From 529e7c9bef57b62529928e34590a5586b873883d Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 17:51:13 +0300 Subject: [PATCH 01/17] fix(eda): recognize small string categories and exclude missing labels Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 9 ++ docs/user_guide/eda_profiling.md | 13 +- .../analysis/opus_core_analysis-open_queue.md | 11 +- .../analysis/opus_core_analysis-tracker.md | 59 ++++++++ skyulf-core/skyulf/preprocessing/pipeline.py | 2 +- .../skyulf/profiling/_analyzer/_utils.py | 24 ++-- .../skyulf/profiling/_analyzer/categorical.py | 7 +- .../skyulf/profiling/_analyzer/column.py | 17 +-- skyulf-core/skyulf/profiling/analyzer.py | 10 +- .../integration/test_profiling_analyzer.py | 7 +- .../test_profiling_string_categories.py | 132 ++++++++++++++++++ .../integration/test_eda_profiling_dtypes.py | 19 +++ 12 files changed, 272 insertions(+), 38 deletions(-) create mode 100644 skyulf-core/tests/integration/test_profiling_string_categories.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 17ef1616a..a42cbf5e8 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -3,6 +3,15 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- +## v0.8.21 + +- **EDA string categories (OC-110):** recognize repeated labels in small + datasets so categorical statistics and classification target analysis are + available. Infer from non-missing values; preserve unique strings as text. + Rerun saved analyses to refresh their results. +- **EDA category counts (OC-247):** exclude missing values from distinct and + rare-label counts and keep them from displacing observed top categories. + ## v0.8.20 - **EDA causal analysis (OC-235–238):** correct reversed arrows, retain the diff --git a/docs/user_guide/eda_profiling.md b/docs/user_guide/eda_profiling.md index 94c37a379..e49937457 100644 --- a/docs/user_guide/eda_profiling.md +++ b/docs/user_guide/eda_profiling.md @@ -72,7 +72,9 @@ The analyzer automatically detects column types (Numeric, Categorical, Date, Tex * *Normality Tests:* For performance, normality tests are performed on a sample of up to 5,000 rows. * **Shapiro-Wilk:** Used for N < 5,000. * **Kolmogorov-Smirnov:** Used for N >= 5,000 (on a 5k sample). -* **Categorical:** Unique count, Mode, Frequency distribution. +* **Categorical:** Unique count, Mode, Frequency distribution. Unique and + rare-label counts and the top categories exclude missing values, which + are reported separately in the column's missing count and percentage. * **Date:** Min/Max date, Range, Year/Month distribution. * **Text:** Avg length, Common words, **Sentiment Analysis** (Positive/Neutral/Negative). @@ -83,6 +85,15 @@ missing percentage and quality alerts remain available, while type-specific statistics are omitted. An all-null column with a declared type, such as `Float64`, retains that type's profile. +String columns are treated as categorical when fewer than 5% of their +non-missing values are distinct, or when they contain at most 20 distinct +non-missing values with at least one repetition. This also recognizes small +datasets with repeated class or city labels. Missing values do not count as +labels or dilute the ratio; all-null strings and strings with no repeated +values remain Text. A recognized string target receives classification +statistics, associations and rule discovery when numeric features are available. +Rerun saved analyses to refresh their inferred types and target results. + ### 2. Smart Alerts Skyulf automatically flags potential data quality issues: * **High Null Rate:** Columns with >50% missing values. diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 576f0cc26..dea7614fa 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -15,7 +15,7 @@ file deliberately carries no history. per-area report files `00`–`18`). **Baseline:** commit `93d7719e` (master), audit run 2026-08-31 β†’ 09-01 by 15 parallel read-only agents (Claude Opus 5). 116 findings: 5 πŸ”΄ / 45 🟠 / 44 🟑 / -22 βšͺ, plus OC-160–246 filed by later reviews. OC-100 was retracted as a false +22 βšͺ, plus OC-160–247 filed by later reviews. OC-100 was retracted as a false positive and is not counted; the corrections pass stays in the archive. **Status key:** ⬜ open Β· 🟨 in progress Β· βœ… done Β· ⏭️ parked @@ -27,6 +27,9 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue +**Current status (2026-09-12): 37 open / 4 parked.** OC-110 and the newly filed +OC-247 are closed in the archive. + Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide deployment model), **Ongoing** (remove the hiding conditions). Remaining findings @@ -60,7 +63,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/column.py`, `analyzer.py:502`) | small | ⬜ open | | OC-113 | 🟠 | Near-perfect multicollinearity silently reports VIF = 1.0 β€” `max(1.0, …)` clamps numerical garbage (`numeric.py:32-63`) | small | ⬜ open | | OC-120 | 🟠 | `Decimal` columns silently skipped by every auto-numeric node; crash pandas when selected explicitly (`engines/__init__.py`, `preprocessing/_helpers.py`) | small | ⬜ open | | OC-91 | 🟑 | Three public `core/` seams (263 lines) have zero call sites; one duplicates a differently-shaped backend class name | small | ⬜ open | @@ -191,8 +193,9 @@ key β€” also the fastest way to find drift the audit missed). **Status:** ⬜ open β€” specification recorded at the user's request on 2026-09-10; deferred for a later implementation pass. This is a cross-layer enhancement, -not a newly reproduced OC finding. It does not change the **63 open / 4 parked** -audit counts. OC-224 remains fixed; OC-223 is a separate alert-note lifecycle bug. +not a newly reproduced OC finding. At filing, the audit contained **63 open / +4 parked** findings; this enhancement did not change those counts. OC-224 remains +fixed; OC-223 is a separate alert-note lifecycle bug. **Goal:** let the user upload one raw dataset and choose which representation to monitor. Both modes must compare the same preprocessing stage on each side. diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 6908709a9..fc4a64fa7 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -184,6 +184,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/_utils.py`, `analyzer.py`) | small | βœ… fixed 2026-09-12 β€” infer repeated small string categories from non-null counts in both profiling paths, restoring statistics and classification target analysis. | | OC-114 | 🟑 | All-null tracked column yields 30 `NaN` autocorrelation lags as real analysis (β‰₯1000-row datasets) (`temporal.py:167-191`) | small | βœ… fixed 2026-09-09 - undefined temporal diagnostics are omitted unless sufficient finite varying observations and finite results support them. | | OC-112 | βšͺ | Comment and code disagree in the categorical profiler β€” the comment promises a rendered missing-value marker, the code `continue`s and discards the null category (`profiling/_analyzer/categorical.py:22-30`). *Filed as "disagree about the applied threshold"; the real subject is the null-category marker* | 1 line | βœ… fixed 2026-09-06 β€” comment-only, no behaviour change; the reasoning for why dropping the null category is correct now lives in the code comment it rewrote. See the log entry | | OC-148 | 🟑 | PII detector flags ordinary 7+ digit numeric ID columns as "Email/Phone" (`profiling/_analyzer/text.py:107-128`) | small | βœ… fixed 2026-09-07 β€” phone detection now requires positive format evidence and repeated sample evidence; plain IDs, ZIP+4, and isolated phone-shaped IDs are excluded | @@ -240,6 +241,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-247 | 🟑 | Missing categorical values inflate unique/rare-label counts and consume a top-10 frequency slot (`profiling/analyzer.py`, `_analyzer/categorical.py`) | small | βœ… filed and fixed 2026-09-12 β€” exclude nulls before frequency ranking and rare-label aggregation, and remove the null entry from the distinct-label count. | | OC-235 | 🟠 | Directed causal edges are serialized backwards (`profiling/_analyzer/causal.py`) | small | βœ… fixed 2026-09-11 β€” preserve causal-learn endpoint order; real graph objects and public collider regressions verify both orientations. | | OC-236 | 🟠 | Nominal target codes feed Pearson/Fisher-Z as numeric magnitudes, making results depend on category order (`profiling/analyzer.py`) | design + medium | βœ… fixed 2026-09-11 β€” omit categorical targets from numeric analysis while preserving category associations; numeric task overrides and omission metadata are explicit. | | OC-237 | 🟑 | The causal graph cap guesses the target from column names and can omit the actual selection (`profiling/_analyzer/causal.py`) | small | βœ… fixed 2026-09-11 β€” retain the explicitly selected eligible numeric target and record all/target-correlation/variance selection. | @@ -398,6 +400,63 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-110/247 fixed: observed string categories and counts + +Public `EDAAnalyzer.analyze(target_col="label")` reproduced the filed failure +for 50 rows / 3 labels and 100 rows / 5 or 10 labels: the target was `Text`, +`task_type` and `rule_tree` were `None`, categorical statistics were absent, +and target associations were empty. The new regressions and updated customer +sample expectation produced **13 expected failures / 8 passing controls** +before the production change. + +Both the batched and per-series inference paths now pass their column counts +to the same helper. Strings are categorical when fewer than 5% of observed +values are distinct, or when at most 20 distinct observed values include a +repetition. Nulls are excluded from both the distinct count and denominator. +Unlike the source audit's blanket small-vocabulary suggestion, the repetition +guard preserves all-unique strings as Text. All-null strings remain Text +regardless of frame size. Integer inference and native Categorical/Enum +behavior are unchanged; OC-50 and OC-111 remain open. + +Regressions cover the 5% boundary, 20/21 distinct labels, nulls at the small +vocabulary boundary, sparse strings, constant labels, all-unique text and +large low-ratio vocabularies. Full target analysis verifies categorical +statistics, classification, rules, associations and balance advice. The +backend analysis/JSON serialization regression verifies the saved report +contains these results without altering source rows. The checked-in customer +sample now correctly profiles repeated city labels as Categorical. + +Independent review also identified **OC-247**, reproduced for both strings +and native categoricals: `["a", "a", None]` reported two distinct and two rare +labels; 99 copies of `"a"` plus null still reported two distinct labels and +one rare label. A null-heavy column with ten observed categories displayed +only nine because null occupied a top-ten slot before being removed. +Eight new regressions failed before this correction. Category frequencies now +drop nulls before ranking/counting, and the distinct-label count removes the +null entry. Tests cover String/Categorical/Enum, low/high frequency labels, +the top-ten boundary and all-null native categories. Missing counts remain +available independently; source rows and native semantic types are preserved. +OC-247 is filed closed here; it does not increase the live queue count. + +Final verification: **543 tests passed** across all `test_profiling_*.py` modules +and the six backend EDA suites (`test_eda_api`, `test_eda_router_extra`, +`test_eda_tasks_extra`, `test_eda_profiling_dtypes`, `test_eda_target_contract`, +`test_eda_target_association_missing_values`). The run reports 133 dependency, +numeric edge-case and plotting warnings, with no failures. Command: repository +`.venv/Scripts/python.exe -m pytest` with those paths, `-q --tb=short +-p no:cacheprovider --basetemp=tmp_repro_artifacts/oc110-oc247-final-pytest`. +The log is `tmp_repro_artifacts/oc110-oc247-final-tests.log` (ignored). +Repository-wide Ruff, the configured backend/Core Ty scope and formatting of +all seven touched Python files pass. Follow-up review found no remaining issue +in the correction. The EDA user guide and v0.8.20 release notes +describe the heuristic and rerunning saved analyses. OC-110 moves to the +archive; the live queue now contains **37 open / 4 parked** findings. + +Commit verification repeated the **543-test** run and passed Ruff/Ty again. +`mkdocs build --strict` also passes after adding the missing docstring type +for the existing `FeatureEngineer.fit_transform(node_id_prefix)` parameter; +this one-line documentation repair does not change its signature or behavior. + ### 2026-09-11 β€” Web EDA label sorting review The repeated scanner finding referred to the single bare `.sort()` in diff --git a/skyulf-core/skyulf/preprocessing/pipeline.py b/skyulf-core/skyulf/preprocessing/pipeline.py index de2d3331e..bc222717c 100644 --- a/skyulf-core/skyulf/preprocessing/pipeline.py +++ b/skyulf-core/skyulf/preprocessing/pipeline.py @@ -101,7 +101,7 @@ def fit_transform( Args: data: Input frame, feature-target pair, or existing split dataset. - node_id_prefix: Prefix for the per-step transformer identifiers. + node_id_prefix (str): Prefix for the per-step transformer identifiers. target_column: Execution target excluded from automatic feature selection. on_split: Optional synchronous callback receiving the first actual row split before later transformations run. Skipped splitters and diff --git a/skyulf-core/skyulf/profiling/_analyzer/_utils.py b/skyulf-core/skyulf/profiling/_analyzer/_utils.py index 20a020616..c9f53bf82 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/_utils.py +++ b/skyulf-core/skyulf/profiling/_analyzer/_utils.py @@ -23,18 +23,20 @@ def _collect(lf: pl.LazyFrame) -> pl.DataFrame: ) -def _dtype_to_semantic_bucket(dtype: Any, ratio: float, n_unique: int) -> str: - """Map a Polars dtype + cardinality ratio/count to a semantic bucket. +def _dtype_to_semantic_bucket(dtype: Any, n_unique: int, count: int, null_count: int = 0) -> str: + """Map a Polars dtype and column counts to a semantic bucket. Shared by ``ColumnMixin._get_semantic_type`` (per-series, used during the - main per-column analysis pass) and ``EDAAnalyzer._semantic_type_for_column`` - (dtype-only, used by the inline/vectorized inference pass that reuses + main per-column analysis pass) and ``EDAAnalyzer._infer_semantic_types`` + (used by the inline/vectorized inference pass that reuses already-computed ``n_unique`` counts) so the Numeric/Categorical/Boolean/ DateTime/Text buckets never drift apart between the two call sites. - ``ratio`` is ``n_unique / row_count`` (0 when there are no rows). - Low-cardinality ints (``ratio < 0.05`` and ``n_unique < 20``) and - low-cardinality strings (``ratio < 0.05``) are treated as Categorical. + ``n_unique`` includes null when present; ``count`` includes every row. + Integers are Categorical when ``n_unique / count < 0.05`` and + ``n_unique < 20``. Strings use only non-null values: a unique ratio below + 0.05, or at most 20 distinct values with repetition, is Categorical. + All-null strings and strings with no repeated values remain Text. Native Categorical/Enum dtypes remain Categorical at any cardinality. Null dtype has no inferable type, so Unknown preserves missing-value reporting without dispatching to type-specific aggregates. @@ -44,13 +46,19 @@ def _dtype_to_semantic_bucket(dtype: Any, ratio: float, n_unique: int) -> str: if dtype in (pl.Float32, pl.Float64): return "Numeric" if dtype in _INT_DTYPES: + ratio = n_unique / count if count > 0 else 0 return "Categorical" if (ratio < 0.05 and n_unique < 20) else "Numeric" if dtype == pl.Boolean: return "Boolean" if dtype in (pl.Date, pl.Datetime, pl.Duration): return "DateTime" if dtype in (pl.Utf8, pl.String): - return "Categorical" if ratio < 0.05 else "Text" + observed_unique = n_unique - int(null_count > 0) + observed_count = count - null_count + if observed_count == 0 or observed_unique == observed_count: + return "Text" + ratio = observed_unique / observed_count + return "Categorical" if ratio < 0.05 or observed_unique <= 20 else "Text" if dtype in (pl.Categorical, pl.Enum): return "Categorical" return "Text" diff --git a/skyulf-core/skyulf/profiling/_analyzer/categorical.py b/skyulf-core/skyulf/profiling/_analyzer/categorical.py index 593658f98..3f79752de 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/categorical.py +++ b/skyulf-core/skyulf/profiling/_analyzer/categorical.py @@ -8,7 +8,8 @@ class CategoricalMixin(_AnalyzerState): """Categorical helpers for :class:`EDAAnalyzer`.""" def _analyze_categorical(self, col: str, row: dict, basic: dict) -> CategoricalStats: - unique_count = basic.get(f"{col}__unique", 0) + """Report observed labels separately from the column's missing-value count.""" + unique_count = basic.get(f"{col}__unique", 0) - int(basic.get(f"{col}__null", 0) > 0) top_k_list = row.get(f"{col}__top_k", []) top_k = [] @@ -21,8 +22,8 @@ def _analyze_categorical(self, col: str, row: dict, basic: dict) -> CategoricalS continue value = item[val_key] if value is None: - # Polars' `value_counts` includes null as a real category. - # Drop it rather than stringify it: `str(None)` would put a + # Defend against null entries in supplied aggregates: + # `str(None)` would put a # literal "None" in top_k, indistinguishable from a genuine # category value of that name. Null frequency is still # reported by ColumnProfile.missing_count/missing_percentage. diff --git a/skyulf-core/skyulf/profiling/_analyzer/column.py b/skyulf-core/skyulf/profiling/_analyzer/column.py index 63ab50417..c996b7d06 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/column.py +++ b/skyulf-core/skyulf/profiling/_analyzer/column.py @@ -29,19 +29,10 @@ class ColumnMixin(_AnalyzerState): def _get_semantic_type(self, series: pl.Series) -> str: """Map polars dtype + cardinality heuristics to a semantic bucket.""" dtype = series.dtype - if dtype in _INT_DTYPES or dtype in (pl.Utf8, pl.String): - n_unique = series.n_unique() - count = len(series) - ratio = n_unique / count if count > 0 else 0 - else: - # Non-int/string dtypes (Float, Boolean, Date/Datetime/Duration, - # Categorical, Object, ...) never consult ratio/n_unique in - # _dtype_to_semantic_bucket, so skip n_unique() β€” it can be - # unsupported for some dtypes (e.g. Object) and is otherwise - # wasted work. - n_unique = 0 - ratio = 0.0 - return _dtype_to_semantic_bucket(dtype, ratio, n_unique) + # Only integers and strings consult cardinality; other dtypes may not + # support n_unique() (e.g. Object), so avoid querying it for them. + n_unique = series.n_unique() if dtype in _INT_DTYPES or dtype in (pl.Utf8, pl.String) else 0 + return _dtype_to_semantic_bucket(dtype, n_unique, len(series), series.null_count()) def _add_high_null_alert(self, col: str, null_pct: float, alerts: list[Alert]) -> None: """Flag columns with more than 5% missing values.""" diff --git a/skyulf-core/skyulf/profiling/analyzer.py b/skyulf-core/skyulf/profiling/analyzer.py index 5df11ee44..b3603f626 100644 --- a/skyulf-core/skyulf/profiling/analyzer.py +++ b/skyulf-core/skyulf/profiling/analyzer.py @@ -227,8 +227,10 @@ def _infer_semantic_types(self, basic_stats: dict) -> dict[str, str]: for col in self.columns: dtype = self.df[col].dtype n_unique = basic_stats.get(f"{col}__unique", 0) - ratio = n_unique / self.row_count if self.row_count > 0 else 0 - semantic_types[col] = _dtype_to_semantic_bucket(dtype, ratio, n_unique) + null_count = basic_stats.get(f"{col}__null", 0) + semantic_types[col] = _dtype_to_semantic_bucket( + dtype, n_unique, self.row_count, null_count + ) return semantic_types def _numeric_advanced_aggs(self, col: str) -> list[pl.Expr]: @@ -255,9 +257,9 @@ def _numeric_advanced_aggs(self, col: str) -> list[pl.Expr]: ] def _categorical_advanced_aggs(self, col: str) -> list[pl.Expr]: - """Advanced aggregation expressions for a Categorical column.""" + """Aggregate observed category frequencies without treating null as a label.""" # The nested value/count struct has its own names, independent of user columns. - values = pl.col(col).alias("value") + values = pl.col(col).drop_nulls().alias("value") return [ values.value_counts(sort=True).head(10).implode().alias(f"{col}__top_k"), (values.value_counts().struct.field("count") < 5).sum().alias(f"{col}__rare"), diff --git a/skyulf-core/tests/integration/test_profiling_analyzer.py b/skyulf-core/tests/integration/test_profiling_analyzer.py index 6add8319d..ef541d266 100644 --- a/skyulf-core/tests/integration/test_profiling_analyzer.py +++ b/skyulf-core/tests/integration/test_profiling_analyzer.py @@ -738,10 +738,9 @@ def test_analyze_profiles_numeric_categorical_geo_and_date_columns(self) -> None assert profile.columns["age"].numeric_stats is not None assert profile.columns["age"].missing_percentage > 0 - # city is a low-cardinality string, but with only 15 rows its unique - # ratio (4/14 non-null) is above the 5% categorical threshold, so it's - # classified as free-form Text rather than Categorical. - assert profile.columns["city"].dtype == "Text" + # Repeated city labels remain categorical even in this small sample. + assert profile.columns["city"].dtype == "Categorical" + assert profile.columns["city"].categorical_stats is not None assert profile.columns["city"].missing_percentage > 0 # signup_date should be auto-detected and cast to a Date/Datetime dtype. diff --git a/skyulf-core/tests/integration/test_profiling_string_categories.py b/skyulf-core/tests/integration/test_profiling_string_categories.py new file mode 100644 index 000000000..685f5b76e --- /dev/null +++ b/skyulf-core/tests/integration/test_profiling_string_categories.py @@ -0,0 +1,132 @@ +"""Observed string categories must reach accurate target statistics (OC-110/247).""" + +import polars as pl +import pytest + +from skyulf.profiling.analyzer import EDAAnalyzer + + +@pytest.mark.parametrize( + ("row_count", "class_count"), [(50, 3), (100, 5), (100, 6), (100, 10), (40, 20)] +) +def test_small_string_target_reaches_classification(row_count: int, class_count: int) -> None: + """Repeated class labels must retain target analysis above the 5% cardinality ratio.""" + frame = pl.DataFrame( + { + "signal": [10.0 * (i % class_count) + 0.01 * i for i in range(row_count)], + "label": [f"class_{i % class_count}" for i in range(row_count)], + } + ) + analyzer = EDAAnalyzer(frame) + + profile = analyzer.analyze(target_col="label") + + column = profile.columns["label"] + assert column.dtype == "Categorical" + assert analyzer._get_semantic_type(analyzer.df["label"]) == "Categorical" + assert column.categorical_stats is not None + assert column.categorical_stats.unique_count == class_count + assert column.text_stats is None + assert profile.task_type == "Classification" + assert profile.rule_tree is not None + assert profile.target_correlations is not None + assert 0.99 < profile.target_correlations["signal"] <= 1.0 + assert any( + r.column == "label" and r.reason == "Balanced Target" for r in profile.recommendations + ) + + +@pytest.mark.parametrize( + ("values", "expected_type"), + [ + pytest.param(["a", "b", "a", "b"], "Categorical", id="small-repeated-labels"), + pytest.param(["a", "a", None], "Categorical", id="repeated-label-with-null"), + pytest.param( + [f"class_{i}" for i in range(20)] * 2 + [None], + "Categorical", + id="twenty-labels-plus-null", + ), + pytest.param(["a", "b", "c"], "Text", id="unique-small-strings"), + pytest.param(["a", "b", None, None], "Text", id="nulls-are-not-repeated-labels"), + pytest.param(["a"] + [None] * 99, "Text", id="nulls-cannot-dilute-cardinality"), + pytest.param([None] * 4, "Text", id="all-null-small"), + pytest.param([None] * 100, "Text", id="all-null-large"), + pytest.param(["one sentence"], "Text", id="single-observation"), + pytest.param(["constant"] * 4, "Categorical", id="constant-label"), + pytest.param( + [f"class_{i}" for i in range(21)] * 2, "Text", id="above-small-vocabulary-limit" + ), + pytest.param( + [f"class_{i}" for i in range(60)] * 25, + "Categorical", + id="large-vocabulary-low-ratio", + ), + pytest.param([f"sentence number {i}" for i in range(30)], "Text", id="unique-text"), + ], +) +def test_string_inference_uses_observed_categories( + values: list[str | None], expected_type: str +) -> None: + """Both inference paths must distinguish repeated labels from missing or unique text.""" + series = pl.Series("value", values, dtype=pl.String) + analyzer = EDAAnalyzer(series.to_frame()) + + profile = analyzer.analyze() + + column = profile.columns["value"] + assert analyzer._get_semantic_type(series) == expected_type + assert column.dtype == expected_type + assert column.missing_count == series.null_count() + if expected_type == "Categorical": + assert column.categorical_stats is not None + assert column.text_stats is None + else: + assert column.text_stats is not None + assert column.categorical_stats is None + + +@pytest.mark.parametrize("dtype", [pl.String, pl.Categorical, pl.Enum(["a"])]) +@pytest.mark.parametrize(("observed_count", "rare_count"), [(2, 1), (99, 0)]) +def test_categorical_counts_exclude_missing_values( + dtype: pl.DataType | type[pl.DataType], observed_count: int, rare_count: int +) -> None: + """A missing value must not inflate the number of categories or rare labels.""" + series = pl.Series("value", ["a"] * observed_count + [None], dtype=dtype) + + column = EDAAnalyzer(series.to_frame()).analyze().columns["value"] + + stats = column.categorical_stats + assert stats is not None + assert stats.unique_count == 1 + assert stats.rare_labels_count == rare_count + assert stats.top_k == [{"value": "a", "count": observed_count}] + assert column.missing_count == 1 + + +def test_missing_values_do_not_displace_top_categories() -> None: + """Missing rows must not consume a frequency slot reserved for an observed label.""" + labels = [f"class_{i}" for i in range(10)] + frame = pl.DataFrame({"value": labels * 2 + [None] * 100}) + + column = EDAAnalyzer(frame).analyze().columns["value"] + + stats = column.categorical_stats + assert stats is not None + assert len(stats.top_k) == 10 + assert {entry["value"]: entry["count"] for entry in stats.top_k} == dict.fromkeys(labels, 2) + assert stats.unique_count == 10 + assert stats.rare_labels_count == 10 + assert column.missing_count == 100 + + +def test_all_null_native_category_has_no_observed_labels() -> None: + """An explicit categorical dtype can retain its type without inventing a null label.""" + frame = pl.DataFrame({"value": pl.Series([None] * 3, dtype=pl.Categorical)}) + + column = EDAAnalyzer(frame).analyze().columns["value"] + + assert column.categorical_stats is not None + assert column.categorical_stats.unique_count == 0 + assert column.categorical_stats.rare_labels_count == 0 + assert column.categorical_stats.top_k == [] + assert column.missing_count == 3 diff --git a/tests/integration/test_eda_profiling_dtypes.py b/tests/integration/test_eda_profiling_dtypes.py index e3e6b854c..8be6e3edd 100644 --- a/tests/integration/test_eda_profiling_dtypes.py +++ b/tests/integration/test_eda_profiling_dtypes.py @@ -26,3 +26,22 @@ def test_eda_report_serializes_null_and_enum_columns() -> None: {"value": "b", "count": 1}, ] assert result["sample_data"] == df.to_dicts() + + +def test_eda_report_serializes_small_string_target_analysis() -> None: + """Saved EDA reports must include classification results for small string targets.""" + df = pl.DataFrame( + { + "signal": [1.0, 1.1, 2.0, 2.1, 3.0, 3.1], + "label": ["small", "small", "medium", "medium", "large", "large"], + } + ) + + result = _run_eda_analyzer(df, {"target_col": "label"}).model_dump(mode="json") + + assert result["columns"]["label"]["dtype"] == "Categorical" + assert result["columns"]["label"]["categorical_stats"]["unique_count"] == 3 + assert result["task_type"] == "Classification" + assert result["rule_tree"] is not None + assert 0.99 < result["target_correlations"]["signal"] <= 1.0 + assert result["sample_data"] == df.to_dicts() From 4fea1ccac4aecc1706d1c1a4654b1190425057fc Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 18:02:37 +0300 Subject: [PATCH 02/17] fix(eda): retain reliable per-feature VIF warnings Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 3 + docs/user_guide/eda_profiling.md | 6 ++ .../analysis/opus_core_analysis-open_queue.md | 5 +- .../analysis/opus_core_analysis-tracker.md | 48 ++++++++++++ .../skyulf/profiling/_analyzer/numeric.py | 45 ++++++++++- .../integration/test_profiling_numeric.py | 77 +++++++++++++++++++ tests/integration/test_eda_vif.py | 25 ++++++ 7 files changed, 202 insertions(+), 7 deletions(-) create mode 100644 tests/integration/test_eda_vif.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index a42cbf5e8..8e3f37a28 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -14,6 +14,9 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). ## v0.8.20 +- **EDA multicollinearity (OC-113):** use regression residuals when correlation + inversion is unstable so near-duplicate features retain high-VIF warnings; + preserve low VIF for unrelated features. Rerun saved analyses to refresh results. - **EDA causal analysis (OC-235–238):** correct reversed arrows, retain the selected numeric target under the feature cap, and replace arbitrary categorical target codes with an explicit numeric-analysis boundary. diff --git a/docs/user_guide/eda_profiling.md b/docs/user_guide/eda_profiling.md index e49937457..089225b93 100644 --- a/docs/user_guide/eda_profiling.md +++ b/docs/user_guide/eda_profiling.md @@ -101,6 +101,12 @@ Skyulf automatically flags potential data quality issues: * **High Cardinality:** Categorical columns with too many unique values. * **High Correlation:** Pairs of features with correlation > 0.95. * **Multicollinearity (VIF):** Detects features with Variance Inflation Factor > 5.0. + Nearly duplicated features still produce warnings when the correlation + matrix cannot be reliably inverted. The calculation then uses a separate + regression for each feature, preserving low VIF for unrelated features. + A value of **999** is a finite warning marker for effectively perfect + dependence, not a precise estimate or a cap on other VIF values. Rerun + saved analyses to refresh these results. * **Class Imbalance:** Target variables with skewed class distributions. * **Data Leakage:** Features with 1.0 correlation to the target. diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index dea7614fa..12e2785d9 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,8 +27,8 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 37 open / 4 parked.** OC-110 and the newly filed -OC-247 are closed in the archive. +**Current status (2026-09-12): 36 open / 4 parked.** OC-110, OC-113 and the newly +filed OC-247 are closed in the archive. Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -63,7 +63,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-113 | 🟠 | Near-perfect multicollinearity silently reports VIF = 1.0 β€” `max(1.0, …)` clamps numerical garbage (`numeric.py:32-63`) | small | ⬜ open | | OC-120 | 🟠 | `Decimal` columns silently skipped by every auto-numeric node; crash pandas when selected explicitly (`engines/__init__.py`, `preprocessing/_helpers.py`) | small | ⬜ open | | OC-91 | 🟑 | Three public `core/` seams (263 lines) have zero call sites; one duplicates a differently-shaped backend class name | small | ⬜ open | | OC-101 | 🟑 | `calibrated_classifier`'s `random_state` no-op for two independent reasons (estimator rejects it AND factories hardcode the seed) | small | ⬜ open | diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index fc4a64fa7..88372f17e 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -185,6 +185,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/_utils.py`, `analyzer.py`) | small | βœ… fixed 2026-09-12 β€” infer repeated small string categories from non-null counts in both profiling paths, restoring statistics and classification target analysis. | +| OC-113 | 🟠 | Near-perfect multicollinearity silently reports VIF = 1.0 β€” `max(1.0, …)` clamps numerical garbage (`profiling/_analyzer/numeric.py`) | small | βœ… fixed 2026-09-12 β€” use per-feature regression residuals for unstable correlation inversion, preserving high-VIF warnings without falsely flagging unrelated columns. | | OC-114 | 🟑 | All-null tracked column yields 30 `NaN` autocorrelation lags as real analysis (β‰₯1000-row datasets) (`temporal.py:167-191`) | small | βœ… fixed 2026-09-09 - undefined temporal diagnostics are omitted unless sufficient finite varying observations and finite results support them. | | OC-112 | βšͺ | Comment and code disagree in the categorical profiler β€” the comment promises a rendered missing-value marker, the code `continue`s and discards the null category (`profiling/_analyzer/categorical.py:22-30`). *Filed as "disagree about the applied threshold"; the real subject is the null-category marker* | 1 line | βœ… fixed 2026-09-06 β€” comment-only, no behaviour change; the reasoning for why dropping the null category is correct now lives in the code comment it rewrote. See the log entry | | OC-148 | 🟑 | PII detector flags ordinary 7+ digit numeric ID columns as "Email/Phone" (`profiling/_analyzer/text.py:107-128`) | small | βœ… fixed 2026-09-07 β€” phone detection now requires positive format evidence and repeated sample evidence; plain IDs, ZIP+4, and isolated phone-shaped IDs are excluded | @@ -400,6 +401,53 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-113 fixed: stable per-feature VIF diagnostics + +After committing OC-110/247 as DCO-signed `529e7c9b` with passing hooks, +the next unparked finding was reproduced through public `EDAAnalyzer.analyze`. +For 100 standard-normal rows from `default_rng(2)`, `b = 2*a + 1e-9*noise` +and an independent third column, the correlation condition number was +`1.811e16`. Both near-duplicate columns reported VIF **1.0**, and no +multicollinearity alerts were emitted. Seeds 3 and 4 reproduced the same +false all-clear. An exact duplicate pair also exposed the old singular fallback +incorrectly assigning 999 to an independent feature. + +Well-conditioned inputs retain the inverse-correlation calculation. Above a +condition number of `1e10`, on inversion failure, or with invalid inverse +diagonal entries, VIF is computed from each feature's regression on the other +centered, normalized features. Direct residual sums avoid the cancellation in +`1 - RΒ²`; the existing finite 999 warning marker applies only to a feature whose +residual variance ratio is at or below float64 epsilon. Unrelated features +retain their own VIF. The seed-2 report now returns **999 / 999 / 1.020194** +and two high-VIF alerts. Constants, missing-row handling and the minimum-row +guard are preserved. + +The approach follows NumPy's documented +[inverse-conditioning caveat](https://numpy.org/doc/stable/reference/generated/numpy.linalg.inv.html) +and [least-squares residual definition](https://numpy.org/doc/stable/reference/generated/numpy.linalg.lstsq.html). +Unlike a blanket 999 fallback or a correlation pseudoinverse, it does not +publish a low VIF for dependent features or blame every feature for a singular +pair. No dependency or wire-format change is needed. + +Tests first produced **9 expected failures / 6 passing controls**, followed +by four failing invalid-inverse cases. All **19 focused tests** now pass. +An orthogonal design has the independently derived VIF `1 + 4/noiseΒ²`, tested +at noise 0.5, 1e-5 and 1e-7, including shifted/scaled columns. Other cases cover +exact dependence with an independent feature, three original false-negative +seeds, negative/sub-one/non-finite inverse outputs, public warnings and backend +JSON serialization with `allow_nan=False`. + +Final verification: **558 tests passed / 133 existing dependency and numeric +edge-case warnings** across every `test_profiling_*.py` module and the seven +backend EDA suites (the prior six plus `test_eda_vif.py`). The run used +`-q --tb=short -p no:cacheprovider +--basetemp=tmp_repro_artifacts/oc113-final-pytest`; output is recorded in ignored +`tmp_repro_artifacts/oc113-final-tests.log`. Repository-wide Ruff, the configured +backend/Core Ty scope, changed Python formatting and diff checks pass. +Independent review found no remaining issue. User documentation and v0.8.20 +release notes explain the warning marker and rerunning saved analyses. +OC-113 moves to the archive; the live queue has **36 open / 4 parked** findings. + ### 2026-09-12 β€” OC-110/247 fixed: observed string categories and counts Public `EDAAnalyzer.analyze(target_col="label")` reproduced the filed failure diff --git a/skyulf-core/skyulf/profiling/_analyzer/numeric.py b/skyulf-core/skyulf/profiling/_analyzer/numeric.py index c2c562d8c..14ade5ca8 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/numeric.py +++ b/skyulf-core/skyulf/profiling/_analyzer/numeric.py @@ -9,6 +9,10 @@ logger = logging.getLogger(__name__) +# Beyond this condition number, a float64 inverse may lose ten precision digits. +_VIF_MAX_CONDITION = 1e10 +_VIF_UNRESOLVED = 999.0 + class NumericMixin(_AnalyzerState): """Numeric helpers for :class:`EDAAnalyzer`.""" @@ -30,10 +34,12 @@ def _analyze_numeric(self, col: str, row: dict) -> NumericStats: ) def _calculate_vif(self, numeric_cols: list[str]) -> dict[str, float] | None: - """Variance Inflation Factor via diagonal of the inverse correlation matrix. + """Calculate VIF, using regression residuals when correlation inversion is unstable. Equivalent to ``1 / (1 - R_i^2)`` where ``R_i^2`` is the RΒ² of regressing feature *i* against all others. ``VIF > 5`` flags multicollinearity. + A residual variance ratio at or below float64 precision returns the + finite high-collinearity marker 999 for that feature only. """ if len(numeric_cols) < 2: return None @@ -52,13 +58,44 @@ def _calculate_vif(self, numeric_cols: list[str]) -> dict[str, float] | None: if np.isnan(corr_matrix).any(): return None + if np.linalg.cond(corr_matrix) > _VIF_MAX_CONDITION: + return self._vif_from_residuals(data, numeric_cols) + try: inv_corr = np.linalg.inv(corr_matrix) except np.linalg.LinAlgError: - # Singular matrix = perfect multicollinearity; flag everything. - return dict.fromkeys(numeric_cols, 999.0) + return self._vif_from_residuals(data, numeric_cols) + + diagonal = np.diag(inv_corr) + if not np.isfinite(diagonal).all() or (diagonal < 1.0 - 1e-10).any(): + return self._vif_from_residuals(data, numeric_cols) - return {col: max(1.0, float(inv_corr[i, i])) for i, col in enumerate(numeric_cols)} + return { + col: max(1.0, float(value)) + for col, value in zip(numeric_cols, diagonal, strict=True) + } except Exception as e: # noqa: BLE001 - VIF is optional; logged, returns None logger.warning(f"Error calculating VIF: {e}") return None + + @staticmethod + def _vif_from_residuals(data: np.ndarray, numeric_cols: list[str]) -> dict[str, float]: + """Use centered, normalized least squares to keep VIF specific to each feature.""" + standardized = np.asarray(data, dtype=np.float64) + standardized = standardized - standardized.mean(axis=0) + standardized /= np.linalg.norm(standardized, axis=0) + + result = {} + for i, col in enumerate(numeric_cols): + target = standardized[:, i] + predictors = np.delete(standardized, i, axis=1) + coefficients = np.linalg.lstsq(predictors, target, rcond=None)[0] + residual = target - predictors @ coefficients + # Computing 1 - RΒ² would erase tiny residuals through cancellation. + residual_ratio = float((residual @ residual) / (target @ target)) + result[col] = ( + _VIF_UNRESOLVED + if residual_ratio <= np.finfo(np.float64).eps + else max(1.0, 1.0 / residual_ratio) + ) + return result diff --git a/skyulf-core/tests/integration/test_profiling_numeric.py b/skyulf-core/tests/integration/test_profiling_numeric.py index 11032fb55..794b935d1 100644 --- a/skyulf-core/tests/integration/test_profiling_numeric.py +++ b/skyulf-core/tests/integration/test_profiling_numeric.py @@ -40,6 +40,83 @@ def test_calculate_vif_singular_matrix_flags_all_columns() -> None: assert result == {"a": 999.0, "b": 999.0} +@pytest.mark.parametrize("noise", [0.5, 1e-5, 1e-7]) +@pytest.mark.parametrize("rescaled", [False, True]) +def test_calculate_vif_matches_known_orthogonal_design(noise: float, rescaled: bool) -> None: + """Near-collinear features need accurate VIF without blaming an orthogonal feature.""" + a = np.tile([-1.0, -1.0, 1.0, 1.0], 25) + independent_noise = np.tile([-1.0, 1.0, -1.0, 1.0], 25) + data = np.column_stack((a, 2 * a + noise * independent_noise, a * independent_noise)) + if rescaled: + data = data * [1e-6, -1000.0, 7.0] + [3.0, 500.0, 29.0] + frame = pl.DataFrame(data, schema=["a", "b", "independent"]) + + result = EDAAnalyzer(frame)._calculate_vif(frame.columns) + + # Var(a)=Var(noise)=1 and Cov(a,noise)=0 give VIF = 1 + 4 / noise**2. + expected = 1.0 + 4.0 / noise**2 + assert result is not None + assert result["a"] == pytest.approx(expected, rel=1e-5) + assert result["b"] == pytest.approx(expected, rel=1e-5) + assert result["independent"] == pytest.approx(1.0) + + +def test_calculate_vif_singular_design_preserves_independent_feature() -> None: + """A duplicated pair must not cause a false removal warning for an unrelated feature.""" + a = np.tile([-1.0, -1.0, 1.0, 1.0], 25) + independent = np.tile([-1.0, 1.0, -1.0, 1.0], 25) + frame = pl.DataFrame({"a": a, "b": 2 * a, "independent": independent}) + + result = EDAAnalyzer(frame)._calculate_vif(frame.columns) + + assert result is not None + assert result["a"] > 10.0 + assert result["b"] > 10.0 + assert result["independent"] == pytest.approx(1.0) + + +@pytest.mark.parametrize("invalid_vif", [-1e22, 0.5, np.nan, np.inf]) +def test_calculate_vif_recovers_from_invalid_inverse_diagonal( + monkeypatch: pytest.MonkeyPatch, invalid_vif: float +) -> None: + """Numerically invalid inverse values must not become an all-clear or non-finite report.""" + a = np.tile([-1.0, -1.0, 1.0, 1.0], 25) + noise = np.tile([-1.0, 1.0, -1.0, 1.0], 25) + frame = pl.DataFrame({"a": a, "b": 2 * a + 0.5 * noise}) + + def invalid_inverse(matrix: np.ndarray) -> np.ndarray: + """Simulate a numerical failure while retaining the real input design.""" + return np.diag([invalid_vif, invalid_vif]) + + monkeypatch.setattr(np.linalg, "inv", invalid_inverse) + + result = EDAAnalyzer(frame)._calculate_vif(frame.columns) + + assert result == pytest.approx({"a": 17.0, "b": 17.0}) + + +@pytest.mark.parametrize("seed", [2, 3, 4]) +def test_near_collinearity_produces_public_vif_alerts(seed: int) -> None: + """An unstable inverse must not turn almost duplicated features into an all-clear.""" + rng = np.random.default_rng(seed) + a = rng.normal(size=100) + frame = pl.DataFrame( + {"a": a, "b": 2 * a + 1e-9 * rng.normal(size=100), "independent": rng.normal(size=100)} + ) + + profile = EDAAnalyzer(frame).analyze() + + assert profile.vif is not None + assert all(np.isfinite(value) for value in profile.vif.values()) + assert profile.vif["a"] > 10.0 + assert profile.vif["b"] > 10.0 + assert profile.vif["independent"] < 5.0 + messages = [alert.message for alert in profile.alerts if alert.type == "Multicollinearity"] + assert len(messages) == 2 + assert any("'a'" in message for message in messages) + assert any("'b'" in message for message in messages) + + def test_calculate_vif_generic_exception_returns_none(monkeypatch: pytest.MonkeyPatch) -> None: """An unexpected exception (e.g. from np.corrcoef) should be caught and return None (lines 60-62).""" rng = np.random.default_rng(1) diff --git a/tests/integration/test_eda_vif.py b/tests/integration/test_eda_vif.py new file mode 100644 index 000000000..1921993bd --- /dev/null +++ b/tests/integration/test_eda_vif.py @@ -0,0 +1,25 @@ +"""Unstable correlation matrices must retain VIF warnings in saved EDA reports.""" + +import json + +import numpy as np +import polars as pl + +from backend.eda.tasks import _run_eda_analyzer + + +def test_eda_report_serializes_near_collinearity_warnings() -> None: + """API consumers must receive finite high VIF and warnings for almost duplicated features.""" + rng = np.random.default_rng(2) + a = rng.normal(size=100) + frame = pl.DataFrame( + {"a": a, "b": 2 * a + 1e-9 * rng.normal(size=100), "independent": rng.normal(size=100)} + ) + + payload = _run_eda_analyzer(frame, None).model_dump(mode="json") + result = json.loads(json.dumps(payload, allow_nan=False)) + + assert result["vif"]["a"] > 10.0 + assert result["vif"]["b"] > 10.0 + assert result["vif"]["independent"] < 5.0 + assert len([alert for alert in result["alerts"] if alert["type"] == "Multicollinearity"]) == 2 From 8425f56f4dbd82c3779691006e66e8a053e3e004 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 18:28:16 +0300 Subject: [PATCH 03/17] fix(preprocessing): process Decimal columns as numeric features Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 5 + docs/reference/preprocessing_nodes.md | 21 ++ .../analysis/opus_core_analysis-open_queue.md | 5 +- .../analysis/opus_core_analysis-tracker.md | 40 +++ .../opus_core_analysis/16-dtype-coverage.md | 7 + skyulf-core/skyulf/preprocessing/_helpers.py | 44 ++- skyulf-core/skyulf/preprocessing/bucketing.py | 3 + .../preprocessing/imputation/_common.py | 3 +- .../skyulf/preprocessing/imputation/simple.py | 11 +- .../skyulf/preprocessing/inspection.py | 7 +- .../skyulf/preprocessing/outliers/iqr.py | 5 +- .../preprocessing/outliers/winsorize.py | 10 +- .../skyulf/preprocessing/outliers/zscore.py | 5 +- .../skyulf/preprocessing/scaling/_common.py | 11 +- .../skyulf/preprocessing/scaling/maxabs.py | 10 +- .../skyulf/preprocessing/scaling/minmax.py | 9 +- .../skyulf/preprocessing/scaling/robust.py | 10 +- .../skyulf/preprocessing/scaling/standard.py | 10 +- .../preprocessing/transformations/power.py | 19 +- skyulf-core/skyulf/utils.py | 35 +- .../tests/integration/test_decimal_numeric.py | 317 ++++++++++++++++++ .../test_catalog_polars_ingestion.py | 31 ++ 22 files changed, 570 insertions(+), 48 deletions(-) create mode 100644 skyulf-core/tests/integration/test_decimal_numeric.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 8e3f37a28..331b3ea9a 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -11,6 +11,11 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). Rerun saved analyses to refresh their results. - **EDA category counts (OC-247):** exclude missing values from distinct and rare-label counts and keep them from displacing observed top categories. +- **Decimal preprocessing (OC-120):** include Decimal columns in numeric + auto-selection on both engines and handle selected values and missingness + safely through scaling, imputation, outlier handling and binning. Numeric + calculations use float64; source frames retain exact Decimal values. Refit + affected pipelines to include columns omitted by older fitted artifacts. ## v0.8.20 diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index 4198e117e..b84c42f9f 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -16,6 +16,27 @@ Every preprocessing step in the pipeline config uses: Where `params` is passed into the node's Calculator `fit()`. +### Decimal numeric columns + +Numeric auto-selection includes Polars `Decimal(precision, scale)` columns and +pandas object columns whose non-missing values are all `decimal.Decimal`. +Numeric strings and mixed Decimal/string columns remain outside automatic +numeric selection. Existing exclusions for booleans, binary values, constants +and all-missing columns still apply according to the node's selection rules. + +Selected Decimal values use float64 for numerical transformations such as +scaling, power transforms and mean/median imputation. This has ordinary floating +point precision, rather than exact decimal arithmetic. Source frames and +unselected columns retain their original values; outlier filtering retains the +original values of kept rows and their matching targets. + +For example, `MinMaxScaler` with `params={}` now scales Decimal prices +`[100.00, 200.00, 300.00, 400.00]` to `[0.0, 0.3333, 0.6667, 1.0]` on both +engines. An explicit `columns=[]` still makes the scaler a no-op. + +Refit pipelines whose previous automatic selection skipped Decimal columns. +Existing fitted artifacts keep their original selection when replayed. + ## Splitters Example step: diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 12e2785d9..5ce7084b3 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,8 +27,8 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 36 open / 4 parked.** OC-110, OC-113 and the newly -filed OC-247 are closed in the archive. +**Current status (2026-09-12): 35 open / 4 parked.** OC-110, OC-113, OC-120 and +the newly filed OC-247 are closed in the archive. Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -63,7 +63,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-120 | 🟠 | `Decimal` columns silently skipped by every auto-numeric node; crash pandas when selected explicitly (`engines/__init__.py`, `preprocessing/_helpers.py`) | small | ⬜ open | | OC-91 | 🟑 | Three public `core/` seams (263 lines) have zero call sites; one duplicates a differently-shaped backend class name | small | ⬜ open | | OC-101 | 🟑 | `calibrated_classifier`'s `random_state` no-op for two independent reasons (estimator rejects it AND factories hardcode the seed) | small | ⬜ open | | OC-111 | 🟑 | A profiling recommendation branch is unreachable | small | ⬜ open | diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 88372f17e..60c86dedf 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -184,6 +184,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-120 | 🟠 | Decimal columns skipped by numeric auto-selection and mishandled during explicit numeric processing (`utils.py`, `preprocessing/_helpers.py` and numeric nodes) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Polars and pandas object Decimals, normalize selected values at numeric boundaries, and preserve missingness, source values and target alignment. | | OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/_utils.py`, `analyzer.py`) | small | βœ… fixed 2026-09-12 β€” infer repeated small string categories from non-null counts in both profiling paths, restoring statistics and classification target analysis. | | OC-113 | 🟠 | Near-perfect multicollinearity silently reports VIF = 1.0 β€” `max(1.0, …)` clamps numerical garbage (`profiling/_analyzer/numeric.py`) | small | βœ… fixed 2026-09-12 β€” use per-feature regression residuals for unstable correlation inversion, preserving high-VIF warnings without falsely flagging unrelated columns. | | OC-114 | 🟑 | All-null tracked column yields 30 `NaN` autocorrelation lags as real analysis (β‰₯1000-row datasets) (`temporal.py:167-191`) | small | βœ… fixed 2026-09-09 - undefined temporal diagnostics are omitted unless sufficient finite varying observations and finite results support them. | @@ -401,6 +402,45 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-120 fixed: Decimal numeric selection and processing + +After committing OC-113 as `4fea1cca`, reproduced OC-120 with Decimal prices +on native and wrapped pandas/Polars frames. Both numeric selectors omitted +prices. The original explicit StandardScaler crash was already repaired; +Robust/MinMax/MaxAbs still raised Decimal/float arithmetic errors on pandas. +Winsorize fitted bounds but skipped Decimal values on both engines, Polars +IQR/ZScore called unsupported Decimal `is_nan`, KNN/Iterative fitting failed +on object NumPy arrays, and binning could silently omit the output column. + +Numeric detection now recognizes parameterized Polars Decimal dtypes and +homogeneous non-missing pandas Decimal objects without accepting numeric +strings or mixed string/Decimal columns. Binary/constant/all-missing exclusions, +target exclusion and explicit empty scaler selections remain intact. Numeric +boundaries convert only selected Decimal columns to float64, including pandas +`pd.NA`; original frames and unselected columns are unchanged. Mean/median +imputation remains numeric for downstream nodes, outlier filters preserve null +rows and matching targets, and DatasetProfile emits numeric Decimal statistics. +Schema promotion also recognizes Decimal dtype labels. + +Verification: + +- The initial public-path regression matrix reproduced **67 failures / 10 + passes**. Added missing-sentinel cases reproduced seven further failures + before repairing fit/apply conversion boundaries. +- **110 Decimal regressions pass**, covering four scalers, power transforms, + imputers, outliers, binning, feature selection/generation, profile statistics, + native/wrapped inputs, Arrow Decimal missingness and precision/scale variants. +- Broader Core preprocessing, utility, engine and schema suites: **1,924 passed, + 2 skipped**. Backend catalog/data-service/preprocessing suites: **65 passed**. +- The real FileSystemCatalog Parquet path feeds automatic SimpleImputer then + MinMaxScaler through FeatureEngineer on both engines; fit and replay produce + `[0.0, 0.5, 1.0]` while retaining the source Decimals and label column. +- Ruff and full configured `ty check` pass. Focused review found no blockers. + +Docs and changelog explain float64 precision and refitting older pipelines whose +artifacts omitted Decimal columns. The live queue has **35 open / 4 parked**; +OC-121 remains open and parked findings remain parked. + ### 2026-09-12 β€” OC-113 fixed: stable per-feature VIF diagnostics After committing OC-110/247 as DCO-signed `529e7c9b` with passing hooks, diff --git a/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md b/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md index 1731fcdfd..40470221c 100644 --- a/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md +++ b/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md @@ -15,6 +15,13 @@ dtype not explicitly listed is silently invisible. Two real dtypes fall through. ## Findings ### OC-120 + +**Resolved 2026-09-12.** See the +[verification and fix log](../opus_core_analysis-tracker.md#2026-09-12-oc-120-fixed-decimal-numeric-selection-and-processing). +The original reproduction below is retained as historical evidence. Numeric +selectors now include Decimal columns; selected values are normalized at numeric +boundaries, with cross-engine fit/apply and Parquet pipeline regressions. + ### 🟠 High β€” `Decimal` columns are silently skipped by every auto-numeric node, and crash pandas when selected explicitly **Files:** `skyulf/engines/__init__.py` (`POLARS_NUMERIC_DTYPES`), diff --git a/skyulf-core/skyulf/preprocessing/_helpers.py b/skyulf-core/skyulf/preprocessing/_helpers.py index 163c28a98..dee65ac89 100644 --- a/skyulf-core/skyulf/preprocessing/_helpers.py +++ b/skyulf-core/skyulf/preprocessing/_helpers.py @@ -29,7 +29,7 @@ SkyulfDataFrame, get_engine, ) -from ..utils import resolve_columns +from ..utils import is_decimal_series, resolve_columns from ._schema import SkyulfSchema @@ -69,7 +69,7 @@ def promote_configured_columns_to_float64( def _is_numeric_schema_dtype(dtype: str | None) -> bool: """Return whether an engine-neutral schema dtype is numeric.""" - return bool(dtype) and dtype.lower().startswith(("int", "uint", "float")) + return bool(dtype) and dtype.lower().startswith(("int", "uint", "float", "decimal")) def safe_scale(scale_arr: np.ndarray) -> np.ndarray: @@ -90,6 +90,16 @@ def to_pandas(X: Any) -> pd.DataFrame: return X.to_pandas() if hasattr(X, "to_pandas") else X +def decimal_columns_to_float(X: pd.DataFrame, columns: Iterable[str]) -> pd.DataFrame: + """Convert selected Decimal object columns for numeric math without mutating input.""" + converted = { + col: X[col].to_numpy(dtype=np.float64, na_value=np.nan) + for col in columns + if is_decimal_series(X[col]) + } + return X.assign(**converted) if converted else X + + def select_rows_by_position(y: Any, positions: Any) -> Any: """Return ``y`` restricted and reordered to exactly ``positions``. @@ -153,6 +163,9 @@ def resolve_columns_then_to_pandas( the selected columns instead of the full input frame avoids paying for unrelated columns on wide frames (large win when few columns of many are selected, neutral when most/all columns are selected). + + Selected pandas Decimal object columns become float64 for numeric math; + the caller's frame and unselected columns retain their original values. """ columns = resolve_columns(X, config, default_selection_func, target_column_key) if hasattr(X, "to_pandas") and not isinstance(X, pd.DataFrame): @@ -160,7 +173,7 @@ def resolve_columns_then_to_pandas( X = (X.select(select_cols) if select_cols else X).to_pandas() else: X = to_pandas(X) - return X, columns + return decimal_columns_to_float(X, columns), columns def resolve_columns_then_to_numpy( @@ -180,15 +193,26 @@ def resolve_columns_then_to_numpy( ``.select(cols).to_numpy()`` is native, no Pandas involved. Pandas inputs still go through ``DataFrame.to_numpy()`` (also native, no extra copy vs. the old ``pandas -> pandas -> numpy`` path). + + Decimal columns are converted to float64 before NumPy consumers run, with + missing values represented as NaN on both engines. """ columns = resolve_columns(X, config, default_selection_func, target_column_key) if not columns: return np.empty((0, 0)), columns - if hasattr(X, "to_pandas") and not isinstance(X, pd.DataFrame): + if is_polars(X): select_cols = [c for c in columns if c in X.columns] - X_np = X.select(select_cols).to_numpy() if select_cols else np.empty((0, 0)) + subset = X.select(select_cols) + decimal_cols = [ + c + for c, dt in zip(subset.columns, subset.dtypes, strict=True) + if isinstance(dt, pl.Decimal) + ] + if decimal_cols: + subset = subset.with_columns(pl.col(decimal_cols).cast(pl.Float64)) + X_np = subset.to_numpy() else: - subset = X[columns] + subset = decimal_columns_to_float(to_pandas(X)[columns], columns) # Nullable extension dtypes (Int64, Float64...) to_numpy() as object # arrays full of pd.NA, which crash sklearn (F-10). Force the # float64/NaN representation the Polars path produces natively. @@ -258,16 +282,18 @@ def auto_detect_text_columns(df: pd.DataFrame | SkyulfDataFrame) -> list[str]: def auto_detect_numeric_columns(df: pd.DataFrame | SkyulfDataFrame) -> list[str]: - """Return numeric columns from either a Pandas or Polars frame.""" + """Return numeric columns, including Decimals, without cardinality exclusions.""" engine = get_engine(df) if engine.name == EngineName.POLARS: polars_df = cast(PolarsBackedFrame, df) return [ c for c, t in zip(polars_df.columns, polars_df.dtypes, strict=True) - if t in POLARS_NUMERIC_DTYPES + if t in POLARS_NUMERIC_DTYPES or isinstance(t, pl.Decimal) ] - return list(cast(PandasBackedFrame, df).select_dtypes(include=["number"]).columns) + frame = to_pandas(df) + numeric = set(frame.select_dtypes(include=["number"]).columns) + return [c for c in frame.columns if c in numeric or is_decimal_series(frame[c])] def auto_detect_datetime_columns(df: pd.DataFrame | SkyulfDataFrame) -> list[str]: diff --git a/skyulf-core/skyulf/preprocessing/bucketing.py b/skyulf-core/skyulf/preprocessing/bucketing.py index 50f6de47c..9cec76b67 100644 --- a/skyulf-core/skyulf/preprocessing/bucketing.py +++ b/skyulf-core/skyulf/preprocessing/bucketing.py @@ -21,6 +21,7 @@ from ..types import DEFAULT_RANDOM_STATE from ..utils import ( detect_numeric_columns, + is_decimal_series, user_picked_no_columns, ) from ._artifacts import GeneralBinningArtifact @@ -225,6 +226,8 @@ def _bin_one_column_pandas( missing_label = params.get("missing_label", "Missing") labels = _resolve_pandas_labels(label_format, edges, custom_labels) + if is_decimal_series(series): + series = pd.to_numeric(series) binned = pd.cut(series, bins=sorted_edges, labels=labels, include_lowest=include_lowest) binned = _apply_missing_strategy(binned, missing_strategy, missing_label) diff --git a/skyulf-core/skyulf/preprocessing/imputation/_common.py b/skyulf-core/skyulf/preprocessing/imputation/_common.py index 90c49a1e5..2798de1b1 100644 --- a/skyulf-core/skyulf/preprocessing/imputation/_common.py +++ b/skyulf-core/skyulf/preprocessing/imputation/_common.py @@ -15,6 +15,7 @@ from ..._validation import raise_invalid_choice from ...engines.sklearn_bridge import SklearnBridge from ...utils import detect_numeric_columns, resolve_columns +from .._helpers import decimal_columns_to_float logger = logging.getLogger(__name__) @@ -88,7 +89,7 @@ def _sklearn_transform_subset(X: Any, cols: list[str], imputer: Any, is_polars: return X.with_columns(new_cols) X_out = X.copy() - X_subset = X_out[cols].copy() + X_subset = decimal_columns_to_float(X_out[cols].copy(), cols) # Nullable extension dtypes (Int64...) hand pd.NA to sklearn and refuse # float results on write-back; upcast them to float64 like the Polars # branch does natively (F-10). diff --git a/skyulf-core/skyulf/preprocessing/imputation/simple.py b/skyulf-core/skyulf/preprocessing/imputation/simple.py index 42ca59ed2..881daf494 100644 --- a/skyulf-core/skyulf/preprocessing/imputation/simple.py +++ b/skyulf-core/skyulf/preprocessing/imputation/simple.py @@ -8,9 +8,9 @@ from ...core.meta.decorators import node_meta from ...registry import NodeRegistry -from ...utils import detect_numeric_columns, user_picked_no_columns +from ...utils import detect_numeric_columns, is_decimal_series, user_picked_no_columns from .._artifacts import SimpleImputerArtifact -from .._helpers import promote_configured_columns_to_float64 +from .._helpers import decimal_columns_to_float, promote_configured_columns_to_float64 from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -86,6 +86,8 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: X_out[col] = val else: series = X_out[col] + if is_decimal_series(series) and params.get("strategy") in {"mean", "median"}: + series = pd.to_numeric(series) # Nullable numeric extension dtypes (Int64...) refuse a float # fill value; upcast like the Polars fill does (F-10). if ( @@ -196,7 +198,10 @@ def _fit_pandas(X: Any, _y: Any, params: dict[str, Any]) -> dict[str, Any]: fill_value=fill_value, keep_empty_features=strategy == "constant", ) - imputer.fit(X[cols]) + fit_data = ( + decimal_columns_to_float(X[cols], cols) if strategy in {"mean", "median"} else X[cols] + ) + imputer.fit(fit_data) if strategy == "constant" and fill_value is not None: # Validation still runs, but heldout missingness must not choose a constant. diff --git a/skyulf-core/skyulf/preprocessing/inspection.py b/skyulf-core/skyulf/preprocessing/inspection.py index 011c28623..5387263b6 100644 --- a/skyulf-core/skyulf/preprocessing/inspection.py +++ b/skyulf-core/skyulf/preprocessing/inspection.py @@ -15,6 +15,7 @@ from ..registry import NodeRegistry from ..utils import detect_numeric_columns from ._artifacts import DatasetProfileArtifact, DataSnapshotArtifact +from ._helpers import decimal_columns_to_float from ._schema import SkyulfSchema from .base import BaseApplier, BaseCalculator, fit_method from .dispatcher import fit_dual_engine @@ -51,7 +52,7 @@ def _profile_fit_polars(X: Any, _y: Any, _config: dict[str, Any]) -> DatasetProf numeric_cols = [ col for col, dtype in zip(X.columns, X.dtypes, strict=True) - if dtype in (pl.Float64, pl.Float32, pl.Int64, pl.Int32) + if dtype in (pl.Float64, pl.Float32, pl.Int64, pl.Int32) or isinstance(dtype, pl.Decimal) ] if numeric_cols: profile["numeric_stats"] = _extract_polars_numeric_stats(X, numeric_cols) @@ -67,7 +68,9 @@ def _profile_fit_pandas(X: Any, _y: Any, _config: dict[str, Any]) -> DatasetProf } numeric_cols = detect_numeric_columns(X) if numeric_cols: - profile["numeric_stats"] = X[numeric_cols].describe().to_dict() + profile["numeric_stats"] = ( + decimal_columns_to_float(X[numeric_cols], numeric_cols).describe().to_dict() + ) return {"type": "dataset_profile", "profile": profile} diff --git a/skyulf-core/skyulf/preprocessing/outliers/iqr.py b/skyulf-core/skyulf/preprocessing/outliers/iqr.py index 16dfd6772..00458db56 100644 --- a/skyulf-core/skyulf/preprocessing/outliers/iqr.py +++ b/skyulf-core/skyulf/preprocessing/outliers/iqr.py @@ -42,7 +42,10 @@ def _apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, Any]: if col not in X.columns: continue col_mask = (pl.col(col) >= bound["lower"]) & (pl.col(col) <= bound["upper"]) - mask = mask & (col_mask | pl.col(col).is_null() | pl.col(col).is_nan()) + missing = pl.col(col).is_null() + if X.schema[col].is_float(): + missing = missing | pl.col(col).is_nan() + mask = mask & (col_mask | missing) mask_series = X.select(mask.alias("mask")).get_column("mask") return X.filter(mask_series), _filter_y_polars(y, mask_series) diff --git a/skyulf-core/skyulf/preprocessing/outliers/winsorize.py b/skyulf-core/skyulf/preprocessing/outliers/winsorize.py index a3b25eac0..00eb06a9b 100644 --- a/skyulf-core/skyulf/preprocessing/outliers/winsorize.py +++ b/skyulf-core/skyulf/preprocessing/outliers/winsorize.py @@ -7,7 +7,7 @@ from ...core.meta.decorators import node_meta from ...registry import NodeRegistry -from ...utils import detect_numeric_columns, user_picked_no_columns +from ...utils import detect_numeric_columns, is_decimal_series, user_picked_no_columns from .._artifacts import WinsorizeArtifact from .._helpers import ( auto_detect_numeric_columns, @@ -61,12 +61,14 @@ def _apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, Any]: for col, bound in bounds.items(): if col not in df_out.columns: continue - if pd.api.types.is_numeric_dtype(df_out[col]): + if pd.api.types.is_numeric_dtype(df_out[col]) or is_decimal_series(df_out[col]): series = df_out[col] # Nullable extension dtypes (Int64...) refuse float clip # bounds; the Polars branch casts to Float64 first (F-10). - if isinstance(series.dtype, pd.api.extensions.ExtensionDtype): - series = series.astype("float64") + if isinstance(series.dtype, pd.api.extensions.ExtensionDtype) or is_decimal_series( + series + ): + series = pd.to_numeric(series).astype("float64") df_out[col] = series.clip(lower=bound["lower"], upper=bound["upper"]) return df_out, y diff --git a/skyulf-core/skyulf/preprocessing/outliers/zscore.py b/skyulf-core/skyulf/preprocessing/outliers/zscore.py index cd3fb1098..3894dfbba 100644 --- a/skyulf-core/skyulf/preprocessing/outliers/zscore.py +++ b/skyulf-core/skyulf/preprocessing/outliers/zscore.py @@ -44,7 +44,10 @@ def _apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, Any]: continue z = (pl.col(col) - stat["mean"]) / stat["std"] col_mask = z.abs() <= threshold - mask = mask & (col_mask | pl.col(col).is_null() | pl.col(col).is_nan()) + missing = pl.col(col).is_null() + if X.schema[col].is_float(): + missing = missing | pl.col(col).is_nan() + mask = mask & (col_mask | missing) mask_series = X.select(mask.alias("mask")).get_column("mask") return X.filter(mask_series), _filter_y_polars(y, mask_series) diff --git a/skyulf-core/skyulf/preprocessing/scaling/_common.py b/skyulf-core/skyulf/preprocessing/scaling/_common.py index 36e9a647a..be26ae27d 100644 --- a/skyulf-core/skyulf/preprocessing/scaling/_common.py +++ b/skyulf-core/skyulf/preprocessing/scaling/_common.py @@ -1,8 +1,15 @@ -"""Shared helpers for scaling nodes (engine-specific subset selection).""" +"""Shared numeric-column selection and Decimal conversion for scaling nodes. + +Automatic selection includes pandas Decimal object columns and Polars Decimal +dtypes. Selected Decimal values use float64 for scaling; source frames and +unselected columns keep their original values. Refit older artifacts to include +Decimal columns that their automatic selection previously omitted. +""" from typing import Any from ...utils import detect_numeric_columns, resolve_columns +from .._helpers import decimal_columns_to_float def _select_subset_polars(X: Any, config: dict[str, Any]) -> tuple[list[str], Any]: @@ -18,4 +25,4 @@ def _select_subset_pandas(X: Any, config: dict[str, Any]) -> tuple[list[str], An cols = resolve_columns(X, config, detect_numeric_columns) if not cols: return [], None - return cols, X[cols] + return cols, decimal_columns_to_float(X[cols], cols) diff --git a/skyulf-core/skyulf/preprocessing/scaling/maxabs.py b/skyulf-core/skyulf/preprocessing/scaling/maxabs.py index 5a14154e6..5870fdbd0 100644 --- a/skyulf-core/skyulf/preprocessing/scaling/maxabs.py +++ b/skyulf-core/skyulf/preprocessing/scaling/maxabs.py @@ -11,7 +11,12 @@ from ...registry import NodeRegistry from ...utils import user_picked_no_columns from .._artifacts import MaxAbsScalerArtifact -from .._helpers import promote_configured_columns_to_float64, resolve_valid_columns, safe_scale +from .._helpers import ( + decimal_columns_to_float, + promote_configured_columns_to_float64, + resolve_valid_columns, + safe_scale, +) from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -52,7 +57,8 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: X_out = X.copy() col_indices = [cols.index(c) for c in valid] - vals = X_out[valid].values + subset = decimal_columns_to_float(X_out[valid], valid) + vals = subset.to_numpy(dtype=np.float64, na_value=np.nan) vals = vals / safe_scale(np.array(scale)[col_indices].copy()) X_out[valid] = vals return X_out, _y diff --git a/skyulf-core/skyulf/preprocessing/scaling/minmax.py b/skyulf-core/skyulf/preprocessing/scaling/minmax.py index ae6e3226b..e02cf0e2c 100644 --- a/skyulf-core/skyulf/preprocessing/scaling/minmax.py +++ b/skyulf-core/skyulf/preprocessing/scaling/minmax.py @@ -11,7 +11,11 @@ from ...registry import NodeRegistry from ...utils import user_picked_no_columns from .._artifacts import MinMaxScalerArtifact -from .._helpers import promote_configured_columns_to_float64, resolve_valid_columns +from .._helpers import ( + decimal_columns_to_float, + promote_configured_columns_to_float64, + resolve_valid_columns, +) from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -53,7 +57,8 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: X_out = X.copy() col_indices = [cols.index(c) for c in valid] - vals = X_out[valid].values + subset = decimal_columns_to_float(X_out[valid], valid) + vals = subset.to_numpy(dtype=np.float64, na_value=np.nan) vals = vals * np.array(scale)[col_indices] + np.array(min_val)[col_indices] X_out[valid] = vals return X_out, _y diff --git a/skyulf-core/skyulf/preprocessing/scaling/robust.py b/skyulf-core/skyulf/preprocessing/scaling/robust.py index 2d0a50c5f..d3b485267 100644 --- a/skyulf-core/skyulf/preprocessing/scaling/robust.py +++ b/skyulf-core/skyulf/preprocessing/scaling/robust.py @@ -11,7 +11,12 @@ from ...registry import NodeRegistry from ...utils import user_picked_no_columns from .._artifacts import RobustScalerArtifact -from .._helpers import promote_configured_columns_to_float64, resolve_valid_columns, safe_scale +from .._helpers import ( + decimal_columns_to_float, + promote_configured_columns_to_float64, + resolve_valid_columns, + safe_scale, +) from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -66,7 +71,8 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: X_out = X.copy() col_indices = [cols.index(c) for c in valid] - vals = X_out[valid].values + subset = decimal_columns_to_float(X_out[valid], valid) + vals = subset.to_numpy(dtype=np.float64, na_value=np.nan) if params.get("with_centering", True) and center is not None: vals = vals - np.array(center)[col_indices] diff --git a/skyulf-core/skyulf/preprocessing/scaling/standard.py b/skyulf-core/skyulf/preprocessing/scaling/standard.py index 16b166705..565985325 100644 --- a/skyulf-core/skyulf/preprocessing/scaling/standard.py +++ b/skyulf-core/skyulf/preprocessing/scaling/standard.py @@ -12,7 +12,12 @@ from ...registry import NodeRegistry from ...utils import user_picked_no_columns from .._artifacts import StandardScalerArtifact -from .._helpers import promote_configured_columns_to_float64, resolve_valid_columns, safe_scale +from .._helpers import ( + decimal_columns_to_float, + promote_configured_columns_to_float64, + resolve_valid_columns, + safe_scale, +) from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -95,7 +100,8 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: X_out = X.copy() col_indices = [cols.index(c) for c in valid] - vals = X_out[valid].to_numpy(dtype=np.float64, na_value=np.nan) + subset = decimal_columns_to_float(X_out[valid], valid) + vals = subset.to_numpy(dtype=np.float64, na_value=np.nan) if with_mean: vals = vals - np.array(mean)[col_indices] if with_std: diff --git a/skyulf-core/skyulf/preprocessing/transformations/power.py b/skyulf-core/skyulf/preprocessing/transformations/power.py index 7f3b595bf..38646ee45 100644 --- a/skyulf-core/skyulf/preprocessing/transformations/power.py +++ b/skyulf-core/skyulf/preprocessing/transformations/power.py @@ -12,7 +12,11 @@ from ...registry import NodeRegistry from ...utils import detect_numeric_columns, user_picked_no_columns from .._artifacts import PowerTransformerArtifact -from .._helpers import promote_configured_columns_to_float64, resolve_columns_then_to_pandas +from .._helpers import ( + decimal_columns_to_float, + promote_configured_columns_to_float64, + resolve_columns_then_to_pandas, +) from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine @@ -131,16 +135,13 @@ def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: # Computed before the copy so a failure hands back the caller's frame # rather than one whose columns were already cast to float64, matching # what the polars path returns. - X_vals = X[valid_cols].to_numpy() + subset = decimal_columns_to_float(X[valid_cols], valid_cols) + X_vals = subset.to_numpy(dtype=np.float64, na_value=np.nan) X_trans = np.asarray(_power_transform_array(X_vals, params, cols, valid_cols)) df_out = X.copy() - # The transform result is float; writing it into an integer column is - # the pandas "incompatible dtype" FutureWarning, slated to become an - # error β€” which the bare except below would swallow into a silent - # no-op that returns untransformed data. Cast first. - for col in valid_cols: - df_out[col] = df_out[col].astype("float64") - df_out.loc[:, valid_cols] = X_trans + # Replace selected columns so nullable integers and Decimal objects + # can receive float results without incompatible-dtype assignment. + df_out[valid_cols] = X_trans except Exception: # noqa: BLE001 - transform failure is logged; frame left unchanged logger.exception("PowerTransformer (Pandas) application failed") return X, _y diff --git a/skyulf-core/skyulf/utils.py b/skyulf-core/skyulf/utils.py index f48594e83..23900b136 100644 --- a/skyulf-core/skyulf/utils.py +++ b/skyulf-core/skyulf/utils.py @@ -9,6 +9,7 @@ import contextlib import logging from collections.abc import Callable +from decimal import Decimal from typing import Any, cast import numpy as np @@ -214,7 +215,7 @@ def _is_binary_numeric(series: pd.Series | Any) -> bool: unique_vals = series.drop_nulls().unique() if len(unique_vals) > 2: return False - return all(np.isclose(val, 0) or np.isclose(val, 1) for val in unique_vals) + return all(_is_close_to_binary(val) for val in unique_vals) # Pandas Series unique_vals = series.dropna().unique() @@ -222,13 +223,34 @@ def _is_binary_numeric(series: pd.Series | Any) -> bool: return False # Check if values are close to 0 or 1 - return all(np.isclose(val, 0) or np.isclose(val, 1) for val in unique_vals) + return all(_is_close_to_binary(val) for val in unique_vals) + + +def _is_close_to_binary(value: Any) -> bool: + """Compare Decimal values using the same float tolerance as other numeric values.""" + if isinstance(value, Decimal): + value = float(value) + return bool(np.isclose(value, 0) or np.isclose(value, 1)) + + +def is_decimal_series(series: pd.Series) -> bool: + """Recognize homogeneous non-missing Decimal values in a pandas object column. + + Numeric strings and mixed object columns remain non-numeric. Native numeric + and Arrow dtypes are handled by the usual dtype predicates. + """ + return bool( + pd.api.types.is_object_dtype(series.dtype) + and pd.api.types.infer_dtype(series, skipna=True) == "decimal" + ) def _polars_numeric_dtype_cols(frame: Any) -> list[str]: - """List the columns of a Polars frame whose dtype is numeric (float/int/uint).""" + """List Polars numeric columns, including parameterized Decimal dtypes.""" return [ - c for c, t in zip(frame.columns, frame.dtypes, strict=True) if t in POLARS_NUMERIC_DTYPES + c + for c, t in zip(frame.columns, frame.dtypes, strict=True) + if t in POLARS_NUMERIC_DTYPES or isinstance(t, pl.Decimal) ] @@ -267,7 +289,7 @@ def _pandas_column_excluded(series: Any, exclude_binary: bool, exclude_constant: if pd.api.types.is_bool_dtype(dtype): return True # Strict Numeric Check (Align with Polars behavior) - if not pd.api.types.is_numeric_dtype(dtype): + if not pd.api.types.is_numeric_dtype(dtype) and not is_decimal_series(series): return True valid = series.dropna() @@ -306,6 +328,9 @@ def detect_numeric_columns( ) -> list[str]: """Find numeric-like columns. + Includes Polars Decimal dtypes and pandas object columns whose observed + values are all ``decimal.Decimal``. Detection does not convert values. + Args: frame: DataFrame to analyze exclude_binary: If True, excludes columns with only 0/1 values. diff --git a/skyulf-core/tests/integration/test_decimal_numeric.py b/skyulf-core/tests/integration/test_decimal_numeric.py new file mode 100644 index 000000000..971d919db --- /dev/null +++ b/skyulf-core/tests/integration/test_decimal_numeric.py @@ -0,0 +1,317 @@ +"""Decimal columns must participate in numeric preprocessing on both engines.""" + +from decimal import Decimal +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest +from sklearn.preprocessing import ( + MaxAbsScaler, + MinMaxScaler, + PowerTransformer, + RobustScaler, + StandardScaler, +) + +from skyulf.core.schema import SkyulfSchema +from skyulf.engines.registry import EngineRegistry +from skyulf.preprocessing._helpers import auto_detect_numeric_columns +from skyulf.preprocessing.bucketing import GeneralBinningApplier, GeneralBinningCalculator +from skyulf.preprocessing.feature_generation.polynomial import ( + PolynomialFeaturesApplier, + PolynomialFeaturesCalculator, +) +from skyulf.preprocessing.feature_selection.correlation import CorrelationThresholdCalculator +from skyulf.preprocessing.feature_selection.model_based import ModelBasedSelectionCalculator +from skyulf.preprocessing.feature_selection.univariate import UnivariateSelectionCalculator +from skyulf.preprocessing.feature_selection.variance import VarianceThresholdCalculator +from skyulf.preprocessing.imputation.iterative import ( + IterativeImputerApplier, + IterativeImputerCalculator, +) +from skyulf.preprocessing.imputation.knn import KNNImputerApplier, KNNImputerCalculator +from skyulf.preprocessing.imputation.simple import SimpleImputerApplier, SimpleImputerCalculator +from skyulf.preprocessing.inspection import DatasetProfileCalculator +from skyulf.preprocessing.outliers.iqr import IQRApplier, IQRCalculator +from skyulf.preprocessing.outliers.winsorize import WinsorizeApplier, WinsorizeCalculator +from skyulf.preprocessing.outliers.zscore import ZScoreApplier, ZScoreCalculator +from skyulf.preprocessing.scaling.maxabs import MaxAbsScalerApplier, MaxAbsScalerCalculator +from skyulf.preprocessing.scaling.minmax import MinMaxScalerApplier, MinMaxScalerCalculator +from skyulf.preprocessing.scaling.robust import RobustScalerApplier, RobustScalerCalculator +from skyulf.preprocessing.scaling.standard import StandardScalerApplier, StandardScalerCalculator +from skyulf.preprocessing.transformations.power import ( + PowerTransformerApplier, + PowerTransformerCalculator, +) +from skyulf.utils import detect_numeric_columns, resolve_columns + + +@pytest.fixture(params=["pandas", "polars", "pandas_wrapped", "polars_wrapped"]) +def make_frame(request: pytest.FixtureRequest) -> Any: + """Exercise native and wrapped inputs without changing decimal values.""" + + def build(data: dict[str, Any]) -> Any: + """Build the requested engine's frame from exact values.""" + frame = pd.DataFrame(data) if request.param.startswith("pandas") else pl.DataFrame(data) + return EngineRegistry.wrap(frame) if request.param.endswith("wrapped") else frame + + return build + + +def _pandas(frame: Any) -> pd.DataFrame: + """Unwrap output only for assertions shared between engines.""" + if hasattr(frame, "to_native"): + frame = frame.to_native() + return frame.to_pandas() if isinstance(frame, pl.DataFrame) else frame + + +def test_decimal_detection_preserves_selection_rules(make_frame: Any) -> None: + """Decimals follow numeric exclusions without opting text or targets into transforms.""" + frame = make_frame( + { + "price": [Decimal("1.25"), None, Decimal("3.75")], + "binary": [Decimal("0"), None, Decimal("1")], + "constant": [Decimal("2"), None, Decimal("2")], + "qty": [2, 3, 4], + "text": ["1.25", None, "3.75"], + "flag": [True, False, True], + } + ) + original = _pandas(frame).copy(deep=True) + + assert detect_numeric_columns(frame) == ["price", "qty"] + assert detect_numeric_columns(frame, False, False) == ["price", "binary", "constant", "qty"] + assert auto_detect_numeric_columns(frame) == ["price", "binary", "constant", "qty"] + assert resolve_columns(frame, {"target_column": "price"}, detect_numeric_columns) == ["qty"] + assert StandardScalerCalculator().fit(frame, {"columns": []}) == {} + pd.testing.assert_frame_equal(_pandas(frame), original) + + +def test_decimal_detection_rejects_mixed_objects() -> None: + """A decimal next to a string must not silently turn an object column into numbers.""" + frame = pd.DataFrame( + { + "mixed": [Decimal("1.25"), "2.50", None], + "empty": [None, None, None], + "price": [Decimal("1.25"), pd.NA, Decimal("2.50")], + } + ) + assert detect_numeric_columns(frame) == ["price"] + assert auto_detect_numeric_columns(frame) == ["price"] + + +@pytest.mark.parametrize("explicit", [False, True]) +@pytest.mark.parametrize( + "calculator,applier,reference", + [ + (StandardScalerCalculator, StandardScalerApplier, StandardScaler), + (RobustScalerCalculator, RobustScalerApplier, RobustScaler), + (MinMaxScalerCalculator, MinMaxScalerApplier, MinMaxScaler), + (MaxAbsScalerCalculator, MaxAbsScalerApplier, MaxAbsScaler), + ], +) +def test_decimal_scalers_fit_and_replay( + make_frame: Any, + explicit: bool, + calculator: Any, + applier: Any, + reference: Any, +) -> None: + """Fitted scaling must handle decimal inputs, nulls and unseen values without mutation.""" + frame = make_frame( + { + "price": [Decimal("1.25"), Decimal("2.50"), None, Decimal("5.00")], + "target": [Decimal("10.00"), Decimal("20.00"), Decimal("30.00"), Decimal("40.00")], + "label": ["a", "b", "c", "d"], + } + ) + original = _pandas(frame).copy(deep=True) + config = {"columns": ["price"]} if explicit else {"target_column": "target"} + fitted = reference().fit(np.array([[1.25], [2.5], [np.nan], [5.0]])) + params = calculator().fit(frame, config) + out = _pandas(applier().apply(frame, params)) + + assert params["columns"] == ["price"] + np.testing.assert_allclose(out[["price"]], fitted.transform([[1.25], [2.5], [np.nan], [5.0]])) + assert pd.api.types.is_float_dtype(out["price"]) + pd.testing.assert_frame_equal(out[["target", "label"]], original[["target", "label"]]) + pd.testing.assert_frame_equal(_pandas(frame), original) + + heldout = make_frame({"price": [Decimal("7.50"), None, Decimal("0.00")]}) + replay = _pandas(applier().apply(heldout, params)) + np.testing.assert_allclose(replay[["price"]], fitted.transform([[7.5], [np.nan], [0.0]])) + + +@pytest.mark.parametrize( + "calculator,applier,config", + [ + (IQRCalculator, IQRApplier, {}), + (ZScoreCalculator, ZScoreApplier, {"threshold": 2.0}), + ], +) +def test_decimal_outliers_keep_nulls_and_target_alignment( + make_frame: Any, + calculator: Any, + applier: Any, + config: dict[str, Any], +) -> None: + """Filtering decimal outliers must preserve exact retained values and matching targets.""" + values = [Decimal(str(n)) for n in [1, 2, 3, 4, 5, 6, 100]] + [None] + frame = make_frame({"price": values}) + target = np.arange(len(values)) + params = calculator().fit(frame, config) + out, out_target = applier().apply((frame, target), params) + + assert _pandas(out)["price"].tolist() == values[:6] + [None] + np.testing.assert_array_equal(out_target, [0, 1, 2, 3, 4, 5, 7]) + + +def test_decimal_winsorization_applies_fitted_bounds(make_frame: Any) -> None: + """Fitting decimal quantiles must actually clip values during apply on either engine.""" + frame = make_frame({"price": [Decimal("0"), Decimal("10"), None, Decimal("20")]}) + params = WinsorizeCalculator().fit(frame, {"lower_percentile": 25, "upper_percentile": 75}) + out = _pandas(WinsorizeApplier().apply(frame, params)) + + np.testing.assert_allclose(out["price"].to_numpy(dtype=float), [5, 10, np.nan, 15]) + assert pd.api.types.is_float_dtype(out["price"]) + + +@pytest.mark.parametrize( + "calculator,applier,config", + [ + (SimpleImputerCalculator, SimpleImputerApplier, {"strategy": "mean"}), + (SimpleImputerCalculator, SimpleImputerApplier, {"strategy": "median"}), + (KNNImputerCalculator, KNNImputerApplier, {}), + (IterativeImputerCalculator, IterativeImputerApplier, {}), + ], +) +def test_decimal_imputation_remains_numeric_for_next_node( + make_frame: Any, + calculator: Any, + applier: Any, + config: dict[str, Any], +) -> None: + """Filled decimal columns must remain discoverable by the next numeric pipeline node.""" + frame = make_frame({"price": [Decimal("1.25"), None, Decimal("3.75")]}) + params = calculator().fit(frame, config) + out = applier().apply(frame, params) + + assert params["columns"] == ["price"] + np.testing.assert_allclose(_pandas(out)["price"].to_numpy(dtype=float), [1.25, 2.5, 3.75]) + assert detect_numeric_columns(out) == ["price"] + + +def test_decimal_binning_generates_expected_bins(make_frame: Any) -> None: + """Decimal fit must not be silently skipped by the bin-edge calculator.""" + frame = make_frame({"price": [Decimal("1"), Decimal("2"), None, Decimal("3")]}) + params = GeneralBinningCalculator().fit(frame, {"n_bins": 2}) + out = _pandas(GeneralBinningApplier().apply(frame, params)) + + assert params["bin_edges"]["price"] == [1.0, 2.0, 3.0] + np.testing.assert_allclose(out["price_binned"].to_numpy(dtype=float), [0, 0, np.nan, 1]) + + +def test_decimal_feature_selection_and_generation(make_frame: Any) -> None: + """Decimal features must reach variance, correlation and polynomial calculations.""" + frame = make_frame( + { + "price": [Decimal("1"), Decimal("2"), Decimal("3")], + "duplicate": [Decimal("2"), Decimal("4"), Decimal("6")], + } + ) + variance = VarianceThresholdCalculator().fit(frame, {"threshold": 0.1}) + correlation = CorrelationThresholdCalculator().fit(frame, {}) + polynomial = PolynomialFeaturesCalculator().fit(frame, {"auto_detect": True}) + out = _pandas(PolynomialFeaturesApplier().apply(frame, polynomial)) + + assert variance["selected_columns"] == ["price", "duplicate"] + assert variance["variances"]["price"] == pytest.approx(2 / 3) + assert correlation["columns_to_drop"] == ["duplicate"] + assert polynomial["columns"] == ["price", "duplicate"] + np.testing.assert_allclose(out["poly_price_pow_2"], [1, 4, 9]) + + +def test_decimal_dataset_profile_reports_numeric_statistics(make_frame: Any) -> None: + """Decimal profiling must expose numeric statistics instead of categorical counts.""" + frame = make_frame({"price": [Decimal("1.25"), None, Decimal("3.75")]}) + artifact = DatasetProfileCalculator().fit(frame, {}) + + assert artifact["profile"]["numeric_stats"]["price"]["mean"] == pytest.approx(2.5) + + +@pytest.mark.parametrize("method", ["yeo-johnson", "box-cox"]) +def test_decimal_power_transform_matches_float_reference(make_frame: Any, method: str) -> None: + """Automatic power fitting and replay must use the same numeric values as float inputs.""" + values = [1.25, 2.5, np.nan, 5.0, 10.0] + frame = make_frame({"price": [Decimal(str(v)) if np.isfinite(v) else None for v in values]}) + reference = PowerTransformer(method=method).fit(np.array(values).reshape(-1, 1)) + params = PowerTransformerCalculator().fit(frame, {"method": method}) + out = _pandas(PowerTransformerApplier().apply(frame, params)) + + assert params["columns"] == ["price"] + np.testing.assert_allclose(out[["price"]], reference.transform(np.array(values).reshape(-1, 1))) + + +@pytest.mark.parametrize( + "calculator", [UnivariateSelectionCalculator, ModelBasedSelectionCalculator] +) +def test_decimal_supervised_selection_excludes_target(make_frame: Any, calculator: Any) -> None: + """Numeric candidate discovery must include decimals while keeping the target out.""" + frame = make_frame( + { + "price": [Decimal(str(v)) for v in [1, 3, 2, 5, 7, 8]], + "target": [2.0, 6.0, 4.0, 10.0, 14.0, 16.0], + } + ) + params = calculator().fit( + frame, {"target_column": "target", "problem_type": "regression", "k": 1} + ) + + assert params["candidate_columns"] == ["price"] + assert params["selected_columns"] == ["price"] + + +@pytest.mark.parametrize( + "calculator,applier", + [ + (StandardScalerCalculator, StandardScalerApplier), + (RobustScalerCalculator, RobustScalerApplier), + (MinMaxScalerCalculator, MinMaxScalerApplier), + (MaxAbsScalerCalculator, MaxAbsScalerApplier), + (KNNImputerCalculator, KNNImputerApplier), + (IterativeImputerCalculator, IterativeImputerApplier), + (PowerTransformerCalculator, PowerTransformerApplier), + ], +) +@pytest.mark.parametrize("arrow", [False, True]) +def test_decimal_pandas_na_matches_float_missing( + calculator: Any, applier: Any, arrow: bool +) -> None: + """Pandas' missing sentinel in a decimal object column must survive numeric boundaries.""" + decimal_frame = pd.DataFrame({"price": [Decimal("1.25"), pd.NA, Decimal("3.75")]}) + if arrow: + pa = pytest.importorskip("pyarrow") + decimal_frame["price"] = decimal_frame["price"].astype(pd.ArrowDtype(pa.decimal128(10, 2))) + numeric_frame = pd.DataFrame({"price": [1.25, np.nan, 3.75]}) + params = calculator().fit(decimal_frame, {}) + reference = calculator().fit(numeric_frame, {}) + out = applier().apply(decimal_frame, params) + expected = applier().apply(numeric_frame, reference) + + np.testing.assert_allclose(out[["price"]].to_numpy(dtype=float), expected[["price"]]) + + +@pytest.mark.parametrize("precision,scale", [(10, 2), (20, 4), (38, 10)]) +def test_parameterized_decimal_schema_and_empty_selection(precision: int, scale: int) -> None: + """Decimal precision/scale must not prevent detection or advertise unchanged scaler dtypes.""" + dtype = pl.Decimal(precision, scale) + frame: Any = pl.DataFrame({"price": pl.Series([Decimal("1.25"), Decimal("3.75")], dtype=dtype)}) + empty = frame.with_columns(pl.lit(None, dtype=dtype).alias("price")) + schema = SkyulfSchema.from_dataframe(frame) + + assert auto_detect_numeric_columns(frame) == ["price"] + assert detect_numeric_columns(frame) == ["price"] + assert detect_numeric_columns(empty, False, False) == [] + assert StandardScalerCalculator().infer_output_schema(schema, {}).dtypes["price"] == "float64" diff --git a/tests/integration/test_catalog_polars_ingestion.py b/tests/integration/test_catalog_polars_ingestion.py index ef84a2d8c..18406ac43 100644 --- a/tests/integration/test_catalog_polars_ingestion.py +++ b/tests/integration/test_catalog_polars_ingestion.py @@ -12,18 +12,49 @@ skyulf-core's NaN-aware operators (F-04/F-06/F-13) handle both forms. """ +from decimal import Decimal from io import StringIO +import numpy as np import pandas as pd import polars as pl import pytest from backend.config import get_settings from backend.data.catalog import FileSystemCatalog +from skyulf.preprocessing.pipeline import FeatureEngineer NAN_CSV = "a,b,c\n1,x,NaN\n,y,2\n3,z,\n" +@pytest.mark.parametrize("engine", ["pandas", "polars"]) +def test_parquet_decimal_pipeline_imputes_scales_and_replays(tmp_path, monkeypatch, engine): + """Uploaded Decimal prices must survive ingestion and reach every automatic numeric step.""" + monkeypatch.setattr(get_settings(), "SKYULF_ENGINE", engine) + source = pl.DataFrame( + { + "price": pl.Series([Decimal("1.25"), None, Decimal("3.75")], dtype=pl.Decimal(10, 2)), + "label": ["a", "b", "c"], + } + ) + source.write_parquet(tmp_path / "prices.parquet") + frame = FileSystemCatalog(base_path=str(tmp_path)).load("prices.parquet") + assert frame["price"].to_list() == [Decimal("1.25"), None, Decimal("3.75")] + engineer = FeatureEngineer( + [ + {"name": "fill", "transformer": "SimpleImputer", "params": {"strategy": "mean"}}, + {"name": "scale", "transformer": "MinMaxScaler", "params": {}}, + ] + ) + + out, _ = engineer.fit_transform(frame) + replay = engineer.transform(frame) + np.testing.assert_allclose(out["price"].to_numpy(), [0.0, 0.5, 1.0]) + np.testing.assert_allclose(replay["price"].to_numpy(), [0.0, 0.5, 1.0]) + assert out["label"].to_list() == ["a", "b", "c"] + assert frame["price"].to_list() == [Decimal("1.25"), None, Decimal("3.75")] + + @pytest.fixture def polars_engine(monkeypatch): settings = get_settings() From 2ba4c67cbdb0361c71c61df111c63e48c594a238 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 18:36:59 +0300 Subject: [PATCH 04/17] fix(preprocessing): include Enum columns in text auto-selection Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 4 + docs/reference/preprocessing_nodes.md | 8 ++ .../analysis/opus_core_analysis-open_queue.md | 5 +- .../analysis/opus_core_analysis-tracker.md | 30 +++++ .../opus_core_analysis/16-dtype-coverage.md | 7 + skyulf-core/skyulf/preprocessing/_helpers.py | 8 +- .../integration/test_enum_text_cleaning.py | 127 ++++++++++++++++++ 7 files changed, 184 insertions(+), 5 deletions(-) create mode 100644 skyulf-core/tests/integration/test_enum_text_cleaning.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 331b3ea9a..36aac50d4 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -16,6 +16,10 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). safely through scaling, imputation, outlier handling and binning. Numeric calculations use float64; source frames retain exact Decimal values. Refit affected pipelines to include columns omitted by older fitted artifacts. +- **Enum text cleaning (OC-121):** include Polars Enum columns in automatic + TextCleaning and AliasReplacement selection, matching pandas categorical + strings. Preserve missing values and explicit empty selections; refit saved + artifacts that previously omitted Enum columns. ## v0.8.20 diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index b84c42f9f..113181f71 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -72,6 +72,14 @@ Learned params: none. ## Cleaning +When `columns` is omitted, `TextCleaning` and `AliasReplacement` select text-like +columns, including pandas categorical strings and Polars `Enum` columns. An +explicit `columns=[]` keeps both nodes as no-ops. Enum categories do not restrict +the cleaned output: for example, trim plus lowercase changes `" YES "` to +`"yes"`, while boolean alias replacement produces `"Yes"`. Missing values stay +missing and source frames are unchanged. Refit saved artifacts to include Enum +columns that older automatic selections skipped. + Example step: ```python diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 5ce7084b3..67c9bb730 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,8 +27,8 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 35 open / 4 parked.** OC-110, OC-113, OC-120 and -the newly filed OC-247 are closed in the archive. +**Current status (2026-09-12): 34 open / 4 parked.** OC-110, OC-113, OC-120, +OC-121 and the newly filed OC-247 are closed in the archive. Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -67,7 +67,6 @@ closed that on 2026-09-07. | OC-101 | 🟑 | `calibrated_classifier`'s `random_state` no-op for two independent reasons (estimator rejects it AND factories hardcode the seed) | small | ⬜ open | | OC-111 | 🟑 | A profiling recommendation branch is unreachable | small | ⬜ open | | OC-102 | βšͺ | Five tunable models return an empty search space from the live `/defaults` endpoint (`hyperparameters/_registry.py`) | small | ⬜ open | -| OC-121 | βšͺ | polars `Enum` columns invisible to text auto-detection, diverging from pandas `Categorical` (`_helpers.py:148-157`) | small | ⬜ open | | OC-90 | βšͺ | Unknown split config keys silently dropped instead of rejected (`preprocessing/split.py`) | small | ⬜ open | ### Remaining β€” file-coverage closure diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 60c86dedf..b0509b931 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -184,6 +184,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-121 | βšͺ | Polars Enum columns omitted by text auto-selection, unlike pandas Categorical (`preprocessing/_helpers.py`) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Enum dtypes in the shared selector; TextCleaning and AliasReplacement now include them while preserving nulls, explicit selections and replay behavior. | | OC-120 | 🟠 | Decimal columns skipped by numeric auto-selection and mishandled during explicit numeric processing (`utils.py`, `preprocessing/_helpers.py` and numeric nodes) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Polars and pandas object Decimals, normalize selected values at numeric boundaries, and preserve missingness, source values and target alignment. | | OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/_utils.py`, `analyzer.py`) | small | βœ… fixed 2026-09-12 β€” infer repeated small string categories from non-null counts in both profiling paths, restoring statistics and classification target analysis. | | OC-113 | 🟠 | Near-perfect multicollinearity silently reports VIF = 1.0 β€” `max(1.0, …)` clamps numerical garbage (`profiling/_analyzer/numeric.py`) | small | βœ… fixed 2026-09-12 β€” use per-feature regression residuals for unstable correlation inversion, preserving high-VIF warnings without falsely flagging unrelated columns. | @@ -402,6 +403,35 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-121 fixed: Enum text auto-selection + +After committing OC-120 as `8425f56f`, reproduced the adjacent dtype finding +with `status = [" YES ", "No!", null, "Maybe"]`. Polars Enum auto-detection +returned no status column; both TextCleaning and AliasReplacement left it +unchanged. Equivalent pandas Categorical input was selected and transformed. +Explicitly selecting status already worked on both engines. + +The shared text selector now recognizes `isinstance(dtype, pl.Enum)` alongside +the existing text dtypes. No node transformation or frontend changes were needed. +Enum selection uses the declared dtype, so it also includes empty/all-null +columns. Text cleaning and alias mapping keep their existing string output, +null preservation, target exclusions and explicit-empty-selection no-op. + +Verification: + +- Before the fix, the new matrix had **10 failed / 26 passed**, isolating the + Polars native/wrapped automatic-selection failures from the working explicit + and pandas controls. +- **341 tests passed**, including all 36 new Enum cases and the existing text, + alias, helper, pipeline, engine-parity and Decimal regressions. +- Tests exercise fit/apply and held-out Enum vocabularies, preserve source frames + and untouched columns, and verify empty/all-null dtype discovery. +- Ruff, formatting and full configured `ty check` pass; focused review found no + concrete defects or scope concerns. + +Docs and changelog explain the new selection and refitting previously saved +artifacts. OC-121 moves into the archive; the live queue is **34 open / 4 parked**. + ### 2026-09-12 β€” OC-120 fixed: Decimal numeric selection and processing After committing OC-113 as `4fea1cca`, reproduced OC-120 with Decimal prices diff --git a/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md b/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md index 40470221c..d52d88e73 100644 --- a/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md +++ b/initiatives/analysis/opus_core_analysis/16-dtype-coverage.md @@ -113,6 +113,13 @@ path stops crashing. Add a cross-engine test with a decimal column. --- ### OC-121 + +**Resolved 2026-09-12.** See the +[verification and fix log](../opus_core_analysis-tracker.md#2026-09-12-oc-121-fixed-enum-text-auto-selection). +The shared text selector now recognizes parameterized Enum dtypes; native and +wrapped TextCleaning/AliasReplacement fit/apply regressions pass. The original +reproduction below is retained as historical evidence. + ### βšͺ Low β€” polars `Enum` columns are invisible to text auto-detection, diverging from the pandas `Categorical` equivalent **File:** `skyulf/preprocessing/_helpers.py:148-157` (`auto_detect_text_columns`) diff --git a/skyulf-core/skyulf/preprocessing/_helpers.py b/skyulf-core/skyulf/preprocessing/_helpers.py index dee65ac89..3a768a843 100644 --- a/skyulf-core/skyulf/preprocessing/_helpers.py +++ b/skyulf-core/skyulf/preprocessing/_helpers.py @@ -267,14 +267,18 @@ def is_polars(X: Any) -> bool: def auto_detect_text_columns(df: pd.DataFrame | SkyulfDataFrame) -> list[str]: - """Return string-like columns from either a Pandas or Polars frame.""" + """Return text columns, including categorical strings and Polars Enum dtypes. + + Enum columns are selected even when empty or entirely null; their declared + categories establish the text dtype independently of observed values. + """ engine = get_engine(df) if engine.name == EngineName.POLARS: polars_df = cast(PolarsBackedFrame, df) return [ c for c, t in zip(polars_df.columns, polars_df.dtypes, strict=True) - if t in [pl.Utf8, pl.Categorical, pl.Object] + if t in [pl.Utf8, pl.Categorical, pl.Object] or isinstance(t, pl.Enum) ] return list( cast(PandasBackedFrame, df).select_dtypes(include=["object", "string", "category"]).columns diff --git a/skyulf-core/tests/integration/test_enum_text_cleaning.py b/skyulf-core/tests/integration/test_enum_text_cleaning.py new file mode 100644 index 000000000..d717fc673 --- /dev/null +++ b/skyulf-core/tests/integration/test_enum_text_cleaning.py @@ -0,0 +1,127 @@ +"""Enum text columns must participate in automatic cleaning on both engines.""" + +from typing import Any + +import pandas as pd +import polars as pl +import pytest + +from skyulf.engines.registry import EngineRegistry +from skyulf.preprocessing._helpers import auto_detect_text_columns +from skyulf.preprocessing.cleaning.alias import AliasReplacementApplier, AliasReplacementCalculator +from skyulf.preprocessing.cleaning.text import TextCleaningApplier, TextCleaningCalculator + + +@pytest.fixture(params=["pandas", "polars", "pandas_wrapped", "polars_wrapped"]) +def make_frame(request: pytest.FixtureRequest) -> Any: + """Use equivalent categorical data in native and wrapped frames.""" + + def build(values: list[str | None]) -> Any: + """Keep the category dictionary separate from observed values.""" + categories = ["unused", *dict.fromkeys(v for v in values if v is not None)] + data = { + "status": values, + "plain": values, + "qty": list(range(len(values))), + "target": ["KEEP"] * len(values), + } + if request.param.startswith("polars"): + frame = pl.DataFrame(data).with_columns(pl.col("status").cast(pl.Enum(categories))) + else: + frame = pd.DataFrame(data) + frame["status"] = pd.Categorical(values, categories=categories) + return EngineRegistry.wrap(frame) if request.param.endswith("wrapped") else frame + + return build + + +def _pandas(frame: Any) -> pd.DataFrame: + """Normalize assertion input without changing the tested frame.""" + if hasattr(frame, "to_native"): + frame = frame.to_native() + return frame.to_pandas() if isinstance(frame, pl.DataFrame) else frame + + +@pytest.mark.parametrize("values", [["A", None, "B"], [None, None], []]) +def test_enum_text_detection_includes_null_and_empty_columns( + make_frame: Any, + values: list[str | None], +) -> None: + """Enum text detection must depend on dtype, including unobserved categories.""" + frame = make_frame(values) + detected = auto_detect_text_columns(frame) + + assert "status" in detected + assert "qty" not in detected + + +@pytest.mark.parametrize("explicit", [False, True]) +@pytest.mark.parametrize( + "calculator,applier,config,expected,heldout_expected", + [ + ( + TextCleaningCalculator, + TextCleaningApplier, + {"operations": [{"op": "trim"}, {"op": "case", "mode": "lower"}]}, + ["yes", "no!", None, "maybe"], + ["no!", "yes", None], + ), + ( + AliasReplacementCalculator, + AliasReplacementApplier, + {"alias_type": "boolean"}, + ["Yes", "No", None, "Maybe"], + ["No", "Yes", None], + ), + ], +) +def test_enum_cleaning_fit_and_replay( + make_frame: Any, + explicit: bool, + calculator: Any, + applier: Any, + config: dict[str, Any], + expected: list[str | None], + heldout_expected: list[str | None], +) -> None: + """Automatic Enum cleaning must match explicit selection and preserve nulls and other columns.""" + frame = make_frame([" YES ", "No!", None, "Maybe"]) + original = _pandas(frame).copy(deep=True) + selection = {"columns": ["status"]} if explicit else {"target_column": "target"} + params = calculator().fit(frame, {**config, **selection}) + out = _pandas(applier().apply(frame, params)) + + assert params["columns"] == (["status"] if explicit else ["status", "plain"]) + pd.testing.assert_series_equal( + out["status"].astype("string"), pd.Series(expected, name="status", dtype="string") + ) + untouched = ["qty", "target", "plain"] if explicit else ["qty", "target"] + pd.testing.assert_frame_equal(out[untouched], original[untouched]) + pd.testing.assert_frame_equal(_pandas(frame), original) + + heldout = make_frame([" No! ", "YES", None]) + replay = _pandas(applier().apply(heldout, params)) + pd.testing.assert_series_equal( + replay["status"].astype("string"), + pd.Series(heldout_expected, name="status", dtype="string"), + ) + + +@pytest.mark.parametrize( + "calculator,applier", + [ + (TextCleaningCalculator, TextCleaningApplier), + (AliasReplacementCalculator, AliasReplacementApplier), + ], +) +def test_enum_cleaning_explicit_empty_selection_is_noop( + make_frame: Any, + calculator: Any, + applier: Any, +) -> None: + """Adding Enum auto-selection must not override an explicit opt-out.""" + frame = make_frame([" YES ", None]) + params = calculator().fit(frame, {"columns": []}) + + assert params == {} + pd.testing.assert_frame_equal(_pandas(applier().apply(frame, params)), _pandas(frame)) From 9663132a89dccde80903eaf3f04419903f77983e Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 18:56:09 +0300 Subject: [PATCH 05/17] fix(preprocessing): align numeric profiles and missing bin labels Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 9 + docs/reference/preprocessing_nodes.md | 22 ++ .../analysis/opus_core_analysis-open_queue.md | 8 +- .../analysis/opus_core_analysis-tracker.md | 49 +++++ ...ture-generation-selection-vectorization.md | 8 + .../07-outliers-timeseries-geo.md | 14 ++ skyulf-core/skyulf/preprocessing/bucketing.py | 13 ++ .../skyulf/preprocessing/inspection.py | 24 ++- .../test_binning_missing_labels.py | 204 ++++++++++++++++++ .../test_group_aggregate_null_keys.py | 117 ++++++++++ .../tests/integration/test_inspection.py | 63 ++++++ 11 files changed, 516 insertions(+), 15 deletions(-) create mode 100644 skyulf-core/tests/integration/test_binning_missing_labels.py create mode 100644 skyulf-core/tests/integration/test_group_aggregate_null_keys.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 36aac50d4..efc3ec698 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,15 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **Dataset Profile coverage (OC-59):** report supported numeric dtypes on + both engines, including small/unsigned integers, binary, constant and + entirely missing numeric columns. Rerun the node to refresh saved profiles. +- **Binning missing labels (OC-60):** honor the configured missing label on + Polars for null, NaN and out-of-range bins. Label mode consistently returns + strings on Polars; pandas retains mixed numeric/text values and the default + keep strategy is unchanged. +- **Group aggregation regressions (OC-24):** verify the existing shared + null/NaN training group and fitted-only inference behavior across both engines. - **EDA string categories (OC-110):** recognize repeated labels in small datasets so categorical statistics and classification target analysis are available. Infer from non-missing values; preserve unique strings as text. diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index 113181f71..fc8165fa2 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -543,6 +543,14 @@ Config: - output formatting: - `output_suffix`, `drop_original`, `label_format`, `missing_strategy`, `missing_label`, `include_lowest`, `precision` +`missing_strategy="label"` replaces missing and out-of-range bins with +`missing_label` (default `"Missing"`). This includes nulls, NaN and values outside +the fitted edges during later transformations. With this strategy Polars always +returns strings, including in batches with no missing values: ordinal/bin-index +codes become `"0"`, `"1"`, etc. Pandas keeps numeric codes alongside the text +label in an object column. Range and custom labels retain their text. The default +`missing_strategy="keep"` leaves missing bins as missing values. + Learned params: - `bin_edges` (dict[col -> edges]) @@ -663,6 +671,13 @@ produces `0.5`. An entirely missing denominator uses positive epsilon, and an entirely missing numerator sums to zero. Source columns retain their values; this rule applies to the generated ratio. +For `group_agg`, null and NaN keys share a single training group on both engines. +Later transformations reuse that fitted aggregate, including for missing keys; +they never calculate it from the new batch's values. Keys not seen during +training, including missing keys when training had none, produce missing output. +The operation groups by one column. Legacy artifacts without fitted group +statistics must be refitted before applying them. + Learned params: - `operations`, `epsilon`, `allow_overwrite` @@ -820,6 +835,13 @@ Learned params: none. Captures basic dataset stats without modifying data. +Numeric statistics cover supported signed/unsigned integer, float and Decimal +columns on both engines. Binary, constant and entirely missing numeric columns +remain visible, as do typed numeric columns in an empty frame. Boolean, +categorical and temporal columns retain their metadata but have no numeric +statistics. Statistics still use each engine's native `describe()` metrics and +quantile conventions. Rerun the node to refresh older profile artifacts. + Config: none. Learned params: diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 67c9bb730..e0b56dcc3 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,8 +27,9 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 34 open / 4 parked.** OC-110, OC-113, OC-120, -OC-121 and the newly filed OC-247 are closed in the archive. +**Current status (2026-09-12): 31 open / 4 parked.** OC-59/60 are fixed and +OC-24 is verified already fixed at the public fit/apply boundary; all three +are recorded in the archive. Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -95,7 +96,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-24 | 🟠 | Polars group aggregates treat null group keys differently from pandas (`_polars_ops.py:222-234`) | small | ⬜ open | | OC-30 | 🟑 | Datetime extraction ignores the UI output name, overwrites collisions (`_pandas_ops.py:173-184`) | small | ⬜ open | ### Remaining β€” profiling (outside the OC-39–46 cluster) @@ -120,8 +120,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-59 | 🟠 | `DatasetProfile` numeric-column coverage completely different between engines (`preprocessing/inspection/`) | small | ⬜ open | -| OC-60 | 🟠 | `GeneralBinning`'s `missing_strategy: "label"` silent no-op on polars (`preprocessing/bucketing.py`) | small | ⬜ open | ### Remaining β€” modeling / tuning diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index b0509b931..91032ac6b 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -226,6 +226,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-24 | 🟠 | Polars group aggregates treat missing keys differently from pandas (`feature_generation/_polars_ops.py`) | small | βœ… already fixed β€” verified 2026-09-12: public fitted aggregates share null/NaN training groups across engines and wrappers; unseen groups remain missing, while the public artifact guard excludes divergent private unfitted helpers. | | OC-230 | 🟑 | Native Polars NaN inputs propagate through feature ratios while pandas treats them as missing (`feature_generation/_polars_ops.py:_polars_ratio`, `_pandas_ops.py:_pandas_ratio`) | small | βœ… fixed 2026-09-11 - normalize native NaN and null ratio operands to zero before summing, preserving other operands, input columns and signed epsilon. | | OC-23 | 🟠 | Polars `ratio` flips the sign of near-zero negative denominators (`feature_generation/_polars_ops.py:97-112`) | small | βœ… fixed 2026-09-11 - preserve the sign when clamping a near-zero ratio denominator to epsilon on Polars, matching pandas. | | OC-211 | 🟑 | Pandas datetime features depend on prediction-batch composition: prepending a different valid date format makes the original rows' year/month/day missing in both `FeatureGeneration.datetime_extract` and `DateFeatures` (`feature_generation/_pandas_ops.py:179`, `time_series/date_features.py:64`) | small | βœ… already fixed - verified 2026-09-09: mixed-format batch companions preserve calendar features across both engines and aliases. | @@ -282,6 +283,8 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-59 | 🟠 | DatasetProfile selects different numeric-column sets on pandas and Polars (`preprocessing/inspection.py`) | small | βœ… fixed 2026-09-12 β€” use shared dtype-based selection, include supported small/unsigned integers and binary/constant/empty numeric columns, and exclude temporal columns on both engines. | +| OC-60 | 🟠 | GeneralBinning ignores missing_strategy=label on Polars (`preprocessing/bucketing.py`) | small | βœ… fixed 2026-09-12 β€” fill missing and out-of-range bins with the configured label; labeled Polars outputs use a stable String dtype and the default keep strategy is preserved. | | OC-176 | 🟑 | Polars `LagFeatures(drop_na=True)` removes nulls but retains float NaN in source/lag columns; equivalent pandas input drops those rows (`preprocessing/time_series/lag.py:54-59`) β€” independent of OC-165's y desynchronization | small | βœ… fixed 2026-09-09 - Polars lag filtering removes both null and floating NaN rows with one positional selection shared by X and y. | | OC-175 | 🟑 | Polars `RollingAggregate` propagates float NaN through windows instead of ignoring missing observations like pandas β€” `[1,NaN,3]` with window 2 yields mean `[1,NaN,NaN]` vs `[1,1,3]` (`preprocessing/time_series/rolling.py:48`) | small | βœ… fixed 2026-09-09 - floating NaN is treated as missing inside Polars rolling expressions, preserving source values and grouped-window semantics. | | OC-174 | 🟑 | Polars `DateFeatures` crashes on an entirely invalid string date column despite `strict=False`; pandas produces nullable calendar features (`preprocessing/time_series/date_features.py:102`) | small | βœ… already fixed - verified 2026-09-09: wholly invalid date strings produce nullable calendar features in both engines. | @@ -403,6 +406,52 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-24/59/60: parallel preprocessing audit closure + +After committing OC-121 as `2ba4c67c`, investigated three independent findings +with two implementation agents and a separate review of the combined change. + +**OC-59 β€” fixed.** Reproduced differing numeric profile coverage: pandas +reported Int8/Int16/unsigned columns but excluded binary, constant and entirely +missing columns; Polars did the reverse for those cases. Both paths now use +shared dtype-based numeric selection, because these columns remain useful in a +diagnostic profile regardless of cardinality. The pandas path excludes timedeltas +from its number selector, matching the Polars temporal boundary. Decimal +conversion and the read-only applier remain intact. Six new public regressions +failed before the repair and pass afterward, covering all ten existing integer/ +float dtypes, Decimal, nullable/empty inputs and native/wrapped frames. + +**OC-60 β€” fixed.** With fitted edges `[0, 5, 10]`, Polars left missing and +out-of-range bins null even when `missing_strategy="label"` selected a sentinel; +pandas emitted the configured label. The Polars expression now widens labeled +outputs to String and fills missing bins, including null, NaN and held-out values +outside the fitted edges. String output applies even to complete/empty batches +so concatenation keeps a stable schema. Pandas retains its existing numeric/text +object values, and default `keep` behavior is unchanged. The 67-case regression +matrix went from **25 failed / 42 passed** to all passing; it covers ordinal, +bin-index, range/custom labels, boundary inclusion, empty/default/existing labels, +drop/source/target preservation and wrappers. Canvas exposes neither missing +option, so the existing Core configuration needed no frontend change. + +**OC-24 β€” verified already fixed.** The public repair dates to `f12dde9f8` +(2026-09-08): fitting includes missing keys as a training group, replay uses its +stored aggregate and normalizes Polars null/NaN keys, and the public applier +rejects artifacts without a fitted mapping. Training keys `[1, null, NaN]` with +values `[1, 2, 5]` produce `[1, 3.5, 3.5]` on both engines. Held-out keys +`[null, NaN, 1, 2]` reuse `[3.5, 3.5, 1, missing]` independently of their values. +Missing keys absent from training remain missing during inference. Forty added +cases cover all seven aggregates, native/wrapped inputs and the unfitted-artifact +guard. The retained private unfitted compatibility helpers still differ, but +their direct callers are tests; the public path cannot reach that behavior. +They were left unchanged. The editor/resolver supports one grouping column, +so this closure does not introduce multi-key grouping. + +Combined verification: **2,169 Core tests passed / 2 skipped**, plus **65 backend +catalog, data-service and preprocessing tests passed**. Ruff, formatting and full +configured `ty check` pass; independent review found no blockers. Docs and +changelog describe the profile coverage, missing-label dtype choice and existing +fitted group semantics. The live queue now has **31 open / 4 parked** findings. + ### 2026-09-12 β€” OC-121 fixed: Enum text auto-selection After committing OC-120 as `8425f56f`, reproduced the adjacent dtype finding diff --git a/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md b/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md index 7af848d3b..55cf36ff7 100644 --- a/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md +++ b/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md @@ -28,6 +28,14 @@ the engine. --- ### OC-24 + +**Verified already fixed 2026-09-12 at the public fit/apply boundary.** The +training-fitted mapping introduced in `f12dde9f8` shares null/NaN groups across +engines and prevents batch-local inference aggregation. The historical behavior +below remains only in private unfitted compatibility helpers; the public applier +rejects artifacts that could reach them. See the +[verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-245960-parallel-preprocessing-audit-closure). + ### 🟠 High β€” Polars group aggregates treat null group keys differently from pandas **File:** `preprocessing/feature_generation/_polars_ops.py:222-234` diff --git a/initiatives/analysis/opus_core_analysis/07-outliers-timeseries-geo.md b/initiatives/analysis/opus_core_analysis/07-outliers-timeseries-geo.md index b0edeaea7..b78aa73e4 100644 --- a/initiatives/analysis/opus_core_analysis/07-outliers-timeseries-geo.md +++ b/initiatives/analysis/opus_core_analysis/07-outliers-timeseries-geo.md @@ -58,6 +58,13 @@ any value outside `{0, 1, null}` and raise, mirroring --- ### OC-59 + +**Resolved 2026-09-12.** Both profile paths now use shared dtype-based numeric +selection, including binary, constant and empty numeric columns. Temporal +columns remain outside numeric statistics. See the +[verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-245960-parallel-preprocessing-audit-closure). +The original reproduction below is retained as historical evidence. + ### 🟠 High β€” `DatasetProfile` numeric-column coverage is completely different between engines **File:** `skyulf-core/skyulf/preprocessing/inspection.py:44-58` (polars) vs `:60-71` (pandas) @@ -95,6 +102,13 @@ to, so both paths select the same logical column set. --- ### OC-60 + +**Resolved 2026-09-12.** Polars now fills missing and out-of-range bins with +the configured label and uses String output consistently across batches; +pandas and the default keep strategy preserve their existing behavior. See the +[verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-245960-parallel-preprocessing-audit-closure). +The original reproduction below is retained as historical evidence. + ### 🟠 High β€” `GeneralBinning`'s `missing_strategy: "label"` is a silent no-op on polars **File:** `skyulf-core/skyulf/preprocessing/bucketing.py:134-142` vs `:197-231` diff --git a/skyulf-core/skyulf/preprocessing/bucketing.py b/skyulf-core/skyulf/preprocessing/bucketing.py index 9cec76b67..030231420 100644 --- a/skyulf-core/skyulf/preprocessing/bucketing.py +++ b/skyulf-core/skyulf/preprocessing/bucketing.py @@ -112,6 +112,8 @@ def _build_polars_exprs(X: Any, params: dict[str, Any]) -> tuple[list[Any], list custom_labels_map = params.get("custom_labels", {}) include_lowest = params.get("include_lowest", True) precision = params.get("precision", 3) + missing_strategy = params.get("missing_strategy", "keep") + missing_label = params.get("missing_label", "Missing") exprs: list[Any] = [] cols_to_drop: list[str] = [] @@ -128,6 +130,10 @@ def _build_polars_exprs(X: Any, params: dict[str, Any]) -> tuple[list[Any], list precision, ) if expr is not None: + if missing_strategy == "label": + # Polars needs one dtype for bin values and a string sentinel. + # Widen even complete batches so train/heldout schemas agree. + expr = expr.cast(pl.String).fill_null(missing_label) exprs.append(expr) if drop_original: cols_to_drop.append(col) @@ -282,6 +288,13 @@ class BaseBinningApplier(BaseApplier): Expects ``bin_edges`` in params: ``Dict[str, List[float]]`` mapping column names to bin edges. + + ``missing_strategy="label"`` fills null/NaN and out-of-range bins with + ``missing_label`` (default ``"Missing"``). Polars emits String columns for + this mode, including complete and empty batches; ordinal/bin-index values + become ``"0"``, ``"1"``, etc. Pandas retains numeric bin values alongside + the string sentinel in an object column. Range and custom labels keep + their text. The default ``"keep"`` strategy preserves missing values. """ @apply_method diff --git a/skyulf-core/skyulf/preprocessing/inspection.py b/skyulf-core/skyulf/preprocessing/inspection.py index 5387263b6..c4e4f58a3 100644 --- a/skyulf-core/skyulf/preprocessing/inspection.py +++ b/skyulf-core/skyulf/preprocessing/inspection.py @@ -8,14 +8,12 @@ from typing import Any, cast import pandas as pd -import polars as pl from ..core.meta.decorators import node_meta from ..engines import SkyulfDataFrame from ..registry import NodeRegistry -from ..utils import detect_numeric_columns from ._artifacts import DatasetProfileArtifact, DataSnapshotArtifact -from ._helpers import decimal_columns_to_float +from ._helpers import auto_detect_numeric_columns, decimal_columns_to_float from ._schema import SkyulfSchema from .base import BaseApplier, BaseCalculator, fit_method from .dispatcher import fit_dual_engine @@ -43,30 +41,30 @@ def _extract_polars_numeric_stats(X: Any, numeric_cols: list) -> dict[str, dict[ def _profile_fit_polars(X: Any, _y: Any, _config: dict[str, Any]) -> DatasetProfileArtifact: + """Describe every supported numeric dtype, independent of observed cardinality.""" profile: dict[str, Any] = { "rows": len(X), "columns": len(X.columns), "dtypes": {col: str(dtype) for col, dtype in zip(X.columns, X.dtypes, strict=True)}, "missing": {col: X[col].null_count() for col in X.columns}, } - numeric_cols = [ - col - for col, dtype in zip(X.columns, X.dtypes, strict=True) - if dtype in (pl.Float64, pl.Float32, pl.Int64, pl.Int32) or isinstance(dtype, pl.Decimal) - ] + numeric_cols = auto_detect_numeric_columns(X) if numeric_cols: profile["numeric_stats"] = _extract_polars_numeric_stats(X, numeric_cols) return {"type": "dataset_profile", "profile": profile} def _profile_fit_pandas(X: Any, _y: Any, _config: dict[str, Any]) -> DatasetProfileArtifact: + """Describe numeric dtypes without filtering binary, constant or missing columns.""" profile: dict[str, Any] = { "rows": len(X), "columns": len(X.columns), "dtypes": X.dtypes.astype(str).to_dict(), "missing": X.isna().sum().to_dict(), } - numeric_cols = detect_numeric_columns(X) + # pandas includes timedeltas in select_dtypes("number"); they are temporal + # columns, and Polars correctly leaves them outside numeric statistics. + numeric_cols = auto_detect_numeric_columns(X.select_dtypes(exclude=["timedelta"])) if numeric_cols: profile["numeric_stats"] = ( decimal_columns_to_float(X[numeric_cols], numeric_cols).describe().to_dict() @@ -97,7 +95,13 @@ def apply( learns_from_data=False, ) class DatasetProfileCalculator(BaseCalculator): - """Summarise shape, dtypes, missingness and numeric statistics.""" + """Summarise shape, dtypes, missingness and numeric statistics. + + Numeric statistics include supported integer, unsigned integer, float and + Decimal columns, even when binary, constant, entirely missing or empty. + Boolean, categorical and temporal columns retain their dtype/missingness + metadata but are not treated as numeric features. + """ def infer_output_schema( self, input_schema: SkyulfSchema, config: dict[str, Any] diff --git a/skyulf-core/tests/integration/test_binning_missing_labels.py b/skyulf-core/tests/integration/test_binning_missing_labels.py new file mode 100644 index 000000000..a9d70561a --- /dev/null +++ b/skyulf-core/tests/integration/test_binning_missing_labels.py @@ -0,0 +1,204 @@ +"""Missing-label behavior through the public binning calculator/applier API.""" + +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest +from polars.testing import assert_frame_equal + +from skyulf.engines import SkyulfPolarsWrapper +from skyulf.engines.pandas_engine import SkyulfPandasWrapper +from skyulf.preprocessing.bucketing import GeneralBinningApplier, GeneralBinningCalculator + +INPUT_KINDS = ["pandas", "pandas_wrapped", "polars", "polars_wrapped"] + + +def _frame(kind: str, values: dict[str, list[Any]]) -> Any: + """Build native and wrapped inputs without converting NaN to Polars null.""" + if kind.startswith("pandas"): + frame = pd.DataFrame(values) + return SkyulfPandasWrapper(frame) if kind.endswith("wrapped") else frame + frame = pl.DataFrame(values) + return SkyulfPolarsWrapper(frame) if kind.endswith("wrapped") else frame + + +def _native(frame: Any) -> Any: + """Inspect public wrapper outputs through their native accessor.""" + return frame.to_native() if hasattr(frame, "to_native") else frame + + +@pytest.mark.parametrize("kind", INPUT_KINDS) +@pytest.mark.parametrize("include_lowest", [True, False]) +@pytest.mark.parametrize( + ("label_format", "custom_labels", "expected_bins"), + [ + ("ordinal", None, [0, 0, 1, 1]), + ("bin_index", None, [0, 0, 1, 1]), + ("range", None, ["[0.0, 5.0]", "[0.0, 5.0]", "[5.0, 10.0]", "[5.0, 10.0]"]), + ("ordinal", ["low", "high"], ["low", "low", "high", "high"]), + ], + ids=["ordinal", "bin_index", "range", "custom"], +) +def test_missing_label_tags_null_nan_and_heldout_values( + kind: str, + include_lowest: bool, + label_format: str, + custom_labels: list[str] | None, + expected_bins: list[Any], +) -> None: + """Heldout gaps must receive the configured label without changing data or selection.""" + training = _frame(kind, {"x": [0.0, 2.0, 8.0, 10.0], "untouched": [20, 30, 40, 50]}) + values = [-1.0, 0.0, 2.0, 5.0, 8.0, 10.0, 11.0, None, float("nan")] + heldout = _frame(kind, {"x": values, "untouched": list(range(len(values)))}) + original = _native(heldout) + snapshot = original.copy(deep=True) if kind.startswith("pandas") else original.clone() + target = np.arange(len(values)) + config: dict[str, Any] = { + "columns": ["x"], + "strategy": "equal_width", + "n_bins": 2, + "missing_strategy": "label", + "missing_label": "MISSING_TAG", + "label_format": label_format, + "include_lowest": include_lowest, + "output_suffix": "_tagged", + } + if custom_labels is not None: + config.update( + strategy="custom", + custom_bins={"x": [0.0, 5.0, 10.0]}, + custom_labels={"x": custom_labels}, + ) + + artifact = GeneralBinningCalculator().fit(training, config) + output, output_target = GeneralBinningApplier().apply((heldout, target), artifact) + result = _native(output) + + expected = expected_bins.copy() + if label_format == "range" and not include_lowest: + expected = [label.replace("[", "(") for label in expected] + if kind.startswith("polars"): + expected = [str(label) for label in expected] + assert result["x_tagged"].dtype == pl.String + assert isinstance(output, SkyulfPolarsWrapper) == kind.endswith("wrapped") + assert_frame_equal(_native(heldout), snapshot) + assert_frame_equal(result.select("x", "untouched"), snapshot) + else: + pd.testing.assert_frame_equal(_native(heldout), snapshot) + pd.testing.assert_frame_equal(result[["x", "untouched"]], snapshot) + if custom_labels is None and label_format in ("ordinal", "bin_index"): + assert result["x_tagged"].dtype == object + assert isinstance(result["x_tagged"].iloc[2], float) + first_edge = expected[0] if include_lowest else "MISSING_TAG" + assert list(result.columns) == ["x", "untouched", "x_tagged"] + assert output_target is target + assert result["x_tagged"].to_list() == [ + "MISSING_TAG", + first_edge, + *expected, + "MISSING_TAG", + "MISSING_TAG", + "MISSING_TAG", + ] + + +@pytest.mark.parametrize("kind", INPUT_KINDS) +@pytest.mark.parametrize("label_format", ["ordinal", "bin_index", "range"]) +def test_keep_strategy_preserves_missing_values(kind: str, label_format: str) -> None: + """Enabling label support must leave the existing keep strategy unchanged.""" + training = _frame(kind, {"x": [0.0, 5.0, 10.0]}) + heldout = _frame(kind, {"x": [-1.0, 2.0, 8.0, 11.0, None, float("nan")]}) + config = { + "columns": ["x"], + "strategy": "equal_width", + "n_bins": 2, + "label_format": label_format, + "missing_strategy": "keep", + "missing_label": "UNUSED", + } + artifact = GeneralBinningCalculator().fit(training, config) + result = _native(GeneralBinningApplier().apply(heldout, artifact)) + values = result["x_binned"].to_list() + assert all(pd.isna(values[i]) for i in (0, 3, 4, 5)) + if label_format == "range": + assert values[1:3] == ["[0.0, 5.0]", "[5.0, 10.0]"] + else: + assert values[1:3] == [0, 1] + + +@pytest.mark.parametrize("kind", INPUT_KINDS) +@pytest.mark.parametrize("missing_label", [None, "", "low"]) +def test_default_empty_and_existing_custom_missing_labels( + kind: str, missing_label: str | None +) -> None: + """Default, empty, and already-used labels must fill every missing custom bin.""" + training = _frame(kind, {"x": [0.0, 5.0, 10.0]}) + heldout = _frame(kind, {"x": [2.0, 8.0, None, float("nan")]}) + config: dict[str, Any] = { + "columns": ["x"], + "strategy": "custom", + "custom_bins": {"x": [0.0, 5.0, 10.0]}, + "custom_labels": {"x": ["low", "high"]}, + "missing_strategy": "label", + } + if missing_label is not None: + config["missing_label"] = missing_label + artifact = GeneralBinningCalculator().fit(training, config) + result = _native(GeneralBinningApplier().apply(heldout, artifact)) + expected_label = "Missing" if missing_label is None else missing_label + assert result["x_binned"].to_list() == ["low", "high", expected_label, expected_label] + + +@pytest.mark.parametrize("kind", INPUT_KINDS) +@pytest.mark.parametrize("drop_original", [False, True]) +def test_label_mode_preserves_empty_selection_and_only_drops_binned_columns( + kind: str, drop_original: bool +) -> None: + """Missing labels must not cause unselected or unfitted columns to be removed.""" + frame = _frame(kind, {"x": [0.0, 5.0, 10.0], "empty": [None] * 3, "other": [1, 2, 3]}) + config = { + "columns": [], + "missing_strategy": "label", + "drop_original": drop_original, + "n_bins": 2, + } + calculator = GeneralBinningCalculator() + applier = GeneralBinningApplier() + artifact = calculator.fit(frame, config) + unchanged = _native(applier.apply(frame, artifact)) + assert list(unchanged.columns) == ["x", "empty", "other"] + + config["columns"] = ["x", "empty", "absent"] + artifact = calculator.fit(frame, config) + result = _native(applier.apply(frame, artifact)) + expected_columns = ["empty", "other", "x_binned"] + if not drop_original: + expected_columns.insert(0, "x") + assert result["empty"].to_list() == [None] * 3 + assert result["other"].to_list() == [1, 2, 3] + assert list(result.columns) == expected_columns + + +@pytest.mark.parametrize("label_format", ["ordinal", "bin_index", "range"]) +def test_polars_label_mode_keeps_string_dtype_across_batches(label_format: str) -> None: + """A labeled column needs one schema for populated, missing, and empty batches.""" + training = pl.DataFrame({"x": [0.0, 5.0, 10.0]}) + artifact = GeneralBinningCalculator().fit( + training, + { + "columns": ["x"], + "n_bins": 2, + "label_format": label_format, + "missing_strategy": "label", + }, + ) + batches = [] + for values in ([2.0, 8.0], [None, float("nan")], []): + frame = pl.DataFrame({"x": pl.Series(values, dtype=pl.Float64)}) + batches.append(GeneralBinningApplier().apply(frame, artifact)) + combined = pl.concat(batches) + expected_bins = ["[0.0, 5.0]", "[5.0, 10.0]"] if label_format == "range" else ["0", "1"] + assert all(batch["x_binned"].dtype == pl.String for batch in batches) + assert combined["x_binned"].to_list() == [*expected_bins, "Missing", "Missing"] diff --git a/skyulf-core/tests/integration/test_group_aggregate_null_keys.py b/skyulf-core/tests/integration/test_group_aggregate_null_keys.py new file mode 100644 index 000000000..ccc4e5be4 --- /dev/null +++ b/skyulf-core/tests/integration/test_group_aggregate_null_keys.py @@ -0,0 +1,117 @@ +"""Pin missing-key parity at the public fitted feature-generation boundary.""" + +from typing import Any + +import pandas as pd +import polars as pl +import pytest + +from skyulf.engines import SkyulfPolarsWrapper +from skyulf.engines.pandas_engine import SkyulfPandasWrapper +from skyulf.preprocessing.feature_generation import ( + FeatureGenerationApplier, + FeatureGenerationCalculator, +) + +_FRAME_KINDS = ["pandas", "polars", "pandas_wrapper", "polars_wrapper"] + + +def _frame(data: dict[str, list[Any]], frame_kind: str) -> Any: + """Keep native Polars null and IEEE NaN keys distinct in the input fixture.""" + if frame_kind == "pandas": + return pd.DataFrame(data) + if frame_kind == "pandas_wrapper": + return SkyulfPandasWrapper(pd.DataFrame(data)) + frame = pl.DataFrame(data) + return SkyulfPolarsWrapper(frame) if frame_kind == "polars_wrapper" else frame + + +def _config(method: str) -> dict[str, Any]: + """Use the single-group-column payload produced by the Canvas editor.""" + return { + "operations": [ + { + "operation_type": "group_agg", + "method": method, + "input_columns": ["group"], + "secondary_columns": ["value"], + "output_column": "group_value", + } + ] + } + + +@pytest.mark.parametrize("frame_kind", _FRAME_KINDS) +@pytest.mark.parametrize( + ("method", "missing_group", "known_group"), + [ + ("mean", 6.0, 20.0), + ("sum", 12.0, 40.0), + ("count", 2.0, 2.0), + ("min", 4.0, 10.0), + ("max", 8.0, 30.0), + ("std", 2.8284271247461903, 14.142135623730951), + ("median", 6.0, 20.0), + ], +) +def test_null_and_nan_keys_share_training_aggregate( + frame_kind: str, method: str, missing_group: float, known_group: float +) -> None: + """Mixed null/NaN keys must share one learned group for training and held-out rows.""" + train = _frame( + { + "group": [1.0, None, float("nan"), None, 1.0], + "value": [10.0, 4.0, 8.0, None, 30.0], + }, + frame_kind, + ) + params = FeatureGenerationCalculator().fit(train, _config(method)) + heldout = _frame( + { + "group": [float("nan"), None, 1.0, 9.0], + "value": [10000.0, -10000.0, 999.0, 500.0], + }, + frame_kind, + ) + + train_out = FeatureGenerationApplier().apply(train, params) + heldout_out = FeatureGenerationApplier().apply(heldout, params) + + assert train_out["group_value"].to_list() == pytest.approx( + [known_group, missing_group, missing_group, missing_group, known_group] + ) + values = heldout_out["group_value"].to_list() + assert values[:3] == pytest.approx([missing_group, missing_group, known_group]) + assert pd.isna(values[3]) + + +@pytest.mark.parametrize("frame_kind", _FRAME_KINDS) +@pytest.mark.parametrize(("method", "known_group"), [("mean", 20.0), ("count", 2.0)]) +def test_unseen_missing_keys_do_not_learn_from_heldout_rows( + frame_kind: str, method: str, known_group: float +) -> None: + """Missing keys absent from training must remain missing even with held-out values.""" + train = _frame({"group": [1.0, 1.0], "value": [10.0, 30.0]}, frame_kind) + params = FeatureGenerationCalculator().fit(train, _config(method)) + heldout = _frame( + { + "group": [None, float("nan"), 9.0, 1.0], + "value": [100.0, 200.0, 300.0, 400.0], + }, + frame_kind, + ) + + out = FeatureGenerationApplier().apply(heldout, params) + + values = out["group_value"].to_list() + assert all(pd.isna(value) for value in values[:3]) + assert values[3] == known_group + + +@pytest.mark.parametrize("frame_kind", _FRAME_KINDS) +def test_unfitted_public_aggregate_cannot_reach_legacy_batch_helpers(frame_kind: str) -> None: + """Reject legacy artifacts before divergent batch helpers can aggregate inference rows.""" + frame = _frame({"group": [1.0, None], "value": [10.0, 20.0]}, frame_kind) + + with pytest.raises(ValueError, match="requires fitted statistics"): + FeatureGenerationApplier().apply(frame, _config("mean")) diff --git a/skyulf-core/tests/integration/test_inspection.py b/skyulf-core/tests/integration/test_inspection.py index fbf537fe8..c4940a633 100644 --- a/skyulf-core/tests/integration/test_inspection.py +++ b/skyulf-core/tests/integration/test_inspection.py @@ -7,6 +7,7 @@ counts, and that apply never mutates the frame. """ +from decimal import Decimal from typing import Any, cast import numpy as np @@ -15,6 +16,7 @@ import pytest from tests.utils.test_case_loader import TestCaseLoader +from skyulf.engines.registry import EngineRegistry from skyulf.preprocessing.inspection import ( DatasetProfileApplier, DatasetProfileCalculator, @@ -51,6 +53,67 @@ def _make_text_only_frame(engine: str) -> pd.DataFrame | pl.DataFrame: return pd.DataFrame(data) +@pytest.mark.parametrize("engine", ["pandas", "polars"]) +@pytest.mark.parametrize("wrapped", [False, True]) +def test_profile_numeric_coverage_includes_small_binary_constant_and_missing_columns( + engine: str, + wrapped: bool, +) -> None: + """Changing engines must not hide numeric columns needed to diagnose a dataset.""" + integer_dtypes = ["int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64"] + frame = pd.DataFrame({dtype: pd.Series([2, 4, 6], dtype=dtype) for dtype in integer_dtypes}) + frame["float32"] = pd.Series([2.0, 4.0, 6.0], dtype="float32") + frame["float64"] = [2.0, 4.0, 6.0] + frame["binary"] = [0, 1, 0] + frame["constant"] = [7, 7, 7] + frame["all_missing"] = pd.Series([pd.NA] * 3, dtype="Float64") + frame["decimal"] = pd.Series([Decimal("1.25"), None, Decimal("3.75")]) + expected_columns = list(frame.columns) + frame["label"] = ["a", "b", "c"] + frame["category"] = pd.Categorical(["a", "b", "a"]) + frame["boolean"] = [True, False, True] + frame["date"] = pd.to_datetime(["2026-01-01", "2026-01-02", "2026-01-03"]) + frame["duration"] = pd.to_timedelta([1, 2, 3], unit="s") + original = frame.copy(deep=True) + data: Any = pl.from_pandas(frame) if engine == "polars" else frame + if wrapped: + data = EngineRegistry.wrap(data) + + artifact = DatasetProfileCalculator().fit(data, {}) + stats = artifact["profile"]["numeric_stats"] + + assert list(stats) == expected_columns + for col in [*integer_dtypes, "float32", "float64"]: + assert stats[col]["mean"] == pytest.approx(4.0) + assert stats[col]["min"] == pytest.approx(2.0) + assert stats[col]["max"] == pytest.approx(6.0) + assert stats["constant"]["mean"] == pytest.approx(7.0) + assert stats["constant"]["std"] == pytest.approx(0.0) + assert stats["binary"]["mean"] == pytest.approx(1 / 3) + assert stats["all_missing"]["count"] == 0 + assert pd.isna(stats["all_missing"]["mean"]) + assert stats["decimal"]["mean"] == pytest.approx(2.5) + assert artifact["profile"]["missing"]["all_missing"] == 3 + assert DatasetProfileApplier().apply(data, cast(dict[str, Any], artifact)) is data + pd.testing.assert_frame_equal(frame, original) + + +@pytest.mark.parametrize("engine", ["pandas", "polars"]) +def test_profile_empty_typed_numeric_columns_remain_visible(engine: str) -> None: + """An empty input must retain numeric coverage and report zero observations.""" + frame = pd.DataFrame( + {"small": pd.Series([], dtype="int8"), "unsigned": pd.Series([], dtype="uint16")} + ) + data: Any = pl.from_pandas(frame) if engine == "polars" else frame + + artifact = DatasetProfileCalculator().fit(data, {}) + stats = artifact["profile"]["numeric_stats"] + + assert list(stats) == ["small", "unsigned"] + assert stats["small"]["count"] == 0 + assert stats["unsigned"]["count"] == 0 + + def _fit_apply( calculator: DatasetProfileCalculator | DataSnapshotCalculator, applier: DatasetProfileApplier | DataSnapshotApplier, From 7947d5af1fb8430dad70f18d7111e0dd7d301f79 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 19:28:44 +0300 Subject: [PATCH 06/17] fix(core): preserve calibrated model choices and validate preprocessing advice Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 14 + docs/reference/modeling_nodes.md | 25 ++ docs/reference/preprocessing_nodes.md | 8 + docs/user_guide/eda_profiling.md | 14 + .../analysis/opus_core_analysis-open_queue.md | 8 +- .../analysis/opus_core_analysis-tracker.md | 100 +++++- .../opus_core_analysis/05-profiling.md | 7 + .../opus_core_analysis/08-modeling-tuning.md | 10 + .../opus_core_analysis/14-hyperparameters.md | 16 + .../opus_core_analysis/17-file-coverage.md | 7 + skyulf-core/skyulf/modeling/classification.py | 97 ++++-- .../modeling/hyperparameters/_calibration.py | 8 +- .../preprocessing/cleaning/invalid_value.py | 58 +++- .../profiling/_analyzer/recommendations.py | 53 ++-- .../test_invalid_value_numeric_contract.py | 209 ++++++++++++ .../test_profiling_recommendation_safety.py | 116 +++++++ ...test_calibrated_classifier_random_state.py | 299 ++++++++++++++++++ .../test_calibrated_tuning_selection.py | 88 ++++++ 18 files changed, 1075 insertions(+), 62 deletions(-) create mode 100644 skyulf-core/tests/integration/test_invalid_value_numeric_contract.py create mode 100644 skyulf-core/tests/integration/test_profiling_recommendation_safety.py create mode 100644 skyulf-core/tests/unit/test_calibrated_classifier_random_state.py create mode 100644 tests/integration/test_calibrated_tuning_selection.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index efc3ec698..230f7d80d 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,20 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **Calibrated base selection in tuning (OC-66 follow-up):** honor Base + Estimator search choices in every strategy and final refit, including fold + preprocessing. Random Forest selection no longer fails in Optuna/halving + or silently trains logistic regression in Grid/Random search. +- **EDA transformation advice (OC-51):** choose transformations compatible + with the value range and skew direction. Preparation recommendations now + suppress the contradictory clean-dataset message, including target resampling. +- **Calibrated classifier seeds (OC-101):** apply `random_state` to stochastic + base estimators during training, tuning and final refitting. Default 42 and + explicit 0/None are respected; calibration CV splitting remains unchanged. +- **Invalid-value replacement (OC-140):** reject nonnumeric selections with + a clear error before either engine can coerce text or compare it to numbers. + Numeric text requires explicit conversion; temporal columns are excluded + from automatic selection, and inactive configurations preserve their input. - **Dataset Profile coverage (OC-59):** report supported numeric dtypes on both engines, including small/unsigned integers, binary, constant and entirely missing numeric columns. Rerun the node to refresh saved profiles. diff --git a/docs/reference/modeling_nodes.md b/docs/reference/modeling_nodes.md index 4848bbd51..eac463a06 100644 --- a/docs/reference/modeling_nodes.md +++ b/docs/reference/modeling_nodes.md @@ -76,6 +76,31 @@ Learned params: - fitted sklearn estimator (stored in-memory and pickled when saving the pipeline) +### calibrated_classifier + +Calibrates a selected base classifier using sigmoid or isotonic calibration. +Defaults are `base_estimator="logistic_regression"`, `method="sigmoid"` and +`cv=5`. Other base choices are `random_forest`, `gradient_boosting`, +`decision_tree`, `gaussian_nb` and `svc`. + +In advanced mode, Base Estimator is a search choice. For example, +`"search_space": {"base_estimator": ["random_forest"], "method": ["isotonic"], +"cv": [3]}` tunes a calibrated random forest. Selecting multiple bases compares +those classifier families. All five search strategies preserve this choice +during trials and the final refit, including with preprocessing fitted inside +each fold. The winning parameters retain the selected base name in reports. + +`random_state` controls randomness in base estimators that support it, including +the models fitted inside calibration folds. It defaults to 42, accepts 0, and +can be set to `None` (`null` in JSON) for unseeded fitting. It also applies during +tuning and the final model refit. Deterministic estimators such as Gaussian +Naive Bayes are unaffected. An integer `cv` retains unshuffled calibration +folds; this seed does not change those splits. + +For example, `{"base_estimator": "random_forest", "random_state": 7}` now +seeds the calibrated forest with 7. Previously the forest always used 42. +Existing fitted models retain their predictions; retrain to apply the setting. + ### random_forest_classifier Backed by `sklearn.ensemble.RandomForestClassifier`. diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index fc8165fa2..36a9f435b 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -156,6 +156,14 @@ Config: - `replacement`: any (default NaN) - `min_value` / `max_value`: used by `custom_range` +Active numeric rules and infinity replacement require numeric selected columns +on both engines. Text, categorical, Boolean and temporal selections raise a +`ValueError` naming the columns; convert numeric text explicitly before this +node. The same check runs when applying a fitted artifact, so inference data +that changes a selected column to text fails clearly without coercing values. +Automatic selection excludes temporal columns. An empty selection or a +configuration with no active rule or infinity replacement leaves data untouched. + Learned params: - `columns`, `rule`, `replacement`, `min_value`, `max_value` diff --git a/docs/user_guide/eda_profiling.md b/docs/user_guide/eda_profiling.md index 089225b93..a352843f6 100644 --- a/docs/user_guide/eda_profiling.md +++ b/docs/user_guide/eda_profiling.md @@ -110,6 +110,20 @@ Skyulf automatically flags potential data quality issues: * **Class Imbalance:** Target variables with skewed class distributions. * **Data Leakage:** Features with 1.0 correlation to the target. +### Smart Recommendations + +For highly skewed numeric columns, transformation advice follows the observed +value range. Log or Box-Cox is suggested for strictly positive, right-skewed +data. Columns containing zero or negative values, left-skewed columns, and +profiles with an unknown minimum receive Yeo-Johnson advice instead. These +are suggestions to evaluate; EDA does not transform the source data. + +The clean-dataset message appears only when no drop, imputation, transformation, +encoding or resampling action is recommended. It describes the outcome of +these checks, without certifying that a dataset is ready for modeling. An +informational balanced-target message can appear alongside it. Rerun saved +analyses to refresh their recommendations. + ### 3. Advanced Analysis * **Outlier Detection:** Uses Isolation Forest to identify anomalous rows. * **PCA:** Computes Principal Components to visualize high-dimensional data structure. diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index e0b56dcc3..8af659224 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,9 +27,8 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 31 open / 4 parked.** OC-59/60 are fixed and -OC-24 is verified already fixed at the public fit/apply boundary; all three -are recorded in the archive. +**Current status (2026-09-12): 28 open / 4 parked.** OC-51/101/140 are fixed +and recorded in the archive with reproduction and regression evidence. Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -65,7 +64,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-91 | 🟑 | Three public `core/` seams (263 lines) have zero call sites; one duplicates a differently-shaped backend class name | small | ⬜ open | -| OC-101 | 🟑 | `calibrated_classifier`'s `random_state` no-op for two independent reasons (estimator rejects it AND factories hardcode the seed) | small | ⬜ open | | OC-111 | 🟑 | A profiling recommendation branch is unreachable | small | ⬜ open | | OC-102 | βšͺ | Five tunable models return an empty search space from the live `/defaults` endpoint (`hyperparameters/_registry.py`) | small | ⬜ open | | OC-90 | βšͺ | Unknown split config keys silently dropped instead of rejected (`preprocessing/split.py`) | small | ⬜ open | @@ -74,7 +72,6 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-140 | 🟠 | `InvalidValueReplacement` diverges across engines on non-numeric columns (pandas silently NaNs, polars raises) | small | ⬜ open | ### Remaining β€” cross-cutting & packaging @@ -106,7 +103,6 @@ closed that on 2026-09-07. | OC-47 | 🟑 | Common-column dtype drift can silently disappear (`profiling/drift.py:136-153`) | small | ⬜ open | | OC-48 | 🟑 | Expectations pass vacuously on empty frames (`profiling/expect.py:92-209`) | small | ⬜ open | | OC-50 | 🟑 | Binary targets miss class-balance advice or flip to regression by sample size (`recommendations.py:147-152`) | small | ⬜ open | -| OC-51 | 🟑 | Transform advice can be mathematically invalid and self-contradictory (`recommendations.py:66-78,129-139`) | small | ⬜ open | ### Remaining β€” core / engines / pipeline diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 91032ac6b..46c7e0ac9 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -110,7 +110,7 @@ uses, so a fixed finding stays where it was filed. | OC-20 | 🟑 | Value Replacement's "empty columns = all columns" UI promise is false (`cleaning/value_replacement.py:163-180`) | small | βœ… fixed 2026-09-04 | | OC-53 | 🟑 | `select_from_model`'s `max_features` is Python-only, UI-unreachable | small | βœ… fixed 2026-09-04 | | OC-61 | βšͺ | `BinningNode`'s "Precision (Decimals)" UI field never sent to backend (`BinningNode.tsx`) | small | βœ… fixed 2026-09-04 | -| OC-66 | 🟠 | `CalibratedClassifierCV`'s user-selected base estimator silently discarded during tuning (`classification.py:206-282` vs `_tuning/engine.py:495-499`) | small | βœ… fixed 2026-09-04 | +| OC-66 | 🟠 | `CalibratedClassifierCV`'s user-selected base estimator silently discarded during tuning (`classification.py` vs `_tuning/engine.py`) | small | βœ… completed 2026-09-12 β€” the earlier flat-config fix missed Canvas search-space candidates; every strategy now resolves the selected base through trial fitting and final refitting, including fold pipelines. | | OC-16 | 🟠 | KNN/Iterative imputers crash on all-missing fitted columns (`imputation/knn.py:64-76`, `iterative.py:68-84`) | small | βœ… fixed 2026-09-04 | | OC-17 | 🟠 | SimpleImputer polars mean/median crashes on all-null columns (engine divergence, `imputation/_common.py:32-37`) | small | βœ… fixed 2026-09-04 | | OC-69 | 🟠 | Engine trusts `config.nodes` list order, never verifies topological sort (`_schema_graph.py:49-70`); `_kahn_topological_order` already exists β€” wiring fix | small | βœ… fixed 2026-09-04 | @@ -184,6 +184,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-101 | 🟑 | `calibrated_classifier`'s `random_state` is dropped and its factories hardcode the seed | small | βœ… fixed 2026-09-12 β€” a cloneable calibration wrapper seeds supported base estimators during training, tuning and final refitting; defaults, explicit 0/None, unshuffled integer CV and saved predictions are covered. | | OC-121 | βšͺ | Polars Enum columns omitted by text auto-selection, unlike pandas Categorical (`preprocessing/_helpers.py`) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Enum dtypes in the shared selector; TextCleaning and AliasReplacement now include them while preserving nulls, explicit selections and replay behavior. | | OC-120 | 🟠 | Decimal columns skipped by numeric auto-selection and mishandled during explicit numeric processing (`utils.py`, `preprocessing/_helpers.py` and numeric nodes) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Polars and pandas object Decimals, normalize selected values at numeric boundaries, and preserve missingness, source values and target alignment. | | OC-110 | 🟠 | Semantic-type inference misclassifies small categorical columns as `Text`, so task type never inferred (`profiling/_analyzer/_utils.py`, `analyzer.py`) | small | βœ… fixed 2026-09-12 β€” infer repeated small string categories from non-null counts in both profiling paths, restoring statistics and classification target analysis. | @@ -197,6 +198,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-140 | 🟠 | `InvalidValueReplacement` silently coerces nonnumeric values on pandas but fails on Polars | small | βœ… fixed 2026-09-12 β€” reject nonnumeric selections consistently before active operations at fit/apply, exclude durations from automatic selection, and preserve inactive operations, source values, targets and existing wrapper output conventions. | | OC-142 | 🟠 | EDA correlation ratio Ξ· exceeds 1.0 with nulls; null-heavy columns rank as strongest association | small | βœ… fixed 2026-09-11 - use complete target-feature pairs for all group counts, means and sums of squares; preserve source rows and correct report ranking. | | OC-144 | βšͺ | Geo distance column named `_km` even when the unit is miles | small | βœ… fixed 2026-09-11 - resolve automatic names from the selected unit; preserve explicit configuration and saved artifact names. | | OC-143 | 🟠 | RFE ignores the UI's `k`, silently selecting half the features β€” **duplicate of OC-25**, same file and line; one fix retires both | small | βœ… fixed 2026-09-05 β€” with OC-25 | @@ -245,6 +247,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-51 | 🟑 | Transform advice can be mathematically invalid and contradict the clean-dataset message | small | βœ… fixed 2026-09-12 β€” use domain/skew-aware transform advice and evaluate all preparation recommendations, including target resampling, before emitting a limited clean-dataset message. | | OC-247 | 🟑 | Missing categorical values inflate unique/rare-label counts and consume a top-10 frequency slot (`profiling/analyzer.py`, `_analyzer/categorical.py`) | small | βœ… filed and fixed 2026-09-12 β€” exclude nulls before frequency ranking and rare-label aggregation, and remove the null entry from the distinct-label count. | | OC-235 | 🟠 | Directed causal edges are serialized backwards (`profiling/_analyzer/causal.py`) | small | βœ… fixed 2026-09-11 β€” preserve causal-learn endpoint order; real graph objects and public collider regressions verify both orientations. | | OC-236 | 🟠 | Nominal target codes feed Pearson/Fisher-Z as numeric magnitudes, making results depend on category order (`profiling/analyzer.py`) | design + medium | βœ… fixed 2026-09-11 β€” omit categorical targets from numeric analysis while preserving category associations; numeric task overrides and omission metadata are explicit. | @@ -406,6 +409,101 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-66 follow-up: Canvas calibrated base selection + +The user reported Optuna rejecting `model__estimator__base_estimator` after +selecting Random Forest for a calibrated classifier. This reopened an uncovered +path of OC-66: the 2026-09-04 fix handled a flat structural selection, and the +OC-101 seed regression manually prepared that flat shape. Neither covered the +Canvas multiselect's `tuning_config.search_space.base_estimator` list. + +Reproduced with the real backend `_prepare_tuning_config`, a StandardScaler +fold adapter and one Optuna trial: `method="isotonic"`, `cv=3` and +`base_estimator="random_forest"` reached the nested estimator's `set_params`, +which rejected the last key. Grid search instead silently filtered that key +and trained logistic regression. Thus adding scaling cannot repair this +parameter-routing error. + +The calibration-specific estimator now retains `base_estimator` as a cloneable +symbolic parameter. Each fit resolves the selected factory before applying the +seed, so searcher clones, fold pipelines and the winning refit all use the +requested model family. The factory is shared with the existing basic and flat +tuning paths, preserving their choices and fallback behavior. Multiple selected +bases remain valid search candidates; trial and best-parameter reports retain +JSON-safe names without internal pipeline prefixes. No frontend or backend +production change was needed. + +Added **12 Core regressions**, all observed failing before the repair: every +search strategy with and without fold preprocessing, observed trial/refit model +types and seeds, multi-base comparisons, cloning, changing candidates, source +configuration preservation and pickle round trips. Added **two backend +regressions** using Canvas-shaped node config and real Grid/Optuna training; +both failed before the fix and now pass. Together with the OC-101 checks, the +calibration module passes 33 cases. + +Final related verification: **395 Core tests and 171 backend tests passed**, +covering calibration, hyperparameters, all tuning strategies, fold replay and +node runners. Scoped Ruff lint/format, the configured full ty check and an +independent review passed. Updated model docs, dynamic field help, changelog +and both source-audit notes. OC-66 keeps its existing archive row, now marked +completed for the actual Canvas path; queue remains **28 open / 4 parked**. + +### 2026-09-12 β€” OC-51/101/140: recommendations, calibration seeds and numeric rules + +Committed OC-24/59/60 as `9663132a` after 131 fresh focused tests, a strict +documentation build and all applicable commit hooks passed. Continued with +three independent findings, two implementation agents and a separate review +of each change. + +**OC-51 β€” fixed.** Public analysis of `[-100, 1, 2, 3, 4, 5, 6, 7]` and +zero-containing skewed data recommended Log/Box-Cox and simultaneously claimed +modeling readiness. An imbalanced string target also produced both Keep and +Resample. Log/Box-Cox advice now requires known positive values and right skew; +non-positive values, left skew and unknown domain evidence use Yeo-Johnson. +The clean message is evaluated after target advice and is suppressed by Drop, +Impute, Transform, Encode or Resample. Its text describes these checks rather +than certifying readiness. New public-profile and serialized-payload tests +cover those actions, signed/zero/positive domains, incomplete/nonfinite stats, +thresholds, source preservation and the allowed Info+Keep case: **20 failed +before the repair, 22 passed afterward**. The existing Insights tab displays +the supplied recommendation text; no frontend change was required. + +**OC-101 β€” fixed.** A configured calibrated random forest seed of 7 was +dropped as unsupported, and its base estimator still used 42. The tuning path +constructs and clones `model_class` directly, so a calculator-only change would +leave tuning broken. A small calibration-specific sklearn subclass accepts the +seed and applies it to a cloned supported base estimator at fit. It covers +ordinary training, search clones and final refitting without changing generic +wrappers. Default 42, explicit 0 and None, deterministic bases and integer CV +semantics are preserved. Dynamic hyperparameter text now describes the actual +control. **17 initial regression failures** led to **21 passing new cases**, +including fitted fold seeds, repeatable/different forest predictions, caller +preservation on success/failure, clone/set_params, public tuning and pickle +round trips. Existing fitted artifacts keep their predictions; retraining +applies previously ignored custom seeds. + +**OC-140 β€” fixed.** With Canvas-shaped `mode="negative_to_nan"` on +`["hello", "-3", "2"]`, pandas produced `[NaN, NaN, 2.0]` while Polars raised +a numeric comparison error. Active numeric operations now reject selected +nonnumeric columns consistently at fit and apply, naming the columns and +requiring explicit conversion. Apply validation also covers inference dtype +changes. A local numeric selector excludes pandas durations from automatic +selection, matching Polars. Inactive operations remain no-ops. Four native/ +wrapped engine shapes cover rules, infinity flags, temporal/text/category/bool +inputs, Decimal/nullable numeric values, empty selections and source/target +preservation. **59 original failures**, two duration failures and five wrapper +return-type failures were observed during development; the final new module +passes **116 cases**. The wrapper regressions ensured no-op handling preserves +the dispatcher's native pandas output and wrapped Polars output. Canvas already +restricts selection to numeric columns and passes the config through. + +Final combined verification: **1,566 Core tests passed** across profiling, +classification, tuning, cleaning, registry and artifact/schema coverage; +**79 backend tests passed** across EDA, frontend-node contracts and cleaning/ +preprocessing integration. Scoped Ruff lint and format checks, the configured +full ty check, and independent reviews of all three changes passed. User docs, +changelog and source findings were updated. Queue: **28 open / 4 parked**. + ### 2026-09-12 β€” OC-24/59/60: parallel preprocessing audit closure After committing OC-121 as `2ba4c67c`, investigated three independent findings diff --git a/initiatives/analysis/opus_core_analysis/05-profiling.md b/initiatives/analysis/opus_core_analysis/05-profiling.md index d22ce9c38..5e6c64e3d 100644 --- a/initiatives/analysis/opus_core_analysis/05-profiling.md +++ b/initiatives/analysis/opus_core_analysis/05-profiling.md @@ -269,6 +269,13 @@ when `target_col` is supplied, independent of row count. --- ### OC-51 + +**Resolved 2026-09-12.** Transformation advice checks the observed domain and +skew direction. All preparation actions, including target resampling, suppress +the clean-dataset message; its wording no longer promises modeling readiness. +See the [verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-51101140-recommendations-calibration-seeds-and-numeric-rules). +The original reproduction below is retained as historical evidence. + ### 🟑 Medium β€” Transform advice can be invalid and self-contradictory **File:** `_analyzer/recommendations.py:66-78,129-139` diff --git a/initiatives/analysis/opus_core_analysis/08-modeling-tuning.md b/initiatives/analysis/opus_core_analysis/08-modeling-tuning.md index 4ed955045..d33e41cde 100644 --- a/initiatives/analysis/opus_core_analysis/08-modeling-tuning.md +++ b/initiatives/analysis/opus_core_analysis/08-modeling-tuning.md @@ -11,6 +11,16 @@ ## Findings ### OC-66 + +**Completed 2026-09-12 after user-reported re-verification.** The earlier +flat-configuration repair did not handle Canvas selections inside +`search_space`. Grid/Random silently used logistic regression, while +Optuna/halving rejected the symbolic `base_estimator` parameter. The calibration +wrapper now accepts and resolves each candidate choice, including nested fold +pipelines and final refitting. See the +[follow-up log](../opus_core_analysis-tracker.md#2026-09-12-oc-66-follow-up-canvas-calibrated-base-selection). +The original reproduction below is retained as historical evidence. + ### 🟠 High β€” `CalibratedClassifierCV`'s user-selected base estimator is silently discarded during tuning **Files:** `skyulf/modeling/classification.py:206-282` (resolution) vs diff --git a/initiatives/analysis/opus_core_analysis/14-hyperparameters.md b/initiatives/analysis/opus_core_analysis/14-hyperparameters.md index 62f829aa1..2b76c5ec6 100644 --- a/initiatives/analysis/opus_core_analysis/14-hyperparameters.md +++ b/initiatives/analysis/opus_core_analysis/14-hyperparameters.md @@ -118,6 +118,14 @@ five, or have the endpoint return an explicit `not_tunable` marker. ### OC-101 + +**Resolved 2026-09-12.** The advertised seed now reaches stochastic base +estimators through a cloneable calibration-specific wrapper, covering direct +training, tuning and final refitting. Integer calibration folds remain +unshuffled; the field description now states what the seed controls. +See the [verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-51101140-recommendations-calibration-seeds-and-numeric-rules). +The original reproduction below is retained as historical evidence. + ### 🟑 Medium β€” `calibrated_classifier` declares a `random_state` field its estimator never accepts **File:** `skyulf-core/skyulf/modeling/hyperparameters/_calibration.py` @@ -186,6 +194,14 @@ splitter must be passed to `cv` β€” the field alone cannot deliver it. ### OC-66 root cause confirmed β€” *merged, not re-filed* +**Follow-up correction 2026-09-12.** A field rename alone is insufficient: +the UI sends symbolic candidate names, not sklearn estimator objects. The +calibration wrapper now accepts those names as cloneable search parameters and +resolves each candidate during fitting. The real Canvas configuration and +fold-preprocessing path are covered in the +[follow-up log](../opus_core_analysis-tracker.md#2026-09-12-oc-66-follow-up-canvas-calibrated-base-selection). +The proposal below is historical and was not the implemented repair. + > **Merged, not re-filed:** this is the mechanism behind > [OC-66](./08-modeling-tuning.md#oc-66) ("`CalibratedClassifierCV`'s > user-selected base estimator is silently discarded during tuning"), which is diff --git a/initiatives/analysis/opus_core_analysis/17-file-coverage.md b/initiatives/analysis/opus_core_analysis/17-file-coverage.md index 3cc9ec6f5..b42d16069 100644 --- a/initiatives/analysis/opus_core_analysis/17-file-coverage.md +++ b/initiatives/analysis/opus_core_analysis/17-file-coverage.md @@ -41,6 +41,13 @@ reason the remaining 16 files are worth closing out. ### OC-140 🟠 High β€” `InvalidValueReplacement` diverges across engines on non-numeric columns +**Resolved 2026-09-12.** Active numeric operations now reject selected +nonnumeric columns consistently at fit and apply, including inference dtype +changes. Automatic selection excludes durations, and inactive configurations +preserve data. Numeric text must be converted explicitly before this node. +See the [verification log](../opus_core_analysis-tracker.md#2026-09-12-oc-51101140-recommendations-calibration-seeds-and-numeric-rules). +The original reproduction below is retained as historical evidence. + **File:** `skyulf/preprocessing/cleaning/invalid_value.py` The pandas path calls `pd.to_numeric(df_out[col], errors="coerce")` before diff --git a/skyulf-core/skyulf/modeling/classification.py b/skyulf-core/skyulf/modeling/classification.py index 5b4ff1aae..4103d56c7 100644 --- a/skyulf-core/skyulf/modeling/classification.py +++ b/skyulf-core/skyulf/modeling/classification.py @@ -5,7 +5,7 @@ from collections.abc import Callable from typing import Any, ClassVar -from sklearn.base import BaseEstimator +from sklearn.base import BaseEstimator, clone from sklearn.calibration import CalibratedClassifierCV from sklearn.ensemble import ( AdaBoostClassifier, @@ -192,6 +192,66 @@ def _validate_solver_penalty(self, config: dict[str, Any] | None) -> None: # --- Calibrated Classifier --- +_CALIBRATED_BASE_ESTIMATORS: dict[str, Callable[[], BaseEstimator]] = { + "logistic_regression": lambda: LogisticRegression(max_iter=1000), + "random_forest": lambda: RandomForestClassifier( + n_estimators=100, random_state=DEFAULT_RANDOM_STATE + ), + "gradient_boosting": lambda: GradientBoostingClassifier(random_state=DEFAULT_RANDOM_STATE), + "decision_tree": lambda: DecisionTreeClassifier(random_state=DEFAULT_RANDOM_STATE), + "gaussian_nb": GaussianNB, + "svc": lambda: SVC(probability=True, random_state=DEFAULT_RANDOM_STATE), +} + + +def _make_calibrated_base_estimator(key: str) -> BaseEstimator: + """Resolve a symbolic calibration base consistently for direct fits and search trials.""" + factory = _CALIBRATED_BASE_ESTIMATORS.get(key) + if factory is None: + logger.warning("Unknown base_estimator '%s'; falling back to logistic_regression.", key) + factory = _CALIBRATED_BASE_ESTIMATORS["logistic_regression"] + return factory() + + +class _SeededCalibratedClassifierCV(CalibratedClassifierCV): + """Resolve a cloneable base selection and seed for each calibration fit. + + Tuning constructs and clones ``model_class`` directly, bypassing the + calculator's ``fit``. Both ``base_estimator`` and ``random_state`` must + survive searcher ``set_params`` calls, including fold pipeline prefixes. + An explicit symbolic base overrides ``estimator`` for that candidate; + without one, the supplied estimator or sklearn default is preserved. + Integer CV folds retain sklearn's unshuffled splitting semantics. + """ + + def __init__( + self, + estimator: BaseEstimator | None = None, + *, + method: str = "sigmoid", + cv: Any = None, + n_jobs: int | None = None, + ensemble: bool | str = "auto", + random_state: int | None = DEFAULT_RANDOM_STATE, + base_estimator: str | None = None, + ) -> None: + """Keep constructor parameters intact for sklearn cloning and ``set_params``.""" + super().__init__( + estimator=estimator, method=method, cv=cv, n_jobs=n_jobs, ensemble=ensemble + ) + self.random_state = random_state + self.base_estimator = base_estimator + + def fit(self, X: Any, y: Any, sample_weight: Any = None, **fit_params: Any) -> Any: + """Resolve and seed this candidate without modifying a caller-supplied estimator.""" + if self.base_estimator is not None: + self.estimator = _make_calibrated_base_estimator(self.base_estimator) + estimator = self._get_estimator() + if "random_state" in estimator.get_params(deep=False): + self.estimator = clone(estimator).set_params(random_state=self.random_state) + return super().fit(X, y, sample_weight=sample_weight, **fit_params) + + class CalibratedClassifierApplier(SklearnApplier): """Calibrated Classifier Applier (well-calibrated predict_proba).""" @@ -215,21 +275,16 @@ class CalibratedClassifierCalculator(SklearnCalculator): The frontend sends ``base_estimator`` as a string key (e.g. ``"random_forest"``); it is resolved here into a fresh estimator instance before ``CalibratedClassifierCV`` is constructed. Defaults to logistic - regression for backward compatibility. + regression for backward compatibility. ``random_state`` seeds supported + base estimators, defaults to 42, and accepts ``None`` for unseeded fits. + It does not shuffle calibration CV folds or affect deterministic bases. + A tuning search space can select one or more ``base_estimator`` keys; + each candidate and the final refit use the selected classifier family. """ # Map of selectable base estimators β†’ factory. Each must support # ``predict_proba`` (or ``decision_function``) so calibration is meaningful. - BASE_ESTIMATORS: ClassVar[dict[str, Callable[[], BaseEstimator]]] = { - "logistic_regression": lambda: LogisticRegression(max_iter=1000), - "random_forest": lambda: RandomForestClassifier( - n_estimators=100, random_state=DEFAULT_RANDOM_STATE - ), - "gradient_boosting": lambda: GradientBoostingClassifier(random_state=DEFAULT_RANDOM_STATE), - "decision_tree": lambda: DecisionTreeClassifier(random_state=DEFAULT_RANDOM_STATE), - "gaussian_nb": GaussianNB, - "svc": lambda: SVC(probability=True, random_state=DEFAULT_RANDOM_STATE), - } + BASE_ESTIMATORS: ClassVar[dict[str, Callable[[], BaseEstimator]]] = _CALIBRATED_BASE_ESTIMATORS STRUCTURAL_TUNING_KEYS: tuple[str, ...] = ("base_estimator",) @@ -242,7 +297,7 @@ def __init__(self): :meth:`prepare_tuning_params` records a different selection. """ super().__init__( - model_class=CalibratedClassifierCV, + model_class=_SeededCalibratedClassifierCV, default_params={ "estimator": LogisticRegression(max_iter=1000), "method": "sigmoid", @@ -264,13 +319,7 @@ def default_params(self) -> dict[str, Any]: if self._tuning_base_config: key = self._tuning_base_config.get("base_estimator") if isinstance(key, str): - factory = self.BASE_ESTIMATORS.get(key) - if factory is None: - logger.warning( - "Unknown base_estimator '%s'; falling back to logistic_regression.", key - ) - factory = self.BASE_ESTIMATORS["logistic_regression"] - params["estimator"] = factory() + params["estimator"] = _make_calibrated_base_estimator(key) return params def prepare_tuning_params(self, config: dict[str, Any]) -> None: @@ -320,13 +369,7 @@ def _resolve_base_estimator(cls, config: dict[str, Any] | None) -> dict[str, Any bucket = dict(resolved["params"]) if nested else resolved key = bucket.pop("base_estimator", None) if isinstance(key, str): - factory = cls.BASE_ESTIMATORS.get(key) - if factory is None: - logger.warning( - "Unknown base_estimator '%s'; falling back to logistic_regression.", key - ) - factory = cls.BASE_ESTIMATORS["logistic_regression"] - bucket["estimator"] = factory() + bucket["estimator"] = _make_calibrated_base_estimator(key) if nested: resolved["params"] = bucket return resolved diff --git a/skyulf-core/skyulf/modeling/hyperparameters/_calibration.py b/skyulf-core/skyulf/modeling/hyperparameters/_calibration.py index ee80e5597..1809e32f4 100644 --- a/skyulf-core/skyulf/modeling/hyperparameters/_calibration.py +++ b/skyulf-core/skyulf/modeling/hyperparameters/_calibration.py @@ -20,7 +20,8 @@ ], description=( "Classifier whose probabilities are calibrated. Uses sensible " - "defaults for the chosen estimator." + "defaults for the chosen estimator. During tuning, each selected " + "classifier is a search candidate." ), ), HyperparameterField( @@ -47,5 +48,8 @@ max=10, description="Number of cross-validation folds used to fit the calibrator.", ), - random_state_field("Seed for the calibration CV split and the seeded base estimators."), + random_state_field( + "Seed for stochastic base estimators. Does not change calibration CV " + "splits or deterministic base estimators." + ), ] diff --git a/skyulf-core/skyulf/preprocessing/cleaning/invalid_value.py b/skyulf-core/skyulf/preprocessing/cleaning/invalid_value.py index 7129e3008..73e4c5c70 100644 --- a/skyulf-core/skyulf/preprocessing/cleaning/invalid_value.py +++ b/skyulf-core/skyulf/preprocessing/cleaning/invalid_value.py @@ -1,5 +1,6 @@ """Invalid-value replacement node.""" +from collections.abc import Mapping from typing import Any import numpy as np @@ -107,19 +108,57 @@ def _normalize_rule( return _RULE_ALIASES.get(raw_rule, raw_rule), min_value, max_value # ty: ignore[no-matching-overload] +def _has_numeric_operation(params: Mapping[str, Any]) -> bool: + """Identify rules and infinity flags that actually compare numeric values.""" + rule = params.get("rule") + return bool( + params.get("replace_inf") + or params.get("replace_neg_inf") + or rule in ("negative", "negative_to_nan", "zero") + or ( + rule == "custom_range" + and (params.get("min_value") is not None or params.get("max_value") is not None) + ) + ) + + +def _numeric_columns(X: Any) -> list[str]: + """Find numeric columns without treating pandas durations as raw nanoseconds.""" + return [ + col for col in _auto_detect_numeric_columns(X) if getattr(X[col].dtype, "kind", None) != "m" + ] + + +def _validate_numeric_columns(X: Any, columns: list[str]) -> None: + """Reject nonnumeric selections before either engine can coerce their values.""" + if not columns: + return + numeric = set(_numeric_columns(X)) + non_numeric = [col for col in columns if col not in numeric] + if non_numeric: + raise ValueError( + "InvalidValueReplacement requires numeric columns; " + f"non-numeric columns: {non_numeric}. " + "Convert these columns to a numeric type before applying numeric rules." + ) + + class InvalidValueReplacementApplier(BaseApplier): """Replace values violating the configured rule β€” and optionally Β±inf β€” with a sentinel. The pandas and polars paths must agree value-for-value: ``inf``/``-inf`` are replaced first when flagged, then the rule (``negative``, ``zero`` or ``custom_range``, which honours a single bound when only one is given). A - column with neither a rule nor an inf flag configured is skipped outright, - so its values and dtype survive untouched. + configuration without an effective rule or an inf flag is skipped outright, + so its values and dtype survive untouched. Active operations require numeric + columns on both engines; text must be explicitly converted before this node. """ @apply_method def apply(self, X: Any, _y: Any, params: dict[str, Any]) -> Any: # pylint: disable=arguments-differ """Dispatch the rule to the pandas or polars path; ``y`` passes through.""" + if _has_numeric_operation(params): + _validate_numeric_columns(X, resolve_valid_columns(X, params.get("columns", []))) return apply_dual_engine( X, params, {"polars": self._apply_polars, "pandas": self._apply_pandas} ) @@ -127,7 +166,7 @@ def apply(self, X: Any, _y: Any, params: dict[str, Any]) -> Any: # pylint: disa @staticmethod def _apply_polars(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: valid = resolve_valid_columns(X, params.get("columns", [])) - if not valid: + if not valid or not _has_numeric_operation(params): return X, _y replace_inf = params.get("replace_inf", False) @@ -158,7 +197,7 @@ def _apply_pandas_column( min_value: Any, max_value: Any, ) -> None: - """Coerce, replace inf/-inf, and apply the invalid-value rule for a single column in-place.""" + """Normalize numeric data, replace infinities, and apply a rule in-place.""" to_replace = [] if replace_inf: to_replace.append(np.inf) @@ -181,7 +220,7 @@ def _apply_pandas_column( @staticmethod def _apply_pandas(X: Any, _y: Any, params: dict[str, Any]) -> tuple[Any, Any]: valid = resolve_valid_columns(X, params.get("columns", [])) - if not valid: + if not valid or not _has_numeric_operation(params): return X, _y replace_inf = params.get("replace_inf", False) @@ -234,16 +273,18 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> InvalidValueReplacemen rather than in each engine: ``percentage_bounds``/``age_bounds`` become a ``custom_range`` carrying their default bounds unless the user overrode them, and ``zero_to_nan`` becomes ``zero``. + Active rules reject nonnumeric selected columns with ``ValueError``; + the applier repeats this check when inference data changes dtype. """ if user_picked_no_columns(config): return {} - cols = resolve_columns(X, config, _auto_detect_numeric_columns) + cols = resolve_columns(X, config, _numeric_columns) rule, min_value, max_value = _normalize_rule( config.get("rule") or config.get("mode"), config.get("min_value"), config.get("max_value"), ) - return { + params: InvalidValueReplacementArtifact = { "type": "invalid_value_replacement", "columns": cols, "replace_inf": config.get("replace_inf", False), @@ -254,3 +295,6 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> InvalidValueReplacemen "min_value": min_value, "max_value": max_value, } + if _has_numeric_operation(params): + _validate_numeric_columns(X, cols) + return params diff --git a/skyulf-core/skyulf/profiling/_analyzer/recommendations.py b/skyulf-core/skyulf/profiling/_analyzer/recommendations.py index 1cdd26cf8..20b16d4b7 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/recommendations.py +++ b/skyulf-core/skyulf/profiling/_analyzer/recommendations.py @@ -3,7 +3,7 @@ from ..schemas import Alert, ColumnProfile, Recommendation from ._utils import _AnalyzerState -# |skew| above this triggers a log/Box-Cox transform recommendation. +# |skew| above this triggers domain-aware transform advice. SKEWNESS_TRANSFORM_THRESHOLD = 1.5 # Class-ratio bands: above the upper band the target is balanced, below the # lower band it is imbalanced enough to recommend resampling. @@ -20,6 +20,7 @@ def _generate_recommendations( alerts: list[Alert], target_col: str | None, ) -> list[Recommendation]: + """Collect actionable advice before deciding whether a clean message applies.""" recs: list[Recommendation] = [] for col, profile in profiles.items(): @@ -33,8 +34,8 @@ def _generate_recommendations( for col, profile in profiles.items(): recs.extend(self._id_column_recommendations(col, profile)) - recs.extend(self._clean_dataset_recommendation(recs)) recs.extend(self._target_balance_recommendations(profiles, target_col)) + recs.extend(self._clean_dataset_recommendation(recs)) return recs @@ -64,21 +65,36 @@ def _missing_value_recommendations( return [] def _skewness_recommendations(self, col: str, profile: ColumnProfile) -> list[Recommendation]: - """Recommend a transformation for highly skewed numeric columns.""" + """Select transform advice using the numeric domain and skew direction. + + Log/Box-Cox advice requires positive observations and right skew. + Yeo-Johnson supports non-positive values and is also the fallback + when the profile cannot establish a strictly positive domain. + """ + stats = profile.numeric_stats if ( - profile.numeric_stats - and profile.numeric_stats.skewness - and abs(profile.numeric_stats.skewness) > SKEWNESS_TRANSFORM_THRESHOLD + stats is None + or stats.skewness is None + or abs(stats.skewness) <= SKEWNESS_TRANSFORM_THRESHOLD ): - return [ - Recommendation( - column=col, - action="Transform", - reason=f"High skewness ({profile.numeric_stats.skewness:.2f})", - suggestion=f"Apply Log or Box-Cox transformation to '{col}'.", - ) - ] - return [] + return [] + + positive_right_skew = ( + stats.skewness > 0 + and stats.min is not None + and stats.min > 0 + and not stats.zeros_count + and not stats.negatives_count + ) + method = "Log or Box-Cox" if positive_right_skew else "Yeo-Johnson" + return [ + Recommendation( + column=col, + action="Transform", + reason=f"High skewness ({stats.skewness:.2f})", + suggestion=f"Consider {method} transformation for '{col}'.", + ) + ] def _cardinality_recommendations( self, col: str, profile: ColumnProfile @@ -128,15 +144,14 @@ def _id_column_recommendations(self, col: str, profile: ColumnProfile) -> list[R return [] def _clean_dataset_recommendation(self, recs: list[Recommendation]) -> list[Recommendation]: - """Provide positive reinforcement when no critical issues were found.""" - critical_issues = [r for r in recs if r.action in ["Drop", "Impute"]] - if not critical_issues: + """Report no recommended preparation only after all actionable advice is known.""" + if not any(r.action in {"Drop", "Impute", "Transform", "Encode", "Resample"} for r in recs): return [ Recommendation( column=None, action="Keep", reason="Clean Dataset", - suggestion="No missing values or constant columns found. Data is ready for modeling!", + suggestion="No data preparation changes were recommended by these checks.", ) ] return [] diff --git a/skyulf-core/tests/integration/test_invalid_value_numeric_contract.py b/skyulf-core/tests/integration/test_invalid_value_numeric_contract.py new file mode 100644 index 000000000..76e87a3fd --- /dev/null +++ b/skyulf-core/tests/integration/test_invalid_value_numeric_contract.py @@ -0,0 +1,209 @@ +"""OC-140 regressions for numeric rules on explicitly selected nonnumeric data.""" + +from decimal import Decimal +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest +from polars.testing import assert_frame_equal + +from skyulf.engines import SkyulfPolarsWrapper +from skyulf.engines.pandas_engine import SkyulfPandasWrapper +from skyulf.preprocessing.cleaning.invalid_value import ( + InvalidValueReplacementApplier, + InvalidValueReplacementCalculator, +) + + +@pytest.fixture(params=["pandas", "wrapped_pandas", "polars", "wrapped_polars"]) +def engine(request: pytest.FixtureRequest) -> str: + """Exercise native inputs and both public engine wrappers without engine conversion.""" + return request.param + + +def _frame(data: dict[str, Any], engine: str) -> Any: + """Build equivalent frames while retaining the requested public input shape.""" + frame = pd.DataFrame(data) + if engine == "pandas": + return frame + if engine == "wrapped_pandas": + return SkyulfPandasWrapper(frame) + polars_frame = pl.from_pandas(frame) + return SkyulfPolarsWrapper(polars_frame) if engine == "wrapped_polars" else polars_frame + + +def _assert_equal(actual: Any, expected: Any) -> None: + """Compare both values and dtypes, including whether a wrapper was retained.""" + assert type(actual) is type(expected) + if isinstance(actual, pd.DataFrame): + pd.testing.assert_frame_equal(actual, expected) + elif isinstance(actual, SkyulfPandasWrapper): + pd.testing.assert_frame_equal(actual.to_native(), expected.to_native()) + elif isinstance(actual, SkyulfPolarsWrapper): + assert_frame_equal(actual.to_native(), expected.to_native()) + else: + assert_frame_equal(actual, expected) + + +def _expected_output(frame: Any) -> Any: + """Preserve the dispatcher's existing native-pandas and wrapped-Polars outputs.""" + return frame.to_native() if isinstance(frame, SkyulfPandasWrapper) else frame + + +@pytest.mark.parametrize("operation", ["fit", "apply"]) +@pytest.mark.parametrize( + "config", + [ + {"rule": "negative"}, + {"rule": "negative_to_nan"}, + {"rule": "zero"}, + {"rule": "custom_range", "min_value": 0}, + {"rule": "custom_range", "max_value": 100}, + {"replace_inf": True}, + {"replace_neg_inf": True}, + ], +) +def test_numeric_operations_reject_text_without_modifying_source( + engine: str, operation: str, config: dict[str, Any] +) -> None: + """Selected text must fail clearly before either engine can erase or rewrite data.""" + data = {"numeric": [-3.0, 0.0, 2.0], "text": ["hello", "-3", "2"]} + frame = _frame(data, engine) + original = _frame(data, engine) + params = {"columns": ["numeric", "text"], **config} + node = ( + InvalidValueReplacementCalculator() + if operation == "fit" + else InvalidValueReplacementApplier() + ) + + with pytest.raises(ValueError) as exc: + getattr(node, operation)(frame, params) + + assert str(exc.value) == ( + "InvalidValueReplacement requires numeric columns; non-numeric columns: ['text']. " + "Convert these columns to a numeric type before applying numeric rules." + ) + _assert_equal(frame, original) + + +@pytest.mark.parametrize( + "values", + [ + pd.Series(["5", "-3", "7"], dtype="string"), + pd.Series(["low", "medium", "high"], dtype="category"), + pd.Series([True, False, True], dtype="boolean"), + pd.Series(pd.date_range("2026-01-01", periods=3)), + pd.Series(pd.to_timedelta([-1, 0, 1], unit="D")), + ], + ids=["numeric_text", "category", "boolean", "datetime", "duration"], +) +def test_nonnumeric_dtypes_rejected_for_canvas_mode(engine: str, values: pd.Series) -> None: + """The Canvas numeric-only contract also applies to direct Core configuration.""" + frame = _frame({"value": values}, engine) + + with pytest.raises(ValueError, match="non-numeric columns: .*value"): + InvalidValueReplacementCalculator().fit( + frame, {"columns": ["value"], "mode": "negative_to_nan"} + ) + + +def test_apply_revalidates_numeric_artifact_after_schema_drift(engine: str) -> None: + """An artifact fitted on numbers must reject text encountered during inference.""" + training = _frame({"value": [5.0, -3.0, 7.0]}, engine) + inference = _frame({"value": ["5", "oops", "7"]}, engine) + artifact = InvalidValueReplacementCalculator().fit( + training, {"columns": ["value"], "mode": "percentage_bounds"} + ) + + with pytest.raises(ValueError, match="non-numeric columns: .*value"): + InvalidValueReplacementApplier().apply(inference, artifact) + + +@pytest.mark.parametrize( + "config", + [ + {}, + {"rule": None, "replace_inf": False, "replace_neg_inf": False}, + {"rule": "unknown"}, + {"rule": "custom_range"}, + ], +) +def test_inactive_operations_preserve_text_and_target(engine: str, config: dict[str, Any]) -> None: + """Configurations without an effective numeric operation remain true no-ops.""" + frame = _frame({"text": ["hello", "-3", "2"]}, engine) + target = np.array([1, 0, 1]) + artifact = InvalidValueReplacementCalculator().fit( + (frame, target), {"columns": ["text"], **config} + ) + + result, result_target = InvalidValueReplacementApplier().apply((frame, target), artifact) + + _assert_equal(result, _expected_output(frame)) + assert result_target is target + + +def test_auto_selection_preserves_text_and_target(engine: str) -> None: + """Numeric validation must not reject untouched text or alter the target selection.""" + data = { + "number": [-3.0, 0.0, 2.0], + "text": ["a", "b", "c"], + "duration": pd.to_timedelta([-1, 0, 1], unit="D"), + "target": [-1, 1, 0], + } + frame = _frame(data, engine) + original = _frame(data, engine) + target = np.array([0, 1, 0]) + artifact = InvalidValueReplacementCalculator().fit( + (frame, target), {"mode": "negative_to_nan", "target_column": "target", "value": 0.0} + ) + + result, result_target = InvalidValueReplacementApplier().apply((frame, target), artifact) + + assert artifact["columns"] == ["number"] + _assert_equal(result, _expected_output(_frame({**data, "number": [0.0, 0.0, 2.0]}, engine))) + _assert_equal(frame, original) + assert result_target is target + + +def test_empty_selection_with_active_rule_preserves_text(engine: str) -> None: + """An explicit empty selection must not become implicit validation of all columns.""" + frame = _frame({"text": ["a", "b", "c"]}, engine) + artifact = InvalidValueReplacementCalculator().fit( + frame, {"columns": [], "mode": "negative_to_nan"} + ) + + result = InvalidValueReplacementApplier().apply(frame, artifact) + + assert artifact == {} + _assert_equal(result, _expected_output(frame)) + + +@pytest.mark.parametrize( + "values", + [ + pd.Series([Decimal("-3"), Decimal("2"), None]), + pd.Series([-3, 2, None], dtype="Int64"), + pd.Series([-3.0, 2.0, None], dtype="Float64"), + ], + ids=["decimal", "nullable_integer", "nullable_float"], +) +def test_numeric_extension_values_remain_supported(engine: str, values: pd.Series) -> None: + """Numeric validation must retain Decimal and nullable numeric replacement support.""" + frame = _frame({"value": values}, engine) + original = _frame({"value": values}, engine) + artifact = InvalidValueReplacementCalculator().fit( + frame, {"mode": "negative_to_nan", "value": 0.0} + ) + + result = InvalidValueReplacementApplier().apply(frame, artifact) + + assert artifact["columns"] == ["value"] + assert type(result) is type(_expected_output(frame)) + native = result.to_native() if isinstance(result, SkyulfPolarsWrapper) else result + result_values = native["value"].to_list() + assert result_values[:2] == [0.0, 2.0] + assert pd.isna(result_values[2]) + _assert_equal(frame, original) diff --git a/skyulf-core/tests/integration/test_profiling_recommendation_safety.py b/skyulf-core/tests/integration/test_profiling_recommendation_safety.py new file mode 100644 index 000000000..803a4f3c0 --- /dev/null +++ b/skyulf-core/tests/integration/test_profiling_recommendation_safety.py @@ -0,0 +1,116 @@ +"""Regression coverage for applicable and consistent EDA transformation advice.""" + +import polars as pl +import pytest + +from skyulf.profiling.analyzer import EDAAnalyzer +from skyulf.profiling.schemas import ColumnProfile, NumericStats + + +@pytest.mark.parametrize( + ("values", "expected_method"), + [ + ([-100.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], "Yeo-Johnson"), + ([0.0] * 7 + [100.0], "Yeo-Johnson"), + ([-100.0] * 7 + [-1.0], "Yeo-Johnson"), + ([1.0] * 7 + [100.0], "Log or Box-Cox"), + ([100.0] * 7 + [1.0], "Yeo-Johnson"), + ], + ids=["mixed-sign", "zero", "all-negative", "positive-right-skew", "positive-left-skew"], +) +def test_public_profile_recommends_a_compatible_transform( + values: list[float], expected_method: str +) -> None: + """The displayed advice must respect the domain and direction of the observed skew.""" + frame = pl.DataFrame({"x": values}) + original = frame.clone() + profile = EDAAnalyzer(frame).analyze() + transforms = [rec for rec in profile.recommendations if rec.action == "Transform"] + + assert len(transforms) == 1 + assert transforms[0].column == "x" + assert expected_method in transforms[0].suggestion + if expected_method == "Yeo-Johnson": + assert "Log" not in transforms[0].suggestion + assert "Box-Cox" not in transforms[0].suggestion + assert not any(rec.action == "Keep" for rec in profile.recommendations) + assert frame.equals(original) + + +@pytest.mark.parametrize( + "stats", + [ + NumericStats(skewness=2.3), + NumericStats(skewness=2.3, min=0.0), + NumericStats(skewness=2.3, min=-1.0), + NumericStats(skewness=2.3, min=1.0, zeros_count=1), + NumericStats(skewness=2.3, min=1.0, negatives_count=1), + ], + ids=["unknown-domain", "zero", "negative", "zero-count", "negative-count"], +) +def test_incomplete_or_nonpositive_profile_does_not_recommend_positive_only_transform( + stats: NumericStats, +) -> None: + """Missing or conflicting domain evidence must not produce unsafe log advice.""" + profile = ColumnProfile( + name="x", dtype="Numeric", missing_count=0, missing_percentage=0, numeric_stats=stats + ) + analyzer = EDAAnalyzer(pl.DataFrame({"x": [1.0, 2.0, 3.0]})) + recommendations = analyzer._generate_recommendations({"x": profile}, [], None) + + assert len(recommendations) == 1 + assert recommendations[0].action == "Transform" + assert "Yeo-Johnson" in recommendations[0].suggestion + + +@pytest.mark.parametrize("skewness", [None, 0.0, 1.5, -1.5, float("nan"), float("inf")]) +def test_unavailable_or_low_skewness_does_not_request_transformation( + skewness: float | None, +) -> None: + """Only a defined skewness beyond the threshold justifies transform advice.""" + profile = ColumnProfile( + name="x", + dtype="Numeric", + missing_count=0, + missing_percentage=0, + numeric_stats=NumericStats(skewness=skewness, min=1.0), + ) + analyzer = EDAAnalyzer(pl.DataFrame({"x": [1.0, 2.0, 3.0]})) + recommendations = analyzer._generate_recommendations({"x": profile}, [], None) + + assert [rec.action for rec in recommendations] == ["Keep"] + assert "ready for modeling" not in recommendations[0].suggestion.lower() + + +@pytest.mark.parametrize("scenario", ["transform", "encode", "resample", "impute", "drop"]) +def test_public_profile_never_combines_remediation_with_clean_dataset(scenario: str) -> None: + """Every actionable recommendation must suppress the contradictory clean message.""" + frames = { + "transform": pl.DataFrame({"x": [1.0] * 7 + [100.0]}), + "encode": pl.DataFrame( + {"x": pl.Series([str(i) for i in range(60)] * 2).cast(pl.Categorical)} + ), + "resample": pl.DataFrame({"x": ["a"] * 95 + ["b"] * 5}), + "impute": pl.DataFrame({"x": [1.0, 2.0, 3.0, None]}), + "drop": pl.DataFrame({"x": [7.0] * 8}), + } + profile = EDAAnalyzer(frames[scenario]).analyze( + target_col="x" if scenario == "resample" else None + ) + # Exercise the payload that the Insights tab displays, including target advice. + recommendations = profile.model_dump(mode="json")["recommendations"] + actions = {rec["action"] for rec in recommendations} + + assert scenario.capitalize() in actions + assert "Keep" not in actions + assert all("ready for modeling" not in rec["suggestion"].lower() for rec in recommendations) + + +def test_balanced_target_can_retain_the_limited_clean_message() -> None: + """An informational balance result alone does not request remediation.""" + profile = EDAAnalyzer(pl.DataFrame({"target": ["a", "b"] * 50})).analyze(target_col="target") + + assert {rec.action for rec in profile.recommendations} == {"Info", "Keep"} + assert all( + "ready for modeling" not in rec.suggestion.lower() for rec in profile.recommendations + ) diff --git a/skyulf-core/tests/unit/test_calibrated_classifier_random_state.py b/skyulf-core/tests/unit/test_calibrated_classifier_random_state.py new file mode 100644 index 000000000..ce5f5d5ca --- /dev/null +++ b/skyulf-core/tests/unit/test_calibrated_classifier_random_state.py @@ -0,0 +1,299 @@ +"""Regression coverage for the calibrated classifier's advertised seed control.""" + +import logging +import pickle +from copy import deepcopy + +import numpy as np +import pandas as pd +import pytest +from sklearn.base import clone +from sklearn.calibration import CalibratedClassifierCV +from sklearn.datasets import make_classification +from sklearn.ensemble import RandomForestClassifier +from sklearn.naive_bayes import GaussianNB +from sklearn.svm import LinearSVC +from sklearn.tree import DecisionTreeClassifier + +from skyulf.modeling._tuning.engine import TuningCalculator +from skyulf.modeling._tuning.schemas import TuningConfig +from skyulf.modeling.classification import CalibratedClassifierCalculator +from skyulf.preprocessing.fold_adapter import FeatureEngineerFoldAdapter + + +@pytest.fixture +def calibration_data() -> tuple[pd.DataFrame, pd.Series]: + """Keep folds small while exposing stochastic differences in forest probabilities.""" + X, y = make_classification( + n_samples=96, n_features=6, n_informative=4, flip_y=0.15, random_state=11 + ) + return pd.DataFrame(X), pd.Series(y) + + +@pytest.mark.parametrize("nested", [False, True]) +@pytest.mark.parametrize( + "base_estimator", + ["logistic_regression", "random_forest", "gradient_boosting", "decision_tree", "svc"], +) +def test_configured_seed_reaches_every_fitted_base_estimator( + calibration_data, base_estimator, nested, caplog +): + """Both accepted payload shapes must seed all fitted calibration folds without dropping it.""" + X, y = calibration_data + params = {"base_estimator": base_estimator, "random_state": 7, "cv": 3} + config = {"params": params} if nested else params + with caplog.at_level(logging.WARNING, logger="skyulf.modeling"): + model = CalibratedClassifierCalculator().fit(X, y, config) + + assert isinstance(model, CalibratedClassifierCV) + assert model.cv == 3 + assert len(model.calibrated_classifiers_) == 3 + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {7} + assert params == {"base_estimator": base_estimator, "random_state": 7, "cv": 3} + assert not caplog.records + + +@pytest.mark.parametrize( + "seed_params,expected", [({}, 42), ({"random_state": 0}, 0), ({"random_state": None}, None)] +) +def test_default_zero_and_unseeded_configuration(calibration_data, seed_params, expected): + """Missing seeds retain reproducibility while explicit zero and None remain authoritative.""" + X, y = calibration_data + model = CalibratedClassifierCalculator().fit( + X, y, {"params": {"base_estimator": "decision_tree", "cv": 3, **seed_params}} + ) + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {expected} + + +def test_implicit_default_base_estimator_receives_seed(calibration_data): + """A payload may set only the seed and rely on the default logistic-regression base.""" + X, y = calibration_data + model = CalibratedClassifierCalculator().fit(X, y, {"params": {"random_state": 19}}) + assert model.cv == 5 + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {19} + + +def test_clone_and_set_params_seed_without_mutating_supplied_estimator(calibration_data): + """Sklearn search clones must apply late seed overrides without changing caller-owned models.""" + X, y = calibration_data + supplied = DecisionTreeClassifier(random_state=97) + calculator = CalibratedClassifierCalculator() + model = calculator.model_class(estimator=supplied, cv=3, random_state=7) + candidate = clone(model).set_params(random_state=17) + candidate.fit(X.to_numpy(), y.to_numpy()) + model.fit(X.to_numpy(), y.to_numpy()) + + assert supplied.random_state == 97 + assert not hasattr(supplied, "tree_") + assert candidate.get_params()["random_state"] == 17 + assert {fold.estimator.random_state for fold in candidate.calibrated_classifiers_} == {17} + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {7} + + +def test_failed_fit_preserves_supplied_estimator(calibration_data): + """Rejected calibration settings must leave the caller's base estimator untouched.""" + X, y = calibration_data + supplied = DecisionTreeClassifier(random_state=97) + model = CalibratedClassifierCalculator().model_class( + estimator=supplied, method="invalid", random_state=7 + ) + with pytest.raises(ValueError, match="method"): + model.fit(X.to_numpy(), y.to_numpy()) + + assert supplied.random_state == 97 + assert not hasattr(supplied, "tree_") + + +def test_direct_constructor_without_estimator_preserves_sklearn_default(calibration_data): + """Direct estimator construction must still resolve sklearn's default base and seed it.""" + X, y = calibration_data + model = CalibratedClassifierCalculator().model_class(cv=3, random_state=19) + model.fit(X.to_numpy(), y.to_numpy()) + + assert all(isinstance(fold.estimator, LinearSVC) for fold in model.calibrated_classifiers_) + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {19} + + +def test_fitted_calibration_pickle_round_trip(calibration_data): + """Persisting the seeded estimator must preserve fitted probabilities and fold seeds.""" + X, y = calibration_data + model = CalibratedClassifierCalculator().fit( + X, y, {"params": {"base_estimator": "decision_tree", "cv": 3, "random_state": 19}} + ) + restored = pickle.loads(pickle.dumps(model)) + + np.testing.assert_array_equal( + model.predict_proba(X.to_numpy()), restored.predict_proba(X.to_numpy()) + ) + assert {fold.estimator.random_state for fold in restored.calibrated_classifiers_} == {19} + + +def test_random_forest_seed_controls_repeatable_predictions(calibration_data): + """A real stochastic fit must repeat for one seed and respond when that seed changes.""" + X, y = calibration_data + predictions = [] + for seed in [7, 7, 19]: + model = CalibratedClassifierCalculator().fit( + X, y, {"params": {"base_estimator": "random_forest", "cv": 3, "random_state": seed}} + ) + predictions.append(model.predict_proba(X.to_numpy())) + + np.testing.assert_array_equal(predictions[0], predictions[1]) + assert not np.allclose(predictions[0], predictions[2]) + + +def test_deterministic_base_accepts_seed_without_changing_calibration_splits( + calibration_data, caplog +): + """GaussianNB has no seed parameter and must retain the existing unshuffled integer folds.""" + X, y = calibration_data + reference = CalibratedClassifierCV(estimator=GaussianNB(), cv=3).fit(X.to_numpy(), y.to_numpy()) + with caplog.at_level(logging.WARNING, logger="skyulf.modeling"): + model = CalibratedClassifierCalculator().fit( + X, y, {"params": {"base_estimator": "gaussian_nb", "cv": 3, "random_state": 7}} + ) + + assert model.cv == 3 + assert all(isinstance(fold.estimator, GaussianNB) for fold in model.calibrated_classifiers_) + np.testing.assert_array_equal( + model.predict_proba(X.to_numpy()), reference.predict_proba(X.to_numpy()) + ) + assert not caplog.records + + +def test_tuning_seed_reaches_search_clones_and_final_refit(calibration_data, caplog): + """The tuning path constructs estimators directly and must preserve the seed through refit.""" + X, y = calibration_data + calculator = CalibratedClassifierCalculator() + calculator.prepare_tuning_params({"base_estimator": "decision_tree"}) + config = TuningConfig( + strategy="grid", + search_space={"method": ["sigmoid", "isotonic"], "cv": [3]}, + cv_folds=2, + random_state=19, + ) + with caplog.at_level(logging.WARNING, logger="skyulf.modeling"): + model, result = TuningCalculator(calculator).fit(X, y, config.__dict__) + + assert result.n_trials == 2 + assert np.isfinite(result.best_score) + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {19} + assert not caplog.records + + +@pytest.mark.parametrize("preprocess", [False, True]) +@pytest.mark.parametrize("strategy", ["grid", "random", "halving_grid", "halving_random", "optuna"]) +def test_search_space_base_selection_reaches_trials_and_refit( + calibration_data, monkeypatch, strategy, preprocess +): + """Canvas base selections must reach real trial fits, including nested fold pipelines.""" + X, y = calibration_data + X = X.rename(columns=lambda col: f"x{col}") + fitted_bases = [] + original_fit = CalibratedClassifierCV.fit + + def observe_fit(self, X, y, **kwargs): + """Record the actual fitted fold models while retaining sklearn's real training.""" + fitted = original_fit(self, X, y, **kwargs) + fitted_bases.extend(fold.estimator for fold in fitted.calibrated_classifiers_) + return fitted + + monkeypatch.setattr(CalibratedClassifierCV, "fit", observe_fit) + search_space = {"base_estimator": ["random_forest"], "method": ["isotonic"], "cv": [3]} + original_space = deepcopy(search_space) + config = TuningConfig( + strategy=strategy, + n_trials=1, + cv_folds=2, + random_state=7, + search_space=search_space, + strategy_params={"min_resources": 48, "factor": 2}, + ) + adapter = ( + FeatureEngineerFoldAdapter( + [ + { + "name": "scale", + "transformer": "StandardScaler", + "params": {"columns": list(X.columns)}, + } + ], + target_column="target", + ) + if preprocess + else None + ) + logs = [] + model, result = TuningCalculator(CalibratedClassifierCalculator()).fit( + X, y, config, preprocessing=adapter, log_callback=logs.append + ) + + assert np.isfinite(result.best_score) + assert result.best_params == {"base_estimator": "random_forest", "method": "isotonic", "cv": 3} + assert len(fitted_bases) > len(model.calibrated_classifiers_) + assert all(isinstance(base, RandomForestClassifier) for base in fitted_bases) + assert {base.random_state for base in fitted_bases} == {7} + assert all(np.isfinite(trial["score"]) for trial in result.trials) + assert all(trial["params"]["base_estimator"] == "random_forest" for trial in result.trials) + assert search_space == original_space + if preprocess and strategy in {"halving_grid", "halving_random", "optuna"}: + assert any("fold-aware estimator" in message for message in logs) + assert model.get_params()["base_estimator"] == "random_forest" + + +def test_base_estimator_search_compares_candidates_and_refits_winner(calibration_data, monkeypatch): + """A multiselect search must train both requested base families and retain the winner.""" + X, y = calibration_data + fitted_types = set() + original_fit = CalibratedClassifierCV.fit + + def observe_fit(self, X, y, **kwargs): + """Observe actual candidate fits without substituting their scores or results.""" + fitted = original_fit(self, X, y, **kwargs) + fitted_types.update(type(fold.estimator) for fold in fitted.calibrated_classifiers_) + return fitted + + monkeypatch.setattr(CalibratedClassifierCV, "fit", observe_fit) + model, result = TuningCalculator(CalibratedClassifierCalculator()).fit( + X, + y, + TuningConfig( + strategy="grid", + cv_folds=2, + random_state=19, + search_space={"base_estimator": ["random_forest", "gaussian_nb"], "cv": [3]}, + ), + ) + expected_type = {"random_forest": RandomForestClassifier, "gaussian_nb": GaussianNB}[ + result.best_params["base_estimator"] + ] + + assert result.n_trials == 2 + assert fitted_types == {RandomForestClassifier, GaussianNB} + assert all(isinstance(fold.estimator, expected_type) for fold in model.calibrated_classifiers_) + assert model.get_params()["base_estimator"] == result.best_params["base_estimator"] + + +def test_base_selection_is_cloneable_and_can_change_between_fits(calibration_data): + """The symbolic choice must override stale estimators after cloning or changing candidates.""" + X, y = calibration_data + supplied = DecisionTreeClassifier(random_state=97) + estimator_class = CalibratedClassifierCalculator().model_class + model = estimator_class( + estimator=supplied, base_estimator="random_forest", cv=3, random_state=7 + ) + model.fit(X.to_numpy(), y.to_numpy()) + changed = clone(model).set_params(base_estimator="gaussian_nb") + changed.fit(X.to_numpy(), y.to_numpy()) + restored = pickle.loads(pickle.dumps(model)) + + assert all( + isinstance(fold.estimator, RandomForestClassifier) for fold in model.calibrated_classifiers_ + ) + assert all(isinstance(fold.estimator, GaussianNB) for fold in changed.calibrated_classifiers_) + assert supplied.random_state == 97 + assert not hasattr(supplied, "tree_") + assert restored.get_params()["base_estimator"] == "random_forest" + np.testing.assert_array_equal( + model.predict_proba(X.to_numpy()), restored.predict_proba(X.to_numpy()) + ) diff --git a/tests/integration/test_calibrated_tuning_selection.py b/tests/integration/test_calibrated_tuning_selection.py new file mode 100644 index 000000000..48ddc9307 --- /dev/null +++ b/tests/integration/test_calibrated_tuning_selection.py @@ -0,0 +1,88 @@ +"""Exercise Canvas calibration search choices through backend preparation and real folds.""" + +import json +from copy import deepcopy + +import numpy as np +import pandas as pd +import pytest +from sklearn.ensemble import RandomForestClassifier + +from backend.config import get_settings +from backend.ml_pipeline._execution.engine._node_runners import NodeRunnersMixin +from backend.ml_pipeline._execution.schemas import NodeConfig +from skyulf.modeling._tuning.engine import TuningCalculator +from skyulf.modeling.classification import CalibratedClassifierCalculator +from skyulf.preprocessing.fold_adapter import FeatureEngineerFoldAdapter + + +@pytest.mark.parametrize("strategy", ["grid", "optuna"]) +def test_canvas_calibration_search_selection_survives_fold_refit(strategy, monkeypatch): + """Canvas-selected bases must survive both direct candidate fitting and nested search routing.""" + settings = get_settings() + monkeypatch.setattr(settings, "TUNING_N_JOBS", 1) + monkeypatch.setattr(settings, "TUNING_PARALLEL_BACKEND", "") + node = NodeConfig( + node_id="classification", + step_type="training", + inputs=["scale"], + params={ + "run_mode": "tuned", + "target_column": "target", + "algorithm": "calibrated_classifier", + "tuning_config": { + "strategy": strategy, + "metric": "accuracy", + "n_trials": 1, + "cv_enabled": True, + "cv_folds": 2, + "random_state": 7, + "search_space": { + "base_estimator": ["random_forest"], + "method": ["isotonic"], + "cv": [3], + }, + }, + }, + ) + original_params = deepcopy(node.params) + calculator = CalibratedClassifierCalculator() + tuning_config = NodeRunnersMixin()._prepare_tuning_config(node, calculator) + + rng = np.random.default_rng(42) + y = pd.Series(np.tile([0, 1], 48), name="target") + X = pd.DataFrame({"signal": y + rng.normal(size=96), "noise": rng.normal(size=96)}) + preprocessing = FeatureEngineerFoldAdapter( + steps_config=[ + { + "name": "scale", + "transformer": "StandardScaler", + "params": {"columns": ["signal", "noise"]}, + } + ], + target_column="target", + ) + logs: list[str] = [] + model, result = TuningCalculator(calculator).fit( + X, y, tuning_config, preprocessing=preprocessing, log_callback=logs.append + ) + + assert all( + isinstance(fold.estimator, RandomForestClassifier) for fold in model.calibrated_classifiers_ + ) + assert {fold.estimator.random_state for fold in model.calibrated_classifiers_} == {7} + assert len(model.calibrated_classifiers_) == 3 + assert model.method == "isotonic" + assert result.n_trials == 1 + assert np.isfinite(result.best_score) + assert len(result.trials) == 1 + assert np.isfinite(result.trials[0]["score"]) + public_result = json.loads( + json.dumps({"best_params": result.best_params, "trials": result.trials}, allow_nan=False) + ) + expected_params = {"base_estimator": "random_forest", "method": "isotonic", "cv": 3} + assert public_result["best_params"] == expected_params + assert public_result["trials"][0]["params"] == expected_params + if strategy == "optuna": + assert any("fold-aware estimator" in message for message in logs) + assert node.params == original_params From 81f35f07cdbfcf3e5d1b1be522c96ed27bda3d7a Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 19:45:01 +0300 Subject: [PATCH 07/17] fix(core): guard generated columns and empty-data expectations Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 11 + docs/reference/data_validation.md | 35 ++- docs/reference/preprocessing_nodes.md | 40 ++- .../analysis/opus_core_analysis-open_queue.md | 5 +- .../analysis/opus_core_analysis-tracker.md | 55 ++++ .../opus_core_analysis/00-validation-log.md | 6 + ...02-encoding-cleaning-imputation-scaling.md | 8 + ...ture-generation-selection-vectorization.md | 8 + .../opus_core_analysis/05-profiling.md | 9 + .../skyulf/preprocessing/_output_names.py | 29 ++ .../drop_and_missing/missing_indicator.py | 23 +- .../skyulf/preprocessing/encoding/dummy.py | 39 ++- .../skyulf/preprocessing/encoding/one_hot.py | 33 +- .../skyulf/preprocessing/encoding/target.py | 21 +- .../feature_generation/_common.py | 18 ++ .../feature_generation/_pandas_ops.py | 10 +- .../feature_generation/_polars_ops.py | 24 +- .../feature_generation/generation.py | 8 + skyulf-core/skyulf/profiling/expect.py | 36 ++- .../test_feature_generation_datetime_names.py | 227 ++++++++++++++ ...coding_output_names_regression_20260912.py | 290 ++++++++++++++++++ skyulf-core/tests/unit/test_expect_empty.py | 138 +++++++++ 22 files changed, 1026 insertions(+), 47 deletions(-) create mode 100644 skyulf-core/skyulf/preprocessing/_output_names.py create mode 100644 skyulf-core/tests/integration/test_feature_generation_datetime_names.py create mode 100644 skyulf-core/tests/unit/test_encoding_output_names_regression_20260912.py create mode 100644 skyulf-core/tests/unit/test_expect_empty.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 230f7d80d..a8ed952e9 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,17 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **Generated column collisions (OC-18):** reject conflicting one-hot, dummy, + missing-indicator and multiclass target-encoding names before replacing + existing data or emitting duplicate columns. Checks also apply at inference; + names belonging only to dropped sources remain available. +- **Datetime output names (OC-30):** honor the configured output name, using + it as a prefix for multiple features. Preserve existing columns with numbered + suffixes unless overwrite is enabled. Refit saved pipelines affected by + previously ignored names or overwritten columns. +- **Empty-data expectations (OC-48):** null, range and uniqueness checks + reject zero-row datasets by default. Add `allow_empty=True` to calls that + intentionally accept empty partitions; column-existence checks stay unchanged. - **Calibrated base selection in tuning (OC-66 follow-up):** honor Base Estimator search choices in every strategy and final refit, including fold preprocessing. Random Forest selection no longer fails in Optuna/halving diff --git a/docs/reference/data_validation.md b/docs/reference/data_validation.md index 2387c3b5f..f213ff583 100644 --- a/docs/reference/data_validation.md +++ b/docs/reference/data_validation.md @@ -6,8 +6,9 @@ dependencies**. Each `expect_*` function checks a single condition and raises [`ExpectationError`][skyulf.profiling.expect.ExpectationError] with a precise message when the condition is violated. -It is **engine-agnostic**: Pandas frames are used directly; Polars (or any frame -exposing `to_pandas()`) is converted first. +It is **engine-agnostic**: Pandas frames are used directly; raw and wrapped +Polars frames stay native for simple predicates. Boolean range checks and +other frames exposing `to_pandas()` use Pandas conversion. ## When to use it @@ -24,9 +25,33 @@ automatically. You call them yourself in two main places: | Function | Checks | | --- | --- | | `expect_columns_exist(df, columns)` | Every name in `columns` is present. | -| `expect_no_nulls(df, columns=None)` | Given columns (default: all) have no nulls. | -| `expect_value_range(df, column, *, minimum, maximum, inclusive=True)` | All values fall within `[minimum, maximum]`. | -| `expect_unique(df, columns)` | The combination of `columns` has no duplicate rows. | +| `expect_no_nulls(df, columns=None, *, allow_empty=False)` | Given columns (default: all) have no nulls. | +| `expect_value_range(df, column, *, minimum=None, maximum=None, inclusive=True, allow_empty=False)` | All non-null values fall within the optional bounds. | +| `expect_unique(df, columns, *, allow_empty=False)` | The combination of `columns` has no duplicate rows. | + +## Empty datasets + +The null, range and uniqueness checks require at least one row by default. +An ingestion that unexpectedly returns zero rows therefore raises +`ExpectationError`, even if the expected columns are present. + +If empty partitions are valid in your workflow, explicitly opt in on each check: + +```python +import pandas as pd +from skyulf import expect_no_nulls, expect_unique, expect_value_range + +empty = pd.DataFrame({"age": pd.Series(dtype="float64")}) +expect_no_nulls(empty, ["age"], allow_empty=True) +expect_value_range(empty, "age", minimum=0, maximum=120, allow_empty=True) +expect_unique(empty, ["age"], allow_empty=True) +``` + +Previously these checks accepted empty frames automatically; existing callers +that rely on that behavior must add `allow_empty=True`. Requested columns must +still exist. `expect_columns_exist` only checks the schema and accepts zero rows. +Range checks continue to ignore null values, including an all-null column in a +frame that has rows; combine them with `expect_no_nulls` when nulls are invalid. ## Example: a dataset contract in CI diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index 36a9f435b..c1d3a84f1 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -206,15 +206,20 @@ Learned params: ### MissingIndicator -Adds `{col}_missing` indicator columns. +Adds `{col}_missing` indicator columns by default. + +Generated names must be unique and must not collide with existing columns. +Fitting and applying raise `ValueError` on a collision, including one introduced by new inference +data. Rename the conflicting input column or change the selected columns. Config: - `columns`: list[str] (optional; defaults to all columns with any missing values) +- `flag_suffix`: str (default `_missing`) Learned params: -- `columns` +- `columns`, `flag_suffix` ## Imputation @@ -278,6 +283,13 @@ Example step: ### OneHotEncoder +Generated names must be unique and must not collide with retained input +columns. Fitting and applying raise `ValueError` before returning ambiguous +columns or replacing existing data. This also checks new inference columns +and older fitted artifacts. Rename conflicting inputs or categories before +encoding. A selected source that is removed by `drop_original=True` does not +reserve its name; other retained columns do. + Config: - `columns`: list[str] (optional; auto-detects categorical columns) @@ -296,6 +308,9 @@ Learned params: ### DummyEncoder +Uses the same collision checks as `OneHotEncoder`. Generated columns are +computed from the original source values before selected sources are dropped. + Config: - `columns`: list[str] @@ -352,6 +367,12 @@ target class appears only once, raises a clear error instead of leaking the row's target into its encoded value. Direct Calculator/Applier use remains an advanced API and uses the explicit fit/apply calls supplied by the caller. +Multiclass output names must be unique and must not collide with retained +input columns. A collision raises `ValueError` during fitting, cross-fitted +training, or later application, including with older artifacts. Rename the +conflicting input column before encoding. Binary and regression encodings +continue to replace their selected source columns. + Config: - `columns`: list[str] @@ -679,6 +700,21 @@ produces `0.5`. An entirely missing denominator uses positive epsilon, and an entirely missing numerator sums to zero. Source columns retain their values; this rule applies to the generated ratio. +For `datetime_extract`, `output_column` names a single source/feature result +exactly. With one source and multiple features, it becomes a prefix: +`output_column="calendar"` with `["year", "month"]` produces `calendar_year` +and `calendar_month`. With multiple sources, names also include the source, +such as `calendar_start_year`. Without `output_column`, the default is +`source_feature`; an optional `output_prefix` is prepended to that default. + +Datetime outputs now follow `allow_overwrite` (default `False`): a collision +adds `_1`, `_2`, and so on until the name is available. Setting it to `True` +permits replacement. For example, an existing `dt_year` is retained and a new +year feature becomes `dt_year_1`. Names are resolved against the frame being +transformed, as for other Feature Generation operations. Refit affected saved +pipelines and downstream models if they depended on previously ignored names +or overwritten columns. + For `group_agg`, null and NaN keys share a single training group on both engines. Later transformations reuse that fitted aggregate, including for missing keys; they never calculate it from the new batch's values. Keys not seen during diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 8af659224..63bd7ea0a 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,7 +27,7 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 28 open / 4 parked.** OC-51/101/140 are fixed +**Current status (2026-09-12): 25 open / 4 parked.** OC-18/30/48 are fixed and recorded in the archive with reproduction and regression evidence. Ordered by the master report's suggested fix order: **Now** (silent wrongness @@ -87,13 +87,11 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-18 | 🟑 | One-hot/dummy generated names can collide with existing columns (`encoding/one_hot.py:68-92`, `dummy.py:76-99`) | small | ⬜ open | ### Remaining β€” feature generation / selection / vectorization / transformations | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-30 | 🟑 | Datetime extraction ignores the UI output name, overwrites collisions (`_pandas_ops.py:173-184`) | small | ⬜ open | ### Remaining β€” profiling (outside the OC-39–46 cluster) @@ -101,7 +99,6 @@ closed that on 2026-09-07. |---|---|---|---|---| | OC-192 | 🟑 | Decomposition's categorical null bucket displays as `Unknown`, but drilling into it filters for the literal string and silently loses the bucket's rows (`profiling/_analyzer/decomposition.py:71-76`) | small | ⬜ open | | OC-47 | 🟑 | Common-column dtype drift can silently disappear (`profiling/drift.py:136-153`) | small | ⬜ open | -| OC-48 | 🟑 | Expectations pass vacuously on empty frames (`profiling/expect.py:92-209`) | small | ⬜ open | | OC-50 | 🟑 | Binary targets miss class-balance advice or flip to regression by sample size (`recommendations.py:147-152`) | small | ⬜ open | diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 46c7e0ac9..5090a3ef5 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -214,6 +214,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-18 | 🟑 | One-hot/dummy generated names can collide with existing columns (`encoding/one_hot.py`, `dummy.py`) | small | βœ… fixed 2026-09-12 β€” reject conflicting generated names in one-hot, dummy, missing-indicator and multiclass target encoding at fit/apply, while preserving legitimate reuse of dropped source names. | | OC-21 | 🟑 | WOE additive smoothing not normalized over categories (`encoding/woe.py`) | small | βœ… fixed 2026-09-11 β€” normalize class totals by all observed-category pseudocounts in full fits and training complements, correcting WOE/IV without rewriting saved mappings. | | OC-172 | 🟑 | `StandardScaler` crashes on mixed pandas nullable numeric columns containing `pd.NA`; native sklearn and equivalent Polars input succeed (`preprocessing/scaling/standard.py:144,154`, `engines/sklearn_bridge.py:52`) | small | βœ… fixed 2026-09-09 - nullable numeric missing sentinels become NumPy NaN without rounding observed integers; StandardScaler applies numeric arithmetic safely. | | OC-178 | 🟑 | `HashEncoder` hashes the same missing value into different buckets across Polars, pandas object, and pandas nullable string inputs, even with one shared fitted artifact (`preprocessing/encoding/hash.py:45,76`) | small | βœ… already fixed - verified 2026-09-09: one shared hash artifact gives identical missing-value buckets across pandas object/string and Polars. | @@ -228,6 +229,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-30 | 🟑 | Datetime extraction ignores the UI output name and overwrites collisions (`feature_generation/_pandas_ops.py`, `_polars_ops.py`) | small | βœ… fixed 2026-09-12 β€” honor exact/prefix output naming and the shared numbered collision policy on both engines, including fitted operation replay. | | OC-24 | 🟠 | Polars group aggregates treat missing keys differently from pandas (`feature_generation/_polars_ops.py`) | small | βœ… already fixed β€” verified 2026-09-12: public fitted aggregates share null/NaN training groups across engines and wrappers; unseen groups remain missing, while the public artifact guard excludes divergent private unfitted helpers. | | OC-230 | 🟑 | Native Polars NaN inputs propagate through feature ratios while pandas treats them as missing (`feature_generation/_polars_ops.py:_polars_ratio`, `_pandas_ops.py:_pandas_ratio`) | small | βœ… fixed 2026-09-11 - normalize native NaN and null ratio operands to zero before summing, preserving other operands, input columns and signed epsilon. | | OC-23 | 🟠 | Polars `ratio` flips the sign of near-zero negative denominators (`feature_generation/_polars_ops.py:97-112`) | small | βœ… fixed 2026-09-11 - preserve the sign when clamping a near-zero ratio denominator to epsilon on Polars, matching pandas. | @@ -247,6 +249,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-48 | 🟑 | Expectations pass vacuously on empty frames (`profiling/expect.py`) | small | βœ… fixed 2026-09-12 β€” require at least one row by default in null/range/uniqueness checks, with explicit `allow_empty=True`, preserved schema validation and safe all-null range checks. | | OC-51 | 🟑 | Transform advice can be mathematically invalid and contradict the clean-dataset message | small | βœ… fixed 2026-09-12 β€” use domain/skew-aware transform advice and evaluate all preparation recommendations, including target resampling, before emitting a limited clean-dataset message. | | OC-247 | 🟑 | Missing categorical values inflate unique/rare-label counts and consume a top-10 frequency slot (`profiling/analyzer.py`, `_analyzer/categorical.py`) | small | βœ… filed and fixed 2026-09-12 β€” exclude nulls before frequency ranking and rare-label aggregation, and remove the null entry from the distinct-label count. | | OC-235 | 🟠 | Directed causal edges are serialized backwards (`profiling/_analyzer/causal.py`) | small | βœ… fixed 2026-09-11 β€” preserve causal-learn endpoint order; real graph objects and public collider regressions verify both orientations. | @@ -409,6 +412,58 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-18/30/48: generated names, datetime outputs and empty-data checks + +Continued the unparked queue after signed commit `7947d5af`; the calibrated +Base Estimator multiselect stays unchanged. Reproductions used public +Calculator/Applier and expectation APIs with native and wrapped Pandas/Polars +frames. Canvas encoding and datetime payloads already forwarded the relevant +settings correctly, so this batch changes Core behavior without frontend edits. + +- **OC-18:** one-hot/dummy generated `city_a` names duplicated an existing + Pandas column; Polars one-hot raised `DuplicateError`, while dummy encoding + silently replaced the retained values. MissingIndicator and multiclass + TargetEncoder also overwrote retained output names, including cross-fitted + target-encoder training. A shared validator now rejects names duplicated + within generated outputs or shared with retained inputs at fit/apply. Names + belonging only to dropped sources remain available. One-hot and dummy + construction reads all original sources before output assembly, fixing lost + indicators and corrupted secondary source values in those valid cases. + The dedicated regressions went from **78 failed / 46 passed** to **124 passed**. +- **OC-30:** a Canvas-shaped datetime operation with + `output_column="custom_year"` ignored that name and replaced an existing + `dt_year=99` with `2024` despite overwrite being disabled. Both engines now + honor exact single-result names, feature/source prefixes for multiple + results, optional default-name prefixes and the existing numbered collision + policy. The configured source count keeps remaining names stable when an + inference source is absent; suffixes still depend on the current input + schema, as for other Feature Generation operations. The node's existing + schema-prediction fallback remains `None`. **68 regressions** cover native + and wrapped inputs, replay, overwrite, repeated features, runtime columns, + and downstream arithmetic/fitted group aggregation. +- **OC-48:** all three row-level expectations returned success for zero-row + datasets on both engines. They now raise `ExpectationError` by default, with + keyword-only `allow_empty=True` for intentionally empty data. Requested + columns are still validated first; column-existence checks stay schema-only. + An additional probe found empty/all-null Polars `Null` series invoking an + unsupported comparison. Range checks now return after null removal when no + observed values remain, preserving their documented null-ignore behavior. + **81 regressions** distinguish empty rows, absent columns, all-null values, + invalid nonempty data, zero-width Pandas frames and native Polars execution. + +Validation: the combined encoding, feature-generation, expectation, artifact, +schema, preprocessing-pipeline and leakage Core selection passed **2,080 tests** +and **3 snapshots** (11 existing warnings). Separate backend encoding, +preprocessing, schema-preview/graph and operation-leakage suites passed +**925 tests** (two existing deprecations); the two existing root feature-generation +suites also passed **3 tests**. Full-repository Ruff, all 13 changed Python files' +format checks, and the complete configured ty gate passed. Independent reviews +found no actionable issues. Reference docs, changelog and source findings record +the behavior changes: rename conflicting encoder inputs, refit pipelines affected +by datetime naming/overwrite changes, and explicitly allow expected empty data. + +The queue now has **25 open / 4 parked**. OC-71/72/73/185 remain parked. + ### 2026-09-12 β€” OC-66 follow-up: Canvas calibrated base selection The user reported Optuna rejecting `model__estimator__base_estimator` after diff --git a/initiatives/analysis/opus_core_analysis/00-validation-log.md b/initiatives/analysis/opus_core_analysis/00-validation-log.md index ace7bcaaf..859323b32 100644 --- a/initiatives/analysis/opus_core_analysis/00-validation-log.md +++ b/initiatives/analysis/opus_core_analysis/00-validation-log.md @@ -161,6 +161,12 @@ which is the label of the row that was *dropped*. So labels are both misaligned ### OC-18 β€” CONFIRMED, and worse +**Fixed 2026-09-12:** the public fit/apply paths now reject generated-name +collisions consistently for one-hot, dummy, missing-indicator and multiclass +target encoding. Valid dropped-source name reuse retains its indicators and +original source values during encoding. The following is historical evidence; +the archive records the new reproduction and regression results. + ``` OneHotEncoder on DataFrame({"c": ["a","b"], "c_a": [9,9]}) output columns: ['c_a', 'c_a', 'c_b'] diff --git a/initiatives/analysis/opus_core_analysis/02-encoding-cleaning-imputation-scaling.md b/initiatives/analysis/opus_core_analysis/02-encoding-cleaning-imputation-scaling.md index da153782c..571bf7c91 100644 --- a/initiatives/analysis/opus_core_analysis/02-encoding-cleaning-imputation-scaling.md +++ b/initiatives/analysis/opus_core_analysis/02-encoding-cleaning-imputation-scaling.md @@ -162,6 +162,14 @@ policy for both engines. ### OC-18 ### 🟑 Medium β€” One-hot/dummy generated names can collide with existing columns +**Fixed 2026-09-12:** one-hot, dummy, missing-indicator and multiclass target +encoding now reject duplicate generated names and collisions with retained +inputs at fit/apply, including cross-fitted target-encoder training and legacy +artifacts. Names belonging only to dropped sources remain available; output +assembly now preserves their generated values and reads original source data. +The dedicated native/wrapper regressions changed from 78 failed / 46 passed to +124 passed. Historical reproduction follows. + **Files:** `preprocessing/encoding/one_hot.py:68-92`, `dummy.py:76-99` Generated names such as `city_a` are never checked against existing columns. diff --git a/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md b/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md index 55cf36ff7..4b6ba41b1 100644 --- a/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md +++ b/initiatives/analysis/opus_core_analysis/03-feature-generation-selection-vectorization.md @@ -155,6 +155,14 @@ handler dict implements it, so it no-ops without error. ### OC-30 ### 🟑 Medium β€” Datetime extraction ignores the UI output name and overwrites collisions +**Fixed 2026-09-12:** datetime extraction now uses `output_column` exactly for +a single result, as a feature prefix for multiple features, and as a +source/feature prefix for multiple sources. Both engines use the existing +numbered collision policy and honor `allow_overwrite`. Default names remain +`source_feature`; affected saved pipelines need refitting if they depended on +the old ignored names or overwrites. Native/wrapper fit, replay, downstream +operations and runtime-schema regressions pass. Historical reproduction follows. + **Files:** `feature_generation/_pandas_ops.py:173-184`, `_polars_ops.py:181-205` The UI shows "Output Column Name" for every operation, but datetime extraction diff --git a/initiatives/analysis/opus_core_analysis/05-profiling.md b/initiatives/analysis/opus_core_analysis/05-profiling.md index 5e6c64e3d..5d0142c6b 100644 --- a/initiatives/analysis/opus_core_analysis/05-profiling.md +++ b/initiatives/analysis/opus_core_analysis/05-profiling.md @@ -215,6 +215,15 @@ missing=[] new=[] column_drifts={} drifted_count=0 ### OC-48 ### 🟑 Medium β€” Expectations pass vacuously on empty frames +**Fixed 2026-09-12:** all three row-level expectations now require at least one +row by default, with keyword-only `allow_empty=True` for intentional empty +partitions. Requested-column validation still runs; `expect_columns_exist` +remains schema-only, and range checks still ignore nulls in nonempty frames. +After null removal, a range check with no observed values returns before +comparison, also supporting inferred Polars `Null` dtype safely. +Public regressions cover Pandas/Polars and both wrappers, including native +Polars execution. The reproduction below records the former behavior. + **File:** `profiling/expect.py:92-209` `expect_no_nulls`, `expect_value_range`, and `expect_unique` all **pass** on an diff --git a/skyulf-core/skyulf/preprocessing/_output_names.py b/skyulf-core/skyulf/preprocessing/_output_names.py new file mode 100644 index 000000000..cf5f5825d --- /dev/null +++ b/skyulf-core/skyulf/preprocessing/_output_names.py @@ -0,0 +1,29 @@ +"""Validate generated columns against the schema a preprocessing node will emit.""" + +from collections.abc import Iterable + + +def validate_generated_column_names( + input_columns: Iterable[str], + generated_columns: Iterable[str], + *, + dropped_columns: Iterable[str] = (), + node_name: str, +) -> None: + """Reject duplicate generated names and names shared with retained inputs. + + Names of dropped sources remain available for generated features. Check + fitted names again at apply time because incoming frames can add columns. + """ + seen = set(input_columns).difference(dropped_columns) + collisions = set() + for name in generated_columns: + if name in seen: + collisions.add(name) + seen.add(name) + if collisions: + names = ", ".join(repr(name) for name in sorted(collisions)) + raise ValueError( + f"{node_name}: generated output column names collide: {names}. " + "Rename the conflicting input columns or adjust the encoding/flag settings." + ) diff --git a/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py b/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py index 332528569..5def1b607 100644 --- a/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py +++ b/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py @@ -7,6 +7,7 @@ from ...core.meta.decorators import node_meta from ...registry import NodeRegistry from .._artifacts import MissingIndicatorArtifact +from .._output_names import validate_generated_column_names from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method from ..dispatcher import apply_dual_engine, fit_dual_engine @@ -14,11 +15,21 @@ _DEFAULT_FLAG_SUFFIX = "_missing" +def _validate_flag_names(X: Any, cols: list[str], suffix: str) -> None: + """Protect retained inputs from the flags that present source columns emit.""" + validate_generated_column_names( + X.columns, + (f"{col}{suffix}" for col in cols if col in X.columns), + node_name="MissingIndicator", + ) + + def _missing_indicator_apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, Any]: cols = params.get("columns", []) if not cols: return X, y suffix = params.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX + _validate_flag_names(X, cols, suffix) schema = X.schema exprs = [] for c in cols: @@ -38,6 +49,7 @@ def _missing_indicator_apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> t if not cols: return X, y suffix = params.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX + _validate_flag_names(X, cols, suffix) X_out = X.copy() for col in cols: if col in X.columns: @@ -54,7 +66,8 @@ class MissingIndicatorApplier(BaseApplier): flag the same cells, which needs care on polars β€” it stores float NaN distinctly from null where pandas' ``isna()`` treats both as missing, so float columns get an explicit NaN test. Columns absent from the frame are - skipped. + skipped. A generated flag name matching an existing column raises + ``ValueError``; input values are never overwritten by flags. """ @apply_method @@ -88,10 +101,12 @@ def _missing_indicator_fit_polars( ) -> MissingIndicatorArtifact: explicit = config.get("columns") cols = [c for c in explicit if c in X.columns] if explicit else _missing_cols_polars(X) + suffix = config.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX + _validate_flag_names(X, cols, suffix) return { "type": "missing_indicator", "columns": cols, - "flag_suffix": config.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX, + "flag_suffix": suffix, } @@ -100,10 +115,12 @@ def _missing_indicator_fit_pandas( ) -> MissingIndicatorArtifact: explicit = config.get("columns") cols = [c for c in explicit if c in X.columns] if explicit else _missing_cols_pandas(X) + suffix = config.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX + _validate_flag_names(X, cols, suffix) return { "type": "missing_indicator", "columns": cols, - "flag_suffix": config.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX, + "flag_suffix": suffix, } diff --git a/skyulf-core/skyulf/preprocessing/encoding/dummy.py b/skyulf-core/skyulf/preprocessing/encoding/dummy.py index def7aefb8..24859ca60 100644 --- a/skyulf-core/skyulf/preprocessing/encoding/dummy.py +++ b/skyulf-core/skyulf/preprocessing/encoding/dummy.py @@ -11,6 +11,7 @@ from ...registry import NodeRegistry from ...utils import resolve_columns, user_picked_no_columns from .._artifacts import DummyEncoderArtifact +from .._output_names import validate_generated_column_names from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine from ._common import _exclude_target_column, detect_categorical_columns @@ -35,6 +36,20 @@ def _drop_first_if_needed(cats: list[Any], drop_first: bool) -> list[Any]: return cats +def _validate_dummy_names( + X: Any, cols: list[str], categories: dict[str, list[Any]], drop_first: bool +) -> None: + """Check only the indicators emitted from the fitted category lists.""" + names = ( + f"{col}_{cat}" + for col in cols + for cat in _drop_first_if_needed(categories.get(col, []), drop_first) + ) + validate_generated_column_names( + X.columns, names, dropped_columns=cols, node_name="DummyEncoder" + ) + + # A trailing ".0" is stripped from float columns so an integral value renders # identically on both engines and in every batch. Pandas upcasts an integer # column to float64 the moment it holds a null (no NaN-capable numpy int dtype), @@ -87,15 +102,19 @@ def _dummy_apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, An categories = params.get("categories", {}) drop_first = params.get("drop_first", False) - X_out = X + _validate_dummy_names(X, valid_cols, categories, drop_first) + exprs = [] for col in valid_cols: cats = _drop_first_if_needed(categories.get(col, []), drop_first) rendered = _polars_col_to_str_expr(X, col) - exprs = [ + exprs.extend( (rendered == str(cat)).cast(pl.Int8).fill_null(0).alias(f"{col}_{cat}") for cat in cats - ] - X_out = X_out.with_columns(exprs) - return X_out.drop(valid_cols), y + ) + retained = X.drop(valid_cols) + if not exprs: + return retained, y + encoded = X.select(exprs) + return (retained.hstack(encoded) if retained.width else encoded), y def _dummy_apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, Any]: @@ -105,6 +124,7 @@ def _dummy_apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, An categories = params.get("categories", {}) drop_first = params.get("drop_first", False) + _validate_dummy_names(X, valid_cols, categories, drop_first) X_out = X.copy() for col in valid_cols: known_cats = categories.get(col, []) @@ -125,6 +145,8 @@ class DummyEncoderApplier(BaseApplier): and ``_polars_col_to_str_expr``, which is a function of the value alone so a category cannot stop matching because of what else shares its batch. A value unseen at fit time yields an all-zero row rather than raising. + Generated names that duplicate another indicator or a retained input + column raise ``ValueError`` before output construction. """ @apply_method @@ -143,10 +165,13 @@ def apply(self, X: Any, y: Any, params: dict[str, Any]) -> Any: # pylint: disab def _build_dummy_artifact( + X: Any, cols: list[str], categories: dict[str, list[str]], config: dict[str, Any], ) -> Mapping[str, Any]: + """Validate fitted indicator names before returning the reusable artifact.""" + _validate_dummy_names(X, cols, categories, config.get("drop_first", False)) return { "type": "dummy_encoder", "columns": cols, @@ -163,7 +188,7 @@ def _dummy_fit_polars(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, An for col in cols: rendered = X.select(_polars_col_to_str_expr(X, col).unique().sort()).to_series().to_list() categories[col] = [str(c) for c in rendered if c is not None] - return _build_dummy_artifact(cols, categories, config) + return _build_dummy_artifact(X, cols, categories, config) def _dummy_fit_pandas(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, Any]: @@ -173,7 +198,7 @@ def _dummy_fit_pandas(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, An categories: dict[str, list[str]] = { col: sorted(_pandas_col_to_str(X[col]).dropna().unique().tolist()) for col in cols } - return _build_dummy_artifact(cols, categories, config) + return _build_dummy_artifact(X, cols, categories, config) @NodeRegistry.register("DummyEncoder", DummyEncoderApplier) diff --git a/skyulf-core/skyulf/preprocessing/encoding/one_hot.py b/skyulf-core/skyulf/preprocessing/encoding/one_hot.py index 02c1a76c9..04bd57cb9 100644 --- a/skyulf-core/skyulf/preprocessing/encoding/one_hot.py +++ b/skyulf-core/skyulf/preprocessing/encoding/one_hot.py @@ -14,6 +14,7 @@ from ...registry import NodeRegistry from ...utils import resolve_columns, user_picked_no_columns from .._artifacts import OneHotArtifact +from .._output_names import validate_generated_column_names from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine from ._common import _exclude_target_column, detect_categorical_columns @@ -38,6 +39,12 @@ def _validate_apply_params(X: Any, params: dict[str, Any]) -> tuple[list[str], A valid_cols = [c for c in cols if c in X.columns] if not valid_cols or not encoder: return [], None, None + validate_generated_column_names( + X.columns, + cast(list[str], feature_names), + dropped_columns=valid_cols if params.get("drop_original", True) else (), + node_name="OneHotEncoder", + ) return valid_cols, encoder, feature_names @@ -66,9 +73,8 @@ def _onehot_apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, A encoded = _to_dense(encoder.transform(X_np)) encoded_df = pl.DataFrame(encoded, schema=feature_names) - X_out = pl.concat([X, encoded_df], how="horizontal") - if drop_original: - X_out = X_out.drop(valid_cols) + retained = X.drop(valid_cols) if drop_original else X + X_out = retained.hstack(encoded_df) if retained.width else encoded_df return X_out, y @@ -87,9 +93,9 @@ def _onehot_apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, A X_input = X_subset.to_numpy() if hasattr(X_subset, "to_numpy") else X_subset encoded = _to_dense(encoder.transform(X_input)) encoded_df = pd.DataFrame(encoded, columns=feature_names, index=X_out.index) - X_out = pd.concat(cast(Any, [X_out, encoded_df]), axis=1) if drop_original: X_out = X_out.drop(columns=valid_cols) + X_out = pd.concat(cast(Any, [X_out, encoded_df]), axis=1) return X_out, y @@ -102,7 +108,8 @@ class OneHotEncoderApplier(BaseApplier): transforming, which only lines up when ``include_missing`` was set at fit time too β€” the encoder knows that level solely if it saw it. Indicator columns are concatenated on and the originals dropped unless - ``drop_original`` is false. + ``drop_original`` is false. Generated names must be unique and must not + collide with retained input columns; conflicts raise ``ValueError``. """ @apply_method @@ -169,13 +176,21 @@ def _fit_sklearn_onehot(X_subset: Any, opts: dict[str, Any], cols: list[str]) -> def _build_onehot_artifact( - encoder: OneHotEncoder, cols: list[str], opts: dict[str, Any] + X: Any, encoder: OneHotEncoder, cols: list[str], opts: dict[str, Any] ) -> Mapping[str, Any]: + """Validate the fitted feature names before returning the reusable artifact.""" + feature_names = encoder.get_feature_names_out(cols).tolist() + validate_generated_column_names( + X.columns, + feature_names, + dropped_columns=cols if opts["drop_original"] else (), + node_name="OneHotEncoder", + ) return { "type": "onehot", "columns": cols, "encoder_object": encoder, - "feature_names": encoder.get_feature_names_out(cols).tolist(), + "feature_names": feature_names, "prefix_separator": opts["prefix_separator"], "drop_original": opts["drop_original"], "include_missing": opts["include_missing"], @@ -194,7 +209,7 @@ def _onehot_fit_polars(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, A X_subset = X_subset.fill_null(_MISSING_TOKEN) encoder = _fit_sklearn_onehot(X_subset, opts, cols) - return _build_onehot_artifact(encoder, cols, opts) + return _build_onehot_artifact(X, encoder, cols, opts) def _onehot_fit_pandas(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, Any]: @@ -209,7 +224,7 @@ def _onehot_fit_pandas(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, A X_subset = X_subset.astype(object).where(X_subset.notna(), _MISSING_TOKEN) encoder = _fit_sklearn_onehot(X_subset, opts, cols) - return _build_onehot_artifact(encoder, cols, opts) + return _build_onehot_artifact(X, encoder, cols, opts) @NodeRegistry.register("OneHotEncoder", OneHotEncoderApplier) diff --git a/skyulf-core/skyulf/preprocessing/encoding/target.py b/skyulf-core/skyulf/preprocessing/encoding/target.py index b82402b43..e619066de 100644 --- a/skyulf-core/skyulf/preprocessing/encoding/target.py +++ b/skyulf-core/skyulf/preprocessing/encoding/target.py @@ -17,6 +17,7 @@ from ...types import DEFAULT_RANDOM_STATE from ...utils import resolve_columns, user_picked_no_columns from .._artifacts import TargetEncoderArtifact +from .._output_names import validate_generated_column_names from .._schema import SkyulfSchema from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ..dispatcher import apply_dual_engine, fit_dual_engine, fit_transform_train_dual_engine @@ -40,6 +41,17 @@ def _resolve_apply_inputs(X: Any, params: dict[str, Any]) -> tuple[list[str], An return valid_cols, encoder +def _validate_multiclass_names(X: Any, cols: list[str], n_classes: int) -> None: + """Reject class-feature collisions while allowing names of dropped originals.""" + if n_classes > 1: + validate_generated_column_names( + X.columns, + (f"{col}_cls{ci}" for col in cols for ci in range(n_classes)), + dropped_columns=cols, + node_name="TargetEncoder", + ) + + def _replace_target_encoded_polars( X: Any, y: Any, valid_cols: list[str], encoded: Any ) -> tuple[Any, Any]: @@ -50,6 +62,7 @@ def _replace_target_encoded_polars( return X.with_columns(new_cols), y n_classes = encoded.shape[1] // n_feats + _validate_multiclass_names(X, valid_cols, n_classes) new_cols = [] for fi, col in enumerate(valid_cols): for ci in range(n_classes): @@ -68,6 +81,7 @@ def _replace_target_encoded_pandas( return X_out, y n_classes = encoded.shape[1] // n_feats + _validate_multiclass_names(X, valid_cols, n_classes) X_out = X_out.drop(columns=valid_cols) for fi, col in enumerate(valid_cols): for ci in range(n_classes): @@ -104,7 +118,8 @@ class TargetEncoderApplier(BaseApplier): the artifact, so parity comes from sharing it. The output shape follows the target type: binary and regression targets are encoded in place, while a multiclass target drops the originals and emits one ``{col}_cls{i}`` column - per class. + per class. Multiclass output names must not collide with retained columns; + conflicts raise ``ValueError`` before any input values are replaced. """ @apply_method @@ -251,6 +266,8 @@ def _target_fit_polars(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, A return {} encoder = _fit_target_encoder(X.select(cols), y, config) + if encoder.target_type_ == "multiclass" and encoder.classes_ is not None: + _validate_multiclass_names(X, cols, len(encoder.classes_)) return {"type": "target_encoder", "columns": cols, "encoder_object": encoder} @@ -265,6 +282,8 @@ def _target_fit_pandas(X: Any, y: Any, config: dict[str, Any]) -> Mapping[str, A return {} encoder = _fit_target_encoder(X[cols], y, config) + if encoder.target_type_ == "multiclass" and encoder.classes_ is not None: + _validate_multiclass_names(X, cols, len(encoder.classes_)) return {"type": "target_encoder", "columns": cols, "encoder_object": encoder} diff --git a/skyulf-core/skyulf/preprocessing/feature_generation/_common.py b/skyulf-core/skyulf/preprocessing/feature_generation/_common.py index 0a27ef087..1ad5464e3 100644 --- a/skyulf-core/skyulf/preprocessing/feature_generation/_common.py +++ b/skyulf-core/skyulf/preprocessing/feature_generation/_common.py @@ -159,6 +159,24 @@ def _resolve_output_col( return output_col +def _resolve_datetime_output_col( + op: dict[str, Any], col: str, feature: str, existing: list[str], allow_overwrite: bool +) -> str: + """Resolve a datetime name using configured output counts and collision policy.""" + output_col = op.get("output_column") + if output_col: + if len(op.get("input_columns", [])) > 1: + output_col = f"{output_col}_{col}_{feature}" + elif len(op.get("datetime_features", [])) > 1: + output_col = f"{output_col}_{feature}" + else: + output_col = f"{col}_{feature}" + prefix = op.get("output_prefix") + if prefix: + output_col = f"{prefix}_{output_col}" + return _resolve_output_col({"output_column": output_col}, 0, existing, allow_overwrite) + + def _resolve_similarity_pair(op: dict[str, Any], existing: list[str]) -> tuple[str, str] | None: """Return ``(col_a, col_b)`` for similarity ops, or ``None`` if unresolved.""" inputs = op.get("input_columns", []) diff --git a/skyulf-core/skyulf/preprocessing/feature_generation/_pandas_ops.py b/skyulf-core/skyulf/preprocessing/feature_generation/_pandas_ops.py index 70b6ac08e..55eb1baa2 100644 --- a/skyulf-core/skyulf/preprocessing/feature_generation/_pandas_ops.py +++ b/skyulf-core/skyulf/preprocessing/feature_generation/_pandas_ops.py @@ -13,6 +13,7 @@ SEASON_BY_MONTH, TIME_OF_DAY_BUCKETS, TIME_OF_DAY_DEFAULT, + _resolve_datetime_output_col, _resolve_group_agg_cols, _resolve_output_col, _resolve_similarity_pair, @@ -170,7 +171,7 @@ def _pandas_time_of_day(d: Any) -> Any: } -def _pandas_datetime_apply(op: dict[str, Any], df_out: Any) -> None: +def _pandas_datetime_apply(op: dict[str, Any], df_out: Any, allow_overwrite: bool = False) -> None: """Materialise datetime-extract features onto ``df_out`` in place.""" valid = [c for c in op.get("input_columns", []) if c in df_out.columns] features = op.get("datetime_features", []) @@ -181,7 +182,10 @@ def _pandas_datetime_apply(op: dict[str, Any], df_out: Any) -> None: builder = _PANDAS_DT_FEATURES.get(feat) if builder is None: continue - df_out[f"{col}_{feat}"] = builder(dt) + output_col = _resolve_datetime_output_col( + op, col, feat, list(df_out.columns), allow_overwrite + ) + df_out[output_col] = builder(dt) except Exception as e: # noqa: BLE001 - per-column datetime feature failure is logged and skipped logger.warning(f"Failed to extract datetime features for column {col}: {e}") @@ -234,7 +238,7 @@ def _featgen_apply_pandas(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, op_type = op.get("operation_type", "arithmetic") try: if op_type == "datetime_extract": - _pandas_datetime_apply(op, df_out) + _pandas_datetime_apply(op, df_out, allow_overwrite) continue handler = _PANDAS_OP_HANDLERS.get(op_type) if handler is None: diff --git a/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py b/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py index 696e0a891..645a7067f 100644 --- a/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py +++ b/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py @@ -13,6 +13,7 @@ TIME_OF_DAY_BUCKETS, TIME_OF_DAY_DEFAULT, _compute_similarity_score, + _resolve_datetime_output_col, _resolve_group_agg_cols, _resolve_output_col, _resolve_similarity_pair, @@ -181,23 +182,26 @@ def _register_polars_dt() -> None: ) -def _build_polars_dt_exprs(col: str, base_dt: Any, features: list[str]) -> list[Any]: +def _build_polars_dt_exprs( + op: dict[str, Any], col: str, base_dt: Any, existing: list[str], allow_overwrite: bool +) -> list[Any]: """Return the per-feature Polars expressions for one datetime column.""" - exprs: list[Any] = [] - for feat in features: + exprs: dict[str, Any] = {} + for feat in op.get("datetime_features", []): builder = _POLARS_DT_FEATURES.get(feat) if builder is not None: - exprs.append(builder(base_dt).alias(f"{col}_{feat}")) - return exprs + output_col = _resolve_datetime_output_col(op, col, feat, existing, allow_overwrite) + exprs[output_col] = builder(base_dt).alias(output_col) + existing.append(output_col) + return list(exprs.values()) -def _polars_datetime_apply(op: dict[str, Any], X_out: Any) -> Any: +def _polars_datetime_apply(op: dict[str, Any], X_out: Any, allow_overwrite: bool = False) -> Any: """Materialise datetime-extract feature columns onto ``X_out`` (Polars).""" if not _POLARS_DT_FEATURES: _register_polars_dt() valid = [c for c in op.get("input_columns", []) if c in X_out.columns] - features = op.get("datetime_features", []) for col in valid: try: base_dt = pl.col(col) @@ -207,7 +211,9 @@ def _polars_datetime_apply(op: dict[str, Any], X_out: Any) -> Any: ) elif X_out.schema[col] == pl.Null: base_dt = base_dt.cast(pl.Datetime) - col_exprs = _build_polars_dt_exprs(col, base_dt, features) + col_exprs = _build_polars_dt_exprs( + op, col, base_dt, list(X_out.columns), allow_overwrite + ) if col_exprs: X_out = X_out.with_columns(col_exprs) except Exception as e: # noqa: BLE001 - per-column datetime feature failure is logged and skipped @@ -284,7 +290,7 @@ def _featgen_apply_polars(X: Any, y: Any, params: dict[str, Any]) -> tuple[Any, op_type = op.get("operation_type", "arithmetic") try: if op_type == "datetime_extract": - X_out = _polars_datetime_apply(op, X_out) + X_out = _polars_datetime_apply(op, X_out, allow_overwrite) continue handler = _POLARS_OP_HANDLERS.get(op_type) if handler is None: diff --git a/skyulf-core/skyulf/preprocessing/feature_generation/generation.py b/skyulf-core/skyulf/preprocessing/feature_generation/generation.py index cabcd4e64..e0e385f85 100644 --- a/skyulf-core/skyulf/preprocessing/feature_generation/generation.py +++ b/skyulf-core/skyulf/preprocessing/feature_generation/generation.py @@ -45,6 +45,14 @@ def apply(self, X: Any, _y: Any, params: dict[str, Any]) -> Any: # pylint: disa skipped, and an output name that already exists is suffixed until unique unless ``allow_overwrite`` says otherwise. + Datetime extraction uses ``output_column`` exactly for one configured + source and feature. With multiple features it produces ``name_feature``; + with multiple sources it produces ``name_source_feature``. Without an + explicit name, outputs remain ``source_feature``, optionally preceded + by ``output_prefix``. Every datetime output follows the collision policy. + Saved pipelines affected by formerly ignored names or overwritten + columns require refitting after upgrading. + Group aggregates require training-fitted mappings. Legacy artifacts lacking those mappings must be refitted before inference. """ diff --git a/skyulf-core/skyulf/profiling/expect.py b/skyulf-core/skyulf/profiling/expect.py index f5b8d049f..3b1879663 100644 --- a/skyulf-core/skyulf/profiling/expect.py +++ b/skyulf-core/skyulf/profiling/expect.py @@ -61,6 +61,15 @@ def _resolve_columns(df: Any, columns: Sequence[str] | None) -> list[str]: return list(columns) +def _check_row_count(frame: pd.DataFrame | pl.DataFrame, *, allow_empty: bool) -> None: + """Reject zero rows unless the caller explicitly permits an empty dataset.""" + if len(frame) == 0 and not allow_empty: + raise ExpectationError( + "Expected at least one row, but the frame is empty. " + "Set allow_empty=True to allow zero rows." + ) + + def _polars_null_count(series: pl.Series) -> int: """Count null and floating NaN values with Pandas isnull semantics.""" count = int(series.null_count()) @@ -89,11 +98,17 @@ def expect_columns_exist(df: Any, columns: Sequence[str]) -> None: raise ExpectationError(f"Expected columns are missing: {missing}") -def expect_no_nulls(df: Any, columns: Sequence[str] | None = None) -> None: - """Assert that the given columns (default: all) contain no null values.""" +def expect_no_nulls( + df: Any, columns: Sequence[str] | None = None, *, allow_empty: bool = False +) -> None: + """Assert that the given columns (default: all) contain no null values. + + Zero-row frames fail unless ``allow_empty=True`` is explicitly requested. + """ frame = _as_polars(df) if frame is not None: cols = _resolve_columns(frame, columns) + _check_row_count(frame, allow_empty=allow_empty) offenders = { column: count for column in cols @@ -102,6 +117,7 @@ def expect_no_nulls(df: Any, columns: Sequence[str] | None = None) -> None: else: pandas_frame = _as_pandas(df) cols = _resolve_columns(pandas_frame, columns) + _check_row_count(pandas_frame, allow_empty=allow_empty) null_counts = {c: int(pandas_frame[c].isnull().sum()) for c in cols} offenders = {c: n for c, n in null_counts.items() if n > 0} if offenders: @@ -115,15 +131,19 @@ def expect_value_range( minimum: float | None = None, maximum: float | None = None, inclusive: bool = True, + allow_empty: bool = False, ) -> None: """Assert that all values in ``column`` fall within ``[minimum, maximum]``. ``minimum`` / ``maximum`` are optional (open-ended on the unset side). Null values are ignored. Set ``inclusive=False`` for a strict comparison. + Zero-row frames fail unless ``allow_empty=True`` is explicitly requested; + a frame containing only null values still has rows and passes this check. """ frame = _as_polars(df) if frame is not None: expect_columns_exist(frame, [column]) + _check_row_count(frame, allow_empty=allow_empty) series = frame.get_column(column) if series.dtype == pl.Boolean: pandas_frame = _as_pandas(df) @@ -137,8 +157,11 @@ def expect_value_range( else: pandas_frame = _as_pandas(df) expect_columns_exist(pandas_frame, [column]) + _check_row_count(pandas_frame, allow_empty=allow_empty) series = pandas_frame[column].dropna() observed_as_float = False + if len(series) == 0: + return _check_lower_bound(series, column, minimum, inclusive, observed_as_float=observed_as_float) _check_upper_bound(series, column, maximum, inclusive, observed_as_float=observed_as_float) @@ -192,15 +215,20 @@ def _check_upper_bound( ) -def expect_unique(df: Any, columns: Sequence[str]) -> None: - """Assert that the combination of ``columns`` has no duplicate rows.""" +def expect_unique(df: Any, columns: Sequence[str], *, allow_empty: bool = False) -> None: + """Assert that the combination of ``columns`` has no duplicate rows. + + Zero-row frames fail unless ``allow_empty=True`` is explicitly requested. + """ frame = _as_polars(df) if frame is not None: expect_columns_exist(frame, columns) + _check_row_count(frame, allow_empty=allow_empty) dup_count = int(_polars_duplicate_subset(frame, columns).is_duplicated().sum()) else: pandas_frame = _as_pandas(df) expect_columns_exist(pandas_frame, columns) + _check_row_count(pandas_frame, allow_empty=allow_empty) duplicated = pandas_frame.duplicated(subset=list(columns), keep=False) dup_count = int(duplicated.sum()) if dup_count: diff --git a/skyulf-core/tests/integration/test_feature_generation_datetime_names.py b/skyulf-core/tests/integration/test_feature_generation_datetime_names.py new file mode 100644 index 000000000..6a14158df --- /dev/null +++ b/skyulf-core/tests/integration/test_feature_generation_datetime_names.py @@ -0,0 +1,227 @@ +"""Datetime outputs must honor configured names without losing existing columns.""" + +from copy import deepcopy +from typing import Any + +import pandas as pd +import polars as pl +import pytest + +from skyulf.core.schema import SkyulfSchema +from skyulf.engines.pandas_engine import SkyulfPandasWrapper +from skyulf.engines.polars_engine import SkyulfPolarsWrapper +from skyulf.preprocessing.feature_generation import ( + FeatureGenerationApplier, + FeatureGenerationCalculator, +) + + +@pytest.fixture(params=["pandas", "polars", "pandas-wrapper", "polars-wrapper"]) +def frame_factory(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch) -> Any: + """Exercise both native and public wrapper dispatch without ambient engine overrides.""" + engine = request.param + monkeypatch.setenv("SKYULF_ENGINE", engine.split("-")[0]) + + def make_frame(data: dict[str, Any]) -> Any: + """Construct the selected engine directly from the same source values.""" + if engine == "pandas": + return pd.DataFrame(data) + if engine == "polars": + return pl.DataFrame(data) + if engine == "pandas-wrapper": + return SkyulfPandasWrapper(pd.DataFrame(data)) + return SkyulfPolarsWrapper(pl.DataFrame(data)) + + return make_frame + + +def _native(frame: Any) -> Any: + """Expose native columns for value assertions on every public input form.""" + return frame.to_native() if hasattr(frame, "to_native") else frame + + +def _date_op(**overrides: Any) -> dict[str, Any]: + """Mirror the Canvas operation payload while allowing naming edge cases.""" + return { + "operation_type": "datetime_extract", + "method": "year", + "input_columns": ["dt"], + "datetime_features": ["year"], + "output_column": "", + **overrides, + } + + +@pytest.mark.parametrize( + "naming,features,expected", + [ + ({"output_column": "custom_year"}, ["year"], ["custom_year"]), + ({"output_column": "calendar"}, ["year", "month"], ["calendar_year", "calendar_month"]), + ({}, ["year", "month"], ["dt_year", "dt_month"]), + ({"output_prefix": "calendar"}, ["year"], ["calendar_dt_year"]), + ( + {"output_prefix": "ignored", "output_column": "custom_year"}, + ["year"], + ["custom_year"], + ), + ], +) +def test_datetime_output_naming(frame_factory, naming, features, expected) -> None: + """A UI output name must reach generated columns and retain unnamed defaults.""" + frame = frame_factory({"dt": ["2024-01-15", "2025-07-04"]}) + config = {"operations": [_date_op(datetime_features=features, **naming)]} + params = FeatureGenerationCalculator().fit(frame, config) + result = _native(FeatureGenerationApplier().apply(frame, params)) + + assert list(result.columns) == ["dt", *expected] + assert result[expected[0]].to_list() == [2024, 2025] + if len(features) > 1: + assert result[expected[1]].to_list() == [1, 7] + assert list(frame.columns) == ["dt"] + + +@pytest.mark.parametrize("custom_name", [None, "dt_year"]) +@pytest.mark.parametrize("allow_overwrite", [False, True]) +def test_datetime_input_and_generated_collisions( + frame_factory, custom_name, allow_overwrite +) -> None: + """Existing and earlier generated columns survive unless overwrite is explicit.""" + frame = frame_factory({"dt": ["2024-01-15"], "dt_year": [99], "dt_year_1": [98]}) + op = _date_op(output_column=custom_name) + config = {"allow_overwrite": allow_overwrite, "operations": [op, deepcopy(op)]} + params = FeatureGenerationCalculator().fit(frame, config) + result = _native(FeatureGenerationApplier().apply(frame, params)) + + if allow_overwrite: + assert list(result.columns) == ["dt", "dt_year", "dt_year_1"] + assert result["dt_year"].to_list() == [2024] + else: + assert list(result.columns) == ["dt", "dt_year", "dt_year_1", "dt_year_2", "dt_year_3"] + assert result["dt_year"].to_list() == [99] + assert result["dt_year_2"].to_list() == result["dt_year_3"].to_list() == [2024] + assert result["dt_year_1"].to_list() == [98] + assert _native(frame)["dt_year"].to_list() == [99] + + +def test_multiple_sources_keep_distinct_names_at_inference(frame_factory) -> None: + """Missing inference sources cannot change the names of remaining configured outputs.""" + training = frame_factory({"dt": ["2024-01-15"], "end": ["2026-02-03"]}) + config = {"operations": [_date_op(input_columns=["dt", "end"], output_column="calendar")]} + params = FeatureGenerationCalculator().fit(training, config) + applier = FeatureGenerationApplier() + fitted = _native(applier.apply(training, params)) + inferred = _native(applier.apply(frame_factory({"dt": ["2025-01-15"]}), params)) + + assert list(fitted.columns) == ["dt", "end", "calendar_dt_year", "calendar_end_year"] + assert fitted["calendar_end_year"].to_list() == [2026] + assert list(inferred.columns) == ["dt", "calendar_dt_year"] + assert inferred["calendar_dt_year"].to_list() == [2025] + + +@pytest.mark.parametrize("allow_overwrite", [False, True]) +def test_datetime_repeated_features_reserve_each_output_name( + frame_factory, allow_overwrite +) -> None: + """Batched Polars expressions must reserve aliases before they are materialized.""" + frame = frame_factory({"dt": ["2024-01-15"]}) + params = FeatureGenerationCalculator().fit( + frame, + { + "allow_overwrite": allow_overwrite, + "operations": [_date_op(datetime_features=["year", "year"])], + }, + ) + result = _native(FeatureGenerationApplier().apply(frame, params)) + + expected_columns = ["dt", "dt_year"] if allow_overwrite else ["dt", "dt_year", "dt_year_1"] + assert list(result.columns) == expected_columns + assert all(result[column].to_list() == [2024] for column in expected_columns[1:]) + + +def test_datetime_names_replay_without_mutating_artifact_or_config(frame_factory) -> None: + """Replay stays deterministic and old plain artifacts need no new naming fields.""" + frame = frame_factory({"dt": ["2024-01-15"], "named": [99]}) + config = {"operations": [_date_op(output_column="named")]} + saved_config = deepcopy(config) + params = FeatureGenerationCalculator().fit(frame, config) + saved_params = deepcopy(params) + applier = FeatureGenerationApplier() + first = _native(applier.apply(frame, params)) + replay = _native(applier.apply(frame, params)) + repeated = _native(applier.apply(first, params)) + legacy = _native(applier.apply(frame, saved_config)) + + assert first.equals(replay) and first.equals(legacy) + assert list(first.columns) == ["dt", "named", "named_1"] + assert list(repeated.columns) == ["dt", "named", "named_1", "named_2"] + assert repeated["named_2"].to_list() == [2024] + assert params == saved_params and config == saved_config + + +def test_datetime_named_output_feeds_later_operation(frame_factory) -> None: + """Downstream operations must read the configured datetime name in the same node.""" + frame = frame_factory({"dt": ["2024-01-15", "2025-01-15"]}) + config = { + "operations": [ + _date_op(output_column="calendar_year"), + { + "operation_type": "arithmetic", + "method": "subtract", + "input_columns": ["calendar_year"], + "constants": [2000], + "output_column": "elapsed", + }, + ] + } + calculator = FeatureGenerationCalculator() + predicted = calculator.infer_output_schema(SkyulfSchema.from_dataframe(frame), config) + params = calculator.fit(frame, config) + result = _native(FeatureGenerationApplier().apply(frame, params)) + actual_schema = SkyulfSchema.from_dataframe(result) + + assert predicted is None # This node intentionally falls back to runtime introspection. + assert actual_schema.columns == ("dt", "calendar_year", "elapsed") + assert result["elapsed"].to_list() == [24, 25] + + +@pytest.mark.parametrize("allow_overwrite", [False, True]) +def test_datetime_output_can_target_its_source(frame_factory, allow_overwrite) -> None: + """An explicit source name respects overwrite without mutating the caller's frame.""" + frame = frame_factory({"dt": ["2024-01-15"]}) + params = FeatureGenerationCalculator().fit( + frame, + { + "allow_overwrite": allow_overwrite, + "operations": [_date_op(output_column="dt")], + }, + ) + result = _native(FeatureGenerationApplier().apply(frame, params)) + + assert result["dt" if allow_overwrite else "dt_1"].to_list() == [2024] + assert list(result.columns) == (["dt"] if allow_overwrite else ["dt", "dt_1"]) + assert _native(frame)["dt"].to_list() == ["2024-01-15"] + + +def test_datetime_named_output_supplies_fitted_group_aggregation(frame_factory) -> None: + """Fit-time intermediate columns must match the names used during inference replay.""" + frame = frame_factory( + {"dt": ["2024-01-15", "2024-02-15", "2025-03-15"], "value": [2.0, 4.0, 8.0]} + ) + config = { + "operations": [ + _date_op(output_column="calendar_year"), + { + "operation_type": "group_agg", + "method": "mean", + "input_columns": ["calendar_year"], + "secondary_columns": ["value"], + "output_column": "annual_mean", + }, + ] + } + params = FeatureGenerationCalculator().fit(frame, config) + inference = frame_factory({"dt": ["2024-12-31", "2025-12-31"], "value": [99.0, 99.0]}) + result = _native(FeatureGenerationApplier().apply(inference, params)) + + assert result["calendar_year"].to_list() == [2024, 2025] + assert result["annual_mean"].to_list() == [3.0, 8.0] diff --git a/skyulf-core/tests/unit/test_encoding_output_names_regression_20260912.py b/skyulf-core/tests/unit/test_encoding_output_names_regression_20260912.py new file mode 100644 index 000000000..0046e01c1 --- /dev/null +++ b/skyulf-core/tests/unit/test_encoding_output_names_regression_20260912.py @@ -0,0 +1,290 @@ +"""Public encoder contracts for unambiguous, stable indicator column names.""" + +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest +from sklearn.preprocessing import OneHotEncoder + +from skyulf.engines.registry import EngineRegistry +from skyulf.preprocessing.drop_and_missing.missing_indicator import ( + MissingIndicatorApplier, + MissingIndicatorCalculator, +) +from skyulf.preprocessing.encoding.dummy import DummyEncoderApplier, DummyEncoderCalculator +from skyulf.preprocessing.encoding.one_hot import OneHotEncoderApplier, OneHotEncoderCalculator +from skyulf.preprocessing.encoding.target import TargetEncoderApplier, TargetEncoderCalculator + + +@pytest.fixture(params=["onehot", "dummy"]) +def encoder(request): + """Exercise both public calculator/applier pairs with the same output contract.""" + if request.param == "onehot": + return OneHotEncoderCalculator(), OneHotEncoderApplier() + return DummyEncoderCalculator(), DummyEncoderApplier() + + +@pytest.fixture(params=[("pandas", False), ("pandas", True), ("polars", False), ("polars", True)]) +def frame_kind(request): + """Include the native and wrapped input forms supported by each engine.""" + return request.param + + +def _frame(data: dict[str, list[Any]], frame_kind: tuple[str, bool]) -> Any: + """Construct equivalent frames without changing the public caller's input form.""" + engine, wrapped = frame_kind + native: Any = pd.DataFrame(data) + if engine == "polars": + native = pl.from_pandas(native) + return EngineRegistry.wrap(native) if wrapped else native + + +def _pandas(frame: Any) -> pd.DataFrame: + """Expose result values for engine-independent assertions.""" + return frame.to_pandas() if hasattr(frame, "to_pandas") else frame + + +def test_fit_rejects_indicator_name_matching_a_retained_column(encoder, frame_kind): + """Fitting must reject an ambiguous schema before a later transform loses input values.""" + calculator, _ = encoder + frame = _frame({"city": ["a", "b"], "city_a": [9, 8]}, frame_kind) + original = _pandas(frame).copy(deep=True) + + with pytest.raises(ValueError, match="collid.*city_a"): + calculator.fit(frame, {"columns": ["city"]}) + + pd.testing.assert_frame_equal(_pandas(frame), original) + + +def test_apply_rejects_extra_column_matching_an_absent_fitted_category(encoder, frame_kind): + """Held-out columns must not overwrite fitted indicators even when their category is absent.""" + calculator, applier = encoder + artifact = calculator.fit(_frame({"city": ["a", "b"]}, frame_kind), {"columns": ["city"]}) + other_engine = "polars" if frame_kind[0] == "pandas" else "pandas" + heldout = _frame({"city": ["b"], "city_a": [91]}, (other_engine, frame_kind[1])) + original = _pandas(heldout).copy(deep=True) + + with pytest.raises(ValueError, match="collid.*city_a"): + applier.apply(heldout, artifact) + + pd.testing.assert_frame_equal(_pandas(heldout), original) + + +def test_fit_rejects_duplicate_indicator_names_from_distinct_sources(encoder, frame_kind): + """Underscores in source names and categories must not merge independent indicators.""" + calculator, _ = encoder + frame = _frame({"a": ["b_c", "d"], "a_b": ["c", "e"]}, frame_kind) + + with pytest.raises(ValueError, match="collid.*a_b_c"): + calculator.fit(frame, {"columns": ["a", "a_b"]}) + + +def test_apply_rejects_duplicate_names_in_legacy_artifacts(encoder, frame_kind): + """Artifacts fitted before collision validation must fail without mutating their input.""" + calculator, applier = encoder + frame = _frame({"a": ["b_c", "d"], "a_b": ["c", "e"]}, frame_kind) + artifact: dict[str, Any] = {"columns": ["a", "a_b"]} + if isinstance(calculator, OneHotEncoderCalculator): + fitted = OneHotEncoder(sparse_output=False).fit(_pandas(frame).to_numpy()) + artifact.update( + encoder_object=fitted, feature_names=fitted.get_feature_names_out(["a", "a_b"]).tolist() + ) + else: + artifact["categories"] = {"a": ["b_c", "d"], "a_b": ["c", "e"]} + original = _pandas(frame).copy(deep=True) + + with pytest.raises(ValueError, match="collid.*a_b_c"): + applier.apply(frame, artifact) + + pd.testing.assert_frame_equal(_pandas(frame), original) + + +def test_indicator_can_reuse_a_source_name_that_is_dropped(encoder, frame_kind): + """Dropping originals must preserve both the replacement indicator and other source values.""" + calculator, applier = encoder + frame = _frame({"a": ["b", "c"], "a_b": ["x", "y"], "keep": [9, 8]}, frame_kind) + artifact = calculator.fit(frame, {"columns": ["a", "a_b"]}) + result = _pandas(applier.apply(frame, artifact)) + + assert list(result.columns) == ["keep", "a_b", "a_c", "a_b_x", "a_b_y"] + np.testing.assert_array_equal(result.to_numpy(), [[9, 1, 0, 1, 0], [8, 0, 1, 0, 1]]) + assert _pandas(frame)["a_b"].tolist() == ["x", "y"] + + +def test_drop_first_excludes_names_that_are_not_emitted(encoder, frame_kind): + """A retained column matching a dropped reference category must remain a valid input.""" + calculator, applier = encoder + frame = _frame({"city": ["a", "b"], "city_a": [9, 8]}, frame_kind) + artifact = calculator.fit(frame, {"columns": ["city"], "drop_first": True}) + result = _pandas(applier.apply(frame, artifact)) + + assert list(result.columns) == ["city_a", "city_b"] + np.testing.assert_array_equal(result.to_numpy(), [[9, 0], [8, 1]]) + + +def test_unseen_category_does_not_create_a_false_heldout_collision(encoder, frame_kind): + """Only fitted indicators reserve names; an unseen category cannot change the output schema.""" + calculator, applier = encoder + artifact = calculator.fit(_frame({"city": ["a", "b"]}, frame_kind), {"columns": ["city"]}) + result = _pandas(applier.apply(_frame({"city": ["c"], "city_c": [91]}, frame_kind), artifact)) + + assert list(result.columns) == ["city_c", "city_a", "city_b"] + assert result.iloc[0].tolist() == [91, 0, 0] + + +def test_numeric_indicators_keep_fitted_names_and_values_across_batches(encoder, frame_kind): + """Collision checks must preserve numeric dtype coercion and the fitted category contract.""" + calculator, applier = encoder + artifact = calculator.fit(_frame({"number": [1, 2]}, frame_kind), {"columns": ["number"]}) + alone = _pandas(applier.apply(_frame({"number": [1]}, frame_kind), artifact)) + together = _pandas(applier.apply(_frame({"number": [1.0, 2.5]}, frame_kind), artifact)) + + assert list(alone.columns) == list(together.columns) == ["number_1", "number_2"] + assert alone.iloc[0].tolist() == together.iloc[0].tolist() == [1, 0] + assert together.iloc[1].tolist() == [0, 0] + + +def test_onehot_keep_original_rejects_selected_source_name_collision(frame_kind): + """Keeping originals makes an indicator matching another selected source ambiguous.""" + frame = _frame({"a": ["b", "c"], "a_b": ["x", "y"]}, frame_kind) + + with pytest.raises(ValueError, match="collid.*a_b"): + OneHotEncoderCalculator().fit(frame, {"columns": ["a", "a_b"], "drop_original": False}) + + +@pytest.mark.parametrize( + ("values", "config", "name"), + [ + (["None", None], {}, "city_None"), + (["infrequent_sklearn"] * 5 + ["a", "b"], {"max_categories": 2}, "city_infrequent_sklearn"), + ], +) +def test_onehot_rejects_distinct_categories_with_identical_names(values, config, name, frame_kind): + """Null rendering and the infrequent bucket must not alias a real category indicator.""" + frame = _frame({"city": values}, frame_kind) + + with pytest.raises(ValueError, match=f"collid.*{name}"): + OneHotEncoderCalculator().fit(frame, {"columns": ["city"], **config}) + + +def test_onehot_sparse_artifact_preserves_unambiguous_output(frame_kind): + """Legacy sparse sklearn output must retain its fitted feature names and indicator values.""" + frame = _frame({"city": ["a", "b"], "keep": [9, 8]}, frame_kind) + artifact = OneHotEncoderCalculator().fit(frame, {"columns": ["city"], "drop_original": False}) + artifact["encoder_object"].set_params(sparse_output=True) + result = _pandas(OneHotEncoderApplier().apply(frame, artifact)) + + assert list(result.columns) == ["city", "keep", "city_a", "city_b"] + np.testing.assert_array_equal(result[["city_a", "city_b"]].to_numpy(), [[1, 0], [0, 1]]) + assert result["keep"].tolist() == [9, 8] + + +@pytest.mark.parametrize("explicit", [False, True]) +def test_missing_indicator_rejects_existing_flag_at_fit(explicit, frame_kind): + """Automatically detected and selected flags must never overwrite existing data.""" + frame = _frame({"x": [None, 2.0], "x_missing": [91, 92]}, frame_kind) + config = {"columns": ["x"]} if explicit else {} + + with pytest.raises(ValueError, match="collid.*x_missing"): + MissingIndicatorCalculator().fit(frame, config) + + +@pytest.mark.parametrize("suffix", ["_missing", "_flag"]) +def test_missing_indicator_rejects_heldout_flag_collision(suffix, frame_kind): + """A fitted custom flag name must be checked against each incoming frame.""" + artifact = MissingIndicatorCalculator().fit( + _frame({"x": [None, 2.0]}, frame_kind), {"columns": ["x"], "flag_suffix": suffix} + ) + frame = _frame({"x": [3.0], f"x{suffix}": [91]}, frame_kind) + + with pytest.raises(ValueError, match=f"collid.*x{suffix}"): + MissingIndicatorApplier().apply(frame, artifact) + + assert _pandas(frame)[f"x{suffix}"].tolist() == [91] + + +def test_missing_indicator_skips_absent_source_before_name_validation(frame_kind): + """A missing source emits no flag, so its would-be name cannot cause a false collision.""" + artifact = MissingIndicatorCalculator().fit( + _frame({"x": [None, 2.0]}, frame_kind), {"columns": ["x"]} + ) + frame = _frame({"x_missing": [91]}, frame_kind) + result = _pandas(MissingIndicatorApplier().apply(frame, artifact)) + + assert result.to_dict("list") == {"x_missing": [91]} + + +def _target_labels(frame_kind: tuple[str, bool], binary: bool = False) -> Any: + """Keep public tuple labels on the same engine as their feature frame.""" + labels = pd.Series(([0, 1] * 3) if binary else ([0, 1, 2] * 2), name="target") + return pl.from_pandas(labels) if frame_kind[0] == "polars" else labels + + +@pytest.mark.parametrize("method", ["fit", "fit_transform_train"]) +def test_multiclass_target_rejects_retained_class_name_during_fit(method, frame_kind): + """Both training entry points must reject class features that would destroy retained data.""" + frame = _frame({"city": ["a", "b"] * 3, "city_cls0": [91] * 6}, frame_kind) + original = _pandas(frame).copy(deep=True) + + with pytest.raises(ValueError, match="collid.*city_cls0"): + getattr(TargetEncoderCalculator(), method)( + (frame, _target_labels(frame_kind)), {"columns": ["city"], "target_type": "multiclass"} + ) + + pd.testing.assert_frame_equal(_pandas(frame), original) + + +def test_multiclass_target_rejects_extra_heldout_class_column(frame_kind): + """Multiclass replay must protect held-out columns absent from the fit-time schema.""" + artifact = TargetEncoderCalculator().fit( + (_frame({"city": ["a", "b"] * 3}, frame_kind), _target_labels(frame_kind)), + {"columns": ["city"], "target_type": "multiclass"}, + ) + frame = _frame({"city": ["a"], "city_cls2": [91]}, frame_kind) + + with pytest.raises(ValueError, match="collid.*city_cls2"): + TargetEncoderApplier().apply(frame, artifact) + + assert _pandas(frame)["city_cls2"].tolist() == [91] + + +@pytest.mark.parametrize("method", ["fit", "fit_transform_train"]) +def test_multiclass_target_allows_reusing_dropped_source_names(method, frame_kind): + """Class indicators may replace selected originals while all original features are encoded.""" + frame = _frame({"city": ["a", "b"] * 3, "city_cls0": ["x", "y"] * 3}, frame_kind) + fitted = getattr(TargetEncoderCalculator(), method)( + (frame, _target_labels(frame_kind)), + {"columns": ["city", "city_cls0"], "target_type": "multiclass", "smooth": 0}, + ) + if method == "fit": + result = TargetEncoderApplier().apply(frame, fitted) + else: + _, (result, _) = fitted + result = _pandas(result) + + assert list(result.columns) == [ + "city_cls0", + "city_cls1", + "city_cls2", + "city_cls0_cls0", + "city_cls0_cls1", + "city_cls0_cls2", + ] + np.testing.assert_allclose(result.iloc[:, :3].sum(axis=1), np.ones(6)) + np.testing.assert_allclose(result.iloc[:, 3:].sum(axis=1), np.ones(6)) + + +def test_binary_target_retains_columns_resembling_multiclass_outputs(frame_kind): + """Binary encoding emits no class suffixes and must keep similarly named input columns.""" + frame = _frame({"city": ["a", "b"] * 3, "city_cls0": [91] * 6}, frame_kind) + artifact = TargetEncoderCalculator().fit( + (frame, _target_labels(frame_kind, binary=True)), + {"columns": ["city"], "target_type": "binary", "smooth": 0}, + ) + result = _pandas(TargetEncoderApplier().apply(frame, artifact)) + + assert list(result.columns) == ["city", "city_cls0"] + assert result["city"].tolist() == [0, 1] * 3 + assert result["city_cls0"].tolist() == [91] * 6 diff --git a/skyulf-core/tests/unit/test_expect_empty.py b/skyulf-core/tests/unit/test_expect_empty.py new file mode 100644 index 000000000..4f1b3ddaf --- /dev/null +++ b/skyulf-core/tests/unit/test_expect_empty.py @@ -0,0 +1,138 @@ +"""Empty datasets must not silently pass row-level data-quality checks.""" + +from collections.abc import Callable +from typing import Any + +import pandas as pd +import polars as pl +import pytest + +from skyulf import ( + ExpectationError, + expect_columns_exist, + expect_no_nulls, + expect_unique, + expect_value_range, +) +from skyulf.engines.pandas_engine import SkyulfPandasWrapper +from skyulf.engines.polars_engine import SkyulfPolarsWrapper + + +@pytest.fixture(params=["pandas", "pandas_wrapper", "polars", "polars_wrapper"]) +def make_frame(request: pytest.FixtureRequest) -> Callable[[list[float | None]], Any]: + """Exercise native inputs and the supported engine wrappers through public APIs.""" + + def build(values: list[float | None]) -> Any: + """Keep the numeric schema present even when there are no rows.""" + if request.param.startswith("pandas"): + frame = pd.DataFrame({"value": pd.Series(values, dtype="float64")}) + return SkyulfPandasWrapper(frame) if request.param.endswith("wrapper") else frame + frame = pl.DataFrame({"value": values}, schema={"value": pl.Float64}) + return SkyulfPolarsWrapper(frame) if request.param.endswith("wrapper") else frame + + return build + + +@pytest.mark.parametrize("check", [expect_no_nulls, expect_unique, expect_value_range]) +def test_empty_rows_fail_by_default(make_frame: Callable, check: Callable) -> None: + """A failed ingestion must not look like a successful data-quality check.""" + columns = "value" if check is expect_value_range else ["value"] + with pytest.raises(ExpectationError, match="at least one row"): + check(make_frame([]), columns) + + +@pytest.mark.parametrize("check", [expect_no_nulls, expect_unique, expect_value_range]) +def test_empty_rows_can_be_allowed_explicitly(make_frame: Callable, check: Callable) -> None: + """Callers can deliberately preserve checks that accept an empty partition.""" + columns = "value" if check is expect_value_range else ["value"] + kwargs = {"minimum": 0, "maximum": 10} if check is expect_value_range else {} + assert check(make_frame([]), columns, allow_empty=True, **kwargs) is None + + +@pytest.mark.parametrize("allow_empty", [False, True]) +@pytest.mark.parametrize("check", [expect_no_nulls, expect_unique, expect_value_range]) +def test_empty_frames_still_validate_requested_columns( + make_frame: Callable, check: Callable, allow_empty: bool +) -> None: + """The empty-row option must not hide a broken column contract.""" + columns = "missing" if check is expect_value_range else ["missing"] + with pytest.raises(ExpectationError, match="Expected columns are missing"): + check(make_frame([]), columns, allow_empty=allow_empty) + + +@pytest.mark.parametrize( + ("check", "values", "columns", "kwargs", "error"), + [ + (expect_no_nulls, [None], ["value"], {}, "Null values found"), + (expect_unique, [1, 1], ["value"], {}, "duplicate rows"), + (expect_value_range, [11], "value", {"maximum": 10}, "not <= 10"), + ], +) +def test_allow_empty_does_not_disable_checks_on_existing_rows( + make_frame: Callable, + check: Callable, + values: list[float | None], + columns: str | list[str], + kwargs: dict, + error: str, +) -> None: + """Opting into empty frames must retain the actual null, range and duplicate checks.""" + with pytest.raises(ExpectationError, match=error): + check(make_frame(values), columns, allow_empty=True, **kwargs) + + +def test_null_only_range_is_not_an_empty_frame(make_frame: Callable) -> None: + """Range checks must keep ignoring null values when the input has rows.""" + assert expect_value_range(make_frame([None]), "value", minimum=0, maximum=10) is None + + +def test_columns_exist_remains_a_schema_only_check(make_frame: Callable) -> None: + """A schema check can validate a typed frame before any rows are available.""" + assert expect_columns_exist(make_frame([]), ["value"]) is None + + +@pytest.mark.parametrize("values", [[], [None]]) +@pytest.mark.parametrize("wrapped", [False, True]) +def test_range_with_no_observed_values_accepts_inferred_null_dtype( + values: list[None], wrapped: bool +) -> None: + """An empty or all-null Polars column must not invoke unsupported Null comparisons.""" + raw = pl.DataFrame({"value": values}) + frame = SkyulfPolarsWrapper(raw) if wrapped else raw + assert expect_value_range(frame, "value", minimum=0, maximum=10, allow_empty=not values) is None + + +def test_no_nulls_checks_row_count_without_an_explicit_subset(make_frame: Callable) -> None: + """The default all-columns path must enforce the same empty-row policy.""" + with pytest.raises(ExpectationError, match="at least one row"): + expect_no_nulls(make_frame([])) + + +def test_no_nulls_does_not_confuse_no_columns_with_no_rows() -> None: + """A zero-width Pandas frame can still contain rows and must use its row count.""" + assert expect_no_nulls(pd.DataFrame(index=[0, 1])) is None + + +@pytest.mark.parametrize("wrapped", [False, True]) +@pytest.mark.parametrize("allow_empty", [False, True]) +def test_empty_polars_checks_stay_native( + monkeypatch: pytest.MonkeyPatch, wrapped: bool, allow_empty: bool +) -> None: + """An empty-data guard must not introduce an expensive Polars conversion.""" + import skyulf.profiling.expect as expectation_module + + def fail_to_pandas(*args: object, **kwargs: object) -> None: + """Expose any regression that converts native numeric checks to Pandas.""" + raise AssertionError("unexpected pandas conversion") + + monkeypatch.setattr(expectation_module, "_as_pandas", fail_to_pandas) + raw = pl.DataFrame(schema={"value": pl.Float64}) + frame = SkyulfPolarsWrapper(raw) if wrapped else raw + checks: list[Callable[..., None]] = [expect_no_nulls, expect_unique, expect_value_range] + for check in checks: + columns = "value" if check is expect_value_range else ["value"] + if allow_empty: + assert check(frame, columns, allow_empty=True) is None + else: + with pytest.raises(ExpectationError, match="at least one row"): + check(frame, columns) From f479e1969dee7b7c132df993c2a52d02e7a2ab08 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 20:12:20 +0300 Subject: [PATCH 08/17] fix(core): restore LightGBM sampling and decomposition navigation Warn about ignored split settings and restrict Canvas split payloads. Preserve missing-group identity through EDA requests and navigation. Include regressions, rebuilt assets, documentation and the recorded Core audit follow-up. Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 11 + docs/guides/backend_api.md | 19 +- docs/reference/modeling_nodes.md | 19 ++ docs/reference/preprocessing_nodes.md | 10 +- .../e2e/eda-decomposition-missing.spec.ts | 78 ++++++ .../components/eda/DecompositionTree.test.tsx | 87 +++++++ .../src/components/eda/DecompositionTree.tsx | 61 +++-- frontend/ml-canvas/src/core/api/eda.ts | 7 +- .../utils/pipelineConversion/preprocessing.ts | 3 +- .../utils/pipelineConversion/split.test.ts | 41 +++ .../analysis/opus_core_analysis-open_queue.md | 72 +++--- .../analysis/opus_core_analysis-tracker.md | 203 ++++++++++++++- .../opus_core_analysis/12-splitters.md | 9 + skyulf-core/skyulf/modeling/_lightgbm.py | 33 +++ skyulf-core/skyulf/modeling/_tuning/engine.py | 2 + skyulf-core/skyulf/modeling/classification.py | 15 +- .../skyulf/modeling/hyperparameters/_tree.py | 5 +- skyulf-core/skyulf/modeling/regression.py | 16 +- skyulf-core/skyulf/preprocessing/split.py | 36 ++- .../profiling/_analyzer/decomposition.py | 30 ++- .../test_profiling_decomposition_missing.py | 98 ++++++++ .../integration/test_split_config_warnings.py | 102 ++++++++ .../tests/unit/test_lightgbm_subsampling.py | 236 ++++++++++++++++++ ...e-Dyr3ReJ0.js => AuditLogPage-DPVze77q.js} | 2 +- ...-FTzER2c0.js => DataDriftPage-DBBkKEof.js} | 2 +- ...JQ6Vxf0.js => DeploymentsPage-DlnI46US.js} | 2 +- static/ml_canvas/assets/EDAPage-BkzWx__1.js | 12 + static/ml_canvas/assets/EDAPage-CC9tylrM.js | 12 - ...-B6M0swMs.js => InferencePage-BvDNVaSU.js} | 2 +- ...-8Pg2diG_.js => ModelRegistry-Bw2YKOFO.js} | 2 +- ...-ixEyO8cV.js => SlowNodesPage-DjArPNLO.js} | 2 +- ...KB.js => abnfDiagram-VCTEODGH-BA-XXAuE.js} | 2 +- ... architectureDiagram-5GKGNRK7-BxKLzAsN.js} | 2 +- ...y.js => blockDiagram-I7D4REHJ-j0yjDlHD.js} | 2 +- ...Y5T3.js => c4Diagram-7LVT6UL2-9wb6NkWK.js} | 2 +- static/ml_canvas/assets/channel-D4R-Rc0m.js | 1 + static/ml_canvas/assets/channel-DIwzyvS1.js | 1 - ...BBHJD4OQ.js => chunk-2Q5K7J3B-bOW8kvkF.js} | 2 +- ...vgh9rKCo.js => chunk-5VM5RSS4-C6GC8vvo.js} | 2 +- ...B6ZPWwpd.js => chunk-F27PBJKO-CzX57j4f.js} | 2 +- ...D26YLBdf.js => chunk-IMKFNOWR-Te9v1FIK.js} | 2 +- ...D_VUnfvZ.js => chunk-JWPE2WC7-B0RMgOJt.js} | 2 +- ...oeZXlwKE.js => chunk-POPQ4Y6H-CGqTimen.js} | 2 +- ...rNd1SwBb.js => chunk-SVP7TREG-BbXYbc8x.js} | 2 +- ...fDp21oQ3.js => chunk-TICWLB2K-C_ND7Y6C.js} | 2 +- ...Bs02z9v-.js => chunk-XXDRQBXY-BLKLIunJ.js} | 2 +- .../assets/classDiagram-ZZMXUADV-B-odMm70.js | 1 - .../assets/classDiagram-ZZMXUADV-BL29_2U2.js | 1 + .../classDiagram-v2-VYDZK3BY-B-odMm70.js | 1 - .../classDiagram-v2-VYDZK3BY-BL29_2U2.js | 1 + ...-.js => cose-bilkent-JH36ORCC-B9wHaWDG.js} | 2 +- ...aIaB7v.js => cynefin-OW5HDTMX-B9uzoGfR.js} | 2 +- ...js => cynefinDiagram-5FMLGOSQ-CzFli75j.js} | 2 +- ...HI_1BsWY.js => dagre-GXQ25YYZ-B4MP3Plp.js} | 2 +- ...xvjyBt.js => diagram-S7CK7UJ4-eE7ozkpX.js} | 2 +- ...U-fTJX.js => diagram-UQ7AKVKN-BnbQkIqG.js} | 2 +- ...HXd--c.js => diagram-VSXAHHWV-Bf7G2Gse.js} | 2 +- ...Cb8NMS.js => diagram-VX7I27RA-CZnDwfvE.js} | 2 +- ...NpeXsQ.js => diagram-Z3DM3KII-Cqf74g10.js} | 2 +- ...5D.js => ebnfDiagram-PWID7BFC-BrXqZ7JF.js} | 2 +- ...fcik.js => erDiagram-RLTQ6QDP-ClvuHycY.js} | 2 +- ...a5.js => flowDiagram-HODETNUW-B-fmyqOw.js} | 2 +- ...P.js => ganttDiagram-EL5Y4UJY-C6gbssAY.js} | 2 +- ...s => gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js} | 2 +- .../{index-_bluKNvP.js => index-BR7Y881F.js} | 8 +- ...8X.js => infoDiagram-27XIBGKW-BYbjxULf.js} | 2 +- ...s => ishikawaDiagram-5VMMS53U-C6U6iZ6u.js} | 2 +- ...js => journeyDiagram-3NMN7TZE-DLdfxAvt.js} | 2 +- ...=> kanban-definition-UXKFOSKX-BOJnqoJE.js} | 2 +- ...{layout-D4UUaX_9.js => layout-s0gQ8r44.js} | 2 +- ...e-DBa20IFF.js => mermaid.core-Bh6LVe7i.js} | 10 +- ...> mindmap-definition-YA3MSWOX-q0jvfvMy.js} | 2 +- ...6hL.js => pegDiagram-XKGWAZYB-DPT6U1TU.js} | 2 +- ...X98.js => pieDiagram-E7YTZNPT-I-cL6PKO.js} | 2 +- ...s => quadrantDiagram-AXDQQJYC-D5F7m3hQ.js} | 2 +- ...s => railroadDiagram-O6MQD6OU-DB9mNuo5.js} | 2 +- ...> requirementDiagram-BXWQKSXE-zfL0JJ5z.js} | 2 +- ....js => sankeyDiagram-P5KCCOFB-B-FZ_6j8.js} | 2 +- ...s => sequenceDiagram-WJ2MYXX4-BBJpGmE9.js} | 2 +- ...yb.js => sizeCapture-INFHLROL-DUGUyLSa.js} | 2 +- ...A.js => stateDiagram-D77RDMKH-BZRhMfUy.js} | 2 +- .../stateDiagram-v2-MP3YSRHH-CIeclGCR.js | 1 + .../stateDiagram-v2-MP3YSRHH-D_3MdGaI.js | 1 - ...9bDi.js => swimlanes-42K2YHIH-X3NDKqK8.js} | 2 +- .../swimlanesDiagram-VR7AAH4N-9O47xpSI.js | 8 + .../swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js | 8 - ... timeline-definition-24CTP7MA-DKpgYUw-.js} | 2 +- ...Pt.js => vennDiagram-4TSXK5OY-DW_WRjKp.js} | 2 +- ...js => wardleyDiagram-VM6X3IG4-DdsuhfKh.js} | 2 +- ...js => xychartDiagram-S5SC5T6Z-n6bmpw2W.js} | 2 +- static/ml_canvas/index.html | 2 +- .../test_eda_decomposition_missing.py | 58 +++++ 92 files changed, 1252 insertions(+), 173 deletions(-) create mode 100644 frontend/ml-canvas/e2e/eda-decomposition-missing.spec.ts create mode 100644 frontend/ml-canvas/src/components/eda/DecompositionTree.test.tsx create mode 100644 frontend/ml-canvas/src/core/utils/pipelineConversion/split.test.ts create mode 100644 skyulf-core/skyulf/modeling/_lightgbm.py create mode 100644 skyulf-core/tests/integration/test_profiling_decomposition_missing.py create mode 100644 skyulf-core/tests/integration/test_split_config_warnings.py create mode 100644 skyulf-core/tests/unit/test_lightgbm_subsampling.py rename static/ml_canvas/assets/{AuditLogPage-Dyr3ReJ0.js => AuditLogPage-DPVze77q.js} (99%) rename static/ml_canvas/assets/{DataDriftPage-FTzER2c0.js => DataDriftPage-DBBkKEof.js} (99%) rename static/ml_canvas/assets/{DeploymentsPage-BJQ6Vxf0.js => DeploymentsPage-DlnI46US.js} (99%) create mode 100644 static/ml_canvas/assets/EDAPage-BkzWx__1.js delete mode 100644 static/ml_canvas/assets/EDAPage-CC9tylrM.js rename static/ml_canvas/assets/{InferencePage-B6M0swMs.js => InferencePage-BvDNVaSU.js} (99%) rename static/ml_canvas/assets/{ModelRegistry-8Pg2diG_.js => ModelRegistry-Bw2YKOFO.js} (99%) rename static/ml_canvas/assets/{SlowNodesPage-ixEyO8cV.js => SlowNodesPage-DjArPNLO.js} (99%) rename static/ml_canvas/assets/{abnfDiagram-VCTEODGH-Da14qxKB.js => abnfDiagram-VCTEODGH-BA-XXAuE.js} (83%) rename static/ml_canvas/assets/{architectureDiagram-5GKGNRK7-DR-sbxhh.js => architectureDiagram-5GKGNRK7-BxKLzAsN.js} (99%) rename static/ml_canvas/assets/{blockDiagram-I7D4REHJ-01ED4W8y.js => blockDiagram-I7D4REHJ-j0yjDlHD.js} (99%) rename static/ml_canvas/assets/{c4Diagram-7LVT6UL2-CrUbY5T3.js => c4Diagram-7LVT6UL2-9wb6NkWK.js} (99%) create mode 100644 static/ml_canvas/assets/channel-D4R-Rc0m.js delete mode 100644 static/ml_canvas/assets/channel-DIwzyvS1.js rename static/ml_canvas/assets/{chunk-2Q5K7J3B-BBHJD4OQ.js => chunk-2Q5K7J3B-bOW8kvkF.js} (66%) rename static/ml_canvas/assets/{chunk-5VM5RSS4-vgh9rKCo.js => chunk-5VM5RSS4-C6GC8vvo.js} (83%) rename static/ml_canvas/assets/{chunk-F27PBJKO-B6ZPWwpd.js => chunk-F27PBJKO-CzX57j4f.js} (96%) rename static/ml_canvas/assets/{chunk-IMKFNOWR-D26YLBdf.js => chunk-IMKFNOWR-Te9v1FIK.js} (99%) rename static/ml_canvas/assets/{chunk-JWPE2WC7-D_VUnfvZ.js => chunk-JWPE2WC7-B0RMgOJt.js} (78%) rename static/ml_canvas/assets/{chunk-POPQ4Y6H-oeZXlwKE.js => chunk-POPQ4Y6H-CGqTimen.js} (87%) rename static/ml_canvas/assets/{chunk-SVP7TREG-rNd1SwBb.js => chunk-SVP7TREG-BbXYbc8x.js} (99%) rename static/ml_canvas/assets/{chunk-TICWLB2K-fDp21oQ3.js => chunk-TICWLB2K-C_ND7Y6C.js} (99%) rename static/ml_canvas/assets/{chunk-XXDRQBXY-Bs02z9v-.js => chunk-XXDRQBXY-BLKLIunJ.js} (76%) delete mode 100644 static/ml_canvas/assets/classDiagram-ZZMXUADV-B-odMm70.js create mode 100644 static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js delete mode 100644 static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-B-odMm70.js create mode 100644 static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js rename static/ml_canvas/assets/{cose-bilkent-JH36ORCC-DSJwbOO-.js => cose-bilkent-JH36ORCC-B9wHaWDG.js} (99%) rename static/ml_canvas/assets/{cynefin-OW5HDTMX-DvaIaB7v.js => cynefin-OW5HDTMX-B9uzoGfR.js} (99%) rename static/ml_canvas/assets/{cynefinDiagram-5FMLGOSQ-DQF0zKIv.js => cynefinDiagram-5FMLGOSQ-CzFli75j.js} (98%) rename static/ml_canvas/assets/{dagre-GXQ25YYZ-HI_1BsWY.js => dagre-GXQ25YYZ-B4MP3Plp.js} (98%) rename static/ml_canvas/assets/{diagram-S7CK7UJ4-zlxvjyBt.js => diagram-S7CK7UJ4-eE7ozkpX.js} (96%) rename static/ml_canvas/assets/{diagram-UQ7AKVKN-B7U-fTJX.js => diagram-UQ7AKVKN-BnbQkIqG.js} (95%) rename static/ml_canvas/assets/{diagram-VSXAHHWV-XaHXd--c.js => diagram-VSXAHHWV-Bf7G2Gse.js} (97%) rename static/ml_canvas/assets/{diagram-VX7I27RA-NQCb8NMS.js => diagram-VX7I27RA-CZnDwfvE.js} (97%) rename static/ml_canvas/assets/{diagram-Z3DM3KII-DZNpeXsQ.js => diagram-Z3DM3KII-Cqf74g10.js} (95%) rename static/ml_canvas/assets/{ebnfDiagram-PWID7BFC-5A6xA75D.js => ebnfDiagram-PWID7BFC-BrXqZ7JF.js} (84%) rename static/ml_canvas/assets/{erDiagram-RLTQ6QDP-DUTJfcik.js => erDiagram-RLTQ6QDP-ClvuHycY.js} (98%) rename static/ml_canvas/assets/{flowDiagram-HODETNUW-CY2uKpa5.js => flowDiagram-HODETNUW-B-fmyqOw.js} (99%) rename static/ml_canvas/assets/{ganttDiagram-EL5Y4UJY-BPTKWvnP.js => ganttDiagram-EL5Y4UJY-C6gbssAY.js} (99%) rename static/ml_canvas/assets/{gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js => gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js} (99%) rename static/ml_canvas/assets/{index-_bluKNvP.js => index-BR7Y881F.js} (98%) rename static/ml_canvas/assets/{infoDiagram-27XIBGKW-BKR9ZU8X.js => infoDiagram-27XIBGKW-BYbjxULf.js} (72%) rename static/ml_canvas/assets/{ishikawaDiagram-5VMMS53U-CiUVSvQn.js => ishikawaDiagram-5VMMS53U-C6U6iZ6u.js} (99%) rename static/ml_canvas/assets/{journeyDiagram-3NMN7TZE-5Eg3OQkk.js => journeyDiagram-3NMN7TZE-DLdfxAvt.js} (98%) rename static/ml_canvas/assets/{kanban-definition-UXKFOSKX-DdgiJMlk.js => kanban-definition-UXKFOSKX-BOJnqoJE.js} (99%) rename static/ml_canvas/assets/{layout-D4UUaX_9.js => layout-s0gQ8r44.js} (99%) rename static/ml_canvas/assets/{mermaid.core-DBa20IFF.js => mermaid.core-Bh6LVe7i.js} (99%) rename static/ml_canvas/assets/{mindmap-definition-YA3MSWOX-DQIC6o-x.js => mindmap-definition-YA3MSWOX-q0jvfvMy.js} (98%) rename static/ml_canvas/assets/{pegDiagram-XKGWAZYB-BQQjq6hL.js => pegDiagram-XKGWAZYB-DPT6U1TU.js} (84%) rename static/ml_canvas/assets/{pieDiagram-E7YTZNPT-B2e1MX98.js => pieDiagram-E7YTZNPT-I-cL6PKO.js} (96%) rename static/ml_canvas/assets/{quadrantDiagram-AXDQQJYC-B8cLCZlE.js => quadrantDiagram-AXDQQJYC-D5F7m3hQ.js} (99%) rename static/ml_canvas/assets/{railroadDiagram-O6MQD6OU-DqV6ivu7.js => railroadDiagram-O6MQD6OU-DB9mNuo5.js} (81%) rename static/ml_canvas/assets/{requirementDiagram-BXWQKSXE-B8LHaj5a.js => requirementDiagram-BXWQKSXE-zfL0JJ5z.js} (99%) rename static/ml_canvas/assets/{sankeyDiagram-P5KCCOFB-BoZhgcxg.js => sankeyDiagram-P5KCCOFB-B-FZ_6j8.js} (99%) rename static/ml_canvas/assets/{sequenceDiagram-WJ2MYXX4-BKpy-f0A.js => sequenceDiagram-WJ2MYXX4-BBJpGmE9.js} (99%) rename static/ml_canvas/assets/{sizeCapture-INFHLROL-DhKNPmyb.js => sizeCapture-INFHLROL-DUGUyLSa.js} (88%) rename static/ml_canvas/assets/{stateDiagram-D77RDMKH-DsmaWosA.js => stateDiagram-D77RDMKH-BZRhMfUy.js} (96%) create mode 100644 static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-CIeclGCR.js delete mode 100644 static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-D_3MdGaI.js rename static/ml_canvas/assets/{swimlanes-42K2YHIH-Dd449bDi.js => swimlanes-42K2YHIH-X3NDKqK8.js} (99%) create mode 100644 static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-9O47xpSI.js delete mode 100644 static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js rename static/ml_canvas/assets/{timeline-definition-24CTP7MA-CSbm3DNI.js => timeline-definition-24CTP7MA-DKpgYUw-.js} (99%) rename static/ml_canvas/assets/{vennDiagram-4TSXK5OY-U8E6M_Pt.js => vennDiagram-4TSXK5OY-DW_WRjKp.js} (99%) rename static/ml_canvas/assets/{wardleyDiagram-VM6X3IG4-l1AdmyzU.js => wardleyDiagram-VM6X3IG4-DdsuhfKh.js} (99%) rename static/ml_canvas/assets/{xychartDiagram-S5SC5T6Z-DvskLDdU.js => xychartDiagram-S5SC5T6Z-n6bmpw2W.js} (99%) create mode 100644 tests/integration/test_eda_decomposition_missing.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index a8ed952e9..54c9c2643 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,17 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **LightGBM row sampling (OC-187):** make `subsample` effective for GBDT/DART + in basic training, all tuning strategies and final refitting. Preserve GOSS + sampling, explicit frequency overrides and existing fitted models; retrain + to apply a previously ignored fraction. +- **EDA decomposition missing groups (OC-192):** keep missing values separate + from a literal `Unknown` category and use their identity when drilling down. + The tree labels missing groups explicitly and retains them during navigation. +- **Split configuration warnings (OC-90):** warn when an unsupported public + setting is ignored, including `stratify_col`; use `stratify` and + `target_column` in node configs. Canvas sends only supported split settings + plus routing metadata, so editor labels do not produce warnings. - **Generated column collisions (OC-18):** reject conflicting one-hot, dummy, missing-indicator and multiclass target-encoding names before replacing existing data or emitting duplicate columns. Checks also apply at inference; diff --git a/docs/guides/backend_api.md b/docs/guides/backend_api.md index e696f32d0..16afd0dbe 100644 --- a/docs/guides/backend_api.md +++ b/docs/guides/backend_api.md @@ -302,7 +302,24 @@ Get a specific EDA report by ID. Cancel a running EDA analysis. ### `POST /api/eda/{dataset_id}/decomposition` -Run time-series decomposition on a dataset column. +Aggregate a measure for one level of the EDA decomposition tree, optionally +grouped by `split_col` and restricted by `filters`. + +Grouped response rows include `name` (display label), `filter_value` (the +category identity), `value` and `ratio`. Use `filter_value` when drilling into a +row: missing values have JSON `null`, while a real category named `Unknown` +has the string `"Unknown"`. For example, the following filter selects missing +values in `group`: + +```json +{"column": "group", "operator": "==", "value": null} +``` + +Use `"!="` with `null` to select non-missing rows. The UI labels the missing +bucket `Unknown (missing)` and keeps literal `Unknown` separate. Older response +rows without `filter_value` fall back to their display name; the legacy string +`"Unknown"` still selects missing values on numeric columns. Reload or reopen +the tree to obtain updated group identities; no stored-data migration is needed. ### `GET /api/eda/jobs/all` List all EDA jobs with status. Query params: `limit` (default 50), `skip` (default 0). diff --git a/docs/reference/modeling_nodes.md b/docs/reference/modeling_nodes.md index eac463a06..28aff20bb 100644 --- a/docs/reference/modeling_nodes.md +++ b/docs/reference/modeling_nodes.md @@ -62,6 +62,25 @@ Seed** in each node's Cross Validation section. Full precedence rules: ## Classification +### LightGBM row sampling + +The `lgbm_classifier` and `lgbm_regressor` nodes apply `subsample` during basic +training, hyperparameter search and the final refit. With GBDT or DART, +`subsample=0.4` uses 40% of the training rows per boosting iteration. The default +`subsample=1.0` uses all rows. GOSS keeps its gradient-based sampling instead of +ordinary row bagging, so this fraction does not control GOSS sampling. + +Skyulf resolves its automatic `subsample_freq=None` to 1 for ordinary boosting +and 0 for GOSS after each candidate's parameters are applied. Explicit numeric +frequencies and LightGBM's `bagging_freq` alias are preserved; `subsample_freq=0` +disables row bagging. Explicit combinations that LightGBM rejects, such as GOSS +with ordinary bagging enabled, continue to raise an error. + +Previously the default frequency was 0, so changing `subsample` had no effect. +Existing fitted models retain their predictions. Retrain or rerun tuning to +apply a previously ignored fraction. To reproduce the previous sampling policy +in a new fit, set `subsample_freq=0` explicitly. + ### logistic_regression Backed by `sklearn.linear_model.LogisticRegression`. diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index c1d3a84f1..3832fc259 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -58,7 +58,15 @@ Config (`params`): - `stratify`: bool (default False) - `target_column`: str (required only when splitting a DataFrame and using stratify) -Learned params: none (passes through config). +The node copies only these six settings into its fitted artifact. Unknown +public keys produce a warning and are ignored; they do not change the split. +For example, `stratify_col="target"` is a `DataSplitter` constructor argument, +not a node setting. Use `stratify=True` and `target_column="target"` here. +The artifact's `type` field and private underscore-prefixed routing metadata +are ignored without warnings. Canvas sends the supported settings separately +from its editor labels and identifiers. + +Learned params: none (records the recognized config settings). ### feature_target_split diff --git a/frontend/ml-canvas/e2e/eda-decomposition-missing.spec.ts b/frontend/ml-canvas/e2e/eda-decomposition-missing.spec.ts new file mode 100644 index 000000000..49d3177dc --- /dev/null +++ b/frontend/ml-canvas/e2e/eda-decomposition-missing.spec.ts @@ -0,0 +1,78 @@ +import { expect, test } from '@playwright/test'; +import { mockBackend } from './fixtures/mockApi'; + +for (const viewport of [ + { name: 'desktop', width: 1440, height: 1000 }, + { name: 'mobile', width: 390, height: 844 }, +]) { + test.describe(viewport.name, () => { + test.use({ viewport: { width: viewport.width, height: viewport.height } }); + + test('drills into missing and literal Unknown groups independently by keyboard', async ({ page }) => { + /** The real browser request must retain JSON null through split and parent-selection refresh. */ + await mockBackend(page); + await page.route('**/data/api/sources/usable', route => route.fulfill({ json: { sources: [{ + id: '192', source_id: 'missing-groups', name: 'Missing groups', type: 'file', format: 'csv', + rows: 4, columns: 2, created_at: '2026-09-12T10:00:00Z', + }] } })); + await page.route('**/api/eda/192/history', route => route.fulfill({ json: [] })); + await page.route('**/api/eda/192/latest', route => route.fulfill({ json: { + id: 192, status: 'COMPLETED', created_at: '2026-09-12T10:00:00Z', + profile_data: { + row_count: 4, column_count: 2, duplicate_rows: 0, + missing_cells_percentage: 25, memory_usage_mb: 0.01, alerts: [], + columns: Object.fromEntries(['group', 'detail'].map(name => [name, { + name, dtype: 'Categorical', missing_count: name === 'group' ? 2 : 0, + missing_percentage: name === 'group' ? 50 : 0, + categorical_stats: { unique_count: 2, top_k: [], rare_labels_count: 0 }, + }])), + }, + } })); + const requests: Array<{ column: string; operator: string; value: string | null }> = []; + await page.route('**/api/eda/192/decomposition', route => { + const body = route.request().postDataJSON(); + if (!body.split_col) return route.fulfill({ json: [{ name: 'Total', value: 4, ratio: 1 }] }); + if (body.split_col === 'group') return route.fulfill({ json: [ + { name: 'Unknown', filter_value: null, value: 2, ratio: 0.5 }, + { name: 'Unknown', filter_value: 'Unknown', value: 1, ratio: 0.25 }, + { name: 'a', filter_value: 'a', value: 1, ratio: 0.25 }, + ] }); + requests.push(...body.filters); + if (body.filters[0]?.value === null) return route.fulfill({ json: [ + { name: 'missing detail', filter_value: 'missing detail', value: 2, ratio: 1 }, + ] }); + if (body.filters[0]?.value === 'Unknown') return route.fulfill({ json: [ + { name: 'literal detail', filter_value: 'literal detail', value: 1, ratio: 1 }, + ] }); + return route.fulfill({ status: 400, json: { detail: 'Unexpected decomposition filter' } }); + }); + await page.goto('/eda?dataset_id=192'); + if (viewport.name === 'mobile') { + await page.getByRole('button', { name: 'Collapse Sidebar', exact: true }).click(); + } + await page.getByRole('button', { name: 'Decomposition', exact: true }).click(); + await page.getByRole('button', { name: 'Total 4 (100%)' }).click(); + await page.getByTitle('Split further').click(); + await page.getByRole('button', { name: 'group', exact: true }).click(); + const missing = page.getByRole('button', { name: 'Unknown (missing) 2 (50%)' }); + const literal = page.getByRole('button', { name: 'Unknown 1 (25%)' }); + await missing.focus(); + await missing.press('Enter'); + await expect(missing).toHaveAttribute('aria-pressed', 'true'); + await expect(literal).toHaveAttribute('aria-pressed', 'false'); + expect(await missing.getAttribute('id')).not.toBe(await literal.getAttribute('id')); + await page.getByTitle('Split further').click(); + await page.getByRole('button', { name: 'detail', exact: true }).click(); + await expect(page.getByText('missing detail', { exact: true })).toBeVisible(); + await literal.focus(); + await literal.press('Enter'); + await expect(page.getByText('literal detail', { exact: true })).toBeVisible(); + await expect(missing).toHaveAttribute('aria-pressed', 'false'); + await expect(literal).toHaveAttribute('aria-pressed', 'true'); + expect(requests).toEqual([ + { column: 'group', operator: '==', value: null }, + { column: 'group', operator: '==', value: 'Unknown' }, + ]); + }); + }); +} diff --git a/frontend/ml-canvas/src/components/eda/DecompositionTree.test.tsx b/frontend/ml-canvas/src/components/eda/DecompositionTree.test.tsx new file mode 100644 index 000000000..2350fb22b --- /dev/null +++ b/frontend/ml-canvas/src/components/eda/DecompositionTree.test.tsx @@ -0,0 +1,87 @@ +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { EDAService } from '../../core/api/eda'; +import { DecompositionTree } from './DecompositionTree'; + +const baseProps = { + datasetId: 192, + measureCol: 'count', + measureAgg: 'count', + columns: ['group', 'detail'], + initialFilters: [], +}; + +/** Open the selected bucket's next split through the user-facing menu. */ +function splitBy(column: string) { + fireEvent.click(screen.getByTitle('Split further')); + fireEvent.click(screen.getByRole('button', { name: column })); +} + +describe('decomposition missing bucket identity', () => { + beforeEach(() => { + Object.defineProperty(HTMLElement.prototype, 'scrollTo', { configurable: true, value: vi.fn() }); + }); + + afterEach(() => vi.restoreAllMocks()); + + it('keeps missing and literal Unknown selections separate through split, refresh, and cache restore', async () => { + // Using labels for filters or selection would select both buckets and fetch the wrong rows. + const getDecomposition = vi.spyOn(EDAService, 'getDecomposition') + .mockResolvedValueOnce([{ name: 'Total', value: 4, ratio: 1 }]) + .mockResolvedValueOnce([ + { name: 'Unknown', filter_value: null, value: 2, ratio: 0.5 }, + { name: 'Unknown', filter_value: 'Unknown', value: 1, ratio: 0.25 }, + { name: 'a', filter_value: 'a', value: 1, ratio: 0.25 }, + ]) + .mockResolvedValueOnce([{ name: 'missing detail', filter_value: 'missing detail', value: 2, ratio: 1 }]) + .mockResolvedValueOnce([{ name: 'literal detail', filter_value: 'literal detail', value: 1, ratio: 1 }]) + .mockResolvedValueOnce([{ name: 'missing detail', filter_value: 'missing detail', value: 2, ratio: 1 }]); + const { unmount } = render(); + fireEvent.click(await screen.findByRole('button', { name: 'Total 4 (100%)' })); + splitBy('group'); + const missing = await screen.findByRole('button', { name: 'Unknown (missing) 2 (50%)' }); + const literal = screen.getByRole('button', { name: 'Unknown 1 (25%)' }); + expect(missing.id).not.toBe(literal.id); + fireEvent.click(missing); + expect(missing).toHaveAttribute('aria-pressed', 'true'); + expect(literal).toHaveAttribute('aria-pressed', 'false'); + splitBy('detail'); + await screen.findByText('missing detail'); + expect(getDecomposition).toHaveBeenLastCalledWith(192, null, 'count', 'detail', [ + { column: 'group', operator: '==', value: null }, + ]); + + fireEvent.click(literal); + await screen.findByText('literal detail'); + expect(getDecomposition).toHaveBeenLastCalledWith(192, null, 'count', 'detail', [ + { column: 'group', operator: '==', value: 'Unknown' }, + ]); + expect(missing).toHaveAttribute('aria-pressed', 'false'); + expect(literal).toHaveAttribute('aria-pressed', 'true'); + + unmount(); + render(); + fireEvent.click(screen.getByRole('button', { name: 'Unknown (missing) 2 (50%)' })); + await screen.findByText('missing detail'); + expect(getDecomposition).toHaveBeenLastCalledWith(192, null, 'count', 'detail', [ + { column: 'group', operator: '==', value: null }, + ]); + }); + + it('uses the existing label filter when an older response omits filter_value', async () => { + // Cached or older API rows remain drillable without guessing a null identity from their label. + const getDecomposition = vi.spyOn(EDAService, 'getDecomposition') + .mockResolvedValueOnce([{ name: 'Total', value: 1, ratio: 1 }]) + .mockResolvedValueOnce([{ name: 'Unknown', value: 1, ratio: 1 }]) + .mockResolvedValueOnce([{ name: 'legacy detail', value: 1, ratio: 1 }]); + render(); + fireEvent.click(await screen.findByRole('button', { name: 'Total 1 (100%)' })); + splitBy('group'); + fireEvent.click(await screen.findByRole('button', { name: 'Unknown 1 (100%)' })); + splitBy('detail'); + await waitFor(() => expect(screen.getByText('legacy detail')).toBeInTheDocument()); + expect(getDecomposition).toHaveBeenLastCalledWith(193, null, 'count', 'detail', [ + { column: 'group', operator: '==', value: 'Unknown' }, + ]); + }); +}); diff --git a/frontend/ml-canvas/src/components/eda/DecompositionTree.tsx b/frontend/ml-canvas/src/components/eda/DecompositionTree.tsx index 6eec60a6e..3753933fc 100644 --- a/frontend/ml-canvas/src/components/eda/DecompositionTree.tsx +++ b/frontend/ml-canvas/src/components/eda/DecompositionTree.tsx @@ -1,10 +1,11 @@ import React, { useState, useEffect, useRef } from 'react'; -import { EDAService, Filter } from '../../core/api/eda'; +import { EDAService, DecompositionFilter, Filter } from '../../core/api/eda'; import { Plus, X, Loader2 } from 'lucide-react'; import { clickableProps } from '../../core/utils/a11y'; interface TreeItem { name: string; + filter_value?: string | null; value: number; ratio: number; } @@ -13,8 +14,8 @@ interface TreeLevel { id: string; splitColumn: string | null; // The column used to generate this level's items items: TreeItem[]; - selectedItemName: string | null; - filters: Filter[]; // Filters applied to reach this level + selectedItemKey: string | null; + filters: DecompositionFilter[]; // Filters applied to reach this level } interface DecompositionTreeProps { @@ -31,6 +32,16 @@ interface DecompositionTreeProps { const TREE_CACHE_MAX_ENTRIES = 20; const treeCache = new Map(); +/** Retain explicit nulls while accepting responses from before filter values were added. */ +function getItemFilterValue(item: TreeItem): string | null { + return item.filter_value === undefined ? item.name : item.filter_value; +} + +/** Missing rows and a real category named Unknown must have different selection identities. */ +function getItemKey(item: TreeItem): string { + return JSON.stringify([getItemFilterValue(item)]); +} + function setTreeCache(key: string, value: { levels: TreeLevel[], splitPath: (string|null)[] }): void { // Re-inserting moves the key to the "most recently used" end. treeCache.delete(key); @@ -81,10 +92,10 @@ export const DecompositionTree: React.FC = ({ levels.forEach((level, index) => { if (index >= levels.length - 1) return; - const selectedItemName = level.selectedItemName; - if (!selectedItemName) return; + const selectedItemIndex = level.items.findIndex(item => getItemKey(item) === level.selectedItemKey); + if (selectedItemIndex < 0) return; - const startId = `node-${index}-${selectedItemName}`; + const startId = `node-${index}-${selectedItemIndex}`; const startEl = document.getElementById(startId); if (startEl) { @@ -99,9 +110,10 @@ export const DecompositionTree: React.FC = ({ const nextLevel = levels[index + 1]; if (!nextLevel) return; - if (nextLevel.selectedItemName) { + if (nextLevel.selectedItemKey) { // If next level has a selection, connect to that item - const endId = `node-${index + 1}-${nextLevel.selectedItemName}`; + const nextItemIndex = nextLevel.items.findIndex(item => getItemKey(item) === nextLevel.selectedItemKey); + const endId = `node-${index + 1}-${nextItemIndex}`; const endEl = document.getElementById(endId); if (endEl) { @@ -189,7 +201,7 @@ export const DecompositionTree: React.FC = ({ id: 'root', splitColumn: null, items: res, - selectedItemName: null, + selectedItemKey: null, filters: initialFilters }; @@ -209,12 +221,12 @@ export const DecompositionTree: React.FC = ({ const handleHeaderSplitClick = (levelIndex: number, event: React.MouseEvent) => { // Only allow splitting if an item is selected in this level const level = levels[levelIndex]; - if (!level || !level.selectedItemName) { + if (!level || !level.selectedItemKey) { // Maybe show a toast or tooltip? For now just return. return; } - const item = level.items.find(i => i.name === level.selectedItemName); + const item = level.items.find(i => getItemKey(i) === level.selectedItemKey); if (!item) return; // Open Split Menu @@ -252,7 +264,7 @@ export const DecompositionTree: React.FC = ({ // fetch below fails. const currentLevel = levels[levelIndex]; if (!currentLevel) return; - const updatedCurrentLevel = { ...currentLevel, selectedItemName: item.name }; + const updatedCurrentLevel = { ...currentLevel, selectedItemKey: getItemKey(item) }; const newLevels = levels.map((l, i) => (i === levelIndex ? updatedCurrentLevel : l)); // Check if we have a next level defined in our split path @@ -269,7 +281,7 @@ export const DecompositionTree: React.FC = ({ newFilters.push({ column: updatedCurrentLevel.splitColumn, operator: '==', - value: item.name + value: getItemFilterValue(item) }); } else if (levelIndex === 0) { // Root level @@ -293,7 +305,7 @@ export const DecompositionTree: React.FC = ({ id: `level-${levelIndex + 1}`, splitColumn: nextSplitCol, items: res, - selectedItemName: null, // Reset selection in next level + selectedItemKey: null, // Reset selection in next level filters: newFilters }; @@ -341,7 +353,7 @@ export const DecompositionTree: React.FC = ({ newFilters.push({ column: currentLevel.splitColumn, operator: '==', - value: item.name + value: getItemFilterValue(item) }); } @@ -360,7 +372,7 @@ export const DecompositionTree: React.FC = ({ id: `level-${levelIndex + 1}`, splitColumn: column, items: res, - selectedItemName: null, + selectedItemKey: null, filters: newFilters }; @@ -413,10 +425,10 @@ export const DecompositionTree: React.FC = ({ onClick={(e) => handleHeaderSplitClick(index, e)} className={` p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors - ${level.selectedItemName ? 'text-blue-500' : 'text-slate-300 cursor-not-allowed'} + ${level.selectedItemKey ? 'text-blue-500' : 'text-slate-300 cursor-not-allowed'} `} - title={level.selectedItemName ? "Split further" : "Select an item to split"} - disabled={!level.selectedItemName} + title={level.selectedItemKey ? "Split further" : "Select an item to split"} + disabled={!level.selectedItemKey} > @@ -436,16 +448,18 @@ export const DecompositionTree: React.FC = ({ className="flex-1 overflow-y-auto pr-2 space-y-2 scrollbar-thin scrollbar-thumb-slate-300 dark:scrollbar-thumb-slate-600" onScroll={updatePaths} > - {level.items.map((item) => { - const isSelected = level.selectedItemName === item.name; + {level.items.map((item, itemIndex) => { + const itemKey = getItemKey(item); + const isSelected = level.selectedItemKey === itemKey; const isMax = Math.max(...level.items.map(i => i.value)); const barWidth = (item.value / isMax) * 100; return (
handleItemClick(index, item))} + aria-pressed={isSelected} className={` relative p-3 rounded-md border cursor-pointer transition-all group ${isSelected @@ -457,6 +471,7 @@ export const DecompositionTree: React.FC = ({
{item.name} + {item.filter_value === null && (missing)} {item.value.toLocaleString()} ({Math.round(item.ratio * 100)}%) diff --git a/frontend/ml-canvas/src/core/api/eda.ts b/frontend/ml-canvas/src/core/api/eda.ts index aecba42dd..248b1f1d5 100644 --- a/frontend/ml-canvas/src/core/api/eda.ts +++ b/frontend/ml-canvas/src/core/api/eda.ts @@ -9,6 +9,11 @@ export interface Filter { value: string | number | boolean | Array; } +/** Decomposition drill-down supports an explicit null for the selected missing bucket. */ +export interface DecompositionFilter extends Omit { + value: Filter['value'] | null; +} + export interface EDAReport { id?: number; status?: 'PENDING' | 'COMPLETED' | 'FAILED' | string; @@ -65,7 +70,7 @@ export const EDAService = { return response.data; }, - getDecomposition: async (datasetId: number, measureCol: string | null, measureAgg: string, splitCol: string, filters: Filter[]) => { + getDecomposition: async (datasetId: number, measureCol: string | null, measureAgg: string, splitCol: string, filters: DecompositionFilter[]) => { // nosemgrep: node-ssrf -- browser axios call to our own fixed API_BASE; `datasetId` // is a numeric identifier, never an attacker-supplied host/URL. const response = await axios.post(`${API_BASE}/${datasetId}/decomposition`, { diff --git a/frontend/ml-canvas/src/core/utils/pipelineConversion/preprocessing.ts b/frontend/ml-canvas/src/core/utils/pipelineConversion/preprocessing.ts index 8dcc381f2..f14cceeaa 100644 --- a/frontend/ml-canvas/src/core/utils/pipelineConversion/preprocessing.ts +++ b/frontend/ml-canvas/src/core/utils/pipelineConversion/preprocessing.ts @@ -147,9 +147,10 @@ const convertEncoding: NodeConverter = (node) => { }; const convertTrainTestSplitter: NodeConverter = (node) => { + const keys = new Set(['test_size', 'validation_size', 'random_state', 'shuffle', 'stratify', 'target_column']); return { stepType: 'TrainTestSplitter', - params: node.data || {} + params: Object.fromEntries(Object.entries(node.data || {}).filter(([key]) => keys.has(key))) }; }; diff --git a/frontend/ml-canvas/src/core/utils/pipelineConversion/split.test.ts b/frontend/ml-canvas/src/core/utils/pipelineConversion/split.test.ts new file mode 100644 index 000000000..f3615ae82 --- /dev/null +++ b/frontend/ml-canvas/src/core/utils/pipelineConversion/split.test.ts @@ -0,0 +1,41 @@ +import type { Edge, Node } from '@xyflow/react'; +import { describe, expect, it } from 'vitest'; +import { convertGraphToPipelineConfig } from '../pipelineConverter'; + +describe('split configuration payload', () => { + it('sends split settings without Canvas editor fields while retaining routing metadata', () => { + // Editor fields must not produce unknown-setting warnings in the Core splitter. + const config = { + test_size: 0.25, + validation_size: 0, + random_state: 0, + shuffle: false, + stratify: false, + target_column: 'target', + }; + const nodes: Node[] = [ + { id: 'data', position: { x: 0, y: 0 }, data: { definitionType: 'dataset_node', datasetId: 'sample' } }, + { id: 'split', position: { x: 10, y: 0 }, data: { + definitionType: 'TrainTestSplitter', label: 'Holdout', title: 'Old title', + ...config, + } }, + ]; + const edges: Edge[] = [{ id: 'edge', source: 'data', target: 'split' }]; + const before = structuredClone(nodes); + const result = convertGraphToPipelineConfig(nodes, edges); + expect(result.nodes.find(node => node.node_id === 'split')?.params).toEqual({ + ...config, _display_name: 'Holdout', + }); + expect(nodes).toEqual(before); + }); + + it('keeps omitted optional settings absent so Core defaults remain effective', () => { + // A partial saved graph must not introduce undefined values or replacement defaults. + const nodes: Node[] = [ + { id: 'data', position: { x: 0, y: 0 }, data: { definitionType: 'dataset_node', datasetId: 'sample' } }, + { id: 'split', position: { x: 10, y: 0 }, data: { definitionType: 'TrainTestSplitter', test_size: 0.3 } }, + ]; + const result = convertGraphToPipelineConfig(nodes, [{ id: 'edge', source: 'data', target: 'split' }]); + expect(result.nodes.find(node => node.node_id === 'split')?.params).toEqual({ test_size: 0.3 }); + }); +}); diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 63bd7ea0a..14384aa18 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -15,7 +15,7 @@ file deliberately carries no history. per-area report files `00`–`18`). **Baseline:** commit `93d7719e` (master), audit run 2026-08-31 β†’ 09-01 by 15 parallel read-only agents (Claude Opus 5). 116 findings: 5 πŸ”΄ / 45 🟠 / 44 🟑 / -22 βšͺ, plus OC-160–247 filed by later reviews. OC-100 was retracted as a false +22 βšͺ, plus OC-160–263 filed by later reviews. OC-100 was retracted as a false positive and is not counted; the corrections pass stays in the archive. **Status key:** ⬜ open Β· 🟨 in progress Β· βœ… done Β· ⏭️ parked @@ -27,18 +27,36 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 25 open / 4 parked.** OC-18/30/48 are fixed -and recorded in the archive with reproduction and regression evidence. +**Current status (2026-09-12): 40 open / 4 parked.** The Core review adds +OC-248–263, reopens OC-35/46 and extends OC-47's reproduction evidence. +OC-90/187/192 remain fixed; filing and verification details are in the +[archive Log](opus_core_analysis-tracker.md#log). Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide deployment model), **Ongoing** (remove the hiding conditions). Remaining findings follow, grouped by domain. -The **Now**, **Next** and **Ongoing** tiers have no open findings left β€” those rows -are in the archive. **Next** closed its last two filed rows (OC-177, OC-164) on -2026-09-06, immediately re-opened with OC-207 filed *while* fixing OC-164, and -closed that on 2026-09-07. +The **Now** tier contains the newly reproduced training/threshold defects; +**Next** contains the remaining evaluation and payload paths of OC-35/46. +The **Ongoing** tier has no open findings left; its completed rows are in the +archive. The earlier fixes remain recorded there and are not undone by reopening +these narrower cases. + +### Now β€” silent wrongness reaching users + +| ID | Sev | Item | Effort | Status | +|---|---|---|---|---| +| OC-248 | 🟠 | Merged fold preprocessing joins different observations: `LagFeatures`/`RollingAggregate` can sort a branch, and `LagFeatures(drop_na=True)`/`ManualBounds` can filter it, but the merge resets indexes, combines columns positionally and takes the first branch's target (`preprocessing/fold_adapter.py:28-34,52-54,181`) | medium | ⬜ open β€” runtime reproduction leaves times `[3,1,2]` with targets `[100,200,300]`; filtering also produces 3 feature rows / 2 targets despite `changes_row_count=False`. | +| OC-249 | 🟠 | Public threshold optimization transforms only `X_val`, leaving `y_val` in its original order when preprocessing sorts or filters rows (`pipeline/_pipeline.py:543-549`) | small | ⬜ open β€” RollingAggregate sorting selects threshold `0.4118` instead of aligned `0.5`, changing eight initially correct predictions into one constant class. | +| OC-250 | 🟠 | Tuning bypasses the calculator's nonnative `class_weight` to `sample_weight` conversion while reporting `class_weight="balanced"` in the selected parameters (`modeling/_tuning/grid_random.py:150-154`, `refit.py:77`, `params.py:60`) | medium | ⬜ open β€” GradientBoosting and XGBoost tuned probabilities exactly match unweighted fits; maximum differences from the corresponding balanced fits are `0.575548` and `0.631411`. | + +### Next β€” wrong results in realistic configs + +| ID | Sev | Item | Effort | Status | +|---|---|---|---|---| +| OC-35 | 🟠 | Binary evaluation still builds a ROC curve when the held-out partition contains only one class, publishing NaN coordinates (`modeling/_evaluation/classification.py:88-94`) | small | ⬜ reopened 2026-09-12 β€” reproduced points `[(0.0, NaN), (0.3333, NaN), (1.0, NaN)]`; the previously fixed multiclass missing-class path remains fixed. | +| OC-46 | 🟑 | Constant numeric features still publish non-finite PCA explained-variance ratios in the public profile (`profiling/_analyzer/multivariate.py:161`, `profiling/schemas.py:PCAComponent`) | small | ⬜ reopened 2026-09-12 β€” ten identical rows with two constant features produce `[NaN, NaN]`; `json.dumps(profile.model_dump(mode="json"), allow_nan=False)` raises ValueError. | ### Then β€” decide deployment model first @@ -66,7 +84,6 @@ closed that on 2026-09-07. | OC-91 | 🟑 | Three public `core/` seams (263 lines) have zero call sites; one duplicates a differently-shaped backend class name | small | ⬜ open | | OC-111 | 🟑 | A profiling recommendation branch is unreachable | small | ⬜ open | | OC-102 | βšͺ | Five tunable models return an empty search space from the live `/defaults` endpoint (`hyperparameters/_registry.py`) | small | ⬜ open | -| OC-90 | βšͺ | Unknown split config keys silently dropped instead of rejected (`preprocessing/split.py`) | small | ⬜ open | ### Remaining β€” file-coverage closure @@ -87,19 +104,24 @@ closed that on 2026-09-07. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-254 | 🟑 | LabelEncoder fits supported NumPy/list targets but assumes native Series methods during apply (`preprocessing/encoding/label.py:69,113-115`) | small | ⬜ open β€” NumPy targets raise missing `.map` on pandas and missing `.clone` on Polars; lists fail on `.astype`/`.clone`, and Polars fails even for feature-only encoding. | ### Remaining β€” feature generation / selection / vectorization / transformations | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-256 | 🟑 | Feature-selection task inference treats pandas StringDtype/Categorical targets with more than ten classes as regression (`preprocessing/feature_selection/_common.py:54-69`) | small | ⬜ open β€” 11 labels repeated four times work as object dtype but make UnivariateSelection and ModelBasedSelection fail as string/category; explicit classification is a workaround. | ### Remaining β€” profiling (outside the OC-39–46 cluster) | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-192 | 🟑 | Decomposition's categorical null bucket displays as `Unknown`, but drilling into it filters for the literal string and silently loses the bucket's rows (`profiling/_analyzer/decomposition.py:71-76`) | small | ⬜ open | -| OC-47 | 🟑 | Common-column dtype drift can silently disappear (`profiling/drift.py:136-153`) | small | ⬜ open | +| OC-47 | 🟑 | Common-column dtype drift can silently disappear or be erased by a successful lossy cast to the reference dtype (`profiling/drift.py:192`) | small | ⬜ open β€” besides the original uncastable-to-null case, integer reference `[0]*50+[1]*50` against fractional current `[0.9]*50+[1.9]*50 reports all distances zero; a Float64 reference control detects drift with normalized Wasserstein `1.8`. | | OC-50 | 🟑 | Binary targets miss class-balance advice or flip to regression by sample size (`recommendations.py:147-152`) | small | ⬜ open | +| OC-257 | 🟑 | Native Enum columns bypass categorical drift dispatch and disappear from the report (`profiling/drift.py:154-162`) | small | ⬜ open β€” identical Enum dtypes with 100 `a` values replaced by 100 `b` values return zero drift and no column metrics; String controls detect PSI `10.54365`. | +| OC-258 | 🟑 | Decomposition grouping columns named `value` or `ratio` collide with generated aggregation fields (`profiling/_analyzer/decomposition.py:140-148`) | small | ⬜ open β€” `value` raises DuplicateError; `ratio` replaces category names and drill-down filter values with `0.5`; reproduced after the separate OC-192 missing-group repair. | +| OC-259 | 🟑 | Decimal columns are classified as Text and abort the entire EDA profile when batched string aggregates run (`profiling/_analyzer/_utils.py:64`, `profiling/analyzer.py:278`) | small | ⬜ open β€” a two-row Decimal amount column raises SchemaError from `str.len_bytes()`; Time/List columns hit the same unsupported-dtype fallback, while Float64 succeeds. | +| OC-260 | 🟑 | Time-series plotting builds unequal timestamp/value arrays when metrics have different missingness (`profiling/visualizer.py:823-827,846`) | small | ⬜ open β€” a native profile with 1000 timestamps and only 500 observed values for one metric makes public `EDAVisualizer.plot()` raise an x/y dimension mismatch. | ### Remaining β€” core / engines / pipeline @@ -108,17 +130,23 @@ closed that on 2026-09-07. |---|---|---|---|---| | OC-64 | 🟠 | **F-14 only partially fixed** β€” engine registry global still an unlocked race (`engines/registry.py:60,86-91`) | small | ⬜ open | | OC-65 | 🟑 | polars `to_numpy()` zero-width "parity fix" does not achieve parity (`engines/polars_engine.py`) | small | ⬜ open | +| OC-261 | 🟑 | Pipeline fingerprints omit stored decision thresholds, allowing identical fingerprints for different predictions under the same `use_tuned_thresholds=True` call (`pipeline/_pipeline.py:695-701`) | small | ⬜ open β€” two copies of one fitted classifier learn positive thresholds `0.480392` and `0.519608`, disagree on four of eight predictions, and retain equal fingerprints. | +| OC-262 | 🟑 | Both dataframe wrappers recurse through missing `_df` during pickle/joblib restoration (`engines/pandas_engine.py:100-102`, `engines/polars_engine.py:121-123`) | small | ⬜ open β€” Core's JoblibModelSerializer can dump either wrapper but loading it raises RecursionError; direct pickle round trips fail identically. | ### Remaining β€” outliers / casting / binning / timeseries / geo | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-255 | 🟑 | DateFeatures uses local offsets on pandas and UTC on Polars; mixed DST offsets make the pandas `.dt` access fail (`preprocessing/time_series/date_features.py:64-66,106-109`) | small | ⬜ open β€” identical `+02:00` strings produce different days/hours; mixed `+02:00`/`+03:00` strings raise AttributeError on pandas, so choose and enforce one timezone contract. | +| OC-263 | 🟑 | Haversine roundoff can put the intermediate outside `[0,1]`, producing NaN for valid antipodal coordinates on both engines (`preprocessing/geo/distance.py:53-54,108-109`) | small | ⬜ open β€” `(-89.91000888888888,0)` to `(89.91000888888888,180)` returns NaN instead of approximately `20015.114442 km`. | ### Remaining β€” modeling / tuning | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-187 | 🟑 | LightGBM's advertised `subsample` control and default search dimension have no effect: both calculators retain native `subsample_freq=0`, disabling row bagging (`modeling/hyperparameters/_tree.py:576`, `_registry.py:298,309`; `classification.py:754`, `regression.py:547`) | small | ⬜ open | +| OC-251 | 🟑 | Fold-aware Halving/Optuna scoring keeps original validation labels after preprocessing filters prediction rows (`modeling/_tuning/fold_pipeline.py:168-171`) | medium | ⬜ open β€” IQR yields 120 held-out labels / 110 predictions; actual halving_grid and Optuna searches fail all trials while grid scores the same chain at R2 `0.999998`. | +| OC-252 | 🟑 | Weighted PR-AUC tuning derives its class axis from the holdout instead of the trained model (`modeling/_tuning/metrics.py:84-90`) | small | ⬜ open β€” a three-class model and two-class holdout produce a 40-by-3 probability/target mismatch and fail all trials; model-class-aligned average precision succeeds at `1.0`. | +| OC-253 | 🟑 | F1 tuning and evaluation/threshold tuning disagree on the positive class for labels `{1,2}` (`modeling/_tuning/metrics.py:235`, `modeling/_evaluation/classification.py:84`) | decision + small | ⬜ open β€” the same predictions score `0.909091` for class 1 in tuning and `0.8` for class 2 in evaluation; reconcile the documented stock-scorer exception with a shared positive-class contract. | ### Remaining β€” frontend @@ -360,25 +388,3 @@ reproduced `count` through public clustering evaluation. **Fix/verification target:** choose independent collision-safe names for cluster, reference and count columns. OC-161 concerns centroid features; this is the separate reference-label aggregation path. - -**OC-192 β€” categorical null drill-down loses the selected group.** With -`group=['a',None,'b']` and `v=[1,2,3]`, a decomposition sum split publishes an -`Unknown` bucket valued **2**. Applying -`{'column':'group','operator':'==','value':'Unknown'}` returns a total of -**0**. Only numeric columns recognize the null sentinel. -**Fix/verification target:** preserve null identity across split output and -filter input for every dtype, including genuine literal `Unknown` values. - -**OC-187 β€” LightGBM row-subsampling control is inert.** Executed both public -`LGBMRegressorCalculator.fit` and `LGBMClassifierCalculator.fit` on 300-row, -6-feature sklearn generated datasets (`random_state=7`). With 20 trees, one -worker and seed 7, changing only `subsample` from 1.0 to 0.4 produced exactly -identical predictions/probabilities (maximum difference **0.0**). Setting -`subsample_freq=1` as a control produced maximum differences **85.66120232221425** -for regression and **0.16583687788133306** for classification. The metadata -exposes `subsample` but no frequency control; the default search proposes -`[0.6, 0.8, 1.0]` while the estimator frequency remains zero. This silently -ignores a requested regularization setting and wastes trials on equivalent -models. **Fix/verification target:** define and expose the bagging activation -policy for supported boosting modes, and verify a selected fraction changes -the fitted model when bagging is enabled. No implementation change made. diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 5090a3ef5..e9e64a18a 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -114,7 +114,6 @@ uses, so a fixed finding stays where it was filed. | OC-16 | 🟠 | KNN/Iterative imputers crash on all-missing fitted columns (`imputation/knn.py:64-76`, `iterative.py:68-84`) | small | βœ… fixed 2026-09-04 | | OC-17 | 🟠 | SimpleImputer polars mean/median crashes on all-null columns (engine divergence, `imputation/_common.py:32-37`) | small | βœ… fixed 2026-09-04 | | OC-69 | 🟠 | Engine trusts `config.nodes` list order, never verifies topological sort (`_schema_graph.py:49-70`); `_kahn_topological_order` already exists β€” wiring fix | small | βœ… fixed 2026-09-04 | -| OC-35 | 🟠 | Multiclass splits missing a class emit binary-only metrics + null curve points (`metrics.py:217-237,361-363`) | small | βœ… fixed 2026-09-04 | | OC-36 | 🟠 | F1 threshold tuning picks pathological threshold on single-class validation (`thresholds.py:101-111`) | small | βœ… fixed 2026-09-05 | | OC-39 | 🟠 | NaN-bearing numeric columns publish `nan` stats and leak non-finite JSON (`profiling/analyzer.py:215-224`) | small | βœ… fixed 2026-09-05 | | OC-40 | 🟠 | PCA/clustering "mean imputation" actually replaces NaN with `0.0` (`multivariate.py:46-60`) | small | βœ… fixed 2026-09-05 | @@ -123,7 +122,6 @@ uses, so a fixed finding stays where it was filed. | OC-43 | 🟠 | Correlation drops valid columns/rows instead of the defined missing-data policy (`correlations.py:41-44,100-110`) | small | βœ… fixed 2026-09-05 | | OC-44 | 🟠 | Wasserstein drift thresholds normalized value but reports raw one (`drift.py:181-195`) | small | βœ… fixed 2026-09-05 | | OC-45 | 🟠 | Schema drift computed but never counted or rendered as drift (`drift.py:76-98`) | small | βœ… fixed 2026-09-05 | -| OC-46 | 🟑 | Non-finite floats reach public payloads; only stdlib-json paths emit invalid JSON (`schemas.py:7-17,263-302`) | small | βœ… fixed 2026-09-05 | ### Ongoing β€” remove the hiding conditions @@ -184,6 +182,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-90 | βšͺ | Unknown split config keys silently dropped (`preprocessing/split.py`) | small | βœ… fixed 2026-09-12 β€” warn once about ignored public keys and list supported settings, preserving existing split semantics and quiet routing metadata; Canvas emits only supported settings. | | OC-101 | 🟑 | `calibrated_classifier`'s `random_state` is dropped and its factories hardcode the seed | small | βœ… fixed 2026-09-12 β€” a cloneable calibration wrapper seeds supported base estimators during training, tuning and final refitting; defaults, explicit 0/None, unshuffled integer CV and saved predictions are covered. | | OC-121 | βšͺ | Polars Enum columns omitted by text auto-selection, unlike pandas Categorical (`preprocessing/_helpers.py`) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Enum dtypes in the shared selector; TextCleaning and AliasReplacement now include them while preserving nulls, explicit selections and replay behavior. | | OC-120 | 🟠 | Decimal columns skipped by numeric auto-selection and mishandled during explicit numeric processing (`utils.py`, `preprocessing/_helpers.py` and numeric nodes) | small | βœ… fixed 2026-09-12 β€” recognize parameterized Polars and pandas object Decimals, normalize selected values at numeric boundaries, and preserve missingness, source values and target alignment. | @@ -249,6 +248,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-192 | 🟑 | Decomposition's categorical null bucket loses rows when drilled into (`profiling/_analyzer/decomposition.py`) | small | βœ… fixed 2026-09-12 β€” preserve nullable group identity through response/filter payloads and tree navigation, keeping actual `Unknown` categories separate. | | OC-48 | 🟑 | Expectations pass vacuously on empty frames (`profiling/expect.py`) | small | βœ… fixed 2026-09-12 β€” require at least one row by default in null/range/uniqueness checks, with explicit `allow_empty=True`, preserved schema validation and safe all-null range checks. | | OC-51 | 🟑 | Transform advice can be mathematically invalid and contradict the clean-dataset message | small | βœ… fixed 2026-09-12 β€” use domain/skew-aware transform advice and evaluate all preparation recommendations, including target resampling, before emitting a limited clean-dataset message. | | OC-247 | 🟑 | Missing categorical values inflate unique/rare-label counts and consume a top-10 frequency slot (`profiling/analyzer.py`, `_analyzer/categorical.py`) | small | βœ… filed and fixed 2026-09-12 β€” exclude nulls before frequency ranking and rare-label aggregation, and remove the null entry from the distinct-label count. | @@ -302,6 +302,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-187 | 🟑 | LightGBM's subsample control and search dimension have no effect with default frequency zero | small | βœ… fixed 2026-09-12 β€” resolve automatic bagging after candidate parameters, enabling ordinary row sampling while preserving GOSS, explicit frequencies, native aliases and existing artifacts. | | OC-218 | 🟑 | Connected model CV seed `0` is replaced by the existing ensemble seed during frontend settings synchronization | small | βœ… fixed 2026-09-09 - explicit zero now survives synchronization and both fixed/tuned request conversion; missing seeds retain the ensemble default. | | OC-206 | βšͺ | Ensemble configuration resolution shallow-copies nested base-model parameters, so fitting mutates the caller's configuration (`modeling/ensemble.py:473,484`) | small | βœ… fixed 2026-09-09 - inner base-model parameter maps are copied before temporary overrides, preserving caller settings and later refits. | | OC-204 | 🟑 | `fit_predict` drops an embedded target during training but keeps it in held-out tuple features when explicit y is also supplied, causing prediction to fail (`modeling/base.py:317-324`) | small | βœ… fixed 2026-09-09 - held-out tuples use training target extraction, excluding embedded targets while preserving explicit-y precedence. | @@ -412,6 +413,204 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-248–263 filed; OC-35/46 reopened and OC-47 extended + +At the user's request, recorded the preceding read-only Core review in the +[live queue](opus_core_analysis-open_queue.md). The review inventoried 190 Python +files and covered all main module groups, with deeper execution checks on +preprocessing, modeling/tuning, evaluation, profiling and pipeline/engine seams. +H3, sentence embedding, some model defaults and several tuning internals received +more limited inspection; this was not a line-by-line certification of every file. + +**Filing:** sixteen new findings, OC-248–263 (3 🟠 / 13 🟑), two reopened IDs, +and additional evidence on already-open OC-47. Open rows for OC-35/46 move back +out of this archive; their earlier fix entries remain intact. The current +OC-90/187/192 repairs remain closed. Counts change from **22 open / 4 parked** +to **40 open / 4 parked**, excluding R1 and DRIFT-01 planning work. No +implementation, regression-test or release-note changes belong to this filing. + +All findings below were reproduced by executing inline Python against the +working source with `.venv/Scripts/python.exe`; no model downloads were needed. +The queue rows retain the affected files, current scope, effort and status. + +- **OC-248 β€” merged branch alignment:** use times `[3,1,2]`, values + `[30,10,20]`, targets `[300,100,200]`, one sorted LagFeatures/RollingAggregate + branch and one StandardScaler branch. Merged times remain `[3,1,2]` but the + first branch supplies sorted targets `[100,200,300]`. Index resets discard + observation identity. LagFeatures with `drop_na=True` and ManualBounds also + evade the unsafe-branch screen and yield unequal feature/target counts. + Individual applier alignment repairs in OC-163/165 remain valid. +- **OC-249 β€” threshold label alignment:** fit LogisticRegression with `C=0.001` + on times/values `0..19`, targets ten zeros then ten ones, after RollingAggregate + with window 2, `min_periods=1`, sorted by time. Tune on reversed times `13..6` + and labels four ones then four zeros. The public method uses unsorted labels + against sorted probabilities and selects `0.411765`; explicitly aligning the + labels selects `0.5`. Tuned predictions become eight ones instead of four + zeros then four ones in output order. +- **OC-250 β€” ignored class weights:** generate 200 classification rows with five + features, three informative, 90/10 class weights, no label noise and seed 17. + Compare direct plain/balanced fits with single-candidate grid tuning using + ten trees, depth 2, seed 7 and two folds. GradientBoosting's tuned probabilities + differ from the plain fit by exactly zero and from the balanced fit by up to + `0.5755483623828201`; XGBoost controls give zero and `0.63141084` respectively. + The result still lists `class_weight="balanced"`. Candidate construction and + final refit bypass the calculator's sample-weight conversion. +- **OC-251 β€” filtered fold scoring:** repeat `[0,1,2,3,4,5,6,7,8,9,10,100]` ten + times as feature x, with target `2*x+1`, and use an IQR fold adapter. Ridge + tuning with alpha 1, three folds and R2 succeeds under grid at + `0.9999981339595826`; halving_grid and Optuna fail all trials. The fitted + FoldAwareModelStep returns 110 predictions for 120 labels; its prediction + path transforms X without carrying the scorer's y through the filter. +- **OC-252 β€” holdout PR-AUC classes:** fit a three-class logistic model on + x=`0..59` and 20 observations per class, then use the first 40 rows as explicit + validation data with `metric="pr_auc_weighted"`. Three probability columns + meet a target binarized from only the two observed holdout classes, failing + all trials. Binarizing against the model's classes succeeds with weighted + average precision `1.0`; the tuning scorer needs that class axis. +- **OC-253 β€” F1 positive-class consistency:** train on x=`0..39`, class 1 for + the first 30 rows and class 2 for the remainder. Holdout x values + `[0,10,20,25,29,30,35,39]` with labels `[1,1,1,1,1,2,1,2]` give tuning F1 + `0.9090909090909091`, matching `pos_label=1`; `pos_label=2` gives `0.8`. + Evaluation and threshold tuning use the latter class. The tuning exception + that retains sklearn's default when label 1 exists is documented, so agree + on the common contract before changing it. +- **OC-254 β€” LabelEncoder target containers:** fit/apply `(X, y)` with three + numeric feature rows and NumPy or list labels such as `["yes","no","yes"]`. + Fit accepts them; pandas apply assumes `.astype(...).map(...)` and Polars + apply assumes `.clone()`. Polars clones y even when only features are encoded. +- **OC-255 β€” timezone/DST extraction:** the same `+02:00` ISO timestamps yield + local day/hour features on pandas and UTC features on Polars. A two-row + sample across `2024-03-30T12:00:00+02:00` and + `2024-03-31T12:00:00+03:00` raises pandas' non-datetimelike `.dt` error; + Polars succeeds. Pick a shared timezone policy and cover mixed offsets. +- **OC-256 β€” categorical selector inference:** repeat 11 string class labels + four times and run UnivariateSelection/ModelBasedSelection with automatic + problem type. Object labels work, but pandas StringDtype/Categorical labels + enter regression and fail with division/conversion errors. Explicit + `problem_type="classification"` avoids the faulty inference. +- **OC-257 β€” Enum drift:** an Enum with allowed labels a/b changes from 100 a + observations to 100 b observations. Both inputs keep the same dtype, yet + the report has zero drift and no column metrics. String controls report + categorical PSI `10.543651559430593`; this is not OC-47's dtype-change case. +- **OC-258 β€” decomposition aliases:** group `["a","a","b"]` and sum amounts + `[1,2,3]`. A grouping column named `value` raises DuplicateError, while + `ratio` overwrites both names and drill-down filter values with `0.5`. + A grouping column named `group` works. Reread and reproduced against the + concurrent OC-192 missing-group repair; its null-identity fix remains valid. +- **OC-259 β€” unsupported dtype fallback:** public EDA analysis of a two-row + Decimal amount column raises SchemaError when the fallback Text path applies + `str.len_bytes()`. Time/List columns hit the same path; Float64 controls work. + The earlier Null/Enum semantic-type repair in OC-191 does not cover these. +- **OC-260 β€” time-series plot alignment:** analyze 1000 hourly timestamps, one + complete metric and another with only its first 500 values present. Native + profile construction succeeds, but public `EDAVisualizer.plot()` raises an + x/y mismatch for shapes `(1000,)` and `(500,)`. Every date is appended while + missing metric values are omitted. This differs from OC-193's missing dates. +- **OC-261 β€” fingerprint thresholds:** copy one fitted logistic pipeline twice + and optimize against two different labelings of the same eight validation + features. Stored positive thresholds `0.480392` and `0.519608` produce + different predictions on four rows under `use_tuned_thresholds=True`, but + fingerprints stay equal because the stored thresholds are not hashed. +- **OC-262 β€” wrapper restoration:** wrap a two-row pandas or Polars frame with + EngineRegistry, dump through JoblibModelSerializer and load it again. Both + raise RecursionError through `__getattr__` before `_df` exists. Direct + `pickle.loads(pickle.dumps(wrapper))` reproduces the same failure; this + evidence concerns dataframe wrappers, not every saved model. +- **OC-263 β€” antipodal distance:** both engines return NaN for the valid points + `(-89.91000888888888,0)` and `(89.91000888888888,180)`, instead of the mean-Earth + half-circumference `20015.114442035923 km`. Haversine roundoff makes the + intermediate slightly greater than one before `sqrt(1-a)`. + +**Existing IDs with current evidence:** + +- **OC-35 reopened:** the binary model from OC-253 evaluated on the first three + holdout rows sees only class 1 and publishes ROC coordinates + `[(0.0, NaN), (0.3333333333333333, NaN), (1.0, NaN)]`. The multiclass guard + repaired in the earlier entry does not protect this binary path. +- **OC-46 reopened:** public analysis of ten rows with x=1 and z=2 publishes + PCA explained-variance ratios `[NaN, NaN]`. + `json.dumps(profile.model_dump(mode="json"), allow_nan=False)` raises + ValueError. Preserve earlier finite-value repairs and cover PCA output too. +- **OC-47 extended:** reference integers `[0]*50+[1]*50` versus current floats + `[0.9]*50+[1.9]*50` report zero distances and zero drift. Casting current + values to the integer reference loses their fractional parts. Keeping the + reference Float64 yields drift with normalized Wasserstein `1.8`. This + supplements the original all-null-after-casting disappearance in the same ID. + +**Verification from the preceding audit, not a new full-suite run for this +documentation update:** Core pytest returned **7796 passed / 80 skipped / +1 failed**, with three snapshots passing. The single failing test, +`test_patch_coverage_core_round5.py::TestBalanceRecommendationDirections::test_skewness_threshold_both_directions`, +also failed in isolation: its SimpleNamespace fixture lacks `min` and other +NumericStats fields used by the updated skewness recommendation. A real +ColumnProfile/NumericStats payload succeeds, so record this as a test-maintenance +follow-up rather than another demonstrated product bug. Current decomposition +missing-group tests passed **12/12**, and Core Ruff/Ty checks passed. Inline +reproductions establish the findings above independently of those green gates. + +### 2026-09-12 β€” OC-90/187/192: split warnings, LightGBM sampling and missing-group navigation + +Continued the unparked queue after signed commit `81f35f07` closed the preceding +OC-18/30/48 batch. Each repair began with a public-path reproduction and checked +the actual Canvas payload before editing another layer. + +- **OC-90:** a node config using `stratify_col="target"` silently dropped that + key. With 200 rows, 20% positives, 20% test/validation and seed 42, both + engines produced class proportions `[0.2, 0.175, 0.225]`; the supported + `stratify=True` setting produced `[0.2, 0.2, 0.2]`. The source audit explicitly + recommended a warning, so fitting now names ignored public keys and lists + the six supported settings without changing the artifact or splitting + behavior. `type` and private underscore-prefixed routing metadata remain + quiet. The current Canvas serializer also forwarded `definitionType`, + labels and titles; it now selects the six supported fields before shared + routing metadata is attached. **Eight Core regressions and two frontend + payload tests failed before the fix**; all ten Core cases and both frontend + cases pass afterward. +- **OC-187:** reproduced the original 300-row, six-feature, seed-7 LightGBM + case with 20 trees and one worker. Changing `subsample` from 1.0 to 0.4 + produced identical predictions; explicit frequency 1 produced differences + of **0.16583687788133306** for classifier probabilities and + **85.66120232221425** for regression. Grid-search scores were also identical + before repair. A blanket frequency of 1 breaks GOSS, so new estimator + subclasses resolve the automatic `None` frequency at the native parameter + handoff: 1 for ordinary bagging, 0 for effective GOSS. Constructor state stays + unchanged across clone/set_params, and explicit frequencies/native aliases + keep LightGBM's precedence. Uppercase GOSS values are supported too. Native + missing-feature support remains admitted by the tuning validator; imports + still succeed with LightGBM unavailable. **56 regressions** cover both model + tasks, all five search strategies, default-space boosting modes, actual + training effects, final refit, explicit overrides, cloning and saved models. + Existing fitted models retain predictions; retrain to apply previously + ignored fractions, or use explicit frequency 0 to keep the old policy. +- **OC-192:** the original `group=['a', None, 'b']`, `v=[1,2,3]` sum split + displayed an `Unknown` bucket worth 2, but filtering `group == 'Unknown'` + returned 0. Further reproduction showed missing rows and a literal + `Unknown` category merging to 9 rather than separate groups worth 6 and 3. + Grouped results now retain null identity in an additive `filter_value` + field; `== null` / `!= null` select/exclude missing rows. The tree uses this + identity for requests, selection, connection anchors and cached navigation, + labels missing groups explicitly, and falls back to names for older rows. + Numeric legacy `Unknown` filtering and float-NaN normalization remain. + Nullable filters are scoped to decomposition; other EDA filter contracts + stay unchanged. **Nine Core cases and the UI regression failed before repair**; + real HTTP and browser roundtrips now preserve distinct null/string values. + +Validation: split/schema/pipeline/leakage/decomposition Core suites passed +**1,313 tests** (two existing skips); modeling/tuning suites passed **308 tests**. +Separate backend split, EDA HTTP, schema-preview and graph-leakage suites passed +**68 tests**. Full Vitest passed **2,493 tests in 193 files**; after the build +caught an unsupported test-query option and an overly broad nullable filter +type, the corrected decomposition/sidebar selection passed **17 tests** and +TypeScript passed. Desktop/mobile Playwright passed **2 tests**, including +keyboard Enter activation, selected-state distinction and real JSON request +inspection. Full frontend lint and CCN gates, full-repository Ruff, configured +ty, Python formatting, frontend production build and bundle-size gates passed. +Generated `static/ml_canvas` assets, reference/API docs and changelog are updated. +Independent reviews found no actionable blockers. Existing dependency/legacy +alias warnings remain; no parked work was resumed. + +The queue now has **22 open / 4 parked**; OC-71/72/73/185 stay parked. + ### 2026-09-12 β€” OC-18/30/48: generated names, datetime outputs and empty-data checks Continued the unparked queue after signed commit `7947d5af`; the calibrated diff --git a/initiatives/analysis/opus_core_analysis/12-splitters.md b/initiatives/analysis/opus_core_analysis/12-splitters.md index 23868eb0a..ef83cf6d0 100644 --- a/initiatives/analysis/opus_core_analysis/12-splitters.md +++ b/initiatives/analysis/opus_core_analysis/12-splitters.md @@ -26,6 +26,15 @@ is filed. New ids continue from the master at **OC-90**. ### OC-90 ### βšͺ Low β€” Unrecognised split config keys are silently dropped +**Fixed 2026-09-12:** fitting now logs one warning naming unknown public +configuration keys and listing the supported settings. The existing +ignore-unknown behavior and artifact shape remain compatible; `type` and +private underscore-prefixed metadata are quiet. Canvas now serializes the six +supported settings without editor labels/identifiers, then adds its existing +routing metadata. Public direct/pipeline regressions cover both engines and +preserve the old row partitioning while making mistyped settings visible. +The source recommendation below was implemented as a warning, not rejection. + **File:** `skyulf-core/skyulf/preprocessing/split.py:174-183` `SplitCalculator.fit` copies a fixed whitelist into the artifact: diff --git a/skyulf-core/skyulf/modeling/_lightgbm.py b/skyulf-core/skyulf/modeling/_lightgbm.py new file mode 100644 index 000000000..1d8cb6404 --- /dev/null +++ b/skyulf-core/skyulf/modeling/_lightgbm.py @@ -0,0 +1,33 @@ +"""Resolve Skyulf's automatic LightGBM sampling policy at the native boundary.""" + +from typing import Any + + +def resolve_sampling_frequency(params: dict[str, Any]) -> dict[str, Any]: + """Enable automatic bagging outside GOSS while preserving explicit frequencies. + + ``None`` marks Skyulf's automatic frequency. Resolve it after candidate + ``set_params`` calls, without changing estimator constructor state. GOSS + uses gradient sampling and rejects ordinary row bagging. Native alias + precedence decides the effective boosting mode and any explicit frequency. + """ + if params.get("subsample_freq") is not None: + return params + + if params.get("bagging_freq") is not None: + params.pop("subsample_freq", None) + return params + + from lightgbm.basic import ( # ty: ignore[unresolved-import] # noqa: PLC0415 - optional boosting extra + _ConfigAliases, + ) + + boosting = next( + (params[name] for name in _ConfigAliases.get_sorted("boosting") if name in params), + "gbdt", + ) + is_goss = ( + str(boosting).lower() == "goss" or str(params.get("data_sample_strategy")).lower() == "goss" + ) + params["subsample_freq"] = 0 if is_goss else 1 + return params diff --git a/skyulf-core/skyulf/modeling/_tuning/engine.py b/skyulf-core/skyulf/modeling/_tuning/engine.py index 430c8fd57..259df05b7 100644 --- a/skyulf-core/skyulf/modeling/_tuning/engine.py +++ b/skyulf-core/skyulf/modeling/_tuning/engine.py @@ -321,6 +321,8 @@ def _validate_no_nan_inf( "XGBRegressor", "LGBMClassifier", "LGBMRegressor", + "_SamplingLGBMClassifier", + "_SamplingLGBMRegressor", "HistGradientBoostingClassifier", "HistGradientBoostingRegressor", } diff --git a/skyulf-core/skyulf/modeling/classification.py b/skyulf-core/skyulf/modeling/classification.py index 4103d56c7..ee5847275 100644 --- a/skyulf-core/skyulf/modeling/classification.py +++ b/skyulf-core/skyulf/modeling/classification.py @@ -52,6 +52,7 @@ def warning(self, msg: str) -> None: from ..registry import NodeRegistry from ..types import DEFAULT_RANDOM_STATE from ._boosting_progress import LightGBMIterationAdapter, XgboostIterationAdapter +from ._lightgbm import resolve_sampling_frequency from ._sklearn_compat import normalize_logistic_regression_params from .sklearn_wrapper import SklearnApplier, SklearnCalculator @@ -741,6 +742,13 @@ def __init__(self): # --- LightGBM Classifier (optional) --- if LIGHTGBM_AVAILABLE: + class _SamplingLGBMClassifier(LGBMClassifier): + """Resolve automatic row sampling after tuning applies candidate parameters.""" + + def _process_params(self, stage: str) -> dict[str, Any]: + """Apply the sampling policy without mutating cloneable constructor state.""" + return resolve_sampling_frequency(super()._process_params(stage)) + class LGBMClassifierApplier(SklearnApplier): """LightGBM Classifier Applier. @@ -782,12 +790,14 @@ def __init__(self): ``max_depth=-1`` leaves depth unbounded, so ``num_leaves=31`` alone governs tree shape, and both subsampling rates and both L1/L2 - penalties start at their neutral values. ``verbose`` and + penalties start at their neutral values. Automatic ``subsample_freq`` + enables per-round bagging when the fraction is below one, except + for GOSS, which keeps its gradient sampling. ``verbose`` and ``verbosity`` are pinned to -1 to quiet LightGBM's native logging alongside the no-op logger registered at import time. """ super().__init__( - model_class=LGBMClassifier, + model_class=_SamplingLGBMClassifier, default_params={ "n_estimators": 100, "num_leaves": 31, @@ -795,6 +805,7 @@ def __init__(self): "max_depth": -1, "min_child_samples": 20, "subsample": 1.0, + "subsample_freq": None, "colsample_bytree": 1.0, "reg_alpha": 0.0, "reg_lambda": 0.0, diff --git a/skyulf-core/skyulf/modeling/hyperparameters/_tree.py b/skyulf-core/skyulf/modeling/hyperparameters/_tree.py index b68b3f1df..d1a02475d 100644 --- a/skyulf-core/skyulf/modeling/hyperparameters/_tree.py +++ b/skyulf-core/skyulf/modeling/hyperparameters/_tree.py @@ -582,7 +582,10 @@ min=0.1, max=1.0, step=0.1, - description="Fraction of training data sampled per iteration.", + description=( + "Fraction of training rows sampled each iteration for GBDT/DART. " + "GOSS uses gradient sampling instead." + ), ), HyperparameterField( name="colsample_bytree", diff --git a/skyulf-core/skyulf/modeling/regression.py b/skyulf-core/skyulf/modeling/regression.py index a14fc4037..3d0c39217 100644 --- a/skyulf-core/skyulf/modeling/regression.py +++ b/skyulf-core/skyulf/modeling/regression.py @@ -1,6 +1,7 @@ """Regression models.""" import warnings +from typing import Any from sklearn.ensemble import ( AdaBoostRegressor, @@ -45,6 +46,7 @@ def warning(self, msg: str) -> None: from ..core.meta.decorators import node_meta from ..registry import NodeRegistry from ._boosting_progress import LightGBMIterationAdapter, XgboostIterationAdapter +from ._lightgbm import resolve_sampling_frequency from .sklearn_wrapper import SklearnApplier, SklearnCalculator @@ -497,6 +499,13 @@ def __init__(self): # --- LightGBM Regressor (optional) --- if LIGHTGBM_AVAILABLE: + class _SamplingLGBMRegressor(LGBMRegressor): + """Resolve automatic row sampling after tuning applies candidate parameters.""" + + def _process_params(self, stage: str) -> dict[str, Any]: + """Apply the sampling policy without mutating cloneable constructor state.""" + return resolve_sampling_frequency(super()._process_params(stage)) + class LGBMRegressorApplier(SklearnApplier): """LightGBM Regressor Applier. @@ -532,12 +541,14 @@ def __init__(self): ``max_depth=-1`` leaves depth unbounded, so ``num_leaves=31`` alone governs tree shape, and both subsampling rates and both L1/L2 - penalties start at their neutral values. ``verbose`` and + penalties start at their neutral values. Automatic ``subsample_freq`` + enables per-round bagging when the fraction is below one, except + for GOSS, which keeps its gradient sampling. ``verbose`` and ``verbosity`` are pinned to -1 to quiet LightGBM's native logging alongside the no-op logger registered at import time. """ super().__init__( - model_class=LGBMRegressor, + model_class=_SamplingLGBMRegressor, default_params={ "n_estimators": 100, "num_leaves": 31, @@ -545,6 +556,7 @@ def __init__(self): "max_depth": -1, "min_child_samples": 20, "subsample": 1.0, + "subsample_freq": None, "colsample_bytree": 1.0, "reg_alpha": 0.0, "reg_lambda": 0.0, diff --git a/skyulf-core/skyulf/preprocessing/split.py b/skyulf-core/skyulf/preprocessing/split.py index 0e225d8a1..42284fa54 100644 --- a/skyulf-core/skyulf/preprocessing/split.py +++ b/skyulf-core/skyulf/preprocessing/split.py @@ -33,6 +33,15 @@ logger = logging.getLogger(__name__) +_SPLIT_CONFIG_KEYS = ( + "test_size", + "validation_size", + "random_state", + "shuffle", + "stratify", + "target_column", +) + # ----------------------------------------------------------------------------- # Engine-bridge helpers @@ -177,19 +186,28 @@ class SplitCalculator(BaseCalculator): def fit( self, df: pd.DataFrame | SkyulfDataFrame | tuple[Any, ...] | Any, config: dict[str, Any] ) -> SplitArtifact: - """Return a typed ``SplitArtifact`` holding the recognized split settings.""" + """Return a typed artifact and warn about ignored public configuration keys. + + ``type`` and underscore-prefixed routing metadata are ignored quietly. + Use ``stratify=True`` with ``target_column`` to request stratification; + ``stratify_col`` belongs to ``DataSplitter``, not this node's config. + """ # No learning from data; pass through known split params from config. # Constructed explicitly so the artifact shape matches SplitArtifact # rather than echoing arbitrary user keys back into the params dict. + unknown = sorted( + key + for key in config + if key not in _SPLIT_CONFIG_KEYS and key != "type" and not key.startswith("_") + ) + if unknown: + logger.warning( + "TrainTestSplitter ignored unrecognized config keys: %s. Supported keys: %s.", + unknown, + ", ".join(_SPLIT_CONFIG_KEYS), + ) artifact: SplitArtifact = {"type": "split"} - for key in ( - "test_size", - "validation_size", - "random_state", - "shuffle", - "stratify", - "target_column", - ): + for key in _SPLIT_CONFIG_KEYS: if key in config: artifact[key] = config[key] # type: ignore[literal-required] return artifact diff --git a/skyulf-core/skyulf/profiling/_analyzer/decomposition.py b/skyulf-core/skyulf/profiling/_analyzer/decomposition.py index 2dc1ee6d9..ac570dd3f 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/decomposition.py +++ b/skyulf-core/skyulf/profiling/_analyzer/decomposition.py @@ -45,8 +45,8 @@ def _apply_filter_operator( return filtered_df @staticmethod - def _filter_unknown_numeric(filtered_df: pl.DataFrame, col: str, op: str) -> pl.DataFrame: - """Filter a numeric column against the FE's "Unknown" (null) sentinel.""" + def _filter_missing(filtered_df: pl.DataFrame, col: str, op: str) -> pl.DataFrame: + """Select or exclude missing rows without comparing a display label.""" if op == "==": return filtered_df.filter(pl.col(col).is_null()) elif op == "!=": @@ -56,8 +56,8 @@ def _filter_unknown_numeric(filtered_df: pl.DataFrame, col: str, op: str) -> pl. def _apply_single_filter(self, filtered_df: pl.DataFrame, f: dict[str, Any]) -> pl.DataFrame: """Apply one filter dict to ``filtered_df``, with numeric-vs-string coercion. - FE serializes all filter values as strings, so numeric columns need - coercion, and "Unknown" is the FE's stand-in for nulls. + Numeric labels need coercion. A JSON null selects missing rows; older + clients can still use "Unknown" for numeric columns. """ col = f["column"] op = f["operator"] @@ -66,12 +66,15 @@ def _apply_single_filter(self, filtered_df: pl.DataFrame, f: dict[str, Any]) -> if col not in filtered_df.columns: return filtered_df + if val is None: + return self._filter_missing(filtered_df, col, op) + dtype = filtered_df.schema[col] is_numeric = dtype in self._NUMERIC_DTYPES if is_numeric and isinstance(val, str): if val == "Unknown": - return self._filter_unknown_numeric(filtered_df, col, op) + return self._filter_missing(filtered_df, col, op) val = self._coerce_filter_value(dtype, val) col_expr = ( @@ -137,7 +140,7 @@ def _aggregate_grouped( return temp_df.group_by(split_col).agg(value_expr.alias("value")) def _rows_to_split_result(self, agg_df: pl.DataFrame, split_col: str) -> list[dict[str, Any]]: - """Add a normalized "ratio" column to ``agg_df`` and convert it to result dicts.""" + """Format labels and ratios while retaining nullable group values for filtering.""" total_val = agg_df["value"].sum() if total_val == 0 or total_val is None: result_df = agg_df.with_columns(pl.lit(0.0).alias("ratio")) @@ -148,7 +151,8 @@ def _rows_to_split_result(self, agg_df: pl.DataFrame, split_col: str) -> list[di return [ { - "name": str(row[split_col]), + "name": row[split_col] if row[split_col] is not None else "Unknown", + "filter_value": row[split_col], "value": row["value"] if row["value"] is not None else 0, "ratio": row["ratio"] if row["ratio"] is not None else 0, } @@ -166,8 +170,8 @@ def _compute_grouped_split( if split_col not in filtered_df.columns: return [] - # Surface nulls as "Unknown" rather than dropping them. - temp_df = filtered_df.with_columns(pl.col(split_col).fill_null("Unknown").cast(pl.Utf8)) + # Keep nulls distinct from a real "Unknown" category until display formatting. + temp_df = filtered_df.with_columns(pl.col(split_col).cast(pl.Utf8)) agg_df = self._aggregate_grouped(temp_df, split_col, measure_col, measure_agg) if agg_df is None: @@ -182,7 +186,13 @@ def get_decomposition_split( split_col: str | None, filters: list[dict[str, Any]], ) -> list[dict[str, Any]]: - """Apply ``filters``, then aggregate ``measure_col`` either globally or split by ``split_col``.""" + """Filter rows and aggregate a measure globally or by the selected split column. + + Grouped results include a display ``name`` and a nullable ``filter_value``. + Use ``filter_value`` for subsequent equality filters: null selects missing + rows, while the string "Unknown" selects that literal category. Numeric + columns also accept the legacy "Unknown" missing-value filter. + """ # 1. Apply filters (with numeric-vs-string coercion since FE serializes everything as strings). filtered_df = self._apply_decomposition_filters(filters) diff --git a/skyulf-core/tests/integration/test_profiling_decomposition_missing.py b/skyulf-core/tests/integration/test_profiling_decomposition_missing.py new file mode 100644 index 000000000..623d11a0c --- /dev/null +++ b/skyulf-core/tests/integration/test_profiling_decomposition_missing.py @@ -0,0 +1,98 @@ +"""Decomposition drill-down must preserve missing groups across JSON round trips.""" + +import json +from datetime import date + +import polars as pl +import pytest + +from skyulf.profiling.analyzer import EDAAnalyzer + + +def test_missing_and_literal_unknown_groups_drill_down_independently() -> None: + """A display label must neither merge missing rows nor select the literal category.""" + analyzer = EDAAnalyzer( + pl.DataFrame({"group": ["a", None, "Unknown", None], "value": [1, 2, 3, 4]}) + ) + rows = json.loads(json.dumps(analyzer.get_decomposition_split("value", "sum", "group", []))) + assert len(rows) == 3 + unknown_rows = [row for row in rows if row["name"] == "Unknown"] + assert {row["filter_value"]: row["value"] for row in unknown_rows} == { + None: 6, + "Unknown": 3, + } + for row in rows: + result = analyzer.get_decomposition_split( + "value", + "sum", + None, + [{"column": "group", "operator": "==", "value": row["filter_value"]}], + ) + assert result == [{"name": "Total", "value": row["value"], "ratio": 1.0}] + assert sum(row["ratio"] for row in rows) == pytest.approx(1.0) + + +@pytest.mark.parametrize( + "group", + [ + pl.Series("group", ["a", None]), + pl.Series("group", ["a", None], dtype=pl.Categorical), + pl.Series("group", ["a", None], dtype=pl.Enum(["a"])), + pl.Series("group", [True, None]), + pl.Series("group", [1, None]), + pl.Series("group", [1.5, None]), + pl.Series("group", [date(2026, 1, 1), None]), + pl.Series("group", [None, None]), + ], + ids=["string", "categorical", "enum", "boolean", "integer", "float", "date", "null"], +) +def test_missing_group_round_trips_for_each_dtype(group: pl.Series) -> None: + """Missing-value filtering must work independently of the split column dtype.""" + analyzer = EDAAnalyzer(pl.DataFrame({"group": group, "value": [1, 2]})) + rows = analyzer.get_decomposition_split("value", "sum", "group", []) + missing = next(row for row in rows if row["name"] == "Unknown") + result = analyzer.get_decomposition_split( + "value", + "sum", + None, + [ + { + "column": "group", + "operator": "==", + "value": missing.get("filter_value", missing["name"]), + } + ], + ) + assert result == [{"name": "Total", "value": missing["value"], "ratio": 1.0}] + + +@pytest.mark.parametrize("operator, expected", [("==", 6), ("!=", 4)]) +def test_missing_numeric_filter_includes_normalized_nan(operator: str, expected: int) -> None: + """NaN shares the analyzer's missing bucket while numeric values stay separate.""" + analyzer = EDAAnalyzer( + pl.DataFrame({"group": [1.5, None, 2.0, float("nan")], "value": [1, 2, 3, 4]}) + ) + result = analyzer.get_decomposition_split( + "value", + "sum", + None, + [{"column": "group", "operator": operator, "value": None}], + ) + assert result == [{"name": "Total", "value": expected, "ratio": 1.0}] + + +def test_numeric_and_legacy_unknown_filters_keep_their_meaning() -> None: + """Adding a typed missing bucket must retain earlier numeric drill-down requests.""" + analyzer = EDAAnalyzer( + pl.DataFrame({"group": [1.5, None, 2.0, float("nan")], "value": [1, 2, 3, 4]}) + ) + rows = analyzer.get_decomposition_split("value", "sum", "group", []) + assert {row["name"]: row["value"] for row in rows} == {"1.5": 1, "2.0": 3, "Unknown": 6} + for value, expected in [("1.5", 1), ("Unknown", 6)]: + result = analyzer.get_decomposition_split( + "value", + "sum", + None, + [{"column": "group", "operator": "==", "value": value}], + ) + assert result == [{"name": "Total", "value": expected, "ratio": 1.0}] diff --git a/skyulf-core/tests/integration/test_split_config_warnings.py b/skyulf-core/tests/integration/test_split_config_warnings.py new file mode 100644 index 000000000..0735efda8 --- /dev/null +++ b/skyulf-core/tests/integration/test_split_config_warnings.py @@ -0,0 +1,102 @@ +"""Misspelled split settings must be visible without changing valid split behavior.""" + +import logging +from typing import Any + +import pandas as pd +import polars as pl +import pytest + +from skyulf.data.dataset import SplitDataset +from skyulf.preprocessing.pipeline import FeatureEngineer +from skyulf.preprocessing.split import SplitApplier, SplitCalculator + + +@pytest.fixture(params=["pandas", "polars"]) +def frame(request: pytest.FixtureRequest) -> Any: + """Use balanced enough data to separate configuration warnings from rare-class warnings.""" + data = {"feature": list(range(200)), "target": [0] * 160 + [1] * 40} + return pd.DataFrame(data) if request.param == "pandas" else pl.DataFrame(data) + + +@pytest.mark.parametrize( + "unknown", + [{"stratify_col": "target"}, {"validation_fraction": 0.2, "test_szie": 0.3}], +) +def test_unknown_split_config_keys_warn_without_leaking_values( + frame: Any, unknown: dict[str, Any], caplog: pytest.LogCaptureFixture +) -> None: + """A typo must produce one actionable warning while preserving the artifact contract.""" + config = {"test_size": 0.2, "random_state": 42, **unknown} + with caplog.at_level(logging.WARNING, logger="skyulf.preprocessing.split"): + params = SplitCalculator().fit(frame, config) + assert params == {"type": "split", "test_size": 0.2, "random_state": 42} + assert len(caplog.records) == 1 + assert str(sorted(unknown)) in caplog.text + assert "ignored unrecognized config keys" in caplog.text + assert "Supported keys" in caplog.text + assert "stratify" in caplog.text and "target_column" in caplog.text + assert config == {"test_size": 0.2, "random_state": 42, **unknown} + + +def test_split_config_warning_contains_names_only( + frame: Any, caplog: pytest.LogCaptureFixture +) -> None: + """Diagnostics need setting names, never arbitrary objects or values from the config.""" + value = "private-dataset-location" + SplitCalculator().fit(frame, {"stratify_col": value}) + assert "stratify_col" in caplog.text and value not in caplog.text + + +def test_supported_split_settings_and_reserved_metadata_are_quiet( + frame: Any, caplog: pytest.LogCaptureFixture +) -> None: + """Valid Canvas settings and private routing metadata must not create false warnings.""" + config = { + "test_size": 0.2, + "validation_size": 0.2, + "random_state": 42, + "shuffle": True, + "stratify": True, + "target_column": "target", + } + params = SplitCalculator().fit( + frame, + {**config, "type": "split", "_display_name": "Split", "_merge_strategy": "first_wins"}, + ) + result = SplitApplier().apply(frame, dict(params)) + assert params == {"type": "split", **config} + sizes = [] + for part in (result.train, result.test, result.validation): + assert isinstance(part, tuple) + features, target = part + assert isinstance(target, (pd.Series, pl.Series)) + sizes.append(len(features)) + assert target.mean() == pytest.approx(0.2) + assert sizes == [120, 40, 40] + assert not caplog.records + + +def test_pipeline_exposes_split_typo_warning_without_inventing_stratification( + frame: Any, caplog: pytest.LogCaptureFixture +) -> None: + """The real pipeline must surface the typo and retain existing split semantics.""" + config = { + "test_size": 0.2, + "validation_size": 0.2, + "random_state": 42, + "target_column": "target", + "stratify_col": "target", + } + pipeline = FeatureEngineer( + [{"name": "split", "transformer": "TrainTestSplitter", "params": config}] + ) + result, _ = pipeline.fit_transform(frame) + assert isinstance(result, SplitDataset) + assert "stratify_col" in caplog.text + assert "ignored unrecognized config keys" in caplog.text + assert [float(part[1].mean()) for part in (result.train, result.test, result.validation)] == [ + 0.2, + 0.175, + 0.225, + ] diff --git a/skyulf-core/tests/unit/test_lightgbm_subsampling.py b/skyulf-core/tests/unit/test_lightgbm_subsampling.py new file mode 100644 index 000000000..c32de50c1 --- /dev/null +++ b/skyulf-core/tests/unit/test_lightgbm_subsampling.py @@ -0,0 +1,236 @@ +"""LightGBM row sampling must affect direct fits and cloned tuning candidates.""" + +import pickle + +import numpy as np +import pandas as pd +import pytest +from sklearn.base import clone +from sklearn.datasets import make_classification, make_regression + +from skyulf.modeling import classification, regression +from skyulf.modeling._tuning.engine import TuningCalculator +from skyulf.modeling._tuning.schemas import TuningConfig +from skyulf.modeling.hyperparameters import get_default_search_space + +lgb = pytest.importorskip("lightgbm") + +pytestmark = pytest.mark.filterwarnings("ignore:.*valid feature names.*:UserWarning") + + +@pytest.fixture(params=["classification", "regression"]) +def lightgbm_case(request): + """Exercise identical sampling contracts for classification and regression.""" + if request.param == "classification": + calculator = classification.LGBMClassifierCalculator() + applier = classification.LGBMClassifierApplier() + native_class = lgb.LGBMClassifier + maker = make_classification + prediction = "predict_proba" + metric = "neg_log_loss" + else: + calculator = regression.LGBMRegressorCalculator() + applier = regression.LGBMRegressorApplier() + native_class = lgb.LGBMRegressor + maker = make_regression + prediction = "predict" + metric = "neg_mean_squared_error" + X, y = maker(n_samples=300, n_features=6, random_state=7) + params = {"n_estimators": 20, "n_jobs": 1, "random_state": 7} + return ( + calculator, + applier, + native_class, + pd.DataFrame(X), + pd.Series(y), + params, + prediction, + metric, + ) + + +@pytest.mark.parametrize("boosting_type", ["gbdt", "dart"]) +def test_lightgbm_subsample_changes_fitted_predictions(lightgbm_case, boosting_type): + """The advertised fraction must change fitted predictions in bagging-compatible modes.""" + calculator, _, _, X, y, params, prediction, _ = lightgbm_case + params = {**params, "boosting_type": boosting_type} + full = calculator.fit(X, y, {"params": {**params, "subsample": 1.0}}) + sampled = calculator.fit(X, y, {"params": {**params, "subsample": 0.4}}) + + assert not np.allclose(getattr(full, prediction)(X), getattr(sampled, prediction)(X)) + + +def test_lightgbm_subsample_changes_tuning_scores_and_refitted_predictions(lightgbm_case): + """Candidate cloning and final refits must retain sampling across all advertised modes.""" + calculator, _, _, X, y, params, prediction, metric = lightgbm_case + model_key = ( + "lgbm_classifier" if calculator.problem_type == "classification" else "lgbm_regressor" + ) + advertised_space = get_default_search_space(model_key) + search_space = { + **{key: [value] for key, value in params.items()}, + "boosting_type": advertised_space["boosting_type"], + "subsample": advertised_space["subsample"], + } + model, result = TuningCalculator(calculator).fit( + X, + y, + TuningConfig( + strategy="grid", metric=metric, cv_folds=2, random_state=7, search_space=search_space + ), + ) + scores = { + mode: [ + trial["score"] for trial in result.trials if trial["params"]["boosting_type"] == mode + ] + for mode in ["gbdt", "dart", "goss"] + } + assert len(result.trials) == 9 + assert all(len(values) == 3 and np.isfinite(values).all() for values in scores.values()) + assert not np.allclose(scores["gbdt"], scores["gbdt"][0]) + assert not np.allclose(scores["dart"], scores["dart"][0]) + np.testing.assert_allclose(scores["goss"], scores["goss"][0]) + direct = calculator.fit(X, y, {"params": result.best_params}) + np.testing.assert_allclose(getattr(model, prediction)(X), getattr(direct, prediction)(X)) + + +@pytest.mark.parametrize("strategy", ["grid", "random", "halving_grid", "halving_random", "optuna"]) +def test_lightgbm_tuning_refit_uses_sampled_rows(lightgbm_case, strategy): + """Every searcher must refit a selected sampling fraction with actual row bagging.""" + if strategy == "optuna": + pytest.importorskip("optuna") + calculator, _, native_class, X, y, params, prediction, metric = lightgbm_case + params = {**params, "subsample": 0.4} + model, _ = TuningCalculator(calculator).fit( + X, + y, + TuningConfig( + strategy=strategy, + n_trials=1, + metric=metric, + cv_folds=2, + random_state=7, + search_space={key: [value] for key, value in params.items()}, + ), + ) + native = native_class(**params, subsample_freq=1, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + + np.testing.assert_allclose(getattr(model, prediction)(X), getattr(native, prediction)(X)) + + +@pytest.mark.parametrize( + "frequency", + [ + {"subsample_freq": 0}, + {"bagging_freq": 0}, + {"subsample_freq": 3}, + {"bagging_freq": 3}, + {"subsample_freq": 1, "bagging_freq": 0}, + {"subsample_freq": 0, "bagging_freq": 3}, + ], +) +def test_lightgbm_explicit_sampling_frequency_matches_native_training(lightgbm_case, frequency): + """Explicit zero, positive frequencies, and the native alias must keep their semantics.""" + calculator, _, native_class, X, y, params, prediction, _ = lightgbm_case + params = {**params, "subsample": 0.4, **frequency} + actual = calculator.fit(X, y, {"params": params}) + native = native_class(**params, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + + np.testing.assert_allclose(getattr(actual, prediction)(X), getattr(native, prediction)(X)) + + +@pytest.mark.parametrize("frequency", [{"subsample_freq": 0}, {"bagging_freq": 0}]) +def test_lightgbm_tuning_preserves_explicit_disabled_bagging(lightgbm_case, frequency): + """Explicit disabled sampling must survive searcher parameter updates and final refit.""" + calculator, _, native_class, X, y, params, prediction, metric = lightgbm_case + params = {**params, "subsample": 0.4, **frequency} + model, _ = TuningCalculator(calculator).fit( + X, + y, + TuningConfig( + strategy="grid", + metric=metric, + cv_folds=2, + random_state=7, + search_space={key: [value] for key, value in params.items()}, + ), + ) + native = native_class(**params, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + + np.testing.assert_allclose(getattr(model, prediction)(X), getattr(native, prediction)(X)) + + +@pytest.mark.parametrize( + "goss_params", + [ + {"boosting_type": "goss"}, + {"boosting": "goss"}, + {"boost": "goss"}, + {"data_sample_strategy": "goss"}, + {"boosting_type": "GOSS"}, + {"boosting": "GOSS"}, + {"boost": "GOSS"}, + {"data_sample_strategy": "GOSS"}, + ], +) +def test_lightgbm_automatic_sampling_preserves_goss_training(lightgbm_case, goss_params): + """GOSS retains gradient sampling for canonical and alias configurations.""" + calculator, _, native_class, X, y, params, prediction, _ = lightgbm_case + params = {**params, "subsample": 0.4, **goss_params} + actual = calculator.fit(X, y, {"params": params}) + native = native_class(**params, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + + np.testing.assert_allclose(getattr(actual, prediction)(X), getattr(native, prediction)(X)) + + +def test_lightgbm_clone_can_switch_from_goss_to_bagging(lightgbm_case): + """A fitted GOSS candidate must not freeze the automatic frequency on later clones.""" + calculator, applier, native_class, X, y, params, prediction, _ = lightgbm_case + params = {**params, "subsample": 0.4} + goss = calculator.fit(X, y, {"params": {**params, "boosting_type": "goss"}}) + bagged = clone(goss).set_params(boosting_type="gbdt").fit(X.to_numpy(), y.to_numpy()) + restored = pickle.loads(pickle.dumps(bagged)) + native = native_class(**params, subsample_freq=1, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + + np.testing.assert_allclose( + getattr(applier, prediction)(X, restored), getattr(native, prediction)(X) + ) + + +def test_lightgbm_explicit_goss_bagging_conflict_is_not_silently_overridden(lightgbm_case): + """Automatic defaults must not erase an explicitly incompatible native frequency.""" + calculator, _, _, X, y, params, _, _ = lightgbm_case + params = {**params, "subsample": 0.4, "boosting_type": "goss", "subsample_freq": 1} + + with pytest.raises(lgb.basic.LightGBMError, match="Cannot use bagging in GOSS"): + calculator.fit(X, y, {"params": params}) + + +def test_lightgbm_sampling_preserves_tuning_with_missing_features(lightgbm_case): + """The sampling estimator must retain LightGBM's native missing-feature support.""" + calculator, _, _, X, y, params, prediction, metric = lightgbm_case + X.iloc[::5, 0] = np.nan + model, result = TuningCalculator(calculator).fit( + X, + y, + TuningConfig( + strategy="grid", + metric=metric, + cv_folds=2, + search_space={**{key: [value] for key, value in params.items()}, "subsample": [0.4]}, + ), + ) + + assert np.isfinite(result.best_score) + assert np.isfinite(getattr(model, prediction)(X)).all() + + +def test_lightgbm_legacy_fitted_artifact_preserves_predictions(lightgbm_case): + """Loading a previously fitted native estimator must not enable bagging retroactively.""" + _, applier, native_class, X, y, params, prediction, _ = lightgbm_case + legacy = native_class(**params, subsample=0.4, verbosity=-1).fit(X.to_numpy(), y.to_numpy()) + restored = pickle.loads(pickle.dumps(legacy)) + + np.testing.assert_allclose( + getattr(applier, prediction)(X, restored), getattr(legacy, prediction)(X) + ) diff --git a/static/ml_canvas/assets/AuditLogPage-Dyr3ReJ0.js b/static/ml_canvas/assets/AuditLogPage-DPVze77q.js similarity index 99% rename from static/ml_canvas/assets/AuditLogPage-Dyr3ReJ0.js rename to static/ml_canvas/assets/AuditLogPage-DPVze77q.js index 67821a238..218ada099 100644 --- a/static/ml_canvas/assets/AuditLogPage-Dyr3ReJ0.js +++ b/static/ml_canvas/assets/AuditLogPage-DPVze77q.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{A as H,k as O,l as U,t as q}from"./index-_bluKNvP.js";import{a as l,p as G,k as K,H as B,C as V,U as $,G as Y,q as C,M as z,s as I,t as J,u as Q,c as W,f as X}from"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const S=t=>String(t.id);function Z({actorFilter:t,kindFilter:r,fromTime:s,toTime:i}){return{...t!=="all"?{actor:t}:{},...r!=="all"?{kind:r}:{},...s?{createdAfter:s}:{},...i?{createdBefore:i}:{}}}function ee(t){if(!t)return null;const r=t.entries,s=new Set(r.map(o=>o.user_id!==null?`u${o.user_id}`:"anon"));let i=0,d=0,n=0;for(const o of r)i+=o.diff.nodes_added.length,d+=o.diff.nodes_removed.length,n+=o.diff.nodes_modified.length;return{saves:r.length,users:s.size,added:i,removed:d,modified:n}}function te(t,r,s,i){const{actorFilter:d,kindFilter:n,fromTime:o,toTime:x}=i,m=(t==null?void 0:t.entries)??[],y=d!=="all"||n!=="all"||o!==""||x!=="",h=(t==null?void 0:t.total)??0,u=(t==null?void 0:t.total_unfiltered)??0,g=m.length,p=`${s}`,a=t?y?`Showing ${g} of ${h} matching saves for ${r}. History total ${u}.`:`Showing ${g} of ${u} saves for ${r}.`:null,j=t?`Page limit ${p}. Newest first. Retention is not reported by the API. Filters are applied across the full history, not just this page.`:null,k=se(t,g,u,r,p);return{filteredEntries:m,historyScopeText:a,historyMetaText:j,emptyStateText:k}}function se(t,r,s,i,d){return t&&r===0?s===0?`No saves recorded for ${i} yet. The audit API shows the newest ${d} saves first, but this dataset currently has no history. Retention is not reported by the API.`:`No audit records match the current filters for ${i}. Filters were applied across all ${s} saves, so widening them is the only way to see more. Retention is not reported by the API.`:null}const re=[25,50,100,200],ae=({state:t})=>{const{actorFilter:r,setActorFilter:s,kindFilter:i,setKindFilter:d,fromTime:n,setFromTime:o,toTime:x,setToTime:m,limit:y,setLimit:h,data:u,actorOptions:g,kindOptions:p}=t;return e.jsxs("div",{className:"flex flex-wrap items-end gap-4 mb-4",children:[e.jsx(de,{state:t}),e.jsxs("div",{className:"min-w-[220px]",children:[e.jsx("label",{htmlFor:"audit-actor",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Actor"}),e.jsxs("select",{id:"audit-actor",value:r,onChange:a=>s(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All actors"}),g.userIds.map(a=>e.jsxs("option",{value:a,children:["user #",a]},a)),g.hasAnonymous&&e.jsx("option",{value:H,children:"anonymous"})]})]}),e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{htmlFor:"audit-kind",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Action kind"}),e.jsxs("select",{id:"audit-kind",value:i,onChange:a=>d(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All kinds"}),p.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-from",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"From time"}),e.jsx("input",{id:"audit-from",type:"datetime-local",value:n,onChange:a=>o(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-to",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"To time"}),e.jsx("input",{id:"audit-to",type:"datetime-local",value:x,onChange:a=>m(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Limit"}),e.jsx("div",{className:"inline-flex rounded border border-gray-300 dark:border-gray-600 overflow-hidden",children:re.map(a=>e.jsx("button",{type:"button",onClick:()=>h(a),className:`px-3 py-2 text-xs font-medium ${y===a?"bg-violet-500 text-white":"bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:a},a))})]})]})},de=({state:t})=>{const{datasets:r,datasetsLoading:s,datasetId:i,setDatasetId:d}=t;return e.jsxs("div",{className:"flex-1 min-w-[240px]",children:[e.jsx("label",{htmlFor:"audit-dataset",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Dataset"}),e.jsx("select",{id:"audit-dataset",value:i,onChange:n=>d(n.target.value),disabled:s||!r||r.length===0,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:!r||r.length===0?e.jsx("option",{value:"",children:s?"Loading…":"No datasets"}):r.map(n=>{const o=S(n),x=o.length>8?o.slice(0,8):o;return e.jsxs("option",{value:o,children:[n.name," (",x,")"]},o)})})]})},ie=t=>{try{return new Date(t).toLocaleString()}catch{return t}},w=({icon:t,label:r,count:s,tone:i})=>{if(s===0)return null;const d=i==="add"?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-900/20 dark:text-emerald-300 dark:border-emerald-800":i==="remove"?"bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-900/20 dark:text-rose-300 dark:border-rose-800":"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-900/20 dark:text-amber-300 dark:border-amber-800";return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border text-[11px] font-medium ${d}`,title:`${s} ${r}`,children:[t,s," ",r]})},A=({title:t,items:r,tone:s})=>{if(r.length===0)return null;const i=s==="add"?"text-emerald-600 dark:text-emerald-400":s==="remove"?"text-rose-600 dark:text-rose-400":"text-amber-600 dark:text-amber-400";return e.jsxs("div",{children:[e.jsxs("div",{className:`text-[11px] font-semibold uppercase tracking-wide mb-1 ${i}`,children:[t," (",r.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(d=>e.jsx("code",{className:"text-[11px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-mono",children:d},d))})]})},oe=({entry:t,isFirst:r})=>{const[s,i]=l.useState(!1),{diff:d}=t,n=d.nodes_added.length+d.nodes_removed.length+d.nodes_modified.length,o=r&&d.nodes_removed.length===0&&d.nodes_modified.length===0;return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>i(x=>!x),className:"w-full flex items-start gap-3 p-3 text-left hover:bg-gray-50 dark:hover:bg-slate-800/50 transition-colors",children:[e.jsx("div",{className:"pt-0.5 text-gray-400",children:s?e.jsx(G,{size:16}):e.jsx(K,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-mono text-gray-500 dark:text-gray-400",children:[e.jsx(B,{size:11}),"v",t.version_int]}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100 truncate",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold ${t.kind==="auto"?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-slate-700 dark:text-gray-300"}`,children:t.kind}),o&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300",children:"initial"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(V,{size:11}),ie(t.created_at)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{size:11}),t.user_id!==null?`user #${t.user_id}`:"anonymous"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Y,{size:11}),t.node_count," nodes / ",t.edge_count," edges"]})]}),t.note&&e.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300 italic truncate",children:["β€œ",t.note,"”"]}),!o&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[e.jsx(w,{icon:e.jsx(C,{size:10}),label:"added",count:d.nodes_added.length,tone:"add"}),e.jsx(w,{icon:e.jsx(z,{size:10}),label:"removed",count:d.nodes_removed.length,tone:"remove"}),e.jsx(w,{icon:e.jsx(I,{size:10}),label:"modified",count:d.nodes_modified.length,tone:"modify"}),n===0&&e.jsx("span",{className:"text-[11px] text-gray-400 italic",children:"no node-level changes"})]})]})]}),e.jsx(ne,{expanded:s,diff:d,totalChanged:n})]})},ne=({expanded:t,diff:r,totalChanged:s})=>e.jsx(e.Fragment,{children:t&&s>0&&e.jsxs("div",{className:"px-10 pb-3 pt-1 space-y-2 bg-gray-50/60 dark:bg-slate-900/40",children:[e.jsx(A,{title:"Added",items:r.nodes_added,tone:"add"}),e.jsx(A,{title:"Removed",items:r.nodes_removed,tone:"remove"}),e.jsx(A,{title:"Modified",items:r.nodes_modified,tone:"modify"})]})}),le=({state:t})=>{const{isLoading:r,datasetId:s,data:i,emptyStateText:d,filteredEntries:n}=t;return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading audit trail…"}):s?!i||i.entries.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):n.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):e.jsx("div",{children:n.map((o,x)=>e.jsx(oe,{entry:o,isFirst:x===n.length-1},o.id))}):e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Pick a dataset to view its save history."})})},ce=({summary:t})=>e.jsx(e.Fragment,{children:t&&t.saves>0&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3 mb-4",children:[e.jsx(f,{label:"Saves",value:t.saves,icon:e.jsx(J,{size:14})}),e.jsx(f,{label:"Users",value:t.users,icon:e.jsx($,{size:14})}),e.jsx(f,{label:"Nodes added",value:t.added,icon:e.jsx(C,{size:14}),tone:"add"}),e.jsx(f,{label:"Nodes removed",value:t.removed,icon:e.jsx(z,{size:14}),tone:"remove"}),e.jsx(f,{label:"Nodes modified",value:t.modified,icon:e.jsx(I,{size:14}),tone:"modify"})]})}),f=({label:t,value:r,icon:s,tone:i})=>{const d=i==="add"?"text-emerald-600 dark:text-emerald-400":i==="remove"?"text-rose-600 dark:text-rose-400":i==="modify"?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-200";return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400 font-medium",children:[s,t]}),e.jsx("div",{className:`mt-1 text-xl font-semibold ${d}`,children:r})]})};function xe(){const{data:t,isLoading:r}=O(),[s,i]=l.useState(""),[d,n]=l.useState(50),[o,x]=l.useState("all"),[m,y]=l.useState("all"),[h,u]=l.useState(""),[g,p]=l.useState(""),[a,j]=l.useState(null),[k,_]=l.useState(!1),[L,T]=l.useState(null);l.useEffect(()=>{if(!s&&t&&t.length>0){const c=t[0];c&&i(S(c))}},[t,s]);const v=l.useRef(0),N=l.useCallback(async()=>{if(!s)return;const c=++v.current;_(!0),T(null);try{const b=await U.audit(s,d,Z({actorFilter:o,kindFilter:m,fromTime:h,toTime:g}));if(c!==v.current)return;j(b)}catch(b){if(c!==v.current)return;const F=b.message||"Failed to load audit trail";T(F),q.error(F)}finally{c===v.current&&_(!1)}},[s,d,o,m,h,g]);l.useEffect(()=>{N()},[N]);const R=l.useMemo(()=>ee(a),[a]),P=l.useMemo(()=>{var c,b;return{hasAnonymous:((c=a==null?void 0:a.facets)==null?void 0:c.has_anonymous_actor)??!1,userIds:((b=a==null?void 0:a.facets)==null?void 0:b.actors)??[]}},[a]),D=l.useMemo(()=>{var c;return((c=a==null?void 0:a.facets)==null?void 0:c.kinds)??[]},[a]),M=l.useMemo(()=>{const c=t==null?void 0:t.find(b=>S(b)===s);return(c==null?void 0:c.name)??"this dataset"},[t,s]),E=te(a,M,d,{actorFilter:o,kindFilter:m,fromTime:h,toTime:g});return{datasets:t,datasetsLoading:r,datasetId:s,setDatasetId:i,limit:d,setLimit:n,actorFilter:o,setActorFilter:x,kindFilter:m,setKindFilter:y,fromTime:h,setFromTime:u,toTime:g,setToTime:p,data:a,isLoading:k,error:L,load:N,summary:R,actorOptions:P,kindOptions:D,...E}}const be=()=>{const t=xe(),{load:r,isLoading:s,datasetId:i,data:d,error:n,summary:o,historyScopeText:x,historyMetaText:m}=t;return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Q,{className:"w-6 h-6 text-violet-500"}),"Pipeline Audit Log"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Chronological history of canvas saves. Each entry shows who, when, and which nodes changed vs. the previous save."})]}),e.jsxs("button",{type:"button",onClick:()=>void r(),disabled:s||!i,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 disabled:opacity-50",children:[e.jsx(W,{className:`w-4 h-4 ${s?"animate-spin":""}`}),"Refresh"]})]}),e.jsx(ae,{state:t}),d&&e.jsx("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"Actor, action kind and time filters apply across the full history before the page limit."}),n&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(X,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:n})]}),e.jsx(ce,{summary:o}),e.jsx(le,{state:t}),x&&e.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400 text-center",children:[x," ",m]})]})};export{be as AuditLogPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{A as H,k as O,l as U,t as q}from"./index-BR7Y881F.js";import{a as l,p as G,k as K,H as B,C as V,U as $,G as Y,q as C,M as z,s as I,t as J,u as Q,c as W,f as X}from"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const S=t=>String(t.id);function Z({actorFilter:t,kindFilter:r,fromTime:s,toTime:i}){return{...t!=="all"?{actor:t}:{},...r!=="all"?{kind:r}:{},...s?{createdAfter:s}:{},...i?{createdBefore:i}:{}}}function ee(t){if(!t)return null;const r=t.entries,s=new Set(r.map(o=>o.user_id!==null?`u${o.user_id}`:"anon"));let i=0,d=0,n=0;for(const o of r)i+=o.diff.nodes_added.length,d+=o.diff.nodes_removed.length,n+=o.diff.nodes_modified.length;return{saves:r.length,users:s.size,added:i,removed:d,modified:n}}function te(t,r,s,i){const{actorFilter:d,kindFilter:n,fromTime:o,toTime:x}=i,m=(t==null?void 0:t.entries)??[],y=d!=="all"||n!=="all"||o!==""||x!=="",h=(t==null?void 0:t.total)??0,u=(t==null?void 0:t.total_unfiltered)??0,g=m.length,p=`${s}`,a=t?y?`Showing ${g} of ${h} matching saves for ${r}. History total ${u}.`:`Showing ${g} of ${u} saves for ${r}.`:null,j=t?`Page limit ${p}. Newest first. Retention is not reported by the API. Filters are applied across the full history, not just this page.`:null,k=se(t,g,u,r,p);return{filteredEntries:m,historyScopeText:a,historyMetaText:j,emptyStateText:k}}function se(t,r,s,i,d){return t&&r===0?s===0?`No saves recorded for ${i} yet. The audit API shows the newest ${d} saves first, but this dataset currently has no history. Retention is not reported by the API.`:`No audit records match the current filters for ${i}. Filters were applied across all ${s} saves, so widening them is the only way to see more. Retention is not reported by the API.`:null}const re=[25,50,100,200],ae=({state:t})=>{const{actorFilter:r,setActorFilter:s,kindFilter:i,setKindFilter:d,fromTime:n,setFromTime:o,toTime:x,setToTime:m,limit:y,setLimit:h,data:u,actorOptions:g,kindOptions:p}=t;return e.jsxs("div",{className:"flex flex-wrap items-end gap-4 mb-4",children:[e.jsx(de,{state:t}),e.jsxs("div",{className:"min-w-[220px]",children:[e.jsx("label",{htmlFor:"audit-actor",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Actor"}),e.jsxs("select",{id:"audit-actor",value:r,onChange:a=>s(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All actors"}),g.userIds.map(a=>e.jsxs("option",{value:a,children:["user #",a]},a)),g.hasAnonymous&&e.jsx("option",{value:H,children:"anonymous"})]})]}),e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{htmlFor:"audit-kind",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Action kind"}),e.jsxs("select",{id:"audit-kind",value:i,onChange:a=>d(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All kinds"}),p.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-from",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"From time"}),e.jsx("input",{id:"audit-from",type:"datetime-local",value:n,onChange:a=>o(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-to",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"To time"}),e.jsx("input",{id:"audit-to",type:"datetime-local",value:x,onChange:a=>m(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Limit"}),e.jsx("div",{className:"inline-flex rounded border border-gray-300 dark:border-gray-600 overflow-hidden",children:re.map(a=>e.jsx("button",{type:"button",onClick:()=>h(a),className:`px-3 py-2 text-xs font-medium ${y===a?"bg-violet-500 text-white":"bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:a},a))})]})]})},de=({state:t})=>{const{datasets:r,datasetsLoading:s,datasetId:i,setDatasetId:d}=t;return e.jsxs("div",{className:"flex-1 min-w-[240px]",children:[e.jsx("label",{htmlFor:"audit-dataset",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Dataset"}),e.jsx("select",{id:"audit-dataset",value:i,onChange:n=>d(n.target.value),disabled:s||!r||r.length===0,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:!r||r.length===0?e.jsx("option",{value:"",children:s?"Loading…":"No datasets"}):r.map(n=>{const o=S(n),x=o.length>8?o.slice(0,8):o;return e.jsxs("option",{value:o,children:[n.name," (",x,")"]},o)})})]})},ie=t=>{try{return new Date(t).toLocaleString()}catch{return t}},w=({icon:t,label:r,count:s,tone:i})=>{if(s===0)return null;const d=i==="add"?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-900/20 dark:text-emerald-300 dark:border-emerald-800":i==="remove"?"bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-900/20 dark:text-rose-300 dark:border-rose-800":"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-900/20 dark:text-amber-300 dark:border-amber-800";return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border text-[11px] font-medium ${d}`,title:`${s} ${r}`,children:[t,s," ",r]})},A=({title:t,items:r,tone:s})=>{if(r.length===0)return null;const i=s==="add"?"text-emerald-600 dark:text-emerald-400":s==="remove"?"text-rose-600 dark:text-rose-400":"text-amber-600 dark:text-amber-400";return e.jsxs("div",{children:[e.jsxs("div",{className:`text-[11px] font-semibold uppercase tracking-wide mb-1 ${i}`,children:[t," (",r.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(d=>e.jsx("code",{className:"text-[11px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-mono",children:d},d))})]})},oe=({entry:t,isFirst:r})=>{const[s,i]=l.useState(!1),{diff:d}=t,n=d.nodes_added.length+d.nodes_removed.length+d.nodes_modified.length,o=r&&d.nodes_removed.length===0&&d.nodes_modified.length===0;return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>i(x=>!x),className:"w-full flex items-start gap-3 p-3 text-left hover:bg-gray-50 dark:hover:bg-slate-800/50 transition-colors",children:[e.jsx("div",{className:"pt-0.5 text-gray-400",children:s?e.jsx(G,{size:16}):e.jsx(K,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-mono text-gray-500 dark:text-gray-400",children:[e.jsx(B,{size:11}),"v",t.version_int]}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100 truncate",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold ${t.kind==="auto"?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-slate-700 dark:text-gray-300"}`,children:t.kind}),o&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300",children:"initial"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(V,{size:11}),ie(t.created_at)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{size:11}),t.user_id!==null?`user #${t.user_id}`:"anonymous"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Y,{size:11}),t.node_count," nodes / ",t.edge_count," edges"]})]}),t.note&&e.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300 italic truncate",children:["β€œ",t.note,"”"]}),!o&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[e.jsx(w,{icon:e.jsx(C,{size:10}),label:"added",count:d.nodes_added.length,tone:"add"}),e.jsx(w,{icon:e.jsx(z,{size:10}),label:"removed",count:d.nodes_removed.length,tone:"remove"}),e.jsx(w,{icon:e.jsx(I,{size:10}),label:"modified",count:d.nodes_modified.length,tone:"modify"}),n===0&&e.jsx("span",{className:"text-[11px] text-gray-400 italic",children:"no node-level changes"})]})]})]}),e.jsx(ne,{expanded:s,diff:d,totalChanged:n})]})},ne=({expanded:t,diff:r,totalChanged:s})=>e.jsx(e.Fragment,{children:t&&s>0&&e.jsxs("div",{className:"px-10 pb-3 pt-1 space-y-2 bg-gray-50/60 dark:bg-slate-900/40",children:[e.jsx(A,{title:"Added",items:r.nodes_added,tone:"add"}),e.jsx(A,{title:"Removed",items:r.nodes_removed,tone:"remove"}),e.jsx(A,{title:"Modified",items:r.nodes_modified,tone:"modify"})]})}),le=({state:t})=>{const{isLoading:r,datasetId:s,data:i,emptyStateText:d,filteredEntries:n}=t;return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading audit trail…"}):s?!i||i.entries.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):n.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):e.jsx("div",{children:n.map((o,x)=>e.jsx(oe,{entry:o,isFirst:x===n.length-1},o.id))}):e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Pick a dataset to view its save history."})})},ce=({summary:t})=>e.jsx(e.Fragment,{children:t&&t.saves>0&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3 mb-4",children:[e.jsx(f,{label:"Saves",value:t.saves,icon:e.jsx(J,{size:14})}),e.jsx(f,{label:"Users",value:t.users,icon:e.jsx($,{size:14})}),e.jsx(f,{label:"Nodes added",value:t.added,icon:e.jsx(C,{size:14}),tone:"add"}),e.jsx(f,{label:"Nodes removed",value:t.removed,icon:e.jsx(z,{size:14}),tone:"remove"}),e.jsx(f,{label:"Nodes modified",value:t.modified,icon:e.jsx(I,{size:14}),tone:"modify"})]})}),f=({label:t,value:r,icon:s,tone:i})=>{const d=i==="add"?"text-emerald-600 dark:text-emerald-400":i==="remove"?"text-rose-600 dark:text-rose-400":i==="modify"?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-200";return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400 font-medium",children:[s,t]}),e.jsx("div",{className:`mt-1 text-xl font-semibold ${d}`,children:r})]})};function xe(){const{data:t,isLoading:r}=O(),[s,i]=l.useState(""),[d,n]=l.useState(50),[o,x]=l.useState("all"),[m,y]=l.useState("all"),[h,u]=l.useState(""),[g,p]=l.useState(""),[a,j]=l.useState(null),[k,_]=l.useState(!1),[L,T]=l.useState(null);l.useEffect(()=>{if(!s&&t&&t.length>0){const c=t[0];c&&i(S(c))}},[t,s]);const v=l.useRef(0),N=l.useCallback(async()=>{if(!s)return;const c=++v.current;_(!0),T(null);try{const b=await U.audit(s,d,Z({actorFilter:o,kindFilter:m,fromTime:h,toTime:g}));if(c!==v.current)return;j(b)}catch(b){if(c!==v.current)return;const F=b.message||"Failed to load audit trail";T(F),q.error(F)}finally{c===v.current&&_(!1)}},[s,d,o,m,h,g]);l.useEffect(()=>{N()},[N]);const R=l.useMemo(()=>ee(a),[a]),P=l.useMemo(()=>{var c,b;return{hasAnonymous:((c=a==null?void 0:a.facets)==null?void 0:c.has_anonymous_actor)??!1,userIds:((b=a==null?void 0:a.facets)==null?void 0:b.actors)??[]}},[a]),D=l.useMemo(()=>{var c;return((c=a==null?void 0:a.facets)==null?void 0:c.kinds)??[]},[a]),M=l.useMemo(()=>{const c=t==null?void 0:t.find(b=>S(b)===s);return(c==null?void 0:c.name)??"this dataset"},[t,s]),E=te(a,M,d,{actorFilter:o,kindFilter:m,fromTime:h,toTime:g});return{datasets:t,datasetsLoading:r,datasetId:s,setDatasetId:i,limit:d,setLimit:n,actorFilter:o,setActorFilter:x,kindFilter:m,setKindFilter:y,fromTime:h,setFromTime:u,toTime:g,setToTime:p,data:a,isLoading:k,error:L,load:N,summary:R,actorOptions:P,kindOptions:D,...E}}const be=()=>{const t=xe(),{load:r,isLoading:s,datasetId:i,data:d,error:n,summary:o,historyScopeText:x,historyMetaText:m}=t;return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Q,{className:"w-6 h-6 text-violet-500"}),"Pipeline Audit Log"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Chronological history of canvas saves. Each entry shows who, when, and which nodes changed vs. the previous save."})]}),e.jsxs("button",{type:"button",onClick:()=>void r(),disabled:s||!i,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 disabled:opacity-50",children:[e.jsx(W,{className:`w-4 h-4 ${s?"animate-spin":""}`}),"Refresh"]})]}),e.jsx(ae,{state:t}),d&&e.jsx("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"Actor, action kind and time filters apply across the full history before the page limit."}),n&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(X,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:n})]}),e.jsx(ce,{summary:o}),e.jsx(le,{state:t}),x&&e.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400 text-center",children:[x," ",m]})]})};export{be as AuditLogPage}; diff --git a/static/ml_canvas/assets/DataDriftPage-FTzER2c0.js b/static/ml_canvas/assets/DataDriftPage-DBBkKEof.js similarity index 99% rename from static/ml_canvas/assets/DataDriftPage-FTzER2c0.js rename to static/ml_canvas/assets/DataDriftPage-DBBkKEof.js index 5e467ee29..ed702fe4a 100644 --- a/static/ml_canvas/assets/DataDriftPage-FTzER2c0.js +++ b/static/ml_canvas/assets/DataDriftPage-DBBkKEof.js @@ -1,2 +1,2 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{O as he,j as L,Q as ge,f as H,t as be,U as fe,C as ke,V as je,a as x,T,S as X,Y as ye,X as E,K as ve,b as I,e as F,z as Ne,_ as we,p as R,$ as _e,a0 as Se,a1 as Ce,a2 as B,a3 as De,a4 as ze,a5 as J,a6 as _,a7 as Re,a8 as Le,w as Ee,a9 as Ae,aa as Te,s as Fe,ab as $e,ac as Pe,ad as Me,D as Oe,c as Ke,ae as Ue}from"./vendor-utils-VkF_O5b_.js";import{R as A,b as He,C as Ie,M as Be,L as Ye,E as G,m as S,u as Ve}from"./index-_bluKNvP.js";import{R as Q,ag as We,C as Z,X as ee,Y as te,T as se,ah as re,ai as Y,B as qe,h as V}from"./vendor-charts-BkHP8M8k.js";import{F as W}from"./FormField-BaO1-ftW.js";const Xe={none:{label:"No drift",classes:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800"},warning:{label:"Warning",classes:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-800"},critical:{label:"Critical",classes:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800"}},ae=({severity:t})=>{const s=Xe[t],r=t==="critical"?he:t==="warning"?L:ge;return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:[e.jsx(r,{size:12,"aria-hidden":"true"}),s.label]})},Je={new:{label:"New",classes:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800"},acknowledged:{label:"Acknowledged",classes:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400 border-purple-200 dark:border-purple-800"},resolved:{label:"Resolved",classes:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700"},reopened:{label:"Reopened",classes:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400 border-orange-200 dark:border-orange-800"}},$=({status:t})=>{const s=Je[t];return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:s.label})};function Ge({detail:t,filters:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ae,{severity:t.severity}),e.jsx($,{status:t.status}),t.evaluation_status!=="completed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t.evaluation_status==="no_baseline"?"No baseline":"Evaluation failed"]})]}),t.evaluation_status!=="completed"&&t.error_message&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(H,{size:16,className:"shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:t.error_message})]}),e.jsx(Qe,{detail:t}),e.jsx(Ze,{detail:t,filters:s})]})}function Qe({detail:t}){var s;return e.jsxs("dl",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Detected"}),e.jsx("dd",{className:"font-medium",children:((s=t.created_at)==null?void 0:s.replace("T"," ").slice(0,16))??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Threshold version"}),e.jsxs("dd",{className:"font-medium",children:[t.threshold_version!=null?`v${t.threshold_version}`:"β€”",t.threshold_version!=null&&e.jsxs("span",{className:"block text-[11px] font-normal text-gray-400",children:["PSI ",t.threshold_psi," Β· KS ",t.threshold_ks," Β· Wasserstein"," ",t.threshold_wasserstein," Β· KL ",t.threshold_kl]})]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Drifted features"}),e.jsx("dd",{className:"font-medium",children:t.drifted_columns_count!=null&&t.total_columns!=null?`${t.drifted_columns_count} / ${t.total_columns}`:"β€”"})]})]})}function Ze({detail:t,filters:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsx(A,{recordRef:{kind:"job",jobId:t.job_id},origin:"/drift",filters:s}),t.model_version&&e.jsx(A,{recordRef:{kind:"modelVersion",jobId:t.job_id,version:t.model_version},origin:"/drift",filters:s}),t.deployment_id!=null&&e.jsx(A,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},origin:"/drift",filters:s})]})}function et({alertId:t,evaluationStatus:s,evidenceRows:r}){return s!=="completed"?null:e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Feature evidence"}),r.length===0?e.jsx(He,{title:"No evidence recorded",description:"This alert has no retained per-feature drift evidence."}):e.jsx(Ie,{caption:`Per-feature drift evidence for alert #${t??""}`,filename:`drift-alert-${t??"unknown"}-evidence`,columns:[{key:"column",label:"Feature"},{key:"drifted",label:"Drifted"},{key:"psi",label:"PSI"},{key:"wasserstein",label:"Wasserstein"},{key:"ks_statistic",label:"KS statistic"},{key:"ks_p_value",label:"KS p-value"}],rows:r,defaultOpen:!0})]})}function tt({entries:t}){return e.jsxs(e.Fragment,{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(be,{size:12})," History"]}),t.length===0?e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No disposition changes recorded yet."}):e.jsx("ul",{className:"space-y-1.5",children:t.map((s,r)=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx($,{status:s.status}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{size:11})," ",s.actor]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(ke,{size:11})," ",s.at.replace("T"," ").slice(0,16)]}),s.note&&e.jsxs("span",{className:"italic",children:['"',s.note,'"']})]},r))})]})}const q={new:["acknowledge"],acknowledged:["resolve","reopen"],resolved:["reopen"],reopened:["acknowledge"]},st={acknowledge:"Acknowledge",resolve:"Resolve",reopen:"Reopen"};function rt({detail:t,actor:s,note:r,actionError:a,error:n,actionPending:l,setActor:i,setNote:u,handleAction:m}){return e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(je,{size:13})," Disposition"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:t.owner?e.jsxs(e.Fragment,{children:["Currently ",e.jsx("strong",{children:t.status})," by ",e.jsx("strong",{children:t.owner}),"."]}):e.jsx(e.Fragment,{children:"No disposition recorded yet β€” acknowledge to claim this alert."})}),(q[t.status]??[]).length>0&&e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e.jsx(W,{label:"Your name",required:!0,children:p=>e.jsx("input",{...p,type:"text",value:s,onChange:h=>i(h.target.value),placeholder:"e.g. alice",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})}),e.jsx(W,{label:"Note",hint:"Optional context for the audit trail",children:p=>e.jsx("input",{...p,type:"text",value:r,onChange:h=>u(h.target.value),placeholder:"Optional",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})})]}),a&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:a}),n&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:n}),e.jsx("div",{className:"flex gap-2",children:(q[t.status]??[]).map(p=>e.jsx("button",{type:"button",disabled:l,onClick:()=>void m(p),className:"px-3 py-1.5 text-sm font-medium rounded-md action-primary disabled:opacity-50 disabled:cursor-not-allowed",children:st[p]},p))})]}),e.jsx(tt,{entries:t.disposition_history})]})}function at(t){return t!=null&&t.column_drifts?Object.entries(t.column_drifts).map(([s,r])=>{const a=Object.fromEntries(r.metrics.map(n=>[n.metric,n.value]));return{column:s,drifted:r.drift_detected?"Yes":"No",psi:a.psi!=null?Number(a.psi.toFixed(4)):null,wasserstein:a.wasserstein_distance!=null?Number(a.wasserstein_distance.toFixed(4)):null,ks_statistic:a.ks_statistic!=null?Number(a.ks_statistic.toFixed(4)):null,ks_p_value:a.ks_test_p_value!=null?Number(a.ks_test_p_value.toFixed(4)):null}}):[]}const nt=({alertId:t,detail:s,loading:r,error:a,actionPending:n,onApplyDisposition:l,onRetry:i,onClose:u,filters:m})=>{const[p,h]=x.useState(""),[g,b]=x.useState(""),[k,c]=x.useState(null),d=async f=>{if(!p.trim()){c("Enter your name so the disposition records who made it.");return}c(null),await l(f,p.trim(),g.trim()||void 0)&&b("")},o=at(s);return e.jsxs(Be,{isOpen:t!==null,onClose:u,title:t!==null?`Drift alert #${t}`:void 0,size:"3xl",children:[r&&e.jsx(Ye,{message:"Loading drift alert…"}),!r&&a&&!s&&e.jsx(G,{error:a,onRetry:i}),!r&&s&&e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsx(Ge,{detail:s,filters:m}),e.jsx(et,{alertId:t,evaluationStatus:s.evaluation_status,evidenceRows:o}),e.jsx(rt,{detail:s,actor:p,note:g,actionError:k,error:a,actionPending:n,setActor:h,setNote:b,handleAction:d})]})]})},lt=({history:t,onInvestigate:s})=>t.length===0?null:e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(T,{size:18})," Alert History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-slate-700",children:[e.jsx("th",{className:"px-4 py-2 font-medium",children:"Detected"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Severity"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Evaluation"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Threshold"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Owner"}),e.jsx("th",{className:"px-4 py-2 font-medium sr-only",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(r=>{var a;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-slate-700/60 last:border-0",children:[e.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:((a=r.created_at)==null?void 0:a.replace("T"," ").slice(0,16))??"Unknown"}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(ae,{severity:r.severity})}),e.jsx("td",{className:"px-4 py-2",children:e.jsx($,{status:r.status})}),e.jsx("td",{className:"px-4 py-2 capitalize",children:r.evaluation_status.replace("_"," ")}),e.jsx("td",{className:"px-4 py-2",children:r.threshold_version!=null?`v${r.threshold_version}`:"β€”"}),e.jsx("td",{className:"px-4 py-2",children:r.owner??"β€”"}),e.jsx("td",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>s(r.id),className:"inline-flex items-center gap-1 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 text-xs font-medium",children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Investigate"]})})]},r.id)})})]})})]}),it=({showOnlyDrifted:t,onToggleDrifted:s,sortConfig:r,onClearSort:a,onExport:n})=>e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:s,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors border ${t?"bg-red-50 dark:bg-red-900/30 border-red-200 dark:border-red-700 text-red-700 dark:text-red-300":"border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:[e.jsx(ye,{size:12}),t?"Showing drifted only":"Show only drifted"]}),r&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-xs text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:[e.jsx(E,{size:11})," Clear sort"]}),e.jsx("div",{className:"ml-auto",children:e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium border border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors",title:"Download drift report as CSV",children:[e.jsx(ve,{size:12})," Export CSV"]})})]}),ot=({history:t})=>{if(t.length<=1)return null;const s=[...t].reverse().map(r=>{var l;const a=r.summary?Object.values(r.summary):null,n=a?a.filter(i=>i.drifted).length:null;return{date:((l=r.created_at)==null?void 0:l.split("T")[0])??"",drifted:n,pct:a!=null&&a.length?Math.round((n??0)/a.length*100):null}});return e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(T,{size:18})," Drift History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]}),e.jsx("div",{className:"h-[280px]",children:e.jsx(Q,{width:"100%",height:"100%",children:e.jsxs(We,{data:s,margin:{top:5,right:30,left:0,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:"date",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:!1}),e.jsx(se,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(r,a)=>a==="Drifted Features"?[r,a]:a==="Drift %"?[`${r}%`,a]:[r,a]}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(Y,{type:"monotone",dataKey:"drifted",name:"Drifted Features",stroke:"#ef4444",strokeWidth:2,dot:{r:3,fill:"#ef4444"}}),e.jsx(Y,{type:"monotone",dataKey:"pct",name:"Drift %",stroke:"#f59e0b",strokeWidth:2,dot:{r:3,fill:"#f59e0b"},strokeDasharray:"5 5"})]})})})]})},D=({label:t,tooltip:s,icon:r})=>e.jsxs("div",{className:"group relative flex items-center gap-1 cursor-help",children:[e.jsx("span",{className:"border-b border-dotted border-gray-400",children:t}),r&&e.jsx("span",{className:"text-gray-400",children:r}),e.jsxs("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 w-64 p-2 bg-slate-900 text-white text-xs rounded shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 text-center pointer-events-none",children:[s,e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 -mb-1 border-4 border-transparent border-b-slate-900"})]})]}),dt=({values:t,width:s=64,height:r=20})=>{if(t.length<2)return e.jsx("span",{className:"text-[10px] text-gray-400",children:"β€”"});const a=Math.min(...t),l=Math.max(...t)-a||1,i=t.map((h,g)=>{const b=g/(t.length-1)*s,k=r-(h-a)/l*(r-4)-2;return`${b},${k}`}).join(" "),u=t[t.length-1]??0,m=u>.2?"#ef4444":u>.1?"#f59e0b":"#22c55e",p=r-(u-a)/l*(r-4)-2;return e.jsxs("svg",{width:s,height:r,className:"inline-block",children:[e.jsx("polyline",{points:i,fill:"none",stroke:m,strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("circle",{cx:s,cy:p,r:"2",fill:m})]})},ct={wasserstein:"wasserstein_distance",psi:"psi",kl:"kl_divergence",ks:"ks_statistic"},xt=(t,s,r)=>{const a=(n,l)=>{var i;return((i=n.metrics.find(u=>u.metric===l||l==="psi"&&u.metric==="psi_categorical"))==null?void 0:i.value)??0};return[...t].sort((n,l)=>{let i=0;switch(s.key){case"column":i=n.column.localeCompare(l.column);break;case"status":i=(n.drift_detected?1:0)-(l.drift_detected?1:0);break;case"risk":i=((r==null?void 0:r[n.column])??0)-((r==null?void 0:r[l.column])??0);break;default:{const u=ct[s.key];u&&(i=a(n,u)-a(l,u))}}return s.dir==="asc"?i:-i})};function ut(t,s,r){let a=Object.values(t.column_drifts);return s&&(a=a.filter(n=>n.drift_detected)),r&&(a=xt(a,r,t.feature_importances)),a}const mt=({active:t,dir:s})=>t?s==="asc"?e.jsx(Se,{size:11}):e.jsx(Ce,{size:11}):e.jsx(_e,{size:11,className:"opacity-30"}),pt=({distribution:t})=>e.jsxs("div",{className:"h-[350px] w-full bg-white dark:bg-slate-800 p-6 rounded border dark:border-slate-700 shadow-sm",children:[e.jsxs("h4",{className:"text-sm font-semibold mb-6 flex items-center gap-2 text-slate-700 dark:text-slate-300",children:[e.jsx(J,{size:16})," Distribution Comparison"]}),e.jsx(Q,{width:"100%",height:"85%",children:e.jsxs(qe,{data:t.bins,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:s=>`${s.bin_start.toFixed(2)}`,className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:!1}),e.jsx(se,{cursor:{fill:"rgba(0,0,0,0.05)"},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))",marginBottom:"0.5rem"}}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(V,{dataKey:"reference_count",name:"Reference (Training)",fill:"#94a3b8",radius:[4,4,0,0],barSize:30}),e.jsx(V,{dataKey:"current_count",name:"Current (Production)",fill:"#3b82f6",radius:[4,4,0,0],barSize:30})]})})]}),ht=({importance:t,rank:s,drifted:r,maxImportance:a})=>{if(t==null)return e.jsx("span",{className:"text-xs text-gray-400",children:"β€”"});const n=r&&s!=null&&s<=5,l=r&&s!=null&&s<=15&&!n;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[n?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300",children:[e.jsx(B,{size:12})," High"]}):l?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300",children:[e.jsx(B,{size:12})," Medium"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:[e.jsx(De,{size:12})," Low"]}),e.jsx("div",{className:"w-12 h-1.5 bg-gray-200 dark:bg-slate-700 rounded-full overflow-hidden",title:`Importance: ${(t*100/a).toFixed(0)}%`,children:e.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${a>0?t/a*100:0}%`}})})]})};function z({metric:t,showRawDistance:s=!1}){var a;const r=s&&(t==null?void 0:t.raw_value)!=null?`Raw earth-mover distance: ${t.raw_value.toFixed(4)} in column units`:void 0;return e.jsx("td",{className:`px-6 py-4 whitespace-nowrap tabular-nums ${t!=null&&t.has_drift?"text-red-600 dark:text-red-400 font-bold":""}`,title:r,children:((a=t==null?void 0:t.value)==null?void 0:a.toFixed(4))??"β€”"})}function gt({col:t,ks:s,ksPValue:r}){return e.jsxs("div",{className:"flex flex-col gap-4",children:[s&&e.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400",children:["KS statistic"," ",e.jsx("span",{className:"font-semibold tabular-nums",children:s.value.toFixed(4)})," ","vs threshold ",s.threshold.toFixed(2),r&&e.jsxs(e.Fragment,{children:[" ","Β· p-value"," ",e.jsx("span",{className:"tabular-nums",children:r.value<.001?"< 0.001":r.value.toFixed(3)})," ","(diagnostic only β€” drift is decided on the statistic)"]})]}),t.suggestions&&t.suggestions.length>0&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ze,{size:16,className:"mt-0.5 shrink-0 text-yellow-600 dark:text-yellow-400"}),e.jsx("ul",{className:"list-disc list-inside text-sm text-yellow-800 dark:text-yellow-200",children:t.suggestions.map((a,n)=>e.jsx("li",{children:a},n))})]})}),t.distribution&&e.jsx(pt,{distribution:t.distribution})]})}function bt({col:t,fi:s,isExpanded:r,maxImportance:a,toggleRow:n,hasSparklines:l,columnSparklines:i,colSpan:u}){const m=t.metrics.find(d=>d.metric==="wasserstein_distance"),p=t.metrics.find(d=>d.metric==="psi"||d.metric==="psi_categorical"),h=t.metrics.find(d=>d.metric==="kl_divergence"),g=t.metrics.find(d=>d.metric==="ks_statistic"),b=t.metrics.find(d=>d.metric==="ks_test_p_value"),k=s==null?void 0:s[t.column],c=s?Object.values(s).filter(d=>d>(k??0)).length+1:null;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:t.drift_detected?"bg-red-50 dark:bg-red-900/10":"",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap font-medium",children:t.column}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.drift_detected?e.jsxs("span",{className:"text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(Ne,{size:16})," Drifted"]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(F,{size:16})," Stable"]})}),e.jsx(z,{metric:m,showRawDistance:!0}),e.jsx(z,{metric:p}),e.jsx(z,{metric:h}),e.jsx(z,{metric:g}),s&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(ht,{importance:k,rank:c,drifted:t.drift_detected,maxImportance:a})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("button",{onClick:()=>n(t.column),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 flex items-center gap-1 text-sm",children:[r?e.jsx(we,{size:16}):e.jsx(R,{size:16}),r?"Hide":"Details"]})}),l&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(dt,{values:i[t.column]??[]})})]}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:u,className:"px-6 py-4 bg-gray-50 dark:bg-slate-900/50",children:e.jsx(gt,{col:t,ks:g,ksPValue:b})})})]})}const ft=({report:t,showOnlyDrifted:s,sortConfig:r,onSort:a,columnSparklines:n})=>{const[l,i]=x.useState({});I.useEffect(()=>{i({})},[t]),I.useEffect(()=>{const d=o=>{o.key==="Escape"&&i({})};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const u=d=>i(o=>({...o,[d]:!o[d]})),m=t.feature_importances,p=m?Math.max(...Object.values(m)):0,h=Object.keys(n).length>0,g=ut(t,s,r),b=(m?8:7)+(h?1:0),k=t.missing_columns.length>0||t.new_columns.length>0,c=(d,o)=>e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer select-none hover:text-gray-700 dark:hover:text-slate-300",onClick:()=>a(d),children:e.jsxs("span",{className:"flex items-center gap-1",children:[o,e.jsx(mt,{active:(r==null?void 0:r.key)===d,dir:r==null?void 0:r.dir})]})});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-slate-900",children:e.jsxs("tr",{children:[c("column","Column"),c("status","Status"),c("wasserstein",e.jsx(D,{label:"Wasserstein",tooltip:"Measures distance between distributions, normalized by the reference column's standard deviation so the threshold is scale-free. Lower is better. < 0.1 usually means stable.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("psi",e.jsx(D,{label:"PSI",tooltip:"Population Stability Index. < 0.1: Stable, < 0.2: Minor Drift, > 0.2: Significant Drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("kl",e.jsx(D,{label:"KL Div",tooltip:"Kullback-Leibler Divergence. Measures how one probability distribution diverts from a second.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("ks",e.jsx(D,{label:"KS Stat",tooltip:"Kolmogorov-Smirnov statistic β€” maximum distance between the two cumulative distributions (0–1). Unlike the p-value it does not shrink with sample size; values above the threshold (default 0.1) indicate drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),m&&c("risk",e.jsx(D,{label:"Risk",tooltip:"Combines drift status with feature importance. High = drifted + important feature. Helps prioritize which drifts to investigate.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"}),h&&e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{size:11})," Trend"]})})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-gray-200 dark:divide-slate-700",children:g.length===0&&s?e.jsx("tr",{children:e.jsxs("td",{colSpan:b,className:"px-6 py-8 text-center text-gray-500 dark:text-slate-400 text-sm",children:[e.jsx(F,{size:20,className:"inline mr-2 text-green-500"}),k?"No distribution drift among shared columns β€” see the schema drift above.":"No drifted columns found β€” all features are stable."]})}):g.map(d=>e.jsx(bt,{col:d,fi:m,isExpanded:l[d.column],maxImportance:p,toggleRow:u,hasSparklines:h,columnSparklines:n,colSpan:b},d.column))})]})})},kt=()=>e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-gray-500 dark:text-slate-400",children:[e.jsx(Re,{size:48,strokeWidth:1.2}),e.jsx("h2",{className:"text-lg font-medium text-gray-500 dark:text-slate-400",children:"No Drift Report Yet"}),e.jsxs("p",{className:"text-sm max-w-md",children:["Select a reference model from the dropdown above, upload current production data (CSV or Parquet), and click ",e.jsx("strong",{children:"Run Analysis"})," to compare distributions."]})]})}),jt=({file:t,onFileChange:s,invalid:r})=>{const a=x.useRef(null),n=l=>{l.target.files&&l.target.files[0]&&s(l.target.files[0])};return e.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("input",{ref:a,type:"file",className:"hidden",onChange:n,accept:".csv,.parquet","aria-label":"Upload current data file (CSV or Parquet)"}),t?e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2.5 border border-gray-200 dark:border-slate-600 rounded-md text-sm bg-gray-50 dark:bg-slate-900",children:[e.jsx(Le,{size:14,className:"text-green-500 shrink-0"}),e.jsx("span",{className:"text-slate-700 dark:text-slate-300 truncate max-w-[180px]",children:t.name}),e.jsx("button",{type:"button",onClick:()=>s(null),"aria-label":`Remove ${t.name}`,className:"text-gray-400 hover:text-red-500 transition-colors ml-1",children:e.jsx(E,{size:14})})]}):e.jsxs("button",{type:"button",onClick:()=>{var l;return(l=a.current)==null?void 0:l.click()},"aria-describedby":r?"file-uploader-error":void 0,className:`flex items-center gap-2 px-3 py-2.5 border border-dashed rounded-md text-sm transition-colors ${r?"border-red-400 dark:border-red-500 text-red-600 dark:text-red-400 hover:border-red-500":"border-gray-300 dark:border-slate-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-500 dark:hover:border-blue-500"}`,children:[e.jsx(Ee,{size:15}),"Upload CSV / Parquet"]})]}),r&&!t&&e.jsx("span",{id:"file-uploader-error",className:"text-[11px] text-red-600 dark:text-red-400",children:"Current data file is required."})]})};function yt({triggerRef:t,open:s,listboxId:r,invalid:a,selectedJob:n,selectedJobData:l,onSelect:i,onToggle:u}){return e.jsxs("button",{ref:t,type:"button","aria-haspopup":"listbox","aria-expanded":s,"aria-controls":r,onClick:()=>{u()},className:`w-full flex items-center gap-2 px-3 py-2.5 border rounded-md text-sm transition-colors ${a?"border-red-400 dark:border-red-500 hover:border-red-500":n?"border-blue-300 dark:border-blue-700 bg-blue-50/50 dark:bg-blue-900/20":"border-gray-200 dark:border-slate-600 hover:border-gray-300 dark:hover:border-slate-500"}`,"aria-describedby":a?"job-selector-error":void 0,children:[e.jsx(Ae,{size:15,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:`truncate ${n?"text-slate-800 dark:text-slate-200":"text-gray-400"}`,children:l?`${l.dataset_name} (${l.job_id.slice(0,8)})`:"Select reference model..."}),n&&e.jsx("span",{role:"button",tabIndex:0,"aria-label":"Clear selected reference model",title:"Clear selection",onClick:m=>{m.stopPropagation(),i("")},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),m.preventDefault(),i(""))},className:"ml-auto shrink-0 p-0.5 rounded hover:bg-black/5 dark:hover:bg-white/10 text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:e.jsx(E,{size:13})}),e.jsx(R,{size:14,className:`${n?"":"ml-auto"} shrink-0 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})}const vt=({jobs:t,selectedJob:s,onSelect:r,invalid:a})=>{const[n,l]=x.useState(!1),[i,u]=x.useState(""),m=x.useRef(null),p=x.useRef(null),h="job-selector-listbox";x.useEffect(()=>{const c=d=>{m.current&&!m.current.contains(d.target)&&l(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),x.useEffect(()=>{if(!n)return;const c=d=>{var o;d.key==="Escape"&&(l(!1),(o=p.current)==null||o.focus())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n]);const g=x.useMemo(()=>{if(!i)return t;const c=i.toLowerCase();return t.filter(d=>{var o,f,y;return d.dataset_name.toLowerCase().includes(c)||d.job_id.toLowerCase().includes(c)||((o=d.description)==null?void 0:o.toLowerCase().includes(c))||((f=d.model_type)==null?void 0:f.toLowerCase().includes(c))||((y=d.target_column)==null?void 0:y.toLowerCase().includes(c))})},[i,t]),b=x.useMemo(()=>{var d;const c={};for(const o of g){const f=((d=o.created_at)==null?void 0:d.split(" ")[0])||"Unknown";c[f]||(c[f]=[]),c[f].push(o)}return Object.entries(c).sort(([o],[f])=>f.localeCompare(o))},[g]),k=x.useMemo(()=>t.find(c=>c.job_id===s),[t,s]);return e.jsxs("div",{ref:m,className:"relative flex-1 min-w-0",children:[e.jsx(yt,{triggerRef:p,open:n,listboxId:h,invalid:a,selectedJob:s,selectedJobData:k,onSelect:r,onToggle:()=>{l(!n),u("")}}),a&&!s&&e.jsx("span",{id:"job-selector-error",className:"block mt-1 text-[11px] text-red-600 dark:text-red-400",children:"Reference job is required."}),n&&e.jsxs("div",{id:h,role:"listbox","aria-label":"Reference model jobs",className:"absolute z-50 left-0 right-0 mt-1 bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-600 rounded-md shadow-lg overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-slate-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none z-10",size:14}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Search jobs...",value:i,onChange:c=>u(c.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-200 dark:border-slate-600 rounded bg-gray-50 dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:g.length===0?e.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"No jobs found"}):b.map(([c,d])=>e.jsxs("div",{children:[e.jsx("div",{className:"sticky top-0 px-3 py-1.5 text-[11px] font-semibold text-gray-500 dark:text-slate-400 bg-gray-50 dark:bg-slate-900/80 uppercase tracking-wider border-b border-gray-100 dark:border-slate-700",children:c}),d.map(o=>e.jsxs("button",{type:"button",role:"option","aria-selected":s===o.job_id,onClick:()=>{r(o.job_id),l(!1)},className:`w-full text-left px-3 py-2.5 text-sm transition-colors ${s===o.job_id?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-slate-700/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:o.dataset_name}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono shrink-0",children:o.job_id.slice(0,8)}),o.model_type&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-300 shrink-0",children:o.model_type}),o.best_metric&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-300 shrink-0 ml-auto tabular-nums truncate max-w-[140px]",title:o.best_metric,children:o.best_metric.split(" | ")[0]})]}),(o.target_column||o.description)&&e.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-[11px] text-gray-500 dark:text-slate-400",children:[o.target_column&&e.jsxs("span",{children:["target: ",o.target_column]}),o.description&&e.jsxs("span",{className:"truncate italic",children:["β€” ",o.description]})]})]},o.job_id))]},c))})]})]})},Nt=({missingColumns:t,newColumns:s})=>{const r=t.filter(n=>n.trim()!==""),a=s.filter(n=>n.trim()!=="");return r.length===0&&a.length===0?null:e.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.length>0&&e.jsxs("details",{className:"group bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[e.jsxs("summary",{className:"font-semibold text-red-800 dark:text-red-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(L,{size:16,className:"shrink-0"})," Missing Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-red-200 dark:bg-red-800 px-2 py-0.5 rounded-full",children:r.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-red-600/70 dark:text-red-300/60 mb-2",children:"Columns present in reference (training) data but missing from your uploaded file."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:r.map(n=>e.jsx("li",{children:n},n))})]})]}),a.length>0&&e.jsxs("details",{className:"group bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800",children:[e.jsxs("summary",{className:"font-semibold text-blue-800 dark:text-blue-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(_,{size:16,className:"shrink-0"})," Extra Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-blue-200 dark:bg-blue-800 px-2 py-0.5 rounded-full",children:a.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-blue-600/70 dark:text-blue-300/60 mb-2",children:"Columns in your uploaded file that were not in the training reference. These are excluded from distribution metrics but reported as schema changes. The model target is excluded from both checks."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-blue-700 dark:text-blue-300",children:a.map(n=>e.jsx("li",{children:n},n))})]})]})]})},wt=({job:t,onUpdateDescription:s})=>{const[r,a]=x.useState(!1),[n,l]=x.useState("");x.useEffect(()=>{a(!1)},[t.job_id]);const i=async()=>{await s(n),a(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-3 text-xs text-gray-500 dark:text-slate-400",children:[t.model_type&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-indigo-50 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-300 font-medium",children:t.model_type}),t.target_column&&e.jsxs("span",{children:["Target:"," ",e.jsx("span",{className:"font-medium text-slate-600 dark:text-slate-300",children:t.target_column})]}),t.n_features!=null&&e.jsxs("span",{children:[t.n_features," features"]}),t.n_rows!=null&&e.jsxs("span",{children:[t.n_rows.toLocaleString()," rows"]}),t.best_metric&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-green-50 dark:bg-green-900/30 text-green-600 dark:text-green-300 font-medium tabular-nums",children:t.best_metric}),e.jsx("span",{className:"border-l border-gray-200 dark:border-slate-700 h-3"}),r?e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[e.jsx("input",{autoFocus:!0,value:n,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&a(!1)},placeholder:"Add a description...",className:"flex-1 min-w-0 px-2 py-0.5 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>void i(),className:"text-green-500 hover:text-green-600",children:e.jsx(Te,{size:13})}),e.jsx("button",{onClick:()=>a(!1),className:"text-gray-400 hover:text-red-500",children:e.jsx(E,{size:13})})]}):e.jsxs("button",{onClick:()=>{l(t.description||""),a(!0)},className:"flex items-center gap-1 hover:text-blue-500 transition-colors group",children:[e.jsx(Fe,{size:11,className:"opacity-50 group-hover:opacity-100"}),e.jsx("span",{className:t.description?"":"italic text-gray-400",children:t.description||"Add description..."})]})]})};function _t(t){var p;const s=Object.values(t.column_drifts),r=s.length,a=s.filter(h=>h.drift_detected).length,n=s.map(h=>{var g;return(g=h.metrics.find(b=>b.metric==="psi"))==null?void 0:g.value}).filter(h=>h!=null),l=n.length>0?n.reduce((h,g)=>h+g,0)/n.length:0,i=[...s].sort((h,g)=>{var c,d;const b=((c=h.metrics.find(o=>o.metric==="psi"))==null?void 0:c.value)??0;return(((d=g.metrics.find(o=>o.metric==="psi"))==null?void 0:d.value)??0)-b})[0],u=r>0?Math.round(a/r*100):0,m=((p=i==null?void 0:i.metrics.find(h=>h.metric==="psi"))==null?void 0:p.value)??0;return{totalCols:r,driftedCount:a,avgPsi:l,mostDrifted:i,driftedPct:u,mostDriftedPsi:m}}const St=({report:t})=>{const{totalCols:s,driftedCount:r,avgPsi:a,mostDrifted:n,driftedPct:l,mostDriftedPsi:i}=_t(t);return e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx($e,{size:13})," Total Columns"]}),e.jsx("div",{className:"text-2xl font-bold tabular-nums",children:s}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["Ref: ",t.reference_rows.toLocaleString()," rows | Cur: ",t.current_rows.toLocaleString()," rows"]})]}),e.jsxs("div",{className:`rounded-lg p-4 border ${r>0?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[r>0?e.jsx(L,{size:13}):e.jsx(F,{size:13})," Drifted"]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums",children:[r," ",e.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["/ ",s]})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[l,"% of features"]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Pe,{size:13})," Avg PSI"]}),e.jsx("div",{className:`text-2xl font-bold tabular-nums ${a>.2?"text-red-600 dark:text-red-400":a>.1?"text-amber-600 dark:text-amber-400":""}`,children:a.toFixed(4)}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:a<.1?"Stable":a<.2?"Minor drift":"Significant drift"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Me,{size:13})," Most Drifted"]}),e.jsx("div",{className:"text-lg font-bold truncate",title:n==null?void 0:n.column,children:(n==null?void 0:n.column)??"β€”"}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["PSI: ",i.toFixed(4)]})]})]})},Ct=[{key:"psi",label:"PSI",step:.05,min:.01,max:1},{key:"ks",label:"KS statistic",step:.01,min:.01,max:.5},{key:"wasserstein",label:"Wasserstein",step:.05,min:.01,max:1},{key:"kl",label:"KL Div",step:.05,min:.01,max:1}],Dt={psi:.2,ks:.1,wasserstein:.1,kl:.1},zt=({thresholds:t,onChange:s})=>e.jsxs("div",{className:"px-4 pb-3 flex flex-wrap items-center gap-4 border-t border-gray-100 dark:border-slate-700 pt-3",children:[e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-slate-400",children:"Thresholds:"}),Ct.map(({key:r,label:a,step:n,min:l,max:i})=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-slate-400",children:[e.jsx("span",{className:"font-medium",children:a}),e.jsx("input",{type:"number",value:t[r]??"",onChange:u=>s({...t,[r]:Number.parseFloat(u.target.value)||void 0}),step:n,min:l,max:i,className:"w-20 px-2 py-1 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500 tabular-nums"})]},r)),e.jsx("button",{onClick:()=>s(Dt),className:"text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:"Reset defaults"})]});function Rt(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(!1),p=x.useCallback(async()=>{if(t==null){r(null);return}n(!0),i(null);try{const g=await S.getDriftAlert(t);r(g)}catch{i("Failed to load drift alert detail.")}finally{n(!1)}},[t]);x.useEffect(()=>{p()},[p]);const h=x.useCallback(async(g,b,k)=>{var c,d;if(t==null)return null;m(!0),i(null);try{const o=await S.updateDriftAlertDisposition(t,g,b,k);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?(d=(c=o.response)==null?void 0:c.data)==null?void 0:d.detail:void 0;return i(f||`Failed to ${g} the drift alert.`),null}finally{m(!1)}},[t]);return{detail:s,loading:a,error:l,actionPending:u,refresh:p,applyDisposition:h}}function Lt(t){const[s,r]=x.useState([]),a=x.useCallback(()=>{if(!t){r([]);return}S.getDriftHistory(t).then(r).catch(()=>r([]))},[t]);x.useEffect(()=>{a()},[a]);const n=x.useMemo(()=>{if(s.length<2)return{};const l=[...s].reverse(),i={};for(const u of l)if(u.summary)for(const[m,p]of Object.entries(u.summary))i[m]||(i[m]=[]),i[m].push(p.psi??0);return i},[s]);return{driftHistory:s,columnSparklines:n,refreshHistory:a}}function Et(){const[t,s]=x.useState([]),[r,a]=x.useState(!1),n=x.useCallback(async()=>{a(!0);try{const i=await S.getJobs();s(i)}catch(i){console.error("Failed to fetch jobs",i)}finally{a(!1)}},[]);x.useEffect(()=>{n()},[n]);const l=x.useCallback(async(i,u)=>{try{await S.updateJobDescription(i,u),s(m=>m.map(p=>p.job_id===i?{...p,description:u}:p))}catch(m){console.error("Failed to save description",m)}},[]);return{jobs:t,refreshing:r,refresh:n,updateJobDescription:l}}function At(t,s){switch(t){case"psi":case"psi_categorical":return s.psi;case"ks_statistic":return s.ks;case"wasserstein_distance":return s.wasserstein;case"kl_divergence":return s.kl;default:return}}function Tt(t,s,r){let a=t.has_drift;const n=At(t.metric,r);if(n!=null&&(a=t.value>n),t.metric==="ks_test_p_value"){const l=s.metrics.find(i=>i.metric==="ks_statistic");l!=null&&(a=l.value>(r.ks??l.threshold))}return{...t,has_drift:a}}function Ft(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(null),p=x.useCallback(async({selectedJob:g,file:b,job:k,thresholds:c})=>{var d;n(!0),i(null),m(null);try{const o=await S.calculateDrift(g,b,k==null?void 0:k.dataset_name,c);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?o.response:void 0,y=(d=f==null?void 0:f.data)==null?void 0:d.detail;return i(y||"Failed to calculate drift."),m((f==null?void 0:f.status)===404?"no_baseline":"failed"),null}finally{n(!1)}},[]),h=x.useMemo(()=>{if(!s)return null;const g=t,b={};let k=0;for(const[d,o]of Object.entries(s.column_drifts)){const f=o.metrics.map(C=>Tt(C,o,g)),y=f.some(C=>C.has_drift);y&&k++,b[d]={...o,metrics:f,drift_detected:y}}const c=s.missing_columns.length+s.new_columns.length;return{...s,column_drifts:b,drifted_columns_count:k+c}},[s,t]);return{report:s,evaluatedReport:h,loading:a,error:l,errorKind:u,setError:i,calculate:p}}function $t(){const[t,s]=x.useState(null),r=x.useCallback(n=>{s(l=>(l==null?void 0:l.key)===n?l.dir==="asc"?{key:n,dir:"desc"}:null:{key:n,dir:"asc"})},[]),a=x.useCallback(()=>s(null),[]);return{sortConfig:t,handleSort:r,clearSort:a}}function Pt(t,s){const r=t.feature_importances,a=["Column","Status","Wasserstein","PSI","KL Divergence","KS Statistic","KS P-Value",...r?["Importance","Risk"]:[]],n=Object.values(t.column_drifts).map(p=>{const h=c=>{var d,o;return((o=(d=p.metrics.find(f=>f.metric===c))==null?void 0:d.value)==null?void 0:o.toFixed(6))??""},g=r==null?void 0:r[p.column],b=r?Object.values(r).filter(c=>c>(g??0)).length+1:null,k=p.drift_detected&&b!=null?b<=5?"High":b<=15?"Medium":"Low":r?"Low":"";return[p.column,p.drift_detected?"Drifted":"Stable",h("wasserstein_distance"),h("psi"),h("kl_divergence"),h("ks_statistic"),h("ks_test_p_value"),...r?[(g==null?void 0:g.toFixed(6))??"",k]:[]]}),l=[a,...n].map(p=>p.map(h=>`"${h}"`).join(",")).join(` +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{O as he,j as L,Q as ge,f as H,t as be,U as fe,C as ke,V as je,a as x,T,S as X,Y as ye,X as E,K as ve,b as I,e as F,z as Ne,_ as we,p as R,$ as _e,a0 as Se,a1 as Ce,a2 as B,a3 as De,a4 as ze,a5 as J,a6 as _,a7 as Re,a8 as Le,w as Ee,a9 as Ae,aa as Te,s as Fe,ab as $e,ac as Pe,ad as Me,D as Oe,c as Ke,ae as Ue}from"./vendor-utils-VkF_O5b_.js";import{R as A,b as He,C as Ie,M as Be,L as Ye,E as G,m as S,u as Ve}from"./index-BR7Y881F.js";import{R as Q,ag as We,C as Z,X as ee,Y as te,T as se,ah as re,ai as Y,B as qe,h as V}from"./vendor-charts-BkHP8M8k.js";import{F as W}from"./FormField-BaO1-ftW.js";const Xe={none:{label:"No drift",classes:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800"},warning:{label:"Warning",classes:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-800"},critical:{label:"Critical",classes:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800"}},ae=({severity:t})=>{const s=Xe[t],r=t==="critical"?he:t==="warning"?L:ge;return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:[e.jsx(r,{size:12,"aria-hidden":"true"}),s.label]})},Je={new:{label:"New",classes:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800"},acknowledged:{label:"Acknowledged",classes:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400 border-purple-200 dark:border-purple-800"},resolved:{label:"Resolved",classes:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700"},reopened:{label:"Reopened",classes:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400 border-orange-200 dark:border-orange-800"}},$=({status:t})=>{const s=Je[t];return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:s.label})};function Ge({detail:t,filters:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ae,{severity:t.severity}),e.jsx($,{status:t.status}),t.evaluation_status!=="completed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t.evaluation_status==="no_baseline"?"No baseline":"Evaluation failed"]})]}),t.evaluation_status!=="completed"&&t.error_message&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(H,{size:16,className:"shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:t.error_message})]}),e.jsx(Qe,{detail:t}),e.jsx(Ze,{detail:t,filters:s})]})}function Qe({detail:t}){var s;return e.jsxs("dl",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Detected"}),e.jsx("dd",{className:"font-medium",children:((s=t.created_at)==null?void 0:s.replace("T"," ").slice(0,16))??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Threshold version"}),e.jsxs("dd",{className:"font-medium",children:[t.threshold_version!=null?`v${t.threshold_version}`:"β€”",t.threshold_version!=null&&e.jsxs("span",{className:"block text-[11px] font-normal text-gray-400",children:["PSI ",t.threshold_psi," Β· KS ",t.threshold_ks," Β· Wasserstein"," ",t.threshold_wasserstein," Β· KL ",t.threshold_kl]})]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Drifted features"}),e.jsx("dd",{className:"font-medium",children:t.drifted_columns_count!=null&&t.total_columns!=null?`${t.drifted_columns_count} / ${t.total_columns}`:"β€”"})]})]})}function Ze({detail:t,filters:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsx(A,{recordRef:{kind:"job",jobId:t.job_id},origin:"/drift",filters:s}),t.model_version&&e.jsx(A,{recordRef:{kind:"modelVersion",jobId:t.job_id,version:t.model_version},origin:"/drift",filters:s}),t.deployment_id!=null&&e.jsx(A,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},origin:"/drift",filters:s})]})}function et({alertId:t,evaluationStatus:s,evidenceRows:r}){return s!=="completed"?null:e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Feature evidence"}),r.length===0?e.jsx(He,{title:"No evidence recorded",description:"This alert has no retained per-feature drift evidence."}):e.jsx(Ie,{caption:`Per-feature drift evidence for alert #${t??""}`,filename:`drift-alert-${t??"unknown"}-evidence`,columns:[{key:"column",label:"Feature"},{key:"drifted",label:"Drifted"},{key:"psi",label:"PSI"},{key:"wasserstein",label:"Wasserstein"},{key:"ks_statistic",label:"KS statistic"},{key:"ks_p_value",label:"KS p-value"}],rows:r,defaultOpen:!0})]})}function tt({entries:t}){return e.jsxs(e.Fragment,{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(be,{size:12})," History"]}),t.length===0?e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No disposition changes recorded yet."}):e.jsx("ul",{className:"space-y-1.5",children:t.map((s,r)=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx($,{status:s.status}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{size:11})," ",s.actor]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(ke,{size:11})," ",s.at.replace("T"," ").slice(0,16)]}),s.note&&e.jsxs("span",{className:"italic",children:['"',s.note,'"']})]},r))})]})}const q={new:["acknowledge"],acknowledged:["resolve","reopen"],resolved:["reopen"],reopened:["acknowledge"]},st={acknowledge:"Acknowledge",resolve:"Resolve",reopen:"Reopen"};function rt({detail:t,actor:s,note:r,actionError:a,error:n,actionPending:l,setActor:i,setNote:u,handleAction:m}){return e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(je,{size:13})," Disposition"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:t.owner?e.jsxs(e.Fragment,{children:["Currently ",e.jsx("strong",{children:t.status})," by ",e.jsx("strong",{children:t.owner}),"."]}):e.jsx(e.Fragment,{children:"No disposition recorded yet β€” acknowledge to claim this alert."})}),(q[t.status]??[]).length>0&&e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e.jsx(W,{label:"Your name",required:!0,children:p=>e.jsx("input",{...p,type:"text",value:s,onChange:h=>i(h.target.value),placeholder:"e.g. alice",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})}),e.jsx(W,{label:"Note",hint:"Optional context for the audit trail",children:p=>e.jsx("input",{...p,type:"text",value:r,onChange:h=>u(h.target.value),placeholder:"Optional",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})})]}),a&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:a}),n&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:n}),e.jsx("div",{className:"flex gap-2",children:(q[t.status]??[]).map(p=>e.jsx("button",{type:"button",disabled:l,onClick:()=>void m(p),className:"px-3 py-1.5 text-sm font-medium rounded-md action-primary disabled:opacity-50 disabled:cursor-not-allowed",children:st[p]},p))})]}),e.jsx(tt,{entries:t.disposition_history})]})}function at(t){return t!=null&&t.column_drifts?Object.entries(t.column_drifts).map(([s,r])=>{const a=Object.fromEntries(r.metrics.map(n=>[n.metric,n.value]));return{column:s,drifted:r.drift_detected?"Yes":"No",psi:a.psi!=null?Number(a.psi.toFixed(4)):null,wasserstein:a.wasserstein_distance!=null?Number(a.wasserstein_distance.toFixed(4)):null,ks_statistic:a.ks_statistic!=null?Number(a.ks_statistic.toFixed(4)):null,ks_p_value:a.ks_test_p_value!=null?Number(a.ks_test_p_value.toFixed(4)):null}}):[]}const nt=({alertId:t,detail:s,loading:r,error:a,actionPending:n,onApplyDisposition:l,onRetry:i,onClose:u,filters:m})=>{const[p,h]=x.useState(""),[g,b]=x.useState(""),[k,c]=x.useState(null),d=async f=>{if(!p.trim()){c("Enter your name so the disposition records who made it.");return}c(null),await l(f,p.trim(),g.trim()||void 0)&&b("")},o=at(s);return e.jsxs(Be,{isOpen:t!==null,onClose:u,title:t!==null?`Drift alert #${t}`:void 0,size:"3xl",children:[r&&e.jsx(Ye,{message:"Loading drift alert…"}),!r&&a&&!s&&e.jsx(G,{error:a,onRetry:i}),!r&&s&&e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsx(Ge,{detail:s,filters:m}),e.jsx(et,{alertId:t,evaluationStatus:s.evaluation_status,evidenceRows:o}),e.jsx(rt,{detail:s,actor:p,note:g,actionError:k,error:a,actionPending:n,setActor:h,setNote:b,handleAction:d})]})]})},lt=({history:t,onInvestigate:s})=>t.length===0?null:e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(T,{size:18})," Alert History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-slate-700",children:[e.jsx("th",{className:"px-4 py-2 font-medium",children:"Detected"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Severity"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Evaluation"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Threshold"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Owner"}),e.jsx("th",{className:"px-4 py-2 font-medium sr-only",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(r=>{var a;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-slate-700/60 last:border-0",children:[e.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:((a=r.created_at)==null?void 0:a.replace("T"," ").slice(0,16))??"Unknown"}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(ae,{severity:r.severity})}),e.jsx("td",{className:"px-4 py-2",children:e.jsx($,{status:r.status})}),e.jsx("td",{className:"px-4 py-2 capitalize",children:r.evaluation_status.replace("_"," ")}),e.jsx("td",{className:"px-4 py-2",children:r.threshold_version!=null?`v${r.threshold_version}`:"β€”"}),e.jsx("td",{className:"px-4 py-2",children:r.owner??"β€”"}),e.jsx("td",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>s(r.id),className:"inline-flex items-center gap-1 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 text-xs font-medium",children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Investigate"]})})]},r.id)})})]})})]}),it=({showOnlyDrifted:t,onToggleDrifted:s,sortConfig:r,onClearSort:a,onExport:n})=>e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:s,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors border ${t?"bg-red-50 dark:bg-red-900/30 border-red-200 dark:border-red-700 text-red-700 dark:text-red-300":"border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:[e.jsx(ye,{size:12}),t?"Showing drifted only":"Show only drifted"]}),r&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-xs text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:[e.jsx(E,{size:11})," Clear sort"]}),e.jsx("div",{className:"ml-auto",children:e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium border border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors",title:"Download drift report as CSV",children:[e.jsx(ve,{size:12})," Export CSV"]})})]}),ot=({history:t})=>{if(t.length<=1)return null;const s=[...t].reverse().map(r=>{var l;const a=r.summary?Object.values(r.summary):null,n=a?a.filter(i=>i.drifted).length:null;return{date:((l=r.created_at)==null?void 0:l.split("T")[0])??"",drifted:n,pct:a!=null&&a.length?Math.round((n??0)/a.length*100):null}});return e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(T,{size:18})," Drift History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]}),e.jsx("div",{className:"h-[280px]",children:e.jsx(Q,{width:"100%",height:"100%",children:e.jsxs(We,{data:s,margin:{top:5,right:30,left:0,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:"date",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:!1}),e.jsx(se,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(r,a)=>a==="Drifted Features"?[r,a]:a==="Drift %"?[`${r}%`,a]:[r,a]}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(Y,{type:"monotone",dataKey:"drifted",name:"Drifted Features",stroke:"#ef4444",strokeWidth:2,dot:{r:3,fill:"#ef4444"}}),e.jsx(Y,{type:"monotone",dataKey:"pct",name:"Drift %",stroke:"#f59e0b",strokeWidth:2,dot:{r:3,fill:"#f59e0b"},strokeDasharray:"5 5"})]})})})]})},D=({label:t,tooltip:s,icon:r})=>e.jsxs("div",{className:"group relative flex items-center gap-1 cursor-help",children:[e.jsx("span",{className:"border-b border-dotted border-gray-400",children:t}),r&&e.jsx("span",{className:"text-gray-400",children:r}),e.jsxs("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 w-64 p-2 bg-slate-900 text-white text-xs rounded shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 text-center pointer-events-none",children:[s,e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 -mb-1 border-4 border-transparent border-b-slate-900"})]})]}),dt=({values:t,width:s=64,height:r=20})=>{if(t.length<2)return e.jsx("span",{className:"text-[10px] text-gray-400",children:"β€”"});const a=Math.min(...t),l=Math.max(...t)-a||1,i=t.map((h,g)=>{const b=g/(t.length-1)*s,k=r-(h-a)/l*(r-4)-2;return`${b},${k}`}).join(" "),u=t[t.length-1]??0,m=u>.2?"#ef4444":u>.1?"#f59e0b":"#22c55e",p=r-(u-a)/l*(r-4)-2;return e.jsxs("svg",{width:s,height:r,className:"inline-block",children:[e.jsx("polyline",{points:i,fill:"none",stroke:m,strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("circle",{cx:s,cy:p,r:"2",fill:m})]})},ct={wasserstein:"wasserstein_distance",psi:"psi",kl:"kl_divergence",ks:"ks_statistic"},xt=(t,s,r)=>{const a=(n,l)=>{var i;return((i=n.metrics.find(u=>u.metric===l||l==="psi"&&u.metric==="psi_categorical"))==null?void 0:i.value)??0};return[...t].sort((n,l)=>{let i=0;switch(s.key){case"column":i=n.column.localeCompare(l.column);break;case"status":i=(n.drift_detected?1:0)-(l.drift_detected?1:0);break;case"risk":i=((r==null?void 0:r[n.column])??0)-((r==null?void 0:r[l.column])??0);break;default:{const u=ct[s.key];u&&(i=a(n,u)-a(l,u))}}return s.dir==="asc"?i:-i})};function ut(t,s,r){let a=Object.values(t.column_drifts);return s&&(a=a.filter(n=>n.drift_detected)),r&&(a=xt(a,r,t.feature_importances)),a}const mt=({active:t,dir:s})=>t?s==="asc"?e.jsx(Se,{size:11}):e.jsx(Ce,{size:11}):e.jsx(_e,{size:11,className:"opacity-30"}),pt=({distribution:t})=>e.jsxs("div",{className:"h-[350px] w-full bg-white dark:bg-slate-800 p-6 rounded border dark:border-slate-700 shadow-sm",children:[e.jsxs("h4",{className:"text-sm font-semibold mb-6 flex items-center gap-2 text-slate-700 dark:text-slate-300",children:[e.jsx(J,{size:16})," Distribution Comparison"]}),e.jsx(Q,{width:"100%",height:"85%",children:e.jsxs(qe,{data:t.bins,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:s=>`${s.bin_start.toFixed(2)}`,className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:!1}),e.jsx(se,{cursor:{fill:"rgba(0,0,0,0.05)"},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))",marginBottom:"0.5rem"}}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(V,{dataKey:"reference_count",name:"Reference (Training)",fill:"#94a3b8",radius:[4,4,0,0],barSize:30}),e.jsx(V,{dataKey:"current_count",name:"Current (Production)",fill:"#3b82f6",radius:[4,4,0,0],barSize:30})]})})]}),ht=({importance:t,rank:s,drifted:r,maxImportance:a})=>{if(t==null)return e.jsx("span",{className:"text-xs text-gray-400",children:"β€”"});const n=r&&s!=null&&s<=5,l=r&&s!=null&&s<=15&&!n;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[n?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300",children:[e.jsx(B,{size:12})," High"]}):l?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300",children:[e.jsx(B,{size:12})," Medium"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:[e.jsx(De,{size:12})," Low"]}),e.jsx("div",{className:"w-12 h-1.5 bg-gray-200 dark:bg-slate-700 rounded-full overflow-hidden",title:`Importance: ${(t*100/a).toFixed(0)}%`,children:e.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${a>0?t/a*100:0}%`}})})]})};function z({metric:t,showRawDistance:s=!1}){var a;const r=s&&(t==null?void 0:t.raw_value)!=null?`Raw earth-mover distance: ${t.raw_value.toFixed(4)} in column units`:void 0;return e.jsx("td",{className:`px-6 py-4 whitespace-nowrap tabular-nums ${t!=null&&t.has_drift?"text-red-600 dark:text-red-400 font-bold":""}`,title:r,children:((a=t==null?void 0:t.value)==null?void 0:a.toFixed(4))??"β€”"})}function gt({col:t,ks:s,ksPValue:r}){return e.jsxs("div",{className:"flex flex-col gap-4",children:[s&&e.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400",children:["KS statistic"," ",e.jsx("span",{className:"font-semibold tabular-nums",children:s.value.toFixed(4)})," ","vs threshold ",s.threshold.toFixed(2),r&&e.jsxs(e.Fragment,{children:[" ","Β· p-value"," ",e.jsx("span",{className:"tabular-nums",children:r.value<.001?"< 0.001":r.value.toFixed(3)})," ","(diagnostic only β€” drift is decided on the statistic)"]})]}),t.suggestions&&t.suggestions.length>0&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ze,{size:16,className:"mt-0.5 shrink-0 text-yellow-600 dark:text-yellow-400"}),e.jsx("ul",{className:"list-disc list-inside text-sm text-yellow-800 dark:text-yellow-200",children:t.suggestions.map((a,n)=>e.jsx("li",{children:a},n))})]})}),t.distribution&&e.jsx(pt,{distribution:t.distribution})]})}function bt({col:t,fi:s,isExpanded:r,maxImportance:a,toggleRow:n,hasSparklines:l,columnSparklines:i,colSpan:u}){const m=t.metrics.find(d=>d.metric==="wasserstein_distance"),p=t.metrics.find(d=>d.metric==="psi"||d.metric==="psi_categorical"),h=t.metrics.find(d=>d.metric==="kl_divergence"),g=t.metrics.find(d=>d.metric==="ks_statistic"),b=t.metrics.find(d=>d.metric==="ks_test_p_value"),k=s==null?void 0:s[t.column],c=s?Object.values(s).filter(d=>d>(k??0)).length+1:null;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:t.drift_detected?"bg-red-50 dark:bg-red-900/10":"",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap font-medium",children:t.column}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.drift_detected?e.jsxs("span",{className:"text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(Ne,{size:16})," Drifted"]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(F,{size:16})," Stable"]})}),e.jsx(z,{metric:m,showRawDistance:!0}),e.jsx(z,{metric:p}),e.jsx(z,{metric:h}),e.jsx(z,{metric:g}),s&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(ht,{importance:k,rank:c,drifted:t.drift_detected,maxImportance:a})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("button",{onClick:()=>n(t.column),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 flex items-center gap-1 text-sm",children:[r?e.jsx(we,{size:16}):e.jsx(R,{size:16}),r?"Hide":"Details"]})}),l&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(dt,{values:i[t.column]??[]})})]}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:u,className:"px-6 py-4 bg-gray-50 dark:bg-slate-900/50",children:e.jsx(gt,{col:t,ks:g,ksPValue:b})})})]})}const ft=({report:t,showOnlyDrifted:s,sortConfig:r,onSort:a,columnSparklines:n})=>{const[l,i]=x.useState({});I.useEffect(()=>{i({})},[t]),I.useEffect(()=>{const d=o=>{o.key==="Escape"&&i({})};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const u=d=>i(o=>({...o,[d]:!o[d]})),m=t.feature_importances,p=m?Math.max(...Object.values(m)):0,h=Object.keys(n).length>0,g=ut(t,s,r),b=(m?8:7)+(h?1:0),k=t.missing_columns.length>0||t.new_columns.length>0,c=(d,o)=>e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer select-none hover:text-gray-700 dark:hover:text-slate-300",onClick:()=>a(d),children:e.jsxs("span",{className:"flex items-center gap-1",children:[o,e.jsx(mt,{active:(r==null?void 0:r.key)===d,dir:r==null?void 0:r.dir})]})});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-slate-900",children:e.jsxs("tr",{children:[c("column","Column"),c("status","Status"),c("wasserstein",e.jsx(D,{label:"Wasserstein",tooltip:"Measures distance between distributions, normalized by the reference column's standard deviation so the threshold is scale-free. Lower is better. < 0.1 usually means stable.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("psi",e.jsx(D,{label:"PSI",tooltip:"Population Stability Index. < 0.1: Stable, < 0.2: Minor Drift, > 0.2: Significant Drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("kl",e.jsx(D,{label:"KL Div",tooltip:"Kullback-Leibler Divergence. Measures how one probability distribution diverts from a second.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("ks",e.jsx(D,{label:"KS Stat",tooltip:"Kolmogorov-Smirnov statistic β€” maximum distance between the two cumulative distributions (0–1). Unlike the p-value it does not shrink with sample size; values above the threshold (default 0.1) indicate drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),m&&c("risk",e.jsx(D,{label:"Risk",tooltip:"Combines drift status with feature importance. High = drifted + important feature. Helps prioritize which drifts to investigate.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"}),h&&e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{size:11})," Trend"]})})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-gray-200 dark:divide-slate-700",children:g.length===0&&s?e.jsx("tr",{children:e.jsxs("td",{colSpan:b,className:"px-6 py-8 text-center text-gray-500 dark:text-slate-400 text-sm",children:[e.jsx(F,{size:20,className:"inline mr-2 text-green-500"}),k?"No distribution drift among shared columns β€” see the schema drift above.":"No drifted columns found β€” all features are stable."]})}):g.map(d=>e.jsx(bt,{col:d,fi:m,isExpanded:l[d.column],maxImportance:p,toggleRow:u,hasSparklines:h,columnSparklines:n,colSpan:b},d.column))})]})})},kt=()=>e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-gray-500 dark:text-slate-400",children:[e.jsx(Re,{size:48,strokeWidth:1.2}),e.jsx("h2",{className:"text-lg font-medium text-gray-500 dark:text-slate-400",children:"No Drift Report Yet"}),e.jsxs("p",{className:"text-sm max-w-md",children:["Select a reference model from the dropdown above, upload current production data (CSV or Parquet), and click ",e.jsx("strong",{children:"Run Analysis"})," to compare distributions."]})]})}),jt=({file:t,onFileChange:s,invalid:r})=>{const a=x.useRef(null),n=l=>{l.target.files&&l.target.files[0]&&s(l.target.files[0])};return e.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("input",{ref:a,type:"file",className:"hidden",onChange:n,accept:".csv,.parquet","aria-label":"Upload current data file (CSV or Parquet)"}),t?e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2.5 border border-gray-200 dark:border-slate-600 rounded-md text-sm bg-gray-50 dark:bg-slate-900",children:[e.jsx(Le,{size:14,className:"text-green-500 shrink-0"}),e.jsx("span",{className:"text-slate-700 dark:text-slate-300 truncate max-w-[180px]",children:t.name}),e.jsx("button",{type:"button",onClick:()=>s(null),"aria-label":`Remove ${t.name}`,className:"text-gray-400 hover:text-red-500 transition-colors ml-1",children:e.jsx(E,{size:14})})]}):e.jsxs("button",{type:"button",onClick:()=>{var l;return(l=a.current)==null?void 0:l.click()},"aria-describedby":r?"file-uploader-error":void 0,className:`flex items-center gap-2 px-3 py-2.5 border border-dashed rounded-md text-sm transition-colors ${r?"border-red-400 dark:border-red-500 text-red-600 dark:text-red-400 hover:border-red-500":"border-gray-300 dark:border-slate-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-500 dark:hover:border-blue-500"}`,children:[e.jsx(Ee,{size:15}),"Upload CSV / Parquet"]})]}),r&&!t&&e.jsx("span",{id:"file-uploader-error",className:"text-[11px] text-red-600 dark:text-red-400",children:"Current data file is required."})]})};function yt({triggerRef:t,open:s,listboxId:r,invalid:a,selectedJob:n,selectedJobData:l,onSelect:i,onToggle:u}){return e.jsxs("button",{ref:t,type:"button","aria-haspopup":"listbox","aria-expanded":s,"aria-controls":r,onClick:()=>{u()},className:`w-full flex items-center gap-2 px-3 py-2.5 border rounded-md text-sm transition-colors ${a?"border-red-400 dark:border-red-500 hover:border-red-500":n?"border-blue-300 dark:border-blue-700 bg-blue-50/50 dark:bg-blue-900/20":"border-gray-200 dark:border-slate-600 hover:border-gray-300 dark:hover:border-slate-500"}`,"aria-describedby":a?"job-selector-error":void 0,children:[e.jsx(Ae,{size:15,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:`truncate ${n?"text-slate-800 dark:text-slate-200":"text-gray-400"}`,children:l?`${l.dataset_name} (${l.job_id.slice(0,8)})`:"Select reference model..."}),n&&e.jsx("span",{role:"button",tabIndex:0,"aria-label":"Clear selected reference model",title:"Clear selection",onClick:m=>{m.stopPropagation(),i("")},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),m.preventDefault(),i(""))},className:"ml-auto shrink-0 p-0.5 rounded hover:bg-black/5 dark:hover:bg-white/10 text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:e.jsx(E,{size:13})}),e.jsx(R,{size:14,className:`${n?"":"ml-auto"} shrink-0 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})}const vt=({jobs:t,selectedJob:s,onSelect:r,invalid:a})=>{const[n,l]=x.useState(!1),[i,u]=x.useState(""),m=x.useRef(null),p=x.useRef(null),h="job-selector-listbox";x.useEffect(()=>{const c=d=>{m.current&&!m.current.contains(d.target)&&l(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),x.useEffect(()=>{if(!n)return;const c=d=>{var o;d.key==="Escape"&&(l(!1),(o=p.current)==null||o.focus())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n]);const g=x.useMemo(()=>{if(!i)return t;const c=i.toLowerCase();return t.filter(d=>{var o,f,y;return d.dataset_name.toLowerCase().includes(c)||d.job_id.toLowerCase().includes(c)||((o=d.description)==null?void 0:o.toLowerCase().includes(c))||((f=d.model_type)==null?void 0:f.toLowerCase().includes(c))||((y=d.target_column)==null?void 0:y.toLowerCase().includes(c))})},[i,t]),b=x.useMemo(()=>{var d;const c={};for(const o of g){const f=((d=o.created_at)==null?void 0:d.split(" ")[0])||"Unknown";c[f]||(c[f]=[]),c[f].push(o)}return Object.entries(c).sort(([o],[f])=>f.localeCompare(o))},[g]),k=x.useMemo(()=>t.find(c=>c.job_id===s),[t,s]);return e.jsxs("div",{ref:m,className:"relative flex-1 min-w-0",children:[e.jsx(yt,{triggerRef:p,open:n,listboxId:h,invalid:a,selectedJob:s,selectedJobData:k,onSelect:r,onToggle:()=>{l(!n),u("")}}),a&&!s&&e.jsx("span",{id:"job-selector-error",className:"block mt-1 text-[11px] text-red-600 dark:text-red-400",children:"Reference job is required."}),n&&e.jsxs("div",{id:h,role:"listbox","aria-label":"Reference model jobs",className:"absolute z-50 left-0 right-0 mt-1 bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-600 rounded-md shadow-lg overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-slate-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none z-10",size:14}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Search jobs...",value:i,onChange:c=>u(c.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-200 dark:border-slate-600 rounded bg-gray-50 dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:g.length===0?e.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"No jobs found"}):b.map(([c,d])=>e.jsxs("div",{children:[e.jsx("div",{className:"sticky top-0 px-3 py-1.5 text-[11px] font-semibold text-gray-500 dark:text-slate-400 bg-gray-50 dark:bg-slate-900/80 uppercase tracking-wider border-b border-gray-100 dark:border-slate-700",children:c}),d.map(o=>e.jsxs("button",{type:"button",role:"option","aria-selected":s===o.job_id,onClick:()=>{r(o.job_id),l(!1)},className:`w-full text-left px-3 py-2.5 text-sm transition-colors ${s===o.job_id?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-slate-700/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:o.dataset_name}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono shrink-0",children:o.job_id.slice(0,8)}),o.model_type&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-300 shrink-0",children:o.model_type}),o.best_metric&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-300 shrink-0 ml-auto tabular-nums truncate max-w-[140px]",title:o.best_metric,children:o.best_metric.split(" | ")[0]})]}),(o.target_column||o.description)&&e.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-[11px] text-gray-500 dark:text-slate-400",children:[o.target_column&&e.jsxs("span",{children:["target: ",o.target_column]}),o.description&&e.jsxs("span",{className:"truncate italic",children:["β€” ",o.description]})]})]},o.job_id))]},c))})]})]})},Nt=({missingColumns:t,newColumns:s})=>{const r=t.filter(n=>n.trim()!==""),a=s.filter(n=>n.trim()!=="");return r.length===0&&a.length===0?null:e.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.length>0&&e.jsxs("details",{className:"group bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[e.jsxs("summary",{className:"font-semibold text-red-800 dark:text-red-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(L,{size:16,className:"shrink-0"})," Missing Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-red-200 dark:bg-red-800 px-2 py-0.5 rounded-full",children:r.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-red-600/70 dark:text-red-300/60 mb-2",children:"Columns present in reference (training) data but missing from your uploaded file."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:r.map(n=>e.jsx("li",{children:n},n))})]})]}),a.length>0&&e.jsxs("details",{className:"group bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800",children:[e.jsxs("summary",{className:"font-semibold text-blue-800 dark:text-blue-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(_,{size:16,className:"shrink-0"})," Extra Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-blue-200 dark:bg-blue-800 px-2 py-0.5 rounded-full",children:a.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-blue-600/70 dark:text-blue-300/60 mb-2",children:"Columns in your uploaded file that were not in the training reference. These are excluded from distribution metrics but reported as schema changes. The model target is excluded from both checks."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-blue-700 dark:text-blue-300",children:a.map(n=>e.jsx("li",{children:n},n))})]})]})]})},wt=({job:t,onUpdateDescription:s})=>{const[r,a]=x.useState(!1),[n,l]=x.useState("");x.useEffect(()=>{a(!1)},[t.job_id]);const i=async()=>{await s(n),a(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-3 text-xs text-gray-500 dark:text-slate-400",children:[t.model_type&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-indigo-50 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-300 font-medium",children:t.model_type}),t.target_column&&e.jsxs("span",{children:["Target:"," ",e.jsx("span",{className:"font-medium text-slate-600 dark:text-slate-300",children:t.target_column})]}),t.n_features!=null&&e.jsxs("span",{children:[t.n_features," features"]}),t.n_rows!=null&&e.jsxs("span",{children:[t.n_rows.toLocaleString()," rows"]}),t.best_metric&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-green-50 dark:bg-green-900/30 text-green-600 dark:text-green-300 font-medium tabular-nums",children:t.best_metric}),e.jsx("span",{className:"border-l border-gray-200 dark:border-slate-700 h-3"}),r?e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[e.jsx("input",{autoFocus:!0,value:n,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&a(!1)},placeholder:"Add a description...",className:"flex-1 min-w-0 px-2 py-0.5 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>void i(),className:"text-green-500 hover:text-green-600",children:e.jsx(Te,{size:13})}),e.jsx("button",{onClick:()=>a(!1),className:"text-gray-400 hover:text-red-500",children:e.jsx(E,{size:13})})]}):e.jsxs("button",{onClick:()=>{l(t.description||""),a(!0)},className:"flex items-center gap-1 hover:text-blue-500 transition-colors group",children:[e.jsx(Fe,{size:11,className:"opacity-50 group-hover:opacity-100"}),e.jsx("span",{className:t.description?"":"italic text-gray-400",children:t.description||"Add description..."})]})]})};function _t(t){var p;const s=Object.values(t.column_drifts),r=s.length,a=s.filter(h=>h.drift_detected).length,n=s.map(h=>{var g;return(g=h.metrics.find(b=>b.metric==="psi"))==null?void 0:g.value}).filter(h=>h!=null),l=n.length>0?n.reduce((h,g)=>h+g,0)/n.length:0,i=[...s].sort((h,g)=>{var c,d;const b=((c=h.metrics.find(o=>o.metric==="psi"))==null?void 0:c.value)??0;return(((d=g.metrics.find(o=>o.metric==="psi"))==null?void 0:d.value)??0)-b})[0],u=r>0?Math.round(a/r*100):0,m=((p=i==null?void 0:i.metrics.find(h=>h.metric==="psi"))==null?void 0:p.value)??0;return{totalCols:r,driftedCount:a,avgPsi:l,mostDrifted:i,driftedPct:u,mostDriftedPsi:m}}const St=({report:t})=>{const{totalCols:s,driftedCount:r,avgPsi:a,mostDrifted:n,driftedPct:l,mostDriftedPsi:i}=_t(t);return e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx($e,{size:13})," Total Columns"]}),e.jsx("div",{className:"text-2xl font-bold tabular-nums",children:s}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["Ref: ",t.reference_rows.toLocaleString()," rows | Cur: ",t.current_rows.toLocaleString()," rows"]})]}),e.jsxs("div",{className:`rounded-lg p-4 border ${r>0?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[r>0?e.jsx(L,{size:13}):e.jsx(F,{size:13})," Drifted"]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums",children:[r," ",e.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["/ ",s]})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[l,"% of features"]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Pe,{size:13})," Avg PSI"]}),e.jsx("div",{className:`text-2xl font-bold tabular-nums ${a>.2?"text-red-600 dark:text-red-400":a>.1?"text-amber-600 dark:text-amber-400":""}`,children:a.toFixed(4)}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:a<.1?"Stable":a<.2?"Minor drift":"Significant drift"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Me,{size:13})," Most Drifted"]}),e.jsx("div",{className:"text-lg font-bold truncate",title:n==null?void 0:n.column,children:(n==null?void 0:n.column)??"β€”"}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["PSI: ",i.toFixed(4)]})]})]})},Ct=[{key:"psi",label:"PSI",step:.05,min:.01,max:1},{key:"ks",label:"KS statistic",step:.01,min:.01,max:.5},{key:"wasserstein",label:"Wasserstein",step:.05,min:.01,max:1},{key:"kl",label:"KL Div",step:.05,min:.01,max:1}],Dt={psi:.2,ks:.1,wasserstein:.1,kl:.1},zt=({thresholds:t,onChange:s})=>e.jsxs("div",{className:"px-4 pb-3 flex flex-wrap items-center gap-4 border-t border-gray-100 dark:border-slate-700 pt-3",children:[e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-slate-400",children:"Thresholds:"}),Ct.map(({key:r,label:a,step:n,min:l,max:i})=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-slate-400",children:[e.jsx("span",{className:"font-medium",children:a}),e.jsx("input",{type:"number",value:t[r]??"",onChange:u=>s({...t,[r]:Number.parseFloat(u.target.value)||void 0}),step:n,min:l,max:i,className:"w-20 px-2 py-1 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500 tabular-nums"})]},r)),e.jsx("button",{onClick:()=>s(Dt),className:"text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:"Reset defaults"})]});function Rt(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(!1),p=x.useCallback(async()=>{if(t==null){r(null);return}n(!0),i(null);try{const g=await S.getDriftAlert(t);r(g)}catch{i("Failed to load drift alert detail.")}finally{n(!1)}},[t]);x.useEffect(()=>{p()},[p]);const h=x.useCallback(async(g,b,k)=>{var c,d;if(t==null)return null;m(!0),i(null);try{const o=await S.updateDriftAlertDisposition(t,g,b,k);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?(d=(c=o.response)==null?void 0:c.data)==null?void 0:d.detail:void 0;return i(f||`Failed to ${g} the drift alert.`),null}finally{m(!1)}},[t]);return{detail:s,loading:a,error:l,actionPending:u,refresh:p,applyDisposition:h}}function Lt(t){const[s,r]=x.useState([]),a=x.useCallback(()=>{if(!t){r([]);return}S.getDriftHistory(t).then(r).catch(()=>r([]))},[t]);x.useEffect(()=>{a()},[a]);const n=x.useMemo(()=>{if(s.length<2)return{};const l=[...s].reverse(),i={};for(const u of l)if(u.summary)for(const[m,p]of Object.entries(u.summary))i[m]||(i[m]=[]),i[m].push(p.psi??0);return i},[s]);return{driftHistory:s,columnSparklines:n,refreshHistory:a}}function Et(){const[t,s]=x.useState([]),[r,a]=x.useState(!1),n=x.useCallback(async()=>{a(!0);try{const i=await S.getJobs();s(i)}catch(i){console.error("Failed to fetch jobs",i)}finally{a(!1)}},[]);x.useEffect(()=>{n()},[n]);const l=x.useCallback(async(i,u)=>{try{await S.updateJobDescription(i,u),s(m=>m.map(p=>p.job_id===i?{...p,description:u}:p))}catch(m){console.error("Failed to save description",m)}},[]);return{jobs:t,refreshing:r,refresh:n,updateJobDescription:l}}function At(t,s){switch(t){case"psi":case"psi_categorical":return s.psi;case"ks_statistic":return s.ks;case"wasserstein_distance":return s.wasserstein;case"kl_divergence":return s.kl;default:return}}function Tt(t,s,r){let a=t.has_drift;const n=At(t.metric,r);if(n!=null&&(a=t.value>n),t.metric==="ks_test_p_value"){const l=s.metrics.find(i=>i.metric==="ks_statistic");l!=null&&(a=l.value>(r.ks??l.threshold))}return{...t,has_drift:a}}function Ft(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(null),p=x.useCallback(async({selectedJob:g,file:b,job:k,thresholds:c})=>{var d;n(!0),i(null),m(null);try{const o=await S.calculateDrift(g,b,k==null?void 0:k.dataset_name,c);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?o.response:void 0,y=(d=f==null?void 0:f.data)==null?void 0:d.detail;return i(y||"Failed to calculate drift."),m((f==null?void 0:f.status)===404?"no_baseline":"failed"),null}finally{n(!1)}},[]),h=x.useMemo(()=>{if(!s)return null;const g=t,b={};let k=0;for(const[d,o]of Object.entries(s.column_drifts)){const f=o.metrics.map(C=>Tt(C,o,g)),y=f.some(C=>C.has_drift);y&&k++,b[d]={...o,metrics:f,drift_detected:y}}const c=s.missing_columns.length+s.new_columns.length;return{...s,column_drifts:b,drifted_columns_count:k+c}},[s,t]);return{report:s,evaluatedReport:h,loading:a,error:l,errorKind:u,setError:i,calculate:p}}function $t(){const[t,s]=x.useState(null),r=x.useCallback(n=>{s(l=>(l==null?void 0:l.key)===n?l.dir==="asc"?{key:n,dir:"desc"}:null:{key:n,dir:"asc"})},[]),a=x.useCallback(()=>s(null),[]);return{sortConfig:t,handleSort:r,clearSort:a}}function Pt(t,s){const r=t.feature_importances,a=["Column","Status","Wasserstein","PSI","KL Divergence","KS Statistic","KS P-Value",...r?["Importance","Risk"]:[]],n=Object.values(t.column_drifts).map(p=>{const h=c=>{var d,o;return((o=(d=p.metrics.find(f=>f.metric===c))==null?void 0:d.value)==null?void 0:o.toFixed(6))??""},g=r==null?void 0:r[p.column],b=r?Object.values(r).filter(c=>c>(g??0)).length+1:null,k=p.drift_detected&&b!=null?b<=5?"High":b<=15?"Medium":"Low":r?"Low":"";return[p.column,p.drift_detected?"Drifted":"Stable",h("wasserstein_distance"),h("psi"),h("kl_divergence"),h("ks_statistic"),h("ks_test_p_value"),...r?[(g==null?void 0:g.toFixed(6))??"",k]:[]]}),l=[a,...n].map(p=>p.map(h=>`"${h}"`).join(",")).join(` `),i=new Blob([l],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(i),m=document.createElement("a");m.href=u,m.download=`drift_report_${s??"export"}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),URL.revokeObjectURL(u)}const Mt={psi:.2,ks:.1,wasserstein:.1,kl:.1};function Ot({jobs:t,selectedJob:s,setSelectedJob:r,file:a,setFile:n,submitAttempted:l,loading:i,refreshing:u,showThresholds:m,onCalculate:p,onRefresh:h,onToggleThresholds:g}){return e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3 p-4",children:[e.jsx(vt,{jobs:t,selectedJob:s,onSelect:r,invalid:l&&!s}),e.jsx(jt,{file:a,onFileChange:n,invalid:l&&!a}),e.jsxs("button",{onClick:p,disabled:i||!s||!a,className:"flex items-center justify-center gap-2 px-5 py-2.5 action-primary rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors shrink-0",children:[i?e.jsx(Oe,{className:"animate-spin",size:16}):e.jsx(J,{size:16}),i?"Analyzing...":"Run Analysis"]}),e.jsx("button",{onClick:h,className:"p-2.5 rounded-md hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400 transition-colors shrink-0",title:"Refresh jobs",children:e.jsx(Ke,{size:16,className:u?"animate-spin":""})}),e.jsx("button",{onClick:g,className:`p-2.5 rounded-md transition-colors shrink-0 ${m?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400"}`,title:"Drift thresholds",children:e.jsx(Ue,{size:16})})]})}function Kt({error:t,errorKind:s,onRetry:r}){return e.jsxs(e.Fragment,{children:[t&&s&&e.jsx("div",{className:"mx-4 mb-4",children:e.jsx(G,{error:s==="no_baseline"?`No baseline reference is available for this job yet. ${t}`:t,onRetry:r})}),t&&!s&&e.jsxs("div",{className:"mx-4 mb-4 p-3 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-200 rounded-md flex items-center gap-2 border border-red-200 dark:border-red-800 text-sm",children:[e.jsx(L,{size:16,className:"shrink-0"}),t]})]})}const Vt=()=>{const[t,s]=Ve(),r=Number(t.get("investigate")),[a,n]=x.useState(""),[l,i]=x.useState(null),[u,m]=x.useState(Mt),[p,h]=x.useState(!1),[g,b]=x.useState(!1),[k,c]=x.useState(!1),[d,o]=x.useState(Number.isFinite(r)&&r>0?r:null),{jobs:f,refreshing:y,refresh:C,updateJobDescription:ne}=Et(),{evaluatedReport:v,loading:P,error:M,errorKind:le,setError:ie,calculate:oe}=Ft(u),{driftHistory:O,columnSparklines:de,refreshHistory:ce}=Lt(a),{sortConfig:K,handleSort:xe,clearSort:ue}=$t(),w=Rt(d);x.useEffect(()=>{const j=new URLSearchParams(t);d!=null?j.set("investigate",String(d)):j.delete("investigate"),s(j,{replace:!0})},[d]);const N=x.useMemo(()=>f.find(j=>j.job_id===a),[f,a]),U=async()=>{if(!a||!l){c(!0),ie("Please select a Reference Job and upload Current Data.");return}c(!1),await oe({selectedJob:a,file:l,job:N,thresholds:u})&&ce()},me=()=>{v&&Pt(v,N==null?void 0:N.dataset_name)},pe=x.useMemo(()=>a?{job:a}:{},[a]);return e.jsxs("div",{className:"p-6 w-full text-slate-900 dark:text-slate-100",children:[e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Data Drift Analysis"})}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow mb-6 border dark:border-slate-700",children:[e.jsx(Ot,{jobs:f,selectedJob:a,setSelectedJob:n,file:l,setFile:i,submitAttempted:k,loading:P,refreshing:y,showThresholds:p,onCalculate:()=>void U(),onRefresh:()=>void C(),onToggleThresholds:()=>h(j=>!j)}),p&&e.jsx(zt,{thresholds:u,onChange:m}),N&&e.jsx(wt,{job:N,onUpdateDescription:j=>ne(N.job_id,j)}),e.jsx(Kt,{error:M,errorKind:le,onRetry:()=>void U()})]}),!v&&!P&&!M&&e.jsx(kt,{}),v&&e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700",children:[e.jsx(St,{report:v}),e.jsx(Nt,{missingColumns:v.missing_columns,newColumns:v.new_columns}),e.jsx(it,{showOnlyDrifted:g,onToggleDrifted:()=>b(j=>!j),sortConfig:K,onClearSort:ue,onExport:me}),e.jsx(ft,{report:v,showOnlyDrifted:g,sortConfig:K,onSort:xe,columnSparklines:de})]}),e.jsx(ot,{history:O}),e.jsx(lt,{history:O,onInvestigate:o}),e.jsx(nt,{alertId:d,detail:w.detail,loading:w.loading,error:w.error,actionPending:w.actionPending,onApplyDisposition:w.applyDisposition,onRetry:()=>void w.refresh(),onClose:()=>o(null),filters:pe})]})};export{Vt as DataDriftPage}; diff --git a/static/ml_canvas/assets/DeploymentsPage-BJQ6Vxf0.js b/static/ml_canvas/assets/DeploymentsPage-DlnI46US.js similarity index 99% rename from static/ml_canvas/assets/DeploymentsPage-BJQ6Vxf0.js rename to static/ml_canvas/assets/DeploymentsPage-DlnI46US.js index 8f838039d..5b85fe929 100644 --- a/static/ml_canvas/assets/DeploymentsPage-BJQ6Vxf0.js +++ b/static/ml_canvas/assets/DeploymentsPage-DlnI46US.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as s,c as T,d as U,C as O,B as q,e as z,P as C}from"./vendor-utils-VkF_O5b_.js";import{u as G,a as K,d as h,p as Q,E as v,L as F,b as W,t as u,R as p}from"./index-_bluKNvP.js";import"./vendor-charts-BkHP8M8k.js";const X=r=>!r||r.toLowerCase()==="unknown",i=r=>r.version!==void 0&&r.version!==null?`${r.model_type} v${r.version} (job ${r.job_id})`:`${r.model_type} (job ${r.job_id})`,M=({deployment:r})=>{const t=r.version!==void 0&&r.version!==null;return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsx(p,{recordRef:{kind:"job",jobId:r.job_id},label:`Job ${r.job_id.slice(0,8)}`,origin:"/deployments"}),t?e.jsx(p,{recordRef:{kind:"modelVersion",jobId:r.job_id,version:String(r.version)},label:`Version ${r.version}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"Version unavailable"}),X(r.dataset_id)?e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"No dataset available"}):e.jsx(p,{recordRef:{kind:"dataset",datasetId:r.dataset_id},label:"Dataset",origin:"/deployments"}),r.previous_deployment_id!==void 0&&r.previous_deployment_id!==null?e.jsx(p,{recordRef:{kind:"deployment",deploymentId:r.previous_deployment_id},label:`Replaced deployment #${r.previous_deployment_id}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",children:"No prior deployment"})]})},re=()=>{const[r]=G(),[t,P]=s.useState(null),[m,V]=s.useState([]),[n,f]=s.useState(!1),[k,N]=s.useState(null),[w,_]=s.useState(!1),[R,D]=s.useState(null),[$,I]=s.useState(null),[b,S]=s.useState(null),E=K(),o=s.useCallback(async()=>{f(!0),N(null);try{const[a,l]=await Promise.all([h.getActive(),h.getHistory(50,0)]);P(a),V(l)}catch(a){console.error("Failed to load deployments",a),N("Failed to load deployment data.")}finally{f(!1)}},[]);s.useEffect(()=>{o()},[o]);const d=s.useMemo(()=>Q(r),[r]),c=(d==null?void 0:d.ref.kind)==="deployment"?d.ref.deploymentId:null,x=(d==null?void 0:d.ref.kind)==="modelVersion"?d.ref.jobId:null,j=s.useRef(null),y=s.useCallback(a=>c!==null&&a.id===c||x!==null&&a.job_id===x,[c,x]);s.useEffect(()=>{var a;c===null&&x===null||n||(a=j.current)==null||a.scrollIntoView({block:"center",behavior:"smooth"})},[c,x,n,m,t]);const H=async()=>{!t||!await E({title:"Deactivate deployment?",message:`Deactivate ${i(t)}? It will no longer serve predictions.`,confirmLabel:"Deactivate",variant:"danger"})||await A(t)},A=async a=>{I(null),_(!0);try{await h.deactivate(),await o(),u.success("Deployment deactivated",i(a))}catch(l){console.error("Failed to deactivate",l);const g=l.message||"Failed to deactivate deployment.";I(g),u.error(`Failed to deactivate ${i(a)}`,g)}finally{_(!1)}},J=async a=>{await E({title:"Redeploy model?",message:`Redeploy ${i(a)}? This will replace the currently active deployment${t?` (${i(t)})`:""}.`,confirmLabel:"Redeploy"})&&await L(a)},L=async a=>{S(null),D(a.job_id);try{await h.deployModel(a.job_id),await o(),u.success("Model redeployed",i(a))}catch(l){console.error("Failed to redeploy",l);const g=l.message||"Failed to redeploy model.";S({jobId:a.job_id,message:g}),u.error(`Failed to redeploy ${i(a)}`,g)}finally{D(null)}},B=()=>t?e.jsxs("div",{ref:y(t)?j:null,className:`bg-white dark:bg-gray-800 rounded-xl border shadow-sm overflow-hidden ${y(t)?"border-blue-400 dark:border-blue-500 ring-2 ring-blue-200 dark:ring-blue-900":"border-green-200 dark:border-green-900"}`,children:[e.jsxs("div",{className:"p-6 border-b border-gray-100 dark:border-gray-700 flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(q,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t.model_type}),e.jsxs("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 text-xs font-medium rounded-full flex items-center gap-1",children:[e.jsx(z,{className:"w-3 h-3"})," Active"]})]}),e.jsx("div",{className:"mt-1",children:e.jsx(M,{deployment:t})}),e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:["Deployed: ",new Date(t.created_at).toLocaleString()]})]})]}),e.jsxs("button",{onClick:()=>{H()},disabled:w,className:"flex items-center gap-2 px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 dark:bg-red-900/20 dark:hover:bg-red-900/30 dark:text-red-400 rounded-lg transition-colors text-sm font-medium disabled:opacity-50",children:[w?e.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin"}):e.jsx(C,{className:"w-4 h-4"}),"Deactivate"]})]}),$&&e.jsx("div",{className:"border-b border-gray-100 dark:border-gray-700",children:e.jsx(v,{error:`Failed to deactivate ${i(t)}: ${$}`,onRetry:()=>A(t)})}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 text-xs font-mono text-gray-500 dark:text-gray-400 break-all",children:["Artifact URI: ",t.artifact_uri]})]}):n?e.jsx(F,{message:"Loading active deployment..."}):e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 p-8 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("h3",{className:"text-gray-900 dark:text-gray-100 font-medium",children:"No Active Model"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Deploy a model from the Experiments page to see it here."})]});return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-6 flex justify-between items-center shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100",children:"Model Deployments"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage active models and view deployment history"})]}),e.jsx("button",{onClick:()=>{o()},className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh","aria-label":"Refresh deployments",children:e.jsx(T,{className:`w-5 h-5 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[k&&e.jsx(v,{error:k,onRetry:()=>o()}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),"Active Deployment"]}),B()]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-blue-500"}),"Deployment History"]}),b&&e.jsx("div",{className:"mb-4",children:e.jsx(v,{error:`Failed to redeploy job ${b.jobId}: ${b.message}`,onRetry:()=>{const a=m.find(l=>l.job_id===b.jobId);return a?L(a):void 0}})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3",children:"Status"}),e.jsx("th",{className:"px-6 py-3",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3",children:"Lineage"}),e.jsx("th",{className:"px-6 py-3",children:"Deployed At"}),e.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:m.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:n?e.jsx(F,{message:"Loading deployment history..."}):e.jsx(W,{title:"No deployment history found."})})}):m.map(a=>e.jsxs("tr",{ref:y(a)?j:null,className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${y(a)?"bg-blue-50 dark:bg-blue-900/20 ring-1 ring-inset ring-blue-300 dark:ring-blue-700":""}`,children:[e.jsx("td",{className:"px-6 py-4",children:a.is_active?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),"Active"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),"Inactive"]})}),e.jsx("td",{className:"px-6 py-4 font-medium text-gray-900 dark:text-gray-100",children:a.model_type}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(M,{deployment:a})}),e.jsx("td",{className:"px-6 py-4 text-gray-500 dark:text-gray-400",children:new Date(a.created_at).toLocaleString()}),e.jsx("td",{className:"px-6 py-4 text-right",children:!a.is_active&&e.jsx("button",{onClick:()=>{J(a)},disabled:R===a.job_id,"aria-label":`Redeploy ${i(a)}`,className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium text-xs disabled:opacity-50",children:R===a.job_id?"Redeploying...":"Redeploy"})})]},a.id))})]})})})]})]})]})};export{re as DeploymentsPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as s,c as T,d as U,C as O,B as q,e as z,P as C}from"./vendor-utils-VkF_O5b_.js";import{u as G,a as K,d as h,p as Q,E as v,L as F,b as W,t as u,R as p}from"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";const X=r=>!r||r.toLowerCase()==="unknown",i=r=>r.version!==void 0&&r.version!==null?`${r.model_type} v${r.version} (job ${r.job_id})`:`${r.model_type} (job ${r.job_id})`,M=({deployment:r})=>{const t=r.version!==void 0&&r.version!==null;return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsx(p,{recordRef:{kind:"job",jobId:r.job_id},label:`Job ${r.job_id.slice(0,8)}`,origin:"/deployments"}),t?e.jsx(p,{recordRef:{kind:"modelVersion",jobId:r.job_id,version:String(r.version)},label:`Version ${r.version}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"Version unavailable"}),X(r.dataset_id)?e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"No dataset available"}):e.jsx(p,{recordRef:{kind:"dataset",datasetId:r.dataset_id},label:"Dataset",origin:"/deployments"}),r.previous_deployment_id!==void 0&&r.previous_deployment_id!==null?e.jsx(p,{recordRef:{kind:"deployment",deploymentId:r.previous_deployment_id},label:`Replaced deployment #${r.previous_deployment_id}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",children:"No prior deployment"})]})},re=()=>{const[r]=G(),[t,P]=s.useState(null),[m,V]=s.useState([]),[n,f]=s.useState(!1),[k,N]=s.useState(null),[w,_]=s.useState(!1),[R,D]=s.useState(null),[$,I]=s.useState(null),[b,S]=s.useState(null),E=K(),o=s.useCallback(async()=>{f(!0),N(null);try{const[a,l]=await Promise.all([h.getActive(),h.getHistory(50,0)]);P(a),V(l)}catch(a){console.error("Failed to load deployments",a),N("Failed to load deployment data.")}finally{f(!1)}},[]);s.useEffect(()=>{o()},[o]);const d=s.useMemo(()=>Q(r),[r]),c=(d==null?void 0:d.ref.kind)==="deployment"?d.ref.deploymentId:null,x=(d==null?void 0:d.ref.kind)==="modelVersion"?d.ref.jobId:null,j=s.useRef(null),y=s.useCallback(a=>c!==null&&a.id===c||x!==null&&a.job_id===x,[c,x]);s.useEffect(()=>{var a;c===null&&x===null||n||(a=j.current)==null||a.scrollIntoView({block:"center",behavior:"smooth"})},[c,x,n,m,t]);const H=async()=>{!t||!await E({title:"Deactivate deployment?",message:`Deactivate ${i(t)}? It will no longer serve predictions.`,confirmLabel:"Deactivate",variant:"danger"})||await A(t)},A=async a=>{I(null),_(!0);try{await h.deactivate(),await o(),u.success("Deployment deactivated",i(a))}catch(l){console.error("Failed to deactivate",l);const g=l.message||"Failed to deactivate deployment.";I(g),u.error(`Failed to deactivate ${i(a)}`,g)}finally{_(!1)}},J=async a=>{await E({title:"Redeploy model?",message:`Redeploy ${i(a)}? This will replace the currently active deployment${t?` (${i(t)})`:""}.`,confirmLabel:"Redeploy"})&&await L(a)},L=async a=>{S(null),D(a.job_id);try{await h.deployModel(a.job_id),await o(),u.success("Model redeployed",i(a))}catch(l){console.error("Failed to redeploy",l);const g=l.message||"Failed to redeploy model.";S({jobId:a.job_id,message:g}),u.error(`Failed to redeploy ${i(a)}`,g)}finally{D(null)}},B=()=>t?e.jsxs("div",{ref:y(t)?j:null,className:`bg-white dark:bg-gray-800 rounded-xl border shadow-sm overflow-hidden ${y(t)?"border-blue-400 dark:border-blue-500 ring-2 ring-blue-200 dark:ring-blue-900":"border-green-200 dark:border-green-900"}`,children:[e.jsxs("div",{className:"p-6 border-b border-gray-100 dark:border-gray-700 flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(q,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t.model_type}),e.jsxs("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 text-xs font-medium rounded-full flex items-center gap-1",children:[e.jsx(z,{className:"w-3 h-3"})," Active"]})]}),e.jsx("div",{className:"mt-1",children:e.jsx(M,{deployment:t})}),e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:["Deployed: ",new Date(t.created_at).toLocaleString()]})]})]}),e.jsxs("button",{onClick:()=>{H()},disabled:w,className:"flex items-center gap-2 px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 dark:bg-red-900/20 dark:hover:bg-red-900/30 dark:text-red-400 rounded-lg transition-colors text-sm font-medium disabled:opacity-50",children:[w?e.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin"}):e.jsx(C,{className:"w-4 h-4"}),"Deactivate"]})]}),$&&e.jsx("div",{className:"border-b border-gray-100 dark:border-gray-700",children:e.jsx(v,{error:`Failed to deactivate ${i(t)}: ${$}`,onRetry:()=>A(t)})}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 text-xs font-mono text-gray-500 dark:text-gray-400 break-all",children:["Artifact URI: ",t.artifact_uri]})]}):n?e.jsx(F,{message:"Loading active deployment..."}):e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 p-8 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("h3",{className:"text-gray-900 dark:text-gray-100 font-medium",children:"No Active Model"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Deploy a model from the Experiments page to see it here."})]});return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-6 flex justify-between items-center shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100",children:"Model Deployments"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage active models and view deployment history"})]}),e.jsx("button",{onClick:()=>{o()},className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh","aria-label":"Refresh deployments",children:e.jsx(T,{className:`w-5 h-5 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[k&&e.jsx(v,{error:k,onRetry:()=>o()}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),"Active Deployment"]}),B()]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-blue-500"}),"Deployment History"]}),b&&e.jsx("div",{className:"mb-4",children:e.jsx(v,{error:`Failed to redeploy job ${b.jobId}: ${b.message}`,onRetry:()=>{const a=m.find(l=>l.job_id===b.jobId);return a?L(a):void 0}})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3",children:"Status"}),e.jsx("th",{className:"px-6 py-3",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3",children:"Lineage"}),e.jsx("th",{className:"px-6 py-3",children:"Deployed At"}),e.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:m.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:n?e.jsx(F,{message:"Loading deployment history..."}):e.jsx(W,{title:"No deployment history found."})})}):m.map(a=>e.jsxs("tr",{ref:y(a)?j:null,className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${y(a)?"bg-blue-50 dark:bg-blue-900/20 ring-1 ring-inset ring-blue-300 dark:ring-blue-700":""}`,children:[e.jsx("td",{className:"px-6 py-4",children:a.is_active?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),"Active"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),"Inactive"]})}),e.jsx("td",{className:"px-6 py-4 font-medium text-gray-900 dark:text-gray-100",children:a.model_type}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(M,{deployment:a})}),e.jsx("td",{className:"px-6 py-4 text-gray-500 dark:text-gray-400",children:new Date(a.created_at).toLocaleString()}),e.jsx("td",{className:"px-6 py-4 text-right",children:!a.is_active&&e.jsx("button",{onClick:()=>{J(a)},disabled:R===a.job_id,"aria-label":`Redeploy ${i(a)}`,className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium text-xs disabled:opacity-50",children:R===a.job_id?"Redeploying...":"Redeploy"})})]},a.id))})]})})})]})]})]})};export{re as DeploymentsPage}; diff --git a/static/ml_canvas/assets/EDAPage-BkzWx__1.js b/static/ml_canvas/assets/EDAPage-BkzWx__1.js new file mode 100644 index 000000000..2d3ff5d37 --- /dev/null +++ b/static/ml_canvas/assets/EDAPage-BkzWx__1.js @@ -0,0 +1,12 @@ +import{j as i,u as er,a as tr,P as vt,i as ir,B as sr,C as nr,M as os,H as Rn}from"./vendor-flow-Ct2sLZk5.js";import{af as pt,a as k,ad as rr,ag as ar,D as be,c as qt,E as lo,l as bi,ah as co,ai as ys,aj as ho,ak as uo,H as mo,al as fo,C as ls,am as go,an as or,ao as Ut,e as lr,f as bt,a9 as dr,ab as po,o as cr,_ as vs,p as wi,X as hr,q as bs,ap as xo,aq as _o,ar as yo,a3 as ur,as as mr,a4 as fr,a5 as yt,j as _i,at as vo,au as Zt,av as wt,aw as ds,ax as bo,ay as cs,k as gr,az as pr,a6 as jt,g as xr,K as ke,B as _r,b as $t,aa as Ht,R as wo,aA as ws,S as jo,aB as ko,h as No}from"./vendor-utils-VkF_O5b_.js";import{r as Co,g as yr,i as vr,f as ns,D as Lo,u as Po,t as Wt,a as So,M as To,S as br,s as ji,w as at,x as We,I as _e,C as ki,b as Kt,y as wr,z as Eo,B as Mo,F as Ao,G as yi,T as jr,H as hs,J as us,K as ms,O as zo,L as Io,E as Oo}from"./index-BR7Y881F.js";import{R as De,aj as Do,ak as Ro,j as js,T as He,ah as kr,al as Fo,am as Bo,an as Zo,ao as $o,ap as Ho,aq as Wo,ar as Vo,r as qo,B as nt,C as Ye,X as Xe,Y as Qe,as as Nr,h as Ve,at as Uo,au as rs,ag as Ko,ai as Fn,av as Cr}from"./vendor-charts-BkHP8M8k.js";import{F as as}from"./FormField-BaO1-ftW.js";import{r as Go,a as Yo}from"./vendor-plotly-EQ6XkBLq.js";const xt="/api/eda",qe={analyze:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/analyze`,{target_col:l,exclude_cols:a,filters:d,task_type:h})).data,getLatestReport:async n=>(await pt.get(`${xt}/${n}/latest`)).data,getReport:async n=>(await pt.get(`${xt}/reports/${n}`)).data,cancelJob:async n=>(await pt.post(`${xt}/reports/${n}/cancel`)).data,getHistory:async n=>(await pt.get(`${xt}/${n}/history`)).data,getDecomposition:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/decomposition`,{measure_col:l,measure_agg:a,split_col:d,filters:h})).data},Bn={x:"",y:"",z:"",color:"",is3D:!1,isPCA3D:!1},Zn=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,Xo=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>Zn(a)===Zn(l[d])),te=Co((n,l)=>({activeTab:"dashboard",selectedDataset:null,targetCol:"",taskType:"",excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],scatter:{...Bn},setActiveTab:a=>n({activeTab:a}),setSelectedDataset:a=>n({selectedDataset:a}),setTargetCol:a=>n({targetCol:a}),setTaskType:a=>n({taskType:a}),toggleExclude:(a,d)=>n(h=>{const u=h.excludedColsDraft.includes(a);return d?u?h:{excludedColsDraft:[...h.excludedColsDraft,a]}:u?{excludedColsDraft:h.excludedColsDraft.filter(m=>m!==a)}:h}),setExcludedDraft:a=>n({excludedColsDraft:a}),setExcludedApplied:a=>n({excludedColsApplied:a}),applyExcluded:()=>n({excludedColsApplied:[...l().excludedColsDraft]}),addFilterDraft:a=>n(d=>({filtersDraft:[...d.filtersDraft,a]})),removeFilterDraft:a=>n(d=>({filtersDraft:d.filtersDraft.filter((h,u)=>u!==a)})),clearFiltersDraft:()=>n({filtersDraft:[]}),setFiltersDraft:a=>n({filtersDraft:a}),setFiltersApplied:a=>n({filtersApplied:a}),applyFilters:()=>n(a=>({filtersApplied:[...a.filtersDraft]})),setScatter:a=>n(d=>({scatter:{...d.scatter,...a}})),resetForDataset:()=>n({excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],targetCol:"",activeTab:"dashboard",scatter:{...Bn}})})),Qo=n=>{if(n.excludedColsApplied.length!==n.excludedColsDraft.length)return!0;const l=new Set(n.excludedColsApplied);for(const a of n.excludedColsDraft)if(!l.has(a))return!0;return!1},Jo=n=>!Xo(n.filtersDraft,n.filtersApplied),Ee={datasets:["eda","datasets"],report:n=>["eda","report",n],history:n=>["eda","history",n],reportById:n=>["eda","reportById",n]},el=n=>{const l=yr();return vr({mutationFn:a=>qe.cancelJob(a),onSuccess:()=>{l.invalidateQueries({queryKey:Ee.history(n)}),l.invalidateQueries({queryKey:Ee.report(n)})}})};function fs(n){if(n==null)return null;const l=n.trim();if(!/^\d+$/.test(l))return null;const a=Number(l);return a>0?a:null}function tl(n,l,a){const d=fs(n);if(d!==null)return d;if(l!==null)return l;const h=a[0];return h===void 0?null:fs(String(h.id))}function il(n,l,a){return n===null||!a?!1:!l.some(d=>Number(d.id)===n)}function sl(n,l){return l===null?!1:fs(n)===null}function nl(n){return n.name.trim()||`Dataset ${n.id}`}function rl(n){const l=String(n.id);return l.length<=6?l:l.slice(-6)}function al(n){const l=n.map(d=>nl(d)),a=new Map;for(const d of l)a.set(d,(a.get(d)??0)+1);return n.map((d,h)=>{const u=l[h];return(a.get(u)??0)>1?{value:d.id,label:`${u} (${rl(d)})`}:{value:d.id,label:u}})}function ol(n){const l=ns({queryKey:Ee.datasets,queryFn:()=>Lo.getUsable()}),a=k.useMemo(()=>l.data??[],[l.data]),d=k.useMemo(()=>al(a),[a]),h=ns({queryKey:Ee.report(n??null),queryFn:async()=>{var y;try{return await qe.getLatestReport(n)}catch(b){if(((y=b==null?void 0:b.response)==null?void 0:y.status)===404)return null;throw b}},enabled:n!=null,refetchInterval:y=>{const b=y.state.data;return b&&b.status==="PENDING"?3e3:!1}}),u=h.data??null,m=h.isLoading,p=h.isError?"Failed to load report":null,w=ns({queryKey:Ee.history(n??null),queryFn:()=>qe.getHistory(n),enabled:n!=null,refetchInterval:(u==null?void 0:u.status)==="PENDING"?3e3:!1}).data??[];return{datasetsQuery:l,datasets:a,datasetOptions:d,reportQuery:h,report:u,loading:m,error:p,history:w}}function ll(){const[n,l]=Po(),a=yr(),[d,h]=k.useState(!1),[u,m]=k.useState(!1),[p,g]=k.useState(!1),w=k.useRef(!1),y=te(E=>E.activeTab),b=te(E=>E.setActiveTab),x=te(E=>E.selectedDataset),N=te(E=>E.setSelectedDataset),P=te(E=>E.targetCol),j=te(E=>E.setTargetCol),M=te(E=>E.taskType),D=te(E=>E.setTaskType),S=te(E=>E.excludedColsDraft),G=te(E=>E.excludedColsApplied),fe=te(E=>E.filtersDraft),le=te(E=>E.filtersApplied),ne=te(E=>E.scatter),we=te(E=>E.setScatter),A=te(Qo),I=te(Jo),{datasetsQuery:V,datasets:B,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge}=ol(x),O=vr({mutationFn:E=>qe.analyze(x,P||void 0,E.excluded,E.filters,M||void 0),onSuccess:()=>{a.invalidateQueries({queryKey:Ee.report(x??null)}),a.invalidateQueries({queryKey:Ee.history(x??null)})},onSettled:()=>{w.current=!1,g(!1)}}),ce=O.isPending||p,z=n.get("dataset_id");k.useEffect(()=>{const E=tl(z,x,B);E!==x&&N(E)},[z,B,x,N]),k.useEffect(()=>{if(!sl(z,x))return;const E=new URLSearchParams(n);E.set("dataset_id",String(x)),l(E,{replace:!0})},[z,x,n,l]);const q=il(x,B,V.isSuccess);k.useEffect(()=>{te.getState().resetForDataset()},[x]);const ee=k.useMemo(()=>{const E=Z==null?void 0:Z.profile_data;if(!E)return null;const ye=new Set(S),Ue={};return E.columns&&Object.entries(E.columns).forEach(([Re,Xt])=>{ye.has(Re)||(Ue[Re]=Xt)}),{...E,columns:Ue,excluded_columns:S}},[Z==null?void 0:Z.profile_data,S]),oe=(E,ye)=>{if(!x)return;const Ue=Array.isArray(E)?E:G,Re=Array.isArray(ye)?ye:le;O.mutate({excluded:Ue,filters:Re})},se=async E=>{if(x){m(!0);try{const ye=await a.fetchQuery({queryKey:Ee.reportById(E),queryFn:()=>qe.getReport(E)});a.setQueryData(Ee.report(x),ye)}catch(ye){Wt.error("Failed to load report",String(ye))}finally{m(!1)}}},J=(E,ye,Ue)=>{const Re={column:E,operator:Ue||"==",value:ye};te.getState().addFilterDraft(Re)},K=E=>{te.getState().removeFilterDraft(E)},Pe=()=>{te.getState().setFiltersDraft(le)},Me=()=>{if(w.current||ce)return;w.current=!0,g(!0);const E=te.getState().filtersDraft;te.getState().applyFilters(),oe(void 0,E)},Yt=(E,ye)=>{te.getState().toggleExclude(E,ye)},kt=()=>{const E=te.getState().excludedColsDraft;te.getState().applyExcluded(),oe(E)};k.useEffect(()=>{if(Z&&Z.profile_data){Z.profile_data.target_col&&j(Z.profile_data.target_col);const E=Array.isArray(Z.profile_data.excluded_columns)?Z.profile_data.excluded_columns:[];te.getState().setExcludedApplied(E),te.getState().setExcludedDraft(E)}},[Z==null?void 0:Z.id]);const Nt=P?ge.find(E=>E.target_col===P&&E.status==="COMPLETED"):null;return{searchParams:n,setSearchParams:l,queryClient:a,showHistoryModal:d,setShowHistoryModal:h,isLoadingReport:u,activeTab:y,setActiveTab:b,selectedDataset:x,targetCol:P,setTargetCol:j,taskType:M,setTaskType:D,excludedColsDraft:S,filtersDraft:fe,filtersApplied:le,scatter:ne,setScatter:we,excludedDirty:A,filtersDirty:I,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge,analyzeMutation:O,analyzing:ce,selectionUnavailable:q,profileForUi:ee,runAnalysis:oe,loadSpecificReport:se,handleAddFilter:J,handleRemoveFilter:K,handleResetFilters:Pe,handleApplyFilters:Me,handleToggleExclude:Yt,handleApplyExcluded:kt,existingReport:Nt}}function dl(n){return i.jsx(i.Fragment,{children:i.jsxs("header",{className:"flex-none bg-white dark:bg-slate-900 border-b border-gray-200 dark:border-gray-800 px-4 py-2 flex flex-wrap items-center justify-between gap-3 z-20 shadow-sm lg:h-16 lg:flex-nowrap lg:py-0 lg:gap-4",children:[i.jsx(cl,{...n}),i.jsx(hl,{...n}),i.jsx(fl,{...n})]})})}function cl(n){const{report:l,selectionUnavailable:a,selectedDataset:d,searchParams:h,setSearchParams:u,datasetOptions:m}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-4 lg:gap-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white leading-tight",children:"Exploratory Analysis"}),l&&l.created_at&&i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Last analyzed: ",new Date(l.created_at).toLocaleString()]})]}),i.jsx("div",{className:"h-8 w-px bg-gray-200 dark:bg-gray-700 mx-2"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{htmlFor:"eda-toolbar-dataset",className:"text-[10px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Dataset"}),i.jsxs("select",{id:"eda-toolbar-dataset",value:a?"":d||"",onChange:p=>{const g=new URLSearchParams(h);g.set("dataset_id",p.target.value),u(g)},className:"block w-48 text-sm font-medium bg-transparent border-none p-0 focus:ring-0 text-gray-900 dark:text-white cursor-pointer hover:text-blue-600",children:[i.jsx("option",{value:"",disabled:!0,children:"Select a dataset"}),m.map(p=>i.jsx("option",{value:p.value,children:p.label},p.value))]})]})]})})}function hl(n){const{taskType:l,setTaskType:a,report:d}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-50 dark:bg-gray-800/50 p-1.5 rounded-lg border border-gray-200 dark:border-gray-700 lg:flex-nowrap lg:gap-4",children:[i.jsx(ul,{...n}),i.jsx("div",{className:"w-px h-8 bg-gray-200 dark:bg-gray-700"}),i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{htmlFor:"eda-toolbar-task-type",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Task Type"}),i.jsxs("div",{className:"group relative",children:[i.jsx(ar,{className:"w-3 h-3 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute bottom-full mb-2 w-56 p-2 bg-slate-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none left-1/2 -translate-x-1/2",children:"Force Classification or Regression."})]})]}),i.jsxs("select",{id:"eda-toolbar-task-type",value:l,onChange:h=>a(h.target.value),disabled:!d||!d.profile_data,className:"block w-28 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"Auto"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]})]}),i.jsx(ml,{...n})]})})}function ul(n){const{targetCol:l,setTargetCol:a,report:d,excludedColsDraft:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsx("label",{htmlFor:"eda-toolbar-target-column",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Target Column"}),i.jsxs("select",{id:"eda-toolbar-target-column",value:l,onChange:u=>a(u.target.value),disabled:!d||!d.profile_data,className:"block w-36 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"None"}),d&&d.profile_data&&Object.keys(d.profile_data.columns).filter(u=>!h.includes(u)).map(u=>i.jsx("option",{value:u,children:u},u))]})]})})}function ml(n){const{selectedDataset:l,runAnalysis:a,analyzing:d,existingReport:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("button",{onClick:()=>l&&a(),disabled:!l||d,className:`ml-2 px-3 py-1.5 rounded text-sm font-medium transition-colors flex items-center shadow-sm ${h?"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 hover:bg-gray-50":"action-primary border border-transparent"}`,children:[d?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(bi,{className:"w-4 h-4 mr-2"}),h?"Re-Run":"Analyze"]})})}function fl(n){const{existingReport:l,report:a,loadSpecificReport:d,isLoadingReport:h,setShowHistoryModal:u}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[l&&a&&a.id!==l.id&&i.jsxs("button",{onClick:()=>d(l.id),disabled:h,className:"flex items-center px-3 py-1.5 text-xs bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 rounded-md hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:`Load existing from ${new Date(l.created_at).toLocaleString()}`,children:[h?i.jsx(be,{className:"w-3 h-3 mr-1 animate-spin"}):i.jsx(qt,{className:"w-3 h-3 mr-1"}),"Load Saved"]}),i.jsxs("button",{onClick:()=>u(!0),className:"flex items-center px-3 py-1.5 text-sm font-medium text-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[i.jsx(lo,{className:"w-4 h-4 mr-2"}),"History"]})]})})}function gl(n){const{history:l,report:a,loadSpecificReport:d,isLoadingReport:h}=n;return i.jsx(i.Fragment,{children:l.length>0&&i.jsxs("div",{className:"flex-none bg-white dark:bg-slate-950 border-b border-gray-100 dark:border-gray-800 px-4 py-1.5 flex items-center gap-3 overflow-x-auto z-10 shadow-[0_2px_3px_-1px_rgba(0,0,0,0.02)]",children:[i.jsx("span",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider whitespace-nowrap",children:"Recent Targets:"}),i.jsx("div",{className:"flex gap-2",children:Array.from(new Set(l.filter(u=>u.target_col&&u.status==="COMPLETED").map(u=>u.target_col))).slice(0,8).map(u=>{var m;return i.jsxs("button",{onClick:()=>{const p=l.find(g=>g.target_col===u&&g.status==="COMPLETED");p&&d(p.id)},disabled:h,className:`px-2 py-0.5 text-xs rounded-full border transition-colors flex items-center disabled:opacity-50 disabled:cursor-not-allowed ${((m=a==null?void 0:a.profile_data)==null?void 0:m.target_col)===u?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 font-medium":"bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-200"}`,children:[i.jsx(rr,{className:"w-3 h-3 mr-1"}),u]},u)})})]})})}const pl={Numeric:{badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",iconColorClass:"text-blue-500",Icon:mo},Categorical:{badgeClass:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",iconColorClass:"text-purple-500",Icon:uo},Boolean:{badgeClass:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",iconColorClass:"text-amber-500",Icon:ho},DateTime:{badgeClass:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",iconColorClass:"text-teal-500",Icon:ys},Text:{badgeClass:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-300",iconColorClass:"text-slate-500",Icon:co}},xl={badgeClass:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",iconColorClass:"text-gray-500",Icon:fo};function ks(n){return pl[n]??xl}function _l(n){return ks(n).badgeClass}function yl(n){return ks(n).iconColorClass}function vl(n){return ks(n).Icon}const bl=({isOpen:n,onClose:l,history:a,datasetId:d,onSelect:h,onFetchReport:u,onRefresh:m})=>{const[p,g]=k.useState(null),[w,y]=k.useState(!1),b=k.useRef(0),x=el(d),N=x.isPending?x.variables??null:null,P=So(),j=()=>{g(null),l()},M=async(S,G)=>{if(S.stopPropagation(),!!await P({title:"Cancel analysis?",message:"Are you sure you want to cancel this analysis?",confirmLabel:"Cancel job",variant:"danger"}))try{await x.mutateAsync(G),m&&m()}catch(le){console.error("Failed to cancel job",le),Wt.error("Failed to cancel job")}},D=async S=>{const G=++b.current;y(!0);try{const fe=await u(S.id);if(G!==b.current)return;g(fe)}catch(fe){console.error("Failed to load report details",fe),G===b.current&&Wt.error("Failed to load job details","Please try again.")}finally{G===b.current&&y(!1)}};return i.jsx(To,{isOpen:n,onClose:j,size:p?"5xl":"2xl",title:i.jsxs("div",{className:"flex items-center gap-3",children:[p?i.jsx("button",{onClick:()=>g(null),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":"Back to history",children:i.jsx(go,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})}):i.jsx(ls,{className:"w-5 h-5 text-blue-500"}),i.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:p?`Analysis #${p.id} Details`:"Analysis History"})]}),footer:p?i.jsx("div",{className:"flex justify-end",children:i.jsxs("button",{onClick:()=>{h(p),j()},className:"flex items-center px-4 py-2 action-primary rounded-md transition-colors shadow-sm",children:[i.jsx(bi,{className:"w-4 h-4 mr-2"}),"Load this Report"]})}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center w-full",children:"Select a previous analysis to view details."}),children:i.jsx("div",{className:"p-6",children:p?w?i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[i.jsx(be,{className:"w-12 h-12 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Loading analysis details..."})]}):i.jsx(kl,{selectedJob:p}):a.length===0?i.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[i.jsx(ls,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),i.jsx("p",{children:"No history available for this dataset."})]}):i.jsx("div",{className:"space-y-3",children:a.map(S=>i.jsx(wl,{job:S,handleJobClick:D,cancelling:N,handleCancel:M},S.id))})})})};function wl({job:n,handleJobClick:l,cancelling:a,handleCancel:d}){return i.jsxs("div",{...ji(()=>l(n)),className:"flex items-center justify-between p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer transition-all group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(jl,{status:n.status}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 flex items-center gap-2",children:["Analysis #",n.id,i.jsx(br,{status:n.status??"unknown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:n.created_at?new Date(n.created_at).toLocaleString():"β€”"}),n.target_col&&i.jsxs("div",{className:"text-xs text-gray-400 mt-1 flex items-center gap-1",children:[i.jsx(bi,{className:"w-3 h-3"})," Target: ",n.target_col,n.task_type&&i.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 rounded text-[10px]",children:n.task_type})]})]})]}),i.jsx("div",{className:"text-right flex items-center gap-4",children:(n.status==="PENDING"||n.status==="STARTED"||n.status==="RUNNING")&&i.jsx("button",{onClick:h=>d(h,n.id),disabled:a===n.id,className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full transition-colors",title:"Cancel Analysis",children:a===n.id?i.jsx(be,{className:"w-4 h-4 animate-spin"}):i.jsx(or,{className:"w-4 h-4"})})})]})}function jl({status:n}){return i.jsx("div",{className:`p-2 rounded-full ${n==="COMPLETED"?"bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400":n==="FAILED"?"bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400":n==="CANCELLED"?"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400":"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:n==="COMPLETED"?i.jsx(lr,{className:"w-5 h-5"}):n==="FAILED"?i.jsx(bt,{className:"w-5 h-5"}):n==="CANCELLED"?i.jsx(or,{className:"w-5 h-5"}):i.jsx(be,{className:"w-5 h-5 animate-spin"})})}function kl({selectedJob:n}){var l,a;return i.jsxs("div",{className:"space-y-8",children:[i.jsx(Nl,{selectedJob:n}),((l=n.profile_data)==null?void 0:l.excluded_columns)&&n.profile_data.excluded_columns.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[i.jsx(Ut,{className:"w-4 h-4 text-gray-500"}),"Excluded Columns (",n.profile_data.excluded_columns.length,")"]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:n.profile_data.excluded_columns.map(d=>i.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded text-sm line-through",children:d},d))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Variables Overview"}),i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm text-left",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Missing"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Distinct"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:((a=n.profile_data)==null?void 0:a.columns)&&Object.values(n.profile_data.columns).map(d=>{var u;const h=vl(d.dtype);return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("td",{className:"px-4 py-3 font-medium text-gray-900 dark:text-white",children:d.name}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:`w-4 h-4 ${yl(d.dtype)}`}),i.jsx("span",{children:d.dtype})]})}),i.jsx("td",{className:"px-4 py-3",children:d.missing_percentage>0?i.jsxs("span",{className:"text-amber-600",children:[d.missing_percentage.toFixed(1),"%"]}):i.jsx("span",{className:"text-green-600",children:"0%"})}),i.jsx("td",{className:"px-4 py-3 text-gray-500 dark:text-gray-400",children:((u=d.categorical_stats)==null?void 0:u.unique_count)||"-"})]},d.name)})})]})})]})]})}function Nl({selectedJob:n}){var l,a,d,h,u,m;return i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(dr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Rows"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((a=(l=n.profile_data)==null?void 0:l.row_count)==null?void 0:a.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(po,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Columns"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((h=(d=n.profile_data)==null?void 0:d.column_count)==null?void 0:h.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(cr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Missing Cells"})]}),i.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[(m=(u=n.profile_data)==null?void 0:u.missing_cells_percentage)==null?void 0:m.toFixed(1),"%"]})]})]})}function Cl(n){const{selectionUnavailable:l,selectedDataset:a,analyzeMutation:d,analyzing:h,runAnalysis:u}=n;return i.jsxs(i.Fragment,{children:[l&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Dataset #",a," isn't available for analysis β€” it may still be processing or have no usable columns. Pick another dataset above to continue."]})]}),d.isError&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Could not start the analysis: ",d.error instanceof Error?d.error.message:"the request was rejected."," ","Your dataset, target, and filter choices were kept."]}),i.jsxs("button",{onClick:()=>{const m=d.variables;u(m==null?void 0:m.excluded,m==null?void 0:m.filters)},disabled:h,className:"flex items-center rounded-md border border-red-300 px-3 py-1.5 font-medium hover:bg-red-100 disabled:opacity-50 dark:border-red-800 dark:hover:bg-red-900/40",children:[i.jsx(qt,{className:"mr-2 h-4 w-4"}),"Try again"]}),i.jsx("button",{onClick:()=>d.reset(),className:"rounded-md px-2 py-1.5 font-medium underline hover:no-underline",children:"Dismiss"})]})]})}function Ll(n){const{showHistoryModal:l,setShowHistoryModal:a,history:d,selectedDataset:h,queryClient:u}=n;return i.jsx(i.Fragment,{children:i.jsx(bl,{isOpen:l,onClose:()=>a(!1),history:d,datasetId:h??null,onRefresh:()=>u.invalidateQueries({queryKey:Ee.history(h??null)}),onFetchReport:async m=>{const p=await qe.getReport(m);return{...p,id:p.id??m}},onSelect:m=>{var g;h&&u.setQueryData(Ee.report(h),m);const p=Array.isArray((g=m.profile_data)==null?void 0:g.excluded_columns)?m.profile_data.excluded_columns:[];te.getState().setExcludedApplied(p),te.getState().setExcludedDraft(p)}})})}function Pl(n,l,a,d){return l?a&&!d?`${n===">"?"Greater than":n==="<"?"Less than":n===">="?"Greater than or equal to":"Less than or equal to"} needs a numeric value`:"":"Enter a filter value"}function Sl(n,l,a){const d=[">","<",">=","<="].includes(l),h=n.trim().length>0,u=l.trim().length>0,m=a.trim().length>0,p=Number.isFinite(Number(a)),g=Pl(l,m,d,p);return{hasFilterColumn:h,hasFilterOperator:u,hasFilterValue:m,isComparisonOperator:d,currentFilterValueError:g}}function Tl(n){const[l,a]=k.useState(!1),[d,h]=k.useState(""),[u,m]=k.useState("=="),[p,g]=k.useState(""),[w,y]=k.useState(!1),{hasFilterColumn:b,hasFilterOperator:x,hasFilterValue:N,isComparisonOperator:P,currentFilterValueError:j}=Sl(d,u,p);return{isAddingFilter:l,setIsAddingFilter:a,newFilterCol:d,setNewFilterCol:h,newFilterOp:u,setNewFilterOp:m,newFilterVal:p,setNewFilterVal:g,filterValidationAttempted:w,setFilterValidationAttempted:y,columnError:w&&!b?"Choose a filter column":"",operatorError:w&&!x?"Choose a filter operator":"",valueError:w&&j?j:"",handleAddFilterSubmit:()=>{y(!0),!(!b||!x||!N||j)&&(n(d,P?Number(p):Number.isNaN(Number(p))?p:Number(p),u),a(!1),y(!1),h(""),m("=="),g(""))}}}const $n=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,El=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>$n(a)===$n(l[d]));function Ml({filtersDraft:n,filtersApplied:l,filtersDirty:a,columns:d,analyzing:h,onRemoveFilter:u,onResetFilters:m,onApplyFilters:p,showFilters:g,setShowFilters:w,form:y}){const b=a||!El(n,l);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between w-full mb-2",children:[i.jsxs("button",{onClick:()=>w(!g),className:"flex items-center text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Draft Filters (",n.length,")"]}),g?i.jsx(vs,{className:"w-3 h-3 ml-1"}):i.jsx(wi,{className:"w-3 h-3 ml-1"})]}),a&&i.jsx("span",{className:"text-[10px] font-medium rounded-full bg-amber-100 text-amber-800 px-2 py-0.5",children:"Pending"})]}),g&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Report uses ",l.length," applied filter",l.length===1?"":"s"," until you apply draft changes."]}),i.jsx(Al,{filtersDraft:n,filtersDirty:a,analyzing:h,onRemoveFilter:u}),i.jsx(zl,{form:y,columns:d}),i.jsx(Il,{disabled:!b||h,onResetFilters:m,onApplyFilters:p})]})]})}function Al({filtersDraft:n,filtersDirty:l,analyzing:a,onRemoveFilter:d}){return i.jsx(i.Fragment,{children:n.length>0?n.map((h,u)=>i.jsxs("div",{className:`flex items-center justify-between rounded px-2 py-1 text-xs border ${l?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700"}`,children:[i.jsxs("div",{className:"truncate max-w-[140px]",children:[i.jsx("span",{className:"font-medium text-blue-700 dark:text-blue-300",children:h.column}),i.jsx("span",{className:"mx-1 text-gray-500 dark:text-gray-400",children:h.operator}),i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:String(h.value)})]}),i.jsx("button",{onClick:()=>d(u),className:"text-gray-500 dark:text-gray-400 hover:text-red-500","aria-label":`Remove filter ${u+1}`,disabled:a,children:i.jsx(hr,{className:"w-3 h-3"})})]},u)):i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No draft filters yet."})})}function zl({form:n,columns:l}){const{isAddingFilter:a,setIsAddingFilter:d,newFilterCol:h,setNewFilterCol:u,newFilterOp:m,setNewFilterOp:p,newFilterVal:g,setNewFilterVal:w,filterValidationAttempted:y,setFilterValidationAttempted:b,columnError:x,operatorError:N,valueError:P,handleAddFilterSubmit:j}=n;return i.jsx(i.Fragment,{children:a?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsx(as,{label:"Filter column",hideLabel:!0,required:!0,...y?{error:x}:{},children:M=>i.jsxs("select",{...M,value:h,onChange:D=>u(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"",disabled:!0,children:"Column"}),l.map(D=>i.jsx("option",{value:D,children:D},D))]})}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(as,{label:"Filter operator",hideLabel:!0,required:!0,className:"w-1/3",...y?{error:N}:{},children:M=>i.jsxs("select",{...M,value:m,onChange:D=>p(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"==",children:"=="}),i.jsx("option",{value:"!=",children:"!="}),i.jsx("option",{value:">",children:">"}),i.jsx("option",{value:"<",children:"<"}),i.jsx("option",{value:">=",children:">="}),i.jsx("option",{value:"<=",children:"<="})]})}),i.jsx(as,{label:"Filter value",hideLabel:!0,required:!0,className:"w-2/3",...y?{error:P}:{},children:M=>i.jsx("input",{...M,type:"text",value:g,onChange:D=>w(D.target.value),placeholder:"Value",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onKeyDown:D=>D.key==="Enter"&&j()})})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{onClick:()=>{d(!1),b(!1),u(""),p("=="),w("")},className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Cancel"}),i.jsx("button",{onClick:j,className:"text-xs bg-blue-600 text-white px-2 py-1 rounded hover:bg-blue-700",children:"Save draft"})]})]}):i.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-blue-600 hover:border-blue-300 transition-colors",children:[i.jsx(bs,{className:"w-3 h-3 mr-1"})," Add Filter"]})})}function Il({disabled:n,onResetFilters:l,onApplyFilters:a}){return i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.jsx("button",{onClick:l,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-white dark:bg-gray-900 text-gray-600 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:"Reset filters"}),i.jsx("button",{onClick:a,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-blue-600 text-white border-blue-700 hover:bg-blue-700"}`,children:"Apply filters"})]})}function Ol({columns:n,excludedCols:l,excludedDirty:a,analyzing:d,onToggleExclude:h,onApplyExcluded:u,showExclusions:m,setShowExclusions:p,isAddingExclusion:g,setIsAddingExclusion:w}){return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>p(!m),className:"flex items-center justify-between w-full text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Excluded (",l.length,")"]}),m?i.jsx(vs,{className:"w-3 h-3"}):i.jsx(wi,{className:"w-3 h-3"})]}),m&&i.jsxs("div",{className:"space-y-2",children:[l.map((y,b)=>i.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-xs",children:[i.jsx("span",{className:"font-medium text-gray-500 dark:text-gray-400 line-through truncate max-w-[140px]",children:y}),i.jsx("button",{onClick:()=>h(y,!1),className:"text-gray-500 dark:text-gray-400 hover:text-green-500",title:"Include back",children:i.jsx(bs,{className:"w-3 h-3"})})]},b)),i.jsx(Dl,{onApplyExcluded:u,excludedDirty:a,analyzing:d}),g?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsxs("select",{"aria-label":"Column to exclude from analysis",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onChange:y=>{y.target.value&&(h(y.target.value,!0),w(!1))},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"Select Column"}),n.filter(y=>!l.includes(y)).map(y=>i.jsx("option",{value:y,children:y},y))]}),i.jsx("button",{onClick:()=>w(!1),className:"w-full text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-center",children:"Cancel"})]}):i.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-red-600 hover:border-red-300 transition-colors",children:[i.jsx(Ut,{className:"w-3 h-3 mr-1"})," Exclude Column"]})]})]})}function Dl({onApplyExcluded:n,excludedDirty:l,analyzing:a}){return i.jsx("button",{onClick:n,disabled:!l||a,className:`w-full flex items-center justify-center px-2 py-1 text-xs rounded border transition-colors ${l&&!a?"bg-blue-600 text-white border-blue-700 hover:bg-blue-700":"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed"}`,title:l?"Apply excluded columns to re-run analysis":"No pending exclusion changes",children:"Apply changes"})}function Rl(n){return[{title:"Overview",items:[{id:"dashboard",label:"Dashboard",icon:yo,show:!0},{id:"pii",label:"PII Review",icon:ur,show:!0},{id:"sample",label:"Sample Data",icon:mr,show:!!n.sample_data},{id:"insights",label:"Smart Insights",icon:fr,show:!0}]},{title:"Univariate Analysis",items:[{id:"variables",label:"Variables",icon:yt,show:!0},{id:"outliers",label:"Outliers",icon:_i,show:!!n.outliers},{id:"target",label:"Target Analysis",icon:rr,show:!!(n.target_col&&n.target_correlations)}]},{title:"Multivariate Analysis",items:[{id:"correlations",label:"Correlations",icon:vo,show:!!(n.correlations||n.correlations_with_target||n.causal_target_exclusion_reason)},{id:"bivariate",label:"Bivariate",icon:Zt,show:!0},{id:"pca",label:"PCA & Clusters",icon:wt,show:!!n.pca_data||!!n.clustering}]},{title:"Structure & Causal",items:[{id:"causal",label:"Causal Graph",icon:wt,show:!!(n.causal_graph||n.causal_target_exclusion_reason)},{id:"rules",label:"Decision Tree",icon:ds,show:!!n.rule_tree},{id:"decomposition",label:"Decomposition",icon:bo,show:!0}]},{title:"Specialized",items:[{id:"timeseries",label:"Time Series",icon:ys,show:!!n.timeseries},{id:"geospatial",label:"Geospatial",icon:cs,show:!!n.geospatial}]}]}function Fl({activeTab:n,setActiveTab:l,profile:a,isCollapsed:d,setIsCollapsed:h}){const u=Rl(a);return i.jsxs("div",{className:`flex-1 overflow-y-auto ${d?"p-2":"p-3"}`,children:[i.jsxs("div",{className:`flex items-center ${d?"justify-center":"justify-between"} mb-3`,children:[!d&&i.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Analysis Modules"}),i.jsx("button",{onClick:()=>h(!d),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400",title:d?"Expand Sidebar":"Collapse Sidebar",children:d?i.jsx(xo,{className:"w-4 h-4"}):i.jsx(_o,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"space-y-6",children:u.map((m,p)=>{const g=m.items.filter(w=>w.show);return g.length===0?null:i.jsxs("div",{children:[!d&&i.jsx("h3",{className:"px-2 text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:m.title}),i.jsx("div",{className:"space-y-1",children:g.map(w=>i.jsx(Bl,{item:w,activeTab:n,setActiveTab:l,isCollapsed:d},w.id))})]},p)})})]})}function Bl({item:n,activeTab:l,setActiveTab:a,isCollapsed:d}){const h=l===n.id?{button:"bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",icon:"text-blue-500",current:"page"}:{button:"text-gray-600 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-700",icon:"text-gray-400",current:void 0};return i.jsxs("button",{onClick:()=>a(n.id),"aria-label":n.label,"aria-current":h.current,title:d?n.label:void 0,className:`w-full flex items-center ${d?"justify-center py-2":"px-2 py-2"} text-sm font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 ${h.button}`,children:[i.jsx(n.icon,{className:`${d?"h-5 w-5":"mr-3 h-4 w-4"} ${h.icon}`}),!d&&i.jsxs(i.Fragment,{children:[n.label,l===n.id&&i.jsx(gr,{className:"ml-auto h-4 w-4 text-blue-400"})]})]})}const Zl=n=>{const[l,a]=k.useState(!0),[d,h]=k.useState(!1),[u,m]=k.useState(!1),p=Tl(n.onAddFilter),[g,w]=k.useState(!1);return i.jsxs("div",{className:`${u?"w-14":"w-60"} bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 flex-shrink-0 h-full overflow-y-auto flex flex-col transition-all duration-300`,children:[!u&&n.activeTab!=="pii"&&i.jsxs("div",{className:"p-3 border-b border-gray-200 dark:border-gray-700 space-y-3 bg-gray-50/50 dark:bg-gray-900/20",children:[i.jsx(Ml,{...n,showFilters:l,setShowFilters:a,form:p}),i.jsx(Ol,{...n,showExclusions:d,setShowExclusions:h,isAddingExclusion:g,setIsAddingExclusion:w})]}),i.jsx(Fl,{activeTab:n.activeTab,setActiveTab:n.setActiveTab,profile:n.profile,isCollapsed:u,setIsCollapsed:m})]})},$l=({profile:n})=>{if(!n)return null;const l=n.missing_cells_percentage??0,a=n.duplicate_rows??0;return i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Rows"}),i.jsx("div",{className:"text-2xl font-bold",children:(n.row_count??0).toLocaleString()})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Columns"}),i.jsx("div",{className:"text-2xl font-bold",children:n.column_count})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Missing Cells"}),i.jsxs("div",{className:"text-2xl font-bold",children:[l.toFixed(1),"%"]})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Duplicates"}),i.jsx("div",{className:"text-2xl font-bold",children:a})]}),n.vif&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"High VIF Features"}),i.jsx("div",{className:"text-2xl font-bold text-amber-600",children:Object.values(n.vif).filter(d=>d>5).length})]})]})},Hl=({alerts:n})=>{const[l,a]=k.useState(!0);return!n||n.length===0?null:i.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex justify-between items-center cursor-pointer",...ji(()=>a(!l)),children:[i.jsxs("h3",{className:"font-medium text-amber-800 dark:text-amber-200 flex items-center",children:[i.jsx(bt,{className:"w-4 h-4 mr-2"}),"Data Quality Alerts (",n.length,")"]}),l?i.jsx(vs,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"}):i.jsx(wi,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"})]}),l&&i.jsx("div",{className:"max-h-40 overflow-y-auto pr-2 mt-2 animate-in slide-in-from-top-2 duration-200",children:i.jsx("ul",{className:"space-y-1",children:n.map((d,h)=>i.jsxs("li",{className:"text-sm text-amber-700 dark:text-amber-300 flex items-start",children:[i.jsx("span",{className:"mr-2",children:"β€’"}),i.jsxs("span",{children:[d.column&&i.jsxs("span",{className:"font-semibold",children:[d.column,": "]}),d.message]})]},h))})})]})},Wl=({profile:n,onToggleExclude:l,excludedCols:a=[]})=>{const d=at(),h=k.useMemo(()=>{if(!(n!=null&&n.columns))return[];const m={};return Object.values(n.columns).forEach(p=>{m[String(p.dtype)]=(m[String(p.dtype)]||0)+1}),Object.entries(m).map(([p,g])=>({name:p,value:g}))},[n]),u=k.useMemo(()=>n!=null&&n.columns?Object.values(n.columns).filter(m=>m.missing_percentage>0).sort((m,p)=>p.missing_percentage-m.missing_percentage).slice(0,20).map(m=>({name:m.name,value:m.missing_percentage})):[],[n]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx($l,{profile:n}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(dr,{className:"w-5 h-5 mr-2 text-blue-500"}),"Column Types"]}),i.jsx("div",{className:"h-64",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Do,{children:[i.jsx(Ro,{data:h,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,fill:"#8884d8",paddingAngle:5,dataKey:"value",children:h.map((m,p)=>i.jsx(js,{fill:We[p%We.length]},`cell-${p}`))}),i.jsx(He,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),i.jsx(kr,{verticalAlign:"bottom",height:36})]})})})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-amber-500"}),"Top Missing Values"]}),u.length>0?i.jsx("div",{className:"h-64 overflow-y-auto pr-2 space-y-3",children:u.map((m,p)=>{const g=a.includes(m.name);return i.jsxs("div",{className:"flex items-center gap-3 text-sm group",children:[i.jsx("div",{className:"w-32 truncate text-gray-600 dark:text-gray-300 font-medium",title:m.name,children:m.name}),i.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m.value}%`,backgroundColor:`hsl(10, 80%, ${60-p*2}%)`}})}),i.jsxs("div",{className:"w-12 text-right text-gray-500 text-xs",children:[m.value.toFixed(1),"%"]}),l&&i.jsx("button",{onClick:()=>l(m.name,!g),className:`p-1.5 rounded-md transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 ${g?"bg-red-100 text-red-600 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 opacity-100":"text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Include Column":"Exclude Column","aria-label":g?"Include Column":"Exclude Column",children:g?i.jsx(Ut,{className:"w-4 h-4"}):i.jsx(pr,{className:"w-4 h-4"})})]},p)})}):i.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400",children:[i.jsx(cr,{className:"w-12 h-12 mb-2 opacity-20"}),i.jsx("p",{children:"No missing values found!"})]})]})]}),i.jsx(Hl,{alerts:n.alerts??[]})]})},Vl=({profile:n})=>{const l=Array.isArray(n.recommendations)?n.recommendations:[];return i.jsx("div",{className:"mt-4 space-y-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(fr,{className:"w-5 h-5 mr-2 text-yellow-500"}),"Smart Recommendations"]}),l.length>0?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.map((a,d)=>i.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/10 rounded-lg border border-blue-100 dark:border-blue-800",children:[i.jsxs("div",{className:"flex justify-between items-start mb-2",children:[i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-800 px-2 py-1 rounded border border-blue-100 dark:border-blue-800",children:a.action}),a.column&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:a.column})]}),i.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm mb-1",children:a.reason}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.suggestion})]},d))}):i.jsx("p",{className:"text-gray-500 dark:text-gray-400 italic",children:"No specific recommendations found. Your data looks clean!"})]})})};function ql({alerts:n=[]}){const l=n.filter(d=>d.type==="PII"),a=new Set(l.map(d=>d.column).filter(Boolean)).size;return i.jsxs("section",{id:"eda-pii-review","aria-labelledby":"eda-pii-heading",className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"eda-pii-heading",className:"flex items-center gap-2 text-xl font-semibold text-gray-900 dark:text-white",children:[i.jsx(ur,{"aria-hidden":"true",className:"h-5 w-5 text-blue-600 dark:text-blue-400"}),"PII review"]}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Review columns that may contain personally identifiable information (PII). Values and samples are not shown here."})]}),i.jsxs("div",{className:"flex gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:[i.jsx(jt,{"aria-hidden":"true",className:"mt-0.5 h-5 w-5 shrink-0 text-blue-700 dark:text-blue-300"}),i.jsxs("div",{className:"space-y-1 text-sm text-blue-900 dark:text-blue-100",children:[i.jsx("p",{className:"font-semibold",children:"Advisory heuristics only"}),i.jsx("p",{children:"Matches can be false positives, and detection can miss personal information. Findings do not classify data as legally sensitive or determine compliance. This review does not mask, delete, or block data."})]})]}),l.length===0?i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800",children:[i.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"No PII findings recorded"}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"This profile contains no PII alerts. That does not guarantee the dataset is free of personal information."})]}):i.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white",children:[l.length," finding",l.length===1?"":"s"," across ",a," flagged column",a===1?"":"s"]}),i.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300",children:"The detector checks email and phone patterns together; it does not report which pattern matched. Findings describe the saved profile, including columns with pending exclusions."})]}),i.jsx("div",{role:"region","aria-label":"PII findings table",tabIndex:0,className:"overflow-x-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500",children:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("caption",{className:"sr-only",children:"Possible PII findings from this profile"}),i.jsx("thead",{className:"bg-gray-50 text-gray-600 dark:bg-gray-900/50 dark:text-gray-300",children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Column"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Detector category"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Severity"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Explanation"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:l.map((d,h)=>{const u=d.severity==="error"?"Error":d.severity==="warning"?"Warning":d.severity==="info"?"Info":"Unspecified",m=u==="Error"?"bg-red-50 text-red-800 dark:bg-red-900/30 dark:text-red-200":u==="Warning"?"bg-amber-50 text-amber-800 dark:bg-amber-900/30 dark:text-amber-200":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200";return i.jsxs("tr",{className:"align-top",children:[i.jsx("th",{scope:"row",className:"max-w-64 break-words px-4 py-4 font-medium text-gray-900 dark:text-white",children:d.column||"Column not specified"}),i.jsx("td",{className:"whitespace-nowrap px-4 py-4 text-gray-700 dark:text-gray-200",children:"Email / phone"}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${m}`,children:u})}),i.jsx("td",{className:"px-4 py-4 text-gray-600 dark:text-gray-300",children:"Values may match an email address or phone number pattern. Review whether this column is appropriate for your intended use."})]},h)})})]})})]})]})}var Ul=Go();const Lr=xr(Ul);var Kl=Yo();const Gl=xr(Kl),Yl=Gl(Lr),Hn=["circle","square","diamond","cross","x"],Xl={circle:"circle",square:"rect",diamond:"rectRot",cross:"cross",x:"crossRot"},Ql={circle:"circle",square:"square",diamond:"diamond",cross:"cross",x:"x"},Wn=n=>Hn[n%Hn.length],Jl=n=>Xl[n],ed=n=>Ql[n],td=(n,l)=>{const a=n.localeCompare(l,"en");return a!==0||n===l?a:n{let l="Unlabeled",a=1;for(;n.has(l);)l=a===1?"Unlabeled (missing)":`Unlabeled (missing) ${a}`,a+=1;return l},Gt=(n,l)=>{if(!l)return[{value:null,label:"Data Points",points:n,color:We[0],shape:Wn(0)}];const a=new Map;n.forEach(m=>{const p=m[l],g=p==null?null:String(p),w=a.get(g)??[];w.push(m),a.set(g,w)});const d=[...a.keys()].filter(m=>m!==null).sort(td),h=d.map((m,p)=>({value:m,label:m,points:a.get(m),color:We[p%We.length],shape:Wn(p)})),u=a.get(null);return u&&h.push({value:null,label:id(new Set(d)),points:u,color:"#6b7280",shape:"cross"}),h},Pr=n=>n.map(({label:l,color:a,shape:d})=>({label:l,color:a,shape:d})),Sr=({data:n,xKey:l,yKey:a,zKey:d,labelKey:h,xLabel:u,yLabel:m,zLabel:p,height:g=600})=>{const w=k.useMemo(()=>Gt(n,h).map(({label:x,points:N,color:P,shape:j})=>{const M=ed(j);return{x:N.map(D=>D[l]),y:N.map(D=>D[a]),z:N.map(D=>D[d]),mode:"markers",type:"scatter3d",name:x,marker:{size:3,opacity:.8,color:P,symbol:M},hovertemplate:`${x}
${u||l}: %{x}
${m||a}: %{y}
${p||d}: %{z}`}}),[n,l,a,d,h,u,m,p]),y=at();return n.length===0?i.jsx("div",{className:"text-gray-500 text-sm italic p-4 text-center",children:"No data points to display"}):i.jsx("div",{style:{height:g,width:"100%"},children:i.jsx(Yl,{data:w,layout:{autosize:!0,height:g,margin:{l:0,r:0,b:0,t:0},paper_bgcolor:y.bgColor,plot_bgcolor:y.bgColor,font:{color:y.textColor},scene:{xaxis:{title:{text:u||l},color:y.axisColor,gridcolor:y.gridColor},yaxis:{title:{text:m||a},color:y.axisColor,gridcolor:y.gridColor},zaxis:{title:{text:p||d},color:y.axisColor,gridcolor:y.gridColor}},showlegend:!1},useResizeHandler:!0,style:{width:"100%",height:"100%"},config:{displayModeBar:!0}})})};Bo.register(Zo,$o,Ho,Wo,Vo);const Tr=({data:n,xKey:l,yKey:a,labelKey:d,xLabel:h,yLabel:u,height:m=500})=>{const p=k.useMemo(()=>Gt(n,d).map(({label:b,points:x,color:N,shape:P})=>({label:b,data:x.map(j=>({x:Number(j[l]),y:Number(j[a]),raw:j})),backgroundColor:N,borderColor:N,pointStyle:Jl(P),pointRadius:3,pointHoverRadius:5})),[n,l,a,d]),g=at(),w={responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!h,text:h,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}},y:{title:{display:!!u,text:u,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}}},plugins:{tooltip:{callbacks:{label:y=>{const b=y.raw;let x=y.dataset.label||"";return x&&(x+=": "),x+=`(${b.x}, ${b.y})`,x}}},legend:{display:!1}}};return i.jsx("div",{style:{height:m,width:"100%"},children:i.jsx(Fo,{options:w,data:{datasets:p}})})},sd=({shape:n,color:l})=>{const a={width:12,height:12,"aria-hidden":!0};switch(n){case"square":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("rect",{x:"1",y:"1",width:"10",height:"10",fill:l})});case"diamond":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("polygon",{points:"6,0 12,6 6,12 0,6",fill:l})});case"cross":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M6 1 L6 11 M1 6 L11 6",stroke:l,strokeWidth:2})});case"x":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M2 2 L10 10 M10 2 L2 10",stroke:l,strokeWidth:2})});case"circle":default:return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("circle",{cx:"6",cy:"6",r:"5",fill:l})})}},Ns=({entries:n,filterThreshold:l=12})=>{const[a,d]=k.useState(""),h=k.useMemo(()=>{if(!a.trim())return n;const m=a.trim().toLowerCase();return n.filter(p=>p.label.toLowerCase().includes(m))},[n,a]);if(n.length===0)return null;const u=n.length>l;return i.jsxs("div",{className:"mt-3 border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[u&&i.jsx("input",{type:"search",value:a,onChange:m=>d(m.target.value),placeholder:`Filter ${n.length} legend groups…`,"aria-label":"Filter legend groups",className:"mb-2 w-full text-xs rounded border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white px-2 py-1"}),i.jsxs("ul",{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-gray-700 dark:text-gray-300 ${u?"max-h-32 overflow-y-auto":""}`,children:[h.map(m=>i.jsxs("li",{className:"flex items-center gap-1.5",children:[i.jsx(sd,{shape:m.shape,color:m.color}),i.jsx("span",{className:"truncate max-w-[10rem]",title:m.label,children:m.label})]},m.label)),h.length===0&&i.jsxs("li",{className:"italic text-gray-500 dark:text-gray-400",children:["No groups match β€œ",a,"”."]})]})]})},nd=({profile:n,downloadChart:l})=>{const a=n.clustering;return a?i.jsxs("div",{className:"mt-4 space-y-6",id:"clustering-chart",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-rose-500"}),"Post-Hoc Clustering (Segmentation)",i.jsx(_e,{text:"Automatically groups data points into distinct clusters (segments) based on similarity. Useful for finding natural groups like 'High Spenders' or 'At Risk' users."})]}),i.jsx("button",{onClick:()=>l("clustering-chart","clustering-analysis","Clustering Segmentation",`${a.n_clusters} Clusters Found`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:i.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:i.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"Algorithm Summary"}),i.jsxs("div",{className:"space-y-1 text-sm text-purple-700 dark:text-purple-300",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Method:"}),i.jsx("span",{className:"font-medium",children:a.method})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Metric (Inertia):"}),i.jsx("span",{className:"font-medium",children:a.inertia.toFixed(1)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Clusters:"}),i.jsx("span",{className:"font-medium",children:a.n_clusters})]})]})]})}),i.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mt-4",children:"Cluster Profiles (Centroids)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:a.clusters.map(d=>i.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[i.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:rd(d.cluster_id)}}),"Cluster ",d.cluster_id]}),i.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[d.percentage.toFixed(1),"% (",d.size,")"]})]}),i.jsxs("div",{className:"space-y-1",children:[Object.entries(d.center).sort(([,h],[,u])=>Math.abs(u)-Math.abs(h)).slice(0,5).map(([h,u])=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:h,children:h}),i.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:u.toFixed(2)})]},h)),Object.keys(d.center).length>5&&i.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(d.center).length-5," more features"]})]})]},d.cluster_id))})]})})]}),i.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 rounded-lg text-sm border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),i.jsx("div",{children:"These clusters are found using unsupervised learning (K-Means) on numeric features. The plot shows a 2D projection (PCA) of the clusters. Use this to identify distinct groups of data points that behave similarly."})]})]}):i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm flex flex-col items-center justify-center text-gray-500 min-h-[300px]",children:[i.jsx(wt,{className:"w-12 h-12 mb-4 opacity-20"}),i.jsx("p",{children:"Clustering analysis not available."}),i.jsx("p",{className:"text-sm mt-2",children:"Requires at least 2 numeric columns."})]})},rd=n=>We[n%We.length];function ad({components:n,isPCA3D:l}){return i.jsx(i.Fragment,{children:n&&n.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Principal Component Composition"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,l?3:2).map(a=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex justify-between items-center border-b border-gray-200 dark:border-gray-700 pb-2 mb-2",children:[i.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-200",children:a.component}),i.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 px-2 py-0.5 rounded-full",children:[(a.explained_variance_ratio*100).toFixed(1),"% Var"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:"Top Loadings"}),Object.entries(a.top_features||{}).map(([d,h],u)=>i.jsxs("div",{className:"flex justify-between text-xs items-center group",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400 truncate mr-2 flex-1",title:d,children:d}),i.jsxs("span",{className:`font-mono text-[10px] ${Number(h)>0?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400"}`,children:[Number(h)>0?"+":"",Number(h).toFixed(3)]})]},u))]})]},a.component))})]})})}const od=({profile:n,isPCA3D:l,setIsPCA3D:a,downloadChart:d})=>{const h=Array.isArray(n.pca_data)&&n.pca_data.length>0,u=h?"Download Chart":"Not enough numeric data for PCA",m=k.useMemo(()=>n.pca_data??[],[n.pca_data]),p=k.useMemo(()=>Pr(Gt(m,"label")),[m]),g=k.useMemo(()=>{const w=[{key:"x",label:"PC1"},{key:"y",label:"PC2"}];return l&&w.push({key:"z",label:"PC3"}),w.push({key:"label",label:"Group"}),w},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Multivariate Structure (PCA)",i.jsx(_e,{text:"Reduces data to 2D or 3D. Points closer together are similar. Colors show clusters or target values."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{disabled:!h,onClick:()=>d("pca-chart","pca-analysis","Multivariate Structure (PCA)",l?"3D Projection":"2D Projection"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:u,"aria-label":u,children:i.jsx(ke,{className:"w-4 h-4"})}),i.jsxs("button",{onClick:()=>a(!l),className:`p-2 rounded-md border transition-colors flex items-center gap-2 text-sm ${l?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,children:[i.jsx(_r,{className:"w-4 h-4"}),l?"Switch to 2D":"Switch to 3D"]})]})]}),i.jsx("div",{id:"pca-chart",children:n.pca_data?l?i.jsx(Sr,{data:n.pca_data,xKey:"x",yKey:"y",zKey:"z",labelKey:"label",xLabel:"PC1",yLabel:"PC2",zLabel:"PC3"}):i.jsx(Tr,{data:n.pca_data,xKey:"x",yKey:"y",labelKey:"label",xLabel:"Principal Component 1 (PC1)",yLabel:"Principal Component 2 (PC2)"}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm text-center p-4",children:"Not enough numeric data for PCA."})}),p.length>0&&i.jsx(Ns,{entries:p}),i.jsx(ki,{caption:"PCA projection data",filename:"pca-analysis",columns:g,rows:m}),i.jsxs("div",{className:"mt-6 flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:"About this visualization"}),i.jsxs("p",{children:["This chart shows a ",l?"3D":"2D"," projection of your data using Principal Component Analysis (PCA). Points that are close together share similar characteristics across all numeric features."]}),i.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["* For performance, this visualization uses a random sample of up to ",i.jsx("strong",{children:"5,000 points"}),"."]})]})]}),i.jsx(ad,{components:n.pca_components,isPCA3D:l})]}),i.jsx(nd,{profile:n,downloadChart:d})]})};function Er(n,l){const a=k.useRef(l);k.useEffect(function(){l!==a.current&&n.attributionControl!=null&&(a.current!=null&&n.attributionControl.removeAttribution(a.current),l!=null&&n.attributionControl.addAttribution(l)),a.current=l},[n,l])}function ld(n,l,a){l.center!==a.center&&n.setLatLng(l.center),l.radius!=null&&l.radius!==a.radius&&n.setRadius(l.radius)}const dd=1;function cd(n){return Object.freeze({__version:dd,map:n})}function hd(n,l){return Object.freeze({...n,...l})}const Mr=k.createContext(null),Ar=Mr.Provider;function Cs(){const n=k.useContext(Mr);if(n==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return n}function ud(n){function l(a,d){const{instance:h,context:u}=n(a).current;return k.useImperativeHandle(d,()=>h),a.children==null?null:$t.createElement(Ar,{value:u},a.children)}return k.forwardRef(l)}function md(n){function l(a,d){const[h,u]=k.useState(!1),{instance:m}=n(a,u).current;k.useImperativeHandle(d,()=>m),k.useEffect(function(){h&&m.update()},[m,h,a.children]);const p=m._contentNode;return p?qo.createPortal(a.children,p):null}return k.forwardRef(l)}function fd(n){function l(a,d){const{instance:h}=n(a).current;return k.useImperativeHandle(d,()=>h),null}return k.forwardRef(l)}function Ls(n,l){const a=k.useRef();k.useEffect(function(){return l!=null&&n.instance.on(l),a.current=l,function(){a.current!=null&&n.instance.off(a.current),a.current=null}},[n,l])}function Ni(n,l){const a=n.pane??l.pane;return a?{...n,pane:a}:n}function gd(n,l){return function(d,h){const u=Cs(),m=n(Ni(d,u),u);return Er(u.map,d.attribution),Ls(m.current,d.eventHandlers),l(m.current,u,d,h),m}}var Bt={exports:{}};/* @preserve + * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com + * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade + */var pd=Bt.exports,Vn;function xd(){return Vn||(Vn=1,(function(n,l){(function(a,d){d(l)})(pd,(function(a){var d="1.9.4";function h(e){var t,s,r,o;for(s=1,r=arguments.length;s"u"||!L||!L.Mixin)){e=G(e)?e:[e];for(var t=0;t0?Math.floor(e):Math.ceil(e)};O.prototype={clone:function(){return new O(this.x,this.y)},add:function(e){return this.clone()._add(z(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(z(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new O(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new O(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=ce(this.x),this.y=ce(this.y),this},distanceTo:function(e){e=z(e);var t=e.x-this.x,s=e.y-this.y;return Math.sqrt(t*t+s*s)},equals:function(e){return e=z(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=z(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+x(this.x)+", "+x(this.y)+")"}};function z(e,t,s){return e instanceof O?e:G(e)?new O(e[0],e[1]):e==null?e:typeof e=="object"&&"x"in e&&"y"in e?new O(e.x,e.y):new O(e,t,s)}function q(e,t){if(e)for(var s=t?[e,t]:e,r=0,o=s.length;r=this.min.x&&s.x<=this.max.x&&t.y>=this.min.y&&s.y<=this.max.y},intersects:function(e){e=ee(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>=t.x&&r.x<=s.x,f=o.y>=t.y&&r.y<=s.y;return c&&f},overlaps:function(e){e=ee(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>t.x&&r.xt.y&&r.y=t.lat&&o.lat<=s.lat&&r.lng>=t.lng&&o.lng<=s.lng},intersects:function(e){e=se(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>=t.lat&&r.lat<=s.lat,f=o.lng>=t.lng&&r.lng<=s.lng;return c&&f},overlaps:function(e){e=se(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>t.lat&&r.latt.lng&&r.lng1,Xr=(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",b,t),window.removeEventListener("testPassiveEventSupport",b,t)}catch{}return e})(),Qr=(function(){return!!document.createElement("canvas").getContext})(),Ei=!!(document.createElementNS&&Re("svg").createSVGRect),Jr=!!Ei&&(function(){var e=document.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),ea=!Ei&&(function(){try{var e=document.createElement("div");e.innerHTML='';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&typeof t.adj=="object"}catch{return!1}})(),ta=navigator.platform.indexOf("Mac")===0,ia=navigator.platform.indexOf("Linux")===0;function Ae(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var R={ie:Qt,ielt9:Fr,edge:Ts,webkit:Pi,android:Es,android23:Ms,androidStock:Zr,opera:Si,chrome:As,gecko:zs,safari:$r,phantom:Is,opera12:Os,win:Hr,ie3d:Ds,webkit3d:Ti,gecko3d:Rs,any3d:Wr,mobile:Ct,mobileWebkit:Vr,mobileWebkit3d:qr,msPointer:Fs,pointer:Bs,touch:Ur,touchNative:Zs,mobileOpera:Kr,mobileGecko:Gr,retina:Yr,passiveEvents:Xr,canvas:Qr,svg:Ei,vml:ea,inlineSvg:Jr,mac:ta,linux:ia},$s=R.msPointer?"MSPointerDown":"pointerdown",Hs=R.msPointer?"MSPointerMove":"pointermove",Ws=R.msPointer?"MSPointerUp":"pointerup",Vs=R.msPointer?"MSPointerCancel":"pointercancel",Mi={touchstart:$s,touchmove:Hs,touchend:Ws,touchcancel:Vs},qs={touchstart:la,touchmove:Jt,touchend:Jt,touchcancel:Jt},ot={},Us=!1;function sa(e,t,s){return t==="touchstart"&&oa(),qs[t]?(s=qs[t].bind(this,s),e.addEventListener(Mi[t],s,!1),s):(console.warn("wrong event specified:",t),b)}function na(e,t,s){if(!Mi[t]){console.warn("wrong event specified:",t);return}e.removeEventListener(Mi[t],s,!1)}function ra(e){ot[e.pointerId]=e}function aa(e){ot[e.pointerId]&&(ot[e.pointerId]=e)}function Ks(e){delete ot[e.pointerId]}function oa(){Us||(document.addEventListener($s,ra,!0),document.addEventListener(Hs,aa,!0),document.addEventListener(Ws,Ks,!0),document.addEventListener(Vs,Ks,!0),Us=!0)}function Jt(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){t.touches=[];for(var s in ot)t.touches.push(ot[s]);t.changedTouches=[t],e(t)}}function la(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&xe(t),Jt(e,t)}function da(e){var t={},s,r;for(r in e)s=e[r],t[r]=s&&s.bind?s.bind(e):s;return e=t,t.type="dblclick",t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var ca=200;function ha(e,t){e.addEventListener("dblclick",t);var s=0,r;function o(c){if(c.detail!==1){r=c.detail;return}if(!(c.pointerType==="mouse"||c.sourceCapabilities&&!c.sourceCapabilities.firesTouchEvents)){var f=Js(c);if(!(f.some(function(v){return v instanceof HTMLLabelElement&&v.attributes.for})&&!f.some(function(v){return v instanceof HTMLInputElement||v instanceof HTMLSelectElement}))){var _=Date.now();_-s<=ca?(r++,r===2&&t(da(c))):r=1,s=_}}}return e.addEventListener("click",o),{dblclick:t,simDblclick:o}}function ua(e,t){e.removeEventListener("dblclick",t.dblclick),e.removeEventListener("click",t.simDblclick)}var Ai=ii(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Lt=ii(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Gs=Lt==="webkitTransition"||Lt==="OTransition"?Lt+"End":"transitionend";function Ys(e){return typeof e=="string"?document.getElementById(e):e}function Pt(e,t){var s=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!s||s==="auto")&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);s=r?r[t]:null}return s==="auto"?null:s}function X(e,t,s){var r=document.createElement(e);return r.className=t||"",s&&s.appendChild(r),r}function de(e){var t=e.parentNode;t&&t.removeChild(e)}function ei(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function lt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function dt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function zi(e,t){if(e.classList!==void 0)return e.classList.contains(t);var s=ti(e);return s.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(s)}function W(e,t){if(e.classList!==void 0)for(var s=P(t),r=0,o=s.length;r0?2*window.devicePixelRatio:1;function tn(e){return R.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/ga:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function qi(e,t){var s=t.relatedTarget;if(!s)return!0;try{for(;s&&s!==e;)s=s.parentNode}catch{return!1}return s!==e}var pa={__proto__:null,on:$,off:ae,stopPropagation:tt,disableScrollPropagation:Vi,disableClickPropagation:Mt,preventDefault:xe,stop:it,getPropagationPath:Js,getMousePosition:en,getWheelDelta:tn,isExternalTarget:qi,addListener:$,removeListener:ae},sn=ge.extend({run:function(e,t,s,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=s||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=et(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,s=this._duration*1e3;tthis.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var s=this.getCenter(),r=this._limitCenter(s,this._zoom,se(e));return s.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t=t||{};var s=z(t.paddingTopLeft||t.padding||[0,0]),r=z(t.paddingBottomRight||t.padding||[0,0]),o=this.project(this.getCenter()),c=this.project(e),f=this.getPixelBounds(),_=ee([f.min.add(s),f.max.subtract(r)]),v=_.getSize();if(!_.contains(c)){this._enforcingBounds=!0;var C=c.subtract(_.getCenter()),T=_.extend(c).getSize().subtract(v);o.x+=C.x<0?-T.x:T.x,o.y+=C.y<0?-T.y:T.y,this.panTo(this.unproject(o),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=h({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var s=this.getSize(),r=t.divideBy(2).round(),o=s.divideBy(2).round(),c=r.subtract(o);return!c.x&&!c.y?this:(e.animate&&e.pan?this.panBy(c):(e.pan&&this._rawPanBy(c),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(m(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:t,newSize:s}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=h({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=m(this._handleGeolocationResponse,this),s=m(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,s,e):navigator.geolocation.getCurrentPosition(t,s,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,s=e.message||(t===1?"permission denied":t===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+s+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,s=e.coords.longitude,r=new J(t,s),o=r.toBounds(e.coords.accuracy*2),c=this._locateOptions;if(c.setView){var f=this.getBoundsZoom(o);this.setView(r,c.maxZoom?Math.min(f,c.maxZoom):f)}var _={latlng:r,bounds:o,timestamp:e.timestamp};for(var v in e.coords)typeof e.coords[v]=="number"&&(_[v]=e.coords[v]);this.fire("locationfound",_)}},addHandler:function(e,t){if(!t)return this;var s=this[e]=new t(this);return this._handlers.push(s),this.options[e]&&s.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),de(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(H(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var e;for(e in this._layers)this._layers[e].remove();for(e in this._panes)de(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var s="leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),r=X("div",s,t||this._mapPane);return e&&(this._panes[e]=r),r},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds(),t=this.unproject(e.getBottomLeft()),s=this.unproject(e.getTopRight());return new oe(t,s)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,s){e=se(e),s=z(s||[0,0]);var r=this.getZoom()||0,o=this.getMinZoom(),c=this.getMaxZoom(),f=e.getNorthWest(),_=e.getSouthEast(),v=this.getSize().subtract(s),C=ee(this.project(_,r),this.project(f,r)).getSize(),T=R.any3d?this.options.zoomSnap:1,F=v.x/C.x,U=v.y/C.y,ve=t?Math.max(F,U):Math.min(F,U);return r=this.getScaleZoom(ve,r),T&&(r=Math.round(r/(T/100))*(T/100),r=t?Math.ceil(r/T)*T:Math.floor(r/T)*T),Math.max(o,Math.min(c,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var s=this._getTopLeftPoint(e,t);return new q(s,s.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e=="string"?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var s=this.options.crs;return t=t===void 0?this._zoom:t,s.scale(e)/s.scale(t)},getScaleZoom:function(e,t){var s=this.options.crs;t=t===void 0?this._zoom:t;var r=s.zoom(e*s.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(K(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(z(e),t)},layerPointToLatLng:function(e){var t=z(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){var t=this.project(K(e))._round();return t._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(K(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(se(e))},distance:function(e,t){return this.options.crs.distance(K(e),K(t))},containerPointToLayerPoint:function(e){return z(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return z(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(z(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(K(e)))},mouseEventToContainerPoint:function(e){return en(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=Ys(e);if(t){if(t._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");$(t,"scroll",this._onScroll,this),this._containerId=g(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&R.any3d,W(e,"leaflet-container"+(R.touch?" leaflet-touch":"")+(R.retina?" leaflet-retina":"")+(R.ielt9?" leaflet-oldie":"")+(R.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var t=Pt(e,"position");t!=="absolute"&&t!=="relative"&&t!=="fixed"&&t!=="sticky"&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ue(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(W(e.markerPane,"leaflet-zoom-hide"),W(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,t,s){ue(this._mapPane,new O(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset");var o=this._zoom!==t;this._moveStart(o,s)._move(e,t)._moveEnd(o),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(e,t){return e&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(e,t,s,r){t===void 0&&(t=this._zoom);var o=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?s&&s.pinch&&this.fire("zoom",s):((o||s&&s.pinch)&&this.fire("zoom",s),this.fire("move",s)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return H(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){ue(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[g(this._container)]=this;var t=e?ae:$;t(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&t(window,"resize",this._onResize,this),R.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){H(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var s=[],r,o=t==="mouseout"||t==="mouseover",c=e.target||e.srcElement,f=!1;c;){if(r=this._targets[g(c)],r&&(t==="click"||t==="preclick")&&this._draggableMoved(r)){f=!0;break}if(r&&r.listens(t,!0)&&(o&&!qi(c,e)||(s.push(r),o))||c===this._container)break;c=c.parentNode}return!s.length&&!f&&!o&&this.listens(t,!0)&&(s=[this]),s},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type==="click"&&this._isClickDisabled(t))){var s=e.type;s==="mousedown"&&Bi(t),this._fireDOMEvent(e,s)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,s){if(e.type==="click"){var r=h({},e);r.type="preclick",this._fireDOMEvent(r,r.type,s)}var o=this._findEventTargets(e,t);if(s){for(var c=[],f=0;f0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),s=this.getMaxZoom(),r=R.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(s,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){he(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,t){var s=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(s)?!1:(this.panBy(s,t),!0)},_createAnimProxy:function(){var e=this._proxy=X("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(t){var s=Ai,r=this._proxy.style[s];Je(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),r===this._proxy.style[s]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){de(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Je(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,t,s){if(this._animatingZoom)return!0;if(s=s||{},!this._zoomAnimated||s.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),o=this._getCenterOffset(e)._divideBy(1-1/r);return s.animate!==!0&&!this.getSize().contains(o)?!1:(B(function(){this._moveStart(!0,s.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,s,r){this._mapPane&&(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,W(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(m(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&he(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function xa(e,t){return new Y(e,t)}var Se=Z.extend({options:{position:"topright"},initialize:function(e){j(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),s=this.getPosition(),r=e._controlCorners[s];return W(t,"leaflet-control"),s.indexOf("bottom")!==-1?r.insertBefore(t,r.firstChild):r.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(de(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),At=function(e){return new Se(e)};Y.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t="leaflet-",s=this._controlContainer=X("div",t+"control-container",this._container);function r(o,c){var f=t+o+" "+t+c;e[o+c]=X("div",f,s)}r("top","left"),r("top","right"),r("bottom","left"),r("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)de(this._controlCorners[e]);de(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var nn=Se.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,s,r){return s1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=t&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(g(e.target)),s=t.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;s&&this._map.fire(s,t)},_createRadioElement:function(e,t){var s='",r=document.createElement("div");return r.innerHTML=s,r.firstChild},_addItem:function(e){var t=document.createElement("label"),s=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=s):r=this._createRadioElement("leaflet-base-layers_"+g(this),s),this._layerControlInputs.push(r),r.layerId=g(e.layer),$(r,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+e.name;var c=document.createElement("span");t.appendChild(c),c.appendChild(r),c.appendChild(o);var f=e.overlay?this._overlaysList:this._baseLayersList;return f.appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,s,r=[],o=[];this._handlingClick=!0;for(var c=e.length-1;c>=0;c--)t=e[c],s=this._getLayer(t.layerId).layer,t.checked?r.push(s):t.checked||o.push(s);for(c=0;c=0;o--)t=e[o],s=this._getLayer(t.layerId).layer,t.disabled=s.options.minZoom!==void 0&&rs.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,$(e,"click",xe),this.expand();var t=this;setTimeout(function(){ae(e,"click",xe),t._preventClick=!1})}}),_a=function(e,t,s){return new nn(e,t,s)},Ui=Se.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",s=X("div",t+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+"-in",s,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+"-out",s,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),s},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,s,r,o){var c=X("a",s,r);return c.innerHTML=e,c.href="#",c.title=t,c.setAttribute("role","button"),c.setAttribute("aria-label",t),Mt(c),$(c,"click",it),$(c,"click",o,this),$(c,"click",this._refocusOnMap,this),c},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";he(this._zoomInButton,t),he(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(W(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(W(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});Y.mergeOptions({zoomControl:!0}),Y.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ui,this.addControl(this.zoomControl))});var ya=function(e){return new Ui(e)},rn=Se.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",s=X("div",t),r=this.options;return this._addScales(r,t+"-line",s),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),s},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,s){e.metric&&(this._mScale=X("div",t,s)),e.imperial&&(this._iScale=X("div",t,s))},_update:function(){var e=this._map,t=e.getSize().y/2,s=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(s)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),s=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,s,t/e)},_updateImperial:function(e){var t=e*3.2808399,s,r,o;t>5280?(s=t/5280,r=this._getRoundNum(s),this._updateScale(this._iScale,r+" mi",r/s)):(o=this._getRoundNum(t),this._updateScale(this._iScale,o+" ft",o/t))},_updateScale:function(e,t,s){e.style.width=Math.round(this.options.maxWidth*s)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),s=e/t;return s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:1,t*s}}),va=function(e){return new rn(e)},ba='',Ki=Se.extend({options:{position:"bottomright",prefix:''+(R.inlineSvg?ba+" ":"")+"Leaflet"},initialize:function(e){j(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=X("div","leaflet-control-attribution"),Mt(this._container);for(var t in e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var s=[];this.options.prefix&&s.push(this.options.prefix),e.length&&s.push(e.join(", ")),this._container.innerHTML=s.join(' ')}}});Y.mergeOptions({attributionControl:!0}),Y.addInitHook(function(){this.options.attributionControl&&new Ki().addTo(this)});var wa=function(e){return new Ki(e)};Se.Layers=nn,Se.Zoom=Ui,Se.Scale=rn,Se.Attribution=Ki,At.layers=_a,At.zoom=ya,At.scale=va,At.attribution=wa;var Ie=Z.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ie.addTo=function(e,t){return e.addHandler(t,this),this};var ja={Events:Q},an=R.touch?"touchstart mousedown":"mousedown",Ke=ge.extend({options:{clickTolerance:3},initialize:function(e,t,s,r){j(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=s},enable:function(){this._enabled||($(this._dragStartTarget,an,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ke._dragging===this&&this.finishDrag(!0),ae(this._dragStartTarget,an,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!zi(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){Ke._dragging===this&&this.finishDrag();return}if(!(Ke._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Ke._dragging=this,this._preventOutline&&Bi(this._element),Di(),St(),!this._moving)){this.fire("down");var t=e.touches?e.touches[0]:e,s=Xs(this._element);this._startPoint=new O(t.clientX,t.clientY),this._startPos=et(this._element),this._parentScale=Zi(s);var r=e.type==="mousedown";$(document,r?"mousemove":"touchmove",this._onMove,this),$(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,s=new O(t.clientX,t.clientY)._subtract(this._startPoint);!s.x&&!s.y||Math.abs(s.x)+Math.abs(s.y)c&&(f=_,c=v);c>s&&(t[f]=1,Yi(e,t,s,r,f),Yi(e,t,s,f,o))}function La(e,t){for(var s=[e[0]],r=1,o=0,c=e.length;rt&&(s.push(e[r]),o=r);return ot.max.x&&(s|=2),e.yt.max.y&&(s|=8),s}function Pa(e,t){var s=t.x-e.x,r=t.y-e.y;return s*s+r*r}function zt(e,t,s,r){var o=t.x,c=t.y,f=s.x-o,_=s.y-c,v=f*f+_*_,C;return v>0&&(C=((e.x-o)*f+(e.y-c)*_)/v,C>1?(o=s.x,c=s.y):C>0&&(o+=f*C,c+=_*C)),f=e.x-o,_=e.y-c,r?f*f+_*_:new O(o,c)}function Ce(e){return!G(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function mn(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ce(e)}function fn(e,t){var s,r,o,c,f,_,v,C;if(!e||e.length===0)throw new Error("latlngs not passed");Ce(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var T=K([0,0]),F=se(e),U=F.getNorthWest().distanceTo(F.getSouthWest())*F.getNorthEast().distanceTo(F.getNorthWest());U<1700&&(T=Gi(e));var ve=e.length,pe=[];for(s=0;sr){v=(c-r)/o,C=[_.x-v*(_.x-f.x),_.y-v*(_.y-f.y)];break}var je=t.unproject(z(C));return K([je.lat+T.lat,je.lng+T.lng])}var Sa={__proto__:null,simplify:dn,pointToSegmentDistance:cn,closestPointOnSegment:Na,clipSegment:un,_getEdgeIntersection:ri,_getBitCode:st,_sqClosestPointOnSegment:zt,isFlat:Ce,_flat:mn,polylineCenter:fn},Xi={project:function(e){return new O(e.lng,e.lat)},unproject:function(e){return new J(e.y,e.x)},bounds:new q([-180,-90],[180,90])},Qi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var t=Math.PI/180,s=this.R,r=e.lat*t,o=this.R_MINOR/s,c=Math.sqrt(1-o*o),f=c*Math.sin(r),_=Math.tan(Math.PI/4-r/2)/Math.pow((1-f)/(1+f),c/2);return r=-s*Math.log(Math.max(_,1e-10)),new O(e.lng*t*s,r)},unproject:function(e){for(var t=180/Math.PI,s=this.R,r=this.R_MINOR/s,o=Math.sqrt(1-r*r),c=Math.exp(-e.y/s),f=Math.PI/2-2*Math.atan(c),_=0,v=.1,C;_<15&&Math.abs(v)>1e-7;_++)C=o*Math.sin(f),C=Math.pow((1-C)/(1+C),o/2),v=Math.PI/2-2*Math.atan(c*C)-f,f+=v;return new J(f*t,e.x*t/s)}},Ta={__proto__:null,LonLat:Xi,Mercator:Qi,SphericalMercator:kt},Ea=h({},Me,{code:"EPSG:3395",projection:Qi,transformation:(function(){var e=.5/(Math.PI*Qi.R);return E(e,.5,-e,.5)})()}),gn=h({},Me,{code:"EPSG:4326",projection:Xi,transformation:E(1/180,1,-1/180,.5)}),Ma=h({},Pe,{projection:Xi,transformation:E(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var s=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(s*s+r*r)},infinite:!0});Pe.Earth=Me,Pe.EPSG3395=Ea,Pe.EPSG3857=ye,Pe.EPSG900913=Ue,Pe.EPSG4326=gn,Pe.Simple=Ma;var Te=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[g(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[g(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var s=this.getEvents();t.on(s,this),this.once("remove",function(){t.off(s,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});Y.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=g(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=g(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return g(e)in this._layers},eachLayer:function(e,t){for(var s in this._layers)e.call(t,this._layers[s]);return this},_addLayers:function(e){e=e?G(e)?e:[e]:[];for(var t=0,s=e.length;tthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&t[0]instanceof J&&t[0].equals(t[s-1])&&t.pop(),t},_setLatLngs:function(e){Be.prototype._setLatLngs.call(this,e),Ce(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ce(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,s=new O(t,t);if(e=new q(e.min.subtract(s),e.max.add(s)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,o=this._rings.length,c;re.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(t=!t);return t||Be.prototype._containsPoint.call(this,e,!0)}});function Ba(e,t){return new ut(e,t)}var Ze=Fe.extend({initialize:function(e,t){j(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=G(e)?e:e.features,s,r,o;if(t){for(s=0,r=t.length;s0&&o.push(o[0].slice()),o}function mt(e,t){return e.feature?h({},e.feature,{geometry:t}):hi(t)}function hi(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var is={toGeoJSON:function(e){return mt(this,{type:"Point",coordinates:ts(this.getLatLng(),e)})}};ai.include(is),Ji.include(is),oi.include(is),Be.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=ci(this._latlngs,t?1:0,!1,e);return mt(this,{type:(t?"Multi":"")+"LineString",coordinates:s})}}),ut.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=t&&!Ce(this._latlngs[0]),r=ci(this._latlngs,s?2:t?1:0,!0,e);return t||(r=[r]),mt(this,{type:(s?"Multi":"")+"Polygon",coordinates:r})}}),ct.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(s){t.push(s.toGeoJSON(e).geometry.coordinates)}),mt(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t==="MultiPoint")return this.toMultiPoint(e);var s=t==="GeometryCollection",r=[];return this.eachLayer(function(o){if(o.toGeoJSON){var c=o.toGeoJSON(e);if(s)r.push(c.geometry);else{var f=hi(c);f.type==="FeatureCollection"?r.push.apply(r,f.features):r.push(f)}}}),s?mt(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function _n(e,t){return new Ze(e,t)}var Za=_n,ui=Te.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,s){this._url=e,this._bounds=se(t),j(this,s)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(W(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){de(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&<(this._image),this},bringToBack:function(){return this._map&&dt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=se(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",t=this._image=e?this._url:X("img");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onload=m(this.fire,this,"load"),t.onerror=m(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(t.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),s=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Je(this._image,s,t)},_reset:function(){var e=this._image,t=new q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),s=t.getSize();ue(e,t.min),e.style.width=s.x+"px",e.style.height=s.y+"px"},_updateOpacity:function(){Ne(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),$a=function(e,t,s){return new ui(e,t,s)},yn=ui.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",t=this._image=e?this._url:X("video");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onloadeddata=m(this.fire,this,"load"),e){for(var s=t.getElementsByTagName("source"),r=[],o=0;o0?r:[t.src];return}G(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var c=0;co?(t.height=o+"px",W(e,c)):he(e,c),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),s=this._getAnchor();ue(this._container,t.add(s))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(Pt(this._container,"marginBottom"),10)||0,s=this._container.offsetHeight+t,r=this._containerWidth,o=new O(this._containerLeft,-s-this._containerBottom);o._add(et(this._container));var c=e.layerPointToContainerPoint(o),f=z(this.options.autoPanPadding),_=z(this.options.autoPanPaddingTopLeft||f),v=z(this.options.autoPanPaddingBottomRight||f),C=e.getSize(),T=0,F=0;c.x+r+v.x>C.x&&(T=c.x+r-C.x+v.x),c.x-T-_.x<0&&(T=c.x-_.x),c.y+s+v.y>C.y&&(F=c.y+s-C.y+v.y),c.y-F-_.y<0&&(F=c.y-_.y),(T||F)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([T,F]))}},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Va=function(e,t){return new mi(e,t)};Y.mergeOptions({closePopupOnClick:!0}),Y.include({openPopup:function(e,t,s){return this._initOverlay(mi,e,t,s).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Te.include({bindPopup:function(e,t){return this._popup=this._initOverlay(mi,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Fe||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){it(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof Ge)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var fi=Oe.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Oe.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Oe.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Oe.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",t=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=X("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,s,r=this._map,o=this._container,c=r.latLngToContainerPoint(r.getCenter()),f=r.layerPointToContainerPoint(e),_=this.options.direction,v=o.offsetWidth,C=o.offsetHeight,T=z(this.options.offset),F=this._getAnchor();_==="top"?(t=v/2,s=C):_==="bottom"?(t=v/2,s=0):_==="center"?(t=v/2,s=C/2):_==="right"?(t=0,s=C/2):_==="left"?(t=v,s=C/2):f.xthis.options.maxZoom||sr?this._retainParent(o,c,f,r):!1)},_retainChildren:function(e,t,s,r){for(var o=2*e;o<2*e+2;o++)for(var c=2*t;c<2*t+2;c++){var f=new O(o,c);f.z=s+1;var _=this._tileCoordsToKey(f),v=this._tiles[_];if(v&&v.active){v.retain=!0;continue}else v&&v.loaded&&(v.retain=!0);s+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(e,s);return}for(var F=o.min.y;F<=o.max.y;F++)for(var U=o.min.x;U<=o.max.x;U++){var ve=new O(U,F);if(ve.z=this._tileZoom,!!this._isValidTile(ve)){var pe=this._tiles[this._tileCoordsToKey(ve)];pe?pe.current=!0:f.push(ve)}}if(f.sort(function(je,gt){return je.distanceTo(c)-gt.distanceTo(c)}),f.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Le=document.createDocumentFragment();for(U=0;Us.max.x)||!t.wrapLat&&(e.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return se(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,s=this.getTileSize(),r=e.scaleBy(s),o=r.add(s),c=t.unproject(r,e.z),f=t.unproject(o,e.z);return[c,f]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),s=new oe(t[0],t[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),s=new O(+t[0],+t[1]);return s.z=+t[2],s},_removeTile:function(e){var t=this._tiles[e];t&&(de(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){W(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=b,e.onmousemove=b,R.ielt9&&this.options.opacity<1&&Ne(e,this.options.opacity)},_addTile:function(e,t){var s=this._getTilePos(e),r=this._tileCoordsToKey(e),o=this.createTile(this._wrapCoords(e),m(this._tileReady,this,e));this._initTile(o),this.createTile.length<2&&B(m(this._tileReady,this,e,null,o)),ue(o,s),this._tiles[r]={el:o,coords:e,current:!0},t.appendChild(o),this.fire("tileloadstart",{tile:o,coords:e})},_tileReady:function(e,t,s){t&&this.fire("tileerror",{error:t,tile:s,coords:e});var r=this._tileCoordsToKey(e);s=this._tiles[r],s&&(s.loaded=+new Date,this._map._fadeAnimated?(Ne(s.el,0),H(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(s.active=!0,this._pruneTiles()),t||(W(s.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:s.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),R.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(m(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new O(this._wrapX?y(e.x,this._wrapX):e.x,this._wrapY?y(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new q(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Ka(e){return new Ot(e)}var ft=Ot.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=j(this,t),t.detectRetina&&R.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains=="string"&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var s=document.createElement("img");return $(s,"load",m(this._tileOnLoad,this,t,s)),$(s,"error",m(this._tileOnError,this,t,s)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(s.referrerPolicy=this.options.referrerPolicy),s.alt="",s.src=this.getTileUrl(e),s},getTileUrl:function(e){var t={r:R.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var s=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=s),t["-y"]=s}return S(this._url,h(t,this.options))},_tileOnLoad:function(e,t){R.ielt9?setTimeout(m(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,s){var r=this.options.errorTileUrl;r&&t.getAttribute("src")!==r&&(t.src=r),e(s,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,s=this.options.zoomReverse,r=this.options.zoomOffset;return s&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=b,t.onerror=b,!t.complete)){t.src=le;var s=this._tiles[e].coords;de(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:s})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",le),Ot.prototype._removeTile.call(this,e)},_tileReady:function(e,t,s){if(!(!this._map||s&&s.getAttribute("src")===le))return Ot.prototype._tileReady.call(this,e,t,s)}});function wn(e,t){return new ft(e,t)}var jn=ft.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var s=h({},this.defaultWmsParams);for(var r in t)r in this.options||(s[r]=t[r]);t=j(this,t);var o=t.detectRetina&&R.retina?2:1,c=this.getTileSize();s.width=c.x*o,s.height=c.y*o,this.wmsParams=s},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,ft.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),s=this._crs,r=ee(s.project(t[0]),s.project(t[1])),o=r.min,c=r.max,f=(this._wmsVersion>=1.3&&this._crs===gn?[o.y,o.x,c.y,c.x]:[o.x,o.y,c.x,c.y]).join(","),_=ft.prototype.getTileUrl.call(this,e);return _+M(this.wmsParams,_,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+f},setParams:function(e,t){return h(this.wmsParams,e),t||this.redraw(),this}});function Ga(e,t){return new jn(e,t)}ft.WMS=jn,wn.wms=Ga;var $e=Te.extend({options:{padding:.1},initialize:function(e){j(this,e),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),W(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var s=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,t),c=r.multiplyBy(-s).add(o).subtract(this._map._getNewPixelOrigin(e,t));R.any3d?Je(this._container,c,s):ue(this._container,c)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),s=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new q(s,s.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),kn=$e.extend({options:{tolerance:0},getEvents:function(){var e=$e.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$e.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");$(e,"mousemove",this._onMouseMove,this),$(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){H(this._redrawRequest),delete this._ctx,de(this._container),ae(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var t in this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=this._container,s=e.getSize(),r=R.retina?2:1;ue(t,e.min),t.width=r*s.x,t.height=r*s.y,t.style.width=s.x+"px",t.style.height=s.y+"px",R.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){$e.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[g(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,s=t.next,r=t.prev;s?s.prev=r:this._drawLast=r,r?r.next=s:this._drawFirst=s,delete e._order,delete this._layers[g(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var t=e.options.dashArray.split(/[, ]+/),s=[],r,o;for(o=0;o')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Ya={_initContainer:function(){this._container=X("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($e.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=Dt("shape");W(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=Dt("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;de(t),e.removeInteractiveTarget(t),delete this._layers[g(e)]},_updateStyle:function(e){var t=e._stroke,s=e._fill,r=e.options,o=e._container;o.stroked=!!r.stroke,o.filled=!!r.fill,r.stroke?(t||(t=e._stroke=Dt("stroke")),o.appendChild(t),t.weight=r.weight+"px",t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=G(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=r.lineCap.replace("butt","flat"),t.joinstyle=r.lineJoin):t&&(o.removeChild(t),e._stroke=null),r.fill?(s||(s=e._fill=Dt("fill")),o.appendChild(s),s.color=r.fillColor||r.color,s.opacity=r.fillOpacity):s&&(o.removeChild(s),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),s=Math.round(e._radius),r=Math.round(e._radiusY||s);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+s+","+r+" 0,"+65535*360)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){lt(e._container)},_bringToBack:function(e){dt(e._container)}},gi=R.vml?Dt:Re,Rt=$e.extend({_initContainer:function(){this._container=gi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=gi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){de(this._container),ae(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=e.getSize(),s=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,s.setAttribute("width",t.x),s.setAttribute("height",t.y)),ue(s,e.min),s.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=gi("path");e.options.className&&W(t,e.options.className),e.options.interactive&&W(t,"leaflet-interactive"),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){de(e._path),e.removeInteractiveTarget(e._path),delete this._layers[g(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,s=e.options;t&&(s.stroke?(t.setAttribute("stroke",s.color),t.setAttribute("stroke-opacity",s.opacity),t.setAttribute("stroke-width",s.weight),t.setAttribute("stroke-linecap",s.lineCap),t.setAttribute("stroke-linejoin",s.lineJoin),s.dashArray?t.setAttribute("stroke-dasharray",s.dashArray):t.removeAttribute("stroke-dasharray"),s.dashOffset?t.setAttribute("stroke-dashoffset",s.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),s.fill?(t.setAttribute("fill",s.fillColor||s.color),t.setAttribute("fill-opacity",s.fillOpacity),t.setAttribute("fill-rule",s.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,Xt(e._parts,t))},_updateCircle:function(e){var t=e._point,s=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||s,o="a"+s+","+r+" 0 1,0 ",c=e._empty()?"M0 0":"M"+(t.x-s)+","+t.y+o+s*2+",0 "+o+-s*2+",0 ";this._setPath(e,c)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){lt(e._path)},_bringToBack:function(e){dt(e._path)}});R.vml&&Rt.include(Ya);function Cn(e){return R.svg||R.vml?new Rt(e):null}Y.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Nn(e)||Cn(e)}});var Ln=ut.extend({initialize:function(e,t){ut.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=se(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function Xa(e,t){return new Ln(e,t)}Rt.create=gi,Rt.pointsToPath=Xt,Ze.geometryToLayer=li,Ze.coordsToLatLng=es,Ze.coordsToLatLngs=di,Ze.latLngToCoords=ts,Ze.latLngsToCoords=ci,Ze.getFeature=mt,Ze.asFeature=hi,Y.mergeOptions({boxZoom:!0});var Pn=Ie.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){$(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ae(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){de(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),St(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),$(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=X("div","leaflet-zoom-box",this._container),W(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new q(this._point,this._startPoint),s=t.getSize();ue(this._box,t.min),this._box.style.width=s.x+"px",this._box.style.height=s.y+"px"},_finish:function(){this._moved&&(de(this._box),he(this._container,"leaflet-crosshair")),Tt(),Ri(),ae(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(m(this._resetState,this),0);var t=new oe(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Y.addInitHook("addHandler","boxZoom",Pn),Y.mergeOptions({doubleClickZoom:!0});var Sn=Ie.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,s=t.getZoom(),r=t.options.zoomDelta,o=e.originalEvent.shiftKey?s-r:s+r;t.options.doubleClickZoom==="center"?t.setZoom(o):t.setZoomAround(e.containerPoint,o)}});Y.addInitHook("addHandler","doubleClickZoom",Sn),Y.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Tn=Ie.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Ke(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}W(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){he(this._map._container,"leaflet-grab"),he(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=se(this._map.options.maxBounds);this._offsetLimit=ee(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,s=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(s),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.xt.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),s=this._initialWorldOffset,r=this._draggable._newPos.x,o=(r-t+s)%e+t-s,c=(r+t+s)%e-t-s,f=Math.abs(o+s)0?c:-c))-t;this._delta=0,this._startTime=null,f&&(e.options.scrollWheelZoom==="center"?e.setZoom(t+f):e.setZoomAround(this._lastMousePos,t+f))}});Y.addInitHook("addHandler","scrollWheelZoom",Mn);var Qa=600;Y.mergeOptions({tapHold:R.touchNative&&R.safari&&R.mobile,tapTolerance:15});var An=Ie.extend({addHooks:function(){$(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ae(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new O(t.clientX,t.clientY),this._holdTimeout=setTimeout(m(function(){this._cancel(),this._isTapValid()&&($(document,"touchend",xe),$(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),Qa),$(document,"touchend touchcancel contextmenu",this._cancel,this),$(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){ae(document,"touchend",xe),ae(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),ae(document,"touchend touchcancel contextmenu",this._cancel,this),ae(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new O(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var s=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});s._simulated=!0,t.target.dispatchEvent(s)}});Y.addInitHook("addHandler","tapHold",An),Y.mergeOptions({touchZoom:R.touch,bounceAtZoomLimits:!0});var zn=Ie.extend({addHooks:function(){W(this._map._container,"leaflet-touch-zoom"),$(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){he(this._map._container,"leaflet-touch-zoom"),ae(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!=="center"&&(this._pinchStartLatLng=t.containerPointToLatLng(s.add(r)._divideBy(2))),this._startDist=s.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),$(document,"touchmove",this._onTouchMove,this),$(document,"touchend touchcancel",this._onTouchEnd,this),xe(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),o=s.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(o,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoomt.getMaxZoom()&&o>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var c=s._add(r)._divideBy(2)._subtract(this._centerPoint);if(o===1&&c.x===0&&c.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(c),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),H(this._animRequest);var f=m(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(f,this,!0),xe(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,H(this._animRequest),ae(document,"touchmove",this._onTouchMove,this),ae(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Y.addInitHook("addHandler","touchZoom",zn),Y.BoxZoom=Pn,Y.DoubleClickZoom=Sn,Y.Drag=Tn,Y.Keyboard=En,Y.ScrollWheelZoom=Mn,Y.TapHold=An,Y.TouchZoom=zn,a.Bounds=q,a.Browser=R,a.CRS=Pe,a.Canvas=kn,a.Circle=Ji,a.CircleMarker=oi,a.Class=Z,a.Control=Se,a.DivIcon=bn,a.DivOverlay=Oe,a.DomEvent=pa,a.DomUtil=fa,a.Draggable=Ke,a.Evented=ge,a.FeatureGroup=Fe,a.GeoJSON=Ze,a.GridLayer=Ot,a.Handler=Ie,a.Icon=ht,a.ImageOverlay=ui,a.LatLng=J,a.LatLngBounds=oe,a.Layer=Te,a.LayerGroup=ct,a.LineUtil=Sa,a.Map=Y,a.Marker=ai,a.Mixin=ja,a.Path=Ge,a.Point=O,a.PolyUtil=ka,a.Polygon=ut,a.Polyline=Be,a.Popup=mi,a.PosAnimation=sn,a.Projection=Ta,a.Rectangle=Ln,a.Renderer=$e,a.SVG=Rt,a.SVGOverlay=vn,a.TileLayer=ft,a.Tooltip=fi,a.Transformation=Nt,a.Util=re,a.VideoOverlay=yn,a.bind=m,a.bounds=ee,a.canvas=Nn,a.circle=Ra,a.circleMarker=Da,a.control=At,a.divIcon=Ua,a.extend=h,a.featureGroup=za,a.geoJSON=_n,a.geoJson=Za,a.gridLayer=Ka,a.icon=Ia,a.imageOverlay=$a,a.latLng=K,a.latLngBounds=se,a.layerGroup=Aa,a.map=xa,a.marker=Oa,a.point=z,a.polygon=Ba,a.polyline=Fa,a.popup=Va,a.rectangle=Xa,a.setOptions=j,a.stamp=g,a.svg=Cn,a.svgOverlay=Wa,a.tileLayer=wn,a.tooltip=qa,a.transformation=E,a.version=d,a.videoOverlay=Ha;var Ja=window.L;a.noConflict=function(){return window.L=Ja,this},window.L=a}))})(Bt,Bt.exports)),Bt.exports}var Ci=xd();function Ps(n,l,a){return Object.freeze({instance:n,context:l,container:a})}function Ss(n,l){return l==null?function(d,h){const u=k.useRef();return u.current||(u.current=n(d,h)),u}:function(d,h){const u=k.useRef();u.current||(u.current=n(d,h));const m=k.useRef(d),{instance:p}=u.current;return k.useEffect(function(){m.current!==d&&(l(p,d,m.current),m.current=d)},[p,d,h]),u}}function zr(n,l){k.useEffect(function(){return(l.layerContainer??l.map).addLayer(n.instance),function(){var u;(u=l.layerContainer)==null||u.removeLayer(n.instance),l.map.removeLayer(n.instance)}},[l,n])}function _d(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Er(d.map,a.attribution),Ls(h.current,a.eventHandlers),zr(h.current,d),h}}function yd(n,l){const a=k.useRef();k.useEffect(function(){if(l.pathOptions!==a.current){const h=l.pathOptions??{};n.instance.setStyle(h),a.current=h}},[n,l])}function vd(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Ls(h.current,a.eventHandlers),zr(h.current,d),yd(h.current,a),h}}function bd(n,l){const a=Ss(n),d=gd(a,l);return md(d)}function wd(n,l){const a=Ss(n,l),d=vd(a);return ud(d)}function jd(n,l){const a=Ss(n,l),d=_d(a);return fd(d)}function kd(n,l,a){const{opacity:d,zIndex:h}=l;d!=null&&d!==a.opacity&&n.setOpacity(d),h!=null&&h!==a.zIndex&&n.setZIndex(h)}const Nd=wd(function({center:l,children:a,...d},h){const u=new Ci.CircleMarker(l,d);return Ps(u,hd(h,{overlayContainer:u}))},ld);function gs(){return gs=Object.assign||function(n){for(var l=1;l(N==null?void 0:N.map)??null,[N]);const j=k.useCallback(D=>{if(D!==null&&N===null){const S=new Ci.Map(D,y);a!=null&&w!=null?S.setView(a,w):n!=null&&S.fitBounds(n,l),g!=null&&S.whenReady(g),P(cd(S))}},[]);k.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const M=N?$t.createElement(Ar,{value:N},d):m??null;return $t.createElement("div",gs({},x,{ref:j}),M)}const Ld=k.forwardRef(Cd),Pd=bd(function(l,a){const d=new Ci.Popup(l,a.overlayContainer);return Ps(d,a)},function(l,a,{position:d},h){k.useEffect(function(){const{instance:m}=l;function p(w){w.popup===m&&(m.update(),h(!0))}function g(w){w.popup===m&&h(!1)}return a.map.on({popupopen:p,popupclose:g}),a.overlayContainer==null?(d!=null&&m.setLatLng(d),m.openOn(a.map)):a.overlayContainer.bindPopup(m),function(){var y;a.map.off({popupopen:p,popupclose:g}),(y=a.overlayContainer)==null||y.unbindPopup(),a.map.removeLayer(m)}},[l,a,h,d])}),Sd=jd(function({url:l,...a},d){const h=new Ci.TileLayer(l,Ni(a,d));return Ps(h,d)},function(l,a,d){kd(l,a,d);const{url:h}=a;h!=null&&h!==d.url&&l.setUrl(h)}),Td=({profile:n})=>{var m,p,g,w;if(!((p=(m=n==null?void 0:n.geospatial)==null?void 0:m.sample_points)!=null&&p.length))return i.jsx(Kt,{icon:i.jsx(cs,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Geospatial Data",description:"No latitude/longitude columns were detected in the dataset."});const l=n.geospatial,a=!!n.target_col,d=Gt(l.sample_points??[],a?"label":void 0),h=d.map(({label:y,color:b})=>({label:y,color:b,shape:"circle"})),u=[[l.min_lat,l.min_lon],[l.max_lat,l.max_lon]];return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(cs,{className:"w-5 h-5 mr-2 text-blue-500"}),"Geospatial Analysis",i.jsx(_e,{text:"Visualizes data points on a map based on detected Latitude/Longitude columns. Colors indicate target values."})]}),i.jsxs("div",{className:"text-sm text-gray-500",children:["Detected columns: ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lat_col}),", ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lon_col})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2 min-w-0",children:[i.jsx("div",{className:"h-96 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 relative z-0",children:i.jsxs(Ld,{bounds:u,style:{height:"100%",width:"100%"},scrollWheelZoom:!0,children:[i.jsx(Sd,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'Β© OpenStreetMap contributors'}),d.flatMap(y=>y.points.map((b,x)=>i.jsx(Nd,{center:[b.lat,b.lon],radius:5,pathOptions:{color:a?y.color:"#3b82f6",fillColor:a?y.color:"#3b82f6",fillOpacity:.7,weight:1},children:i.jsx(Pd,{children:i.jsxs("div",{className:"text-xs",children:[i.jsx("strong",{children:"Lat:"})," ",b.lat.toFixed(4),i.jsx("br",{}),i.jsx("strong",{children:"Lon:"})," ",b.lon.toFixed(4),i.jsx("br",{}),a&&i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[n.target_col,":"]})," ",y.label]})]})})},JSON.stringify([y.value,x]))))]},`${l.lat_col??""}-${l.lon_col??""}-${u.flat().join(",")}`)}),a&&i.jsx(Ns,{entries:h})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Spatial Bounds"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Latitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lat.toFixed(4)," to ",n.geospatial.max_lat.toFixed(4)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Longitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lon.toFixed(4)," to ",n.geospatial.max_lon.toFixed(4)]})]})]})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Centroid"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsxs("span",{className:"font-mono text-sm",children:[((g=n.geospatial.centroid_lat)==null?void 0:g.toFixed(4))??"β€”",", ",((w=n.geospatial.centroid_lon)==null?void 0:w.toFixed(4))??"β€”"]})]})]}),i.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:i.jsxs("p",{children:["This scatter plot shows the spatial distribution of your data.",!!n.target_col&&" Points are colored by the target variable."]})})]})]})]})]})},Ed=({profile:n,downloadChart:l,history:a,loading:d,loadSpecificReport:h,report:u})=>{var b;const[m,p]=k.useState("idle"),g=at(),w=k.useCallback(()=>{p("done"),setTimeout(()=>p("idle"),1200)},[]),y=async()=>{if(n!=null&&n.target_interactions){p("downloading");try{const x=wr(),N=n.target_interactions,P=400,j=800,M=40,D=2,S=Math.ceil(N.length/D),G=D*j+(D+1)*M,fe=S*(P+M)+100,le=document.createElement("canvas");le.width=G,le.height=fe;const ne=le.getContext("2d");if(!ne)return;ne.fillStyle=x.bgColor,ne.fillRect(0,0,le.width,le.height),ne.fillStyle=x.textColor,ne.font="bold 24px sans-serif",ne.textAlign="center",ne.fillText("Detailed Interactions (Box Plots)",G/2,50);for(let A=0;A{ce.onload=()=>{ne.drawImage(ce,ie,Q+30,j,P-50),URL.revokeObjectURL(q),ee()},ce.onerror=()=>{URL.revokeObjectURL(q),ee()},ce.src=q})}const we=document.createElement("a");we.download="all-interactions.png",we.href=le.toDataURL("image/png"),we.click()}finally{w()}}};return i.jsxs("div",{className:"mt-4 grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Target Analysis: ",i.jsx("span",{className:"ml-2 text-blue-600",children:n.target_col}),i.jsx(_e,{text:"Analyzes relationships between the target variable and other features. Shows top correlations and key drivers."})]}),i.jsx("button",{onClick:()=>l("target-analysis-chart","target-analysis",`Target Analysis: ${n.target_col}`,"Top Associated Features"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-4",children:"Top Associated Features"}),i.jsx("div",{className:"h-64 w-full",id:"target-analysis-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:Object.entries(n.target_correlations).slice(0,10).map(([x,N])=>({name:x,value:N})),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!1,stroke:g.gridColor}),i.jsx(Xe,{type:"number",domain:[0,1],tick:{fontSize:12,fill:g.axisColor}}),i.jsx(Qe,{type:"category",dataKey:"name",width:120,tick:{fontSize:12,fill:g.axisColor}}),i.jsx(He,{contentStyle:g.tooltipContentStyle,itemStyle:g.tooltipItemStyle,labelStyle:g.tooltipLabelStyle,formatter:x=>[x.toFixed(3),"Association"]}),i.jsx(Nr,{x:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"value",fill:"#3b82f6",radius:[0,4,4,0],barSize:20})]})})})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-2",children:"Key Insights"}),i.jsxs("ul",{className:"space-y-2 text-sm",children:[i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Target is ",i.jsx("strong",{children:(b=n.columns[n.target_col])==null?void 0:b.dtype})]})]}),i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Strongest predictor: ",i.jsx("strong",{children:Object.keys(n.target_correlations)[0]||"None"}),Object.values(n.target_correlations)[0]!==void 0&&i.jsxs(i.Fragment,{children:[" (",Object.values(n.target_correlations)[0].toFixed(2),")"]})]})]})]})]})]})]}),n.target_interactions&&n.target_interactions.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Detailed Interactions (Box Plots)",i.jsx(_e,{text:"Shows distribution of values across categories. The box represents the middle 50% of data (Q1 to Q3). The line inside is the median."})]}),i.jsx("button",{onClick:y,disabled:m!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download All Charts","aria-label":"Download All Charts",children:m==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):m==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:[i.jsx("span",{className:"font-semibold",children:"ANOVA Analysis:"})," A p-value < 0.05 (highlighted in green) indicates that the feature varies significantly across the target categories, making it a strong predictor."]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:n.target_interactions.map((x,N)=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 relative group",children:[i.jsx("div",{className:"absolute top-2 right-2 opacity-100",children:i.jsx("button",{onClick:()=>l(`interaction-chart-${N}`,`interaction-${x.feature}`,`${x.feature} vs ${n.target_col}`,x.p_value!==void 0?`ANOVA p: ${Number(x.p_value).toExponential(2)}`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"text-center mb-2",children:[i.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[x.feature," vs ",n.target_col]}),x.p_value!==void 0&&x.p_value!==null&&i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full inline-block mt-1 ${x.p_value<.05?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:["ANOVA p: ",Number(x.p_value).toExponential(2)]})]}),i.jsx("div",{className:"h-64 w-full",id:`interaction-chart-${N}`,children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Uo,{data:x.data.map(P=>({...P,boxBottom:P.stats.q1,boxHeight:P.stats.q3-P.stats.q1})),margin:{top:20,right:30,left:20,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:g.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:g.axisColor}}),i.jsx(Qe,{domain:["auto","auto"],tick:{fontSize:11,fill:g.axisColor}}),i.jsx(He,{cursor:{fill:"transparent"},content:({active:P,payload:j})=>{if(P&&j&&j.length){const M=j[0].payload;return i.jsxs("div",{style:g.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg z-50",children:[i.jsx("p",{className:"font-semibold mb-1",children:M.name}),i.jsxs("p",{children:["Max: ",M.stats.max.toFixed(2)]}),i.jsxs("p",{children:["Q3: ",M.stats.q3.toFixed(2)]}),i.jsxs("p",{children:["Median: ",M.stats.median.toFixed(2)]}),i.jsxs("p",{children:["Q1: ",M.stats.q1.toFixed(2)]}),i.jsxs("p",{children:["Min: ",M.stats.min.toFixed(2)]})]})}return null}}),i.jsx(Ve,{dataKey:"boxBottom",stackId:"a",fill:"transparent",legendType:"none"}),i.jsx(Ve,{dataKey:"boxHeight",stackId:"a",fill:"#8884d8",fillOpacity:.6,name:"IQR (Q1-Q3)"}),i.jsx(rs,{name:"Median",dataKey:"stats.median",fill:"#ff7300",shape:"square"}),i.jsx(rs,{name:"Max",dataKey:"stats.max",fill:"#82ca9d",shape:"cross"}),i.jsx(rs,{name:"Min",dataKey:"stats.min",fill:"#82ca9d",shape:"cross"})]})})}),i.jsx("p",{className:"text-xs text-center text-gray-400 mt-2",children:"* Box: Q1-Q3. Orange square: Median. Green crosses: Min/Max."})]},N))})]})]}),i.jsx("div",{className:"lg:col-span-1",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm h-fit sticky top-4",children:[i.jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ls,{className:"w-4 h-4 mr-2"}),"Analysis History"]}),d&&i.jsx(be,{className:"w-3 h-3 animate-spin text-blue-500"})]}),i.jsx("div",{className:"space-y-2 max-h-[500px] overflow-y-auto",children:a.length===0?i.jsx("p",{className:"text-xs text-gray-500 italic",children:"No previous analyses found."}):a.slice(0,10).map(x=>i.jsxs("button",{onClick:()=>!d&&h(x.id),disabled:d,className:`w-full text-left p-3 rounded-md text-sm border transition-colors ${u&&u.id===x.id?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-gray-50 border-gray-100 text-gray-600 hover:bg-gray-100 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800"} ${d?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("div",{className:"font-medium truncate",children:x.target_col?`Target: ${x.target_col}`:"General Analysis"}),i.jsx("div",{className:"text-xs opacity-70 mt-1",children:new Date(x.created_at).toLocaleString()}),i.jsx("div",{className:"mt-1",children:i.jsx(br,{status:x.status})})]},x.id))})]})})]})},Md=({profile:n,downloadChart:l})=>{var d,h;const a=at();return i.jsxs("div",{className:"mt-4 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ys,{className:"w-5 h-5 mr-2 text-blue-500"}),"Trend Analysis (",n.timeseries.date_col,")",i.jsx(_e,{text:"Shows how values change over time. Look for long-term trends (up/down) or sudden shifts."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[n.timeseries.stationarity_test&&i.jsxs("div",{className:`text-xs px-3 py-1 rounded-full border flex items-center gap-1 ${n.timeseries.stationarity_test.is_stationary?"bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300":"bg-yellow-50 border-yellow-200 text-yellow-700 dark:bg-yellow-900/20 dark:border-yellow-800 dark:text-yellow-300"}`,children:[i.jsx(_e,{text:"Augmented Dickey-Fuller Test. Stationary (p<0.05) means the data has constant mean/variance over time. Non-Stationary (p>=0.05) means it has a trend or seasonality."}),i.jsx("span",{className:"font-semibold",children:"ADF Test:"})," ",n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary",i.jsxs("span",{className:"opacity-75 ml-1",children:["(p=",n.timeseries.stationarity_test.p_value.toFixed(3),")"]})]}),i.jsx("button",{onClick:()=>l("trend-chart","trend-analysis","Trend Analysis",`Date Column: ${n.timeseries.date_col}`,n.timeseries.stationarity_test?`ADF Test: ${n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary"} (p=${n.timeseries.stationarity_test.p_value.toFixed(3)})`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx("div",{className:"h-80 w-full",id:"trend-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Ko,{data:n.timeseries.trend,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"date",tick:{fontSize:12,fill:a.axisColor},minTickGap:30}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle}),i.jsx(kr,{}),Object.keys(((d=n.timeseries.trend[0])==null?void 0:d.values)||{}).map((u,m)=>i.jsx(Fn,{type:"monotone",dataKey:`values.${u}`,name:u,stroke:We[m%We.length],dot:!1,strokeWidth:2},u)),(!((h=n.timeseries.trend[0])!=null&&h.values)||Object.keys(n.timeseries.trend[0].values).length===0)&&i.jsx(Fn,{type:"monotone",dataKey:"count",stroke:"#3b82f6",dot:!1})]})})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("day-seasonality-chart","day-seasonality","Day of Week Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Day of Week Seasonality"}),i.jsx(_e,{text:"Average values for each day. Helps identify weekly patterns (e.g., lower on weekends)."})]}),i.jsx("div",{className:"h-64 w-full",id:"day-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.day_of_week,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"day",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#8884d8",radius:[4,4,0,0]})]})})})]})}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("month-seasonality-chart","month-seasonality","Monthly Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Monthly Seasonality"}),i.jsx(_e,{text:"Average values for each month. Helps identify yearly patterns or seasonal effects."})]}),i.jsx("div",{className:"h-64 w-full",id:"month-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.month_of_year,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"month",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#82ca9d",radius:[4,4,0,0]})]})})})]}),n.timeseries.autocorrelation&&n.timeseries.autocorrelation.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Autocorrelation (Lag Analysis)"}),i.jsxs("div",{className:"group relative ml-2",children:[i.jsx(jt,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none text-center",children:["Shows how much the current value depends on past values (lags). High bars indicate repeating patterns or seasonality.",i.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-800"})]})]})]}),i.jsx("button",{onClick:()=>l("autocorrelation-chart","autocorrelation","Autocorrelation (Lag Analysis)"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})]}),i.jsx("div",{className:"h-80 w-full pb-6",id:"autocorrelation-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.autocorrelation,margin:{bottom:20},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"lag",tick:{fontSize:12,fill:a.axisColor},label:{value:"Lag (Days)",position:"insideBottom",offset:-15,fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{domain:[-1,1],tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"},formatter:u=>[u.toFixed(3),"Correlation"]}),i.jsx(Nr,{y:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"corr",fill:"#f59e0b",radius:[2,2,0,0]})]})})})]})]})},Ad=({profile:n,onBarClick:l})=>{const a=at(),{data:d,typeMatched:h}=k.useMemo(()=>{var p;if(!n)return{data:[],typeMatched:!1};const m=n.dtype;return m==="Numeric"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(2)}`,fullName:`${Number(g.start).toFixed(2)} - ${Number(g.end).toFixed(2)}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Text"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(0)}`,fullName:`${Number(g.start).toFixed(0)} - ${Number(g.end).toFixed(0)} chars`,count:g.count,rawBin:g})),typeMatched:!0}:m==="DateTime"&&n.histogram?{data:n.histogram.map(g=>({name:new Date(g.start).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),fullName:`${new Date(g.start).toLocaleDateString()} - ${new Date(g.end).toLocaleDateString()}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Categorical"&&((p=n.categorical_stats)!=null&&p.top_k)?{data:n.categorical_stats.top_k.map(g=>({name:String(g.value).substring(0,15)+(String(g.value).length>15?"...":""),fullName:String(g.value),count:g.count,value:g.value})),typeMatched:!0}:{data:[],typeMatched:!1}},[n]);if(!n)return null;if(!h)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No distribution data available for this type"});if(d.length===0)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No data points"});const u=n.dtype;return i.jsxs("div",{className:"w-full h-full flex flex-col",children:[i.jsxs("div",{className:"flex-1 w-full min-h-[250px] relative",children:[n.normality_test&&i.jsxs("div",{className:"absolute top-0 right-0 bg-white/90 dark:bg-gray-800/90 p-2 rounded border border-gray-200 dark:border-gray-700 text-xs z-10 shadow-sm",children:[i.jsxs("div",{className:"font-semibold text-gray-700 dark:text-gray-300 mb-1 flex items-center",children:["Normality Test (",n.normality_test.test_name,")",i.jsx(_e,{text:"Normality tests are performed on a sample of up to 5,000 rows. Shapiro-Wilk is used for smaller datasets (<5,000), and Kolmogorov-Smirnov for larger ones. For very large datasets, rely on Skewness and Kurtosis.",align:"right"})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"p-value:"}),i.jsx("span",{className:`font-mono ${n.normality_test.is_normal?"text-green-600":"text-red-500"}`,children:n.normality_test.p_value.toExponential(2)})]}),i.jsx("div",{className:"mt-1 text-[10px] text-gray-400",children:n.normality_test.is_normal?"Likely Normal Distribution":"Likely Not Normal"})]}),i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:d,margin:{top:5,right:30,left:20,bottom:30},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:a.axisColor},interval:"preserveStartEnd",angle:-45,textAnchor:"end"}),i.jsx(Qe,{tick:{fontSize:11,fill:a.axisColor}}),i.jsx(He,{content:({active:m,payload:p})=>{if(m&&p&&p.length){const g=p[0].payload;return i.jsxs("div",{style:a.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg",children:[i.jsx("p",{className:"font-semibold mb-1",children:g.fullName}),i.jsxs("p",{children:["Count: ",g.count]}),l&&i.jsx("p",{className:"text-blue-300 mt-1 italic",children:"Click to filter"})]})}return null}}),i.jsx(Ve,{dataKey:"count",radius:[4,4,0,0],onClick:m=>l&&l(m),className:l?"cursor-pointer hover:opacity-80":"",children:d.map((m,p)=>i.jsx(js,{fill:u==="Numeric"?"#3b82f6":"#8b5cf6"},`cell-${p}`))})]})})]}),i.jsx(ki,{caption:`Distribution data table for ${n.name}`,filename:`${n.name}-distribution`,columns:[{key:"fullName",label:"Bin / Value"},{key:"count",label:"Count"}],rows:d.map(m=>({fullName:m.fullName,count:m.count}))})]})};var zd=Symbol.for("react.lazy"),vi=wo[" use ".trim().toString()];function Id(n){return typeof n=="object"&&n!==null&&"then"in n}function Ir(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===zd&&"_payload"in n&&Id(n._payload)}function Od(n){const l=Rd(n),a=k.forwardRef((d,h)=>{let{children:u,...m}=d;Ir(u)&&typeof vi=="function"&&(u=vi(u._payload));const p=k.Children.toArray(u),g=p.find(Bd);if(g){const w=g.props.children,y=p.map(b=>b===g?k.Children.count(w)>1?k.Children.only(null):k.isValidElement(w)?w.props.children:null:b);return i.jsx(l,{...m,ref:h,children:k.isValidElement(w)?k.cloneElement(w,void 0,y):null})}return i.jsx(l,{...m,ref:h,children:u})});return a.displayName=`${n}.Slot`,a}var Dd=Od("Slot");function Rd(n){const l=k.forwardRef((a,d)=>{let{children:h,...u}=a;if(Ir(h)&&typeof vi=="function"&&(h=vi(h._payload)),k.isValidElement(h)){const m=$d(h),p=Zd(u,h.props);return h.type!==k.Fragment&&(p.ref=d?Eo(d,m):m),k.cloneElement(h,p)}return k.Children.count(h)>1?k.Children.only(null):null});return l.displayName=`${n}.SlotClone`,l}var Fd=Symbol("radix.slottable");function Bd(n){return k.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Fd}function Zd(n,l){const a={...l};for(const d in l){const h=n[d],u=l[d];/^on[A-Z]/.test(d)?h&&u?a[d]=(...p)=>{const g=u(...p);return h(...p),g}:h&&(a[d]=h):d==="style"?a[d]={...h,...u}:d==="className"&&(a[d]=[h,u].filter(Boolean).join(" "))}return{...n,...a}}function $d(n){var d,h;let l=(d=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:d.get,a=l&&"isReactWarning"in l&&l.isReactWarning;return a?n.ref:(l=(h=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:h.get,a=l&&"isReactWarning"in l&&l.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}const qn=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Un=Cr,Or=(n,l)=>a=>{var d;if((l==null?void 0:l.variants)==null)return Un(n,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:h,defaultVariants:u}=l,m=Object.keys(h).map(w=>{const y=a==null?void 0:a[w],b=u==null?void 0:u[w];if(y===null)return null;const x=qn(y)||qn(b);return h[w][x]}),p=a&&Object.entries(a).reduce((w,y)=>{let[b,x]=y;return x===void 0||(w[b]=x),w},{}),g=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((w,y)=>{let{class:b,className:x,...N}=y;return Object.entries(N).every(P=>{let[j,M]=P;return Array.isArray(M)?M.includes({...u,...p}[j]):{...u,...p}[j]===M})?[...w,b,x]:w},[]);return Un(n,m,g,a==null?void 0:a.class,a==null?void 0:a.className)},Hd=Or("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"action-primary",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"action-secondary",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Vt=k.forwardRef(({className:n,variant:l,size:a,asChild:d=!1,...h},u)=>{const m=d?Dd:"button";return i.jsx(m,{className:Hd({variant:l,size:a,className:n}),ref:u,...h})});Vt.displayName="Button";function Dr(...n){return Mo(Cr(n))}const Wd=Or("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rt({className:n,variant:l,...a}){return i.jsx("div",{className:Dr(Wd({variant:l}),n),...a})}function Vd({profile:n}){var a;let l=[];return n.histogram?l=n.histogram.map(d=>({name:String(d.start),count:d.count})):(a=n.categorical_stats)!=null&&a.top_k&&(l=n.categorical_stats.top_k.slice(0,10).map(d=>({name:String(d.value),count:d.count}))),i.jsxs("div",{className:"flex items-center justify-between w-full pr-4",children:[i.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground mr-auto",children:[i.jsx(qd,{profile:n}),i.jsx(Ud,{profile:n})]}),l.length>0&&i.jsx("div",{className:"h-8 w-24 hidden sm:block opacity-70",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsx(nt,{data:l,children:i.jsx(Ve,{dataKey:"count",fill:n.dtype==="Numeric"?"#3b82f6":n.dtype==="Categorical"?"#8b5cf6":"#10b981",radius:[1,1,0,0]})})})})]})}function qd({profile:n}){var l,a,d,h,u;return i.jsx(i.Fragment,{children:n.numeric_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Mean: ",i.jsx("span",{className:"font-mono text-foreground",children:(l=n.numeric_stats.mean)==null?void 0:l.toFixed(2)})]}),i.jsxs("span",{children:["Std: ",i.jsx("span",{className:"font-mono text-foreground",children:(a=n.numeric_stats.std)==null?void 0:a.toFixed(2)})]}),i.jsxs("span",{children:["Min: ",i.jsx("span",{className:"font-mono text-foreground",children:(d=n.numeric_stats.min)==null?void 0:d.toFixed(2)})]}),i.jsxs("span",{children:["Max: ",i.jsx("span",{className:"font-mono text-foreground",children:(h=n.numeric_stats.max)==null?void 0:h.toFixed(2)})]})]}):n.categorical_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Unique: ",i.jsx("span",{className:"font-mono text-foreground",children:n.categorical_stats.unique_count})]}),((u=n.categorical_stats.top_k)==null?void 0:u[0])&&i.jsxs("span",{children:["Top: ",i.jsx("span",{className:"font-mono text-foreground",children:String(n.categorical_stats.top_k[0].value).slice(0,20)})]})]}):null})}function Ud({profile:n}){return i.jsxs(i.Fragment,{children:[n.normality_test&&n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20",children:"Normal Dist"}),n.normality_test&&!n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20",children:"Not Normal"})]})}function Kd({profile:n}){return i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"font-medium text-sm truncate",children:n.name}),i.jsx(rt,{variant:"outline",className:`text-[10px] h-5 px-1 ${_l(n.dtype)}`,children:n.dtype}),n.is_unique&&i.jsx(rt,{variant:"secondary",className:"text-[10px] h-5",children:"ID"}),n.is_constant&&i.jsx(rt,{variant:"destructive",className:"text-[10px] h-5",children:"Constant"})]})}function Gd({profile:n,isExcluded:l,onToggleExclude:a}){return i.jsxs("div",{className:"flex items-center gap-4 px-2",children:[i.jsxs("div",{className:"flex flex-col items-end w-24",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.missing_percentage>0?`${n.missing_percentage.toFixed(1)}% Missing`:"100% Present"}),i.jsx(_e,{text:"Green bar indicates the percentage of valid (non-null) data. Full green means no missing values.",align:"end",size:"sm"})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-100 dark:bg-gray-800 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${n.missing_percentage>0?"bg-amber-400":"bg-green-500"}`,style:{width:`${Math.max(100-n.missing_percentage,0)}%`}})})]}),i.jsx("div",{className:"h-8 w-[1px] bg-border mx-2"}),i.jsx(Vt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:d=>{d.stopPropagation(),a(n.name,!l)},title:l?"Include in analysis":"Exclude from analysis","aria-label":l?"Include in analysis":"Exclude from analysis",children:l?i.jsx(Ut,{size:16}):i.jsx(pr,{size:16})})]})}function Yd({profile:n}){return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Statistics"}),i.jsxs("div",{className:"bg-background rounded-md border p-3 text-sm space-y-2 font-mono",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Missing"}),i.jsxs("span",{children:[n.missing_count," (",n.missing_percentage.toFixed(2),"%)"]})]}),n.numeric_stats&&i.jsx(Xd,{stats:n.numeric_stats,vif:n.vif}),n.text_stats&&i.jsx(ec,{stats:n.text_stats}),n.categorical_stats&&i.jsx(tc,{stats:n.categorical_stats})]})]})}function Xd({stats:n,vif:l}){var a,d,h,u,m,p,g,w;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mean"}),i.jsx("span",{children:(a=n.mean)==null?void 0:a.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Std Dev"}),i.jsx("span",{children:(d=n.std)==null?void 0:d.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Variance"}),i.jsx("span",{children:((h=n.variance)==null?void 0:h.toFixed(4))||Math.pow(n.std||0,2).toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min"}),i.jsx("span",{children:(u=n.min)==null?void 0:u.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"25% (Q1)"}),i.jsx("span",{children:(m=n.q25)==null?void 0:m.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Median"}),i.jsx("span",{children:(p=n.median)==null?void 0:p.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"75% (Q3)"}),i.jsx("span",{children:(g=n.q75)==null?void 0:g.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max"}),i.jsx("span",{children:(w=n.max)==null?void 0:w.toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Qd,{stats:n}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Jd,{stats:n,vif:l})]})}function Qd({stats:n}){var l,a;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Skewness"}),i.jsx("span",{children:(l=n.skewness)==null?void 0:l.toFixed(4)})]}),n.skewness!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.skewness)<.5?"↳ Symmetric":Math.abs(n.skewness)<1?"↳ Moderately Skewed":"↳ Highly Skewed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Kurtosis"}),i.jsx("span",{children:(a=n.kurtosis)==null?void 0:a.toFixed(4)})]}),n.kurtosis!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.kurtosis)<.5?"↳ Mesokurtic (Normal-like)":n.kurtosis>0?"↳ Leptokurtic (Heavy Tails)":"↳ Platykurtic (Light Tails)"})]})}function Jd({stats:n,vif:l}){return i.jsxs(i.Fragment,{children:[n.zeros_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Zeros"}),i.jsx("span",{children:n.zeros_count})]}),n.negatives_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Negatives"}),i.jsx("span",{children:n.negatives_count})]}),l!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:["VIF",i.jsx(_e,{text:"Variance Inflation Factor. VIF > 5 = high multicollinearity, VIF > 10 = severe.",size:"sm"})]}),i.jsx("span",{className:l>5?"text-red-500 font-semibold":l>2?"text-amber-500":"text-green-500",children:l.toFixed(2)})]})]})}function ec({stats:n}){var l;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Avg Length"}),i.jsxs("span",{children:[(l=n.avg_length)==null?void 0:l.toFixed(1)," chars"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min Length"}),i.jsx("span",{children:n.min_length})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max Length"}),i.jsx("span",{children:n.max_length})]}),n.sentiment_distribution&&i.jsx(ic,{distribution:n.sentiment_distribution}),n.common_words&&n.common_words.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Common Words"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.common_words.slice(0,10).map((a,d)=>i.jsxs(rt,{variant:"secondary",className:"text-[10px] h-4",children:[a.word??a.value," (",a.count,")"]},d))})]})]})}function tc({stats:n}){var l,a,d,h;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Unique"}),i.jsx("span",{children:n.unique_count})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mode"}),i.jsx("span",{className:"truncate max-w-[100px]",title:String((a=(l=n.top_k)==null?void 0:l[0])==null?void 0:a.value),children:String(((h=(d=n.top_k)==null?void 0:d[0])==null?void 0:h.value)||"-")})]}),n.rare_labels_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Rare Labels"}),i.jsx("span",{children:n.rare_labels_count})]}),n.top_k&&n.top_k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Top Categories"}),i.jsx("div",{className:"space-y-1",children:n.top_k.slice(0,5).map((u,m)=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"truncate max-w-[120px]",title:String(u.value),children:String(u.value)}),i.jsx("span",{className:"text-muted-foreground",children:u.count})]},m))})]})]})}function ic({distribution:n}){const l=n.positive||0,a=n.neutral||0,d=n.negative||0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Sentiment"}),i.jsxs("div",{className:"flex h-3 rounded-full overflow-hidden w-full bg-secondary",children:[i.jsx("div",{className:"bg-green-500 h-full",style:{width:`${l*100}%`},title:`Positive: ${(l*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-gray-400 h-full",style:{width:`${a*100}%`},title:`Neutral: ${(a*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-red-500 h-full",style:{width:`${d*100}%`},title:`Negative: ${(d*100).toFixed(1)}%`})]}),i.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1 px-1",children:[i.jsxs("span",{children:["Pos: ",(l*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neu: ",(a*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neg: ",(d*100).toFixed(0),"%"]})]})]})}const Kn=({profile:n,isExpanded:l,onToggleExpand:a,onToggleExclude:d,isExcluded:h,handleAddFilter:u})=>{const m=k.useRef(null),[p,g]=k.useState("idle"),w=async()=>{if(m.current){g("downloading");try{const b=document.documentElement.classList.contains("dark"),x=await ws(m.current,{backgroundColor:b?"#1f2937":"#ffffff",pixelRatio:2}),N=document.createElement("a");N.href=x,N.download=`${n.name}_distribution.png`,N.click()}catch(b){console.error("Failed to download chart",b),Wt.error("Chart download failed",String(b))}finally{g("done"),setTimeout(()=>g("idle"),1200)}}},y=b=>{if(n.dtype==="Categorical"||n.dtype==="Boolean"){const x=b.value!==void 0?b.value:b.name;u(n.name,x,"==")}else n.dtype==="Numeric"&&b.rawBin&&u(n.name,b.rawBin.start,">=")};return i.jsxs("div",{className:`border rounded-lg mb-2 transition-all ${l?"border-primary/50 shadow-md bg-card/50":"border-border bg-card"}`,children:[i.jsxs("div",{className:"flex items-center p-3 hover:bg-accent/50 cursor-pointer rounded-t-lg",...ji(a),children:[i.jsx("div",{className:"mr-2 text-muted-foreground",children:l?i.jsx(wi,{size:18}):i.jsx(gr,{size:18})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Kd,{profile:n}),!l&&i.jsx(Vd,{profile:n})]}),i.jsx(Gd,{profile:n,isExcluded:h,onToggleExclude:d})]}),l&&i.jsx("div",{className:"p-4 border-t border-border bg-card/30 animate-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch",children:[i.jsx(Yd,{profile:n}),i.jsxs("div",{className:"md:col-span-2 flex flex-col min-h-[300px]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Distribution"}),i.jsx(Vt,{size:"icon",variant:"outline",className:"h-8 w-8",title:"Download Chart",onClick:w,disabled:p!=="idle",children:p==="downloading"?i.jsx(be,{size:16,className:"animate-spin"}):p==="done"?i.jsx(Ht,{size:16,className:"text-green-500"}):i.jsx(ke,{size:16})})]}),i.jsx("div",{className:"flex-1 bg-background rounded-md border p-4 min-h-0",ref:m,children:i.jsx(Ad,{profile:n,onBarClick:y})})]})]})})]})},Rr=k.forwardRef(({className:n,type:l,...a},d)=>i.jsx("input",{type:l,className:Dr("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:d,...a}));Rr.displayName="Input";const sc=({profile:n,handleToggleExclude:l,handleAddFilter:a})=>{const[d,h]=k.useState(""),[u,m]=k.useState(new Set);Ao(()=>m(new Set),u.size>0);const p=x=>{const N=new Set(u);N.has(x)?N.delete(x):N.add(x),m(N)},g=()=>{m(new Set(Object.keys(n.columns)))},w=()=>{m(new Set)},y=Object.values(n.columns).filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),b=(n.excluded_columns??[]).filter(x=>x.toLowerCase().includes(d.toLowerCase()));return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4 bg-card p-2 rounded-lg border",children:[i.jsxs("div",{className:"relative flex-1 max-w-sm",children:[i.jsx(jo,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),i.jsx(Rr,{placeholder:"Search variables...",className:"pl-8 h-9",value:d,onChange:x=>h(x.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Vt,{variant:"outline",size:"sm",onClick:g,className:"h-9 text-xs",children:"Expand All"}),i.jsx(Vt,{variant:"outline",size:"sm",onClick:w,className:"h-9 text-xs",children:"Collapse All"})]}),i.jsxs("div",{className:"ml-auto text-sm text-muted-foreground px-2",children:["Showing ",y.length," of ",Object.keys(n.columns).length," variables"]})]}),i.jsxs("div",{className:"space-y-2",children:[y.map(x=>i.jsx(Kn,{profile:x,isExpanded:u.has(x.name),onToggleExpand:()=>p(x.name),onToggleExclude:l,isExcluded:!1,handleAddFilter:a},x.name)),b.length>0&&i.jsxs("div",{className:"mt-8",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2 text-muted-foreground",children:["Excluded Variables ",i.jsx(rt,{variant:"secondary",children:b.length})]}),b.map(x=>i.jsx(Kn,{profile:{name:x,dtype:"Excluded",missing_count:0,missing_percentage:0},isExpanded:u.has(x),onToggleExpand:()=>p(x),onToggleExclude:l,isExcluded:!0,handleAddFilter:a},x))]})]})]})};function nc({profile:n,scatterX:l,scatterY:a,scatterZ:d,scatterColor:h,is3D:u}){return i.jsx(i.Fragment,{children:l&&a?u&&d?i.jsx(Sr,{data:n.sample_data??[],xKey:l,yKey:a,zKey:d,labelKey:h||void 0,xLabel:l,yLabel:a,zLabel:d}):i.jsx(Tr,{data:n.sample_data??[],xKey:l,yKey:a,labelKey:h||void 0,xLabel:l,yLabel:a}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm",children:"Select X and Y variables to generate scatter plot."})})}const rc=({profile:n,downloadChart:l,scatterX:a,setScatterX:d,scatterY:h,setScatterY:u,scatterZ:m,setScatterZ:p,scatterColor:g,setScatterColor:w,is3D:y,setIs3D:b})=>{const x=k.useMemo(()=>(n==null?void 0:n.sample_data)??[],[n==null?void 0:n.sample_data]),N=k.useMemo(()=>Pr(Gt(x,g||void 0)),[x,g]),P=k.useMemo(()=>{const S=[{key:a,label:a||"X"},{key:h,label:h||"Y"}];return y&&m&&S.push({key:m,label:m}),g&&S.push({key:g,label:g}),S},[a,h,m,g,y]),j=k.useMemo(()=>x.map(S=>S),[x]);if(!(n!=null&&n.columns)||!(n!=null&&n.sample_data))return i.jsx(Kt,{icon:i.jsx(Zt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Data Available",description:"Sample data is required for bivariate analysis."});const M=!!(a&&h&&n.sample_data.length>0),D=M?"Download Chart":"Select X and Y variables to enable download";return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Bivariate Analysis (Scatter Plot)",i.jsx(_e,{text:"Visualize the relationship between two numeric variables."})]}),i.jsx("button",{disabled:!M,onClick:()=>l("bivariate-chart","bivariate-analysis","Bivariate Analysis",`${a} vs ${h}`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:D,"aria-label":D,children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-6 items-end",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"X Axis"}),i.jsxs("select",{value:a,onChange:S=>d(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Y Axis"}),i.jsxs("select",{value:h,onChange:S=>u(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),y&&i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Z Axis"}),i.jsxs("select",{value:m,onChange:S=>p(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Color By"}),i.jsxs("select",{value:g,onChange:S=>w(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"None"}),Object.values(n.columns).map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsx("button",{onClick:()=>b(!y),className:`p-2 rounded-md border transition-colors ${y?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,title:"Toggle 3D View","aria-label":"Toggle 3D View",children:i.jsx(_r,{className:"w-5 h-5"})})]}),i.jsx("div",{id:"bivariate-chart",children:i.jsx(nc,{profile:n,scatterX:a,scatterY:h,scatterZ:m,scatterColor:g,is3D:y})}),g&&N.length>0&&i.jsx(Ns,{entries:N}),i.jsx(ki,{caption:"Bivariate scatter plot data",filename:"bivariate-analysis",columns:P,rows:j})]})},ac=({profile:n})=>{var l,a;return(a=(l=n==null?void 0:n.outliers)==null?void 0:l.top_outliers)!=null&&a.length?i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-red-500"}),"Outlier Analysis (",n.outliers.method,")",i.jsx(_e,{text:"Detects anomalous rows using Isolation Forest. Lower scores indicate higher anomaly."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Total Outliers"}),i.jsx("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:n.outliers.total_outliers})]}),i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Percentage"}),i.jsxs("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:[n.outliers.outlier_percentage.toFixed(2),"%"]})]})]}),i.jsx("h4",{className:"text-md font-medium text-gray-900 dark:text-white mb-3",children:"Top Anomalous Rows"}),i.jsx("div",{className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Row Index"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Anomaly Score"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Why is this an outlier?"}),n.outliers.top_outliers[0]&&Object.keys(n.outliers.top_outliers[0].values??{}).slice(0,5).map(d=>i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:d},d))]})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.outliers.top_outliers.map(d=>{var h;return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-gray-500",children:d.index}),i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-red-600",children:((h=d.score)==null?void 0:h.toFixed(4))??"β€”"}),i.jsx("td",{className:"px-4 py-3 text-sm",children:d.explanation?i.jsx("div",{className:"space-y-1",children:d.explanation.map((u,m)=>i.jsxs("div",{className:"text-xs",children:[i.jsxs("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:[u.feature,":"]})," ",i.jsx("span",{className:"text-red-600 dark:text-red-400",children:u.value.toFixed(2)})," ",i.jsxs("span",{className:"text-gray-400",children:["(Median: ",u.median.toFixed(2),", Diff: ",u.diff_pct.toFixed(0),"%)"]})]},m))}):i.jsx("span",{className:"text-gray-400 text-xs",children:"No explanation available"})}),Object.entries(d.values??{}).slice(0,5).map(([u,m])=>i.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-300",children:typeof m=="number"?m.toFixed(2):String(m)},u))]},d.index)})})]})})]}):i.jsx(Kt,{icon:i.jsx(_i,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Outlier Data",description:"Outlier analysis did not return any results."})},oc=n=>{if(n===null||Number.isNaN(n))return"rgba(243, 244, 246, 1)";const l=Math.max(.4,Math.abs(n));return n>0?`rgba(239, 68, 68, ${l})`:`rgba(59, 130, 246, ${l})`},lc=()=>i.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",role:"img","aria-label":"Correlation color scale from negative one (blue) through zero (white) to positive one (red)",children:[i.jsx("span",{children:"βˆ’1"}),i.jsx("div",{className:"h-3 w-40 rounded-sm border border-gray-200 dark:border-gray-700",style:{background:"linear-gradient(to right, rgba(59,130,246,1), rgba(59,130,246,0.4), rgba(243,244,246,1), rgba(239,68,68,0.4), rgba(239,68,68,1))"},"aria-hidden":"true"}),i.jsx("span",{children:"0"}),i.jsx("span",{className:"w-6"}),i.jsx("span",{children:"+1"}),i.jsx("span",{className:"ml-2 italic text-gray-500 dark:text-gray-400",children:"Negative (blue) Β· Positive (red)"})]}),Gn=({data:n})=>{const a=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(0,20),[n]),d=k.useMemo(()=>((n==null?void 0:n.values)??[]).slice(0,20).map(p=>p.slice(0,20)),[n]),h=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(20),[n]),u=k.useMemo(()=>n!=null&&n.columns?n.columns.map((p,g)=>{const w={variable:p};return n.columns.forEach((y,b)=>{var x;w[y]=((x=n.values[g])==null?void 0:x[b])??null}),w}):[],[n]);if(!n||!n.columns)return i.jsx("div",{children:"No correlation data available"});const m=n.columns.length>20;return i.jsxs("div",{className:"overflow-x-auto p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx(lc,{}),m&&i.jsxs("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-200 text-sm rounded-md",children:["Showing the first ",20," of ",n.columns.length," columns (",h.length," omitted: ",h.slice(0,5).join(", "),h.length>5?", …":"","). Use the data table below for the full matrix."]}),i.jsx("div",{className:"inline-block min-w-full",children:i.jsxs("div",{className:"grid gap-1",style:{gridTemplateColumns:`100px repeat(${a.length}, minmax(50px, 1fr))`,paddingTop:"4.5rem"},children:[i.jsx("div",{className:"p-2"}),a.map((p,g)=>i.jsx("div",{className:"relative p-2 text-xs font-medium text-gray-700 dark:text-gray-300",title:p,children:i.jsx("span",{className:"absolute bottom-1 left-1/2 whitespace-nowrap origin-bottom-left",style:{transform:"rotate(-45deg)"},children:p})},g)),a.map((p,g)=>i.jsxs($t.Fragment,{children:[i.jsx("div",{className:"p-2 text-xs font-medium truncate text-right pr-4 text-gray-700 dark:text-gray-300",title:p,children:p}),(d[g]??[]).map((w,y)=>i.jsx("div",{className:"h-10 w-full flex items-center justify-center text-[10px] text-gray-900 dark:text-gray-100 rounded-sm cursor-help transition-opacity hover:opacity-80",style:{backgroundColor:oc(w)},title:`${p} vs ${a[y]}: ${w!==null?w.toFixed(3):"N/A"}`,children:w!==null?w.toFixed(2):""},y))]},g))]})}),i.jsx(ki,{caption:"Full correlation matrix data table",filename:"correlation-matrix",columns:[{key:"variable",label:"Variable"},...n.columns.map(p=>({key:p,label:p}))],rows:u})]})};function ps({target:n,reason:l}){if(!n||!l)return null;const a={categorical:`The selected target β€œ${n}” is treated as categorical and is omitted from numeric-only causal discovery and Pearson correlations. Use Target Analysis for categorical associations.`,excluded:`The selected target β€œ${n}” is excluded from this report's analysis.`,unsupported:`The selected target β€œ${n}” is not supported by numeric-only causal discovery or Pearson correlations.`};return i.jsx("p",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:a[l]})}const dc=({profile:n})=>{const[l,a]=k.useState(null),[d,h]=k.useState(null);if(!(n!=null&&n.correlations))return i.jsxs(i.Fragment,{children:[i.jsx(ps,{target:n==null?void 0:n.target_col,reason:n==null?void 0:n.causal_target_exclusion_reason}),i.jsx(Kt,{icon:i.jsx(yt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Correlation Data",description:"Not enough numeric columns to compute correlations."})]});const u=async(m,p,g)=>{if(m){a(g);try{const w=wr(),y=20,b=m.columns.slice(0,y),x=m.values.slice(0,y).map(A=>A.slice(0,y)),N=60,P=document.createElement("canvas"),j=P.getContext("2d");if(!j)return;j.font="12px sans-serif";let M=0;b.forEach(A=>{const I=j.measureText(A).width;I>M&&(M=I)});const D=M+40,S=M*.7+60,G=60,fe=D+b.length*N+50,le=S+b.length*N+G+50;P.width=fe,P.height=le,j.fillStyle=w.bgColor,j.fillRect(0,0,fe,le),j.fillStyle=w.textColor,j.font="bold 24px sans-serif",j.textAlign="center",j.fillText(p,fe/2,40);const ne=A=>{if(A===null)return w.bgColor==="#ffffff"?"#f3f4f6":"#374151";const I=Math.max(.2,Math.abs(A));return A>0?`rgba(239, 68, 68, ${I})`:`rgba(59, 130, 246, ${I})`};j.font="12px sans-serif",j.textBaseline="middle",x.forEach((A,I)=>{j.fillStyle=w.textColor,j.textAlign="right",j.fillText(b[I],D-10,S+G+I*N+N/2),A.forEach((V,B)=>{const H=D+B*N,re=S+G+I*N;j.fillStyle=ne(V),j.fillRect(H,re,N-2,N-2),V!==null&&(j.fillStyle=Math.abs(V)>.5?"#ffffff":w.textColor,j.textAlign="center",j.fillText(V.toFixed(2),H+N/2,re+N/2))})}),j.save(),b.forEach((A,I)=>{const V=D+I*N+N/2,B=S+G-10;j.translate(V,B),j.rotate(-Math.PI/4),j.fillStyle=w.textColor,j.textAlign="left",j.fillText(A,0,0),j.rotate(Math.PI/4),j.translate(-V,-B)}),j.restore();const we=document.createElement("a");we.download=g,we.href=P.toDataURL("image/png"),we.click()}finally{a(null),h(g),setTimeout(()=>h(null),1200)}}};return i.jsxs("div",{className:"space-y-8",children:[i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Feature Correlations (Multicollinearity)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation between features only. Use this to detect redundant variables (multicollinearity)."}),i.jsx("button",{onClick:()=>u(n.correlations,"Feature Correlations","feature-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="feature-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="feature-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations})]}),n.correlations_with_target&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-green-500"}),"Target Correlations (Feature Selection)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation including the target variable. Use this to identify the most predictive features."}),i.jsx("button",{onClick:()=>u(n.correlations_with_target,"Target Correlations","target-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="target-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="target-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations_with_target})]})]})},cc=({profile:n,excludedCols:l,handleToggleExclude:a})=>{var h;if(!((h=n==null?void 0:n.sample_data)!=null&&h.length))return i.jsx(Kt,{icon:i.jsx(mr,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Sample Data",description:"No sample rows available for this dataset."});const d=Object.keys(n.sample_data[0]||{}).filter(u=>!l.includes(u)&&!u.endsWith("_encoded"));return i.jsxs("div",{className:"mt-4 overflow-x-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsx("tr",{children:d.map(u=>i.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider group",children:i.jsxs("div",{className:"flex items-center gap-2",children:[u,i.jsx("button",{onClick:m=>{m.stopPropagation(),a(u,!0)},className:"p-1 rounded transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 hover:bg-red-100 text-gray-400 hover:text-red-500 dark:hover:bg-red-900/30",title:"Exclude from analysis","aria-label":"Exclude from analysis",children:i.jsx(Ut,{className:"w-3 h-3"})})]})},u))})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.sample_data.slice(0,50).map((u,m)=>i.jsx("tr",{children:d.map((p,g)=>i.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:u[p]!==null?String(u[p]):i.jsx("span",{className:"italic text-gray-400",children:"null"})},g))},m))})]}),n.sample_data.length>50&&i.jsxs("div",{className:"p-4 text-center text-sm text-gray-500 border-t border-gray-200 dark:border-gray-700",children:["Showing first 50 rows of ",n.sample_data.length," sample rows."]})]})},xs=150,Yn=40,hc=()=>{const n=document.documentElement.classList.contains("dark");return{borderRadius:"5px",padding:"10px",width:xs,textAlign:"center",borderWidth:"1px",borderStyle:"solid",backgroundColor:n?"#222529":"#ffffff",color:n?"#f3f4f6":"#17102b",borderColor:n?"#666d77":"#b9b3c8"}},uc=n=>{const l=document.documentElement.classList.contains("dark");return n==="directed"?l?"#9acbfa":"#3b4bc4":l?"#abafb7":"#6b6485"},mc=(n,l)=>{const a={type:os.ArrowClosed,color:l};return n==="bidirected"?{markerStart:a,markerEnd:a}:n==="directed"?{markerEnd:a}:{}},fc=({graph:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),[p,g]=k.useState(0);k.useEffect(()=>{const y=new MutationObserver(()=>{g(b=>b+1)});return y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>y.disconnect()},[]);const w=k.useCallback((y,b)=>{try{const x=new yi.graphlib.Graph;return x.setDefaultEdgeLabel(()=>({})),x.setGraph({rankdir:"LR",nodesep:80,ranksep:200}),y.forEach(P=>{x.setNode(P.id,{width:xs,height:Yn})}),b.forEach(P=>{x.setEdge(P.source,P.target)}),yi.layout(x),{nodes:y.map(P=>{const j=x.node(P.id);return j?{...P,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:j.x-xs/2,y:j.y-Yn/2}}:{...P,position:{x:Math.random()*500,y:Math.random()*500}}}),edges:b}}catch(x){return console.error("Dagre layout failed:",x),{nodes:y.map((P,j)=>({...P,position:{x:j%3*250,y:Math.floor(j/3)*100}})),edges:b}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0){a([]),u([]);return}const y=new Map(n.nodes.map((P,j)=>[P.id,`causal-node-${j}`])),b=n.nodes.map((P,j)=>({id:`causal-node-${j}`,data:{label:P.label},position:{x:0,y:0},style:hc()})),x=n.edges.flatMap((P,j)=>{const M=y.get(P.source),D=y.get(P.target);if(M===void 0||D===void 0)return[];const S=uc(P.type);return[{id:`e${j}`,source:M,target:D,animated:!0,type:"default",label:P.type==="directed"?"causes":P.type==="bidirected"?"confounded":"related",labelStyle:{fill:"hsl(var(--foreground))",fontSize:12},labelBgStyle:{fill:"hsl(var(--card))"},style:{stroke:S,strokeDasharray:P.type==="directed"?"0":"5 5"},...mc(P.type,S)}]}),N=w(b,x);a(N.nodes),u(N.edges)},[n,w,a,u,p]),i.jsx("div",{className:"space-y-2",children:i.jsx("div",{style:{width:"100%",height:"500px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900"}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})})})};function gc(n){switch(n){case"all":return"This graph includes all eligible numeric variables; no feature cap was needed.";case"target_correlation":return"This graph includes the selected numeric target and up to 14 numeric features with the strongest absolute Pearson correlations to it.";case"variance":return"This graph includes up to 15 of the highest-variance numeric variables; no eligible numeric target was used for selection.";default:return"Causal discovery is limited to up to 15 numeric variables. Selection details were not recorded for this report."}}const pc=({profile:n})=>{var m;const l=n.causal_graph,[a,d]=k.useState("idle"),h=k.useCallback(()=>{const p=document.querySelector("#causal-chart .react-flow__viewport");if(!p)return;d("downloading");const w=document.documentElement.classList.contains("dark")?"#111827":"#f9fafb";ws(p,{backgroundColor:w,pixelRatio:2,filter:y=>{const b=y==null?void 0:y.classList;return b?!b.contains("react-flow__controls")&&!b.contains("react-flow__minimap"):!0}}).then(y=>{const b=document.createElement("a");b.download="causal-discovery.png",b.href=y,b.click()}).catch(y=>{console.error("Causal graph download failed",y),Wt.error("Causal graph download failed",String(y))}).finally(()=>{d("done"),setTimeout(()=>d("idle"),1200)})},[]),u=i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason});return(m=l==null?void 0:l.nodes)!=null&&m.length?i.jsx("div",{className:"space-y-6 mt-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Causal Discovery (PC Algorithm)",i.jsx(_e,{text:"Inferred causal structure using the Peter-Clark algorithm. Arrows (A->B) suggest A causes B. Lines (A-B) suggest correlation without clear direction. Bidirected arrows (A<->B) suggest a hidden common cause."})]}),i.jsx("button",{onClick:h,disabled:a!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download Chart",children:a==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):a==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:[i.jsx("strong",{children:"Disclaimer:"})," This graph is inferred purely from observational data. Correlation does not imply causation. Use this as a hypothesis generation tool, not absolute truth."]}),u,i.jsx("div",{id:"causal-chart",children:i.jsx(fc,{graph:l})}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:gc(l.selection_method)})]})}):i.jsxs("div",{className:"p-8 text-center text-gray-500",children:[i.jsx(wt,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"No causal graph available. This might be because there are fewer than 2 numeric columns or the analysis failed."}),u]})},Xn=220,Qn=100;function xc(n,l){if(n.feature===void 0||n.threshold===void 0)return"";const a=l==null?void 0:l[n.feature];if(a){const d=a.filter((h,u)=>u<=n.threshold);return`${n.feature} in [${d.join(", ")}]`}return`${n.feature} <= ${n.threshold.toFixed(2)}`}const _c=({data:n})=>{const l=n.is_leaf,a=n.value.reduce((u,m)=>u+m,0),d=n.value.length>0?Math.max(...n.value):0,h=a>0?d/a*100:0;return i.jsxs("div",{className:`px-4 py-3 shadow-md rounded-md border-2 ${l?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-blue-500 bg-white dark:bg-gray-800"} min-w-[200px]`,children:[i.jsx(Rn,{type:"target",position:vt.Left,className:"w-3 h-3 !bg-gray-400"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("div",{className:"font-bold text-sm text-gray-900 dark:text-white border-b pb-1 mb-1",children:l?i.jsxs("span",{className:"flex items-center gap-2 text-green-700 dark:text-green-400",children:[i.jsx(lr,{className:"w-4 h-4"}),"Prediction: ",n.class_name]}):i.jsxs("span",{className:"flex items-center gap-2 text-blue-700 dark:text-blue-400",children:[i.jsx(ko,{className:"w-4 h-4"}),xc(n,n.categories)]})}),i.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[i.jsxs(jr,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Samples:"})}),i.jsx(ms,{children:i.jsx("p",{children:"The number of data points that fall into this rule bucket."})})]}),i.jsx("span",{className:"font-mono",children:n.samples})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Purity:"})}),i.jsx(ms,{children:i.jsx("p",{className:"max-w-xs",children:"The percentage of samples in this node that belong to the majority class. Higher purity means a clearer separation."})})]}),i.jsxs("span",{className:`font-mono ${h>80?"text-green-600 font-bold":""}`,children:[h.toFixed(1),"%"]})]})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full mt-1 overflow-hidden flex",children:n.value.map((u,m)=>i.jsx("div",{style:{width:`${a>0?u/a*100:0}%`,backgroundColor:`hsl(${m*137.5}, 70%, 50%)`},title:`Class ${m}: ${u}`},m))})]})]}),i.jsx(Rn,{type:"source",position:vt.Right,className:"w-3 h-3 !bg-gray-400"})]})},yc={decision:_c},vc=({tree:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),p=k.useCallback((g,w)=>{try{const y=new yi.graphlib.Graph;return y.setDefaultEdgeLabel(()=>({})),y.setGraph({rankdir:"LR",nodesep:50,ranksep:150}),g.forEach(x=>{y.setNode(x.id,{width:Xn,height:Qn})}),w.forEach(x=>{y.setEdge(x.source,x.target)}),yi.layout(y),{nodes:g.map(x=>{const N=y.node(x.id);return{...x,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:N?N.x-Xn/2:0,y:N?N.y-Qn/2:0}}}),edges:w}}catch(y){return console.error("Dagre layout failed:",y),{nodes:g,edges:w}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0)return;const g=n.nodes.map(b=>({id:b.id.toString(),type:"decision",data:{...b,categories:n.categories},position:{x:0,y:0}})),w=[];n.nodes.forEach(b=>{b.children&&b.children.length>0&&(b.children[0]!==void 0&&w.push({id:`e${b.id}-${b.children[0]}`,source:b.id.toString(),target:b.children[0].toString(),label:"True",type:"smoothstep",style:{stroke:"#22c55e",strokeWidth:2},labelStyle:{fill:"#22c55e",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#22c55e"}}),b.children[1]!==void 0&&w.push({id:`e${b.id}-${b.children[1]}`,source:b.id.toString(),target:b.children[1].toString(),label:"False",type:"smoothstep",style:{stroke:"#ef4444",strokeWidth:2},labelStyle:{fill:"#ef4444",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#ef4444"}}))});const y=p(g,w);a(y.nodes),u(y.edges)},[n,p,a,u]),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{style:{width:"100%",height:"600px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,nodeTypes:yc,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900",gap:16,size:1}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic flex items-center gap-1",children:[i.jsx(jt,{className:"w-3 h-3"}),"This tree is a ",i.jsx("strong",{children:"surrogate (explanatory) model"})," trained on your data to surface readable rules. Do not treat it as a production-grade predictor. Green paths mean the condition is met (True); red paths mean it is not (False)."]})]})},bc=({profile:n})=>{const l=n==null?void 0:n.rule_tree,a=at();return l?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[i.jsx(ds,{className:"w-5 h-5 text-blue-600"}),"Decision Tree Analysis"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["This is a ",i.jsx("strong",{children:"surrogate model"}),": a simple decision tree trained on your dataset to approximate the relationship between features and the target. Use it for interpretation (human-readable rules), not as a causal claim or a production model."]})]}),l.accuracy&&i.jsx(jr,{children:i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsxs("div",{className:"text-sm bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 px-3 py-1 rounded-full border border-blue-200 dark:border-blue-800 cursor-help",children:["Tree Fidelity: ",i.jsxs("strong",{children:[(l.accuracy*100).toFixed(1),"%"]})]})}),i.jsx(ms,{children:i.jsxs("p",{className:"max-w-xs",children:[i.jsx("strong",{children:"Tree Fidelity:"})," How closely this surrogate tree matches the patterns in your data (higher is better). If fidelity is low, treat extracted rules as exploratory."]})})]})})]}),i.jsx(vc,{tree:l})]}),l.feature_importances&&l.feature_importances.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[i.jsx(No,{className:"w-5 h-5 text-blue-600"}),"Feature Importance (Surrogate Model)"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:["Importances reflect what the ",i.jsx("strong",{children:"surrogate tree"})," used to split the data. They may differ from a more complex model’s importances."]}),i.jsx("div",{className:"h-80 w-full",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:l.feature_importances.slice(0,10),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!0,vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{type:"number",domain:[0,"auto"],hide:!0}),i.jsx(Qe,{dataKey:"feature",type:"category",width:150,tick:{fontSize:12,fill:a.axisColor},interval:0}),i.jsx(He,{formatter:d=>[(d*100).toFixed(1)+"%","Importance"],contentStyle:a.tooltipContentStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"importance",radius:[0,4,4,0],barSize:20,children:l.feature_importances.slice(0,10).map((d,h)=>i.jsx(js,{fill:`hsl(217, 91%, ${60-h*3}%)`},`cell-${h}`))})]})})}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 text-center",children:"Showing top 10 features driving the decision rules."})]}),l.rules&&l.rules.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4",children:"Segmentation-Decision Tree (Surrogate Model)"}),i.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:l.rules.map((d,h)=>i.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-900 rounded border border-gray-100 dark:border-gray-700 text-sm font-mono text-gray-700 dark:text-gray-300",children:d},h))})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8",children:[i.jsx(ds,{className:"w-12 h-12 mb-4 text-gray-300 dark:text-gray-600"}),i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Decision Tree Not Available"}),i.jsx("p",{className:"text-center max-w-md mb-4",children:"No tree was generated. This usually happens if the dataset is too small, or if a target column was not selected for analysis."}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 dark:bg-amber-900/20 dark:text-amber-400 px-4 py-2 rounded-md",children:[i.jsx(bt,{className:"w-4 h-4"}),i.jsxs("span",{children:["Ensure you have selected a ",i.jsx("strong",{children:"Target Column"})," and re-run the analysis."]})]})]})},wc=20,_t=new Map;function _s(n){return n.filter_value===void 0?n.name:n.filter_value}function Ft(n){return JSON.stringify([_s(n)])}function jc(n,l){if(_t.delete(n),_t.set(n,l),_t.size>wc){const a=_t.keys().next().value;a!==void 0&&_t.delete(a)}}const kc=({datasetId:n,measureCol:l,measureAgg:a,columns:d,initialFilters:h})=>{const[u,m]=k.useState([]),[p,g]=k.useState(!1),[w,y]=k.useState(null),[b,x]=k.useState([null]),N=k.useRef(null),P=k.useRef(null),j=k.useRef(0),[M,D]=k.useState([]);k.useEffect(()=>{N.current&&N.current.scrollTo({left:N.current.scrollWidth,behavior:"smooth"})},[u.length]);const S=()=>{if(!P.current)return;const A=[],I=P.current.getBoundingClientRect();u.forEach((V,B)=>{if(B>=u.length-1)return;const H=V.items.findIndex(ie=>Ft(ie)===V.selectedItemKey);if(H<0)return;const re=`node-${B}-${H}`,Z=document.getElementById(re);if(Z){const ie=Z.getBoundingClientRect(),Q=ie.right-I.left,ge=ie.top+ie.height/2-I.top;let O,ce;const z=u[B+1];if(!z)return;if(z.selectedItemKey){const q=z.items.findIndex(se=>Ft(se)===z.selectedItemKey),ee=`node-${B+1}-${q}`,oe=document.getElementById(ee);if(oe){const se=oe.getBoundingClientRect();O=se.left-I.left,ce=se.top+se.height/2-I.top}else return}else{const q=`list-${B+1}`,ee=document.getElementById(q);if(ee){const oe=ee.getBoundingClientRect();O=oe.left-I.left,ce=oe.top+oe.height/2-I.top}else return}if(O!==void 0&&ce!==void 0){const q=(Q+O)/2,ee=`M ${Q} ${ge} C ${q} ${ge}, ${q} ${ce}, ${O} ${ce}`;A.push({d:ee})}}}),D(A)};$t.useLayoutEffect(()=>{S()},[u,w]),k.useEffect(()=>{if(u.length>0){const A=`${n}-${l}-${a}`;jc(A,{levels:u,splitPath:b})}},[u,b,n,l,a]),k.useEffect(()=>{const A=`${n}-${l}-${a}`,I=_t.get(A);I?(m(I.levels),x(I.splitPath)):G()},[n,l,a]);const G=async()=>{const A=++j.current;g(!0);try{const I=await qe.getDecomposition(n,l==="count"?null:l,a,"",h);if(A!==j.current)return;m([{id:"root",splitColumn:null,items:I,selectedItemKey:null,filters:h}]),x([null])}catch(I){A===j.current&&console.error(I)}finally{A===j.current&&g(!1)}},fe=(A,I)=>{var Z,ie,Q,ge,O;const V=u[A];if(!V||!V.selectedItemKey)return;const B=V.items.find(ce=>Ft(ce)===V.selectedItemKey);if(!B)return;const H=I.currentTarget.getBoundingClientRect(),re=(Z=N.current)==null?void 0:Z.getBoundingClientRect();if(re){let ce=H.right-re.left+10,z=H.top-re.top;const q=((Q=(ie=N.current)==null?void 0:ie.parentElement)==null?void 0:Q.clientWidth)||window.innerWidth;ce+260>q&&(ce=H.left-re.left-270);const ee=((O=(ge=N.current)==null?void 0:ge.parentElement)==null?void 0:O.clientHeight)||window.innerHeight;z+300>ee&&(z=ee-310),y({levelIndex:A,item:B,x:ce,y:z})}},le=async(A,I)=>{const V=u[A];if(!V)return;const B={...V,selectedItemKey:Ft(I)},H=u.map((Z,ie)=>ie===A?B:Z),re=b[A+1];if(re){const Z=++j.current;g(!0);try{const ie=[...B.filters];B.splitColumn&&ie.push({column:B.splitColumn,operator:"==",value:_s(I)});const Q=await qe.getDecomposition(n,l==="count"?null:l,a,re,ie);if(Z!==j.current)return;const ge={id:`level-${A+1}`,splitColumn:re,items:Q,selectedItemKey:null,filters:ie},O=[...H.slice(0,A+1),ge];m(O),x(b.slice(0,A+2))}catch(ie){Z===j.current&&console.error(ie)}finally{Z===j.current&&g(!1)}}else m(H)},ne=async A=>{if(!w)return;const{levelIndex:I,item:V}=w;y(null);const B=++j.current;g(!0);try{const H=u[I];if(!H)return;const re=[...H.filters];H.splitColumn&&re.push({column:H.splitColumn,operator:"==",value:_s(V)});const Z=await qe.getDecomposition(n,l==="count"?null:l,a,A,re);if(B!==j.current)return;const ie={id:`level-${I+1}`,splitColumn:A,items:Z,selectedItemKey:null,filters:re},Q=[...u.slice(0,I+1),ie];m(Q);const ge=[...b.slice(0,I+1),A];x(ge)}catch(H){B===j.current&&console.error(H)}finally{B===j.current&&g(!1)}},we=A=>{m(u.slice(0,A)),x(b.slice(0,A))};return i.jsxs("div",{className:"relative w-full h-[600px] bg-slate-50 dark:bg-slate-900 overflow-hidden flex flex-col",children:[p&&i.jsx("div",{className:"absolute top-2 right-2 z-50",children:i.jsx(be,{className:"w-5 h-5 animate-spin text-blue-500"})}),i.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",ref:N,children:i.jsxs("div",{className:"flex h-full p-8 min-w-max gap-12 relative",ref:P,children:[u.map((A,I)=>i.jsxs("div",{className:"flex flex-col w-[200px] h-full relative z-10",children:[i.jsxs("div",{id:`header-${I}`,className:"flex items-center justify-between mb-4 bg-white dark:bg-slate-800 p-2 rounded shadow-sm border border-slate-200 dark:border-slate-700",children:[i.jsx("span",{className:"font-semibold text-sm text-slate-700 dark:text-slate-200",children:A.splitColumn||"Total"}),i.jsxs("div",{className:"flex items-center gap-1",children:[I===u.length-1&&i.jsx("button",{onClick:V=>fe(I,V),className:` + p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors + ${A.selectedItemKey?"text-blue-500":"text-slate-300 cursor-not-allowed"} + `,title:A.selectedItemKey?"Split further":"Select an item to split",disabled:!A.selectedItemKey,children:i.jsx(bs,{className:"w-4 h-4"})}),I>0&&i.jsx("button",{onClick:()=>we(I),className:"text-slate-400 hover:text-red-500",children:i.jsx(hr,{className:"w-4 h-4"})})]})]}),i.jsx("div",{id:`list-${I}`,className:"flex-1 overflow-y-auto pr-2 space-y-2 scrollbar-thin scrollbar-thumb-slate-300 dark:scrollbar-thumb-slate-600",onScroll:S,children:A.items.map((V,B)=>{const H=Ft(V),re=A.selectedItemKey===H,Z=Math.max(...A.items.map(Q=>Q.value)),ie=V.value/Z*100;return i.jsxs("div",{id:`node-${I}-${B}`,...ji(()=>le(I,V)),"aria-pressed":re,className:` + relative p-3 rounded-md border cursor-pointer transition-all group + ${re?"bg-blue-50 border-blue-500 dark:bg-blue-900/20 dark:border-blue-500 shadow-md":"bg-white border-slate-200 dark:bg-slate-800 dark:border-slate-700 hover:border-blue-300 dark:hover:border-blue-700"} + `,children:[i.jsxs("div",{className:"flex justify-between items-center mb-1 relative z-10 gap-2",children:[i.jsxs("span",{className:"font-medium text-sm truncate flex-1 min-w-0",title:V.name,children:[V.name,V.filter_value===null&&i.jsx("span",{className:"text-slate-500",children:" (missing)"})]}),i.jsxs("span",{className:"text-xs font-mono text-slate-500 dark:text-slate-400 whitespace-nowrap",children:[V.value.toLocaleString()," (",Math.round(V.ratio*100),"%)"]})]}),i.jsx("div",{className:"absolute bottom-0 left-0 h-1 bg-blue-500/20 transition-all duration-500",style:{width:`${ie}%`}})]},H)})})]},I)),i.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none z-0",children:M.map((A,I)=>i.jsx("path",{d:A.d,fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeOpacity:"0.5"},I))})]})}),w&&i.jsxs("div",{className:"absolute z-50 bg-white dark:bg-slate-800 rounded-lg shadow-xl border border-slate-200 dark:border-slate-700 w-64 max-h-80 overflow-y-auto flex flex-col",style:{left:w.x,top:w.y},children:[i.jsx("div",{className:"p-3 border-b border-slate-100 dark:border-slate-700 bg-slate-50 dark:bg-slate-900 sticky top-0",children:i.jsx("span",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Split by"})}),i.jsx("div",{className:"p-1",children:d.map(A=>i.jsx("button",{onClick:()=>ne(A),className:"w-full text-left px-3 py-2 text-sm text-slate-700 dark:text-slate-200 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded-md transition-colors",children:A},A))})]}),w&&i.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(null)})]})},Nc=({datasetId:n,columns:l,initialFilters:a=[]})=>{const[d,h]=k.useState("count"),[u,m]=k.useState("count"),[p,g]=k.useState(0),w=()=>{g(y=>y+1)};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-white dark:bg-slate-800 p-4 rounded-lg shadow-sm border border-slate-200 dark:border-slate-700 flex gap-4 items-end",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs font-medium text-slate-500",children:"Analyze"}),i.jsxs("select",{value:d,onChange:y=>h(y.target.value),className:"block w-[180px] rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"count",children:"Row Count"}),l.map(y=>i.jsx("option",{value:y,children:y},y))]})]}),d!=="count"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs font-medium text-slate-500",children:"Aggregation"}),i.jsxs("select",{value:u,onChange:y=>m(y.target.value),className:"block w-[120px] rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"sum",children:"Sum"}),i.jsx("option",{value:"mean",children:"Average"}),i.jsx("option",{value:"min",children:"Min"}),i.jsx("option",{value:"max",children:"Max"})]})]}),i.jsx("button",{onClick:w,className:"p-2 border rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 text-slate-600 dark:text-slate-300",title:"Reset Tree","aria-label":"Reset Tree",children:i.jsx(qt,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"bg-slate-50 dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-800 overflow-hidden",children:i.jsx(kc,{datasetId:n,measureCol:d,measureAgg:u,columns:l,initialFilters:a},p)})]})},xi=async(n,l,a,d,h)=>{const u=document.getElementById(n);if(!u)return;const m=zo(),p=m?"#1f2937":"#ffffff",g=m?"#f3f4f6":"#111827",w=m?"#9ca3af":"#4b5563",y=(x,N)=>{let P=0;return a&&(x.fillStyle=g,x.font="bold 16px sans-serif",x.textAlign="center",x.fillText(a,N/2,30),P=40),d&&(x.fillStyle=w,x.font="12px sans-serif",x.textAlign="center",x.fillText(d,N/2,50),P=60),h&&(x.fillStyle=g,x.font="10px monospace",x.textAlign="right",h.split(` +`).forEach((M,D)=>{x.fillText(M,N-10,20+D*12)})),P||20},b=u.querySelector(".js-plotly-plot");if(b){try{const x=await Lr.toImage(b,{format:"png",width:1200,height:800}),N=document.createElement("canvas"),P=N.getContext("2d"),j=new Image,M=1200,D=800,S=a?d?80:50:0;j.onload=()=>{if(N.width=M,N.height=D+S,P){P.fillStyle=p,P.fillRect(0,0,N.width,N.height),a&&(P.fillStyle=g,P.font="bold 24px sans-serif",P.textAlign="center",P.fillText(a,M/2,40),d&&(P.fillStyle=w,P.font="16px sans-serif",P.fillText(d,M/2,70))),h&&(P.fillStyle=g,P.font="14px monospace",P.textAlign="right",h.split(` +`).forEach((le,ne)=>{P.fillText(le,M-20,30+ne*18)})),P.drawImage(j,0,S);const G=document.createElement("a");G.download=`${l}.png`,G.href=N.toDataURL("image/png"),G.click()}},j.src=x}catch(x){console.error("Plotly download failed",x)}return}try{const x=await ws(u,{backgroundColor:p,pixelRatio:2}),N=new Image;N.onload=()=>{const P=a?d?80:50:0,j=document.createElement("canvas"),M=j.getContext("2d");if(j.width=N.width,j.height=N.height+P*2,M){M.fillStyle=p,M.fillRect(0,0,j.width,j.height),M.save(),M.scale(2,2),y(M,N.width/2),M.restore(),M.drawImage(N,0,P*2);const D=document.createElement("a");D.download=`${l}.png`,D.href=j.toDataURL("image/png"),D.click()}},N.src=x}catch(x){console.error("Chart download failed",x)}};function Cc(n){var S;const{report:l,profile:a,activeTab:d,setActiveTab:h,filtersDraft:u,filtersApplied:m,filtersDirty:p,excludedColsDraft:g,excludedDirty:w,analyzing:y,handleAddFilter:b,handleRemoveFilter:x,handleResetFilters:N,handleApplyFilters:P,handleToggleExclude:j,handleApplyExcluded:M}=n,D=(S=l==null?void 0:l.profile_data)!=null&&S.columns?Object.keys(l.profile_data.columns):[];return i.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-white dark:bg-gray-900",children:[i.jsx(Zl,{activeTab:d,setActiveTab:h,profile:a,filtersDraft:u,filtersApplied:m,filtersDirty:p,columns:D,excludedCols:g,excludedDirty:w,analyzing:y,onAddFilter:b,onRemoveFilter:x,onResetFilters:N,onApplyFilters:P,onToggleExclude:j,onApplyExcluded:M}),i.jsx("div",{className:"flex-1 overflow-y-auto p-6 pt-4 bg-gray-50 dark:bg-gray-900/50",children:i.jsx(Lc,{...n,allColumns:D})})]})}const Jn={dashboard:n=>{const{profile:l,handleToggleExclude:a,excludedColsDraft:d}=n;return i.jsx(Wl,{profile:l,onToggleExclude:a,excludedCols:d})},insights:n=>{const{profile:l}=n;return i.jsx(Vl,{profile:l})},pii:n=>{const{profile:l}=n;return i.jsx(ql,{alerts:l.alerts??[]})},pca:n=>{const{profile:l,scatter:a,setScatter:d}=n;return i.jsx(od,{profile:l,isPCA3D:a.isPCA3D,setIsPCA3D:h=>d({isPCA3D:h}),downloadChart:xi})},geospatial:n=>{const{profile:l}=n;return!!l.geospatial&&i.jsx(Td,{profile:l})},target:n=>{const{profile:l,history:a,loading:d,loadSpecificReport:h,report:u}=n;return!!l.target_col&&!!l.target_correlations&&i.jsx(Ed,{profile:l,downloadChart:xi,history:a,loading:d,loadSpecificReport:h,report:u})},timeseries:n=>{const{profile:l}=n;return!!l.timeseries&&i.jsx(Md,{profile:l,downloadChart:xi})},variables:n=>{const{profile:l,handleToggleExclude:a,handleAddFilter:d}=n;return i.jsx(sc,{profile:l,handleToggleExclude:a,handleAddFilter:d})},bivariate:n=>{const{profile:l,scatter:a,setScatter:d}=n;return i.jsx(rc,{profile:l,downloadChart:xi,scatterX:a.x,setScatterX:h=>d({x:h}),scatterY:a.y,setScatterY:h=>d({y:h}),scatterZ:a.z,setScatterZ:h=>d({z:h}),scatterColor:a.color,setScatterColor:h=>d({color:h}),is3D:a.is3D,setIs3D:h=>d({is3D:h})})},outliers:n=>{const{profile:l}=n;return l.outliers&&i.jsx(ac,{profile:l})},correlations:n=>{const{profile:l}=n;return(!!l.correlations||!!l.correlations_with_target||!!l.causal_target_exclusion_reason)&&i.jsx(dc,{profile:l})},causal:n=>{const{profile:l}=n;return i.jsx(pc,{profile:l})},rules:n=>{const{profile:l}=n;return!!l.rule_tree&&i.jsx(bc,{profile:l})},decomposition:n=>{const{selectedDataset:l,allColumns:a,filtersApplied:d}=n;return l&&i.jsx(Nc,{datasetId:l,columns:a,initialFilters:d})},sample:n=>{const{profile:l,excludedColsDraft:a,handleToggleExclude:d}=n;return l.sample_data&&i.jsx(cc,{profile:l,excludedCols:a,handleToggleExclude:d})}};function Lc(n){const l=n.activeTab;if(!Object.prototype.hasOwnProperty.call(Jn,l))return null;const a=Jn[l];return i.jsx(a,{...n})}function Pc(n){const{loading:l,report:a,error:d,reportQuery:h,runAnalysis:u}=n;if(l&&!a)return i.jsx(Io,{message:"Analyzing dataset..."});if(d)return i.jsx(Oo,{error:d,onRetry:()=>h.refetch()});if(!a)return i.jsx(Sc,{...n});if(a.status==="PENDING")return i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:[i.jsx(be,{className:"w-16 h-16 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Analysis in progress..."}),i.jsx("p",{className:"text-sm text-gray-400",children:"This may take a few moments."})]});if(a.status==="FAILED")return i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-red-500",children:[i.jsx(bt,{className:"w-16 h-16 mb-4"}),i.jsx("p",{children:"Analysis Failed"}),i.jsx("p",{className:"text-sm text-gray-600 mt-2",children:a.error_message}),i.jsxs("button",{onClick:()=>u(),className:"mt-4 flex items-center px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200",children:[i.jsx(qt,{className:"w-4 h-4 mr-2"}),"Retry"]})]});const m=n.profileForUi;return m?i.jsx(Cc,{...n,report:a,profile:m}):i.jsx("div",{children:"No profile data"})}function Sc(n){const{targetCol:l,setTargetCol:a,taskType:d,setTaskType:h,existingReport:u,loadSpecificReport:m,isLoadingReport:p,runAnalysis:g,analyzing:w}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:[i.jsx(yt,{className:"w-16 h-16 mb-4 opacity-20"}),i.jsx("p",{className:"mb-4",children:"No analysis found for this dataset."}),i.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[i.jsxs("div",{className:"w-64 space-y-2",children:[i.jsx("label",{htmlFor:"eda-setup-target-column",className:"sr-only",children:"Target Column (Optional)"}),i.jsx("input",{id:"eda-setup-target-column",type:"text",value:l,onChange:y=>a(y.target.value),placeholder:"Target Column (Optional)",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("label",{htmlFor:"eda-setup-task-type",className:"sr-only",children:"Task Type"}),i.jsxs("select",{id:"eda-setup-task-type",value:d,onChange:y=>h(y.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Auto-Detect Task"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]}),i.jsxs("div",{className:"group relative flex items-center",children:[i.jsx(ar,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute left-full ml-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none",children:"Force a specific task type. Useful for ID columns (force Classification) or numeric categories (force Regression)."})]})]})]}),i.jsxs("div",{className:"flex gap-2",children:[u&&i.jsxs("button",{onClick:()=>m(u.id),disabled:p,className:"flex items-center px-4 py-2 action-secondary rounded-md disabled:opacity-50 disabled:cursor-not-allowed",children:[p?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(qt,{className:"w-4 h-4 mr-2"}),"Load Existing (",new Date(u.created_at).toLocaleDateString(),")"]}),i.jsxs("button",{onClick:()=>g(),disabled:w,className:"flex items-center px-4 py-2 action-primary rounded-md disabled:opacity-50",children:[w?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(bi,{className:"w-4 h-4 mr-2"}),u?"Run New Analysis":"Run Analysis"]})]})]})]})})}const Oc=()=>{const n=ll();return i.jsxs("div",{className:"flex flex-col h-full w-full overflow-hidden bg-white dark:bg-slate-950",children:[i.jsx(dl,{...n}),i.jsx(gl,{...n}),i.jsx(Cl,{...n}),i.jsx("div",{className:"flex-1 overflow-hidden relative",children:i.jsx(Pc,{...n})}),i.jsx(Ll,{...n})]})};export{Oc as EDAPage}; diff --git a/static/ml_canvas/assets/EDAPage-CC9tylrM.js b/static/ml_canvas/assets/EDAPage-CC9tylrM.js deleted file mode 100644 index 5122e4088..000000000 --- a/static/ml_canvas/assets/EDAPage-CC9tylrM.js +++ /dev/null @@ -1,12 +0,0 @@ -import{j as i,u as Qn,a as Jn,P as vt,i as er,B as tr,C as ir,M as as,H as Dn}from"./vendor-flow-Ct2sLZk5.js";import{af as pt,a as k,ad as sr,ag as nr,D as be,c as Vt,E as ao,l as vi,ah as oo,ai as xs,aj as lo,ak as co,H as ho,al as uo,C as os,am as mo,an as rr,ao as qt,e as ar,f as bt,a9 as or,ab as fo,o as lr,_ as _s,p as bi,X as dr,q as ys,ap as go,aq as po,ar as xo,a3 as cr,as as hr,a4 as ur,a5 as yt,j as xi,at as _o,au as Bt,av as wt,aw as ls,ax as yo,ay as ds,k as mr,az as fr,a6 as jt,g as gr,K as ke,B as pr,b as Zt,aa as $t,R as vo,aA as vs,S as bo,aB as wo,h as jo}from"./vendor-utils-VkF_O5b_.js";import{r as ko,g as xr,i as _r,f as ss,D as No,u as Co,t as Ht,a as Lo,M as Po,S as yr,s as wi,w as at,x as We,I as _e,C as ji,b as Ut,y as vr,z as So,B as To,F as Eo,G as _i,T as br,H as cs,J as hs,K as us,O as Mo,L as Ao,E as zo}from"./index-_bluKNvP.js";import{R as Ie,aj as Oo,ak as Do,j as bs,T as He,ah as wr,al as Io,am as Ro,an as Fo,ao as Bo,ap as Zo,aq as $o,ar as Ho,r as Wo,B as nt,C as Ye,X as Xe,Y as Qe,as as jr,h as Ve,at as Vo,au as ns,ag as qo,ai as In,av as kr}from"./vendor-charts-BkHP8M8k.js";import{F as rs}from"./FormField-BaO1-ftW.js";import{r as Uo,a as Go}from"./vendor-plotly-EQ6XkBLq.js";const xt="/api/eda",qe={analyze:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/analyze`,{target_col:l,exclude_cols:a,filters:d,task_type:h})).data,getLatestReport:async n=>(await pt.get(`${xt}/${n}/latest`)).data,getReport:async n=>(await pt.get(`${xt}/reports/${n}`)).data,cancelJob:async n=>(await pt.post(`${xt}/reports/${n}/cancel`)).data,getHistory:async n=>(await pt.get(`${xt}/${n}/history`)).data,getDecomposition:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/decomposition`,{measure_col:l,measure_agg:a,split_col:d,filters:h})).data},Rn={x:"",y:"",z:"",color:"",is3D:!1,isPCA3D:!1},Fn=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,Ko=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>Fn(a)===Fn(l[d])),te=ko((n,l)=>({activeTab:"dashboard",selectedDataset:null,targetCol:"",taskType:"",excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],scatter:{...Rn},setActiveTab:a=>n({activeTab:a}),setSelectedDataset:a=>n({selectedDataset:a}),setTargetCol:a=>n({targetCol:a}),setTaskType:a=>n({taskType:a}),toggleExclude:(a,d)=>n(h=>{const u=h.excludedColsDraft.includes(a);return d?u?h:{excludedColsDraft:[...h.excludedColsDraft,a]}:u?{excludedColsDraft:h.excludedColsDraft.filter(m=>m!==a)}:h}),setExcludedDraft:a=>n({excludedColsDraft:a}),setExcludedApplied:a=>n({excludedColsApplied:a}),applyExcluded:()=>n({excludedColsApplied:[...l().excludedColsDraft]}),addFilterDraft:a=>n(d=>({filtersDraft:[...d.filtersDraft,a]})),removeFilterDraft:a=>n(d=>({filtersDraft:d.filtersDraft.filter((h,u)=>u!==a)})),clearFiltersDraft:()=>n({filtersDraft:[]}),setFiltersDraft:a=>n({filtersDraft:a}),setFiltersApplied:a=>n({filtersApplied:a}),applyFilters:()=>n(a=>({filtersApplied:[...a.filtersDraft]})),setScatter:a=>n(d=>({scatter:{...d.scatter,...a}})),resetForDataset:()=>n({excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],targetCol:"",activeTab:"dashboard",scatter:{...Rn}})})),Yo=n=>{if(n.excludedColsApplied.length!==n.excludedColsDraft.length)return!0;const l=new Set(n.excludedColsApplied);for(const a of n.excludedColsDraft)if(!l.has(a))return!0;return!1},Xo=n=>!Ko(n.filtersDraft,n.filtersApplied),Ee={datasets:["eda","datasets"],report:n=>["eda","report",n],history:n=>["eda","history",n],reportById:n=>["eda","reportById",n]},Qo=n=>{const l=xr();return _r({mutationFn:a=>qe.cancelJob(a),onSuccess:()=>{l.invalidateQueries({queryKey:Ee.history(n)}),l.invalidateQueries({queryKey:Ee.report(n)})}})};function ms(n){if(n==null)return null;const l=n.trim();if(!/^\d+$/.test(l))return null;const a=Number(l);return a>0?a:null}function Jo(n,l,a){const d=ms(n);if(d!==null)return d;if(l!==null)return l;const h=a[0];return h===void 0?null:ms(String(h.id))}function el(n,l,a){return n===null||!a?!1:!l.some(d=>Number(d.id)===n)}function tl(n,l){return l===null?!1:ms(n)===null}function il(n){return n.name.trim()||`Dataset ${n.id}`}function sl(n){const l=String(n.id);return l.length<=6?l:l.slice(-6)}function nl(n){const l=n.map(d=>il(d)),a=new Map;for(const d of l)a.set(d,(a.get(d)??0)+1);return n.map((d,h)=>{const u=l[h];return(a.get(u)??0)>1?{value:d.id,label:`${u} (${sl(d)})`}:{value:d.id,label:u}})}function rl(n){const l=ss({queryKey:Ee.datasets,queryFn:()=>No.getUsable()}),a=k.useMemo(()=>l.data??[],[l.data]),d=k.useMemo(()=>nl(a),[a]),h=ss({queryKey:Ee.report(n??null),queryFn:async()=>{var y;try{return await qe.getLatestReport(n)}catch(b){if(((y=b==null?void 0:b.response)==null?void 0:y.status)===404)return null;throw b}},enabled:n!=null,refetchInterval:y=>{const b=y.state.data;return b&&b.status==="PENDING"?3e3:!1}}),u=h.data??null,m=h.isLoading,p=h.isError?"Failed to load report":null,w=ss({queryKey:Ee.history(n??null),queryFn:()=>qe.getHistory(n),enabled:n!=null,refetchInterval:(u==null?void 0:u.status)==="PENDING"?3e3:!1}).data??[];return{datasetsQuery:l,datasets:a,datasetOptions:d,reportQuery:h,report:u,loading:m,error:p,history:w}}function al(){const[n,l]=Co(),a=xr(),[d,h]=k.useState(!1),[u,m]=k.useState(!1),[p,g]=k.useState(!1),w=k.useRef(!1),y=te(E=>E.activeTab),b=te(E=>E.setActiveTab),x=te(E=>E.selectedDataset),N=te(E=>E.setSelectedDataset),P=te(E=>E.targetCol),j=te(E=>E.setTargetCol),M=te(E=>E.taskType),I=te(E=>E.setTaskType),S=te(E=>E.excludedColsDraft),K=te(E=>E.excludedColsApplied),fe=te(E=>E.filtersDraft),ae=te(E=>E.filtersApplied),ie=te(E=>E.scatter),we=te(E=>E.setScatter),A=te(Yo),z=te(Xo),{datasetsQuery:W,datasets:B,datasetOptions:V,reportQuery:re,report:Z,loading:oe,error:ee,history:ge}=rl(x),O=_r({mutationFn:E=>qe.analyze(x,P||void 0,E.excluded,E.filters,M||void 0),onSuccess:()=>{a.invalidateQueries({queryKey:Ee.report(x??null)}),a.invalidateQueries({queryKey:Ee.history(x??null)})},onSettled:()=>{w.current=!1,g(!1)}}),de=O.isPending||p,D=n.get("dataset_id");k.useEffect(()=>{const E=Jo(D,x,B);E!==x&&N(E)},[D,B,x,N]),k.useEffect(()=>{if(!tl(D,x))return;const E=new URLSearchParams(n);E.set("dataset_id",String(x)),l(E,{replace:!0})},[D,x,n,l]);const q=el(x,B,W.isSuccess);k.useEffect(()=>{te.getState().resetForDataset()},[x]);const Q=k.useMemo(()=>{const E=Z==null?void 0:Z.profile_data;if(!E)return null;const ye=new Set(S),Ue={};return E.columns&&Object.entries(E.columns).forEach(([Re,Yt])=>{ye.has(Re)||(Ue[Re]=Yt)}),{...E,columns:Ue,excluded_columns:S}},[Z==null?void 0:Z.profile_data,S]),se=(E,ye)=>{if(!x)return;const Ue=Array.isArray(E)?E:K,Re=Array.isArray(ye)?ye:ae;O.mutate({excluded:Ue,filters:Re})},ce=async E=>{if(x){m(!0);try{const ye=await a.fetchQuery({queryKey:Ee.reportById(E),queryFn:()=>qe.getReport(E)});a.setQueryData(Ee.report(x),ye)}catch(ye){Ht.error("Failed to load report",String(ye))}finally{m(!1)}}},J=(E,ye,Ue)=>{const Re={column:E,operator:Ue||"==",value:ye};te.getState().addFilterDraft(Re)},G=E=>{te.getState().removeFilterDraft(E)},Pe=()=>{te.getState().setFiltersDraft(ae)},Me=()=>{if(w.current||de)return;w.current=!0,g(!0);const E=te.getState().filtersDraft;te.getState().applyFilters(),se(void 0,E)},Kt=(E,ye)=>{te.getState().toggleExclude(E,ye)},kt=()=>{const E=te.getState().excludedColsDraft;te.getState().applyExcluded(),se(E)};k.useEffect(()=>{if(Z&&Z.profile_data){Z.profile_data.target_col&&j(Z.profile_data.target_col);const E=Array.isArray(Z.profile_data.excluded_columns)?Z.profile_data.excluded_columns:[];te.getState().setExcludedApplied(E),te.getState().setExcludedDraft(E)}},[Z==null?void 0:Z.id]);const Nt=P?ge.find(E=>E.target_col===P&&E.status==="COMPLETED"):null;return{searchParams:n,setSearchParams:l,queryClient:a,showHistoryModal:d,setShowHistoryModal:h,isLoadingReport:u,activeTab:y,setActiveTab:b,selectedDataset:x,targetCol:P,setTargetCol:j,taskType:M,setTaskType:I,excludedColsDraft:S,filtersDraft:fe,filtersApplied:ae,scatter:ie,setScatter:we,excludedDirty:A,filtersDirty:z,datasetOptions:V,reportQuery:re,report:Z,loading:oe,error:ee,history:ge,analyzeMutation:O,analyzing:de,selectionUnavailable:q,profileForUi:Q,runAnalysis:se,loadSpecificReport:ce,handleAddFilter:J,handleRemoveFilter:G,handleResetFilters:Pe,handleApplyFilters:Me,handleToggleExclude:Kt,handleApplyExcluded:kt,existingReport:Nt}}function ol(n){return i.jsx(i.Fragment,{children:i.jsxs("header",{className:"flex-none bg-white dark:bg-slate-900 border-b border-gray-200 dark:border-gray-800 px-4 py-2 flex flex-wrap items-center justify-between gap-3 z-20 shadow-sm lg:h-16 lg:flex-nowrap lg:py-0 lg:gap-4",children:[i.jsx(ll,{...n}),i.jsx(dl,{...n}),i.jsx(ul,{...n})]})})}function ll(n){const{report:l,selectionUnavailable:a,selectedDataset:d,searchParams:h,setSearchParams:u,datasetOptions:m}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-4 lg:gap-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white leading-tight",children:"Exploratory Analysis"}),l&&l.created_at&&i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Last analyzed: ",new Date(l.created_at).toLocaleString()]})]}),i.jsx("div",{className:"h-8 w-px bg-gray-200 dark:bg-gray-700 mx-2"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{htmlFor:"eda-toolbar-dataset",className:"text-[10px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Dataset"}),i.jsxs("select",{id:"eda-toolbar-dataset",value:a?"":d||"",onChange:p=>{const g=new URLSearchParams(h);g.set("dataset_id",p.target.value),u(g)},className:"block w-48 text-sm font-medium bg-transparent border-none p-0 focus:ring-0 text-gray-900 dark:text-white cursor-pointer hover:text-blue-600",children:[i.jsx("option",{value:"",disabled:!0,children:"Select a dataset"}),m.map(p=>i.jsx("option",{value:p.value,children:p.label},p.value))]})]})]})})}function dl(n){const{taskType:l,setTaskType:a,report:d}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-50 dark:bg-gray-800/50 p-1.5 rounded-lg border border-gray-200 dark:border-gray-700 lg:flex-nowrap lg:gap-4",children:[i.jsx(cl,{...n}),i.jsx("div",{className:"w-px h-8 bg-gray-200 dark:bg-gray-700"}),i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{htmlFor:"eda-toolbar-task-type",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Task Type"}),i.jsxs("div",{className:"group relative",children:[i.jsx(nr,{className:"w-3 h-3 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute bottom-full mb-2 w-56 p-2 bg-slate-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none left-1/2 -translate-x-1/2",children:"Force Classification or Regression."})]})]}),i.jsxs("select",{id:"eda-toolbar-task-type",value:l,onChange:h=>a(h.target.value),disabled:!d||!d.profile_data,className:"block w-28 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"Auto"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]})]}),i.jsx(hl,{...n})]})})}function cl(n){const{targetCol:l,setTargetCol:a,report:d,excludedColsDraft:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsx("label",{htmlFor:"eda-toolbar-target-column",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Target Column"}),i.jsxs("select",{id:"eda-toolbar-target-column",value:l,onChange:u=>a(u.target.value),disabled:!d||!d.profile_data,className:"block w-36 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"None"}),d&&d.profile_data&&Object.keys(d.profile_data.columns).filter(u=>!h.includes(u)).map(u=>i.jsx("option",{value:u,children:u},u))]})]})})}function hl(n){const{selectedDataset:l,runAnalysis:a,analyzing:d,existingReport:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("button",{onClick:()=>l&&a(),disabled:!l||d,className:`ml-2 px-3 py-1.5 rounded text-sm font-medium transition-colors flex items-center shadow-sm ${h?"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 hover:bg-gray-50":"action-primary border border-transparent"}`,children:[d?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(vi,{className:"w-4 h-4 mr-2"}),h?"Re-Run":"Analyze"]})})}function ul(n){const{existingReport:l,report:a,loadSpecificReport:d,isLoadingReport:h,setShowHistoryModal:u}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[l&&a&&a.id!==l.id&&i.jsxs("button",{onClick:()=>d(l.id),disabled:h,className:"flex items-center px-3 py-1.5 text-xs bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 rounded-md hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:`Load existing from ${new Date(l.created_at).toLocaleString()}`,children:[h?i.jsx(be,{className:"w-3 h-3 mr-1 animate-spin"}):i.jsx(Vt,{className:"w-3 h-3 mr-1"}),"Load Saved"]}),i.jsxs("button",{onClick:()=>u(!0),className:"flex items-center px-3 py-1.5 text-sm font-medium text-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[i.jsx(ao,{className:"w-4 h-4 mr-2"}),"History"]})]})})}function ml(n){const{history:l,report:a,loadSpecificReport:d,isLoadingReport:h}=n;return i.jsx(i.Fragment,{children:l.length>0&&i.jsxs("div",{className:"flex-none bg-white dark:bg-slate-950 border-b border-gray-100 dark:border-gray-800 px-4 py-1.5 flex items-center gap-3 overflow-x-auto z-10 shadow-[0_2px_3px_-1px_rgba(0,0,0,0.02)]",children:[i.jsx("span",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider whitespace-nowrap",children:"Recent Targets:"}),i.jsx("div",{className:"flex gap-2",children:Array.from(new Set(l.filter(u=>u.target_col&&u.status==="COMPLETED").map(u=>u.target_col))).slice(0,8).map(u=>{var m;return i.jsxs("button",{onClick:()=>{const p=l.find(g=>g.target_col===u&&g.status==="COMPLETED");p&&d(p.id)},disabled:h,className:`px-2 py-0.5 text-xs rounded-full border transition-colors flex items-center disabled:opacity-50 disabled:cursor-not-allowed ${((m=a==null?void 0:a.profile_data)==null?void 0:m.target_col)===u?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 font-medium":"bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-200"}`,children:[i.jsx(sr,{className:"w-3 h-3 mr-1"}),u]},u)})})]})})}const fl={Numeric:{badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",iconColorClass:"text-blue-500",Icon:ho},Categorical:{badgeClass:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",iconColorClass:"text-purple-500",Icon:co},Boolean:{badgeClass:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",iconColorClass:"text-amber-500",Icon:lo},DateTime:{badgeClass:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",iconColorClass:"text-teal-500",Icon:xs},Text:{badgeClass:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-300",iconColorClass:"text-slate-500",Icon:oo}},gl={badgeClass:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",iconColorClass:"text-gray-500",Icon:uo};function ws(n){return fl[n]??gl}function pl(n){return ws(n).badgeClass}function xl(n){return ws(n).iconColorClass}function _l(n){return ws(n).Icon}const yl=({isOpen:n,onClose:l,history:a,datasetId:d,onSelect:h,onFetchReport:u,onRefresh:m})=>{const[p,g]=k.useState(null),[w,y]=k.useState(!1),b=k.useRef(0),x=Qo(d),N=x.isPending?x.variables??null:null,P=Lo(),j=()=>{g(null),l()},M=async(S,K)=>{if(S.stopPropagation(),!!await P({title:"Cancel analysis?",message:"Are you sure you want to cancel this analysis?",confirmLabel:"Cancel job",variant:"danger"}))try{await x.mutateAsync(K),m&&m()}catch(ae){console.error("Failed to cancel job",ae),Ht.error("Failed to cancel job")}},I=async S=>{const K=++b.current;y(!0);try{const fe=await u(S.id);if(K!==b.current)return;g(fe)}catch(fe){console.error("Failed to load report details",fe),K===b.current&&Ht.error("Failed to load job details","Please try again.")}finally{K===b.current&&y(!1)}};return i.jsx(Po,{isOpen:n,onClose:j,size:p?"5xl":"2xl",title:i.jsxs("div",{className:"flex items-center gap-3",children:[p?i.jsx("button",{onClick:()=>g(null),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":"Back to history",children:i.jsx(mo,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})}):i.jsx(os,{className:"w-5 h-5 text-blue-500"}),i.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:p?`Analysis #${p.id} Details`:"Analysis History"})]}),footer:p?i.jsx("div",{className:"flex justify-end",children:i.jsxs("button",{onClick:()=>{h(p),j()},className:"flex items-center px-4 py-2 action-primary rounded-md transition-colors shadow-sm",children:[i.jsx(vi,{className:"w-4 h-4 mr-2"}),"Load this Report"]})}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center w-full",children:"Select a previous analysis to view details."}),children:i.jsx("div",{className:"p-6",children:p?w?i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[i.jsx(be,{className:"w-12 h-12 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Loading analysis details..."})]}):i.jsx(wl,{selectedJob:p}):a.length===0?i.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[i.jsx(os,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),i.jsx("p",{children:"No history available for this dataset."})]}):i.jsx("div",{className:"space-y-3",children:a.map(S=>i.jsx(vl,{job:S,handleJobClick:I,cancelling:N,handleCancel:M},S.id))})})})};function vl({job:n,handleJobClick:l,cancelling:a,handleCancel:d}){return i.jsxs("div",{...wi(()=>l(n)),className:"flex items-center justify-between p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer transition-all group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(bl,{status:n.status}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 flex items-center gap-2",children:["Analysis #",n.id,i.jsx(yr,{status:n.status??"unknown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:n.created_at?new Date(n.created_at).toLocaleString():"β€”"}),n.target_col&&i.jsxs("div",{className:"text-xs text-gray-400 mt-1 flex items-center gap-1",children:[i.jsx(vi,{className:"w-3 h-3"})," Target: ",n.target_col,n.task_type&&i.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 rounded text-[10px]",children:n.task_type})]})]})]}),i.jsx("div",{className:"text-right flex items-center gap-4",children:(n.status==="PENDING"||n.status==="STARTED"||n.status==="RUNNING")&&i.jsx("button",{onClick:h=>d(h,n.id),disabled:a===n.id,className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full transition-colors",title:"Cancel Analysis",children:a===n.id?i.jsx(be,{className:"w-4 h-4 animate-spin"}):i.jsx(rr,{className:"w-4 h-4"})})})]})}function bl({status:n}){return i.jsx("div",{className:`p-2 rounded-full ${n==="COMPLETED"?"bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400":n==="FAILED"?"bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400":n==="CANCELLED"?"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400":"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:n==="COMPLETED"?i.jsx(ar,{className:"w-5 h-5"}):n==="FAILED"?i.jsx(bt,{className:"w-5 h-5"}):n==="CANCELLED"?i.jsx(rr,{className:"w-5 h-5"}):i.jsx(be,{className:"w-5 h-5 animate-spin"})})}function wl({selectedJob:n}){var l,a;return i.jsxs("div",{className:"space-y-8",children:[i.jsx(jl,{selectedJob:n}),((l=n.profile_data)==null?void 0:l.excluded_columns)&&n.profile_data.excluded_columns.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[i.jsx(qt,{className:"w-4 h-4 text-gray-500"}),"Excluded Columns (",n.profile_data.excluded_columns.length,")"]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:n.profile_data.excluded_columns.map(d=>i.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded text-sm line-through",children:d},d))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Variables Overview"}),i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm text-left",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Missing"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Distinct"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:((a=n.profile_data)==null?void 0:a.columns)&&Object.values(n.profile_data.columns).map(d=>{var u;const h=_l(d.dtype);return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("td",{className:"px-4 py-3 font-medium text-gray-900 dark:text-white",children:d.name}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:`w-4 h-4 ${xl(d.dtype)}`}),i.jsx("span",{children:d.dtype})]})}),i.jsx("td",{className:"px-4 py-3",children:d.missing_percentage>0?i.jsxs("span",{className:"text-amber-600",children:[d.missing_percentage.toFixed(1),"%"]}):i.jsx("span",{className:"text-green-600",children:"0%"})}),i.jsx("td",{className:"px-4 py-3 text-gray-500 dark:text-gray-400",children:((u=d.categorical_stats)==null?void 0:u.unique_count)||"-"})]},d.name)})})]})})]})]})}function jl({selectedJob:n}){var l,a,d,h,u,m;return i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(or,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Rows"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((a=(l=n.profile_data)==null?void 0:l.row_count)==null?void 0:a.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(fo,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Columns"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((h=(d=n.profile_data)==null?void 0:d.column_count)==null?void 0:h.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(lr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Missing Cells"})]}),i.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[(m=(u=n.profile_data)==null?void 0:u.missing_cells_percentage)==null?void 0:m.toFixed(1),"%"]})]})]})}function kl(n){const{selectionUnavailable:l,selectedDataset:a,analyzeMutation:d,analyzing:h,runAnalysis:u}=n;return i.jsxs(i.Fragment,{children:[l&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Dataset #",a," isn't available for analysis β€” it may still be processing or have no usable columns. Pick another dataset above to continue."]})]}),d.isError&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Could not start the analysis: ",d.error instanceof Error?d.error.message:"the request was rejected."," ","Your dataset, target, and filter choices were kept."]}),i.jsxs("button",{onClick:()=>{const m=d.variables;u(m==null?void 0:m.excluded,m==null?void 0:m.filters)},disabled:h,className:"flex items-center rounded-md border border-red-300 px-3 py-1.5 font-medium hover:bg-red-100 disabled:opacity-50 dark:border-red-800 dark:hover:bg-red-900/40",children:[i.jsx(Vt,{className:"mr-2 h-4 w-4"}),"Try again"]}),i.jsx("button",{onClick:()=>d.reset(),className:"rounded-md px-2 py-1.5 font-medium underline hover:no-underline",children:"Dismiss"})]})]})}function Nl(n){const{showHistoryModal:l,setShowHistoryModal:a,history:d,selectedDataset:h,queryClient:u}=n;return i.jsx(i.Fragment,{children:i.jsx(yl,{isOpen:l,onClose:()=>a(!1),history:d,datasetId:h??null,onRefresh:()=>u.invalidateQueries({queryKey:Ee.history(h??null)}),onFetchReport:async m=>{const p=await qe.getReport(m);return{...p,id:p.id??m}},onSelect:m=>{var g;h&&u.setQueryData(Ee.report(h),m);const p=Array.isArray((g=m.profile_data)==null?void 0:g.excluded_columns)?m.profile_data.excluded_columns:[];te.getState().setExcludedApplied(p),te.getState().setExcludedDraft(p)}})})}function Cl(n,l,a,d){return l?a&&!d?`${n===">"?"Greater than":n==="<"?"Less than":n===">="?"Greater than or equal to":"Less than or equal to"} needs a numeric value`:"":"Enter a filter value"}function Ll(n,l,a){const d=[">","<",">=","<="].includes(l),h=n.trim().length>0,u=l.trim().length>0,m=a.trim().length>0,p=Number.isFinite(Number(a)),g=Cl(l,m,d,p);return{hasFilterColumn:h,hasFilterOperator:u,hasFilterValue:m,isComparisonOperator:d,currentFilterValueError:g}}function Pl(n){const[l,a]=k.useState(!1),[d,h]=k.useState(""),[u,m]=k.useState("=="),[p,g]=k.useState(""),[w,y]=k.useState(!1),{hasFilterColumn:b,hasFilterOperator:x,hasFilterValue:N,isComparisonOperator:P,currentFilterValueError:j}=Ll(d,u,p);return{isAddingFilter:l,setIsAddingFilter:a,newFilterCol:d,setNewFilterCol:h,newFilterOp:u,setNewFilterOp:m,newFilterVal:p,setNewFilterVal:g,filterValidationAttempted:w,setFilterValidationAttempted:y,columnError:w&&!b?"Choose a filter column":"",operatorError:w&&!x?"Choose a filter operator":"",valueError:w&&j?j:"",handleAddFilterSubmit:()=>{y(!0),!(!b||!x||!N||j)&&(n(d,P?Number(p):Number.isNaN(Number(p))?p:Number(p),u),a(!1),y(!1),h(""),m("=="),g(""))}}}const Bn=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,Sl=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>Bn(a)===Bn(l[d]));function Tl({filtersDraft:n,filtersApplied:l,filtersDirty:a,columns:d,analyzing:h,onRemoveFilter:u,onResetFilters:m,onApplyFilters:p,showFilters:g,setShowFilters:w,form:y}){const b=a||!Sl(n,l);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between w-full mb-2",children:[i.jsxs("button",{onClick:()=>w(!g),className:"flex items-center text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Draft Filters (",n.length,")"]}),g?i.jsx(_s,{className:"w-3 h-3 ml-1"}):i.jsx(bi,{className:"w-3 h-3 ml-1"})]}),a&&i.jsx("span",{className:"text-[10px] font-medium rounded-full bg-amber-100 text-amber-800 px-2 py-0.5",children:"Pending"})]}),g&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Report uses ",l.length," applied filter",l.length===1?"":"s"," until you apply draft changes."]}),i.jsx(El,{filtersDraft:n,filtersDirty:a,analyzing:h,onRemoveFilter:u}),i.jsx(Ml,{form:y,columns:d}),i.jsx(Al,{disabled:!b||h,onResetFilters:m,onApplyFilters:p})]})]})}function El({filtersDraft:n,filtersDirty:l,analyzing:a,onRemoveFilter:d}){return i.jsx(i.Fragment,{children:n.length>0?n.map((h,u)=>i.jsxs("div",{className:`flex items-center justify-between rounded px-2 py-1 text-xs border ${l?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700"}`,children:[i.jsxs("div",{className:"truncate max-w-[140px]",children:[i.jsx("span",{className:"font-medium text-blue-700 dark:text-blue-300",children:h.column}),i.jsx("span",{className:"mx-1 text-gray-500 dark:text-gray-400",children:h.operator}),i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:String(h.value)})]}),i.jsx("button",{onClick:()=>d(u),className:"text-gray-500 dark:text-gray-400 hover:text-red-500","aria-label":`Remove filter ${u+1}`,disabled:a,children:i.jsx(dr,{className:"w-3 h-3"})})]},u)):i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No draft filters yet."})})}function Ml({form:n,columns:l}){const{isAddingFilter:a,setIsAddingFilter:d,newFilterCol:h,setNewFilterCol:u,newFilterOp:m,setNewFilterOp:p,newFilterVal:g,setNewFilterVal:w,filterValidationAttempted:y,setFilterValidationAttempted:b,columnError:x,operatorError:N,valueError:P,handleAddFilterSubmit:j}=n;return i.jsx(i.Fragment,{children:a?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsx(rs,{label:"Filter column",hideLabel:!0,required:!0,...y?{error:x}:{},children:M=>i.jsxs("select",{...M,value:h,onChange:I=>u(I.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"",disabled:!0,children:"Column"}),l.map(I=>i.jsx("option",{value:I,children:I},I))]})}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(rs,{label:"Filter operator",hideLabel:!0,required:!0,className:"w-1/3",...y?{error:N}:{},children:M=>i.jsxs("select",{...M,value:m,onChange:I=>p(I.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"==",children:"=="}),i.jsx("option",{value:"!=",children:"!="}),i.jsx("option",{value:">",children:">"}),i.jsx("option",{value:"<",children:"<"}),i.jsx("option",{value:">=",children:">="}),i.jsx("option",{value:"<=",children:"<="})]})}),i.jsx(rs,{label:"Filter value",hideLabel:!0,required:!0,className:"w-2/3",...y?{error:P}:{},children:M=>i.jsx("input",{...M,type:"text",value:g,onChange:I=>w(I.target.value),placeholder:"Value",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onKeyDown:I=>I.key==="Enter"&&j()})})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{onClick:()=>{d(!1),b(!1),u(""),p("=="),w("")},className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Cancel"}),i.jsx("button",{onClick:j,className:"text-xs bg-blue-600 text-white px-2 py-1 rounded hover:bg-blue-700",children:"Save draft"})]})]}):i.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-blue-600 hover:border-blue-300 transition-colors",children:[i.jsx(ys,{className:"w-3 h-3 mr-1"})," Add Filter"]})})}function Al({disabled:n,onResetFilters:l,onApplyFilters:a}){return i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.jsx("button",{onClick:l,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-white dark:bg-gray-900 text-gray-600 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:"Reset filters"}),i.jsx("button",{onClick:a,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-blue-600 text-white border-blue-700 hover:bg-blue-700"}`,children:"Apply filters"})]})}function zl({columns:n,excludedCols:l,excludedDirty:a,analyzing:d,onToggleExclude:h,onApplyExcluded:u,showExclusions:m,setShowExclusions:p,isAddingExclusion:g,setIsAddingExclusion:w}){return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>p(!m),className:"flex items-center justify-between w-full text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Excluded (",l.length,")"]}),m?i.jsx(_s,{className:"w-3 h-3"}):i.jsx(bi,{className:"w-3 h-3"})]}),m&&i.jsxs("div",{className:"space-y-2",children:[l.map((y,b)=>i.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-xs",children:[i.jsx("span",{className:"font-medium text-gray-500 dark:text-gray-400 line-through truncate max-w-[140px]",children:y}),i.jsx("button",{onClick:()=>h(y,!1),className:"text-gray-500 dark:text-gray-400 hover:text-green-500",title:"Include back",children:i.jsx(ys,{className:"w-3 h-3"})})]},b)),i.jsx(Ol,{onApplyExcluded:u,excludedDirty:a,analyzing:d}),g?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsxs("select",{"aria-label":"Column to exclude from analysis",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onChange:y=>{y.target.value&&(h(y.target.value,!0),w(!1))},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"Select Column"}),n.filter(y=>!l.includes(y)).map(y=>i.jsx("option",{value:y,children:y},y))]}),i.jsx("button",{onClick:()=>w(!1),className:"w-full text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-center",children:"Cancel"})]}):i.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-red-600 hover:border-red-300 transition-colors",children:[i.jsx(qt,{className:"w-3 h-3 mr-1"})," Exclude Column"]})]})]})}function Ol({onApplyExcluded:n,excludedDirty:l,analyzing:a}){return i.jsx("button",{onClick:n,disabled:!l||a,className:`w-full flex items-center justify-center px-2 py-1 text-xs rounded border transition-colors ${l&&!a?"bg-blue-600 text-white border-blue-700 hover:bg-blue-700":"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed"}`,title:l?"Apply excluded columns to re-run analysis":"No pending exclusion changes",children:"Apply changes"})}function Dl(n){return[{title:"Overview",items:[{id:"dashboard",label:"Dashboard",icon:xo,show:!0},{id:"pii",label:"PII Review",icon:cr,show:!0},{id:"sample",label:"Sample Data",icon:hr,show:!!n.sample_data},{id:"insights",label:"Smart Insights",icon:ur,show:!0}]},{title:"Univariate Analysis",items:[{id:"variables",label:"Variables",icon:yt,show:!0},{id:"outliers",label:"Outliers",icon:xi,show:!!n.outliers},{id:"target",label:"Target Analysis",icon:sr,show:!!(n.target_col&&n.target_correlations)}]},{title:"Multivariate Analysis",items:[{id:"correlations",label:"Correlations",icon:_o,show:!!(n.correlations||n.correlations_with_target||n.causal_target_exclusion_reason)},{id:"bivariate",label:"Bivariate",icon:Bt,show:!0},{id:"pca",label:"PCA & Clusters",icon:wt,show:!!n.pca_data||!!n.clustering}]},{title:"Structure & Causal",items:[{id:"causal",label:"Causal Graph",icon:wt,show:!!(n.causal_graph||n.causal_target_exclusion_reason)},{id:"rules",label:"Decision Tree",icon:ls,show:!!n.rule_tree},{id:"decomposition",label:"Decomposition",icon:yo,show:!0}]},{title:"Specialized",items:[{id:"timeseries",label:"Time Series",icon:xs,show:!!n.timeseries},{id:"geospatial",label:"Geospatial",icon:ds,show:!!n.geospatial}]}]}function Il({activeTab:n,setActiveTab:l,profile:a,isCollapsed:d,setIsCollapsed:h}){const u=Dl(a);return i.jsxs("div",{className:`flex-1 overflow-y-auto ${d?"p-2":"p-3"}`,children:[i.jsxs("div",{className:`flex items-center ${d?"justify-center":"justify-between"} mb-3`,children:[!d&&i.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Analysis Modules"}),i.jsx("button",{onClick:()=>h(!d),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400",title:d?"Expand Sidebar":"Collapse Sidebar",children:d?i.jsx(go,{className:"w-4 h-4"}):i.jsx(po,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"space-y-6",children:u.map((m,p)=>{const g=m.items.filter(w=>w.show);return g.length===0?null:i.jsxs("div",{children:[!d&&i.jsx("h3",{className:"px-2 text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:m.title}),i.jsx("div",{className:"space-y-1",children:g.map(w=>i.jsx(Rl,{item:w,activeTab:n,setActiveTab:l,isCollapsed:d},w.id))})]},p)})})]})}function Rl({item:n,activeTab:l,setActiveTab:a,isCollapsed:d}){const h=l===n.id?{button:"bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",icon:"text-blue-500",current:"page"}:{button:"text-gray-600 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-700",icon:"text-gray-400",current:void 0};return i.jsxs("button",{onClick:()=>a(n.id),"aria-label":n.label,"aria-current":h.current,title:d?n.label:void 0,className:`w-full flex items-center ${d?"justify-center py-2":"px-2 py-2"} text-sm font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 ${h.button}`,children:[i.jsx(n.icon,{className:`${d?"h-5 w-5":"mr-3 h-4 w-4"} ${h.icon}`}),!d&&i.jsxs(i.Fragment,{children:[n.label,l===n.id&&i.jsx(mr,{className:"ml-auto h-4 w-4 text-blue-400"})]})]})}const Fl=n=>{const[l,a]=k.useState(!0),[d,h]=k.useState(!1),[u,m]=k.useState(!1),p=Pl(n.onAddFilter),[g,w]=k.useState(!1);return i.jsxs("div",{className:`${u?"w-14":"w-60"} bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 flex-shrink-0 h-full overflow-y-auto flex flex-col transition-all duration-300`,children:[!u&&n.activeTab!=="pii"&&i.jsxs("div",{className:"p-3 border-b border-gray-200 dark:border-gray-700 space-y-3 bg-gray-50/50 dark:bg-gray-900/20",children:[i.jsx(Tl,{...n,showFilters:l,setShowFilters:a,form:p}),i.jsx(zl,{...n,showExclusions:d,setShowExclusions:h,isAddingExclusion:g,setIsAddingExclusion:w})]}),i.jsx(Il,{activeTab:n.activeTab,setActiveTab:n.setActiveTab,profile:n.profile,isCollapsed:u,setIsCollapsed:m})]})},Bl=({profile:n})=>{if(!n)return null;const l=n.missing_cells_percentage??0,a=n.duplicate_rows??0;return i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Rows"}),i.jsx("div",{className:"text-2xl font-bold",children:(n.row_count??0).toLocaleString()})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Columns"}),i.jsx("div",{className:"text-2xl font-bold",children:n.column_count})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Missing Cells"}),i.jsxs("div",{className:"text-2xl font-bold",children:[l.toFixed(1),"%"]})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Duplicates"}),i.jsx("div",{className:"text-2xl font-bold",children:a})]}),n.vif&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"High VIF Features"}),i.jsx("div",{className:"text-2xl font-bold text-amber-600",children:Object.values(n.vif).filter(d=>d>5).length})]})]})},Zl=({alerts:n})=>{const[l,a]=k.useState(!0);return!n||n.length===0?null:i.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex justify-between items-center cursor-pointer",...wi(()=>a(!l)),children:[i.jsxs("h3",{className:"font-medium text-amber-800 dark:text-amber-200 flex items-center",children:[i.jsx(bt,{className:"w-4 h-4 mr-2"}),"Data Quality Alerts (",n.length,")"]}),l?i.jsx(_s,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"}):i.jsx(bi,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"})]}),l&&i.jsx("div",{className:"max-h-40 overflow-y-auto pr-2 mt-2 animate-in slide-in-from-top-2 duration-200",children:i.jsx("ul",{className:"space-y-1",children:n.map((d,h)=>i.jsxs("li",{className:"text-sm text-amber-700 dark:text-amber-300 flex items-start",children:[i.jsx("span",{className:"mr-2",children:"β€’"}),i.jsxs("span",{children:[d.column&&i.jsxs("span",{className:"font-semibold",children:[d.column,": "]}),d.message]})]},h))})})]})},$l=({profile:n,onToggleExclude:l,excludedCols:a=[]})=>{const d=at(),h=k.useMemo(()=>{if(!(n!=null&&n.columns))return[];const m={};return Object.values(n.columns).forEach(p=>{m[String(p.dtype)]=(m[String(p.dtype)]||0)+1}),Object.entries(m).map(([p,g])=>({name:p,value:g}))},[n]),u=k.useMemo(()=>n!=null&&n.columns?Object.values(n.columns).filter(m=>m.missing_percentage>0).sort((m,p)=>p.missing_percentage-m.missing_percentage).slice(0,20).map(m=>({name:m.name,value:m.missing_percentage})):[],[n]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx(Bl,{profile:n}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(or,{className:"w-5 h-5 mr-2 text-blue-500"}),"Column Types"]}),i.jsx("div",{className:"h-64",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(Oo,{children:[i.jsx(Do,{data:h,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,fill:"#8884d8",paddingAngle:5,dataKey:"value",children:h.map((m,p)=>i.jsx(bs,{fill:We[p%We.length]},`cell-${p}`))}),i.jsx(He,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),i.jsx(wr,{verticalAlign:"bottom",height:36})]})})})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(xi,{className:"w-5 h-5 mr-2 text-amber-500"}),"Top Missing Values"]}),u.length>0?i.jsx("div",{className:"h-64 overflow-y-auto pr-2 space-y-3",children:u.map((m,p)=>{const g=a.includes(m.name);return i.jsxs("div",{className:"flex items-center gap-3 text-sm group",children:[i.jsx("div",{className:"w-32 truncate text-gray-600 dark:text-gray-300 font-medium",title:m.name,children:m.name}),i.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m.value}%`,backgroundColor:`hsl(10, 80%, ${60-p*2}%)`}})}),i.jsxs("div",{className:"w-12 text-right text-gray-500 text-xs",children:[m.value.toFixed(1),"%"]}),l&&i.jsx("button",{onClick:()=>l(m.name,!g),className:`p-1.5 rounded-md transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 ${g?"bg-red-100 text-red-600 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 opacity-100":"text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Include Column":"Exclude Column","aria-label":g?"Include Column":"Exclude Column",children:g?i.jsx(qt,{className:"w-4 h-4"}):i.jsx(fr,{className:"w-4 h-4"})})]},p)})}):i.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400",children:[i.jsx(lr,{className:"w-12 h-12 mb-2 opacity-20"}),i.jsx("p",{children:"No missing values found!"})]})]})]}),i.jsx(Zl,{alerts:n.alerts??[]})]})},Hl=({profile:n})=>{const l=Array.isArray(n.recommendations)?n.recommendations:[];return i.jsx("div",{className:"mt-4 space-y-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(ur,{className:"w-5 h-5 mr-2 text-yellow-500"}),"Smart Recommendations"]}),l.length>0?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.map((a,d)=>i.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/10 rounded-lg border border-blue-100 dark:border-blue-800",children:[i.jsxs("div",{className:"flex justify-between items-start mb-2",children:[i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-800 px-2 py-1 rounded border border-blue-100 dark:border-blue-800",children:a.action}),a.column&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:a.column})]}),i.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm mb-1",children:a.reason}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.suggestion})]},d))}):i.jsx("p",{className:"text-gray-500 dark:text-gray-400 italic",children:"No specific recommendations found. Your data looks clean!"})]})})};function Wl({alerts:n=[]}){const l=n.filter(d=>d.type==="PII"),a=new Set(l.map(d=>d.column).filter(Boolean)).size;return i.jsxs("section",{id:"eda-pii-review","aria-labelledby":"eda-pii-heading",className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"eda-pii-heading",className:"flex items-center gap-2 text-xl font-semibold text-gray-900 dark:text-white",children:[i.jsx(cr,{"aria-hidden":"true",className:"h-5 w-5 text-blue-600 dark:text-blue-400"}),"PII review"]}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Review columns that may contain personally identifiable information (PII). Values and samples are not shown here."})]}),i.jsxs("div",{className:"flex gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:[i.jsx(jt,{"aria-hidden":"true",className:"mt-0.5 h-5 w-5 shrink-0 text-blue-700 dark:text-blue-300"}),i.jsxs("div",{className:"space-y-1 text-sm text-blue-900 dark:text-blue-100",children:[i.jsx("p",{className:"font-semibold",children:"Advisory heuristics only"}),i.jsx("p",{children:"Matches can be false positives, and detection can miss personal information. Findings do not classify data as legally sensitive or determine compliance. This review does not mask, delete, or block data."})]})]}),l.length===0?i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800",children:[i.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"No PII findings recorded"}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"This profile contains no PII alerts. That does not guarantee the dataset is free of personal information."})]}):i.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white",children:[l.length," finding",l.length===1?"":"s"," across ",a," flagged column",a===1?"":"s"]}),i.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300",children:"The detector checks email and phone patterns together; it does not report which pattern matched. Findings describe the saved profile, including columns with pending exclusions."})]}),i.jsx("div",{role:"region","aria-label":"PII findings table",tabIndex:0,className:"overflow-x-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500",children:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("caption",{className:"sr-only",children:"Possible PII findings from this profile"}),i.jsx("thead",{className:"bg-gray-50 text-gray-600 dark:bg-gray-900/50 dark:text-gray-300",children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Column"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Detector category"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Severity"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Explanation"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:l.map((d,h)=>{const u=d.severity==="error"?"Error":d.severity==="warning"?"Warning":d.severity==="info"?"Info":"Unspecified",m=u==="Error"?"bg-red-50 text-red-800 dark:bg-red-900/30 dark:text-red-200":u==="Warning"?"bg-amber-50 text-amber-800 dark:bg-amber-900/30 dark:text-amber-200":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200";return i.jsxs("tr",{className:"align-top",children:[i.jsx("th",{scope:"row",className:"max-w-64 break-words px-4 py-4 font-medium text-gray-900 dark:text-white",children:d.column||"Column not specified"}),i.jsx("td",{className:"whitespace-nowrap px-4 py-4 text-gray-700 dark:text-gray-200",children:"Email / phone"}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${m}`,children:u})}),i.jsx("td",{className:"px-4 py-4 text-gray-600 dark:text-gray-300",children:"Values may match an email address or phone number pattern. Review whether this column is appropriate for your intended use."})]},h)})})]})})]})]})}var Vl=Uo();const Nr=gr(Vl);var ql=Go();const Ul=gr(ql),Gl=Ul(Nr),Zn=["circle","square","diamond","cross","x"],Kl={circle:"circle",square:"rect",diamond:"rectRot",cross:"cross",x:"crossRot"},Yl={circle:"circle",square:"square",diamond:"diamond",cross:"cross",x:"x"},$n=n=>Zn[n%Zn.length],Xl=n=>Kl[n],Ql=n=>Yl[n],Jl=(n,l)=>{const a=n.localeCompare(l,"en");return a!==0||n===l?a:n{let l="Unlabeled",a=1;for(;n.has(l);)l=a===1?"Unlabeled (missing)":`Unlabeled (missing) ${a}`,a+=1;return l},Gt=(n,l)=>{if(!l)return[{value:null,label:"Data Points",points:n,color:We[0],shape:$n(0)}];const a=new Map;n.forEach(m=>{const p=m[l],g=p==null?null:String(p),w=a.get(g)??[];w.push(m),a.set(g,w)});const d=[...a.keys()].filter(m=>m!==null).sort(Jl),h=d.map((m,p)=>({value:m,label:m,points:a.get(m),color:We[p%We.length],shape:$n(p)})),u=a.get(null);return u&&h.push({value:null,label:ed(new Set(d)),points:u,color:"#6b7280",shape:"cross"}),h},Cr=n=>n.map(({label:l,color:a,shape:d})=>({label:l,color:a,shape:d})),Lr=({data:n,xKey:l,yKey:a,zKey:d,labelKey:h,xLabel:u,yLabel:m,zLabel:p,height:g=600})=>{const w=k.useMemo(()=>Gt(n,h).map(({label:x,points:N,color:P,shape:j})=>{const M=Ql(j);return{x:N.map(I=>I[l]),y:N.map(I=>I[a]),z:N.map(I=>I[d]),mode:"markers",type:"scatter3d",name:x,marker:{size:3,opacity:.8,color:P,symbol:M},hovertemplate:`${x}
${u||l}: %{x}
${m||a}: %{y}
${p||d}: %{z}`}}),[n,l,a,d,h,u,m,p]),y=at();return n.length===0?i.jsx("div",{className:"text-gray-500 text-sm italic p-4 text-center",children:"No data points to display"}):i.jsx("div",{style:{height:g,width:"100%"},children:i.jsx(Gl,{data:w,layout:{autosize:!0,height:g,margin:{l:0,r:0,b:0,t:0},paper_bgcolor:y.bgColor,plot_bgcolor:y.bgColor,font:{color:y.textColor},scene:{xaxis:{title:{text:u||l},color:y.axisColor,gridcolor:y.gridColor},yaxis:{title:{text:m||a},color:y.axisColor,gridcolor:y.gridColor},zaxis:{title:{text:p||d},color:y.axisColor,gridcolor:y.gridColor}},showlegend:!1},useResizeHandler:!0,style:{width:"100%",height:"100%"},config:{displayModeBar:!0}})})};Ro.register(Fo,Bo,Zo,$o,Ho);const Pr=({data:n,xKey:l,yKey:a,labelKey:d,xLabel:h,yLabel:u,height:m=500})=>{const p=k.useMemo(()=>Gt(n,d).map(({label:b,points:x,color:N,shape:P})=>({label:b,data:x.map(j=>({x:Number(j[l]),y:Number(j[a]),raw:j})),backgroundColor:N,borderColor:N,pointStyle:Xl(P),pointRadius:3,pointHoverRadius:5})),[n,l,a,d]),g=at(),w={responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!h,text:h,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}},y:{title:{display:!!u,text:u,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}}},plugins:{tooltip:{callbacks:{label:y=>{const b=y.raw;let x=y.dataset.label||"";return x&&(x+=": "),x+=`(${b.x}, ${b.y})`,x}}},legend:{display:!1}}};return i.jsx("div",{style:{height:m,width:"100%"},children:i.jsx(Io,{options:w,data:{datasets:p}})})},td=({shape:n,color:l})=>{const a={width:12,height:12,"aria-hidden":!0};switch(n){case"square":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("rect",{x:"1",y:"1",width:"10",height:"10",fill:l})});case"diamond":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("polygon",{points:"6,0 12,6 6,12 0,6",fill:l})});case"cross":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M6 1 L6 11 M1 6 L11 6",stroke:l,strokeWidth:2})});case"x":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M2 2 L10 10 M10 2 L2 10",stroke:l,strokeWidth:2})});case"circle":default:return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("circle",{cx:"6",cy:"6",r:"5",fill:l})})}},js=({entries:n,filterThreshold:l=12})=>{const[a,d]=k.useState(""),h=k.useMemo(()=>{if(!a.trim())return n;const m=a.trim().toLowerCase();return n.filter(p=>p.label.toLowerCase().includes(m))},[n,a]);if(n.length===0)return null;const u=n.length>l;return i.jsxs("div",{className:"mt-3 border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[u&&i.jsx("input",{type:"search",value:a,onChange:m=>d(m.target.value),placeholder:`Filter ${n.length} legend groups…`,"aria-label":"Filter legend groups",className:"mb-2 w-full text-xs rounded border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white px-2 py-1"}),i.jsxs("ul",{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-gray-700 dark:text-gray-300 ${u?"max-h-32 overflow-y-auto":""}`,children:[h.map(m=>i.jsxs("li",{className:"flex items-center gap-1.5",children:[i.jsx(td,{shape:m.shape,color:m.color}),i.jsx("span",{className:"truncate max-w-[10rem]",title:m.label,children:m.label})]},m.label)),h.length===0&&i.jsxs("li",{className:"italic text-gray-500 dark:text-gray-400",children:["No groups match β€œ",a,"”."]})]})]})},id=({profile:n,downloadChart:l})=>{const a=n.clustering;return a?i.jsxs("div",{className:"mt-4 space-y-6",id:"clustering-chart",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-rose-500"}),"Post-Hoc Clustering (Segmentation)",i.jsx(_e,{text:"Automatically groups data points into distinct clusters (segments) based on similarity. Useful for finding natural groups like 'High Spenders' or 'At Risk' users."})]}),i.jsx("button",{onClick:()=>l("clustering-chart","clustering-analysis","Clustering Segmentation",`${a.n_clusters} Clusters Found`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:i.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:i.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"Algorithm Summary"}),i.jsxs("div",{className:"space-y-1 text-sm text-purple-700 dark:text-purple-300",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Method:"}),i.jsx("span",{className:"font-medium",children:a.method})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Metric (Inertia):"}),i.jsx("span",{className:"font-medium",children:a.inertia.toFixed(1)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Clusters:"}),i.jsx("span",{className:"font-medium",children:a.n_clusters})]})]})]})}),i.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mt-4",children:"Cluster Profiles (Centroids)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:a.clusters.map(d=>i.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[i.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:sd(d.cluster_id)}}),"Cluster ",d.cluster_id]}),i.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[d.percentage.toFixed(1),"% (",d.size,")"]})]}),i.jsxs("div",{className:"space-y-1",children:[Object.entries(d.center).sort(([,h],[,u])=>Math.abs(u)-Math.abs(h)).slice(0,5).map(([h,u])=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:h,children:h}),i.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:u.toFixed(2)})]},h)),Object.keys(d.center).length>5&&i.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(d.center).length-5," more features"]})]})]},d.cluster_id))})]})})]}),i.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 rounded-lg text-sm border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),i.jsx("div",{children:"These clusters are found using unsupervised learning (K-Means) on numeric features. The plot shows a 2D projection (PCA) of the clusters. Use this to identify distinct groups of data points that behave similarly."})]})]}):i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm flex flex-col items-center justify-center text-gray-500 min-h-[300px]",children:[i.jsx(wt,{className:"w-12 h-12 mb-4 opacity-20"}),i.jsx("p",{children:"Clustering analysis not available."}),i.jsx("p",{className:"text-sm mt-2",children:"Requires at least 2 numeric columns."})]})},sd=n=>We[n%We.length];function nd({components:n,isPCA3D:l}){return i.jsx(i.Fragment,{children:n&&n.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Principal Component Composition"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,l?3:2).map(a=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex justify-between items-center border-b border-gray-200 dark:border-gray-700 pb-2 mb-2",children:[i.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-200",children:a.component}),i.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 px-2 py-0.5 rounded-full",children:[(a.explained_variance_ratio*100).toFixed(1),"% Var"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:"Top Loadings"}),Object.entries(a.top_features||{}).map(([d,h],u)=>i.jsxs("div",{className:"flex justify-between text-xs items-center group",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400 truncate mr-2 flex-1",title:d,children:d}),i.jsxs("span",{className:`font-mono text-[10px] ${Number(h)>0?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400"}`,children:[Number(h)>0?"+":"",Number(h).toFixed(3)]})]},u))]})]},a.component))})]})})}const rd=({profile:n,isPCA3D:l,setIsPCA3D:a,downloadChart:d})=>{const h=Array.isArray(n.pca_data)&&n.pca_data.length>0,u=h?"Download Chart":"Not enough numeric data for PCA",m=k.useMemo(()=>n.pca_data??[],[n.pca_data]),p=k.useMemo(()=>Cr(Gt(m,"label")),[m]),g=k.useMemo(()=>{const w=[{key:"x",label:"PC1"},{key:"y",label:"PC2"}];return l&&w.push({key:"z",label:"PC3"}),w.push({key:"label",label:"Group"}),w},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Bt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Multivariate Structure (PCA)",i.jsx(_e,{text:"Reduces data to 2D or 3D. Points closer together are similar. Colors show clusters or target values."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{disabled:!h,onClick:()=>d("pca-chart","pca-analysis","Multivariate Structure (PCA)",l?"3D Projection":"2D Projection"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:u,"aria-label":u,children:i.jsx(ke,{className:"w-4 h-4"})}),i.jsxs("button",{onClick:()=>a(!l),className:`p-2 rounded-md border transition-colors flex items-center gap-2 text-sm ${l?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,children:[i.jsx(pr,{className:"w-4 h-4"}),l?"Switch to 2D":"Switch to 3D"]})]})]}),i.jsx("div",{id:"pca-chart",children:n.pca_data?l?i.jsx(Lr,{data:n.pca_data,xKey:"x",yKey:"y",zKey:"z",labelKey:"label",xLabel:"PC1",yLabel:"PC2",zLabel:"PC3"}):i.jsx(Pr,{data:n.pca_data,xKey:"x",yKey:"y",labelKey:"label",xLabel:"Principal Component 1 (PC1)",yLabel:"Principal Component 2 (PC2)"}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm text-center p-4",children:"Not enough numeric data for PCA."})}),p.length>0&&i.jsx(js,{entries:p}),i.jsx(ji,{caption:"PCA projection data",filename:"pca-analysis",columns:g,rows:m}),i.jsxs("div",{className:"mt-6 flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:"About this visualization"}),i.jsxs("p",{children:["This chart shows a ",l?"3D":"2D"," projection of your data using Principal Component Analysis (PCA). Points that are close together share similar characteristics across all numeric features."]}),i.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["* For performance, this visualization uses a random sample of up to ",i.jsx("strong",{children:"5,000 points"}),"."]})]})]}),i.jsx(nd,{components:n.pca_components,isPCA3D:l})]}),i.jsx(id,{profile:n,downloadChart:d})]})};function Sr(n,l){const a=k.useRef(l);k.useEffect(function(){l!==a.current&&n.attributionControl!=null&&(a.current!=null&&n.attributionControl.removeAttribution(a.current),l!=null&&n.attributionControl.addAttribution(l)),a.current=l},[n,l])}function ad(n,l,a){l.center!==a.center&&n.setLatLng(l.center),l.radius!=null&&l.radius!==a.radius&&n.setRadius(l.radius)}const od=1;function ld(n){return Object.freeze({__version:od,map:n})}function dd(n,l){return Object.freeze({...n,...l})}const Tr=k.createContext(null),Er=Tr.Provider;function ks(){const n=k.useContext(Tr);if(n==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return n}function cd(n){function l(a,d){const{instance:h,context:u}=n(a).current;return k.useImperativeHandle(d,()=>h),a.children==null?null:Zt.createElement(Er,{value:u},a.children)}return k.forwardRef(l)}function hd(n){function l(a,d){const[h,u]=k.useState(!1),{instance:m}=n(a,u).current;k.useImperativeHandle(d,()=>m),k.useEffect(function(){h&&m.update()},[m,h,a.children]);const p=m._contentNode;return p?Wo.createPortal(a.children,p):null}return k.forwardRef(l)}function ud(n){function l(a,d){const{instance:h}=n(a).current;return k.useImperativeHandle(d,()=>h),null}return k.forwardRef(l)}function Ns(n,l){const a=k.useRef();k.useEffect(function(){return l!=null&&n.instance.on(l),a.current=l,function(){a.current!=null&&n.instance.off(a.current),a.current=null}},[n,l])}function ki(n,l){const a=n.pane??l.pane;return a?{...n,pane:a}:n}function md(n,l){return function(d,h){const u=ks(),m=n(ki(d,u),u);return Sr(u.map,d.attribution),Ns(m.current,d.eventHandlers),l(m.current,u,d,h),m}}var Ft={exports:{}};/* @preserve - * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com - * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */var fd=Ft.exports,Hn;function gd(){return Hn||(Hn=1,(function(n,l){(function(a,d){d(l)})(fd,(function(a){var d="1.9.4";function h(e){var t,s,r,o;for(s=1,r=arguments.length;s"u"||!L||!L.Mixin)){e=K(e)?e:[e];for(var t=0;t0?Math.floor(e):Math.ceil(e)};O.prototype={clone:function(){return new O(this.x,this.y)},add:function(e){return this.clone()._add(D(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(D(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new O(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new O(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=de(this.x),this.y=de(this.y),this},distanceTo:function(e){e=D(e);var t=e.x-this.x,s=e.y-this.y;return Math.sqrt(t*t+s*s)},equals:function(e){return e=D(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=D(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+x(this.x)+", "+x(this.y)+")"}};function D(e,t,s){return e instanceof O?e:K(e)?new O(e[0],e[1]):e==null?e:typeof e=="object"&&"x"in e&&"y"in e?new O(e.x,e.y):new O(e,t,s)}function q(e,t){if(e)for(var s=t?[e,t]:e,r=0,o=s.length;r=this.min.x&&s.x<=this.max.x&&t.y>=this.min.y&&s.y<=this.max.y},intersects:function(e){e=Q(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>=t.x&&r.x<=s.x,f=o.y>=t.y&&r.y<=s.y;return c&&f},overlaps:function(e){e=Q(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>t.x&&r.xt.y&&r.y=t.lat&&o.lat<=s.lat&&r.lng>=t.lng&&o.lng<=s.lng},intersects:function(e){e=ce(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>=t.lat&&r.lat<=s.lat,f=o.lng>=t.lng&&r.lng<=s.lng;return c&&f},overlaps:function(e){e=ce(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>t.lat&&r.latt.lng&&r.lng1,Kr=(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",b,t),window.removeEventListener("testPassiveEventSupport",b,t)}catch{}return e})(),Yr=(function(){return!!document.createElement("canvas").getContext})(),Ti=!!(document.createElementNS&&Re("svg").createSVGRect),Xr=!!Ti&&(function(){var e=document.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Qr=!Ti&&(function(){try{var e=document.createElement("div");e.innerHTML='';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&typeof t.adj=="object"}catch{return!1}})(),Jr=navigator.platform.indexOf("Mac")===0,ea=navigator.platform.indexOf("Linux")===0;function Ae(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var R={ie:Xt,ielt9:Ir,edge:Ps,webkit:Li,android:Ss,android23:Ts,androidStock:Fr,opera:Pi,chrome:Es,gecko:Ms,safari:Br,phantom:As,opera12:zs,win:Zr,ie3d:Os,webkit3d:Si,gecko3d:Ds,any3d:$r,mobile:Ct,mobileWebkit:Hr,mobileWebkit3d:Wr,msPointer:Is,pointer:Rs,touch:Vr,touchNative:Fs,mobileOpera:qr,mobileGecko:Ur,retina:Gr,passiveEvents:Kr,canvas:Yr,svg:Ti,vml:Qr,inlineSvg:Xr,mac:Jr,linux:ea},Bs=R.msPointer?"MSPointerDown":"pointerdown",Zs=R.msPointer?"MSPointerMove":"pointermove",$s=R.msPointer?"MSPointerUp":"pointerup",Hs=R.msPointer?"MSPointerCancel":"pointercancel",Ei={touchstart:Bs,touchmove:Zs,touchend:$s,touchcancel:Hs},Ws={touchstart:aa,touchmove:Qt,touchend:Qt,touchcancel:Qt},ot={},Vs=!1;function ta(e,t,s){return t==="touchstart"&&ra(),Ws[t]?(s=Ws[t].bind(this,s),e.addEventListener(Ei[t],s,!1),s):(console.warn("wrong event specified:",t),b)}function ia(e,t,s){if(!Ei[t]){console.warn("wrong event specified:",t);return}e.removeEventListener(Ei[t],s,!1)}function sa(e){ot[e.pointerId]=e}function na(e){ot[e.pointerId]&&(ot[e.pointerId]=e)}function qs(e){delete ot[e.pointerId]}function ra(){Vs||(document.addEventListener(Bs,sa,!0),document.addEventListener(Zs,na,!0),document.addEventListener($s,qs,!0),document.addEventListener(Hs,qs,!0),Vs=!0)}function Qt(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){t.touches=[];for(var s in ot)t.touches.push(ot[s]);t.changedTouches=[t],e(t)}}function aa(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&xe(t),Qt(e,t)}function oa(e){var t={},s,r;for(r in e)s=e[r],t[r]=s&&s.bind?s.bind(e):s;return e=t,t.type="dblclick",t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var la=200;function da(e,t){e.addEventListener("dblclick",t);var s=0,r;function o(c){if(c.detail!==1){r=c.detail;return}if(!(c.pointerType==="mouse"||c.sourceCapabilities&&!c.sourceCapabilities.firesTouchEvents)){var f=Xs(c);if(!(f.some(function(v){return v instanceof HTMLLabelElement&&v.attributes.for})&&!f.some(function(v){return v instanceof HTMLInputElement||v instanceof HTMLSelectElement}))){var _=Date.now();_-s<=la?(r++,r===2&&t(oa(c))):r=1,s=_}}}return e.addEventListener("click",o),{dblclick:t,simDblclick:o}}function ca(e,t){e.removeEventListener("dblclick",t.dblclick),e.removeEventListener("click",t.simDblclick)}var Mi=ti(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Lt=ti(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Us=Lt==="webkitTransition"||Lt==="OTransition"?Lt+"End":"transitionend";function Gs(e){return typeof e=="string"?document.getElementById(e):e}function Pt(e,t){var s=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!s||s==="auto")&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);s=r?r[t]:null}return s==="auto"?null:s}function X(e,t,s){var r=document.createElement(e);return r.className=t||"",s&&s.appendChild(r),r}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function Jt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function lt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function dt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function Ai(e,t){if(e.classList!==void 0)return e.classList.contains(t);var s=ei(e);return s.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(s)}function H(e,t){if(e.classList!==void 0)for(var s=P(t),r=0,o=s.length;r0?2*window.devicePixelRatio:1;function Js(e){return R.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/ma:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function Vi(e,t){var s=t.relatedTarget;if(!s)return!0;try{for(;s&&s!==e;)s=s.parentNode}catch{return!1}return s!==e}var fa={__proto__:null,on:$,off:ne,stopPropagation:tt,disableScrollPropagation:Wi,disableClickPropagation:Mt,preventDefault:xe,stop:it,getPropagationPath:Xs,getMousePosition:Qs,getWheelDelta:Js,isExternalTarget:Vi,addListener:$,removeListener:ne},en=ge.extend({run:function(e,t,s,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=s||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=et(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,s=this._duration*1e3;tthis.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var s=this.getCenter(),r=this._limitCenter(s,this._zoom,ce(e));return s.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t=t||{};var s=D(t.paddingTopLeft||t.padding||[0,0]),r=D(t.paddingBottomRight||t.padding||[0,0]),o=this.project(this.getCenter()),c=this.project(e),f=this.getPixelBounds(),_=Q([f.min.add(s),f.max.subtract(r)]),v=_.getSize();if(!_.contains(c)){this._enforcingBounds=!0;var C=c.subtract(_.getCenter()),T=_.extend(c).getSize().subtract(v);o.x+=C.x<0?-T.x:T.x,o.y+=C.y<0?-T.y:T.y,this.panTo(this.unproject(o),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=h({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var s=this.getSize(),r=t.divideBy(2).round(),o=s.divideBy(2).round(),c=r.subtract(o);return!c.x&&!c.y?this:(e.animate&&e.pan?this.panBy(c):(e.pan&&this._rawPanBy(c),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(m(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:t,newSize:s}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=h({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=m(this._handleGeolocationResponse,this),s=m(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,s,e):navigator.geolocation.getCurrentPosition(t,s,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,s=e.message||(t===1?"permission denied":t===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+s+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,s=e.coords.longitude,r=new J(t,s),o=r.toBounds(e.coords.accuracy*2),c=this._locateOptions;if(c.setView){var f=this.getBoundsZoom(o);this.setView(r,c.maxZoom?Math.min(f,c.maxZoom):f)}var _={latlng:r,bounds:o,timestamp:e.timestamp};for(var v in e.coords)typeof e.coords[v]=="number"&&(_[v]=e.coords[v]);this.fire("locationfound",_)}},addHandler:function(e,t){if(!t)return this;var s=this[e]=new t(this);return this._handlers.push(s),this.options[e]&&s.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),le(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(V(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var e;for(e in this._layers)this._layers[e].remove();for(e in this._panes)le(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var s="leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),r=X("div",s,t||this._mapPane);return e&&(this._panes[e]=r),r},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds(),t=this.unproject(e.getBottomLeft()),s=this.unproject(e.getTopRight());return new se(t,s)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,s){e=ce(e),s=D(s||[0,0]);var r=this.getZoom()||0,o=this.getMinZoom(),c=this.getMaxZoom(),f=e.getNorthWest(),_=e.getSouthEast(),v=this.getSize().subtract(s),C=Q(this.project(_,r),this.project(f,r)).getSize(),T=R.any3d?this.options.zoomSnap:1,F=v.x/C.x,U=v.y/C.y,ve=t?Math.max(F,U):Math.min(F,U);return r=this.getScaleZoom(ve,r),T&&(r=Math.round(r/(T/100))*(T/100),r=t?Math.ceil(r/T)*T:Math.floor(r/T)*T),Math.max(o,Math.min(c,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var s=this._getTopLeftPoint(e,t);return new q(s,s.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e=="string"?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var s=this.options.crs;return t=t===void 0?this._zoom:t,s.scale(e)/s.scale(t)},getScaleZoom:function(e,t){var s=this.options.crs;t=t===void 0?this._zoom:t;var r=s.zoom(e*s.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(G(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(D(e),t)},layerPointToLatLng:function(e){var t=D(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){var t=this.project(G(e))._round();return t._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(G(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(ce(e))},distance:function(e,t){return this.options.crs.distance(G(e),G(t))},containerPointToLayerPoint:function(e){return D(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return D(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(D(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(G(e)))},mouseEventToContainerPoint:function(e){return Qs(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=Gs(e);if(t){if(t._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");$(t,"scroll",this._onScroll,this),this._containerId=g(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&R.any3d,H(e,"leaflet-container"+(R.touch?" leaflet-touch":"")+(R.retina?" leaflet-retina":"")+(R.ielt9?" leaflet-oldie":"")+(R.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var t=Pt(e,"position");t!=="absolute"&&t!=="relative"&&t!=="fixed"&&t!=="sticky"&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ue(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(H(e.markerPane,"leaflet-zoom-hide"),H(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,t,s){ue(this._mapPane,new O(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset");var o=this._zoom!==t;this._moveStart(o,s)._move(e,t)._moveEnd(o),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(e,t){return e&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(e,t,s,r){t===void 0&&(t=this._zoom);var o=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?s&&s.pinch&&this.fire("zoom",s):((o||s&&s.pinch)&&this.fire("zoom",s),this.fire("move",s)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return V(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){ue(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[g(this._container)]=this;var t=e?ne:$;t(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&t(window,"resize",this._onResize,this),R.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){V(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var s=[],r,o=t==="mouseout"||t==="mouseover",c=e.target||e.srcElement,f=!1;c;){if(r=this._targets[g(c)],r&&(t==="click"||t==="preclick")&&this._draggableMoved(r)){f=!0;break}if(r&&r.listens(t,!0)&&(o&&!Vi(c,e)||(s.push(r),o))||c===this._container)break;c=c.parentNode}return!s.length&&!f&&!o&&this.listens(t,!0)&&(s=[this]),s},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type==="click"&&this._isClickDisabled(t))){var s=e.type;s==="mousedown"&&Fi(t),this._fireDOMEvent(e,s)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,s){if(e.type==="click"){var r=h({},e);r.type="preclick",this._fireDOMEvent(r,r.type,s)}var o=this._findEventTargets(e,t);if(s){for(var c=[],f=0;f0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),s=this.getMaxZoom(),r=R.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(s,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){he(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,t){var s=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(s)?!1:(this.panBy(s,t),!0)},_createAnimProxy:function(){var e=this._proxy=X("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(t){var s=Mi,r=this._proxy.style[s];Je(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),r===this._proxy.style[s]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){le(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Je(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,t,s){if(this._animatingZoom)return!0;if(s=s||{},!this._zoomAnimated||s.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),o=this._getCenterOffset(e)._divideBy(1-1/r);return s.animate!==!0&&!this.getSize().contains(o)?!1:(B(function(){this._moveStart(!0,s.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,s,r){this._mapPane&&(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,H(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(m(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&he(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ga(e,t){return new Y(e,t)}var Se=Z.extend({options:{position:"topright"},initialize:function(e){j(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),s=this.getPosition(),r=e._controlCorners[s];return H(t,"leaflet-control"),s.indexOf("bottom")!==-1?r.insertBefore(t,r.firstChild):r.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(le(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),At=function(e){return new Se(e)};Y.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t="leaflet-",s=this._controlContainer=X("div",t+"control-container",this._container);function r(o,c){var f=t+o+" "+t+c;e[o+c]=X("div",f,s)}r("top","left"),r("top","right"),r("bottom","left"),r("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)le(this._controlCorners[e]);le(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var tn=Se.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,s,r){return s1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=t&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(g(e.target)),s=t.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;s&&this._map.fire(s,t)},_createRadioElement:function(e,t){var s='",r=document.createElement("div");return r.innerHTML=s,r.firstChild},_addItem:function(e){var t=document.createElement("label"),s=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=s):r=this._createRadioElement("leaflet-base-layers_"+g(this),s),this._layerControlInputs.push(r),r.layerId=g(e.layer),$(r,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+e.name;var c=document.createElement("span");t.appendChild(c),c.appendChild(r),c.appendChild(o);var f=e.overlay?this._overlaysList:this._baseLayersList;return f.appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,s,r=[],o=[];this._handlingClick=!0;for(var c=e.length-1;c>=0;c--)t=e[c],s=this._getLayer(t.layerId).layer,t.checked?r.push(s):t.checked||o.push(s);for(c=0;c=0;o--)t=e[o],s=this._getLayer(t.layerId).layer,t.disabled=s.options.minZoom!==void 0&&rs.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,$(e,"click",xe),this.expand();var t=this;setTimeout(function(){ne(e,"click",xe),t._preventClick=!1})}}),pa=function(e,t,s){return new tn(e,t,s)},qi=Se.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",s=X("div",t+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+"-in",s,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+"-out",s,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),s},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,s,r,o){var c=X("a",s,r);return c.innerHTML=e,c.href="#",c.title=t,c.setAttribute("role","button"),c.setAttribute("aria-label",t),Mt(c),$(c,"click",it),$(c,"click",o,this),$(c,"click",this._refocusOnMap,this),c},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";he(this._zoomInButton,t),he(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(H(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(H(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});Y.mergeOptions({zoomControl:!0}),Y.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new qi,this.addControl(this.zoomControl))});var xa=function(e){return new qi(e)},sn=Se.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",s=X("div",t),r=this.options;return this._addScales(r,t+"-line",s),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),s},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,s){e.metric&&(this._mScale=X("div",t,s)),e.imperial&&(this._iScale=X("div",t,s))},_update:function(){var e=this._map,t=e.getSize().y/2,s=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(s)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),s=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,s,t/e)},_updateImperial:function(e){var t=e*3.2808399,s,r,o;t>5280?(s=t/5280,r=this._getRoundNum(s),this._updateScale(this._iScale,r+" mi",r/s)):(o=this._getRoundNum(t),this._updateScale(this._iScale,o+" ft",o/t))},_updateScale:function(e,t,s){e.style.width=Math.round(this.options.maxWidth*s)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),s=e/t;return s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:1,t*s}}),_a=function(e){return new sn(e)},ya='',Ui=Se.extend({options:{position:"bottomright",prefix:''+(R.inlineSvg?ya+" ":"")+"Leaflet"},initialize:function(e){j(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=X("div","leaflet-control-attribution"),Mt(this._container);for(var t in e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var s=[];this.options.prefix&&s.push(this.options.prefix),e.length&&s.push(e.join(", ")),this._container.innerHTML=s.join(' ')}}});Y.mergeOptions({attributionControl:!0}),Y.addInitHook(function(){this.options.attributionControl&&new Ui().addTo(this)});var va=function(e){return new Ui(e)};Se.Layers=tn,Se.Zoom=qi,Se.Scale=sn,Se.Attribution=Ui,At.layers=pa,At.zoom=xa,At.scale=_a,At.attribution=va;var Oe=Z.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Oe.addTo=function(e,t){return e.addHandler(t,this),this};var ba={Events:ee},nn=R.touch?"touchstart mousedown":"mousedown",Ge=ge.extend({options:{clickTolerance:3},initialize:function(e,t,s,r){j(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=s},enable:function(){this._enabled||($(this._dragStartTarget,nn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ge._dragging===this&&this.finishDrag(!0),ne(this._dragStartTarget,nn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!Ai(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){Ge._dragging===this&&this.finishDrag();return}if(!(Ge._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Ge._dragging=this,this._preventOutline&&Fi(this._element),Di(),St(),!this._moving)){this.fire("down");var t=e.touches?e.touches[0]:e,s=Ks(this._element);this._startPoint=new O(t.clientX,t.clientY),this._startPos=et(this._element),this._parentScale=Bi(s);var r=e.type==="mousedown";$(document,r?"mousemove":"touchmove",this._onMove,this),$(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,s=new O(t.clientX,t.clientY)._subtract(this._startPoint);!s.x&&!s.y||Math.abs(s.x)+Math.abs(s.y)c&&(f=_,c=v);c>s&&(t[f]=1,Ki(e,t,s,r,f),Ki(e,t,s,f,o))}function Na(e,t){for(var s=[e[0]],r=1,o=0,c=e.length;rt&&(s.push(e[r]),o=r);return ot.max.x&&(s|=2),e.yt.max.y&&(s|=8),s}function Ca(e,t){var s=t.x-e.x,r=t.y-e.y;return s*s+r*r}function zt(e,t,s,r){var o=t.x,c=t.y,f=s.x-o,_=s.y-c,v=f*f+_*_,C;return v>0&&(C=((e.x-o)*f+(e.y-c)*_)/v,C>1?(o=s.x,c=s.y):C>0&&(o+=f*C,c+=_*C)),f=e.x-o,_=e.y-c,r?f*f+_*_:new O(o,c)}function Ce(e){return!K(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function hn(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ce(e)}function un(e,t){var s,r,o,c,f,_,v,C;if(!e||e.length===0)throw new Error("latlngs not passed");Ce(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var T=G([0,0]),F=ce(e),U=F.getNorthWest().distanceTo(F.getSouthWest())*F.getNorthEast().distanceTo(F.getNorthWest());U<1700&&(T=Gi(e));var ve=e.length,pe=[];for(s=0;sr){v=(c-r)/o,C=[_.x-v*(_.x-f.x),_.y-v*(_.y-f.y)];break}var je=t.unproject(D(C));return G([je.lat+T.lat,je.lng+T.lng])}var La={__proto__:null,simplify:on,pointToSegmentDistance:ln,closestPointOnSegment:ja,clipSegment:cn,_getEdgeIntersection:ni,_getBitCode:st,_sqClosestPointOnSegment:zt,isFlat:Ce,_flat:hn,polylineCenter:un},Yi={project:function(e){return new O(e.lng,e.lat)},unproject:function(e){return new J(e.y,e.x)},bounds:new q([-180,-90],[180,90])},Xi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var t=Math.PI/180,s=this.R,r=e.lat*t,o=this.R_MINOR/s,c=Math.sqrt(1-o*o),f=c*Math.sin(r),_=Math.tan(Math.PI/4-r/2)/Math.pow((1-f)/(1+f),c/2);return r=-s*Math.log(Math.max(_,1e-10)),new O(e.lng*t*s,r)},unproject:function(e){for(var t=180/Math.PI,s=this.R,r=this.R_MINOR/s,o=Math.sqrt(1-r*r),c=Math.exp(-e.y/s),f=Math.PI/2-2*Math.atan(c),_=0,v=.1,C;_<15&&Math.abs(v)>1e-7;_++)C=o*Math.sin(f),C=Math.pow((1-C)/(1+C),o/2),v=Math.PI/2-2*Math.atan(c*C)-f,f+=v;return new J(f*t,e.x*t/s)}},Pa={__proto__:null,LonLat:Yi,Mercator:Xi,SphericalMercator:kt},Sa=h({},Me,{code:"EPSG:3395",projection:Xi,transformation:(function(){var e=.5/(Math.PI*Xi.R);return E(e,.5,-e,.5)})()}),mn=h({},Me,{code:"EPSG:4326",projection:Yi,transformation:E(1/180,1,-1/180,.5)}),Ta=h({},Pe,{projection:Yi,transformation:E(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var s=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(s*s+r*r)},infinite:!0});Pe.Earth=Me,Pe.EPSG3395=Sa,Pe.EPSG3857=ye,Pe.EPSG900913=Ue,Pe.EPSG4326=mn,Pe.Simple=Ta;var Te=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[g(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[g(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var s=this.getEvents();t.on(s,this),this.once("remove",function(){t.off(s,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});Y.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=g(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=g(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return g(e)in this._layers},eachLayer:function(e,t){for(var s in this._layers)e.call(t,this._layers[s]);return this},_addLayers:function(e){e=e?K(e)?e:[e]:[];for(var t=0,s=e.length;tthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&t[0]instanceof J&&t[0].equals(t[s-1])&&t.pop(),t},_setLatLngs:function(e){Be.prototype._setLatLngs.call(this,e),Ce(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ce(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,s=new O(t,t);if(e=new q(e.min.subtract(s),e.max.add(s)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,o=this._rings.length,c;re.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(t=!t);return t||Be.prototype._containsPoint.call(this,e,!0)}});function Ra(e,t){return new ut(e,t)}var Ze=Fe.extend({initialize:function(e,t){j(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=K(e)?e:e.features,s,r,o;if(t){for(s=0,r=t.length;s0&&o.push(o[0].slice()),o}function mt(e,t){return e.feature?h({},e.feature,{geometry:t}):ci(t)}function ci(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var ts={toGeoJSON:function(e){return mt(this,{type:"Point",coordinates:es(this.getLatLng(),e)})}};ri.include(ts),Qi.include(ts),ai.include(ts),Be.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=di(this._latlngs,t?1:0,!1,e);return mt(this,{type:(t?"Multi":"")+"LineString",coordinates:s})}}),ut.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=t&&!Ce(this._latlngs[0]),r=di(this._latlngs,s?2:t?1:0,!0,e);return t||(r=[r]),mt(this,{type:(s?"Multi":"")+"Polygon",coordinates:r})}}),ct.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(s){t.push(s.toGeoJSON(e).geometry.coordinates)}),mt(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t==="MultiPoint")return this.toMultiPoint(e);var s=t==="GeometryCollection",r=[];return this.eachLayer(function(o){if(o.toGeoJSON){var c=o.toGeoJSON(e);if(s)r.push(c.geometry);else{var f=ci(c);f.type==="FeatureCollection"?r.push.apply(r,f.features):r.push(f)}}}),s?mt(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function pn(e,t){return new Ze(e,t)}var Fa=pn,hi=Te.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,s){this._url=e,this._bounds=ce(t),j(this,s)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(H(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){le(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&<(this._image),this},bringToBack:function(){return this._map&&dt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=ce(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",t=this._image=e?this._url:X("img");if(H(t,"leaflet-image-layer"),this._zoomAnimated&&H(t,"leaflet-zoom-animated"),this.options.className&&H(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onload=m(this.fire,this,"load"),t.onerror=m(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(t.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),s=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Je(this._image,s,t)},_reset:function(){var e=this._image,t=new q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),s=t.getSize();ue(e,t.min),e.style.width=s.x+"px",e.style.height=s.y+"px"},_updateOpacity:function(){Ne(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Ba=function(e,t,s){return new hi(e,t,s)},xn=hi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",t=this._image=e?this._url:X("video");if(H(t,"leaflet-image-layer"),this._zoomAnimated&&H(t,"leaflet-zoom-animated"),this.options.className&&H(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onloadeddata=m(this.fire,this,"load"),e){for(var s=t.getElementsByTagName("source"),r=[],o=0;o0?r:[t.src];return}K(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var c=0;co?(t.height=o+"px",H(e,c)):he(e,c),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),s=this._getAnchor();ue(this._container,t.add(s))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(Pt(this._container,"marginBottom"),10)||0,s=this._container.offsetHeight+t,r=this._containerWidth,o=new O(this._containerLeft,-s-this._containerBottom);o._add(et(this._container));var c=e.layerPointToContainerPoint(o),f=D(this.options.autoPanPadding),_=D(this.options.autoPanPaddingTopLeft||f),v=D(this.options.autoPanPaddingBottomRight||f),C=e.getSize(),T=0,F=0;c.x+r+v.x>C.x&&(T=c.x+r-C.x+v.x),c.x-T-_.x<0&&(T=c.x-_.x),c.y+s+v.y>C.y&&(F=c.y+s-C.y+v.y),c.y-F-_.y<0&&(F=c.y-_.y),(T||F)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([T,F]))}},_getAnchor:function(){return D(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Ha=function(e,t){return new ui(e,t)};Y.mergeOptions({closePopupOnClick:!0}),Y.include({openPopup:function(e,t,s){return this._initOverlay(ui,e,t,s).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Te.include({bindPopup:function(e,t){return this._popup=this._initOverlay(ui,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Fe||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){it(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof Ke)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var mi=De.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){De.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){De.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=De.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",t=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=X("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,s,r=this._map,o=this._container,c=r.latLngToContainerPoint(r.getCenter()),f=r.layerPointToContainerPoint(e),_=this.options.direction,v=o.offsetWidth,C=o.offsetHeight,T=D(this.options.offset),F=this._getAnchor();_==="top"?(t=v/2,s=C):_==="bottom"?(t=v/2,s=0):_==="center"?(t=v/2,s=C/2):_==="right"?(t=0,s=C/2):_==="left"?(t=v,s=C/2):f.xthis.options.maxZoom||sr?this._retainParent(o,c,f,r):!1)},_retainChildren:function(e,t,s,r){for(var o=2*e;o<2*e+2;o++)for(var c=2*t;c<2*t+2;c++){var f=new O(o,c);f.z=s+1;var _=this._tileCoordsToKey(f),v=this._tiles[_];if(v&&v.active){v.retain=!0;continue}else v&&v.loaded&&(v.retain=!0);s+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(e,s);return}for(var F=o.min.y;F<=o.max.y;F++)for(var U=o.min.x;U<=o.max.x;U++){var ve=new O(U,F);if(ve.z=this._tileZoom,!!this._isValidTile(ve)){var pe=this._tiles[this._tileCoordsToKey(ve)];pe?pe.current=!0:f.push(ve)}}if(f.sort(function(je,gt){return je.distanceTo(c)-gt.distanceTo(c)}),f.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Le=document.createDocumentFragment();for(U=0;Us.max.x)||!t.wrapLat&&(e.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return ce(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,s=this.getTileSize(),r=e.scaleBy(s),o=r.add(s),c=t.unproject(r,e.z),f=t.unproject(o,e.z);return[c,f]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),s=new se(t[0],t[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),s=new O(+t[0],+t[1]);return s.z=+t[2],s},_removeTile:function(e){var t=this._tiles[e];t&&(le(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){H(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=b,e.onmousemove=b,R.ielt9&&this.options.opacity<1&&Ne(e,this.options.opacity)},_addTile:function(e,t){var s=this._getTilePos(e),r=this._tileCoordsToKey(e),o=this.createTile(this._wrapCoords(e),m(this._tileReady,this,e));this._initTile(o),this.createTile.length<2&&B(m(this._tileReady,this,e,null,o)),ue(o,s),this._tiles[r]={el:o,coords:e,current:!0},t.appendChild(o),this.fire("tileloadstart",{tile:o,coords:e})},_tileReady:function(e,t,s){t&&this.fire("tileerror",{error:t,tile:s,coords:e});var r=this._tileCoordsToKey(e);s=this._tiles[r],s&&(s.loaded=+new Date,this._map._fadeAnimated?(Ne(s.el,0),V(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(s.active=!0,this._pruneTiles()),t||(H(s.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:s.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),R.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(m(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new O(this._wrapX?y(e.x,this._wrapX):e.x,this._wrapY?y(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new q(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function qa(e){return new Dt(e)}var ft=Dt.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=j(this,t),t.detectRetina&&R.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains=="string"&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var s=document.createElement("img");return $(s,"load",m(this._tileOnLoad,this,t,s)),$(s,"error",m(this._tileOnError,this,t,s)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(s.referrerPolicy=this.options.referrerPolicy),s.alt="",s.src=this.getTileUrl(e),s},getTileUrl:function(e){var t={r:R.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var s=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=s),t["-y"]=s}return S(this._url,h(t,this.options))},_tileOnLoad:function(e,t){R.ielt9?setTimeout(m(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,s){var r=this.options.errorTileUrl;r&&t.getAttribute("src")!==r&&(t.src=r),e(s,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,s=this.options.zoomReverse,r=this.options.zoomOffset;return s&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=b,t.onerror=b,!t.complete)){t.src=ae;var s=this._tiles[e].coords;le(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:s})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",ae),Dt.prototype._removeTile.call(this,e)},_tileReady:function(e,t,s){if(!(!this._map||s&&s.getAttribute("src")===ae))return Dt.prototype._tileReady.call(this,e,t,s)}});function vn(e,t){return new ft(e,t)}var bn=ft.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var s=h({},this.defaultWmsParams);for(var r in t)r in this.options||(s[r]=t[r]);t=j(this,t);var o=t.detectRetina&&R.retina?2:1,c=this.getTileSize();s.width=c.x*o,s.height=c.y*o,this.wmsParams=s},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,ft.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),s=this._crs,r=Q(s.project(t[0]),s.project(t[1])),o=r.min,c=r.max,f=(this._wmsVersion>=1.3&&this._crs===mn?[o.y,o.x,c.y,c.x]:[o.x,o.y,c.x,c.y]).join(","),_=ft.prototype.getTileUrl.call(this,e);return _+M(this.wmsParams,_,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+f},setParams:function(e,t){return h(this.wmsParams,e),t||this.redraw(),this}});function Ua(e,t){return new bn(e,t)}ft.WMS=bn,vn.wms=Ua;var $e=Te.extend({options:{padding:.1},initialize:function(e){j(this,e),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),H(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var s=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,t),c=r.multiplyBy(-s).add(o).subtract(this._map._getNewPixelOrigin(e,t));R.any3d?Je(this._container,c,s):ue(this._container,c)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),s=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new q(s,s.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),wn=$e.extend({options:{tolerance:0},getEvents:function(){var e=$e.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$e.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");$(e,"mousemove",this._onMouseMove,this),$(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){V(this._redrawRequest),delete this._ctx,le(this._container),ne(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var t in this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=this._container,s=e.getSize(),r=R.retina?2:1;ue(t,e.min),t.width=r*s.x,t.height=r*s.y,t.style.width=s.x+"px",t.style.height=s.y+"px",R.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){$e.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[g(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,s=t.next,r=t.prev;s?s.prev=r:this._drawLast=r,r?r.next=s:this._drawFirst=s,delete e._order,delete this._layers[g(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var t=e.options.dashArray.split(/[, ]+/),s=[],r,o;for(o=0;o')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Ga={_initContainer:function(){this._container=X("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($e.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=It("shape");H(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=It("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;le(t),e.removeInteractiveTarget(t),delete this._layers[g(e)]},_updateStyle:function(e){var t=e._stroke,s=e._fill,r=e.options,o=e._container;o.stroked=!!r.stroke,o.filled=!!r.fill,r.stroke?(t||(t=e._stroke=It("stroke")),o.appendChild(t),t.weight=r.weight+"px",t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=K(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=r.lineCap.replace("butt","flat"),t.joinstyle=r.lineJoin):t&&(o.removeChild(t),e._stroke=null),r.fill?(s||(s=e._fill=It("fill")),o.appendChild(s),s.color=r.fillColor||r.color,s.opacity=r.fillOpacity):s&&(o.removeChild(s),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),s=Math.round(e._radius),r=Math.round(e._radiusY||s);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+s+","+r+" 0,"+65535*360)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){lt(e._container)},_bringToBack:function(e){dt(e._container)}},fi=R.vml?It:Re,Rt=$e.extend({_initContainer:function(){this._container=fi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=fi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){le(this._container),ne(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=e.getSize(),s=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,s.setAttribute("width",t.x),s.setAttribute("height",t.y)),ue(s,e.min),s.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=fi("path");e.options.className&&H(t,e.options.className),e.options.interactive&&H(t,"leaflet-interactive"),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){le(e._path),e.removeInteractiveTarget(e._path),delete this._layers[g(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,s=e.options;t&&(s.stroke?(t.setAttribute("stroke",s.color),t.setAttribute("stroke-opacity",s.opacity),t.setAttribute("stroke-width",s.weight),t.setAttribute("stroke-linecap",s.lineCap),t.setAttribute("stroke-linejoin",s.lineJoin),s.dashArray?t.setAttribute("stroke-dasharray",s.dashArray):t.removeAttribute("stroke-dasharray"),s.dashOffset?t.setAttribute("stroke-dashoffset",s.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),s.fill?(t.setAttribute("fill",s.fillColor||s.color),t.setAttribute("fill-opacity",s.fillOpacity),t.setAttribute("fill-rule",s.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,Yt(e._parts,t))},_updateCircle:function(e){var t=e._point,s=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||s,o="a"+s+","+r+" 0 1,0 ",c=e._empty()?"M0 0":"M"+(t.x-s)+","+t.y+o+s*2+",0 "+o+-s*2+",0 ";this._setPath(e,c)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){lt(e._path)},_bringToBack:function(e){dt(e._path)}});R.vml&&Rt.include(Ga);function kn(e){return R.svg||R.vml?new Rt(e):null}Y.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&jn(e)||kn(e)}});var Nn=ut.extend({initialize:function(e,t){ut.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=ce(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function Ka(e,t){return new Nn(e,t)}Rt.create=fi,Rt.pointsToPath=Yt,Ze.geometryToLayer=oi,Ze.coordsToLatLng=Ji,Ze.coordsToLatLngs=li,Ze.latLngToCoords=es,Ze.latLngsToCoords=di,Ze.getFeature=mt,Ze.asFeature=ci,Y.mergeOptions({boxZoom:!0});var Cn=Oe.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){$(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ne(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){le(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),St(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),$(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=X("div","leaflet-zoom-box",this._container),H(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new q(this._point,this._startPoint),s=t.getSize();ue(this._box,t.min),this._box.style.width=s.x+"px",this._box.style.height=s.y+"px"},_finish:function(){this._moved&&(le(this._box),he(this._container,"leaflet-crosshair")),Tt(),Ii(),ne(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(m(this._resetState,this),0);var t=new se(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Y.addInitHook("addHandler","boxZoom",Cn),Y.mergeOptions({doubleClickZoom:!0});var Ln=Oe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,s=t.getZoom(),r=t.options.zoomDelta,o=e.originalEvent.shiftKey?s-r:s+r;t.options.doubleClickZoom==="center"?t.setZoom(o):t.setZoomAround(e.containerPoint,o)}});Y.addInitHook("addHandler","doubleClickZoom",Ln),Y.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Pn=Oe.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Ge(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}H(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){he(this._map._container,"leaflet-grab"),he(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=ce(this._map.options.maxBounds);this._offsetLimit=Q(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,s=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(s),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.xt.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),s=this._initialWorldOffset,r=this._draggable._newPos.x,o=(r-t+s)%e+t-s,c=(r+t+s)%e-t-s,f=Math.abs(o+s)0?c:-c))-t;this._delta=0,this._startTime=null,f&&(e.options.scrollWheelZoom==="center"?e.setZoom(t+f):e.setZoomAround(this._lastMousePos,t+f))}});Y.addInitHook("addHandler","scrollWheelZoom",Tn);var Ya=600;Y.mergeOptions({tapHold:R.touchNative&&R.safari&&R.mobile,tapTolerance:15});var En=Oe.extend({addHooks:function(){$(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ne(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new O(t.clientX,t.clientY),this._holdTimeout=setTimeout(m(function(){this._cancel(),this._isTapValid()&&($(document,"touchend",xe),$(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),Ya),$(document,"touchend touchcancel contextmenu",this._cancel,this),$(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){ne(document,"touchend",xe),ne(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),ne(document,"touchend touchcancel contextmenu",this._cancel,this),ne(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new O(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var s=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});s._simulated=!0,t.target.dispatchEvent(s)}});Y.addInitHook("addHandler","tapHold",En),Y.mergeOptions({touchZoom:R.touch,bounceAtZoomLimits:!0});var Mn=Oe.extend({addHooks:function(){H(this._map._container,"leaflet-touch-zoom"),$(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){he(this._map._container,"leaflet-touch-zoom"),ne(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!=="center"&&(this._pinchStartLatLng=t.containerPointToLatLng(s.add(r)._divideBy(2))),this._startDist=s.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),$(document,"touchmove",this._onTouchMove,this),$(document,"touchend touchcancel",this._onTouchEnd,this),xe(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),o=s.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(o,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoomt.getMaxZoom()&&o>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var c=s._add(r)._divideBy(2)._subtract(this._centerPoint);if(o===1&&c.x===0&&c.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(c),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),V(this._animRequest);var f=m(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(f,this,!0),xe(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,V(this._animRequest),ne(document,"touchmove",this._onTouchMove,this),ne(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Y.addInitHook("addHandler","touchZoom",Mn),Y.BoxZoom=Cn,Y.DoubleClickZoom=Ln,Y.Drag=Pn,Y.Keyboard=Sn,Y.ScrollWheelZoom=Tn,Y.TapHold=En,Y.TouchZoom=Mn,a.Bounds=q,a.Browser=R,a.CRS=Pe,a.Canvas=wn,a.Circle=Qi,a.CircleMarker=ai,a.Class=Z,a.Control=Se,a.DivIcon=yn,a.DivOverlay=De,a.DomEvent=fa,a.DomUtil=ua,a.Draggable=Ge,a.Evented=ge,a.FeatureGroup=Fe,a.GeoJSON=Ze,a.GridLayer=Dt,a.Handler=Oe,a.Icon=ht,a.ImageOverlay=hi,a.LatLng=J,a.LatLngBounds=se,a.Layer=Te,a.LayerGroup=ct,a.LineUtil=La,a.Map=Y,a.Marker=ri,a.Mixin=ba,a.Path=Ke,a.Point=O,a.PolyUtil=wa,a.Polygon=ut,a.Polyline=Be,a.Popup=ui,a.PosAnimation=en,a.Projection=Pa,a.Rectangle=Nn,a.Renderer=$e,a.SVG=Rt,a.SVGOverlay=_n,a.TileLayer=ft,a.Tooltip=mi,a.Transformation=Nt,a.Util=re,a.VideoOverlay=xn,a.bind=m,a.bounds=Q,a.canvas=jn,a.circle=Da,a.circleMarker=Oa,a.control=At,a.divIcon=Va,a.extend=h,a.featureGroup=Ma,a.geoJSON=pn,a.geoJson=Fa,a.gridLayer=qa,a.icon=Aa,a.imageOverlay=Ba,a.latLng=G,a.latLngBounds=ce,a.layerGroup=Ea,a.map=ga,a.marker=za,a.point=D,a.polygon=Ra,a.polyline=Ia,a.popup=Ha,a.rectangle=Ka,a.setOptions=j,a.stamp=g,a.svg=kn,a.svgOverlay=$a,a.tileLayer=vn,a.tooltip=Wa,a.transformation=E,a.version=d,a.videoOverlay=Za;var Xa=window.L;a.noConflict=function(){return window.L=Xa,this},window.L=a}))})(Ft,Ft.exports)),Ft.exports}var Ni=gd();function Cs(n,l,a){return Object.freeze({instance:n,context:l,container:a})}function Ls(n,l){return l==null?function(d,h){const u=k.useRef();return u.current||(u.current=n(d,h)),u}:function(d,h){const u=k.useRef();u.current||(u.current=n(d,h));const m=k.useRef(d),{instance:p}=u.current;return k.useEffect(function(){m.current!==d&&(l(p,d,m.current),m.current=d)},[p,d,h]),u}}function Mr(n,l){k.useEffect(function(){return(l.layerContainer??l.map).addLayer(n.instance),function(){var u;(u=l.layerContainer)==null||u.removeLayer(n.instance),l.map.removeLayer(n.instance)}},[l,n])}function pd(n){return function(a){const d=ks(),h=n(ki(a,d),d);return Sr(d.map,a.attribution),Ns(h.current,a.eventHandlers),Mr(h.current,d),h}}function xd(n,l){const a=k.useRef();k.useEffect(function(){if(l.pathOptions!==a.current){const h=l.pathOptions??{};n.instance.setStyle(h),a.current=h}},[n,l])}function _d(n){return function(a){const d=ks(),h=n(ki(a,d),d);return Ns(h.current,a.eventHandlers),Mr(h.current,d),xd(h.current,a),h}}function yd(n,l){const a=Ls(n),d=md(a,l);return hd(d)}function vd(n,l){const a=Ls(n,l),d=_d(a);return cd(d)}function bd(n,l){const a=Ls(n,l),d=pd(a);return ud(d)}function wd(n,l,a){const{opacity:d,zIndex:h}=l;d!=null&&d!==a.opacity&&n.setOpacity(d),h!=null&&h!==a.zIndex&&n.setZIndex(h)}const jd=vd(function({center:l,children:a,...d},h){const u=new Ni.CircleMarker(l,d);return Cs(u,dd(h,{overlayContainer:u}))},ad);function fs(){return fs=Object.assign||function(n){for(var l=1;l(N==null?void 0:N.map)??null,[N]);const j=k.useCallback(I=>{if(I!==null&&N===null){const S=new Ni.Map(I,y);a!=null&&w!=null?S.setView(a,w):n!=null&&S.fitBounds(n,l),g!=null&&S.whenReady(g),P(ld(S))}},[]);k.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const M=N?Zt.createElement(Er,{value:N},d):m??null;return Zt.createElement("div",fs({},x,{ref:j}),M)}const Nd=k.forwardRef(kd),Cd=yd(function(l,a){const d=new Ni.Popup(l,a.overlayContainer);return Cs(d,a)},function(l,a,{position:d},h){k.useEffect(function(){const{instance:m}=l;function p(w){w.popup===m&&(m.update(),h(!0))}function g(w){w.popup===m&&h(!1)}return a.map.on({popupopen:p,popupclose:g}),a.overlayContainer==null?(d!=null&&m.setLatLng(d),m.openOn(a.map)):a.overlayContainer.bindPopup(m),function(){var y;a.map.off({popupopen:p,popupclose:g}),(y=a.overlayContainer)==null||y.unbindPopup(),a.map.removeLayer(m)}},[l,a,h,d])}),Ld=bd(function({url:l,...a},d){const h=new Ni.TileLayer(l,ki(a,d));return Cs(h,d)},function(l,a,d){wd(l,a,d);const{url:h}=a;h!=null&&h!==d.url&&l.setUrl(h)}),Pd=({profile:n})=>{var m,p,g,w;if(!((p=(m=n==null?void 0:n.geospatial)==null?void 0:m.sample_points)!=null&&p.length))return i.jsx(Ut,{icon:i.jsx(ds,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Geospatial Data",description:"No latitude/longitude columns were detected in the dataset."});const l=n.geospatial,a=!!n.target_col,d=Gt(l.sample_points??[],a?"label":void 0),h=d.map(({label:y,color:b})=>({label:y,color:b,shape:"circle"})),u=[[l.min_lat,l.min_lon],[l.max_lat,l.max_lon]];return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(ds,{className:"w-5 h-5 mr-2 text-blue-500"}),"Geospatial Analysis",i.jsx(_e,{text:"Visualizes data points on a map based on detected Latitude/Longitude columns. Colors indicate target values."})]}),i.jsxs("div",{className:"text-sm text-gray-500",children:["Detected columns: ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lat_col}),", ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lon_col})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2 min-w-0",children:[i.jsx("div",{className:"h-96 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 relative z-0",children:i.jsxs(Nd,{bounds:u,style:{height:"100%",width:"100%"},scrollWheelZoom:!0,children:[i.jsx(Ld,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'Β© OpenStreetMap contributors'}),d.flatMap(y=>y.points.map((b,x)=>i.jsx(jd,{center:[b.lat,b.lon],radius:5,pathOptions:{color:a?y.color:"#3b82f6",fillColor:a?y.color:"#3b82f6",fillOpacity:.7,weight:1},children:i.jsx(Cd,{children:i.jsxs("div",{className:"text-xs",children:[i.jsx("strong",{children:"Lat:"})," ",b.lat.toFixed(4),i.jsx("br",{}),i.jsx("strong",{children:"Lon:"})," ",b.lon.toFixed(4),i.jsx("br",{}),a&&i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[n.target_col,":"]})," ",y.label]})]})})},JSON.stringify([y.value,x]))))]},`${l.lat_col??""}-${l.lon_col??""}-${u.flat().join(",")}`)}),a&&i.jsx(js,{entries:h})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Spatial Bounds"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Latitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lat.toFixed(4)," to ",n.geospatial.max_lat.toFixed(4)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Longitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lon.toFixed(4)," to ",n.geospatial.max_lon.toFixed(4)]})]})]})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Centroid"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsxs("span",{className:"font-mono text-sm",children:[((g=n.geospatial.centroid_lat)==null?void 0:g.toFixed(4))??"β€”",", ",((w=n.geospatial.centroid_lon)==null?void 0:w.toFixed(4))??"β€”"]})]})]}),i.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:i.jsxs("p",{children:["This scatter plot shows the spatial distribution of your data.",!!n.target_col&&" Points are colored by the target variable."]})})]})]})]})]})},Sd=({profile:n,downloadChart:l,history:a,loading:d,loadSpecificReport:h,report:u})=>{var b;const[m,p]=k.useState("idle"),g=at(),w=k.useCallback(()=>{p("done"),setTimeout(()=>p("idle"),1200)},[]),y=async()=>{if(n!=null&&n.target_interactions){p("downloading");try{const x=vr(),N=n.target_interactions,P=400,j=800,M=40,I=2,S=Math.ceil(N.length/I),K=I*j+(I+1)*M,fe=S*(P+M)+100,ae=document.createElement("canvas");ae.width=K,ae.height=fe;const ie=ae.getContext("2d");if(!ie)return;ie.fillStyle=x.bgColor,ie.fillRect(0,0,ae.width,ae.height),ie.fillStyle=x.textColor,ie.font="bold 24px sans-serif",ie.textAlign="center",ie.fillText("Detailed Interactions (Box Plots)",K/2,50);for(let A=0;A{de.onload=()=>{ie.drawImage(de,oe,ee+30,j,P-50),URL.revokeObjectURL(q),Q()},de.onerror=()=>{URL.revokeObjectURL(q),Q()},de.src=q})}const we=document.createElement("a");we.download="all-interactions.png",we.href=ae.toDataURL("image/png"),we.click()}finally{w()}}};return i.jsxs("div",{className:"mt-4 grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Target Analysis: ",i.jsx("span",{className:"ml-2 text-blue-600",children:n.target_col}),i.jsx(_e,{text:"Analyzes relationships between the target variable and other features. Shows top correlations and key drivers."})]}),i.jsx("button",{onClick:()=>l("target-analysis-chart","target-analysis",`Target Analysis: ${n.target_col}`,"Top Associated Features"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-4",children:"Top Associated Features"}),i.jsx("div",{className:"h-64 w-full",id:"target-analysis-chart",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:Object.entries(n.target_correlations).slice(0,10).map(([x,N])=>({name:x,value:N})),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!1,stroke:g.gridColor}),i.jsx(Xe,{type:"number",domain:[0,1],tick:{fontSize:12,fill:g.axisColor}}),i.jsx(Qe,{type:"category",dataKey:"name",width:120,tick:{fontSize:12,fill:g.axisColor}}),i.jsx(He,{contentStyle:g.tooltipContentStyle,itemStyle:g.tooltipItemStyle,labelStyle:g.tooltipLabelStyle,formatter:x=>[x.toFixed(3),"Association"]}),i.jsx(jr,{x:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"value",fill:"#3b82f6",radius:[0,4,4,0],barSize:20})]})})})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-2",children:"Key Insights"}),i.jsxs("ul",{className:"space-y-2 text-sm",children:[i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Target is ",i.jsx("strong",{children:(b=n.columns[n.target_col])==null?void 0:b.dtype})]})]}),i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Strongest predictor: ",i.jsx("strong",{children:Object.keys(n.target_correlations)[0]||"None"}),Object.values(n.target_correlations)[0]!==void 0&&i.jsxs(i.Fragment,{children:[" (",Object.values(n.target_correlations)[0].toFixed(2),")"]})]})]})]})]})]})]}),n.target_interactions&&n.target_interactions.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Bt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Detailed Interactions (Box Plots)",i.jsx(_e,{text:"Shows distribution of values across categories. The box represents the middle 50% of data (Q1 to Q3). The line inside is the median."})]}),i.jsx("button",{onClick:y,disabled:m!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download All Charts","aria-label":"Download All Charts",children:m==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):m==="done"?i.jsx($t,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:[i.jsx("span",{className:"font-semibold",children:"ANOVA Analysis:"})," A p-value < 0.05 (highlighted in green) indicates that the feature varies significantly across the target categories, making it a strong predictor."]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:n.target_interactions.map((x,N)=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 relative group",children:[i.jsx("div",{className:"absolute top-2 right-2 opacity-100",children:i.jsx("button",{onClick:()=>l(`interaction-chart-${N}`,`interaction-${x.feature}`,`${x.feature} vs ${n.target_col}`,x.p_value!==void 0?`ANOVA p: ${Number(x.p_value).toExponential(2)}`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"text-center mb-2",children:[i.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[x.feature," vs ",n.target_col]}),x.p_value!==void 0&&x.p_value!==null&&i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full inline-block mt-1 ${x.p_value<.05?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:["ANOVA p: ",Number(x.p_value).toExponential(2)]})]}),i.jsx("div",{className:"h-64 w-full",id:`interaction-chart-${N}`,children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(Vo,{data:x.data.map(P=>({...P,boxBottom:P.stats.q1,boxHeight:P.stats.q3-P.stats.q1})),margin:{top:20,right:30,left:20,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:g.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:g.axisColor}}),i.jsx(Qe,{domain:["auto","auto"],tick:{fontSize:11,fill:g.axisColor}}),i.jsx(He,{cursor:{fill:"transparent"},content:({active:P,payload:j})=>{if(P&&j&&j.length){const M=j[0].payload;return i.jsxs("div",{style:g.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg z-50",children:[i.jsx("p",{className:"font-semibold mb-1",children:M.name}),i.jsxs("p",{children:["Max: ",M.stats.max.toFixed(2)]}),i.jsxs("p",{children:["Q3: ",M.stats.q3.toFixed(2)]}),i.jsxs("p",{children:["Median: ",M.stats.median.toFixed(2)]}),i.jsxs("p",{children:["Q1: ",M.stats.q1.toFixed(2)]}),i.jsxs("p",{children:["Min: ",M.stats.min.toFixed(2)]})]})}return null}}),i.jsx(Ve,{dataKey:"boxBottom",stackId:"a",fill:"transparent",legendType:"none"}),i.jsx(Ve,{dataKey:"boxHeight",stackId:"a",fill:"#8884d8",fillOpacity:.6,name:"IQR (Q1-Q3)"}),i.jsx(ns,{name:"Median",dataKey:"stats.median",fill:"#ff7300",shape:"square"}),i.jsx(ns,{name:"Max",dataKey:"stats.max",fill:"#82ca9d",shape:"cross"}),i.jsx(ns,{name:"Min",dataKey:"stats.min",fill:"#82ca9d",shape:"cross"})]})})}),i.jsx("p",{className:"text-xs text-center text-gray-400 mt-2",children:"* Box: Q1-Q3. Orange square: Median. Green crosses: Min/Max."})]},N))})]})]}),i.jsx("div",{className:"lg:col-span-1",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm h-fit sticky top-4",children:[i.jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(os,{className:"w-4 h-4 mr-2"}),"Analysis History"]}),d&&i.jsx(be,{className:"w-3 h-3 animate-spin text-blue-500"})]}),i.jsx("div",{className:"space-y-2 max-h-[500px] overflow-y-auto",children:a.length===0?i.jsx("p",{className:"text-xs text-gray-500 italic",children:"No previous analyses found."}):a.slice(0,10).map(x=>i.jsxs("button",{onClick:()=>!d&&h(x.id),disabled:d,className:`w-full text-left p-3 rounded-md text-sm border transition-colors ${u&&u.id===x.id?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-gray-50 border-gray-100 text-gray-600 hover:bg-gray-100 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800"} ${d?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("div",{className:"font-medium truncate",children:x.target_col?`Target: ${x.target_col}`:"General Analysis"}),i.jsx("div",{className:"text-xs opacity-70 mt-1",children:new Date(x.created_at).toLocaleString()}),i.jsx("div",{className:"mt-1",children:i.jsx(yr,{status:x.status})})]},x.id))})]})})]})},Td=({profile:n,downloadChart:l})=>{var d,h;const a=at();return i.jsxs("div",{className:"mt-4 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(xs,{className:"w-5 h-5 mr-2 text-blue-500"}),"Trend Analysis (",n.timeseries.date_col,")",i.jsx(_e,{text:"Shows how values change over time. Look for long-term trends (up/down) or sudden shifts."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[n.timeseries.stationarity_test&&i.jsxs("div",{className:`text-xs px-3 py-1 rounded-full border flex items-center gap-1 ${n.timeseries.stationarity_test.is_stationary?"bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300":"bg-yellow-50 border-yellow-200 text-yellow-700 dark:bg-yellow-900/20 dark:border-yellow-800 dark:text-yellow-300"}`,children:[i.jsx(_e,{text:"Augmented Dickey-Fuller Test. Stationary (p<0.05) means the data has constant mean/variance over time. Non-Stationary (p>=0.05) means it has a trend or seasonality."}),i.jsx("span",{className:"font-semibold",children:"ADF Test:"})," ",n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary",i.jsxs("span",{className:"opacity-75 ml-1",children:["(p=",n.timeseries.stationarity_test.p_value.toFixed(3),")"]})]}),i.jsx("button",{onClick:()=>l("trend-chart","trend-analysis","Trend Analysis",`Date Column: ${n.timeseries.date_col}`,n.timeseries.stationarity_test?`ADF Test: ${n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary"} (p=${n.timeseries.stationarity_test.p_value.toFixed(3)})`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx("div",{className:"h-80 w-full",id:"trend-chart",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(qo,{data:n.timeseries.trend,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"date",tick:{fontSize:12,fill:a.axisColor},minTickGap:30}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle}),i.jsx(wr,{}),Object.keys(((d=n.timeseries.trend[0])==null?void 0:d.values)||{}).map((u,m)=>i.jsx(In,{type:"monotone",dataKey:`values.${u}`,name:u,stroke:We[m%We.length],dot:!1,strokeWidth:2},u)),(!((h=n.timeseries.trend[0])!=null&&h.values)||Object.keys(n.timeseries.trend[0].values).length===0)&&i.jsx(In,{type:"monotone",dataKey:"count",stroke:"#3b82f6",dot:!1})]})})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("day-seasonality-chart","day-seasonality","Day of Week Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Day of Week Seasonality"}),i.jsx(_e,{text:"Average values for each day. Helps identify weekly patterns (e.g., lower on weekends)."})]}),i.jsx("div",{className:"h-64 w-full",id:"day-seasonality-chart",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.day_of_week,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"day",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#8884d8",radius:[4,4,0,0]})]})})})]})}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("month-seasonality-chart","month-seasonality","Monthly Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Monthly Seasonality"}),i.jsx(_e,{text:"Average values for each month. Helps identify yearly patterns or seasonal effects."})]}),i.jsx("div",{className:"h-64 w-full",id:"month-seasonality-chart",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.month_of_year,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"month",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#82ca9d",radius:[4,4,0,0]})]})})})]}),n.timeseries.autocorrelation&&n.timeseries.autocorrelation.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Autocorrelation (Lag Analysis)"}),i.jsxs("div",{className:"group relative ml-2",children:[i.jsx(jt,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none text-center",children:["Shows how much the current value depends on past values (lags). High bars indicate repeating patterns or seasonality.",i.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-800"})]})]})]}),i.jsx("button",{onClick:()=>l("autocorrelation-chart","autocorrelation","Autocorrelation (Lag Analysis)"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})]}),i.jsx("div",{className:"h-80 w-full pb-6",id:"autocorrelation-chart",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.autocorrelation,margin:{bottom:20},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"lag",tick:{fontSize:12,fill:a.axisColor},label:{value:"Lag (Days)",position:"insideBottom",offset:-15,fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{domain:[-1,1],tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"},formatter:u=>[u.toFixed(3),"Correlation"]}),i.jsx(jr,{y:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"corr",fill:"#f59e0b",radius:[2,2,0,0]})]})})})]})]})},Ed=({profile:n,onBarClick:l})=>{const a=at(),{data:d,typeMatched:h}=k.useMemo(()=>{var p;if(!n)return{data:[],typeMatched:!1};const m=n.dtype;return m==="Numeric"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(2)}`,fullName:`${Number(g.start).toFixed(2)} - ${Number(g.end).toFixed(2)}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Text"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(0)}`,fullName:`${Number(g.start).toFixed(0)} - ${Number(g.end).toFixed(0)} chars`,count:g.count,rawBin:g})),typeMatched:!0}:m==="DateTime"&&n.histogram?{data:n.histogram.map(g=>({name:new Date(g.start).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),fullName:`${new Date(g.start).toLocaleDateString()} - ${new Date(g.end).toLocaleDateString()}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Categorical"&&((p=n.categorical_stats)!=null&&p.top_k)?{data:n.categorical_stats.top_k.map(g=>({name:String(g.value).substring(0,15)+(String(g.value).length>15?"...":""),fullName:String(g.value),count:g.count,value:g.value})),typeMatched:!0}:{data:[],typeMatched:!1}},[n]);if(!n)return null;if(!h)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No distribution data available for this type"});if(d.length===0)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No data points"});const u=n.dtype;return i.jsxs("div",{className:"w-full h-full flex flex-col",children:[i.jsxs("div",{className:"flex-1 w-full min-h-[250px] relative",children:[n.normality_test&&i.jsxs("div",{className:"absolute top-0 right-0 bg-white/90 dark:bg-gray-800/90 p-2 rounded border border-gray-200 dark:border-gray-700 text-xs z-10 shadow-sm",children:[i.jsxs("div",{className:"font-semibold text-gray-700 dark:text-gray-300 mb-1 flex items-center",children:["Normality Test (",n.normality_test.test_name,")",i.jsx(_e,{text:"Normality tests are performed on a sample of up to 5,000 rows. Shapiro-Wilk is used for smaller datasets (<5,000), and Kolmogorov-Smirnov for larger ones. For very large datasets, rely on Skewness and Kurtosis.",align:"right"})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"p-value:"}),i.jsx("span",{className:`font-mono ${n.normality_test.is_normal?"text-green-600":"text-red-500"}`,children:n.normality_test.p_value.toExponential(2)})]}),i.jsx("div",{className:"mt-1 text-[10px] text-gray-400",children:n.normality_test.is_normal?"Likely Normal Distribution":"Likely Not Normal"})]}),i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:d,margin:{top:5,right:30,left:20,bottom:30},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:a.axisColor},interval:"preserveStartEnd",angle:-45,textAnchor:"end"}),i.jsx(Qe,{tick:{fontSize:11,fill:a.axisColor}}),i.jsx(He,{content:({active:m,payload:p})=>{if(m&&p&&p.length){const g=p[0].payload;return i.jsxs("div",{style:a.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg",children:[i.jsx("p",{className:"font-semibold mb-1",children:g.fullName}),i.jsxs("p",{children:["Count: ",g.count]}),l&&i.jsx("p",{className:"text-blue-300 mt-1 italic",children:"Click to filter"})]})}return null}}),i.jsx(Ve,{dataKey:"count",radius:[4,4,0,0],onClick:m=>l&&l(m),className:l?"cursor-pointer hover:opacity-80":"",children:d.map((m,p)=>i.jsx(bs,{fill:u==="Numeric"?"#3b82f6":"#8b5cf6"},`cell-${p}`))})]})})]}),i.jsx(ji,{caption:`Distribution data table for ${n.name}`,filename:`${n.name}-distribution`,columns:[{key:"fullName",label:"Bin / Value"},{key:"count",label:"Count"}],rows:d.map(m=>({fullName:m.fullName,count:m.count}))})]})};var Md=Symbol.for("react.lazy"),yi=vo[" use ".trim().toString()];function Ad(n){return typeof n=="object"&&n!==null&&"then"in n}function Ar(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Md&&"_payload"in n&&Ad(n._payload)}function zd(n){const l=Dd(n),a=k.forwardRef((d,h)=>{let{children:u,...m}=d;Ar(u)&&typeof yi=="function"&&(u=yi(u._payload));const p=k.Children.toArray(u),g=p.find(Rd);if(g){const w=g.props.children,y=p.map(b=>b===g?k.Children.count(w)>1?k.Children.only(null):k.isValidElement(w)?w.props.children:null:b);return i.jsx(l,{...m,ref:h,children:k.isValidElement(w)?k.cloneElement(w,void 0,y):null})}return i.jsx(l,{...m,ref:h,children:u})});return a.displayName=`${n}.Slot`,a}var Od=zd("Slot");function Dd(n){const l=k.forwardRef((a,d)=>{let{children:h,...u}=a;if(Ar(h)&&typeof yi=="function"&&(h=yi(h._payload)),k.isValidElement(h)){const m=Bd(h),p=Fd(u,h.props);return h.type!==k.Fragment&&(p.ref=d?So(d,m):m),k.cloneElement(h,p)}return k.Children.count(h)>1?k.Children.only(null):null});return l.displayName=`${n}.SlotClone`,l}var Id=Symbol("radix.slottable");function Rd(n){return k.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Id}function Fd(n,l){const a={...l};for(const d in l){const h=n[d],u=l[d];/^on[A-Z]/.test(d)?h&&u?a[d]=(...p)=>{const g=u(...p);return h(...p),g}:h&&(a[d]=h):d==="style"?a[d]={...h,...u}:d==="className"&&(a[d]=[h,u].filter(Boolean).join(" "))}return{...n,...a}}function Bd(n){var d,h;let l=(d=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:d.get,a=l&&"isReactWarning"in l&&l.isReactWarning;return a?n.ref:(l=(h=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:h.get,a=l&&"isReactWarning"in l&&l.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}const Wn=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Vn=kr,zr=(n,l)=>a=>{var d;if((l==null?void 0:l.variants)==null)return Vn(n,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:h,defaultVariants:u}=l,m=Object.keys(h).map(w=>{const y=a==null?void 0:a[w],b=u==null?void 0:u[w];if(y===null)return null;const x=Wn(y)||Wn(b);return h[w][x]}),p=a&&Object.entries(a).reduce((w,y)=>{let[b,x]=y;return x===void 0||(w[b]=x),w},{}),g=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((w,y)=>{let{class:b,className:x,...N}=y;return Object.entries(N).every(P=>{let[j,M]=P;return Array.isArray(M)?M.includes({...u,...p}[j]):{...u,...p}[j]===M})?[...w,b,x]:w},[]);return Vn(n,m,g,a==null?void 0:a.class,a==null?void 0:a.className)},Zd=zr("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"action-primary",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"action-secondary",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Wt=k.forwardRef(({className:n,variant:l,size:a,asChild:d=!1,...h},u)=>{const m=d?Od:"button";return i.jsx(m,{className:Zd({variant:l,size:a,className:n}),ref:u,...h})});Wt.displayName="Button";function Or(...n){return To(kr(n))}const $d=zr("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rt({className:n,variant:l,...a}){return i.jsx("div",{className:Or($d({variant:l}),n),...a})}function Hd({profile:n}){var a;let l=[];return n.histogram?l=n.histogram.map(d=>({name:String(d.start),count:d.count})):(a=n.categorical_stats)!=null&&a.top_k&&(l=n.categorical_stats.top_k.slice(0,10).map(d=>({name:String(d.value),count:d.count}))),i.jsxs("div",{className:"flex items-center justify-between w-full pr-4",children:[i.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground mr-auto",children:[i.jsx(Wd,{profile:n}),i.jsx(Vd,{profile:n})]}),l.length>0&&i.jsx("div",{className:"h-8 w-24 hidden sm:block opacity-70",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsx(nt,{data:l,children:i.jsx(Ve,{dataKey:"count",fill:n.dtype==="Numeric"?"#3b82f6":n.dtype==="Categorical"?"#8b5cf6":"#10b981",radius:[1,1,0,0]})})})})]})}function Wd({profile:n}){var l,a,d,h,u;return i.jsx(i.Fragment,{children:n.numeric_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Mean: ",i.jsx("span",{className:"font-mono text-foreground",children:(l=n.numeric_stats.mean)==null?void 0:l.toFixed(2)})]}),i.jsxs("span",{children:["Std: ",i.jsx("span",{className:"font-mono text-foreground",children:(a=n.numeric_stats.std)==null?void 0:a.toFixed(2)})]}),i.jsxs("span",{children:["Min: ",i.jsx("span",{className:"font-mono text-foreground",children:(d=n.numeric_stats.min)==null?void 0:d.toFixed(2)})]}),i.jsxs("span",{children:["Max: ",i.jsx("span",{className:"font-mono text-foreground",children:(h=n.numeric_stats.max)==null?void 0:h.toFixed(2)})]})]}):n.categorical_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Unique: ",i.jsx("span",{className:"font-mono text-foreground",children:n.categorical_stats.unique_count})]}),((u=n.categorical_stats.top_k)==null?void 0:u[0])&&i.jsxs("span",{children:["Top: ",i.jsx("span",{className:"font-mono text-foreground",children:String(n.categorical_stats.top_k[0].value).slice(0,20)})]})]}):null})}function Vd({profile:n}){return i.jsxs(i.Fragment,{children:[n.normality_test&&n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20",children:"Normal Dist"}),n.normality_test&&!n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20",children:"Not Normal"})]})}function qd({profile:n}){return i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"font-medium text-sm truncate",children:n.name}),i.jsx(rt,{variant:"outline",className:`text-[10px] h-5 px-1 ${pl(n.dtype)}`,children:n.dtype}),n.is_unique&&i.jsx(rt,{variant:"secondary",className:"text-[10px] h-5",children:"ID"}),n.is_constant&&i.jsx(rt,{variant:"destructive",className:"text-[10px] h-5",children:"Constant"})]})}function Ud({profile:n,isExcluded:l,onToggleExclude:a}){return i.jsxs("div",{className:"flex items-center gap-4 px-2",children:[i.jsxs("div",{className:"flex flex-col items-end w-24",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.missing_percentage>0?`${n.missing_percentage.toFixed(1)}% Missing`:"100% Present"}),i.jsx(_e,{text:"Green bar indicates the percentage of valid (non-null) data. Full green means no missing values.",align:"end",size:"sm"})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-100 dark:bg-gray-800 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${n.missing_percentage>0?"bg-amber-400":"bg-green-500"}`,style:{width:`${Math.max(100-n.missing_percentage,0)}%`}})})]}),i.jsx("div",{className:"h-8 w-[1px] bg-border mx-2"}),i.jsx(Wt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:d=>{d.stopPropagation(),a(n.name,!l)},title:l?"Include in analysis":"Exclude from analysis","aria-label":l?"Include in analysis":"Exclude from analysis",children:l?i.jsx(qt,{size:16}):i.jsx(fr,{size:16})})]})}function Gd({profile:n}){return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Statistics"}),i.jsxs("div",{className:"bg-background rounded-md border p-3 text-sm space-y-2 font-mono",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Missing"}),i.jsxs("span",{children:[n.missing_count," (",n.missing_percentage.toFixed(2),"%)"]})]}),n.numeric_stats&&i.jsx(Kd,{stats:n.numeric_stats,vif:n.vif}),n.text_stats&&i.jsx(Qd,{stats:n.text_stats}),n.categorical_stats&&i.jsx(Jd,{stats:n.categorical_stats})]})]})}function Kd({stats:n,vif:l}){var a,d,h,u,m,p,g,w;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mean"}),i.jsx("span",{children:(a=n.mean)==null?void 0:a.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Std Dev"}),i.jsx("span",{children:(d=n.std)==null?void 0:d.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Variance"}),i.jsx("span",{children:((h=n.variance)==null?void 0:h.toFixed(4))||Math.pow(n.std||0,2).toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min"}),i.jsx("span",{children:(u=n.min)==null?void 0:u.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"25% (Q1)"}),i.jsx("span",{children:(m=n.q25)==null?void 0:m.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Median"}),i.jsx("span",{children:(p=n.median)==null?void 0:p.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"75% (Q3)"}),i.jsx("span",{children:(g=n.q75)==null?void 0:g.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max"}),i.jsx("span",{children:(w=n.max)==null?void 0:w.toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Yd,{stats:n}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Xd,{stats:n,vif:l})]})}function Yd({stats:n}){var l,a;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Skewness"}),i.jsx("span",{children:(l=n.skewness)==null?void 0:l.toFixed(4)})]}),n.skewness!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.skewness)<.5?"↳ Symmetric":Math.abs(n.skewness)<1?"↳ Moderately Skewed":"↳ Highly Skewed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Kurtosis"}),i.jsx("span",{children:(a=n.kurtosis)==null?void 0:a.toFixed(4)})]}),n.kurtosis!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.kurtosis)<.5?"↳ Mesokurtic (Normal-like)":n.kurtosis>0?"↳ Leptokurtic (Heavy Tails)":"↳ Platykurtic (Light Tails)"})]})}function Xd({stats:n,vif:l}){return i.jsxs(i.Fragment,{children:[n.zeros_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Zeros"}),i.jsx("span",{children:n.zeros_count})]}),n.negatives_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Negatives"}),i.jsx("span",{children:n.negatives_count})]}),l!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:["VIF",i.jsx(_e,{text:"Variance Inflation Factor. VIF > 5 = high multicollinearity, VIF > 10 = severe.",size:"sm"})]}),i.jsx("span",{className:l>5?"text-red-500 font-semibold":l>2?"text-amber-500":"text-green-500",children:l.toFixed(2)})]})]})}function Qd({stats:n}){var l;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Avg Length"}),i.jsxs("span",{children:[(l=n.avg_length)==null?void 0:l.toFixed(1)," chars"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min Length"}),i.jsx("span",{children:n.min_length})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max Length"}),i.jsx("span",{children:n.max_length})]}),n.sentiment_distribution&&i.jsx(ec,{distribution:n.sentiment_distribution}),n.common_words&&n.common_words.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Common Words"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.common_words.slice(0,10).map((a,d)=>i.jsxs(rt,{variant:"secondary",className:"text-[10px] h-4",children:[a.word??a.value," (",a.count,")"]},d))})]})]})}function Jd({stats:n}){var l,a,d,h;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Unique"}),i.jsx("span",{children:n.unique_count})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mode"}),i.jsx("span",{className:"truncate max-w-[100px]",title:String((a=(l=n.top_k)==null?void 0:l[0])==null?void 0:a.value),children:String(((h=(d=n.top_k)==null?void 0:d[0])==null?void 0:h.value)||"-")})]}),n.rare_labels_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Rare Labels"}),i.jsx("span",{children:n.rare_labels_count})]}),n.top_k&&n.top_k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Top Categories"}),i.jsx("div",{className:"space-y-1",children:n.top_k.slice(0,5).map((u,m)=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"truncate max-w-[120px]",title:String(u.value),children:String(u.value)}),i.jsx("span",{className:"text-muted-foreground",children:u.count})]},m))})]})]})}function ec({distribution:n}){const l=n.positive||0,a=n.neutral||0,d=n.negative||0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Sentiment"}),i.jsxs("div",{className:"flex h-3 rounded-full overflow-hidden w-full bg-secondary",children:[i.jsx("div",{className:"bg-green-500 h-full",style:{width:`${l*100}%`},title:`Positive: ${(l*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-gray-400 h-full",style:{width:`${a*100}%`},title:`Neutral: ${(a*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-red-500 h-full",style:{width:`${d*100}%`},title:`Negative: ${(d*100).toFixed(1)}%`})]}),i.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1 px-1",children:[i.jsxs("span",{children:["Pos: ",(l*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neu: ",(a*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neg: ",(d*100).toFixed(0),"%"]})]})]})}const qn=({profile:n,isExpanded:l,onToggleExpand:a,onToggleExclude:d,isExcluded:h,handleAddFilter:u})=>{const m=k.useRef(null),[p,g]=k.useState("idle"),w=async()=>{if(m.current){g("downloading");try{const b=document.documentElement.classList.contains("dark"),x=await vs(m.current,{backgroundColor:b?"#1f2937":"#ffffff",pixelRatio:2}),N=document.createElement("a");N.href=x,N.download=`${n.name}_distribution.png`,N.click()}catch(b){console.error("Failed to download chart",b),Ht.error("Chart download failed",String(b))}finally{g("done"),setTimeout(()=>g("idle"),1200)}}},y=b=>{if(n.dtype==="Categorical"||n.dtype==="Boolean"){const x=b.value!==void 0?b.value:b.name;u(n.name,x,"==")}else n.dtype==="Numeric"&&b.rawBin&&u(n.name,b.rawBin.start,">=")};return i.jsxs("div",{className:`border rounded-lg mb-2 transition-all ${l?"border-primary/50 shadow-md bg-card/50":"border-border bg-card"}`,children:[i.jsxs("div",{className:"flex items-center p-3 hover:bg-accent/50 cursor-pointer rounded-t-lg",...wi(a),children:[i.jsx("div",{className:"mr-2 text-muted-foreground",children:l?i.jsx(bi,{size:18}):i.jsx(mr,{size:18})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(qd,{profile:n}),!l&&i.jsx(Hd,{profile:n})]}),i.jsx(Ud,{profile:n,isExcluded:h,onToggleExclude:d})]}),l&&i.jsx("div",{className:"p-4 border-t border-border bg-card/30 animate-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch",children:[i.jsx(Gd,{profile:n}),i.jsxs("div",{className:"md:col-span-2 flex flex-col min-h-[300px]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Distribution"}),i.jsx(Wt,{size:"icon",variant:"outline",className:"h-8 w-8",title:"Download Chart",onClick:w,disabled:p!=="idle",children:p==="downloading"?i.jsx(be,{size:16,className:"animate-spin"}):p==="done"?i.jsx($t,{size:16,className:"text-green-500"}):i.jsx(ke,{size:16})})]}),i.jsx("div",{className:"flex-1 bg-background rounded-md border p-4 min-h-0",ref:m,children:i.jsx(Ed,{profile:n,onBarClick:y})})]})]})})]})},Dr=k.forwardRef(({className:n,type:l,...a},d)=>i.jsx("input",{type:l,className:Or("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:d,...a}));Dr.displayName="Input";const tc=({profile:n,handleToggleExclude:l,handleAddFilter:a})=>{const[d,h]=k.useState(""),[u,m]=k.useState(new Set);Eo(()=>m(new Set),u.size>0);const p=x=>{const N=new Set(u);N.has(x)?N.delete(x):N.add(x),m(N)},g=()=>{m(new Set(Object.keys(n.columns)))},w=()=>{m(new Set)},y=Object.values(n.columns).filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),b=(n.excluded_columns??[]).filter(x=>x.toLowerCase().includes(d.toLowerCase()));return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4 bg-card p-2 rounded-lg border",children:[i.jsxs("div",{className:"relative flex-1 max-w-sm",children:[i.jsx(bo,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),i.jsx(Dr,{placeholder:"Search variables...",className:"pl-8 h-9",value:d,onChange:x=>h(x.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Wt,{variant:"outline",size:"sm",onClick:g,className:"h-9 text-xs",children:"Expand All"}),i.jsx(Wt,{variant:"outline",size:"sm",onClick:w,className:"h-9 text-xs",children:"Collapse All"})]}),i.jsxs("div",{className:"ml-auto text-sm text-muted-foreground px-2",children:["Showing ",y.length," of ",Object.keys(n.columns).length," variables"]})]}),i.jsxs("div",{className:"space-y-2",children:[y.map(x=>i.jsx(qn,{profile:x,isExpanded:u.has(x.name),onToggleExpand:()=>p(x.name),onToggleExclude:l,isExcluded:!1,handleAddFilter:a},x.name)),b.length>0&&i.jsxs("div",{className:"mt-8",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2 text-muted-foreground",children:["Excluded Variables ",i.jsx(rt,{variant:"secondary",children:b.length})]}),b.map(x=>i.jsx(qn,{profile:{name:x,dtype:"Excluded",missing_count:0,missing_percentage:0},isExpanded:u.has(x),onToggleExpand:()=>p(x),onToggleExclude:l,isExcluded:!0,handleAddFilter:a},x))]})]})]})};function ic({profile:n,scatterX:l,scatterY:a,scatterZ:d,scatterColor:h,is3D:u}){return i.jsx(i.Fragment,{children:l&&a?u&&d?i.jsx(Lr,{data:n.sample_data??[],xKey:l,yKey:a,zKey:d,labelKey:h||void 0,xLabel:l,yLabel:a,zLabel:d}):i.jsx(Pr,{data:n.sample_data??[],xKey:l,yKey:a,labelKey:h||void 0,xLabel:l,yLabel:a}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm",children:"Select X and Y variables to generate scatter plot."})})}const sc=({profile:n,downloadChart:l,scatterX:a,setScatterX:d,scatterY:h,setScatterY:u,scatterZ:m,setScatterZ:p,scatterColor:g,setScatterColor:w,is3D:y,setIs3D:b})=>{const x=k.useMemo(()=>(n==null?void 0:n.sample_data)??[],[n==null?void 0:n.sample_data]),N=k.useMemo(()=>Cr(Gt(x,g||void 0)),[x,g]),P=k.useMemo(()=>{const S=[{key:a,label:a||"X"},{key:h,label:h||"Y"}];return y&&m&&S.push({key:m,label:m}),g&&S.push({key:g,label:g}),S},[a,h,m,g,y]),j=k.useMemo(()=>x.map(S=>S),[x]);if(!(n!=null&&n.columns)||!(n!=null&&n.sample_data))return i.jsx(Ut,{icon:i.jsx(Bt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Data Available",description:"Sample data is required for bivariate analysis."});const M=!!(a&&h&&n.sample_data.length>0),I=M?"Download Chart":"Select X and Y variables to enable download";return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Bt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Bivariate Analysis (Scatter Plot)",i.jsx(_e,{text:"Visualize the relationship between two numeric variables."})]}),i.jsx("button",{disabled:!M,onClick:()=>l("bivariate-chart","bivariate-analysis","Bivariate Analysis",`${a} vs ${h}`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:I,"aria-label":I,children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-6 items-end",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"X Axis"}),i.jsxs("select",{value:a,onChange:S=>d(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Y Axis"}),i.jsxs("select",{value:h,onChange:S=>u(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),y&&i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Z Axis"}),i.jsxs("select",{value:m,onChange:S=>p(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Color By"}),i.jsxs("select",{value:g,onChange:S=>w(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"None"}),Object.values(n.columns).map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsx("button",{onClick:()=>b(!y),className:`p-2 rounded-md border transition-colors ${y?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,title:"Toggle 3D View","aria-label":"Toggle 3D View",children:i.jsx(pr,{className:"w-5 h-5"})})]}),i.jsx("div",{id:"bivariate-chart",children:i.jsx(ic,{profile:n,scatterX:a,scatterY:h,scatterZ:m,scatterColor:g,is3D:y})}),g&&N.length>0&&i.jsx(js,{entries:N}),i.jsx(ji,{caption:"Bivariate scatter plot data",filename:"bivariate-analysis",columns:P,rows:j})]})},nc=({profile:n})=>{var l,a;return(a=(l=n==null?void 0:n.outliers)==null?void 0:l.top_outliers)!=null&&a.length?i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(xi,{className:"w-5 h-5 mr-2 text-red-500"}),"Outlier Analysis (",n.outliers.method,")",i.jsx(_e,{text:"Detects anomalous rows using Isolation Forest. Lower scores indicate higher anomaly."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Total Outliers"}),i.jsx("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:n.outliers.total_outliers})]}),i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Percentage"}),i.jsxs("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:[n.outliers.outlier_percentage.toFixed(2),"%"]})]})]}),i.jsx("h4",{className:"text-md font-medium text-gray-900 dark:text-white mb-3",children:"Top Anomalous Rows"}),i.jsx("div",{className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Row Index"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Anomaly Score"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Why is this an outlier?"}),n.outliers.top_outliers[0]&&Object.keys(n.outliers.top_outliers[0].values??{}).slice(0,5).map(d=>i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:d},d))]})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.outliers.top_outliers.map(d=>{var h;return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-gray-500",children:d.index}),i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-red-600",children:((h=d.score)==null?void 0:h.toFixed(4))??"β€”"}),i.jsx("td",{className:"px-4 py-3 text-sm",children:d.explanation?i.jsx("div",{className:"space-y-1",children:d.explanation.map((u,m)=>i.jsxs("div",{className:"text-xs",children:[i.jsxs("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:[u.feature,":"]})," ",i.jsx("span",{className:"text-red-600 dark:text-red-400",children:u.value.toFixed(2)})," ",i.jsxs("span",{className:"text-gray-400",children:["(Median: ",u.median.toFixed(2),", Diff: ",u.diff_pct.toFixed(0),"%)"]})]},m))}):i.jsx("span",{className:"text-gray-400 text-xs",children:"No explanation available"})}),Object.entries(d.values??{}).slice(0,5).map(([u,m])=>i.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-300",children:typeof m=="number"?m.toFixed(2):String(m)},u))]},d.index)})})]})})]}):i.jsx(Ut,{icon:i.jsx(xi,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Outlier Data",description:"Outlier analysis did not return any results."})},rc=n=>{if(n===null||Number.isNaN(n))return"rgba(243, 244, 246, 1)";const l=Math.max(.4,Math.abs(n));return n>0?`rgba(239, 68, 68, ${l})`:`rgba(59, 130, 246, ${l})`},ac=()=>i.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",role:"img","aria-label":"Correlation color scale from negative one (blue) through zero (white) to positive one (red)",children:[i.jsx("span",{children:"βˆ’1"}),i.jsx("div",{className:"h-3 w-40 rounded-sm border border-gray-200 dark:border-gray-700",style:{background:"linear-gradient(to right, rgba(59,130,246,1), rgba(59,130,246,0.4), rgba(243,244,246,1), rgba(239,68,68,0.4), rgba(239,68,68,1))"},"aria-hidden":"true"}),i.jsx("span",{children:"0"}),i.jsx("span",{className:"w-6"}),i.jsx("span",{children:"+1"}),i.jsx("span",{className:"ml-2 italic text-gray-500 dark:text-gray-400",children:"Negative (blue) Β· Positive (red)"})]}),Un=({data:n})=>{const a=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(0,20),[n]),d=k.useMemo(()=>((n==null?void 0:n.values)??[]).slice(0,20).map(p=>p.slice(0,20)),[n]),h=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(20),[n]),u=k.useMemo(()=>n!=null&&n.columns?n.columns.map((p,g)=>{const w={variable:p};return n.columns.forEach((y,b)=>{var x;w[y]=((x=n.values[g])==null?void 0:x[b])??null}),w}):[],[n]);if(!n||!n.columns)return i.jsx("div",{children:"No correlation data available"});const m=n.columns.length>20;return i.jsxs("div",{className:"overflow-x-auto p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx(ac,{}),m&&i.jsxs("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-200 text-sm rounded-md",children:["Showing the first ",20," of ",n.columns.length," columns (",h.length," omitted: ",h.slice(0,5).join(", "),h.length>5?", …":"","). Use the data table below for the full matrix."]}),i.jsx("div",{className:"inline-block min-w-full",children:i.jsxs("div",{className:"grid gap-1",style:{gridTemplateColumns:`100px repeat(${a.length}, minmax(50px, 1fr))`,paddingTop:"4.5rem"},children:[i.jsx("div",{className:"p-2"}),a.map((p,g)=>i.jsx("div",{className:"relative p-2 text-xs font-medium text-gray-700 dark:text-gray-300",title:p,children:i.jsx("span",{className:"absolute bottom-1 left-1/2 whitespace-nowrap origin-bottom-left",style:{transform:"rotate(-45deg)"},children:p})},g)),a.map((p,g)=>i.jsxs(Zt.Fragment,{children:[i.jsx("div",{className:"p-2 text-xs font-medium truncate text-right pr-4 text-gray-700 dark:text-gray-300",title:p,children:p}),(d[g]??[]).map((w,y)=>i.jsx("div",{className:"h-10 w-full flex items-center justify-center text-[10px] text-gray-900 dark:text-gray-100 rounded-sm cursor-help transition-opacity hover:opacity-80",style:{backgroundColor:rc(w)},title:`${p} vs ${a[y]}: ${w!==null?w.toFixed(3):"N/A"}`,children:w!==null?w.toFixed(2):""},y))]},g))]})}),i.jsx(ji,{caption:"Full correlation matrix data table",filename:"correlation-matrix",columns:[{key:"variable",label:"Variable"},...n.columns.map(p=>({key:p,label:p}))],rows:u})]})};function gs({target:n,reason:l}){if(!n||!l)return null;const a={categorical:`The selected target β€œ${n}” is treated as categorical and is omitted from numeric-only causal discovery and Pearson correlations. Use Target Analysis for categorical associations.`,excluded:`The selected target β€œ${n}” is excluded from this report's analysis.`,unsupported:`The selected target β€œ${n}” is not supported by numeric-only causal discovery or Pearson correlations.`};return i.jsx("p",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:a[l]})}const oc=({profile:n})=>{const[l,a]=k.useState(null),[d,h]=k.useState(null);if(!(n!=null&&n.correlations))return i.jsxs(i.Fragment,{children:[i.jsx(gs,{target:n==null?void 0:n.target_col,reason:n==null?void 0:n.causal_target_exclusion_reason}),i.jsx(Ut,{icon:i.jsx(yt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Correlation Data",description:"Not enough numeric columns to compute correlations."})]});const u=async(m,p,g)=>{if(m){a(g);try{const w=vr(),y=20,b=m.columns.slice(0,y),x=m.values.slice(0,y).map(A=>A.slice(0,y)),N=60,P=document.createElement("canvas"),j=P.getContext("2d");if(!j)return;j.font="12px sans-serif";let M=0;b.forEach(A=>{const z=j.measureText(A).width;z>M&&(M=z)});const I=M+40,S=M*.7+60,K=60,fe=I+b.length*N+50,ae=S+b.length*N+K+50;P.width=fe,P.height=ae,j.fillStyle=w.bgColor,j.fillRect(0,0,fe,ae),j.fillStyle=w.textColor,j.font="bold 24px sans-serif",j.textAlign="center",j.fillText(p,fe/2,40);const ie=A=>{if(A===null)return w.bgColor==="#ffffff"?"#f3f4f6":"#374151";const z=Math.max(.2,Math.abs(A));return A>0?`rgba(239, 68, 68, ${z})`:`rgba(59, 130, 246, ${z})`};j.font="12px sans-serif",j.textBaseline="middle",x.forEach((A,z)=>{j.fillStyle=w.textColor,j.textAlign="right",j.fillText(b[z],I-10,S+K+z*N+N/2),A.forEach((W,B)=>{const V=I+B*N,re=S+K+z*N;j.fillStyle=ie(W),j.fillRect(V,re,N-2,N-2),W!==null&&(j.fillStyle=Math.abs(W)>.5?"#ffffff":w.textColor,j.textAlign="center",j.fillText(W.toFixed(2),V+N/2,re+N/2))})}),j.save(),b.forEach((A,z)=>{const W=I+z*N+N/2,B=S+K-10;j.translate(W,B),j.rotate(-Math.PI/4),j.fillStyle=w.textColor,j.textAlign="left",j.fillText(A,0,0),j.rotate(Math.PI/4),j.translate(-W,-B)}),j.restore();const we=document.createElement("a");we.download=g,we.href=P.toDataURL("image/png"),we.click()}finally{a(null),h(g),setTimeout(()=>h(null),1200)}}};return i.jsxs("div",{className:"space-y-8",children:[i.jsx(gs,{target:n.target_col,reason:n.causal_target_exclusion_reason}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Feature Correlations (Multicollinearity)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation between features only. Use this to detect redundant variables (multicollinearity)."}),i.jsx("button",{onClick:()=>u(n.correlations,"Feature Correlations","feature-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="feature-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="feature-correlations.png"?i.jsx($t,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Un,{data:n.correlations})]}),n.correlations_with_target&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-green-500"}),"Target Correlations (Feature Selection)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation including the target variable. Use this to identify the most predictive features."}),i.jsx("button",{onClick:()=>u(n.correlations_with_target,"Target Correlations","target-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="target-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="target-correlations.png"?i.jsx($t,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Un,{data:n.correlations_with_target})]})]})},lc=({profile:n,excludedCols:l,handleToggleExclude:a})=>{var h;if(!((h=n==null?void 0:n.sample_data)!=null&&h.length))return i.jsx(Ut,{icon:i.jsx(hr,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Sample Data",description:"No sample rows available for this dataset."});const d=Object.keys(n.sample_data[0]||{}).filter(u=>!l.includes(u)&&!u.endsWith("_encoded"));return i.jsxs("div",{className:"mt-4 overflow-x-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsx("tr",{children:d.map(u=>i.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider group",children:i.jsxs("div",{className:"flex items-center gap-2",children:[u,i.jsx("button",{onClick:m=>{m.stopPropagation(),a(u,!0)},className:"p-1 rounded transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 hover:bg-red-100 text-gray-400 hover:text-red-500 dark:hover:bg-red-900/30",title:"Exclude from analysis","aria-label":"Exclude from analysis",children:i.jsx(qt,{className:"w-3 h-3"})})]})},u))})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.sample_data.slice(0,50).map((u,m)=>i.jsx("tr",{children:d.map((p,g)=>i.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:u[p]!==null?String(u[p]):i.jsx("span",{className:"italic text-gray-400",children:"null"})},g))},m))})]}),n.sample_data.length>50&&i.jsxs("div",{className:"p-4 text-center text-sm text-gray-500 border-t border-gray-200 dark:border-gray-700",children:["Showing first 50 rows of ",n.sample_data.length," sample rows."]})]})},ps=150,Gn=40,dc=()=>{const n=document.documentElement.classList.contains("dark");return{borderRadius:"5px",padding:"10px",width:ps,textAlign:"center",borderWidth:"1px",borderStyle:"solid",backgroundColor:n?"#222529":"#ffffff",color:n?"#f3f4f6":"#17102b",borderColor:n?"#666d77":"#b9b3c8"}},cc=n=>{const l=document.documentElement.classList.contains("dark");return n==="directed"?l?"#9acbfa":"#3b4bc4":l?"#abafb7":"#6b6485"},hc=(n,l)=>{const a={type:as.ArrowClosed,color:l};return n==="bidirected"?{markerStart:a,markerEnd:a}:n==="directed"?{markerEnd:a}:{}},uc=({graph:n})=>{const[l,a,d]=Qn([]),[h,u,m]=Jn([]),[p,g]=k.useState(0);k.useEffect(()=>{const y=new MutationObserver(()=>{g(b=>b+1)});return y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>y.disconnect()},[]);const w=k.useCallback((y,b)=>{try{const x=new _i.graphlib.Graph;return x.setDefaultEdgeLabel(()=>({})),x.setGraph({rankdir:"LR",nodesep:80,ranksep:200}),y.forEach(P=>{x.setNode(P.id,{width:ps,height:Gn})}),b.forEach(P=>{x.setEdge(P.source,P.target)}),_i.layout(x),{nodes:y.map(P=>{const j=x.node(P.id);return j?{...P,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:j.x-ps/2,y:j.y-Gn/2}}:{...P,position:{x:Math.random()*500,y:Math.random()*500}}}),edges:b}}catch(x){return console.error("Dagre layout failed:",x),{nodes:y.map((P,j)=>({...P,position:{x:j%3*250,y:Math.floor(j/3)*100}})),edges:b}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0){a([]),u([]);return}const y=new Map(n.nodes.map((P,j)=>[P.id,`causal-node-${j}`])),b=n.nodes.map((P,j)=>({id:`causal-node-${j}`,data:{label:P.label},position:{x:0,y:0},style:dc()})),x=n.edges.flatMap((P,j)=>{const M=y.get(P.source),I=y.get(P.target);if(M===void 0||I===void 0)return[];const S=cc(P.type);return[{id:`e${j}`,source:M,target:I,animated:!0,type:"default",label:P.type==="directed"?"causes":P.type==="bidirected"?"confounded":"related",labelStyle:{fill:"hsl(var(--foreground))",fontSize:12},labelBgStyle:{fill:"hsl(var(--card))"},style:{stroke:S,strokeDasharray:P.type==="directed"?"0":"5 5"},...hc(P.type,S)}]}),N=w(b,x);a(N.nodes),u(N.edges)},[n,w,a,u,p]),i.jsx("div",{className:"space-y-2",children:i.jsx("div",{style:{width:"100%",height:"500px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(er,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(tr,{className:"dark:bg-gray-900"}),i.jsx(ir,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})})})};function mc(n){switch(n){case"all":return"This graph includes all eligible numeric variables; no feature cap was needed.";case"target_correlation":return"This graph includes the selected numeric target and up to 14 numeric features with the strongest absolute Pearson correlations to it.";case"variance":return"This graph includes up to 15 of the highest-variance numeric variables; no eligible numeric target was used for selection.";default:return"Causal discovery is limited to up to 15 numeric variables. Selection details were not recorded for this report."}}const fc=({profile:n})=>{var m;const l=n.causal_graph,[a,d]=k.useState("idle"),h=k.useCallback(()=>{const p=document.querySelector("#causal-chart .react-flow__viewport");if(!p)return;d("downloading");const w=document.documentElement.classList.contains("dark")?"#111827":"#f9fafb";vs(p,{backgroundColor:w,pixelRatio:2,filter:y=>{const b=y==null?void 0:y.classList;return b?!b.contains("react-flow__controls")&&!b.contains("react-flow__minimap"):!0}}).then(y=>{const b=document.createElement("a");b.download="causal-discovery.png",b.href=y,b.click()}).catch(y=>{console.error("Causal graph download failed",y),Ht.error("Causal graph download failed",String(y))}).finally(()=>{d("done"),setTimeout(()=>d("idle"),1200)})},[]),u=i.jsx(gs,{target:n.target_col,reason:n.causal_target_exclusion_reason});return(m=l==null?void 0:l.nodes)!=null&&m.length?i.jsx("div",{className:"space-y-6 mt-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Causal Discovery (PC Algorithm)",i.jsx(_e,{text:"Inferred causal structure using the Peter-Clark algorithm. Arrows (A->B) suggest A causes B. Lines (A-B) suggest correlation without clear direction. Bidirected arrows (A<->B) suggest a hidden common cause."})]}),i.jsx("button",{onClick:h,disabled:a!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download Chart",children:a==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):a==="done"?i.jsx($t,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:[i.jsx("strong",{children:"Disclaimer:"})," This graph is inferred purely from observational data. Correlation does not imply causation. Use this as a hypothesis generation tool, not absolute truth."]}),u,i.jsx("div",{id:"causal-chart",children:i.jsx(uc,{graph:l})}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:mc(l.selection_method)})]})}):i.jsxs("div",{className:"p-8 text-center text-gray-500",children:[i.jsx(wt,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"No causal graph available. This might be because there are fewer than 2 numeric columns or the analysis failed."}),u]})},Kn=220,Yn=100;function gc(n,l){if(n.feature===void 0||n.threshold===void 0)return"";const a=l==null?void 0:l[n.feature];if(a){const d=a.filter((h,u)=>u<=n.threshold);return`${n.feature} in [${d.join(", ")}]`}return`${n.feature} <= ${n.threshold.toFixed(2)}`}const pc=({data:n})=>{const l=n.is_leaf,a=n.value.reduce((u,m)=>u+m,0),d=n.value.length>0?Math.max(...n.value):0,h=a>0?d/a*100:0;return i.jsxs("div",{className:`px-4 py-3 shadow-md rounded-md border-2 ${l?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-blue-500 bg-white dark:bg-gray-800"} min-w-[200px]`,children:[i.jsx(Dn,{type:"target",position:vt.Left,className:"w-3 h-3 !bg-gray-400"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("div",{className:"font-bold text-sm text-gray-900 dark:text-white border-b pb-1 mb-1",children:l?i.jsxs("span",{className:"flex items-center gap-2 text-green-700 dark:text-green-400",children:[i.jsx(ar,{className:"w-4 h-4"}),"Prediction: ",n.class_name]}):i.jsxs("span",{className:"flex items-center gap-2 text-blue-700 dark:text-blue-400",children:[i.jsx(wo,{className:"w-4 h-4"}),gc(n,n.categories)]})}),i.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[i.jsxs(br,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(cs,{children:[i.jsx(hs,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Samples:"})}),i.jsx(us,{children:i.jsx("p",{children:"The number of data points that fall into this rule bucket."})})]}),i.jsx("span",{className:"font-mono",children:n.samples})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(cs,{children:[i.jsx(hs,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Purity:"})}),i.jsx(us,{children:i.jsx("p",{className:"max-w-xs",children:"The percentage of samples in this node that belong to the majority class. Higher purity means a clearer separation."})})]}),i.jsxs("span",{className:`font-mono ${h>80?"text-green-600 font-bold":""}`,children:[h.toFixed(1),"%"]})]})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full mt-1 overflow-hidden flex",children:n.value.map((u,m)=>i.jsx("div",{style:{width:`${a>0?u/a*100:0}%`,backgroundColor:`hsl(${m*137.5}, 70%, 50%)`},title:`Class ${m}: ${u}`},m))})]})]}),i.jsx(Dn,{type:"source",position:vt.Right,className:"w-3 h-3 !bg-gray-400"})]})},xc={decision:pc},_c=({tree:n})=>{const[l,a,d]=Qn([]),[h,u,m]=Jn([]),p=k.useCallback((g,w)=>{try{const y=new _i.graphlib.Graph;return y.setDefaultEdgeLabel(()=>({})),y.setGraph({rankdir:"LR",nodesep:50,ranksep:150}),g.forEach(x=>{y.setNode(x.id,{width:Kn,height:Yn})}),w.forEach(x=>{y.setEdge(x.source,x.target)}),_i.layout(y),{nodes:g.map(x=>{const N=y.node(x.id);return{...x,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:N?N.x-Kn/2:0,y:N?N.y-Yn/2:0}}}),edges:w}}catch(y){return console.error("Dagre layout failed:",y),{nodes:g,edges:w}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0)return;const g=n.nodes.map(b=>({id:b.id.toString(),type:"decision",data:{...b,categories:n.categories},position:{x:0,y:0}})),w=[];n.nodes.forEach(b=>{b.children&&b.children.length>0&&(b.children[0]!==void 0&&w.push({id:`e${b.id}-${b.children[0]}`,source:b.id.toString(),target:b.children[0].toString(),label:"True",type:"smoothstep",style:{stroke:"#22c55e",strokeWidth:2},labelStyle:{fill:"#22c55e",fontWeight:700},markerEnd:{type:as.ArrowClosed,color:"#22c55e"}}),b.children[1]!==void 0&&w.push({id:`e${b.id}-${b.children[1]}`,source:b.id.toString(),target:b.children[1].toString(),label:"False",type:"smoothstep",style:{stroke:"#ef4444",strokeWidth:2},labelStyle:{fill:"#ef4444",fontWeight:700},markerEnd:{type:as.ArrowClosed,color:"#ef4444"}}))});const y=p(g,w);a(y.nodes),u(y.edges)},[n,p,a,u]),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{style:{width:"100%",height:"600px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(er,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,nodeTypes:xc,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(tr,{className:"dark:bg-gray-900",gap:16,size:1}),i.jsx(ir,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic flex items-center gap-1",children:[i.jsx(jt,{className:"w-3 h-3"}),"This tree is a ",i.jsx("strong",{children:"surrogate (explanatory) model"})," trained on your data to surface readable rules. Do not treat it as a production-grade predictor. Green paths mean the condition is met (True); red paths mean it is not (False)."]})]})},yc=({profile:n})=>{const l=n==null?void 0:n.rule_tree,a=at();return l?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[i.jsx(ls,{className:"w-5 h-5 text-blue-600"}),"Decision Tree Analysis"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["This is a ",i.jsx("strong",{children:"surrogate model"}),": a simple decision tree trained on your dataset to approximate the relationship between features and the target. Use it for interpretation (human-readable rules), not as a causal claim or a production model."]})]}),l.accuracy&&i.jsx(br,{children:i.jsxs(cs,{children:[i.jsx(hs,{asChild:!0,children:i.jsxs("div",{className:"text-sm bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 px-3 py-1 rounded-full border border-blue-200 dark:border-blue-800 cursor-help",children:["Tree Fidelity: ",i.jsxs("strong",{children:[(l.accuracy*100).toFixed(1),"%"]})]})}),i.jsx(us,{children:i.jsxs("p",{className:"max-w-xs",children:[i.jsx("strong",{children:"Tree Fidelity:"})," How closely this surrogate tree matches the patterns in your data (higher is better). If fidelity is low, treat extracted rules as exploratory."]})})]})})]}),i.jsx(_c,{tree:l})]}),l.feature_importances&&l.feature_importances.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[i.jsx(jo,{className:"w-5 h-5 text-blue-600"}),"Feature Importance (Surrogate Model)"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:["Importances reflect what the ",i.jsx("strong",{children:"surrogate tree"})," used to split the data. They may differ from a more complex model’s importances."]}),i.jsx("div",{className:"h-80 w-full",children:i.jsx(Ie,{width:"100%",height:"100%",children:i.jsxs(nt,{data:l.feature_importances.slice(0,10),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!0,vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{type:"number",domain:[0,"auto"],hide:!0}),i.jsx(Qe,{dataKey:"feature",type:"category",width:150,tick:{fontSize:12,fill:a.axisColor},interval:0}),i.jsx(He,{formatter:d=>[(d*100).toFixed(1)+"%","Importance"],contentStyle:a.tooltipContentStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"importance",radius:[0,4,4,0],barSize:20,children:l.feature_importances.slice(0,10).map((d,h)=>i.jsx(bs,{fill:`hsl(217, 91%, ${60-h*3}%)`},`cell-${h}`))})]})})}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 text-center",children:"Showing top 10 features driving the decision rules."})]}),l.rules&&l.rules.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4",children:"Segmentation-Decision Tree (Surrogate Model)"}),i.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:l.rules.map((d,h)=>i.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-900 rounded border border-gray-100 dark:border-gray-700 text-sm font-mono text-gray-700 dark:text-gray-300",children:d},h))})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8",children:[i.jsx(ls,{className:"w-12 h-12 mb-4 text-gray-300 dark:text-gray-600"}),i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Decision Tree Not Available"}),i.jsx("p",{className:"text-center max-w-md mb-4",children:"No tree was generated. This usually happens if the dataset is too small, or if a target column was not selected for analysis."}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 dark:bg-amber-900/20 dark:text-amber-400 px-4 py-2 rounded-md",children:[i.jsx(bt,{className:"w-4 h-4"}),i.jsxs("span",{children:["Ensure you have selected a ",i.jsx("strong",{children:"Target Column"})," and re-run the analysis."]})]})]})},vc=20,_t=new Map;function bc(n,l){if(_t.delete(n),_t.set(n,l),_t.size>vc){const a=_t.keys().next().value;a!==void 0&&_t.delete(a)}}const wc=({datasetId:n,measureCol:l,measureAgg:a,columns:d,initialFilters:h})=>{const[u,m]=k.useState([]),[p,g]=k.useState(!1),[w,y]=k.useState(null),[b,x]=k.useState([null]),N=k.useRef(null),P=k.useRef(null),j=k.useRef(0),[M,I]=k.useState([]);k.useEffect(()=>{N.current&&N.current.scrollTo({left:N.current.scrollWidth,behavior:"smooth"})},[u.length]);const S=()=>{if(!P.current)return;const A=[],z=P.current.getBoundingClientRect();u.forEach((W,B)=>{if(B>=u.length-1)return;const V=W.selectedItemName;if(!V)return;const re=`node-${B}-${V}`,Z=document.getElementById(re);if(Z){const oe=Z.getBoundingClientRect(),ee=oe.right-z.left,ge=oe.top+oe.height/2-z.top;let O,de;const D=u[B+1];if(!D)return;if(D.selectedItemName){const q=`node-${B+1}-${D.selectedItemName}`,Q=document.getElementById(q);if(Q){const se=Q.getBoundingClientRect();O=se.left-z.left,de=se.top+se.height/2-z.top}else return}else{const q=`list-${B+1}`,Q=document.getElementById(q);if(Q){const se=Q.getBoundingClientRect();O=se.left-z.left,de=se.top+se.height/2-z.top}else return}if(O!==void 0&&de!==void 0){const q=(ee+O)/2,Q=`M ${ee} ${ge} C ${q} ${ge}, ${q} ${de}, ${O} ${de}`;A.push({d:Q})}}}),I(A)};Zt.useLayoutEffect(()=>{S()},[u,w]),k.useEffect(()=>{if(u.length>0){const A=`${n}-${l}-${a}`;bc(A,{levels:u,splitPath:b})}},[u,b,n,l,a]),k.useEffect(()=>{const A=`${n}-${l}-${a}`,z=_t.get(A);z?(m(z.levels),x(z.splitPath)):K()},[n,l,a]);const K=async()=>{const A=++j.current;g(!0);try{const z=await qe.getDecomposition(n,l==="count"?null:l,a,"",h);if(A!==j.current)return;m([{id:"root",splitColumn:null,items:z,selectedItemName:null,filters:h}]),x([null])}catch(z){A===j.current&&console.error(z)}finally{A===j.current&&g(!1)}},fe=(A,z)=>{var Z,oe,ee,ge,O;const W=u[A];if(!W||!W.selectedItemName)return;const B=W.items.find(de=>de.name===W.selectedItemName);if(!B)return;const V=z.currentTarget.getBoundingClientRect(),re=(Z=N.current)==null?void 0:Z.getBoundingClientRect();if(re){let de=V.right-re.left+10,D=V.top-re.top;const q=((ee=(oe=N.current)==null?void 0:oe.parentElement)==null?void 0:ee.clientWidth)||window.innerWidth;de+260>q&&(de=V.left-re.left-270);const Q=((O=(ge=N.current)==null?void 0:ge.parentElement)==null?void 0:O.clientHeight)||window.innerHeight;D+300>Q&&(D=Q-310),y({levelIndex:A,item:B,x:de,y:D})}},ae=async(A,z)=>{const W=u[A];if(!W)return;const B={...W,selectedItemName:z.name},V=u.map((Z,oe)=>oe===A?B:Z),re=b[A+1];if(re){const Z=++j.current;g(!0);try{const oe=[...B.filters];B.splitColumn&&oe.push({column:B.splitColumn,operator:"==",value:z.name});const ee=await qe.getDecomposition(n,l==="count"?null:l,a,re,oe);if(Z!==j.current)return;const ge={id:`level-${A+1}`,splitColumn:re,items:ee,selectedItemName:null,filters:oe},O=[...V.slice(0,A+1),ge];m(O),x(b.slice(0,A+2))}catch(oe){Z===j.current&&console.error(oe)}finally{Z===j.current&&g(!1)}}else m(V)},ie=async A=>{if(!w)return;const{levelIndex:z,item:W}=w;y(null);const B=++j.current;g(!0);try{const V=u[z];if(!V)return;const re=[...V.filters];V.splitColumn&&re.push({column:V.splitColumn,operator:"==",value:W.name});const Z=await qe.getDecomposition(n,l==="count"?null:l,a,A,re);if(B!==j.current)return;const oe={id:`level-${z+1}`,splitColumn:A,items:Z,selectedItemName:null,filters:re},ee=[...u.slice(0,z+1),oe];m(ee);const ge=[...b.slice(0,z+1),A];x(ge)}catch(V){B===j.current&&console.error(V)}finally{B===j.current&&g(!1)}},we=A=>{m(u.slice(0,A)),x(b.slice(0,A))};return i.jsxs("div",{className:"relative w-full h-[600px] bg-slate-50 dark:bg-slate-900 overflow-hidden flex flex-col",children:[p&&i.jsx("div",{className:"absolute top-2 right-2 z-50",children:i.jsx(be,{className:"w-5 h-5 animate-spin text-blue-500"})}),i.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",ref:N,children:i.jsxs("div",{className:"flex h-full p-8 min-w-max gap-12 relative",ref:P,children:[u.map((A,z)=>i.jsxs("div",{className:"flex flex-col w-[200px] h-full relative z-10",children:[i.jsxs("div",{id:`header-${z}`,className:"flex items-center justify-between mb-4 bg-white dark:bg-slate-800 p-2 rounded shadow-sm border border-slate-200 dark:border-slate-700",children:[i.jsx("span",{className:"font-semibold text-sm text-slate-700 dark:text-slate-200",children:A.splitColumn||"Total"}),i.jsxs("div",{className:"flex items-center gap-1",children:[z===u.length-1&&i.jsx("button",{onClick:W=>fe(z,W),className:` - p-1 rounded hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors - ${A.selectedItemName?"text-blue-500":"text-slate-300 cursor-not-allowed"} - `,title:A.selectedItemName?"Split further":"Select an item to split",disabled:!A.selectedItemName,children:i.jsx(ys,{className:"w-4 h-4"})}),z>0&&i.jsx("button",{onClick:()=>we(z),className:"text-slate-400 hover:text-red-500",children:i.jsx(dr,{className:"w-4 h-4"})})]})]}),i.jsx("div",{id:`list-${z}`,className:"flex-1 overflow-y-auto pr-2 space-y-2 scrollbar-thin scrollbar-thumb-slate-300 dark:scrollbar-thumb-slate-600",onScroll:S,children:A.items.map(W=>{const B=A.selectedItemName===W.name,V=Math.max(...A.items.map(Z=>Z.value)),re=W.value/V*100;return i.jsxs("div",{id:`node-${z}-${W.name}`,...wi(()=>ae(z,W)),className:` - relative p-3 rounded-md border cursor-pointer transition-all group - ${B?"bg-blue-50 border-blue-500 dark:bg-blue-900/20 dark:border-blue-500 shadow-md":"bg-white border-slate-200 dark:bg-slate-800 dark:border-slate-700 hover:border-blue-300 dark:hover:border-blue-700"} - `,children:[i.jsxs("div",{className:"flex justify-between items-center mb-1 relative z-10 gap-2",children:[i.jsx("span",{className:"font-medium text-sm truncate flex-1 min-w-0",title:W.name,children:W.name}),i.jsxs("span",{className:"text-xs font-mono text-slate-500 dark:text-slate-400 whitespace-nowrap",children:[W.value.toLocaleString()," (",Math.round(W.ratio*100),"%)"]})]}),i.jsx("div",{className:"absolute bottom-0 left-0 h-1 bg-blue-500/20 transition-all duration-500",style:{width:`${re}%`}})]},W.name)})})]},z)),i.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none z-0",children:M.map((A,z)=>i.jsx("path",{d:A.d,fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeOpacity:"0.5"},z))})]})}),w&&i.jsxs("div",{className:"absolute z-50 bg-white dark:bg-slate-800 rounded-lg shadow-xl border border-slate-200 dark:border-slate-700 w-64 max-h-80 overflow-y-auto flex flex-col",style:{left:w.x,top:w.y},children:[i.jsx("div",{className:"p-3 border-b border-slate-100 dark:border-slate-700 bg-slate-50 dark:bg-slate-900 sticky top-0",children:i.jsx("span",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Split by"})}),i.jsx("div",{className:"p-1",children:d.map(A=>i.jsx("button",{onClick:()=>ie(A),className:"w-full text-left px-3 py-2 text-sm text-slate-700 dark:text-slate-200 hover:bg-blue-50 dark:hover:bg-blue-900/30 rounded-md transition-colors",children:A},A))})]}),w&&i.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(null)})]})},jc=({datasetId:n,columns:l,initialFilters:a=[]})=>{const[d,h]=k.useState("count"),[u,m]=k.useState("count"),[p,g]=k.useState(0),w=()=>{g(y=>y+1)};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-white dark:bg-slate-800 p-4 rounded-lg shadow-sm border border-slate-200 dark:border-slate-700 flex gap-4 items-end",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs font-medium text-slate-500",children:"Analyze"}),i.jsxs("select",{value:d,onChange:y=>h(y.target.value),className:"block w-[180px] rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"count",children:"Row Count"}),l.map(y=>i.jsx("option",{value:y,children:y},y))]})]}),d!=="count"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs font-medium text-slate-500",children:"Aggregation"}),i.jsxs("select",{value:u,onChange:y=>m(y.target.value),className:"block w-[120px] rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"sum",children:"Sum"}),i.jsx("option",{value:"mean",children:"Average"}),i.jsx("option",{value:"min",children:"Min"}),i.jsx("option",{value:"max",children:"Max"})]})]}),i.jsx("button",{onClick:w,className:"p-2 border rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 text-slate-600 dark:text-slate-300",title:"Reset Tree","aria-label":"Reset Tree",children:i.jsx(Vt,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"bg-slate-50 dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-800 overflow-hidden",children:i.jsx(wc,{datasetId:n,measureCol:d,measureAgg:u,columns:l,initialFilters:a},p)})]})},pi=async(n,l,a,d,h)=>{const u=document.getElementById(n);if(!u)return;const m=Mo(),p=m?"#1f2937":"#ffffff",g=m?"#f3f4f6":"#111827",w=m?"#9ca3af":"#4b5563",y=(x,N)=>{let P=0;return a&&(x.fillStyle=g,x.font="bold 16px sans-serif",x.textAlign="center",x.fillText(a,N/2,30),P=40),d&&(x.fillStyle=w,x.font="12px sans-serif",x.textAlign="center",x.fillText(d,N/2,50),P=60),h&&(x.fillStyle=g,x.font="10px monospace",x.textAlign="right",h.split(` -`).forEach((M,I)=>{x.fillText(M,N-10,20+I*12)})),P||20},b=u.querySelector(".js-plotly-plot");if(b){try{const x=await Nr.toImage(b,{format:"png",width:1200,height:800}),N=document.createElement("canvas"),P=N.getContext("2d"),j=new Image,M=1200,I=800,S=a?d?80:50:0;j.onload=()=>{if(N.width=M,N.height=I+S,P){P.fillStyle=p,P.fillRect(0,0,N.width,N.height),a&&(P.fillStyle=g,P.font="bold 24px sans-serif",P.textAlign="center",P.fillText(a,M/2,40),d&&(P.fillStyle=w,P.font="16px sans-serif",P.fillText(d,M/2,70))),h&&(P.fillStyle=g,P.font="14px monospace",P.textAlign="right",h.split(` -`).forEach((ae,ie)=>{P.fillText(ae,M-20,30+ie*18)})),P.drawImage(j,0,S);const K=document.createElement("a");K.download=`${l}.png`,K.href=N.toDataURL("image/png"),K.click()}},j.src=x}catch(x){console.error("Plotly download failed",x)}return}try{const x=await vs(u,{backgroundColor:p,pixelRatio:2}),N=new Image;N.onload=()=>{const P=a?d?80:50:0,j=document.createElement("canvas"),M=j.getContext("2d");if(j.width=N.width,j.height=N.height+P*2,M){M.fillStyle=p,M.fillRect(0,0,j.width,j.height),M.save(),M.scale(2,2),y(M,N.width/2),M.restore(),M.drawImage(N,0,P*2);const I=document.createElement("a");I.download=`${l}.png`,I.href=j.toDataURL("image/png"),I.click()}},N.src=x}catch(x){console.error("Chart download failed",x)}};function kc(n){var S;const{report:l,profile:a,activeTab:d,setActiveTab:h,filtersDraft:u,filtersApplied:m,filtersDirty:p,excludedColsDraft:g,excludedDirty:w,analyzing:y,handleAddFilter:b,handleRemoveFilter:x,handleResetFilters:N,handleApplyFilters:P,handleToggleExclude:j,handleApplyExcluded:M}=n,I=(S=l==null?void 0:l.profile_data)!=null&&S.columns?Object.keys(l.profile_data.columns):[];return i.jsxs("div",{className:"flex h-full w-full overflow-hidden bg-white dark:bg-gray-900",children:[i.jsx(Fl,{activeTab:d,setActiveTab:h,profile:a,filtersDraft:u,filtersApplied:m,filtersDirty:p,columns:I,excludedCols:g,excludedDirty:w,analyzing:y,onAddFilter:b,onRemoveFilter:x,onResetFilters:N,onApplyFilters:P,onToggleExclude:j,onApplyExcluded:M}),i.jsx("div",{className:"flex-1 overflow-y-auto p-6 pt-4 bg-gray-50 dark:bg-gray-900/50",children:i.jsx(Nc,{...n,allColumns:I})})]})}const Xn={dashboard:n=>{const{profile:l,handleToggleExclude:a,excludedColsDraft:d}=n;return i.jsx($l,{profile:l,onToggleExclude:a,excludedCols:d})},insights:n=>{const{profile:l}=n;return i.jsx(Hl,{profile:l})},pii:n=>{const{profile:l}=n;return i.jsx(Wl,{alerts:l.alerts??[]})},pca:n=>{const{profile:l,scatter:a,setScatter:d}=n;return i.jsx(rd,{profile:l,isPCA3D:a.isPCA3D,setIsPCA3D:h=>d({isPCA3D:h}),downloadChart:pi})},geospatial:n=>{const{profile:l}=n;return!!l.geospatial&&i.jsx(Pd,{profile:l})},target:n=>{const{profile:l,history:a,loading:d,loadSpecificReport:h,report:u}=n;return!!l.target_col&&!!l.target_correlations&&i.jsx(Sd,{profile:l,downloadChart:pi,history:a,loading:d,loadSpecificReport:h,report:u})},timeseries:n=>{const{profile:l}=n;return!!l.timeseries&&i.jsx(Td,{profile:l,downloadChart:pi})},variables:n=>{const{profile:l,handleToggleExclude:a,handleAddFilter:d}=n;return i.jsx(tc,{profile:l,handleToggleExclude:a,handleAddFilter:d})},bivariate:n=>{const{profile:l,scatter:a,setScatter:d}=n;return i.jsx(sc,{profile:l,downloadChart:pi,scatterX:a.x,setScatterX:h=>d({x:h}),scatterY:a.y,setScatterY:h=>d({y:h}),scatterZ:a.z,setScatterZ:h=>d({z:h}),scatterColor:a.color,setScatterColor:h=>d({color:h}),is3D:a.is3D,setIs3D:h=>d({is3D:h})})},outliers:n=>{const{profile:l}=n;return l.outliers&&i.jsx(nc,{profile:l})},correlations:n=>{const{profile:l}=n;return(!!l.correlations||!!l.correlations_with_target||!!l.causal_target_exclusion_reason)&&i.jsx(oc,{profile:l})},causal:n=>{const{profile:l}=n;return i.jsx(fc,{profile:l})},rules:n=>{const{profile:l}=n;return!!l.rule_tree&&i.jsx(yc,{profile:l})},decomposition:n=>{const{selectedDataset:l,allColumns:a,filtersApplied:d}=n;return l&&i.jsx(jc,{datasetId:l,columns:a,initialFilters:d})},sample:n=>{const{profile:l,excludedColsDraft:a,handleToggleExclude:d}=n;return l.sample_data&&i.jsx(lc,{profile:l,excludedCols:a,handleToggleExclude:d})}};function Nc(n){const l=n.activeTab;if(!Object.prototype.hasOwnProperty.call(Xn,l))return null;const a=Xn[l];return i.jsx(a,{...n})}function Cc(n){const{loading:l,report:a,error:d,reportQuery:h,runAnalysis:u}=n;if(l&&!a)return i.jsx(Ao,{message:"Analyzing dataset..."});if(d)return i.jsx(zo,{error:d,onRetry:()=>h.refetch()});if(!a)return i.jsx(Lc,{...n});if(a.status==="PENDING")return i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:[i.jsx(be,{className:"w-16 h-16 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Analysis in progress..."}),i.jsx("p",{className:"text-sm text-gray-400",children:"This may take a few moments."})]});if(a.status==="FAILED")return i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-red-500",children:[i.jsx(bt,{className:"w-16 h-16 mb-4"}),i.jsx("p",{children:"Analysis Failed"}),i.jsx("p",{className:"text-sm text-gray-600 mt-2",children:a.error_message}),i.jsxs("button",{onClick:()=>u(),className:"mt-4 flex items-center px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200",children:[i.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Retry"]})]});const m=n.profileForUi;return m?i.jsx(kc,{...n,report:a,profile:m}):i.jsx("div",{children:"No profile data"})}function Lc(n){const{targetCol:l,setTargetCol:a,taskType:d,setTaskType:h,existingReport:u,loadSpecificReport:m,isLoadingReport:p,runAnalysis:g,analyzing:w}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400",children:[i.jsx(yt,{className:"w-16 h-16 mb-4 opacity-20"}),i.jsx("p",{className:"mb-4",children:"No analysis found for this dataset."}),i.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[i.jsxs("div",{className:"w-64 space-y-2",children:[i.jsx("label",{htmlFor:"eda-setup-target-column",className:"sr-only",children:"Target Column (Optional)"}),i.jsx("input",{id:"eda-setup-target-column",type:"text",value:l,onChange:y=>a(y.target.value),placeholder:"Target Column (Optional)",className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("label",{htmlFor:"eda-setup-task-type",className:"sr-only",children:"Task Type"}),i.jsxs("select",{id:"eda-setup-task-type",value:d,onChange:y=>h(y.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Auto-Detect Task"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]}),i.jsxs("div",{className:"group relative flex items-center",children:[i.jsx(nr,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute left-full ml-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none",children:"Force a specific task type. Useful for ID columns (force Classification) or numeric categories (force Regression)."})]})]})]}),i.jsxs("div",{className:"flex gap-2",children:[u&&i.jsxs("button",{onClick:()=>m(u.id),disabled:p,className:"flex items-center px-4 py-2 action-secondary rounded-md disabled:opacity-50 disabled:cursor-not-allowed",children:[p?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(Vt,{className:"w-4 h-4 mr-2"}),"Load Existing (",new Date(u.created_at).toLocaleDateString(),")"]}),i.jsxs("button",{onClick:()=>g(),disabled:w,className:"flex items-center px-4 py-2 action-primary rounded-md disabled:opacity-50",children:[w?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(vi,{className:"w-4 h-4 mr-2"}),u?"Run New Analysis":"Run Analysis"]})]})]})]})})}const zc=()=>{const n=al();return i.jsxs("div",{className:"flex flex-col h-full w-full overflow-hidden bg-white dark:bg-slate-950",children:[i.jsx(ol,{...n}),i.jsx(ml,{...n}),i.jsx(kl,{...n}),i.jsx("div",{className:"flex-1 overflow-hidden relative",children:i.jsx(Cc,{...n})}),i.jsx(Nl,{...n})]})};export{zc as EDAPage}; diff --git a/static/ml_canvas/assets/InferencePage-B6M0swMs.js b/static/ml_canvas/assets/InferencePage-BvDNVaSU.js similarity index 99% rename from static/ml_canvas/assets/InferencePage-B6M0swMs.js rename to static/ml_canvas/assets/InferencePage-BvDNVaSU.js index 89c2b62f0..aec9f7d44 100644 --- a/static/ml_canvas/assets/InferencePage-B6M0swMs.js +++ b/static/ml_canvas/assets/InferencePage-BvDNVaSU.js @@ -1,4 +1,4 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as ge,B as Ie,P as kt,f as X,v as me,X as $e,w as Ae,x as Pe,y as he,W as Nt,z as pe,D as _e,l as Le,h as Je,E as vt,I as St,J as Ct,K as Rt,N as It,t as Ot}from"./vendor-utils-VkF_O5b_.js";import{d as be,D as Oe,t as O,n as Ft,o as Mt,a as Et,q as Tt,b as Dt,E as $t}from"./index-_bluKNvP.js";import"./vendor-charts-BkHP8M8k.js";const re=`[ +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as ge,B as Ie,P as kt,f as X,v as me,X as $e,w as Ae,x as Pe,y as he,W as Nt,z as pe,D as _e,l as Le,h as Je,E as vt,I as St,J as Ct,K as Rt,N as It,t as Ot}from"./vendor-utils-VkF_O5b_.js";import{d as be,D as Oe,t as O,n as Ft,o as Mt,a as Et,q as Tt,b as Dt,E as $t}from"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";const re=`[ { "feature1": 0.5, "feature2": 1.2 diff --git a/static/ml_canvas/assets/ModelRegistry-8Pg2diG_.js b/static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js similarity index 99% rename from static/ml_canvas/assets/ModelRegistry-8Pg2diG_.js rename to static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js index b053ff708..c7a6a8247 100644 --- a/static/ml_canvas/assets/ModelRegistry-8Pg2diG_.js +++ b/static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-_bluKNvP.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; diff --git a/static/ml_canvas/assets/SlowNodesPage-ixEyO8cV.js b/static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js similarity index 99% rename from static/ml_canvas/assets/SlowNodesPage-ixEyO8cV.js rename to static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js index 260c798bb..8bb7a705c 100644 --- a/static/ml_canvas/assets/SlowNodesPage-ixEyO8cV.js +++ b/static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-_bluKNvP.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-BR7Y881F.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; diff --git a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-Da14qxKB.js b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js similarity index 83% rename from static/ml_canvas/assets/abnfDiagram-VCTEODGH-Da14qxKB.js rename to static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js index 187042e80..f2c7cc220 100644 --- a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-Da14qxKB.js +++ b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-SVP7TREG-rNd1SwBb.js";import{p as f}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as n,l as o}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; +import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p as f}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as n,l as o}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; diff --git a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-DR-sbxhh.js b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js similarity index 99% rename from static/ml_canvas/assets/architectureDiagram-5GKGNRK7-DR-sbxhh.js rename to static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js index 9041b3251..97dfe349a 100644 --- a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-DR-sbxhh.js +++ b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js @@ -1,4 +1,4 @@ -import{p as qe}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-DBa20IFF.js";import{p as cr}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` +import{p as qe}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-Bh6LVe7i.js";import{p as cr}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; diff --git a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-01ED4W8y.js b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js similarity index 99% rename from static/ml_canvas/assets/blockDiagram-I7D4REHJ-01ED4W8y.js rename to static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js index bb5d554af..022599d07 100644 --- a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-01ED4W8y.js +++ b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js @@ -1,4 +1,4 @@ -import{g as Pe}from"./chunk-5VM5RSS4-vgh9rKCo.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-DBa20IFF.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-DIwzyvS1.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: +import{g as Pe}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-Bh6LVe7i.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-D4R-Rc0m.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: `+b.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":se="Parse error on line "+(f+1)+": Unexpected "+(B==M?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(se,{text:b.match,token:this.terminals_[B]||B,line:b.yylineno,loc:H,expected:q})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(P[0]){case 1:o.push(B),L.push(b.yytext),t.push(b.yylloc),o.push(P[1]),B=null,w=b.yyleng,n=b.yytext,f=b.yylineno,H=b.yylloc;break;case 2:if(W=this.productions_[P[1]][1],U.$=L[L.length-W],U._$={first_line:t[t.length-(W||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(W||1)].first_column,last_column:t[t.length-1].last_column},ee&&(U._$.range=[t[t.length-(W||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(U,[n,w,f,R.yy,P[1],L,t].concat(K)),typeof te<"u")return te;W&&(o=o.slice(0,-1*W*2),L=L.slice(0,-1*W),t=t.slice(0,-1*W)),o.push(this.productions_[P[1]][0]),L.push(U.$),t.push(U._$),fe=O[o[o.length-2]][o[o.length-1]],o.push(fe);break;case 3:return!0}}return!0},"parse")},D=(function(){var T={EOF:1,parseError:g(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:g(function(h,i){return this.yy=i||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var i=h.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:g(function(h){var i=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var L=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===u.length?this.yylloc.first_column:0)+u[u.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[L[0],L[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(h){this.unput(this.match.slice(h))},"less"),pastInput:g(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var h=this.pastInput(),i=new Array(h.length+1).join("-");return h+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-CrUbY5T3.js b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js similarity index 99% rename from static/ml_canvas/assets/c4Diagram-7LVT6UL2-CrUbY5T3.js rename to static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js index 8eaad4a59..dc8f11196 100644 --- a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-CrUbY5T3.js +++ b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js @@ -1,4 +1,4 @@ -import{d as Le}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-DBa20IFF.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: +import{d as Le}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-Bh6LVe7i.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: `+A.showPosition()+` Expecting `+Yt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":Gt="Parse error on line "+(xt+1)+": Unexpected "+(M==le?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[M]||M,line:A.yylineno,loc:Qt,expected:Yt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Et+", token: "+M);switch(V[0]){case 1:E.push(M),D.push(A.yytext),i.push(A.yylloc),E.push(V[1]),M=null,oe=A.yyleng,p=A.yytext,xt=A.yylineno,Qt=A.yylloc;break;case 2:if(j=this.productions_[V[1]][1],Tt.$=D[D.length-j],Tt._$={first_line:i[i.length-(j||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(j||1)].first_column,last_column:i[i.length-1].last_column},Ne&&(Tt._$.range=[i[i.length-(j||1)].range[0],i[i.length-1].range[1]]),Kt=this.performAction.apply(Tt,[p,oe,xt,vt.yy,V[1],D,i].concat(De)),typeof Kt<"u")return Kt;j&&(E=E.slice(0,-1*j*2),D=D.slice(0,-1*j),i=i.slice(0,-1*j)),E.push(this.productions_[V[1]][0]),D.push(Tt.$),i.push(Tt._$),ue=Pt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Oe=(function(){var yt={EOF:1,parseError:d(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),setInput:d(function(b,x){return this.yy=x||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var x=b.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},"input"),unput:d(function(b){var x=b.length,E=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(b){this.unput(this.match.slice(b))},"less"),pastInput:d(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var b=this.pastInput(),x=new Array(b.length+1).join("-");return b+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/channel-D4R-Rc0m.js b/static/ml_canvas/assets/channel-D4R-Rc0m.js new file mode 100644 index 000000000..da2c50bcc --- /dev/null +++ b/static/ml_canvas/assets/channel-D4R-Rc0m.js @@ -0,0 +1 @@ +import{Y as a,$ as n}from"./mermaid.core-Bh6LVe7i.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/channel-DIwzyvS1.js b/static/ml_canvas/assets/channel-DIwzyvS1.js deleted file mode 100644 index ffafaf20a..000000000 --- a/static/ml_canvas/assets/channel-DIwzyvS1.js +++ /dev/null @@ -1 +0,0 @@ -import{Y as a,$ as n}from"./mermaid.core-DBa20IFF.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/chunk-2Q5K7J3B-BBHJD4OQ.js b/static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js similarity index 66% rename from static/ml_canvas/assets/chunk-2Q5K7J3B-BBHJD4OQ.js rename to static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js index 86df72d0d..cd7254285 100644 --- a/static/ml_canvas/assets/chunk-2Q5K7J3B-BBHJD4OQ.js +++ b/static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-DBa20IFF.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; +import{_ as s}from"./mermaid.core-Bh6LVe7i.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; diff --git a/static/ml_canvas/assets/chunk-5VM5RSS4-vgh9rKCo.js b/static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js similarity index 83% rename from static/ml_canvas/assets/chunk-5VM5RSS4-vgh9rKCo.js rename to static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js index 6c7c0ac97..b54492b29 100644 --- a/static/ml_canvas/assets/chunk-5VM5RSS4-vgh9rKCo.js +++ b/static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-DBa20IFF.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-Bh6LVe7i.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/static/ml_canvas/assets/chunk-F27PBJKO-B6ZPWwpd.js b/static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js similarity index 96% rename from static/ml_canvas/assets/chunk-F27PBJKO-B6ZPWwpd.js rename to static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js index c03523c80..b6d51b2a1 100644 --- a/static/ml_canvas/assets/chunk-F27PBJKO-B6ZPWwpd.js +++ b/static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js @@ -1 +1 @@ -import{_ as i,S as d,H as o}from"./mermaid.core-DBa20IFF.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; +import{_ as i,S as d,H as o}from"./mermaid.core-Bh6LVe7i.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; diff --git a/static/ml_canvas/assets/chunk-IMKFNOWR-D26YLBdf.js b/static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js similarity index 99% rename from static/ml_canvas/assets/chunk-IMKFNOWR-D26YLBdf.js rename to static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js index edfdad7e2..775653ced 100644 --- a/static/ml_canvas/assets/chunk-IMKFNOWR-D26YLBdf.js +++ b/static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js @@ -1,4 +1,4 @@ -import{g as ee}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as se}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-DBa20IFF.js";import{f as pe}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: +import{g as ee}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as se}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-Bh6LVe7i.js";import{f as pe}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: `+D.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[w]||w)+"'":bt="Parse error on line "+(G+1)+": Unexpected "+(w==et?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(bt,{text:D.match,token:this.terminals_[w]||w,line:D.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(N[0]){case 1:n.push(w),_.push(D.yytext),r.push(D.yylloc),n.push(N[1]),w=null,q=D.yyleng,c=D.yytext,G=D.yylineno,_t=D.yylloc;break;case 2:if(M=this.productions_[N[1]][1],Q.$=_[_.length-M],Q._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},Zt&&(Q._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(Q,[c,q,G,H.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;M&&(n=n.slice(0,-1*M*2),_=_.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[N[1]][0]),_.push(Q.$),r.push(Q._$),Ot=Y[n[n.length-2]][n[n.length-1]],n.push(Ot);break;case 3:return!0}}return!0},"parse")},Qt=(function(){var U={EOF:1,parseError:S(function(u,n){if(this.yy.parser)this.yy.parser.parseError(u,n);else throw new Error(u)},"parseError"),setInput:S(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:S(function(l){var u=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(l){this.unput(this.match.slice(l))},"less"),pastInput:S(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-JWPE2WC7-D_VUnfvZ.js b/static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js similarity index 78% rename from static/ml_canvas/assets/chunk-JWPE2WC7-D_VUnfvZ.js rename to static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js index 3ab2eb334..a2cd551fa 100644 --- a/static/ml_canvas/assets/chunk-JWPE2WC7-D_VUnfvZ.js +++ b/static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js @@ -1 +1 @@ -import{_ as l}from"./mermaid.core-DBa20IFF.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; +import{_ as l}from"./mermaid.core-Bh6LVe7i.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; diff --git a/static/ml_canvas/assets/chunk-POPQ4Y6H-oeZXlwKE.js b/static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js similarity index 87% rename from static/ml_canvas/assets/chunk-POPQ4Y6H-oeZXlwKE.js rename to static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js index 8d334dcd0..cb6575a45 100644 --- a/static/ml_canvas/assets/chunk-POPQ4Y6H-oeZXlwKE.js +++ b/static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js @@ -1 +1 @@ -import{_ as a,d as w,l as x}from"./mermaid.core-DBa20IFF.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; +import{_ as a,d as w,l as x}from"./mermaid.core-Bh6LVe7i.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; diff --git a/static/ml_canvas/assets/chunk-SVP7TREG-rNd1SwBb.js b/static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js similarity index 99% rename from static/ml_canvas/assets/chunk-SVP7TREG-rNd1SwBb.js rename to static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js index e4542c051..e0f6bc03b 100644 --- a/static/ml_canvas/assets/chunk-SVP7TREG-rNd1SwBb.js +++ b/static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js @@ -1,4 +1,4 @@ -import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-DBa20IFF.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` +import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-Bh6LVe7i.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` `),C.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ie=p(()=>O,"getAccDescription"),ne=Y,ae=P,oe={clear:J,setTitle:Y,getTitle:P,addRule:Q,getRules:Z,getRule:V,setAccTitle:ee,getAccTitle:te,setAccDescription:re,getAccDescription:ie,setDiagramTitle:ne,getDiagramTitle:ae},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},le=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,se=/^[\w "',.-]+$/,de=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=p(e=>e?Object.keys(e).every(i=>i==="railroad"||de.has(i)):!1,"isRailroadStyleOptions"),ce=p(e=>e?"railroad"in e&&e.railroad?e.railroad:L(e)?e:{}:{},"extractRailroadOverrides"),me=p(e=>{if(!e||L(e))return{};const{railroad:i,svgId:a,theme:n,look:t,...r}=e;return r},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return le.test(a)?a:i},"sanitizeColorValue"),I=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return se.test(a)?a:i},"sanitizeFontFamilyValue"),F=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),he=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),pe=p(e=>{const i=I(e.fontFamily,f.fontFamily),a=he(e.fontSize)??f.fontSize;return{...f,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:m(e.lineColor,f.lineColor),markerFill:m(e.lineColor,f.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),E=p(e=>{const i=B(),a={...G(),...i.themeVariables??{},...me(e)},n=pe(a),t={...i.railroad??{},...ce(e)};return{compactMode:t.compactMode??n.compactMode,padding:F(t.padding,n.padding),verticalSeparation:F(t.verticalSeparation,n.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,n.horizontalSeparation),arcRadius:F(t.arcRadius,n.arcRadius),fontSize:F(t.fontSize,n.fontSize),fontFamily:I(t.fontFamily,n.fontFamily),terminalFill:m(t.terminalFill,n.terminalFill),terminalStroke:m(t.terminalStroke,n.terminalStroke),terminalTextColor:m(t.terminalTextColor,n.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:m(t.lineColor,n.lineColor),strokeWidth:F(t.strokeWidth,n.strokeWidth),markerFill:m(t.markerFill,n.markerFill),commentFill:m(t.commentFill,n.commentFill),commentStroke:m(t.commentStroke,n.commentStroke),commentTextColor:m(t.commentTextColor,n.commentTextColor),specialFill:m(t.specialFill,n.specialFill),specialStroke:m(t.specialStroke,n.specialStroke),ruleNameColor:m(t.ruleNameColor,n.ruleNameColor),showMarkers:t.showMarkers??n.showMarkers,markerRadius:F(t.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),Te=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:n,terminalStroke:t,terminalTextColor:r,nonTerminalFill:o,nonTerminalStroke:g,nonTerminalTextColor:l,lineColor:s,strokeWidth:h,markerFill:u,commentFill:c,commentStroke:w,commentTextColor:d,specialFill:T,specialStroke:z,ruleNameColor:S}=E(e);return` .railroad-diagram { font-family: ${i}; diff --git a/static/ml_canvas/assets/chunk-TICWLB2K-fDp21oQ3.js b/static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js similarity index 99% rename from static/ml_canvas/assets/chunk-TICWLB2K-fDp21oQ3.js rename to static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js index 9fbf15870..b19850b11 100644 --- a/static/ml_canvas/assets/chunk-TICWLB2K-fDp21oQ3.js +++ b/static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js @@ -1,4 +1,4 @@ -import{g as st}from"./chunk-5VM5RSS4-vgh9rKCo.js";import{g as it}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as at}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-DBa20IFF.js";import{f as mt}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: +import{g as st}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{g as it}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as at}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-Bh6LVe7i.js";import{f as mt}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: `+D.showPosition()+` Expecting `+Ae.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Oe="Parse error on line "+(de+1)+": Unexpected "+(_==We?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Oe,{text:D.match,token:this.terminals_[_]||_,line:D.yylineno,loc:ve,expected:Ae})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(L[0]){case 1:p.push(_),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),_=null,Ke=D.yyleng,t=D.yytext,de=D.yylineno,ve=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],U.$=C[C.length-v],U._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},et&&(U._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),Ie=this.performAction.apply(U,[t,Ke,de,V.yy,L[1],C,e].concat($e)),typeof Ie<"u")return Ie;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(U.$),e.push(U._$),je=ee[p[p.length-2]][p[p.length-1]],p.push(je);break;case 3:return!0}}return!0},"parse")},Je=(function(){var O={EOF:1,parseError:g(function(d,p){if(this.yy.parser)this.yy.parser.parseError(d,p);else throw new Error(d)},"parseError"),setInput:g(function(o,d){return this.yy=d||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var d=o.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:g(function(o){var d=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(o){this.unput(this.match.slice(o))},"less"),pastInput:g(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var o=this.pastInput(),d=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-XXDRQBXY-Bs02z9v-.js b/static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js similarity index 76% rename from static/ml_canvas/assets/chunk-XXDRQBXY-Bs02z9v-.js rename to static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js index 2c8154d2c..3170453d9 100644 --- a/static/ml_canvas/assets/chunk-XXDRQBXY-Bs02z9v-.js +++ b/static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-DBa20IFF.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; +import{_ as s}from"./mermaid.core-Bh6LVe7i.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-B-odMm70.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-B-odMm70.js deleted file mode 100644 index a45771bc2..000000000 --- a/static/ml_canvas/assets/classDiagram-ZZMXUADV-B-odMm70.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-fDp21oQ3.js";import{_ as i}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-vgh9rKCo.js";import"./chunk-XXDRQBXY-Bs02z9v-.js";import"./chunk-POPQ4Y6H-oeZXlwKE.js";import"./chunk-F27PBJKO-B6ZPWwpd.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js new file mode 100644 index 000000000..a3bf4eb30 --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-C_ND7Y6C.js";import{_ as i}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-C6GC8vvo.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-B-odMm70.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-B-odMm70.js deleted file mode 100644 index a45771bc2..000000000 --- a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-B-odMm70.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-fDp21oQ3.js";import{_ as i}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-vgh9rKCo.js";import"./chunk-XXDRQBXY-Bs02z9v-.js";import"./chunk-POPQ4Y6H-oeZXlwKE.js";import"./chunk-F27PBJKO-B6ZPWwpd.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js new file mode 100644 index 000000000..a3bf4eb30 --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-C_ND7Y6C.js";import{_ as i}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-C6GC8vvo.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-DSJwbOO-.js b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js similarity index 99% rename from static/ml_canvas/assets/cose-bilkent-JH36ORCC-DSJwbOO-.js rename to static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js index f6ce65e1c..00b374f9c 100644 --- a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-DSJwbOO-.js +++ b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js @@ -1 +1 @@ -import{_ as V,l as k}from"./mermaid.core-DBa20IFF.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; +import{_ as V,l as k}from"./mermaid.core-Bh6LVe7i.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; diff --git a/static/ml_canvas/assets/cynefin-OW5HDTMX-DvaIaB7v.js b/static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js similarity index 99% rename from static/ml_canvas/assets/cynefin-OW5HDTMX-DvaIaB7v.js rename to static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js index d92c841ca..2e8c4a254 100644 --- a/static/ml_canvas/assets/cynefin-OW5HDTMX-DvaIaB7v.js +++ b/static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js @@ -1,4 +1,4 @@ -var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-_bluKNvP.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` +var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-BR7Y881F.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` `,`\r `,"\r"],(function(a){function i(c,f,d,p){return new iv(c,f,d,p)}s(i,"create"),a.create=i;function o(c){let f=c;return!!(C.defined(f)&&C.string(f.uri)&&(C.undefined(f.languageId)||C.string(f.languageId))&&C.uinteger(f.lineCount)&&C.func(f.getText)&&C.func(f.positionAt)&&C.func(f.offsetAt))}s(o,"is"),a.is=o;function u(c,f){let d=c.getText(),p=l(f,(y,v)=>{let E=y.range.start.line-v.range.start.line;return E===0?y.range.start.character-v.range.start.character:E}),h=d.length;for(let y=p.length-1;y>=0;y--){let v=p[y],E=c.offsetAt(v.range.start),T=c.offsetAt(v.range.end);if(T<=h)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");h=E}return d}s(u,"applyEdits"),a.applyEdits=u;function l(c,f){if(c.length<=1)return c;const d=c.length/2|0,p=c.slice(0,d),h=c.slice(d);l(p,f),l(h,f);let y=0,v=0,E=0;for(;y({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` +import{p as ht}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{s as gt,g as $t,n as bt,m as Ct,a as wt,b as vt,_ as i,l as O,C as Dt,d as kt,o as At,z as U,x as Q,A as Tt,E as ot}from"./mermaid.core-Bh6LVe7i.js";import{p as Bt}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var rt=i(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` .cynefinDomain { stroke: none; } diff --git a/static/ml_canvas/assets/dagre-GXQ25YYZ-HI_1BsWY.js b/static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js similarity index 98% rename from static/ml_canvas/assets/dagre-GXQ25YYZ-HI_1BsWY.js rename to static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js index 780b1fade..7fee45170 100644 --- a/static/ml_canvas/assets/dagre-GXQ25YYZ-HI_1BsWY.js +++ b/static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js @@ -1,4 +1,4 @@ -import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-DBa20IFF.js";import{l as U}from"./layout-D4UUaX_9.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX +import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-Bh6LVe7i.js";import{l as U}from"./layout-s0gQ8r44.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX Node.id = `,f,` data=`,u.height,` Parent cluster`,s.height),e.setNode(s.id,u),e.parent(f)||(p.trace("Setting parent",f,s.id),e.setParent(f,s.id,u))}if(p.info("(Insert) Node XXX"+f+": "+JSON.stringify(e.node(f))),n!=null&&n.clusterNode){p.info("Cluster identified XBX",f,n.width,e.node(f));const{ranksep:u,nodesep:b}=e.graph();n.graph.setGraph({...n.graph.graph(),ranksep:u+25,nodesep:b});const x=await ne({element:l,graph:n.graph,diagramType:d,id:g,parentCluster:e.node(f),siteConfig:h}),S=x.elem;T(n,S),n.diff=x.diff||0,p.info("New compound node after recursive render XAX",f,"width",n.width,"height",n.height),z(S,n)}else e.children(f).length>0?(p.trace("Cluster - the non recursive path XBX",f,n.id,n,n.width,"Graph:",e),p.trace(R(n.id,e)),w.set(n.id,{id:R(n.id,e),node:n})):(p.trace("Node - the non recursive path XAX",f,l,e.node(f),L),await F(l,e.node(f),{config:h,dir:L}))})),await m(async()=>{const f=e.edges().map(async function(n){var b,x,S,X;const u=e.edge(n.v,n.w,n.name);if(p.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),p.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(e.edge(n))),p.info("Fix",w,"ids:",n.v,n.w,"Translating: ",w.get(n.v),w.get(n.w)),a&&u.selfLoop){if(u.selfLoop.order!==1)return;const N={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:((b=u.originalEdge)==null?void 0:b.startLabelLeft)??u.startLabelLeft,startLabelRight:((x=u.originalEdge)==null?void 0:x.startLabelRight)??u.startLabelRight,endLabelLeft:((S=u.originalEdge)==null?void 0:S.endLabelLeft)??u.endLabelLeft,endLabelRight:((X=u.originalEdge)==null?void 0:X.endLabelRight)??u.endLabelRight};await C(o,N),u.width=N.width,u.height=N.height,u.labelStyle=N.labelStyle;return}await C(o,u)});await Promise.all(f)},"processEdges")();const{subGraphTitleTotalMargin:y}=j(h);return{elem:r,graph:e,groups:{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r},diagramType:d,id:g,mergeSelfLoops:a,subGraphTitleTotalMargin:y}},"measureDagreGraph"),G=m(t=>{p.info("############################################# XXX"),p.info("### Layout ### XXX"),p.info("############################################# XXX"),U(t)},"runDagreGraphLayout"),te=m((t,e,d)=>{const g=t.node(e);if(!g)return;const s={...g};return g!=null&&g.clusterNode?s.y=(g.y??0)+d:t.children(e).length>0?s.height=(g.height??0)+d:s.y=(g.y??0)+d/2,s},"normalizeDagreNode"),I=m((t,e)=>{V.forEach(d=>{e[d]!==void 0&&(t[d]=e[d])})},"applyDagreNodeLayout"),re=m((t,e,d,g)=>({...t,start:t.start??e,end:t.end??d,points:(t.points??[]).map(s=>({...s,y:typeof s.y=="number"?s.y+g:s.y}))}),"normalizeDagreEdge"),ae=m((t,e)=>{const{graph:d,mergeSelfLoops:g,subGraphTitleTotalMargin:s=0}=e,h=new Map(t.nodes.map(c=>[c.id,c]));D(d).forEach(c=>{const i=te(d,c,s);if(!i)return;I(d.node(c),i);const o=h.get(c);o&&I(o,i)});const L=s/2;return t.edges=M(d,L,{mergeSelfLoops:g}).map(({edge:c,start:i,end:o})=>re(c,i,o,L)),t},"applyDagreLayoutResult"),oe=m(async({elem:t,graph:e,groups:{clusters:d,edgePaths:g},diagramType:s,id:h,mergeSelfLoops:L,subGraphTitleTotalMargin:c})=>{let i=0;await Promise.all(D(e).map(async function(r){var E;const a=e.node(r);if(p.info("Position XBX => "+r+": ("+a.x,","+a.y,") width: ",a.width," height: ",a.height),a!=null&&a.clusterNode)a.y+=c,p.info("A tainted cluster node XBX1",r,a.id,a.width,a.height,a.x,a.y,e.parent(r)),w.get(a.id).node=a,P(a);else if(e.children(r).length>0){p.info("A pure cluster node XBX1",r,a.id,a.x,a.y,a.width,a.height,e.parent(r)),a.height+=c,e.node(a.parentId);const y=(a==null?void 0:a.padding)/2||0,f=((E=a==null?void 0:a.labelBBox)==null?void 0:E.height)||0,n=f-y||0;p.debug("OffsetY",n,"labelHeight",f,"halfPadding",y),await W(d,a),w.get(a.id).node=a}else{const y=e.node(a.parentId);a.y+=c/2,p.info("A regular node XBX1 - using the padding",a.id,"parent",a.parentId,a.width,a.height,a.x,a.y,"offsetY",a.offsetY,"parent",y,y==null?void 0:y.offsetY,a),P(a)}}));const o=c/2;return M(e,o,{mergeSelfLoops:L}).forEach(function({edge:r,start:a,end:E}){p.info("Edge "+a+" -> "+E+": "+JSON.stringify(r),r),r.points.forEach(u=>u.y+=o);const y=e.node(a),f=e.node(E),n=q(g,r,w,s,y,f,h);Q(r,n)}),e.nodes().forEach(function(r){const a=e.node(r);p.info(r,a.type,a.diff),a.isGroup&&(i=a.diff)}),p.warn("Returning from recursive render XAX",t,i),{elem:t,diff:i}},"paintDagreLayoutCore"),ne=m(async t=>{const e=await k(t);return G(e.graph),await oe(e)},"renderDagreSubgraph"),O=m(t=>{var d,g,s,h,L,c;const e=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((d=t.config)==null?void 0:d.nodeSpacing)||t.nodeSpacing||((s=(g=t.config)==null?void 0:g.flowchart)==null?void 0:s.nodeSpacing),ranksep:((h=t.config)==null?void 0:h.rankSpacing)||t.rankSpacing||((c=(L=t.config)==null?void 0:L.flowchart)==null?void 0:c.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(i=>{e.setNode(i.id,{...i}),i.parentId&&e.setParent(i.id,i.parentId)}),p.debug("Edges:",t.edges),t.edges.forEach(i=>{if(i.start===i.end){const o=i.start,l=o+"---"+o+"---1",r=o+"---"+o+"---2",a=e.node(o);e.setNode(l,{domId:l,id:l,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(l,a.parentId),e.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(r,a.parentId);const E=structuredClone(i),y=structuredClone(i),f=structuredClone(i),n=structuredClone(i);y.originalEdge=E,y.selfLoop={id:E.id,order:0},f.originalEdge=E,f.selfLoop={id:E.id,order:1},n.originalEdge=E,n.selfLoop={id:E.id,order:2},y.label="",y.arrowTypeEnd="none",y.endLabelLeft="",y.endLabelRight="",y.startLabelLeft="",y.id=o+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=o+"-cyclic-special-mid",n.label="",n.startLabelRight="",n.startLabelLeft="",n.arrowTypeStart="none",a.isGroup&&(y.fromCluster=o,n.toCluster=o),n.id=o+"-cyclic-special-2",n.arrowTypeStart="none",e.setEdge(o,l,y,o+"-cyclic-special-0"),e.setEdge(l,r,f,o+"-cyclic-special-1"),e.setEdge(r,o,n,o+"-cyclic-special-2")}else e.setEdge(i.start,i.end,{...i},i.id)}),_(e),{graph:e}},"prepareLayoutForDagre"),se=m(async(t,{element:e,preparedLayout:d})=>{const g=d??O(t),s=A(),h=await k({element:e,graph:g.graph,diagramType:t.type,id:t.diagramId,parentCluster:void 0,siteConfig:s});return g.measuredLayout=h,h},"measureDagreLayout"),ie=m((t,e)=>{var g;const d=(g=e.preparedLayout)==null?void 0:g.measuredLayout;if(!d)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return G(d.graph),ae(t,d),d},"runDagreLayoutCore"),de=m((t,{measure:e})=>D(e.graph).map(d=>e.graph.node(d)).filter(Boolean),"getDagrePaintNodes"),le=m((t,e,{measure:d})=>t?d.graph.node(t):void 0,"getDagreEdgeNode"),ye=H({prepareLayout:O,measureLayout:se,runLayoutCore:ie,paintOptions:{clusterDb:w,getNodes:de,getEdgeNode:le,skipNode:m((t,{measure:e})=>!e.graph.hasNode(t.id),"skipNode"),isCluster:m((t,{measure:e})=>e.graph.hasNode(t.id)&&(e.graph.children(t.id)??[]).length>0,"isCluster")}});export{ae as applyDagreLayoutResult,M as getEdgesToRender,se as measureDagreLayout,O as prepareLayoutForDagre,ye as render,ie as runDagreLayoutCore}; diff --git a/static/ml_canvas/assets/diagram-S7CK7UJ4-zlxvjyBt.js b/static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js similarity index 96% rename from static/ml_canvas/assets/diagram-S7CK7UJ4-zlxvjyBt.js rename to static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js index 41a731053..78838bea7 100644 --- a/static/ml_canvas/assets/diagram-S7CK7UJ4-zlxvjyBt.js +++ b/static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js @@ -1,4 +1,4 @@ -import{I as W}from"./chunk-2Q5K7J3B-BBHJD4OQ.js";import{p as X}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-DBa20IFF.js";import{p as te}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` +import{I as W}from"./chunk-2Q5K7J3B-bOW8kvkF.js";import{p as X}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-Bh6LVe7i.js";import{p as te}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,L().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{X(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,L()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function z(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(z,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function T(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=z(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g(T,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=T(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),me=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=T(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),w=p+s.paddingY*2,m=r+s.paddingX+(u?d:0);a.attr("x",m),a.attr("y",t+w/2);const f=m+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:w},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",w-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+w/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),we=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,w)=>{const m=w*(h.rowIndent+h.paddingX),f=me(m,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,m-h.rowIndent,s+v/2,m,s+v/2,h.lineThickness),o=Math.max(o,m+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:w,height:m}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,w+m,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const m=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+m.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=q(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=we(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),U(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return` diff --git a/static/ml_canvas/assets/diagram-UQ7AKVKN-B7U-fTJX.js b/static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js similarity index 95% rename from static/ml_canvas/assets/diagram-UQ7AKVKN-B7U-fTJX.js rename to static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js index 0cc4a9315..c74d8c854 100644 --- a/static/ml_canvas/assets/diagram-UQ7AKVKN-B7U-fTJX.js +++ b/static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js @@ -1,4 +1,4 @@ -import{p as I}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{s as _,g as E,n as F,m as D,a as z,b as P,_ as c,C as G,o as B,z as C,x as w,A as W,l as b,E as V,d as H}from"./mermaid.core-DBa20IFF.js";import{p as j}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>C({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rC({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as oe}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{n as se,m as de,s as le,g as ce,a as me,b as ue,_ as o,l as g,c as T,y as xe,o as fe,z as ge,x as E,A as he,i as P,w as S,a6 as pe}from"./mermaid.core-Bh6LVe7i.js";import{p as be,i as ve}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{s as we}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),fe()},"clear");function O(){A={}}o(O,"reset");var ke=he.eventmodeling,Me=o(()=>ge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function G(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(G,"decidePositionFrame");function j(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(j,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=V(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=j(a,d,r),m=c+l.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(ve(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:G,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:le,setDiagramTitle:de,getDiagramTitle:se,setAst:I,getDiagramProps:R,getState:W},Ae={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Re=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ie(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=T(),l=we(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(l,m.maxR,c,r)),m.boxes.forEach(ne(l,c)),m.relations.forEach(ae(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,(d==null?void 0:d.padding)??30,d==null?void 0:d.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,Ve={parser:Ae,db:F,renderer:Te,styles:Ne};export{Ve as diagram}; diff --git a/static/ml_canvas/assets/diagram-VX7I27RA-NQCb8NMS.js b/static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js similarity index 97% rename from static/ml_canvas/assets/diagram-VX7I27RA-NQCb8NMS.js rename to static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js index 8a8867509..40e050130 100644 --- a/static/ml_canvas/assets/diagram-VX7I27RA-NQCb8NMS.js +++ b/static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js @@ -1,4 +1,4 @@ -import{p as ge}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-DBa20IFF.js";import{s as Ne}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{p as Me}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` +import{p as ge}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-Bh6LVe7i.js";import{s as Ne}from"./chunk-POPQ4Y6H-CGqTimen.js";import{p as Me}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/static/ml_canvas/assets/diagram-Z3DM3KII-DZNpeXsQ.js b/static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js similarity index 95% rename from static/ml_canvas/assets/diagram-Z3DM3KII-DZNpeXsQ.js rename to static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js index 930056fa3..721d0d097 100644 --- a/static/ml_canvas/assets/diagram-Z3DM3KII-DZNpeXsQ.js +++ b/static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js @@ -1,4 +1,4 @@ -import{p as B}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-DBa20IFF.js";import{p as N}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` +import{p as B}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-Bh6LVe7i.js";import{p as N}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` .packetByte { font-size: ${t.byteFontSize}; } diff --git a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-5A6xA75D.js b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js similarity index 84% rename from static/ml_canvas/assets/ebnfDiagram-PWID7BFC-5A6xA75D.js rename to static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js index a03a925ce..c4d947767 100644 --- a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-5A6xA75D.js +++ b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js @@ -1 +1 @@ -import{g as m,r as l,d as n}from"./chunk-SVP7TREG-rNd1SwBb.js";import{p}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as t,l as o}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; +import{g as m,r as l,d as n}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as t,l as o}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; diff --git a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-DUTJfcik.js b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js similarity index 98% rename from static/ml_canvas/assets/erDiagram-RLTQ6QDP-DUTJfcik.js rename to static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js index 41e8add5e..0e9a4db7e 100644 --- a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-DUTJfcik.js +++ b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js @@ -1,4 +1,4 @@ -import{g as Ut}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as Kt}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-DBa20IFF.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-DIwzyvS1.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: +import{g as Ut}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as Kt}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-Bh6LVe7i.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-D4R-Rc0m.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: `+m.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Tt="Parse error on line "+(lt+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Tt,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Et,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,lt=m.yylineno,Et=m.yylloc;break;case 2:if(A=this.productions_[O[1]][1],U.$=_[_.length-A],U._$={first_line:t[t.length-(A||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(A||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(A||1)].range[0],t[t.length-1].range[1]]),St=this.performAction.apply(U,[e,Dt,lt,Y.yy,O[1],_,t].concat(Yt)),typeof St<"u")return St;A&&(d=d.slice(0,-1*A*2),_=_.slice(0,-1*A),t=t.slice(0,-1*A)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(a,h){return this.yy=h||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var h=a.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var h=a.length,d=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),h=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/flowDiagram-HODETNUW-CY2uKpa5.js b/static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js similarity index 99% rename from static/ml_canvas/assets/flowDiagram-HODETNUW-CY2uKpa5.js rename to static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js index 2f2744d1b..8993a088e 100644 --- a/static/ml_canvas/assets/flowDiagram-HODETNUW-CY2uKpa5.js +++ b/static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js @@ -1,4 +1,4 @@ -import{g as Xt}from"./chunk-5VM5RSS4-vgh9rKCo.js";import{g as Qt}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as Jt}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-DBa20IFF.js";import{f as g1}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-DIwzyvS1.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` +import{g as Xt}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{g as Qt}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as Jt}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-Bh6LVe7i.js";import{f as g1}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-D4R-Rc0m.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` `)?d=m+` `:d=`{ `+m+` diff --git a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-BPTKWvnP.js b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js similarity index 99% rename from static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-BPTKWvnP.js rename to static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js index bf8efaff5..aa67d5fcd 100644 --- a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-BPTKWvnP.js +++ b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js @@ -1,4 +1,4 @@ -import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-DBa20IFF.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: +import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-Bh6LVe7i.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: `+F.showPosition()+` Expecting `+pt.join(", ")+", got '"+(this.terminals_[X]||X)+"'":Yt="Parse error on line "+(q+1)+": Unexpected "+(X==A?"end of input":"'"+(this.terminals_[X]||X)+"'"),this.parseError(Yt,{text:F.match,token:this.terminals_[X]||X,line:F.yylineno,loc:st,expected:pt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+K+", token: "+X);switch(Z[0]){case 1:m.push(X),S.push(F.yytext),i.push(F.yylloc),m.push(Z[1]),X=null,c=F.yyleng,o=F.yytext,q=F.yylineno,st=F.yylloc;break;case 2:if(tt=this.productions_[Z[1]][1],J.$=S[S.length-tt],J._$={first_line:i[i.length-(tt||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(tt||1)].first_column,last_column:i[i.length-1].last_column},nt&&(J._$.range=[i[i.length-(tt||1)].range[0],i[i.length-1].range[1]]),at=this.performAction.apply(J,[o,c,q,B.yy,Z[1],S,i].concat(R)),typeof at<"u")return at;tt&&(m=m.slice(0,-1*tt*2),S=S.slice(0,-1*tt),i=i.slice(0,-1*tt)),m.push(this.productions_[Z[1]][0]),S.push(J.$),i.push(J._$),Ut=Y[m[m.length-2]][m[m.length-1]],m.push(Ut);break;case 3:return!0}}return!0},"parse")},T=(function(){var p={EOF:1,parseError:l(function(d,m){if(this.yy.parser)this.yy.parser.parseError(d,m);else throw new Error(d)},"parseError"),setInput:l(function(a,d){return this.yy=d||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:l(function(a){var d=a.length,m=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===u.length?this.yylloc.first_column:0)+u[u.length-m.length].length-m[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(a){this.unput(this.match.slice(a))},"less"),pastInput:l(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js similarity index 99% rename from static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js rename to static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js index c7655dfec..8d279eaef 100644 --- a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js +++ b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js @@ -1,4 +1,4 @@ -import{I as he}from"./chunk-2Q5K7J3B-BBHJD4OQ.js";import{p as $e}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-DBa20IFF.js";import{p as Be}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` +import{I as he}from"./chunk-2Q5K7J3B-bOW8kvkF.js";import{p as $e}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-Bh6LVe7i.js";import{p as Be}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` ${o-n/2-M/2},${u+I} ${o-n/2-M/2},${u-I} ${t.posWithOffset-n/2-M},${u-x-I} diff --git a/static/ml_canvas/assets/index-_bluKNvP.js b/static/ml_canvas/assets/index-BR7Y881F.js similarity index 98% rename from static/ml_canvas/assets/index-_bluKNvP.js rename to static/ml_canvas/assets/index-BR7Y881F.js index 54fb54ffc..1082870d0 100644 --- a/static/ml_canvas/assets/index-_bluKNvP.js +++ b/static/ml_canvas/assets/index-BR7Y881F.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DBa20IFF.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-B6M0swMs.js","assets/EDAPage-CC9tylrM.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-FTzER2c0.js","assets/ModelRegistry-8Pg2diG_.js","assets/DeploymentsPage-BJQ6Vxf0.js","assets/SlowNodesPage-ixEyO8cV.js","assets/AuditLogPage-Dyr3ReJ0.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Bh6LVe7i.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-BvDNVaSU.js","assets/EDAPage-BkzWx__1.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-DBBkKEof.js","assets/ModelRegistry-Bw2YKOFO.js","assets/DeploymentsPage-DlnI46US.js","assets/SlowNodesPage-DjArPNLO.js","assets/AuditLogPage-DPVze77q.js"])))=>i.map(i=>d[i]); var f0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var b0=(e,s,r)=>s in e?f0(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Pt=(e,s,r)=>b0(e,typeof s!="symbol"?s+"":s,r),zi=(e,s,r)=>s.has(e)||zd("Cannot "+r);var C=(e,s,r)=>(zi(e,s,"read from private field"),r?r.call(e):s.get(e)),ne=(e,s,r)=>s.has(e)?zd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,r),Q=(e,s,r,a)=>(zi(e,s,"write to private field"),a?a.call(e,r):s.set(e,r),r),he=(e,s,r)=>(zi(e,s,"access private method"),r);var lo=(e,s,r,a)=>({set _(n){Q(e,s,n,r)},get _(){return C(e,s,a)}});import{j as t,c as wp,b as Bi,d as y0,e as v0,f as Np,g as An,H as wl,P as as,h as j0,k as w0,l as kp,m as N0,E as k0,R as _p,i as Sp,B as Cp,C as Ep,n as Kt,M as _0}from"./vendor-flow-Ct2sLZk5.js";import{g as Rp,a as p,b as ae,af as Tp,aC as S0,X as Ee,Q as $n,f as $t,j as Te,a6 as Qe,aD as vc,aE as C0,ar as Mp,a7 as at,a5 as Fn,T as jc,aw as ds,a9 as Ct,A as E0,d as Pa,aF as ri,i as R0,u as T0,aG as M0,aH as P0,D as ge,c as us,aI as I0,C as _t,an as Nl,z as ir,e as Ut,x as Pp,aa as Ie,J as Dn,a0 as Ip,a1 as Ap,q as Es,l as ms,aJ as wc,L as Ln,w as A0,N as $0,o as Dr,aK as F0,ab as D0,m as L0,p as Ce,k as tt,aL as kl,aM as ai,aN as hn,aO as O0,_ as Ia,aP as $p,s as Nc,y as gt,ai as _l,S as lr,Y as On,az as Fp,K as Ae,ap as z0,aq as B0,R as Dp,aB as kc,aQ as xn,aR as V0,aS as _c,aT as Sc,v as tr,aU as U0,aV as Aa,aA as Lp,aW as H0,ak as gn,aX as Op,aY as zp,aZ as W0,a_ as G0,a$ as q0,b0 as Sl,b1 as K0,W as ni,t as oi,ac as Cc,b2 as Bp,b3 as J0,b4 as zn,b5 as Y0,as as Vp,b6 as Zt,ax as Ec,b7 as Q0,V as X0,am as Z0,b8 as eb,b9 as tb,ba as sb,bb as Up,bc as Hp,bd as rb,be as ab,bf as nb,bg as ob,bh as ib,Z as Cl,bi as Rc,bj as Tc,ag as Wp,bk as ii,bl as lb,bm as cb,bn as db,bo as Gp,bp as ub,bq as mb,a4 as qp,br as pb,bs as hb,h as Mc,bt as xb,bu as gb,bv as fb,bw as bb,bx as yb,H as Kp,by as Jp,bz as Yp,bA as Pc,bB as vb,bC as Bd,bD as jb,bE as wb,bF as Nb,bG as kb}from"./vendor-utils-VkF_O5b_.js";import{aY as _b,u as Sb,r as Bn,R as $e,B as Jt,C as Ue,X as Oe,Y as ze,T as Fe,h as lt,aj as Cb,ak as Eb,j as wa,ah as Lr,aZ as Rb,ag as Tb,ai as ht,av as Mb,a_ as pr,a$ as Pb,as as ct,au as hr,at as Zr,b0 as Vi,b1 as Vd}from"./vendor-charts-BkHP8M8k.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var co={},Ud;function Ib(){if(Ud)return co;Ud=1;var e=_b();return co.createRoot=e.createRoot,co.hydrateRoot=e.hydrateRoot,co}var Ab=Ib();const $b=Rp(Ab);var $a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},br,Hs,ca,up,Fb=(up=class extends $a{constructor(){super();ne(this,br);ne(this,Hs);ne(this,ca);Q(this,ca,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Hs)||this.setEventListener(C(this,ca))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Hs))==null||s.call(this),Q(this,Hs,void 0))}setEventListener(s){var r;Q(this,ca,s),(r=C(this,Hs))==null||r.call(this),Q(this,Hs,s(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(s){C(this,br)!==s&&(Q(this,br,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof C(this,br)=="boolean"?C(this,br):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},br=new WeakMap,Hs=new WeakMap,ca=new WeakMap,up),Ic=new Fb,Db={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},Ws,yc,mp,Lb=(mp=class{constructor(){ne(this,Ws,Db);ne(this,yc,!1)}setTimeoutProvider(e){Q(this,Ws,e)}setTimeout(e,s){return C(this,Ws).setTimeout(e,s)}clearTimeout(e){C(this,Ws).clearTimeout(e)}setInterval(e,s){return C(this,Ws).setInterval(e,s)}clearInterval(e){C(this,Ws).clearInterval(e)}},Ws=new WeakMap,yc=new WeakMap,mp),gr=new Lb;function Ob(e){setTimeout(e,0)}var zb=typeof window>"u"||"Deno"in globalThis;function xt(){}function Bb(e,s){return typeof e=="function"?e(s):e}function El(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qp(e,s){return Math.max(e+(s||0)-Date.now(),0)}function Zs(e,s){return typeof e=="function"?e(s):e}function wt(e,s){return typeof e=="function"?e(s):e}function Hd(e,s){const{type:r="all",exact:a,fetchStatus:n,predicate:o,queryKey:i,stale:l}=e;if(i){if(a){if(s.queryHash!==Ac(i,s.options))return!1}else if(!fn(s.queryKey,i))return!1}if(r!=="all"){const c=s.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&s.isStale()!==l||n&&n!==s.state.fetchStatus||o&&!o(s))}function Wd(e,s){const{exact:r,status:a,predicate:n,mutationKey:o}=e;if(o){if(!s.options.mutationKey)return!1;if(r){if(Mr(s.options.mutationKey)!==Mr(o))return!1}else if(!fn(s.options.mutationKey,o))return!1}return!(a&&s.state.status!==a||n&&!n(s))}function Ac(e,s){return((s==null?void 0:s.queryKeyHashFn)||Mr)(e)}function Mr(e){return JSON.stringify(e,(s,r)=>Rl(r)?Object.keys(r).sort().reduce((a,n)=>(a[n]=r[n],a),{}):r)}function fn(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(r=>fn(e[r],s[r])):!1}var Vb=Object.prototype.hasOwnProperty;function Xp(e,s,r=0){if(e===s)return e;if(r>500)return s;const a=Gd(e)&&Gd(s);if(!a&&!(Rl(e)&&Rl(s)))return s;const o=(a?e:Object.keys(e)).length,i=a?s:Object.keys(s),l=i.length,c=a?new Array(l):{};let d=0;for(let u=0;u{gr.setTimeout(s,e)})}function Tl(e,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,s):r.structuralSharing!==!1?Xp(e,s):s}function Hb(e,s,r=0){const a=[...e,s];return r&&a.length>r?a.slice(1):a}function Wb(e,s,r=0){const a=[s,...e];return r&&a.length>r?a.slice(0,-1):a}var $c=Symbol();function Zp(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===$c?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fc(e,s){return typeof e=="function"?e(...s):!!e}function Gb(e,s,r){let a=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=s()),a||(a=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var bn=(()=>{let e=()=>zb;return{isServer(){return e()},setIsServer(s){e=s}}})();function Ml(){let e,s;const r=new Promise((n,o)=>{e=n,s=o});r.status="pending",r.catch(()=>{});function a(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{a({status:"fulfilled",value:n}),e(n)},r.reject=n=>{a({status:"rejected",reason:n}),s(n)},r}var qb=Ob;function Kb(){let e=[],s=0,r=l=>{l()},a=l=>{l()},n=qb;const o=l=>{s?e.push(l):n(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&n(()=>{a(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;s++;try{c=l()}finally{s--,s||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{a=l},setScheduler:l=>{n=l}}}var et=Kb(),da,Gs,ua,pp,Jb=(pp=class extends $a{constructor(){super();ne(this,da,!0);ne(this,Gs);ne(this,ua);Q(this,ua,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),a=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){C(this,Gs)||this.setEventListener(C(this,ua))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Gs))==null||s.call(this),Q(this,Gs,void 0))}setEventListener(s){var r;Q(this,ua,s),(r=C(this,Gs))==null||r.call(this),Q(this,Gs,s(this.setOnline.bind(this)))}setOnline(s){C(this,da)!==s&&(Q(this,da,s),this.listeners.forEach(a=>{a(s)}))}isOnline(){return C(this,da)}},da=new WeakMap,Gs=new WeakMap,ua=new WeakMap,pp),zo=new Jb;function Yb(e){return Math.min(1e3*2**e,3e4)}function eh(e){return(e??"online")==="online"?zo.isOnline():!0}var Pl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function th(e){let s=!1,r=0,a;const n=Ml(),o=()=>n.status!=="pending",i=g=>{var b;if(!o()){const y=new Pl(g);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{s=!0},c=()=>{s=!1},d=()=>Ic.isFocused()&&(e.networkMode==="always"||zo.isOnline())&&e.canRun(),u=()=>eh(e.networkMode)&&e.canRun(),m=g=>{o()||(a==null||a(),n.resolve(g))},h=g=>{o()||(a==null||a(),n.reject(g))},x=()=>new Promise(g=>{var b;a=y=>{(o()||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;a=void 0,o()||(g=e.onContinue)==null||g.call(e)}),f=()=>{if(o())return;let g;const b=r===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(m).catch(y=>{var k;if(o())return;const v=e.retry??(bn.isServer()?0:3),j=e.retryDelay??Yb,w=typeof j=="function"?j(r,y):j,N=v===!0||typeof v=="number"&&rd()?void 0:x()).then(()=>{s?h(y):f()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(a==null||a(),n),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?f():x().then(f),n)}}var yr,hp,sh=(hp=class{constructor(){ne(this,yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),El(this.gcTime)&&Q(this,yr,gr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,yr)!==void 0&&(gr.clearTimeout(C(this,yr)),Q(this,yr,void 0))}},yr=new WeakMap,hp);function Qb(e){return{onFetch:(s,r)=>{var u,m,h,x,f;const a=s.options,n=(h=(m=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,o=((x=s.state.data)==null?void 0:x.pages)||[],i=((f=s.state.data)==null?void 0:f.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=j=>{Gb(j,()=>s.signal,()=>g=!0)},y=Zp(s.options,s.fetchOptions),v=async(j,w,N)=>{if(g)return Promise.reject(s.signal.reason);if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const T={client:s.client,queryKey:s.queryKey,pageParam:w,direction:N?"backward":"forward",meta:s.options.meta};return b(T),T})(),R=await y(_),{maxPages:M}=s.options,E=N?Wb:Hb;return{pages:E(j.pages,R,M),pageParams:E(j.pageParams,w,M)}};if(n&&o.length){const j=n==="backward",w=j?rh:Il,N={pages:o,pageParams:i},k=w(a,N);l=await v(N,k,j)}else{const j=e??o.length;do{const w=c===0?i[0]??a.initialPageParam:Il(a,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c{var g,b;return(b=(g=s.options).persister)==null?void 0:b.call(g,d,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=d}}}function Il(e,{pages:s,pageParams:r}){const a=s.length-1;return s.length>0?e.getNextPageParam(s[a],s,r[a],r):void 0}function rh(e,{pages:s,pageParams:r}){var a;return s.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,s[0],s,r[0],r):void 0}function p6(e,s){return s?Il(e,s)!=null:!1}function h6(e,s){return!s||!e.getPreviousPageParam?!1:rh(e,s)!=null}var ma,vr,pa,At,jr,rt,Rn,wr,jt,ah,ys,xp,Xb=(xp=class extends sh{constructor(s){super();ne(this,jt);ne(this,ma);ne(this,vr);ne(this,pa);ne(this,At);ne(this,jr);ne(this,rt);ne(this,Rn);ne(this,wr);Q(this,wr,!1),Q(this,Rn,s.defaultOptions),this.setOptions(s.options),this.observers=[],Q(this,jr,s.client),Q(this,At,C(this,jr).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Q(this,vr,Jd(this.options)),this.state=s.state??C(this,vr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ma)}get promise(){var s;return(s=C(this,rt))==null?void 0:s.promise}setOptions(s){if(this.options={...C(this,Rn),...s},s!=null&&s._type&&Q(this,ma,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Jd(this.options);r.data!==void 0&&(this.setState(Kd(r.data,r.dataUpdatedAt)),Q(this,vr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,At).remove(this)}setData(s,r){const a=Tl(this.state.data,s,this.options);return he(this,jt,ys).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(s){he(this,jt,ys).call(this,{type:"setState",state:s})}cancel(s){var a,n;const r=(a=C(this,rt))==null?void 0:a.promise;return(n=C(this,rt))==null||n.cancel(s),r?r.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,vr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>wt(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$c||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>Zs(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Qp(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(a=>a.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}onOnline(){var r;const s=this.observers.find(a=>a.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),C(this,At).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(C(this,rt)&&(C(this,wr)||he(this,jt,ah).call(this)?C(this,rt).cancel({revert:!0}):C(this,rt).cancelRetry()),this.scheduleGc()),C(this,At).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,ys).call(this,{type:"invalidate"})}async fetch(s,r){var d,u,m,h,x,f,g,b,y,v,j;if(this.state.fetchStatus!=="idle"&&((d=C(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,rt))return C(this,rt).continueRetry(),C(this,rt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const a=new AbortController,n=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Q(this,wr,!0),a.signal)})},o=()=>{const w=Zp(this.options,r),k=(()=>{const _={client:C(this,jr),queryKey:this.queryKey,meta:this.meta};return n(_),_})();return Q(this,wr,!1),this.options.persister?this.options.persister(w,k,this):w(k)},l=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,jr),state:this.state,fetchFn:o};return n(w),w})(),c=C(this,ma)==="infinite"?Qb(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Q(this,pa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&he(this,jt,ys).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Q(this,rt,th({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Pl&&w.revert&&this.setState({...C(this,pa),fetchStatus:"idle"}),a.abort()},onFail:(w,N)=>{he(this,jt,ys).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{he(this,jt,ys).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,ys).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await C(this,rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=C(this,At).config).onSuccess)==null||x.call(h,w,this),(g=(f=C(this,At).config).onSettled)==null||g.call(f,w,this.state.error,this),w}catch(w){if(w instanceof Pl){if(w.silent)return C(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,jt,ys).call(this,{type:"error",error:w}),(y=(b=C(this,At).config).onError)==null||y.call(b,w,this),(j=(v=C(this,At).config).onSettled)==null||j.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},ma=new WeakMap,vr=new WeakMap,pa=new WeakMap,At=new WeakMap,jr=new WeakMap,rt=new WeakMap,Rn=new WeakMap,wr=new WeakMap,jt=new WeakSet,ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ys=function(s){const r=a=>{switch(s.type){case"failed":return{...a,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...nh(a.data,this.options),fetchMeta:s.meta??null};case"success":const n={...a,...Kd(s.data,s.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,pa,s.manual?n:void 0),n;case"error":const o=s.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...s.state}}};this.state=r(this.state),et.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),C(this,At).notify({query:this,type:"updated",action:s})})},xp);function nh(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eh(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kd(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jd(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,r=s!==void 0,a=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ft,ye,Tn,mt,Nr,ha,vs,qs,Mn,xa,ga,kr,_r,Ks,fa,ke,cn,Al,$l,Fl,Dl,Ll,Ol,zl,oh,gp,Zb=(gp=class extends $a{constructor(s,r){super();ne(this,ke);ne(this,ft);ne(this,ye);ne(this,Tn);ne(this,mt);ne(this,Nr);ne(this,ha);ne(this,vs);ne(this,qs);ne(this,Mn);ne(this,xa);ne(this,ga);ne(this,kr);ne(this,_r);ne(this,Ks);ne(this,fa,new Set);this.options=r,Q(this,ft,s),Q(this,qs,null),Q(this,vs,Ml()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Yd(C(this,ye),this.options)?he(this,ke,cn).call(this):this.updateResult(),he(this,ke,Dl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bl(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bl(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,ke,Ll).call(this),he(this,ke,Ol).call(this),C(this,ye).removeObserver(this)}setOptions(s){const r=this.options,a=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,ke,zl).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Oo(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const n=this.hasListeners();n&&Qd(C(this,ye),a,this.options,r)&&he(this,ke,cn).call(this),this.updateResult(),n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||Zs(this.options.staleTime,C(this,ye))!==Zs(r.staleTime,C(this,ye)))&&he(this,ke,Al).call(this);const o=he(this,ke,$l).call(this);n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||o!==C(this,Ks))&&he(this,ke,Fl).call(this,o)}getOptimisticResult(s){const r=C(this,ft).getQueryCache().build(C(this,ft),s),a=this.createResult(r,s);return ty(this,a)&&(Q(this,mt,a),Q(this,ha,this.options),Q(this,Nr,C(this,ye).state)),a}getCurrentResult(){return C(this,mt)}trackResult(s,r){return new Proxy(s,{get:(a,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,vs).status==="pending"&&C(this,vs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,n))})}trackProp(s){C(this,fa).add(s)}getCurrentQuery(){return C(this,ye)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=C(this,ft).defaultQueryOptions(s),a=C(this,ft).getQueryCache().build(C(this,ft),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(s){return he(this,ke,cn).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,mt)))}createResult(s,r){var M;const a=C(this,ye),n=this.options,o=C(this,mt),i=C(this,Nr),l=C(this,ha),d=s!==a?s.state:C(this,Tn),{state:u}=s;let m={...u},h=!1,x;if(r._optimisticResults){const E=this.hasListeners(),T=!E&&Yd(s,r),S=E&&Qd(s,a,r,n);(T||S)&&(m={...m,...nh(u.data,s.options)}),r._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:b}=m;x=m.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let E;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,y=!0):E=typeof r.placeholderData=="function"?r.placeholderData((M=C(this,ga))==null?void 0:M.state.data,C(this,ga)):r.placeholderData,E!==void 0&&(b="success",x=Tl(o==null?void 0:o.data,E,r),h=!0)}if(r.select&&x!==void 0&&!y)if(o&&x===(i==null?void 0:i.data)&&r.select===C(this,Mn))x=C(this,xa);else try{Q(this,Mn,r.select),x=r.select(x),x=Tl(o==null?void 0:o.data,x,r),Q(this,xa,x),Q(this,qs,null)}catch(E){Q(this,qs,E)}C(this,qs)&&(f=C(this,qs),x=C(this,xa),g=Date.now(),b="error");const v=m.fetchStatus==="fetching",j=b==="pending",w=b==="error",N=j&&v,k=x!==void 0,R={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!j,isLoadingError:w&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&k,isStale:Dc(s,r),refetch:this.refetch,promise:C(this,vs),isEnabled:wt(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const E=R.data!==void 0,T=R.status==="error"&&!E,S=A=>{T?A.reject(R.error):E&&A.resolve(R.data)},P=()=>{const A=Q(this,vs,R.promise=Ml());S(A)},I=C(this,vs);switch(I.status){case"pending":s.queryHash===a.queryHash&&S(I);break;case"fulfilled":(T||R.data!==I.value)&&P();break;case"rejected":(!T||R.error!==I.reason)&&P();break}}return R}updateResult(){const s=C(this,mt),r=this.createResult(C(this,ye),this.options);if(Q(this,Nr,C(this,ye).state),Q(this,ha,this.options),C(this,Nr).data!==void 0&&Q(this,ga,C(this,ye)),Oo(r,s))return;Q(this,mt,r);const a=()=>{if(!s)return!0;const{notifyOnChangeProps:n}=this.options,o=typeof n=="function"?n():n;if(o==="all"||!o&&!C(this,fa).size)return!0;const i=new Set(o??C(this,fa));return this.options.throwOnError&&i.add("error"),Object.keys(C(this,mt)).some(l=>{const c=l;return C(this,mt)[c]!==s[c]&&i.has(c)})};he(this,ke,oh).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,ke,Dl).call(this)}},ft=new WeakMap,ye=new WeakMap,Tn=new WeakMap,mt=new WeakMap,Nr=new WeakMap,ha=new WeakMap,vs=new WeakMap,qs=new WeakMap,Mn=new WeakMap,xa=new WeakMap,ga=new WeakMap,kr=new WeakMap,_r=new WeakMap,Ks=new WeakMap,fa=new WeakMap,ke=new WeakSet,cn=function(s){he(this,ke,zl).call(this);let r=C(this,ye).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(xt)),r},Al=function(){he(this,ke,Ll).call(this);const s=Zs(this.options.staleTime,C(this,ye));if(bn.isServer()||C(this,mt).isStale||!El(s))return;const a=Qp(C(this,mt).dataUpdatedAt,s)+1;Q(this,kr,gr.setTimeout(()=>{C(this,mt).isStale||this.updateResult()},a))},$l=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Fl=function(s){he(this,ke,Ol).call(this),Q(this,Ks,s),!(bn.isServer()||wt(this.options.enabled,C(this,ye))===!1||!El(C(this,Ks))||C(this,Ks)===0)&&Q(this,_r,gr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ic.isFocused())&&he(this,ke,cn).call(this)},C(this,Ks)))},Dl=function(){he(this,ke,Al).call(this),he(this,ke,Fl).call(this,he(this,ke,$l).call(this))},Ll=function(){C(this,kr)!==void 0&&(gr.clearTimeout(C(this,kr)),Q(this,kr,void 0))},Ol=function(){C(this,_r)!==void 0&&(gr.clearInterval(C(this,_r)),Q(this,_r,void 0))},zl=function(){const s=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(s===C(this,ye))return;const r=C(this,ye);Q(this,ye,s),Q(this,Tn,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},oh=function(s){et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(C(this,mt))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},gp);function ey(e,s){return wt(s.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&wt(s.retryOnMount,e)===!1)}function Yd(e,s){return ey(e,s)||e.state.data!==void 0&&Bl(e,s,s.refetchOnMount)}function Bl(e,s,r){if(wt(s.enabled,e)!==!1&&Zs(s.staleTime,e)!=="static"){const a=typeof r=="function"?r(e):r;return a==="always"||a!==!1&&Dc(e,s)}return!1}function Qd(e,s,r,a){return(e!==s||wt(a.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Dc(e,r)}function Dc(e,s){return wt(s.enabled,e)!==!1&&e.isStaleByTime(Zs(s.staleTime,e))}function ty(e,s){return!Oo(e.getCurrentResult(),s)}var Pn,es,it,Sr,ts,Bs,fp,sy=(fp=class extends sh{constructor(s){super();ne(this,ts);ne(this,Pn);ne(this,es);ne(this,it);ne(this,Sr);Q(this,Pn,s.client),this.mutationId=s.mutationId,Q(this,it,s.mutationCache),Q(this,es,[]),this.state=s.state||ih(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){C(this,es).includes(s)||(C(this,es).push(s),this.clearGcTimeout(),C(this,it).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Q(this,es,C(this,es).filter(r=>r!==s)),this.scheduleGc(),C(this,it).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){C(this,es).length||(this.state.status==="pending"?this.scheduleGc():C(this,it).remove(this))}continue(){var s;return((s=C(this,Sr))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,l,c,d,u,m,h,x,f,g,b,y,v,j,w,N,k,_;const r=()=>{he(this,ts,Bs).call(this,{type:"continue"})},a={client:C(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Sr,th({fn:()=>this.options.mutationFn?this.options.mutationFn(s,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{he(this,ts,Bs).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{he(this,ts,Bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,it).canRun(this)}));const n=this.state.status==="pending",o=!C(this,Sr).canStart();try{if(n)r();else{he(this,ts,Bs).call(this,{type:"pending",variables:s,isPaused:o}),C(this,it).config.onMutate&&await C(this,it).config.onMutate(s,this,a);const M=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,s,a));M!==this.state.context&&he(this,ts,Bs).call(this,{type:"pending",context:M,variables:s,isPaused:o})}const R=await C(this,Sr).start();return await((d=(c=C(this,it).config).onSuccess)==null?void 0:d.call(c,R,s,this.state.context,this,a)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,R,s,this.state.context,a)),await((x=(h=C(this,it).config).onSettled)==null?void 0:x.call(h,R,null,this.state.variables,this.state.context,this,a)),await((g=(f=this.options).onSettled)==null?void 0:g.call(f,R,null,s,this.state.context,a)),he(this,ts,Bs).call(this,{type:"success",data:R}),R}catch(R){try{await((y=(b=C(this,it).config).onError)==null?void 0:y.call(b,R,s,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((j=(v=this.options).onError)==null?void 0:j.call(v,R,s,this.state.context,a))}catch(M){Promise.reject(M)}try{await((N=(w=C(this,it).config).onSettled)==null?void 0:N.call(w,void 0,R,this.state.variables,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,R,s,this.state.context,a))}catch(M){Promise.reject(M)}throw he(this,ts,Bs).call(this,{type:"error",error:R}),R}finally{C(this,it).runNext(this)}}},Pn=new WeakMap,es=new WeakMap,it=new WeakMap,Sr=new WeakMap,ts=new WeakSet,Bs=function(s){const r=a=>{switch(s.type){case"failed":return{...a,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...a,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:s.error,failureCount:a.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),et.batch(()=>{C(this,es).forEach(a=>{a.onMutationUpdate(s)}),C(this,it).notify({mutation:this,type:"updated",action:s})})},fp);function ih(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js,Lt,In,bp,ry=(bp=class extends $a{constructor(s={}){super();ne(this,js);ne(this,Lt);ne(this,In);this.config=s,Q(this,js,new Set),Q(this,Lt,new Map),Q(this,In,0)}build(s,r,a){const n=new sy({client:s,mutationCache:this,mutationId:++lo(this,In)._,options:s.defaultMutationOptions(r),state:a});return this.add(n),n}add(s){C(this,js).add(s);const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);a?a.push(s):C(this,Lt).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(C(this,js).delete(s)){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);if(a)if(a.length>1){const n=a.indexOf(s);n!==-1&&a.splice(n,1)}else a[0]===s&&C(this,Lt).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r),n=a==null?void 0:a.find(o=>o.state.status==="pending");return!n||n===s}else return!0}runNext(s){var a;const r=uo(s);if(typeof r=="string"){const n=(a=C(this,Lt).get(r))==null?void 0:a.find(o=>o!==s&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{C(this,js).forEach(s=>{this.notify({type:"removed",mutation:s})}),C(this,js).clear(),C(this,Lt).clear()})}getAll(){return Array.from(C(this,js))}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Wd(r,a))}findAll(s={}){return this.getAll().filter(r=>Wd(s,r))}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(s.map(r=>r.continue().catch(xt))))}},js=new WeakMap,Lt=new WeakMap,In=new WeakMap,bp);function uo(e){var s;return(s=e.options.scope)==null?void 0:s.id}var ws,Js,bt,Ns,ks,To,Vl,yp,ay=(yp=class extends $a{constructor(r,a){super();ne(this,ks);ne(this,ws);ne(this,Js);ne(this,bt);ne(this,Ns);Q(this,ws,r),this.setOptions(a),this.bindMethods(),he(this,ks,To).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const a=this.options;this.options=C(this,ws).defaultMutationOptions(r),Oo(this.options,a)||C(this,ws).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,bt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Mr(a.mutationKey)!==Mr(this.options.mutationKey)?this.reset():((n=C(this,bt))==null?void 0:n.state.status)==="pending"&&C(this,bt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,bt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,ks,To).call(this),he(this,ks,Vl).call(this,r)}getCurrentResult(){return C(this,Js)}reset(){var r;(r=C(this,bt))==null||r.removeObserver(this),Q(this,bt,void 0),he(this,ks,To).call(this),he(this,ks,Vl).call(this)}mutate(r,a){var n;return Q(this,Ns,a),(n=C(this,bt))==null||n.removeObserver(this),Q(this,bt,C(this,ws).getMutationCache().build(C(this,ws),this.options)),C(this,bt).addObserver(this),C(this,bt).execute(r)}},ws=new WeakMap,Js=new WeakMap,bt=new WeakMap,Ns=new WeakMap,ks=new WeakSet,To=function(){var a;const r=((a=C(this,bt))==null?void 0:a.state)??ih();Q(this,Js,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(r){et.batch(()=>{var a,n,o,i,l,c,d,u;if(C(this,Ns)&&this.hasListeners()){const m=C(this,Js).variables,h=C(this,Js).context,x={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(a=C(this,Ns)).onSuccess)==null||n.call(a,r.data,m,h,x)}catch(f){Promise.reject(f)}try{(i=(o=C(this,Ns)).onSettled)==null||i.call(o,r.data,null,m,h,x)}catch(f){Promise.reject(f)}}else if((r==null?void 0:r.type)==="error"){try{(c=(l=C(this,Ns)).onError)==null||c.call(l,r.error,m,h,x)}catch(f){Promise.reject(f)}try{(u=(d=C(this,Ns)).onSettled)==null||u.call(d,void 0,r.error,m,h,x)}catch(f){Promise.reject(f)}}}this.listeners.forEach(m=>{m(C(this,Js))})})},yp),ss,vp,ny=(vp=class extends $a{constructor(s={}){super();ne(this,ss);this.config=s,Q(this,ss,new Map)}build(s,r,a){const n=r.queryKey,o=r.queryHash??Ac(n,r);let i=this.get(o);return i||(i=new Xb({client:s,queryKey:n,queryHash:o,options:s.defaultQueryOptions(r),state:a,defaultOptions:s.getQueryDefaults(n)}),this.add(i)),i}add(s){C(this,ss).has(s.queryHash)||(C(this,ss).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=C(this,ss).get(s.queryHash);r&&(s.destroy(),r===s&&C(this,ss).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return C(this,ss).get(s)}getAll(){return[...C(this,ss).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Hd(r,a))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(a=>Hd(s,a)):r}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},ss=new WeakMap,vp),Ge,Ys,Qs,ba,ya,Xs,va,ja,jp,oy=(jp=class{constructor(e={}){ne(this,Ge);ne(this,Ys);ne(this,Qs);ne(this,ba);ne(this,ya);ne(this,Xs);ne(this,va);ne(this,ja);Q(this,Ge,e.queryCache||new ny),Q(this,Ys,e.mutationCache||new ry),Q(this,Qs,e.defaultOptions||{}),Q(this,ba,new Map),Q(this,ya,new Map),Q(this,Xs,0)}mount(){lo(this,Xs)._++,C(this,Xs)===1&&(Q(this,va,Ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onFocus())})),Q(this,ja,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onOnline())})))}unmount(){var e,s;lo(this,Xs)._--,C(this,Xs)===0&&((e=C(this,va))==null||e.call(this),Q(this,va,void 0),(s=C(this,ja))==null||s.call(this),Q(this,ja,void 0))}isFetching(e){return C(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),r=C(this,Ge).build(this,s),a=r.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zs(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(a))}getQueriesData(e){return C(this,Ge).findAll(e).map(({queryKey:s,state:r})=>{const a=r.data;return[s,a]})}setQueryData(e,s,r){const a=this.defaultQueryOptions({queryKey:e}),n=C(this,Ge).get(a.queryHash),o=n==null?void 0:n.state.data,i=Bb(s,o);if(i!==void 0)return C(this,Ge).build(this,a).setData(i,{...r,manual:!0})}setQueriesData(e,s,r){return et.batch(()=>C(this,Ge).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,s,r)]))}getQueryState(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state}removeQueries(e){const s=C(this,Ge);et.batch(()=>{s.findAll(e).forEach(r=>{s.remove(r)})})}resetQueries(e,s){const r=C(this,Ge);return et.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const r={revert:!0,...s},a=et.batch(()=>C(this,Ge).findAll(e).map(n=>n.cancel(r)));return Promise.all(a).then(xt).catch(xt)}invalidateQueries(e,s={}){return et.batch(()=>(C(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},s)))}refetchQueries(e,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},a=et.batch(()=>C(this,Ge).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,r);return r.throwOnError||(o=o.catch(xt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(xt)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const r=C(this,Ge).build(this,s);return r.isStaleByTime(Zs(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zo.isOnline()?C(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Ge)}getMutationCache(){return C(this,Ys)}getDefaultOptions(){return C(this,Qs)}setDefaultOptions(e){Q(this,Qs,e)}setQueryDefaults(e,s){C(this,ba).set(Mr(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...C(this,ba).values()],r={};return s.forEach(a=>{fn(e,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(e,s){C(this,ya).set(Mr(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...C(this,ya).values()],r={};return s.forEach(a=>{fn(e,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const s={...C(this,Qs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Ac(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===$c&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Ge).clear(),C(this,Ys).clear()}},Ge=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,ba=new WeakMap,ya=new WeakMap,Xs=new WeakMap,va=new WeakMap,ja=new WeakMap,jp),lh=p.createContext(void 0),Fa=e=>{const s=p.useContext(lh);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},iy=({client:e,children:s})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(lh.Provider,{value:e,children:s})),ch=p.createContext(!1),ly=()=>p.useContext(ch);ch.Provider;function cy(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dy=p.createContext(cy()),uy=()=>p.useContext(dy),my=(e,s,r)=>{const a=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Fc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(s.isReset()||(e.retryOnMount=!1))},py=e=>{p.useEffect(()=>{e.clearReset()},[e])},hy=({result:e,errorResetBoundary:s,throwOnError:r,query:a,suspense:n})=>e.isError&&!s.isReset()&&!e.isFetching&&a&&(n&&e.data===void 0||Fc(r,[e.error,a])),xy=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...n)=>r(a(...n)):r(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},gy=(e,s)=>e.isLoading&&e.isFetching&&!s,fy=(e,s)=>(e==null?void 0:e.suspense)&&s.isPending,Xd=(e,s,r)=>s.fetchOptimistic(e).catch(()=>{r.clearReset()});function by(e,s,r){var x,f,g,b;const a=ly(),n=uy(),o=Fa(),i=o.defaultQueryOptions(e);(f=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||f.call(x,i);const l=o.getQueryCache().get(i.queryHash),c=e.subscribed!==!1;i._optimisticResults=a?"isRestoring":c?"optimistic":void 0,xy(i),my(i,n,l),py(n);const d=!o.getQueryCache().get(i.queryHash),[u]=p.useState(()=>new s(o,i)),m=u.getOptimisticResult(i),h=!a&&c;if(p.useSyncExternalStore(p.useCallback(y=>{const v=h?u.subscribe(et.batchCalls(y)):xt;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),p.useEffect(()=>{u.setOptions(i)},[i,u]),fy(i,m))throw Xd(i,u,n);if(hy({result:m,errorResetBoundary:n,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw m.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,i,m),i.experimental_prefetchInRender&&!bn.isServer()&&gy(m,a)){const y=d?Xd(i,u,n):l==null?void 0:l.promise;y==null||y.catch(xt).finally(()=>{u.updateResult()})}return i.notifyOnChangeProps?m:u.trackResult(m)}function li(e,s){return by(e,Zb)}function ci(e,s){const r=Fa(),[a]=p.useState(()=>new ay(r,e));p.useEffect(()=>{a.setOptions(e)},[a,e]);const n=p.useSyncExternalStore(p.useCallback(i=>a.subscribe(et.batchCalls(i)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=p.useCallback((i,l)=>{a.mutate(i,l).catch(xt)},[a]);if(n.error&&Fc(a.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const yy="modulepreload",vy=function(e){return"/"+e},Zd={},cr=function(s,r,a){let n=Promise.resolve();if(r&&r.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(r.map(d=>{if(d=vy(d),d in Zd)return;Zd[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":yy,u||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((x,f)=>{h.addEventListener("load",x),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};/** * react-router v7.18.2 * @@ -14,7 +14,7 @@ Please change the parent to {a=l},i}function pu(e,s){if(e===void 0)throw new Error("Unexpected undefined");return e}const Uj=(e,s)=>Math.abs(e-s)<1.01,Hj=(e,s,r)=>{let a;return function(...n){e.clearTimeout(a),a=e.setTimeout(()=>s.apply(this,n),r)}},hu=e=>{const{offsetWidth:s,offsetHeight:r}=e;return{width:s,height:r}},Wj=e=>e,Gj=e=>{const s=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1),a=[];for(let n=s;n<=r;n++)a.push(n);return a},qj=(e,s)=>{const r=e.scrollElement;if(!r)return;const a=e.targetWindow;if(!a)return;const n=i=>{const{width:l,height:c}=i;s({width:Math.round(l),height:Math.round(c)})};if(n(hu(r)),!a.ResizeObserver)return()=>{};const o=new a.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c!=null&&c.borderBoxSize){const d=c.borderBoxSize[0];if(d){n({width:d.inlineSize,height:d.blockSize});return}}n(hu(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(r,{box:"border-box"}),()=>{o.unobserve(r)}},xu={passive:!0},gu=typeof window>"u"?!0:"onscrollend"in window,Kj=(e,s)=>{const r=e.scrollElement;if(!r)return;const a=e.targetWindow;if(!a)return;let n=0;const o=e.options.useScrollendEvent&&gu?()=>{}:Hj(a,()=>{s(n,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:m,isRtl:h}=e.options;n=m?r.scrollLeft*(h&&-1||1):r.scrollTop,o(),s(n,u)},l=i(!0),c=i(!1);r.addEventListener("scroll",l,xu);const d=e.options.useScrollendEvent&&gu;return d&&r.addEventListener("scrollend",c,xu),()=>{r.removeEventListener("scroll",l),d&&r.removeEventListener("scrollend",c)}},Jj=(e,s,r)=>{if(s!=null&&s.borderBoxSize){const a=s.borderBoxSize[0];if(a)return Math.round(a[r.options.horizontal?"inlineSize":"blockSize"])}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},Yj=(e,{adjustments:s=0,behavior:r},a)=>{var n,o;const i=e+s;(o=(n=a.scrollElement)==null?void 0:n.scrollTo)==null||o.call(n,{[a.options.horizontal?"left":"top"]:i,behavior:r})};class Qj{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,a,n;return((n=(a=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:a.now)==null?void 0:n.call(a))??Date.now()},this.observer=(()=>{let r=null;const a=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(n=>{n.forEach(o=>{const i=()=>{const l=o.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var n;(n=a())==null||n.disconnect(),r=null},observe:n=>{var o;return(o=a())==null?void 0:o.observe(n,{box:"border-box"})},unobserve:n=>{var o;return(o=a())==null?void 0:o.unobserve(n)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([a,n])=>{typeof n>"u"&&delete r[a]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Wj,rangeExtractor:Gj,onChange:()=>{},measureElement:Jj,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...r}},this.notify=r=>{var a,n;(n=(a=this.options).onChange)==null||n.call(a,this,r)},this.maybeNotify=Wr(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const a=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==a){if(this.cleanup(),!a){this.maybeNotify();return}this.scrollElement=a,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(n=>{this.observer.observe(n)}),this.unsubs.push(this.options.observeElementRect(this,n=>{this.scrollRect=n,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(n,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,a)=>{const n=new Map,o=new Map;for(let i=a-1;i>=0;i--){const l=r[i];if(n.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.endi.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Wr(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,a,n,o,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:a,scrollMargin:n,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Wr(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:a,scrollMargin:n,getItemKey:o,enabled:i,lanes:l,laneAssignmentMode:c},d)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const x of this.laneAssignments.keys())x>=r&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,u),h=new Array(l).fill(void 0);for(let x=0;x1){b=g;const k=h[b],_=k!==void 0?m[k]:void 0;y=_?_.end+this.options.gap:a+n}else{const k=this.options.lanes===1?m[x-1]:this.getFurthestMeasurement(m,x);y=k?k.end+this.options.gap:a+n,b=k?k.lane:x%this.options.lanes,this.options.lanes>1&&v&&this.laneAssignments.set(x,b)}const j=d.get(f),w=typeof j=="number"?j:this.options.estimateSize(x),N=y+w;m[x]={index:x,start:y,size:w,end:N,key:f,lane:b},h[b]=x}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Wr(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,a,n,o)=>this.range=r.length>0&&a>0?Xj({measurements:r,outerSize:a,scrollOffset:n,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Wr(()=>{let r=null,a=null;const n=this.calculateRange();return n&&(r=n.startIndex,a=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,a]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,a]},(r,a,n,o,i)=>o===null||i===null?[]:r({startIndex:o,endIndex:i,overscan:a,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const a=this.options.indexAttribute,n=r.getAttribute(a);return n?parseInt(n,10):(console.warn(`Missing attribute name '${a}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var a;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((a=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:a.index);if(n!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,n-o),l=Math.min(this.options.count-1,n+o);return r>=i&&r<=l}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const a=this.indexFromElement(r),n=this.options.getItemKey(a),o=this.elementsCache.get(n);o!==r&&(o&&this.observer.unobserve(o),this.observer.observe(r),this.elementsCache.set(n,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,a)=>{var n;const o=this.measurementsCache[r];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,l=a-i;l!==0&&(((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,l,this):o.start[this.getVirtualIndexes(),this.getMeasurements()],(r,a)=>{const n=[];for(let o=0,i=r.length;othis.options.debug}),this.getVirtualItemForOffset=r=>{const a=this.getMeasurements();if(a.length!==0)return pu(a[Lh(0,a.length-1,n=>pu(a[n]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,a,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();a==="auto"&&(a=r>=i+o?"end":"start"),a==="center"?r+=(n-o)/2:a==="end"&&(r-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,r),0)},this.getOffsetForIndex=(r,a="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),i=this.measurementsCache[r];if(!i)return;if(a==="auto")if(i.end>=o+n-this.options.scrollPaddingEnd)a="end";else if(i.start<=o+this.options.scrollPaddingStart)a="start";else return[o,a];if(a==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),a];const l=a==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,a,i.size),a]},this.scrollToOffset=(r,{align:a="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(r,a),i=this.now();this.scrollState={index:null,align:a,behavior:n,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:a="auto",behavior:n="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getOffsetForIndex(r,a);if(!o)return;const[i,l]=o,c=this.now();this.scrollState={index:r,align:l,behavior:n,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:a="auto"}={})=>{const n=this.getScrollOffset()+r,o=this.now();this.scrollState={index:null,align:"start",behavior:a,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var r;const a=this.getMeasurements();let n;if(a.length===0)n=this.options.paddingStart;else if(this.options.lanes===1)n=((r=a[a.length-1])==null?void 0:r.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=a.length-1;for(;i>=0&&o.some(l=>l===null);){const l=a[i];o[l.lane]===null&&(o[l.lane]=l.end),i--}n=Math.max(...o.filter(l=>l!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:a,behavior:n})=>{this.options.scrollToFn(r,{behavior:n,adjustments:a},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const a=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=a?a[0]:this.scrollState.lastTargetOffset,o=1,i=n!==this.scrollState.lastTargetOffset;if(!i&&Uj(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=n,this.scrollState.behavior="auto",this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Lh=(e,s,r,a)=>{for(;e<=s;){const n=(e+s)/2|0,o=r(n);if(oa)s=n-1;else return n}return e>0?e-1:0};function Xj({measurements:e,outerSize:s,scrollOffset:r,lanes:a}){const n=e.length-1,o=c=>e[c].start;if(e.length<=a)return{startIndex:0,endIndex:n};let i=Lh(0,n,o,r),l=i;if(a===1)for(;l1){const c=Array(a).fill(0);for(;lu=0&&d.some(u=>u>=r);){const u=e[i];d[u.lane]=u.start,i--}i=Math.max(0,i-i%a),l=Math.min(n,l+(a-1-l%a))}return{startIndex:i,endIndex:l}}const fu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Zj({useFlushSync:e=!0,...s}){const r=p.useReducer(()=>({}),{})[1],a={...s,onChange:(o,i)=>{var l;e&&i?Bn.flushSync(r):r(),(l=s.onChange)==null||l.call(s,o,i)}},[n]=p.useState(()=>new Qj(a));return n.setOptions(a),fu(()=>n._didMount(),[]),fu(()=>n._willUpdate()),n}function ew(e){return Zj({observeElementRect:qj,observeElementOffset:Kj,scrollToFn:Yj,...e})}function Uo({items:e,renderItem:s,estimateSize:r,threshold:a=50,getKey:n,className:o,overscan:i=8}){const l=p.useRef(null),c=ew({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>r,overscan:i});if(e.length<=a)return t.jsx("div",{ref:l,className:o,children:e.map((u,m)=>t.jsx(ae.Fragment,{children:s(u,m)},n(u,m)))});const d=c.getVirtualItems();return t.jsx("div",{ref:l,className:o,children:t.jsx("div",{style:{height:c.getTotalSize(),width:"100%",position:"relative"},children:d.map(u=>{const m=e[u.index];return t.jsx("div",{"data-index":u.index,ref:c.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${u.start}px)`},children:s(m,u.index)},n(m,u.index))})})})}class Gc extends ae.Component{constructor(){super(...arguments);Pt(this,"state",{error:null});Pt(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,a){var n,o;console.error("[ErrorBoundary]",r,a),(o=(n=this.props).onError)==null||o.call(n,r,a)}render(){const{error:r}=this.state;return r?this.props.fallback?this.props.fallback(r,this.reset):t.jsx("div",{role:"alert",className:"flex h-full w-full items-center justify-center p-8",children:t.jsxs("div",{className:"max-w-lg rounded-xl border border-red-200 bg-red-50 p-6 dark:border-red-900/50 dark:bg-red-950/40",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx(Te,{className:"h-6 w-6 text-red-600 dark:text-red-400"}),t.jsx("h2",{className:"text-lg font-semibold text-red-900 dark:text-red-100",children:"Something went wrong"})]}),t.jsx("p",{className:"mb-4 text-sm text-red-800 dark:text-red-200",children:r.message||"An unexpected error occurred while rendering this view."}),t.jsxs("button",{type:"button",onClick:this.reset,className:"inline-flex items-center gap-2 rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus-ring",children:[t.jsx(Pp,{className:"h-4 w-4"}),"Try again"]})]})}):this.props.children}}const Oh=p.createContext(null),tw=({children:e})=>{const[s,r]=p.useState(null),a=p.useRef(null),n=p.useCallback(l=>new Promise(c=>{a.current=c,r({...l,resolve:c})}),[]),o=p.useCallback(l=>{const c=a.current;a.current=null,r(null),c==null||c(l)},[]),i=p.useMemo(()=>({confirm:n}),[n]);return t.jsxs(Oh.Provider,{value:i,children:[e,s&&t.jsx(sw,{...s,onConfirm:()=>o(!0),onCancel:()=>o(!1)})]})};function Yt(){const e=p.useContext(Oh);if(!e)throw new Error("useConfirm must be used inside ");return e.confirm}const sw=({title:e,message:s,confirmLabel:r="Confirm",cancelLabel:a="Cancel",variant:n="default",onConfirm:o,onCancel:i})=>{const l=n==="danger";return t.jsx(Tt,{isOpen:!0,onClose:i,size:"md",ariaLabelledBy:"confirm-dialog-title",title:t.jsxs("span",{id:"confirm-dialog-title",className:"flex items-center gap-2",children:[l&&t.jsx(Te,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}),e]}),footer:t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:i,className:"rounded-md border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 focus-ring dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700",children:a}),t.jsx("button",{type:"button",onClick:o,className:l?"rounded-md bg-red-600 px-3 py-2 text-sm font-medium text-white hover:bg-red-700 focus-ring":"rounded-md action-primary px-3 py-2 text-sm font-medium focus-ring",children:r})]}),children:t.jsx("div",{className:"px-6 py-4 text-sm text-slate-700 dark:text-slate-300",children:s})})};function pt(e,s){const r=e.get("oc."+s);if(r===null)return null;const a=r.trim();return a===""?null:a}function po(e,s){const r=pt(e,s);if(r===null)return null;const a=Number(r);return Number.isInteger(a)?a:null}const rw={job(e){const s=pt(e,"jobId");return s===null?null:{kind:"job",jobId:s}},pipeline(e){const s=pt(e,"pipelineId");return s===null?null:{kind:"pipeline",pipelineId:s}},node(e){const s=pt(e,"nodeId");if(s===null)return null;const r=pt(e,"pipelineId");return r===null?{kind:"node",nodeId:s}:{kind:"node",nodeId:s,pipelineId:r}},dataset(e){const s=pt(e,"datasetId");return s===null?null:{kind:"dataset",datasetId:s}},modelVersion(e){const s=pt(e,"jobId"),r=pt(e,"version");return s===null||r===null?null:{kind:"modelVersion",jobId:s,version:r}},deployment(e){const s=po(e,"deploymentId");return s===null?null:{kind:"deployment",deploymentId:s}},driftCheck(e){const s=po(e,"checkId");if(s===null)return null;const r=pt(e,"jobId");return r===null?{kind:"driftCheck",checkId:s}:{kind:"driftCheck",checkId:s,jobId:r}},incident(e){const s=po(e,"incidentId");return s===null?null:{kind:"incident",incidentId:s}},auditEntry(e){const s=po(e,"auditId");if(s===null)return null;const r=pt(e,"datasetId");return r===null?{kind:"auditEntry",auditId:s}:{kind:"auditEntry",auditId:s,datasetId:r}},slowNode(e){const s=pt(e,"stepType");if(s===null)return null;const r=pt(e,"nodeId");return r===null?{kind:"slowNode",stepType:s}:{kind:"slowNode",stepType:s,nodeId:r}}},aw=new Map(Object.entries(rw));function zh(e){switch(e.kind){case"pipeline":return["pipelineId",e.pipelineId];case"node":return["nodeId",e.nodeId];case"dataset":return["datasetId",e.datasetId];case"deployment":return["deploymentId",e.deploymentId];case"driftCheck":return["checkId",e.checkId];case"incident":return["incidentId",e.incidentId];case"auditEntry":return["auditId",e.auditId];case"slowNode":return["stepType",e.stepType];default:return["jobId",e.jobId]}}function ho(e,s,r){r!==void 0&&e.set(`oc.${s}`,r)}function nw(e,s){const[r,a]=zh(s);switch(e.set(`oc.${r}`,String(a)),s.kind){case"modelVersion":e.set("oc.version",s.version);break;case"node":ho(e,"pipelineId",s.pipelineId);break;case"driftCheck":ho(e,"jobId",s.jobId);break;case"auditEntry":ho(e,"datasetId",s.datasetId);break;case"slowNode":ho(e,"nodeId",s.nodeId);break}}const qi="oc.",Jl="oc.f.",ow=["1h","6h","24h","7d","30d","all"],iw={job:"/jobs",pipeline:"/canvas",node:"/canvas",dataset:"/data",modelVersion:"/registry",deployment:"/deployments",driftCheck:"/drift",incident:"/errors",auditEntry:"/audit",slowNode:"/slow-nodes"},lw={job:"Job",pipeline:"Pipeline",node:"Node",dataset:"Dataset",modelVersion:"Model version",deployment:"Deployment",driftCheck:"Drift check",incident:"Incident",auditEntry:"Audit entry",slowNode:"Slow node"};function cw(e){return ow.includes(e)}function dw(e){const s=new URLSearchParams,{ref:r}=e;s.set(`${qi}kind`,r.kind),nw(s,r),e.origin!==void 0&&s.set(`${qi}origin`,e.origin),e.timeRange!==void 0&&s.set(`${qi}t`,e.timeRange);for(const[a,n]of Object.entries(e.filters??{}))s.set(Jl+a,n);return`?${s.toString()}`}function uw(e){const s=pt(e,"kind");if(s===null)return null;const r=aw.get(s);return r?r(e):null}function Bh(e){const s=typeof e=="string"?new URLSearchParams(e.startsWith("?")?e.slice(1):e):e,r=uw(s);if(r===null)return null;const a={ref:r},n=pt(s,"origin");n!==null&&(a.origin=n);const o=pt(s,"t");o!==null&&cw(o)&&(a.timeRange=o);const i={};for(const[l,c]of s.entries())l.startsWith(Jl)&&(i[l.slice(Jl.length)]=c);return Object.keys(i).length>0&&(a.filters=i),a}function mw(e){return`${iw[e.ref.kind]}${dw(e)}`}function Vh(e){const s=lw[e.kind];return e.kind==="modelVersion"?`${s} ${e.version} (job ${e.jobId})`:`${s} ${zh(e)[1]}`}const rr=({recordRef:e,label:s,origin:r,timeRange:a,filters:n,copyable:o=!1,className:i=""})=>{const[l,c]=p.useState(!1),d=p.useRef(void 0);p.useEffect(()=>()=>window.clearTimeout(d.current),[]);const u={ref:e,...r!==void 0?{origin:r}:{},...a!==void 0?{timeRange:a}:{},...n!==void 0?{filters:n}:{}},m=mw(u),h=Vh(e),x=p.useCallback(async()=>{const f=`${window.location.origin}${m}`;try{await navigator.clipboard.writeText(f),c(!0),window.clearTimeout(d.current),d.current=window.setTimeout(()=>c(!1),1500)}catch{}},[m]);return t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(ls,{to:m,"aria-label":h,title:h,className:`text-blue-600 hover:underline dark:text-blue-400 ${i}`,children:s??h}),o&&t.jsx("button",{type:"button",onClick:x,"aria-label":l?"Link copied":`Copy link to ${h}`,className:"rounded p-0.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200",children:l?t.jsx(Ie,{size:12}):t.jsx(Dn,{size:12})})]})};function pw(e){if(!e)return null;const s=new Date(e);return Number.isNaN(s.getTime())?e:s.toLocaleString()}const hw=({isOpen:e,onClose:s,target:r,nodeId:a,origin:n,filters:o})=>{const i=p.useRef(0),[l,c]=p.useState(a),[d,u]=p.useState(null),[m,h]=p.useState(!1),[x,f]=p.useState(null);p.useEffect(()=>{e&&c(a)},[e,a,r]);const g=p.useCallback(async()=>{const v=i.current+1;i.current=v,h(!0),f(null);try{const j=r.kind==="job"?await yt.getJobNode(r.jobId,l):await yt.getPipelineRunNode(r.pipelineId,l);if(v!==i.current)return;u(j)}catch(j){if(v!==i.current)return;u(null),f(j instanceof Error?j.message:"Failed to load node detail.")}finally{v===i.current&&h(!1)}},[r,l]);p.useEffect(()=>{if(e)return g(),()=>{i.current++}},[e,g]);const b=p.useCallback(v=>{c(v.node_id)},[]),y=d?pw(d.finished_at??d.started_at):null;return t.jsx(Tt,{isOpen:e,onClose:s,title:"Node Inspector",size:"2xl",children:t.jsxs("div",{className:"p-6 space-y-5",children:[m&&t.jsx(Rs,{message:"Loading node detail..."}),!m&&x&&t.jsx(sr,{error:x,onRetry:g}),!m&&!x&&d&&t.jsxs(t.Fragment,{children:[y&&t.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400 italic",children:["This is the graph as executed on ",y," β€” a historical snapshot, not live pipeline state."]}),t.jsx(xw,{data:d,origin:n,filters:o}),t.jsx(gw,{data:d,handleWalkTo:b}),t.jsx(bw,{data:d}),t.jsx(fw,{data:d,currentNodeId:l,origin:n,filters:o})]})]})})};function xw({data:e,origin:s,filters:r}){return t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-slate-500 dark:text-slate-400",children:"Job"}),t.jsx(rr,{recordRef:{kind:"job",jobId:e.job_id},...s!==void 0?{origin:s}:{},...r!==void 0?{filters:r}:{}})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-slate-500 dark:text-slate-400",children:"Dataset"}),t.jsx(rr,{recordRef:{kind:"dataset",datasetId:e.dataset_source_id},label:e.dataset_name??e.dataset_source_id,...s!==void 0?{origin:s}:{},...r!==void 0?{filters:r}:{}})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-slate-500 dark:text-slate-400",children:"Status"}),t.jsx("div",{className:"font-medium text-slate-800 dark:text-slate-200 capitalize",children:e.status})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-slate-500 dark:text-slate-400",children:"Branch"}),t.jsx("div",{className:"font-medium text-slate-800 dark:text-slate-200",children:e.branch_index??"β€”"})]})]})}function gw({data:e,handleWalkTo:s}){return e.node?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-slate-800 dark:text-slate-100",children:e.node.label}),t.jsxs("p",{className:"text-xs font-mono text-slate-500 dark:text-slate-400",children:[e.node.node_id," Β· ",e.node.step_type]}),typeof e.node.execution_seconds=="number"&&t.jsxs("p",{className:"mt-1 text-xs text-slate-500 dark:text-slate-400 flex items-center gap-1",children:[t.jsx(_t,{size:12,"aria-hidden":"true"}),e.node.execution_seconds.toFixed(2),"s",e.node.execution_status?` Β· ${e.node.execution_status}`:""]})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 dark:text-slate-400 mb-1",children:"Parameters"}),Object.keys(e.node.params).length===0?t.jsx("p",{className:"text-xs text-slate-400 italic",children:"No parameters recorded."}):t.jsx("pre",{className:"text-xs font-mono bg-slate-50 dark:bg-slate-800 rounded-lg p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:JSON.stringify(e.node.params,null,2)})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 dark:text-slate-400 mb-1 flex items-center gap-1",children:[t.jsx(Ip,{size:12,"aria-hidden":"true"})," Upstream"]}),e.node.upstream.length===0?t.jsx("p",{className:"text-xs text-slate-400 italic",children:"None β€” this is a source node."}):t.jsx("ul",{className:"space-y-1",children:e.node.upstream.map(r=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>{s(r)},className:"text-xs text-blue-600 hover:underline dark:text-blue-400",children:[r.label," (",r.node_id,")"]})},r.node_id))})]}),t.jsxs("div",{children:[t.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 dark:text-slate-400 mb-1 flex items-center gap-1",children:[t.jsx(Ap,{size:12,"aria-hidden":"true"})," Downstream"]}),e.node.downstream.length===0?t.jsx("p",{className:"text-xs text-slate-400 italic",children:"None β€” this is a terminal node."}):t.jsx("ul",{className:"space-y-1",children:e.node.downstream.map(r=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>{s(r)},className:"text-xs text-blue-600 hover:underline dark:text-blue-400",children:[r.label," (",r.node_id,")"]})},r.node_id))})]})]})]}):t.jsx(os,{title:"Node not found in this job's executed graph",description:`Node ${e.node_id} isn't present in the graph recorded for job ${e.job_id}. It may have been removed or renamed since this run.`})}function fw({data:e,currentNodeId:s,origin:r,filters:a}){return t.jsx("div",{className:"pt-2 border-t border-slate-100 dark:border-slate-700",children:e.can_open_in_canvas?t.jsx(rr,{recordRef:{kind:"node",nodeId:s,pipelineId:e.pipeline_id},label:"Open in Canvas",...r!==void 0?{origin:r}:{},...a!==void 0?{filters:a}:{}}):t.jsx("p",{className:"text-xs text-slate-400 italic",children:"This run isn't a saved pipeline, so it can't be opened on the canvas."})})}function bw({data:e}){return e.recent_logs.length>0&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-slate-500 dark:text-slate-400 mb-1",children:"Recent log entries"}),t.jsx("ul",{className:"space-y-1",children:e.recent_logs.map((s,r)=>t.jsxs("li",{className:"text-xs text-slate-600 dark:text-slate-300",children:[t.jsx("span",{className:"font-semibold uppercase",children:s.level}),": ",s.message]},r))})]})}const Uh=({nodeId:e,jobId:s,pipelineId:r,label:a,origin:n,filters:o,className:i=""})=>{const[l,c]=p.useState(!1),d=Vh({kind:"node",nodeId:e,...r?{pipelineId:r}:{}}),u=s?{kind:"job",jobId:s}:r?{kind:"pipelineRun",pipelineId:r}:null;return u?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>{c(!0)},"aria-label":d,title:d,className:`text-blue-600 hover:underline dark:text-blue-400 ${i}`,children:a??d}),t.jsx(hw,{isOpen:l,onClose:()=>{c(!1)},target:u,nodeId:e,...n!==void 0?{origin:n}:{},...o!==void 0?{filters:o}:{}})]}):t.jsx("span",{className:"text-xs text-slate-400 italic",children:d})},g6=["#8884d8","#82ca9d","#ffc658","#ff7300","#0088fe","#00C49F","#FFBB28","#FF8042","#a4de6c","#d0ed57"],Yl=()=>typeof document<"u"&&document.documentElement.classList.contains("dark"),Hh=e=>{const s=e?"#f3f4f6":"#17102b";return{axisColor:e?"#abafb7":"#6b6485",gridColor:e?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.1)",textColor:e?"#f3f4f6":"#17102b",subTextColor:e?"#cdd1d7":"#4c4560",bgColor:e?"#222529":"#ffffff",tooltipContentStyle:e?{backgroundColor:"#222529",borderRadius:"8px",border:"1px solid #3b4047",color:s,boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.3)"}:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderRadius:"8px",border:"1px solid #dedce5",color:s,boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},tooltipItemStyle:{color:s},tooltipLabelStyle:{color:s}}},f6=()=>Hh(Yl()),yw=()=>{const[e,s]=p.useState(Yl);return p.useEffect(()=>{const r=document.documentElement,a=new MutationObserver(()=>{s(Yl())});return a.observe(r,{attributes:!0,attributeFilter:["class"]}),()=>{a.disconnect()}},[]),e},hs=()=>Hh(yw()),xo=["#10B981","#EF4444","#F59E0B","#3B82F6"],bu=e=>typeof e=="object"&&e!==null,vw=()=>{const e=hs(),[s,r]=p.useState(null),[a,n]=p.useState([]),[o,i]=p.useState(!0),[l,c]=p.useState(null),[d,u]=p.useState({statusDist:[],dailyActivity:[]}),m=ae.useCallback(()=>{(async()=>{i(!0),c(null);try{const[f,g]=await Promise.all([se.get("/pipeline/stats"),Re.getJobs(50,0)]);r(f.data);const b=g.map(N=>({id:N.job_id,status:N.status,model_type:N.model_type||"Unknown",created_at:N.start_time||N.created_at||new Date().toISOString(),metrics:(()=>{const k=N.metrics??(bu(N.result)?N.result.metrics:void 0);return bu(k)?k:void 0})()}));n(b);const y=b.reduce((N,k)=>(N[k.status]=(N[k.status]||0)+1,N),{}),v=Object.entries(y).map(([N,k])=>({name:N,value:k})),w=[...Array(7)].map((N,k)=>{const _=new Date;return _.setDate(_.getDate()-k),_.toISOString().split("T")[0]}).reverse().map(N=>({date:new Date(N).toLocaleDateString("en-US",{month:"short",day:"numeric"}),count:b.filter(k=>k.created_at.startsWith(N)).length}));u({statusDist:v,dailyActivity:w})}catch(f){console.error("Failed to fetch dashboard data:",f),c("Failed to load dashboard data. Please try again.")}finally{i(!1)}})()},[]);p.useEffect(()=>{m()},[m]);const h=!o&&!l&&s!==null&&s.total_jobs===0&&s.data_sources===0&&a.length===0;return t.jsxs("div",{className:"p-8 space-y-8 animate-in fade-in duration-500",children:[t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-slate-900 dark:text-slate-100",children:"Dashboard"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Overview of your ML pipeline activities"})]}),t.jsx("div",{className:"flex gap-3",children:t.jsxs(ls,{to:"/canvas",className:"flex items-center gap-2 action-primary px-4 py-2 rounded-md shadow-sm transition-all",children:[t.jsx(Es,{size:18}),"New Experiment"]})})]}),h?t.jsx(jw,{}):t.jsxs(t.Fragment,{children:[t.jsx(ww,{stats:s,jobs:a}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsx("h3",{className:"text-lg font-semibold mb-6 text-slate-900 dark:text-slate-100",children:"Weekly Activity"}),t.jsx("div",{className:"h-64",children:t.jsx($e,{width:"100%",height:"100%",children:t.jsxs(Jt,{data:d.dailyActivity,children:[t.jsx(Ue,{strokeDasharray:"3 3",stroke:e.gridColor,vertical:!1}),t.jsx(Oe,{dataKey:"date",stroke:e.axisColor,fontSize:12,tickLine:!1,axisLine:!1}),t.jsx(ze,{stroke:e.axisColor,fontSize:12,tickLine:!1,axisLine:!1,allowDecimals:!1}),t.jsx(Fe,{contentStyle:e.tooltipContentStyle,itemStyle:e.tooltipItemStyle,labelStyle:e.tooltipLabelStyle,cursor:{fill:e.gridColor}}),t.jsx(lt,{dataKey:"count",fill:"#6366f1",radius:[4,4,0,0],barSize:30})]})})})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsx("h3",{className:"text-lg font-semibold mb-6 text-slate-900 dark:text-slate-100",children:"Job Status Distribution"}),t.jsx("div",{className:"h-64",children:t.jsx($e,{width:"100%",height:"100%",children:t.jsxs(Cb,{children:[t.jsx(Eb,{data:d.statusDist,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",children:d.statusDist.map((x,f)=>t.jsx(wa,{fill:x.name==="succeeded"?xo[0]:x.name==="failed"?xo[1]:x.name==="running"?xo[3]:xo[2]},`cell-${f}`))}),t.jsx(Fe,{contentStyle:e.tooltipContentStyle,itemStyle:e.tooltipItemStyle,labelStyle:e.tooltipLabelStyle}),t.jsx(Lr,{verticalAlign:"bottom",height:36,iconType:"circle"})]})})})]})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[t.jsxs("div",{className:"lg:col-span-2 bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"p-6 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center",children:[t.jsx("h2",{className:"text-lg font-semibold text-slate-900 dark:text-slate-100",children:"Recent Jobs"}),t.jsxs(ls,{to:"/jobs",className:"text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 font-medium flex items-center gap-1",children:["View All ",t.jsx(vc,{size:14})]})]}),o?t.jsx(Rs,{message:"Loading recent jobs..."}):l?t.jsx(sr,{error:l,onRetry:m}):a.length===0?t.jsx(os,{title:"No recent jobs found."}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[t.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Job ID"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Time"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:a.slice(0,5).map(x=>t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[t.jsx("td",{className:"px-4 py-4 whitespace-nowrap",children:t.jsx(Dh,{status:x.status})}),t.jsx("td",{className:"px-4 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-slate-100",children:t.jsx("span",{className:"font-mono text-xs bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded",children:x.id.substring(0,8)})}),t.jsx("td",{className:"px-4 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:x.model_type}),t.jsxs("td",{className:"px-4 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:[new Date(x.created_at).toLocaleDateString()," ",t.jsx("span",{className:"text-xs opacity-70",children:new Date(x.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]},x.id))})]})})]}),t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm p-6",children:[t.jsx("h2",{className:"text-lg font-semibold mb-4 text-slate-900 dark:text-slate-100",children:"Quick Actions"}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(Ki,{to:"/data",icon:t.jsx(Ct,{size:18,className:"text-blue-500"}),title:"Manage Data Sources",desc:"Upload or connect new data"}),t.jsx(Ki,{to:"/canvas",icon:t.jsx(ms,{size:18,className:"text-indigo-500"}),title:"Run Pipeline",desc:"Create and execute ML workflows"}),t.jsx(Ki,{to:"/deployments",icon:t.jsx(wc,{size:18,className:"text-green-500"}),title:"View Deployments",desc:"Monitor active model endpoints"})]})]})]})]})]})},go=({title:e,value:s,icon:r,subtext:a,color:n="text-slate-900 dark:text-slate-100"})=>t.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm hover:shadow-md transition-shadow",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:e}),t.jsx("div",{className:`mt-2 text-3xl font-bold ${n}`,children:s})]}),r&&t.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-full",children:r})]}),a&&t.jsxs("div",{className:"mt-2 text-xs text-slate-500 dark:text-slate-400 flex items-center gap-1",children:[t.jsx(at,{size:12})," ",a]})]}),Ki=({to:e,icon:s,title:r,desc:a})=>t.jsxs(ls,{to:e,className:"relative flex items-center gap-4 p-3 pr-7 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors border border-transparent hover:border-slate-200 dark:hover:border-slate-600 group",children:[t.jsx("div",{className:"bg-white dark:bg-slate-700 p-2 rounded-md shadow-sm group-hover:scale-110 transition-transform shrink-0",children:s}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium text-slate-900 dark:text-slate-100 text-sm",children:r}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:a})]}),t.jsx(vc,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-300 opacity-0 group-hover:opacity-100 transition-opacity"})]}),jw=()=>t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm p-10 text-center max-w-3xl mx-auto",children:[t.jsx("h2",{className:"text-2xl font-bold text-slate-900 dark:text-slate-100",children:"Build your first pipeline"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-2",children:"Nothing has run here yet. Three steps to your first trained model:"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-8 text-left",children:[t.jsxs(ls,{to:"/data",className:"p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-indigo-400 dark:hover:border-indigo-500 hover:shadow-md transition-all group",children:[t.jsx(Ct,{size:20,className:"text-blue-500"}),t.jsx("div",{className:"font-medium text-slate-900 dark:text-slate-100 mt-3 group-hover:text-indigo-600 dark:group-hover:text-indigo-400",children:"1. Add a dataset"}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:"Upload a file or pick a sample dataset."})]}),t.jsxs(ls,{to:"/canvas",className:"p-4 rounded-lg border border-slate-200 dark:border-slate-700 hover:border-indigo-400 dark:hover:border-indigo-500 hover:shadow-md transition-all group",children:[t.jsx(Ln,{size:20,className:"text-indigo-500"}),t.jsx("div",{className:"font-medium text-slate-900 dark:text-slate-100 mt-3 group-hover:text-indigo-600 dark:group-hover:text-indigo-400",children:"2. Start from a template"}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:"Browse templates on the canvas and bind your data."})]}),t.jsxs("div",{className:"p-4 rounded-lg border border-slate-200 dark:border-slate-700",children:[t.jsx(ms,{size:20,className:"text-emerald-500"}),t.jsx("div",{className:"font-medium text-slate-900 dark:text-slate-100 mt-3",children:"3. Run and inspect results"}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 mt-1",children:"Run All, then compare runs in Experiments."})]})]})]});function ww({stats:e,jobs:s}){return t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[t.jsx(go,{title:"Total Jobs",value:(e==null?void 0:e.total_jobs)??"-",icon:t.jsx(at,{className:"text-indigo-500"}),subtext:`${(e==null?void 0:e.training_jobs)??0} Training, ${(e==null?void 0:e.tuning_jobs)??0} Tuning`}),t.jsx(go,{title:"Active Deployments",value:(e==null?void 0:e.active_deployments)??"-",icon:t.jsx(wc,{className:"text-green-500"}),color:"text-green-600 dark:text-green-400"}),t.jsx(go,{title:"Data Sources",value:(e==null?void 0:e.data_sources)??"-",icon:t.jsx(Ct,{className:"text-blue-500"})}),t.jsx(go,{title:"Success Rate",value:s.length>0?`${Math.round(s.filter(r=>r.status==="succeeded"||r.status==="completed").length/s.length*100)}%`:"-",icon:t.jsx(Ut,{className:"text-emerald-500"}),subtext:"Last 50 jobs"})]})}const Gr="/data/api",en="/api/ingestion";class Ql extends Error{constructor(s,r){super(s),this.status=r,this.name="DatasetApiError"}}const yu=async(e,s)=>{try{const r=await e.json();return(r==null?void 0:r.message)||(r==null?void 0:r.detail)||(r==null?void 0:r.error)||s}catch{return s}},Wt={getAll:async()=>{const e=await fetch(`${Gr}/sources`);if(!e.ok)throw new Error("Failed to fetch datasets");return(await e.json()).sources||[]},getUsable:async()=>{const e=await fetch(`${Gr}/sources/usable`);if(!e.ok)throw new Error("Failed to fetch usable datasets");return(await e.json()).sources||[]},upload:async e=>{const s=new FormData;s.append("file",e);const r=await fetch(`${en}/upload`,{method:"POST",body:s});if(!r.ok){const a=await r.json();throw new Error(a.detail||"Failed to upload file")}return await r.json()},uploadWithProgress:(e,s)=>{const r=new FormData;return r.append("file",e),new Promise((a,n)=>{const o=new XMLHttpRequest;o.open("POST",`${en}/upload`),o.upload.onprogress=i=>{i.lengthComputable&&s(Math.round(i.loaded/i.total*100))},o.onload=()=>{let i;try{i=JSON.parse(o.responseText)}catch{i=void 0}if(o.status>=200&&o.status<300)a(i);else{const l=i==null?void 0:i.detail;n(new Error(l||"Failed to upload file"))}},o.onerror=()=>n(new Error("Failed to upload file")),o.onabort=()=>n(new Error("Upload cancelled")),o.send(r)})},createSource:async e=>{const s=await fetch(`${en}/database`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw new Error(r.detail||"Failed to create data source")}return await s.json()},getIngestionStatus:async e=>{const s=await fetch(`${en}/${encodeURIComponent(e)}/status`);if(!s.ok)throw new Error("Failed to fetch ingestion status");return await s.json()},cancelIngestion:async e=>{const s=await fetch(`${en}/${encodeURIComponent(e)}/cancel`,{method:"POST"});if(!s.ok){const r=await s.json();throw new Error(r.detail||"Failed to cancel ingestion")}},getById:async e=>{const s=await fetch(`${Gr}/sources/${encodeURIComponent(e)}`);if(!s.ok)throw new Error("Failed to fetch dataset");return(await s.json()).source},getSample:async(e,s=1)=>{const r=new URLSearchParams({limit:s.toString()}),a=await fetch(`${Gr}/sources/${encodeURIComponent(e)}/sample?${r.toString()}`);if(!a.ok)throw new Ql(await yu(a,"Failed to fetch dataset sample"),a.status);return(await a.json()).data},getProfile:async e=>{const s=await fetch(`/api/pipeline/datasets/${encodeURIComponent(e)}/schema`);if(!s.ok)throw new Ql(await yu(s,"Failed to fetch dataset profile"),s.status);const r=await s.json(),a=Object.values(r.columns).map(i=>{const l=i;return{name:l.name,dtype:l.dtype,missing_count:l.missing_count||0,missing_percentage:(l.missing_ratio||0)*100,distinct_count:l.unique_count||0,numeric_summary:l.column_type==="numeric"?{mean:l.mean_value,std:l.std_value,minimum:l.min_value,maximum:l.max_value}:void 0}}),n=r.row_count*r.column_count,o=a.reduce((i,l)=>i+l.missing_count,0);return{metrics:{row_count:r.row_count,column_count:r.column_count,missing_cells:o,missing_percentage:n>0?Number((o/n*100).toFixed(2)):0},columns:a}},delete:async e=>{if(!(await fetch(`${Gr}/sources/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to delete dataset")},exportData:async(e,s="csv",r=1e4)=>{const a=new URLSearchParams({format:s,limit:r.toString()}),n=await fetch(`${Gr}/sources/${encodeURIComponent(e)}/export?${a.toString()}`);if(!n.ok)throw new Error("Failed to export dataset");const o=await n.blob(),l=(n.headers.get("Content-Disposition")||"").match(/filename=(.+)/),c=(l==null?void 0:l[1])??`export.${s}`,d=URL.createObjectURL(o),u=document.createElement("a");u.href=d,u.download=c,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(d)}},fr={all:["datasets"],lists:()=>[...fr.all,"list"],list:e=>[...fr.lists(),e],details:()=>[...fr.all,"detail"],detail:e=>[...fr.details(),e]},Wh=3e4,Nw=e=>li({queryKey:fr.list("all"),queryFn:()=>Wt.getAll(),staleTime:Wh,...(e==null?void 0:e.refetchInterval)!==void 0?{refetchInterval:e.refetchInterval}:{}}),kw=()=>li({queryKey:fr.list("usable"),queryFn:()=>Wt.getUsable(),staleTime:Wh}),_w=e=>(e??[]).some(s=>{var a,n;const r=(n=(a=s.source_metadata)==null?void 0:a.ingestion_status)==null?void 0:n.status;return r==="pending"||r==="processing"});function xi(e){e.invalidateQueries({queryKey:fr.lists()})}const Sw=()=>{const e=Fa();return ci({mutationFn:s=>Wt.delete(s),onSuccess:()=>{xi(e)}})},Gh=()=>{const e=Fa();return ci({mutationFn:s=>Wt.cancelIngestion(s),onSuccess:()=>{xi(e)}})},Cw=()=>{const e=Fa();return ci({mutationFn:s=>Wt.createSource(s),onSuccess:()=>{xi(e)}})},Ew=()=>{const e=Fa();return ci({mutationFn:({file:s,onProgress:r})=>r?Wt.uploadWithProgress(s,r):Wt.upload(s),onSuccess:()=>{xi(e)}})},Rw=()=>li({queryKey:["upload-config"],queryFn:bj,staleTime:300*1e3,retry:1}),Ji={accuracy:"Fraction of correctly classified samples. Can be misleading when classes are imbalanced.",f1:"Harmonic mean of precision and recall. Balances both. Use when false positives and negatives both matter.",f1_weighted:"F1 averaged across classes weighted by class support. Good choice for imbalanced datasets.",f1_macro:"F1 averaged across classes with equal weight regardless of class size.",f1_micro:"F1 computed globally by pooling true/false positives across all classes.",roc_auc:"Area under the ROC curve. 1.0 = perfect classifier, 0.5 = random guess. Threshold-independent.",roc_auc_weighted:"ROC AUC averaged across classes weighted by support.",roc_auc_ovr:"ROC AUC using one-vs-rest strategy.",roc_auc_ovo:"ROC AUC using one-vs-one strategy.",roc_auc_ovr_weighted:"ROC AUC (one-vs-rest, weighted by class support) for multiclass. Higher = better.",roc_auc_ovo_weighted:"ROC AUC (one-vs-one, weighted by class support) for multiclass. Higher = better.",precision:"Of all positive predictions made, how many were actually correct.",precision_weighted:"Precision averaged by class support.",recall:"Of all actual positive samples, how many did the model correctly identify.",recall_weighted:"Recall averaged by class support.",r2:"RΒ² score: fraction of variance explained. 1.0 = perfect, 0 = mean-only baseline, <0 = worse than predicting the mean.",rmse:"Root mean squared error. Same units as the target. Penalises large errors more than MAE.",mae:"Mean absolute error. Lower is better. More robust to outliers than RMSE.",mse:"Mean squared error. Squares errors so large deviations are penalised heavily.",log_loss:"Negative log-likelihood (log loss). Lower is better. Penalises confident wrong predictions.",g_score:"Geometric mean of sensitivity and specificity. Useful for imbalanced classification.",balanced_accuracy:"Accuracy averaged equally across classes. Unlike standard accuracy, not skewed by majority class size.",matthews_corrcoef:"Matthews Correlation Coefficient (MCC). Single number summary of a confusion matrix. +1 = perfect, 0 = random, -1 = inverse. Best metric for imbalanced binary classification.",pr_auc:"Area under Precision-Recall curve. More informative than ROC AUC when the positive class is rare.",pr_auc_weighted:"PR AUC averaged across classes by support.",mape:"Mean absolute percentage error. Expresses average error as a % of the true value. Avoid when targets are near zero.",explained_variance:"Fraction of target variance explained by the model. Like RΒ² but does not penalise systematic bias.",best_score:"Best cross-validation score found across all tuning trials. This value drove hyperparameter selection."},Tw={train:"Train set β€”",test:"Test set (held-out) β€”",val:"Validation set β€”",cv:"Cross-validation mean β€”"};function Mw(e){return e.startsWith("train_")?{prefix:"train",stripped:e.replace("train_","")}:e.startsWith("test_")?{prefix:"test",stripped:e.replace("test_","")}:e.startsWith("val_")?{prefix:"val",stripped:e.replace("val_","")}:e.startsWith("cv_")?{prefix:"cv",stripped:e.replace("cv_","").replace(/_mean$/,"")}:{prefix:"",stripped:e}}function ka(e){if(e==="best_score")return Ji.best_score;if(/^cv_.+_std$/.test(e)){const o=e.replace(/^cv_/,"").replace(/_std$/,""),i=Ji[o];return i?`Std deviation of ${o} across CV folds β€” lower means more consistent results. ${i}`:`Std deviation of ${o} across cross-validation folds. Lower = more consistent.`}const{prefix:s,stripped:r}=Mw(e),a=Ji[r],n=Tw[s];if(a&&n)return`${n} ${a}`;if(a)return a;if(n)return n}const Pw={C:"Inverse regularisation strength β€” smaller values apply stronger regularisation and prevent overfitting.",alpha:"Regularisation strength (L1/L2). Higher values add more penalty to large coefficients to reduce overfitting.",l1_ratio:"Mix ratio between L1 and L2 regularisation (ElasticNet). 0 = pure Ridge, 1 = pure Lasso.",penalty:"Type of regularisation to apply (l1 = sparse, l2 = smooth, elasticnet = both, none).",reg_alpha:"L1 regularisation term. Encourages sparsity in the leaf weights (XGBoost / LightGBM).",reg_lambda:"L2 regularisation term. Smooths the leaf weights to reduce overfitting (XGBoost / LightGBM).",l2_regularization:"L2 regularisation added to each leaf (HistGradientBoosting). Higher = more regularised.",max_depth:"Maximum depth of each tree. Deeper trees capture more patterns but risk overfitting. -1 means unlimited (LightGBM).",n_estimators:"Number of trees to build. More trees improve accuracy but increase training time.",min_samples_split:"Minimum samples required to split a node. Higher values prevent the tree from learning noise.",min_samples_leaf:"Minimum samples that must remain in a leaf after a split. Acts as smoothing; higher values reduce variance.",min_child_weight:"Minimum sum of instance weights in a child node (XGBoost). Higher values make the model more conservative.",min_child_samples:"Minimum data points in a leaf node (LightGBM). Increase to prevent overfitting on small datasets.",max_leaf_nodes:"Maximum number of leaves in each tree (HistGradientBoosting). Limits model complexity.",max_bins:"Number of bins used for feature discretisation (HistGradientBoosting). More bins β†’ finer splits but slower.",num_leaves:"Maximum number of leaves per tree (LightGBM). Directly controls model complexity; prefer over max_depth.",bootstrap:"Whether to train each tree on a bootstrap sample (random sub-sample with replacement) of the data.",criterion:"Function used to measure split quality (gini, entropy for classifiers; squared_error, absolute_error for regressors).",learning_rate:"Shrinkage factor applied to each tree contribution. Lower values need more trees but generalise better.",subsample:"Fraction of training samples used for each tree. Introduces randomness to reduce overfitting.",colsample_bytree:"Fraction of features sampled per tree. Reduces correlation between trees and overfitting.",gamma:"Minimum loss reduction required to make a further partition on a leaf node (XGBoost). Higher = more conservative.",boosting_type:"LightGBM boosting algorithm: gbdt (traditional gradient), dart (dropout), goss (gradient-based sampling).",kernel:"Kernel function used to transform the feature space (rbf, linear, poly, sigmoid). rbf works well for most tasks.",n_neighbors:"Number of nearest neighbours to consider. Lower = more flexible model; higher = smoother decision boundary.",weights:"How neighbours are weighted: uniform (all equal) or distance (closer neighbours have more influence).",algorithm:"Algorithm used to find nearest neighbours: ball_tree, kd_tree, or brute force.",fit_intercept:"Whether to fit a bias term. Disable only if data is already centred.",solver:"Optimisation algorithm. Choice depends on dataset size and regularisation type.",max_iter:"Maximum number of iterations for the solver to converge. Increase if training shows convergence warnings.",selection:"Coefficient update order for coordinate descent (Lasso/ElasticNet): cyclic (stable) or random (faster).",loss:"Loss function for SGD: log_loss = logistic regression (probabilistic), hinge = linear SVM, modified_huber = smooth SVM with outlier tolerance.",var_smoothing:"Portion of the largest variance added to all variances for numerical stability (Gaussian NB)."};function vu(e){return Pw[e]}const Iw={"Target Column":"The column the model is trained to predict.","CV Enabled":"Whether cross-validation was used to estimate generalisation performance.","CV Method":"Cross-validation strategy: KFold splits data into k equal folds; StratifiedKFold preserves class proportions; TimeSeriesSplit respects temporal order.","CV Folds":"Number of cross-validation folds. More folds β†’ more reliable estimate but longer training time.","CV Shuffle":"Whether to randomly shuffle samples before splitting into folds. Recommended unless data is time-ordered.","CV Random State":"Seed for reproducible fold shuffling.",Strategy:"Search strategy for hyperparameter tuning: random (fast, approximate), grid (exhaustive), halving_grid / halving_random (successive halving β€” prunes poor candidates early), optuna (Bayesian optimisation).","Strategy Params":"Additional settings passed to the search strategy (e.g. sampler and pruner for Optuna, factor for halving).",Metric:"Scoring metric used to rank candidate hyperparameter sets during tuning.",Trials:"Number of hyperparameter configurations to evaluate. More trials β†’ better search coverage but longer run time."};function ju(e){return Iw[e]}const qn=e=>e?{accuracy:"Accuracy",f1:"F1",precision:"Precision",recall:"Recall",roc_auc:"ROC AUC",r2:"RΒ²",mse:"MSE",mae:"MAE",rmse:"RMSE",mape:"MAPE",f1_weighted:"F1 Weighted",precision_weighted:"Precision Weighted",recall_weighted:"Recall Weighted",roc_auc_weighted:"ROC AUC Weighted",f1_macro:"F1 Macro",f1_micro:"F1 Micro",precision_macro:"Precision Macro",recall_macro:"Recall Macro",roc_auc_ovr:"ROC AUC OVR",roc_auc_ovo:"ROC AUC OVO",roc_auc_ovr_weighted:"ROC AUC OVR Weighted",roc_auc_ovo_weighted:"ROC AUC OVO Weighted",balanced_accuracy:"Balanced Accuracy",matthews_corrcoef:"MCC",explained_variance:"Explained Variance",log_loss:"Log Loss",neg_mean_squared_error:"MSE",neg_mean_absolute_error:"MAE",neg_root_mean_squared_error:"RMSE",neg_log_loss:"Log Loss"}[e]||e.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase()):"",Ho=(e,s=2)=>{if(!+e)return"0 Bytes";const r=1024,a=s<0?0:s,n=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.floor(Math.log(e)/Math.log(r));return`${Number.parseFloat((e/Math.pow(r,o)).toFixed(a))} ${n[o]}`},Wo=(e,s)=>{if(!e||!s)return"-";const r=new Date(s).getTime()-new Date(e).getTime();if(r<1e3)return"< 1s";const a=Math.floor(r/1e3);if(a<60)return`${a}s`;const n=Math.floor(a/60);return n<60?`${n}m ${a%60}s`:`${Math.floor(n/60)}h ${n%60}m`},Aw=new Set(["voting_classifier","stacking_classifier","voting_regressor","stacking_regressor"]),dr=e=>!!e&&Aw.has(e),Kn=e=>{if(dr(e))return e.endsWith("_regressor")?"regression":"classification"},qh=e=>{if(dr(e))return e.startsWith("stacking")?"Stacking":"Voting"},$w={logistic_regression:"Logistic Regression",linear_regression:"Linear Regression",ridge:"Ridge",lasso:"Lasso",elasticnet:"ElasticNet",random_forest:"Random Forest",extra_trees:"Extra Trees",gradient_boosting:"Gradient Boosting",hist_gradient_boosting:"Hist Gradient Boosting",adaboost:"AdaBoost",decision_tree:"Decision Tree",gaussian_nb:"Gaussian NB",sgd_classifier:"SGD Classifier",svc:"SVC",svr:"SVR",knn:"KNN",xgboost:"XGBoost",lightgbm:"LightGBM"},jn=e=>$w[e]||e.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase());function Fw(e,s,r){return{voting:!s&&typeof e.voting=="string"?e.voting:void 0,passthrough:s&&typeof e.passthrough=="boolean"?e.passthrough:void 0,weights:s?void 0:r}}function Dw(e){return{calibrateBaseModels:e.calibrate_base_models===!0?!0:void 0,calibrationMethod:e.calibrate_base_models===!0&&typeof e.calibration_method=="string"?e.calibration_method:void 0}}const Kh=(e,s)=>{if(!dr(e)||!s)return null;const r=!!e&&e.startsWith("stacking"),a=s.base_estimators,n=Array.isArray(a)?a.filter(l=>typeof l=="string"):[],o=s.weights,i=Array.isArray(o)&&o.every(l=>typeof l=="number")?o:void 0;return{baseEstimators:n,finalEstimator:typeof s.final_estimator=="string"?s.final_estimator:void 0,...Fw(s,r,i),nJobs:typeof s.n_jobs=="number"?s.n_jobs:void 0,...Dw(s),isStacking:r}},Lw={".csv":"CSV",".xlsx":"Excel",".xls":"Excel",".parquet":"Parquet",".json":"JSON",".txt":"TXT",".feather":"Feather"},Jh=({onUploadComplete:e,onCancel:s})=>{const[r,a]=p.useState(!1),[n,o]=p.useState(null),[i,l]=p.useState(0),c=p.useRef(null);p.useEffect(()=>{var v;(v=c.current)==null||v.focus()},[]);const d=Ew(),u=d.isPending,{data:m}=Rw(),h=m==null?void 0:m.max_upload_size_bytes,x=m==null?void 0:m.allowed_extensions,f=p.useCallback(v=>{v.preventDefault(),v.stopPropagation(),v.type==="dragenter"||v.type==="dragover"?a(!0):v.type==="dragleave"&&a(!1)},[]),g=p.useCallback(v=>{v.preventDefault(),v.stopPropagation(),a(!1),v.dataTransfer.files&&v.dataTransfer.files[0]&&y(v.dataTransfer.files[0])},[]),b=v=>{v.preventDefault(),v.target.files&&v.target.files[0]&&y(v.target.files[0])},y=async v=>{if(o(null),l(0),h!==void 0&&v.size>h){o(`File is too large (${Ho(v.size)}). Maximum size is ${Ho(h)}.`);return}try{const j=await d.mutateAsync({file:v,onProgress:l});e(j.job_id,v.name)}catch(j){console.error("Upload failed:",j),o(j.message||"Failed to upload file. Please try again.")}};return t.jsxs("div",{className:"p-4 border rounded-lg bg-slate-50 dark:bg-slate-900 dark:border-slate-700 relative",children:[t.jsx("button",{type:"button","aria-label":"Close dataset upload",title:"Close dataset upload",onClick:s,className:"absolute top-2 right-2 p-1 hover:bg-slate-200 dark:hover:bg-slate-800 rounded-full text-slate-500 dark:text-slate-400 focus-ring",children:t.jsx(Ee,{size:16})}),t.jsxs("h3",{className:"font-medium mb-4 flex items-center gap-2 text-slate-900 dark:text-slate-100",children:[t.jsx(A0,{size:18,className:"text-blue-600 dark:text-blue-400"}),"Upload New Dataset"]}),t.jsx("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${r?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 dark:border-blue-400":"border-slate-300 dark:border-slate-700 hover:border-slate-400 dark:hover:border-slate-600"}`,onDragEnter:f,onDragLeave:f,onDragOver:f,onDrop:g,children:u?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"w-full bg-slate-200 dark:bg-slate-700 rounded-full h-2.5",children:t.jsx("div",{className:"bg-blue-600 h-2.5 rounded-full transition-all duration-300",style:{width:`${i}%`}})}),t.jsxs("p",{className:"text-sm text-slate-600 dark:text-slate-300",children:["Uploading... ",i,"%"]})]}):t.jsxs(t.Fragment,{children:[t.jsx($0,{className:"w-10 h-10 text-slate-500 dark:text-slate-400 mx-auto mb-3"}),t.jsxs("p",{className:"text-sm text-slate-600 dark:text-slate-300 mb-2",children:["Drag and drop your file here, or"," ",t.jsxs("label",{className:"text-blue-600 dark:text-blue-400 hover:underline cursor-pointer font-medium rounded focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",children:["browse",t.jsx("input",{ref:c,"aria-label":"Browse dataset file",type:"file",className:"sr-only",accept:(x==null?void 0:x.join(","))??"",onChange:b})]})]}),x&&t.jsxs("p",{className:"text-xs text-slate-400",children:["Supports ",[...new Set(x.map(v=>Lw[v]??v.toUpperCase().slice(1)))].join(", ")]})]})}),n&&t.jsxs("div",{className:"mt-4 p-3 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 text-sm rounded-md flex items-start gap-2",children:[t.jsx($t,{size:16,className:"mt-0.5 shrink-0"}),t.jsx("span",{children:n})]})]})},Ow=({dataset:e,isOpen:s,onClose:r})=>{const[a,n]=p.useState([]),[o,i]=p.useState(null),[l,c]=p.useState(!1),[d,u]=p.useState(null),[m,h]=p.useState(null),[x,f]=p.useState("sample"),[g,b]=p.useState(100),y=p.useRef(0);p.useEffect(()=>{s&&e?v(100):(n([]),i(null),u(null),h(null),f("sample"),b(100))},[s,e]);const v=async M=>{if(!e)return;const E=++y.current;c(!0),u(null),h(null);try{const[T,S]=await Promise.allSettled([Wt.getSample(e.id,M),Wt.getProfile(e.id)]);if(E!==y.current)return;T.status==="fulfilled"?n(Array.isArray(T.value)?T.value:[]):(console.error("Failed to fetch sample preview:",T.reason),n([]),u(wu("sample",e.name,T.reason))),S.status==="fulfilled"?i(S.value):(console.error("Failed to fetch dataset profile:",S.reason),i(null),h(wu("statistics",e.name,S.reason)))}catch(T){console.error("Failed to fetch data:",T)}finally{E===y.current&&c(!1)}},j=()=>{const M=g+500;b(M),v(M)};if(!e)return null;const w=a.length>0?Object.keys(a[0]):[],N=()=>{const M=d===null&&a.length>0;return d?t.jsx(sr,{error:d,onRetry:()=>{v(g)}}):M?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"border border-slate-200 dark:border-slate-700 rounded-lg overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto max-h-[60vh]",children:t.jsxs("table",{className:"w-full text-sm text-left",children:[t.jsx("thead",{className:"text-xs text-slate-500 dark:text-slate-400 uppercase bg-slate-50 dark:bg-slate-800 border-b border-slate-200 dark:border-slate-700 sticky top-0 z-10",children:t.jsx("tr",{children:w.map(E=>t.jsx("th",{className:"px-4 py-3 font-semibold whitespace-nowrap bg-slate-50 dark:bg-slate-800",children:E},E))})}),t.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700 bg-white dark:bg-slate-900",children:a.map((E,T)=>t.jsx("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:w.map(S=>t.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-slate-700 dark:text-slate-300",children:String(E[S]??"")},`${T}-${S}`))},T))})]})})}),t.jsxs("div",{className:"flex justify-center items-center gap-4",children:[t.jsx("button",{onClick:j,className:"px-4 py-2 text-sm font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 border border-blue-200 dark:border-blue-800 rounded-md hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors",children:"Load More (+500 rows)"}),t.jsxs("span",{className:"text-xs text-slate-500",children:["Showing first ",a.length," rows"]})]})]}):w.length===0?t.jsx(os,{title:"No data available to preview.",description:`"${e.name}" did not return any columns.`}):t.jsx(os,{title:`No preview data for "${e.name}".`,description:"The sample request returned no rows."})},k=()=>{const M=m===null&&o!==null;return t.jsx("div",{className:"space-y-6",children:m?t.jsx(sr,{error:m,onRetry:()=>{v(g)}}):M?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[t.jsx(fo,{label:"Total Rows",value:(o==null?void 0:o.metrics.row_count)!==void 0?o.metrics.row_count.toLocaleString():void 0}),t.jsx(fo,{label:"Total Columns",value:o==null?void 0:o.metrics.column_count}),t.jsx(fo,{label:"Missing Cells",value:(o==null?void 0:o.metrics.missing_cells)!==void 0?o.metrics.missing_cells.toLocaleString():void 0}),t.jsx(fo,{label:"Missing %",value:(o==null?void 0:o.metrics.missing_percentage)!==void 0?`${o.metrics.missing_percentage}%`:void 0})]}),t.jsx("div",{className:"border border-slate-200 dark:border-slate-700 rounded-lg overflow-hidden",children:t.jsxs("table",{className:"w-full text-sm text-left",children:[t.jsx("thead",{className:"text-xs text-slate-500 dark:text-slate-400 uppercase bg-slate-50 dark:bg-slate-800 border-b border-slate-200 dark:border-slate-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Column"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Type"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Missing"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Unique"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Min"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Max"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Mean"}),t.jsx("th",{className:"px-4 py-3 font-semibold",children:"Std Dev"})]})}),t.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700 bg-white dark:bg-slate-900",children:o.columns.map(E=>{var T,S,P,I;return t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-slate-900 dark:text-slate-100",children:E.name}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-slate-500",children:E.dtype}),t.jsxs("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300",children:[E.missing_count," ",t.jsxs("span",{className:"text-xs text-slate-400",children:["(",E.missing_percentage,"%)"]})]}),t.jsx("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300",children:E.distinct_count}),t.jsx("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300 font-mono text-xs",children:((T=E.numeric_summary)==null?void 0:T.minimum.toFixed(2))??"-"}),t.jsx("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300 font-mono text-xs",children:((S=E.numeric_summary)==null?void 0:S.maximum.toFixed(2))??"-"}),t.jsx("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300 font-mono text-xs",children:((P=E.numeric_summary)==null?void 0:P.mean.toFixed(2))??"-"}),t.jsx("td",{className:"px-4 py-3 text-slate-600 dark:text-slate-300 font-mono text-xs",children:((I=E.numeric_summary)==null?void 0:I.std.toFixed(2))??"-"})]},E.name)})})]})})]}):t.jsx(os,{title:`No statistics for "${e.name}".`,description:"The profile request returned no metrics."})})},_=()=>{const M=(o==null?void 0:o.metrics.row_count)??e.rows??void 0,E=(o==null?void 0:o.metrics.column_count)??e.columns??void 0,T=e.size_bytes??void 0,S=t.jsx("span",{"aria-label":"Unknown",children:"β€”"});return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/20 rounded-lg text-blue-600 dark:text-blue-400",children:t.jsx(Ct,{size:24})}),t.jsxs("div",{children:[t.jsx("span",{className:"text-xl font-bold text-slate-900 dark:text-slate-100",children:e.name}),t.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500 dark:text-slate-400 mt-1 font-normal",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Dr,{size:14})," ",e.format||"CSV"]}),t.jsx("span",{children:"β€’"}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(F0,{size:14})," ",M!==void 0?M.toLocaleString():S," rows"]}),t.jsx("span",{children:"β€’"}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(D0,{size:14})," ",E!==void 0?E:S," columns"]}),t.jsx("span",{children:"β€’"}),t.jsx("span",{children:T!==void 0?Ho(T):S})]})]})]})},R=t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{onClick:r,className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})});return t.jsx(Tt,{isOpen:s,onClose:r,title:_(),size:"5xl",footer:R,children:t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex border-b border-slate-200 dark:border-slate-700 px-6",children:[t.jsx("button",{onClick:()=>{f("sample")},className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${x==="sample"?"border-blue-600 text-blue-600 dark:text-blue-400 dark:border-blue-400":"border-transparent text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"}`,children:"Data Sample"}),t.jsx("button",{onClick:()=>{f("stats")},className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${x==="stats"?"border-blue-600 text-blue-600 dark:text-blue-400 dark:border-blue-400":"border-transparent text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"}`,children:"Statistics"})]}),t.jsx("div",{className:"flex-1 overflow-auto p-6",children:l?t.jsx(Rs,{message:`Loading preview data for ${e.name}...`}):x==="sample"?N():k()})]})})},fo=({label:e,value:s})=>t.jsxs("div",{className:"bg-slate-50 dark:bg-slate-800 p-4 rounded-lg border border-slate-200 dark:border-slate-700",children:[t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 uppercase font-semibold",children:e}),t.jsx("div",{className:"text-2xl font-bold text-slate-900 dark:text-slate-100 mt-1",children:s??t.jsx("span",{"aria-label":"Unknown",children:"β€”"})})]}),wu=(e,s,r)=>{const a=e==="sample"?"Sample preview":"Statistics";if(r instanceof Ql){if(r.status===404)return`${a} for "${s}" is unavailable because the source was deleted or moved.${r.message?` ${r.message}`:""}`;if(r.message)return`${a} for "${s}" could not be loaded: ${r.message}`}return`${a} for "${s}" could not be loaded. Please try again.`},zw=({isOpen:e,onClose:s,onSuccess:r})=>{const[a,n]=p.useState("s3"),[o,i]=p.useState(""),[l,c]=p.useState(""),[d,u]=p.useState(!1),[m,h]=p.useState(""),[x,f]=p.useState(""),[g,b]=p.useState(""),[y,v]=p.useState(null),[j,w]=p.useState(!1),N=Cw(),k=N.isPending,_=j&&o.trim()==="",R=j&&a==="s3"&&l.trim()==="",M=async S=>{if(S.preventDefault(),v(null),w(!0),!(o.trim()===""||a==="s3"&&l.trim()===""))try{const P={};a==="s3"&&(P.path=l,m&&x&&(P.storage_options={aws_access_key_id:m,aws_secret_access_key:x,region:g||void 0}));const I={name:o,type:a,config:P,description:`Imported from ${a}`},A=await N.mutateAsync(I);r(A.job_id),s()}catch(P){v(P.message||"Failed to create source")}},E=()=>t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"add-source-s3-path",className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"S3 Path"}),t.jsx("input",{id:"add-source-s3-path",type:"text",required:!0,value:l,onChange:S=>{c(S.target.value)},"aria-invalid":R,"aria-describedby":R?"add-source-s3-path-error":void 0,className:`w-full px-3 py-2 border rounded-md bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100 focus:ring-2 focus:ring-blue-500 ${R?"border-red-400 dark:border-red-600":"border-slate-300 dark:border-slate-600"}`,placeholder:"s3://my-bucket/path/to/data.parquet"}),R&&t.jsx("p",{id:"add-source-s3-path-error",role:"alert",className:"mt-1 text-xs text-red-600 dark:text-red-400",children:"S3 Path is required."})]}),t.jsxs("div",{className:"border border-slate-200 dark:border-slate-700 rounded-md overflow-hidden",children:[t.jsxs("button",{type:"button",onClick:()=>u(!d),"aria-expanded":d,className:"w-full flex items-center justify-between p-3 bg-slate-50 dark:bg-slate-800/50 hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("h4",{className:"text-sm font-medium text-slate-700 dark:text-slate-300",children:"Credentials (Optional)"})}),d?t.jsx(Ce,{size:16,className:"text-slate-500"}):t.jsx(tt,{size:16,className:"text-slate-500"})]}),d&&t.jsxs("div",{className:"p-3 bg-slate-50 dark:bg-slate-800/50 border-t border-slate-200 dark:border-slate-700",children:[t.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"If your bucket is private, provide credentials here. They will be stored securely. Leave blank if using backend's IAM role."}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"add-source-access-key",className:"block text-xs font-medium text-slate-600 dark:text-slate-400 mb-1",children:"Access Key ID"}),t.jsx("input",{id:"add-source-access-key",type:"text",name:"aws_access_key_id",value:m,onChange:S=>{h(S.target.value)},className:"w-full px-2 py-1.5 text-sm border border-slate-300 dark:border-slate-600 rounded-md bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100",placeholder:"AKIA..."})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"add-source-secret-key",className:"block text-xs font-medium text-slate-600 dark:text-slate-400 mb-1",children:"Secret Access Key"}),t.jsx("input",{id:"add-source-secret-key",type:"password",name:"aws_secret_access_key",value:x,onChange:S=>{f(S.target.value)},className:"w-full px-2 py-1.5 text-sm border border-slate-300 dark:border-slate-600 rounded-md bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100",placeholder:"Secret..."})]}),t.jsxs("div",{className:"col-span-2",children:[t.jsx("label",{htmlFor:"add-source-region",className:"block text-xs font-medium text-slate-600 dark:text-slate-400 mb-1",children:"Region"}),t.jsx("input",{id:"add-source-region",type:"text",name:"region_name",value:g,onChange:S=>{b(S.target.value)},className:"w-full px-2 py-1.5 text-sm border border-slate-300 dark:border-slate-600 rounded-md bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100",placeholder:"us-east-1"})]})]})]})]})]}),T=()=>t.jsxs("div",{children:[t.jsx("label",{htmlFor:"add-source-name",className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Name"}),t.jsx("input",{id:"add-source-name",type:"text",required:!0,value:o,onChange:S=>{i(S.target.value)},"aria-invalid":_,"aria-describedby":_?"add-source-name-error":void 0,className:`w-full px-3 py-2 border rounded-md bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100 focus:ring-2 focus:ring-blue-500 ${_?"border-red-400 dark:border-red-600":"border-slate-300 dark:border-slate-600"}`,placeholder:"My Dataset"}),_&&t.jsx("p",{id:"add-source-name-error",role:"alert",className:"mt-1 text-xs text-red-600 dark:text-red-400",children:"Name is required."})]});return t.jsx(Tt,{isOpen:e,onClose:s,title:"Add Data Source",size:"md",children:t.jsxs("div",{className:"p-4",children:[t.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400 mb-4",children:["Connects a remote source that Skyulf re-reads on demand. Amazon S3 is the only connected source type today β€” for a local file, use"," ",t.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",children:"Upload File"})," on the Data Sources page instead."]}),t.jsx("div",{className:"flex gap-2 mb-6",children:t.jsxs("button",{onClick:()=>{n("s3")},"aria-pressed":a==="s3",className:`flex-1 py-2 px-4 rounded-md flex items-center justify-center gap-2 border ${a==="s3"?"bg-blue-50 border-blue-500 text-blue-700 dark:bg-blue-900/20 dark:border-blue-400 dark:text-blue-400":"border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400"}`,children:[t.jsx(L0,{size:16})," S3"]})}),t.jsxs("form",{onSubmit:S=>{M(S)},className:"space-y-4",noValidate:!0,children:[T(),a==="s3"&&E(),y&&t.jsx("div",{role:"alert",className:"p-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-md",children:y}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-md",children:"Cancel"}),t.jsx("button",{type:"submit",disabled:k,className:"px-4 py-2 action-primary rounded-md flex items-center gap-2 disabled:opacity-50",children:k?"Creating...":t.jsxs(t.Fragment,{children:[t.jsx(Ie,{size:16})," Create Source"]})})]})]})]})})};function bo(e,s,r){Ot.getState().addAppMessage(e,r?`${s} -${r}`:s)}const le={success:(e,s)=>{bo("success",e,s)},error:(e,s)=>{bo("error",e,s)},info:(e,s)=>{bo("info",e,s)},warning:(e,s)=>{bo("warning",e,s)}},yo=new Set(["pending","processing"]),Nu=(e,s)=>{var a;const r=(a=e.source_metadata)==null?void 0:a.ingestion_status;return(r==null?void 0:r.message)||(r==null?void 0:r.error)||s},Bw=e=>{var a;const s=(a=e.source_metadata)==null?void 0:a.ingestion_status,r=(s==null?void 0:s.status)||"completed";return r==="failed"?Nu(e,"Ingestion failed"):r==="cancelled"?Nu(e,"Ingestion cancelled"):r==="pending"?"Queued for ingestion":r==="processing"?"Processing ingestion":(s==null?void 0:s.message)||"Ingestion completed successfully"},Vw=({isOpen:e,onClose:s,datasets:r,onRefresh:a,onRetry:n})=>{const o=Gh(),i=o.isPending?o.variables??null:null,l=Yt(),[c,d]=ae.useState(null),u=async v=>{if(await l({title:"Cancel ingestion job?",message:"Are you sure you want to cancel this ingestion job?",confirmLabel:"Cancel job",variant:"danger"}))try{await o.mutateAsync(v),a&&a()}catch(w){console.error("Failed to cancel ingestion:",w),le.error("Failed to cancel ingestion")}},m=async v=>{if(n){d(v.id);try{await n(v)}finally{d(null)}}},h=r.map(v=>{var w,N;const j=((N=(w=v.source_metadata)==null?void 0:w.ingestion_status)==null?void 0:N.status)||"completed";return{dataset:v,id:v.id,name:v.name,status:j,createdAt:v.created_at,message:Bw(v)}}).sort((v,j)=>new Date(j.createdAt).getTime()-new Date(v.createdAt).getTime()),x=h.filter(v=>yo.has(v.status)),f=h.filter(v=>!yo.has(v.status)),g=v=>{const j=v.status==="failed",w=v.status==="cancelled";return v.status==="processing"||v.status==="pending"?t.jsx(ge,{className:"text-blue-500 animate-spin",size:20,"aria-hidden":"true"}):j?t.jsx(ir,{className:"text-red-500",size:20,"aria-hidden":"true"}):w?t.jsx(Nl,{className:"text-slate-500",size:20,"aria-hidden":"true"}):t.jsx(Ut,{className:"text-green-500",size:20,"aria-hidden":"true"})},b=v=>{const j=yo.has(v.status),w=v.status==="failed",N=v.status==="cancelled";return t.jsxs(t.Fragment,{children:[j?t.jsx("p",{role:"status","aria-atomic":"true",className:"text-sm text-slate-600 dark:text-slate-400 mt-1",children:v.status==="processing"?"Processing ingestion":"Queued for ingestion"}):t.jsxs("p",{className:"text-sm text-slate-600 dark:text-slate-400 mt-1",children:["Status: ",t.jsx("span",{className:"capitalize",children:v.status})]}),(w||N)&&t.jsx("p",{className:`text-sm mt-1 p-2 rounded ${w?"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/10":"text-slate-600 dark:text-slate-400 bg-slate-100 dark:bg-slate-800"}`,role:w?"alert":"status","aria-atomic":"true",children:v.message})]})},y=v=>{const j=yo.has(v.status),w=v.status==="failed",N=j,k=w&&n;return t.jsx("div",{className:"pb-4",children:t.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-lg border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800/50",children:[t.jsx("div",{className:"mt-1",children:g(v)}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("h4",{className:"font-medium text-slate-900 dark:text-slate-100",children:v.name}),t.jsxs("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[t.jsx(_t,{size:12,"aria-hidden":"true"}),new Date(v.createdAt).toLocaleString()]})]}),b(v)]}),N&&t.jsx("button",{onClick:()=>{u(v.id)},disabled:i===v.id,className:"p-2 text-slate-400 hover:text-orange-600 hover:bg-orange-50 dark:hover:bg-orange-900/20 rounded-md transition-colors disabled:opacity-50",title:"Cancel ingestion","aria-label":"Cancel ingestion",children:i===v.id?t.jsx(ge,{className:"animate-spin",size:20,"aria-hidden":"true"}):t.jsx(Nl,{size:20,"aria-hidden":"true"})}),k&&t.jsxs("button",{onClick:()=>{m(v.dataset)},disabled:c===v.id,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-blue-700 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors disabled:opacity-50",children:[c===v.id?t.jsx(ge,{className:"animate-spin",size:16,"aria-hidden":"true"}):t.jsx(us,{size:16,"aria-hidden":"true"}),"Retry"]})]})})};return t.jsx(Tt,{isOpen:e,onClose:s,title:"Data Ingestion Activity",size:"3xl",children:t.jsx("div",{className:"p-6 max-h-[70vh] flex flex-col",children:h.length===0?t.jsx("div",{className:"text-center text-slate-500 py-8",children:"No ingestion activity found."}):t.jsxs("div",{className:"flex flex-col gap-6 overflow-y-auto pr-1",children:[t.jsxs("section",{"aria-label":"Active ingestions",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:"Active ingestions"})}),x.length===0?t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"No active ingestions."}):t.jsx(Uo,{items:x,getKey:v=>v.id,estimateSize:108,className:"space-y-4",renderItem:y})]}),t.jsxs("section",{"aria-label":"Ingestion history",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:"Ingestion history"})}),f.length===0?t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"No ingestion history yet."}):t.jsx(Uo,{items:f,getKey:v=>v.id,estimateSize:108,className:"space-y-4",renderItem:y})]})]})})})};function Yi(e){return{id:e.id,datasetId:e.dataset_source_id,versionInt:e.version_int,name:e.name,...e.note?{note:e.note}:{},kind:e.kind==="auto"?"auto":"manual",pinned:!!e.pinned,nodeCount:e.node_count,edgeCount:e.edge_count,...e.dataset_name?{datasetName:e.dataset_name}:{},createdAt:e.created_at,graph:e.graph}}const ea={async list(e){return(await se.get(`/pipeline/versions/${encodeURIComponent(e)}`)).data.map(Yi)},async create(e,s){const r=s.graph!==void 0?s.graph:{nodes:s.nodes??[],edges:s.edges??[]},a={name:s.name,graph:r,...s.note?{note:s.note}:{},...s.datasetName?{dataset_name:s.datasetName}:{},kind:s.kind??"manual",pinned:!!s.pinned},n=await se.post(`/pipeline/versions/${encodeURIComponent(e)}`,a);return Yi(n.data)},async update(e,s,r){const a={};r.name!==void 0&&(a.name=r.name),r.note!==void 0&&(a.note=r.note??""),r.pinned!==void 0&&(a.pinned=r.pinned);const n=await se.patch(`/pipeline/versions/${encodeURIComponent(e)}/${s}`,a);return Yi(n.data)},async togglePin(e,s,r){return this.update(e,s,{pinned:r})},async rename(e,s,r){return this.update(e,s,{name:r})},async remove(e,s){await se.delete(`/pipeline/versions/${encodeURIComponent(e)}/${s}`)},async audit(e,s=50,r={}){const a=new URLSearchParams({limit:String(s)});return r.actor&&a.set("actor",r.actor),r.kind&&a.set("kind",r.kind),r.createdAfter&&a.set("created_after",r.createdAfter),r.createdBefore&&a.set("created_before",r.createdBefore),(await se.get(`/pipeline/versions/${encodeURIComponent(e)}/audit?${a.toString()}`)).data}},b6="__anonymous__";function Uw(e){const s=Date.now()-new Date(e).getTime();if(Number.isNaN(s)||s<0)return"just now";const r=Math.floor(s/1e3);if(r<45)return"just now";const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const n=Math.floor(a/60);if(n<24)return`${n}h ago`;const o=Math.floor(n/24);return o<30?`${o}d ago`:new Date(e).toLocaleDateString()}function Hw(e,s){for(const r of e){if(!r||typeof r!="object")continue;const a=r.data,n=a&&typeof a=="object"?a.definitionType??a.catalogType:void 0,o=r.type,i=String(n??o??"unknown");s(i)}}function Ww(e){const s=new Map,r=a=>{s.set(a,(s.get(a)??0)+1)};if(e&&typeof e=="object"&&"nodes"in e){const a=e.nodes;Array.isArray(a)&&Hw(a,r)}else if(Array.isArray(e)){for(const a of e)if(a&&typeof a=="object"){const n=a.step_type;r(String(n??"unknown"))}}return[...s.entries()].sort((a,n)=>n[1]-a[1]).slice(0,8)}const Gw=({isOpen:e,onClose:s,datasetId:r,datasetName:a,onRestore:n})=>{const o=Yt(),[i,l]=p.useState([]),[c,d]=p.useState(!1),[u,m]=p.useState(null),[h,x]=p.useState(null),[f,g]=p.useState(""),[b,y]=p.useState(""),[v,j]=p.useState(null),w=p.useCallback(async()=>{if(r){d(!0),m(null);try{const P=await ea.list(r);l(P)}catch(P){m(P instanceof Error?P.message:String(P))}finally{d(!1)}}},[r]);p.useEffect(()=>{e&&r&&w(),e||(x(null),g(""),y(""),j(null))},[e,r,w]);const N=P=>{x(P.id),g(P.name),y(P.note??"")},k=()=>{x(null),g(""),y("")},_=async P=>{if(!r)return;const I=f.trim();if(!I){le.error("Name cannot be empty");return}try{const A={};I!==P.name&&(A.name=I),A.note=b.trim()||null,await ea.update(r,P.id,A),k(),w(),le.success("Version updated")}catch(A){le.error("Failed to update version",String(A))}},R=async P=>{if(r)try{await ea.togglePin(r,P.id,!P.pinned),w()}catch(I){le.error("Failed to toggle pin",String(I))}},M=async P=>{if(!(!r||!await o({title:`Delete v${P.versionInt}?`,message:`"${P.name}" will be permanently removed from the version history. This cannot be undone.`,confirmLabel:"Delete",variant:"danger"})))try{await ea.remove(r,P.id),w(),le.success("Version deleted")}catch(A){le.error("Failed to delete version",String(A))}},E=async P=>{await o({title:`Restore v${P.versionInt} "${P.name}"?`,message:"This will load the snapshot into the canvas and overwrite any unsaved work there. Continue?",confirmLabel:"Restore",variant:"danger"})&&(n==null||n(P),s())},T=P=>t.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[t.jsx("button",{onClick:()=>{E(P)},title:"Restore this version","aria-label":"Restore version",className:"p-1.5 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 text-blue-600 dark:text-blue-400",children:t.jsx(ms,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>j(I=>I===P.id?null:P.id),title:v===P.id?"Hide details":"Show details","aria-label":"Toggle version details","aria-expanded":v===P.id,className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:v===P.id?t.jsx(Ia,{className:"w-3.5 h-3.5"}):t.jsx(Qe,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>{R(P)},title:P.pinned?"Unpin":"Pin (exempt from cleanup)","aria-label":P.pinned?"Unpin version":"Pin version",className:"p-1.5 rounded hover:bg-amber-50 dark:hover:bg-amber-900/20 text-muted-foreground hover:text-amber-600",children:P.pinned?t.jsx($p,{className:"w-3.5 h-3.5"}):t.jsx(hn,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>N(P),title:"Edit name & note","aria-label":"Edit version",className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:t.jsx(Nc,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>{M(P)},title:"Delete version","aria-label":"Delete version",className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-muted-foreground hover:text-red-600 dark:hover:text-red-400",children:t.jsx(gt,{className:"w-3.5 h-3.5"})})]}),S=()=>t.jsxs(t.Fragment,{children:[c&&t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx(ge,{className:"w-6 h-6 animate-spin text-muted-foreground"})}),!c&&u&&t.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load versions: ",u]}),!c&&!u&&i.length===0&&t.jsxs("div",{className:"p-8 text-center text-sm text-muted-foreground",children:[t.jsx(kl,{className:"w-10 h-10 mx-auto mb-2 opacity-40"}),t.jsx("p",{className:"font-medium text-foreground/80 mb-1",children:"No versions yet"}),t.jsx("p",{children:"Saving a pipeline against this dataset stamps a version automatically. They show up here for cross-device restore."})]}),!c&&!u&&i.length>0&&t.jsx("div",{className:"max-h-[70vh] flex flex-col border rounded-md overflow-hidden",children:t.jsx(Uo,{items:i,getKey:P=>P.id,estimateSize:80,className:"flex-1 overflow-y-auto",renderItem:P=>{const I=h===P.id;return t.jsxs("div",{className:"p-3 border-b last:border-b-0 hover:bg-accent/40 transition-colors",children:[I?t.jsxs("div",{className:"space-y-2",children:[t.jsx("input",{type:"text",value:f,onChange:A=>g(A.target.value),placeholder:"Pipeline name","aria-label":"Pipeline name",className:"w-full px-2 py-1 text-sm bg-background border rounded outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),t.jsx("textarea",{value:b,onChange:A=>y(A.target.value),placeholder:"Note (optional) β€” describe what changed","aria-label":"Version note",rows:2,className:"w-full px-2 py-1 text-sm bg-background border rounded outline-none focus:ring-1 focus:ring-primary resize-none"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>{_(P)},className:"flex items-center gap-1 px-2 py-1 text-xs action-primary rounded hover:opacity-90",children:[t.jsx(ai,{className:"w-3 h-3"})," Save"]}),t.jsxs("button",{onClick:k,className:"flex items-center gap-1 px-2 py-1 text-xs border rounded hover:bg-accent",children:[t.jsx(Ee,{className:"w-3 h-3"})," Cancel"]})]})]}):t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[P.pinned&&t.jsx(hn,{className:"w-3 h-3 text-amber-500 flex-shrink-0","aria-label":"Pinned"}),t.jsx("span",{className:"font-medium truncate",title:P.name,children:P.name}),t.jsxs("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex-shrink-0",children:["v",P.versionInt]}),P.kind==="auto"&&t.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 flex-shrink-0",title:"Auto-snapshot from a successful save or run",children:"auto"})]}),P.note&&t.jsxs("div",{className:"text-xs text-foreground/80 mt-0.5 flex items-start gap-1",title:P.note,children:[t.jsx(O0,{className:"w-3 h-3 mt-0.5 flex-shrink-0 text-muted-foreground"}),t.jsx("span",{className:"break-words",children:P.note})]}),t.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-3 mt-1 tabular-nums",children:[t.jsx("span",{children:Uw(P.createdAt)}),t.jsxs("span",{children:[P.nodeCount," nodes Β· ",P.edgeCount," edges"]})]})]}),T(P)]}),v===P.id&&!I&&t.jsxs("div",{className:"mt-2 pt-2 border-t text-xs space-y-1.5 text-muted-foreground",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Created: "}),new Date(P.createdAt).toLocaleString()]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Kind: "}),P.kind]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Version: "}),"v",P.versionInt," ",t.jsxs("span",{className:"opacity-60",children:["(#",P.id,")"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Dataset: "}),t.jsx("span",{className:"font-mono",children:P.datasetId})]})]}),(()=>{const A=Ww(P.graph);return A.length===0?t.jsx("div",{className:"italic opacity-70",children:"Snapshot graph is empty or in an unrecognised shape."}):t.jsxs("div",{children:[t.jsx("div",{className:"text-foreground/70 font-medium mb-1",children:"Node breakdown"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:A.map(([B,F])=>t.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-muted text-foreground/80 tabular-nums",title:B,children:[B," ",t.jsxs("span",{className:"opacity-60",children:["Γ—",F]})]},B))})]})})()]})]})}})})]});return t.jsx(Tt,{isOpen:e,onClose:s,size:"3xl",title:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(kl,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),t.jsx("span",{children:"Pipeline Versions"}),a&&t.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["Β· ",a]})]}),children:S()})};function qw(e,s){if(s){const r=s.toLowerCase(),a=e.name.toLowerCase().includes(r),n=(e.source_id||e.id).toLowerCase().includes(r),o=(e.format||"csv").toLowerCase().includes(r);if(!a&&!n&&!o)return!1}return!0}const Kw=()=>{const e=Oa(),s=Yt(),r=Nw({refetchInterval:H=>_w(H.state.data)?5e3:!1}),a=r.data??[],n=r.isLoading,o=Sw(),i=Gh(),l=o.isPending?o.variables??null:null,c=i.isPending?i.variables??null:null,[d,u]=p.useState(!1),[m,h]=p.useState(!1),[x,f]=p.useState(!1),[g,b]=p.useState(null),[y,v]=p.useState(null),[j,w]=p.useState("all"),[N,k]=p.useState(""),[_,R]=p.useState("all"),[M,E]=p.useState("all"),[T,S]=p.useState(!1),[P,I]=p.useState(new Set),A=H=>{var W,ue;return((ue=(W=H.source_metadata)==null?void 0:W.ingestion_status)==null?void 0:ue.status)||"completed"},B=H=>{var je;const W=(je=H.source_metadata)==null?void 0:je.ingestion_status,ue=A(H);return ue==="failed"?(W==null?void 0:W.message)||(W==null?void 0:W.error)||"Ingestion failed":ue==="cancelled"?(W==null?void 0:W.message)||(W==null?void 0:W.error)||"Ingestion cancelled":(W==null?void 0:W.message)||""},F=a.filter(H=>{var ue,je;const W=((je=(ue=H.source_metadata)==null?void 0:ue.ingestion_status)==null?void 0:je.status)||"completed";return j!=="all"&&W!==j||_!=="all"&&H.type!==_||M!=="all"&&(H.format||"csv")!==M?!1:qw(H,N)}),z=async H=>{if(await s({title:"Delete dataset?",message:"Are you sure you want to delete this dataset? This cannot be undone.",confirmLabel:"Delete",variant:"danger"}))try{await o.mutateAsync(H)}catch{le.error("Failed to delete dataset")}},L=async H=>{I(W=>new Set(W).add(H));try{await Wt.exportData(H,"csv")}catch{le.error("Export failed","Could not export the dataset. Please try again.")}finally{I(W=>{const ue=new Set(W);return ue.delete(H),ue})}},K=async H=>{if(await s({title:"Cancel ingestion job?",message:"Are you sure you want to cancel this ingestion job?",confirmLabel:"Cancel job",variant:"danger"}))try{await i.mutateAsync(H)}catch{le.error("Failed to cancel ingestion")}},re=async H=>{H.type==="file"?(u(!0),h(!1)):(h(!0),u(!1)),f(!1),le.info("Open the source form to retry ingestion.")},de=H=>{e(`/canvas?source_id=${H}`)},O=()=>{u(!1)},q=()=>{h(!1)},D=H=>{const W=A(H);return!W||W==="completed"?null:W==="failed"?t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400",children:"Failed"}):W==="cancelled"?t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400",children:"Cancelled"}):t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400",children:[t.jsx(ge,{size:12,className:"animate-spin","aria-hidden":"true"}),W==="processing"?"Processing ingestion":"Queued for ingestion"]})},G=H=>{var W,ue,je,Ye,we,ee,Y,U,pe,fe;return t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[(!((ue=(W=H.source_metadata)==null?void 0:W.ingestion_status)!=null&&ue.status)||((Ye=(je=H.source_metadata)==null?void 0:je.ingestion_status)==null?void 0:Ye.status)==="completed")&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{b(H)},className:"p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors",title:"Preview Dataset","aria-label":"Preview dataset",children:t.jsx(Fp,{size:16})}),t.jsxs("button",{onClick:()=>{de(H.id)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors",title:"Use in Canvas",children:[t.jsx(ms,{size:16}),"Canvas"]}),t.jsxs("button",{onClick:()=>{e(`/eda?dataset_id=${H.id}`)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-md transition-colors",title:"Analyze with EDA",children:[t.jsx(Fn,{size:16}),"EDA"]}),t.jsxs("button",{onClick:()=>{L(H.id)},disabled:P.has(H.id),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20 rounded-md transition-colors disabled:opacity-50",title:"Download CSV",children:[P.has(H.id)?t.jsx("div",{className:"w-4 h-4 border-2 border-green-600 border-t-transparent rounded-full animate-spin"}):t.jsx(Ae,{size:16}),"CSV"]}),t.jsxs("button",{onClick:()=>{v(H)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-amber-600 dark:text-amber-400 hover:bg-amber-50 dark:hover:bg-amber-900/20 rounded-md transition-colors",title:"Pipeline versions for this dataset","aria-label":"View pipeline versions",children:[t.jsx(kl,{size:16}),"Versions"]})]}),(((ee=(we=H.source_metadata)==null?void 0:we.ingestion_status)==null?void 0:ee.status)==="pending"||((U=(Y=H.source_metadata)==null?void 0:Y.ingestion_status)==null?void 0:U.status)==="processing")&&t.jsx("button",{onClick:()=>{K(H.id)},disabled:c===H.id,className:"p-2 text-slate-400 hover:text-orange-600 hover:bg-orange-50 dark:hover:bg-orange-900/20 rounded-md transition-colors disabled:opacity-50",title:"Cancel ingestion","aria-label":"Cancel ingestion",children:c===H.id?t.jsx("div",{className:"w-4 h-4 border-2 border-orange-600 border-t-transparent rounded-full animate-spin","aria-hidden":"true"}):t.jsx(ir,{size:16,"aria-hidden":"true"})}),((fe=(pe=H.source_metadata)==null?void 0:pe.ingestion_status)==null?void 0:fe.status)==="failed"&&t.jsxs("button",{onClick:()=>{re(H)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors","aria-label":"Retry ingestion",children:[t.jsx(us,{size:16,"aria-hidden":"true"}),"Retry"]}),t.jsx("button",{onClick:()=>{z(H.id)},disabled:l===H.id,className:"p-2 text-slate-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-md transition-colors disabled:opacity-50",title:"Delete Dataset","aria-label":"Delete dataset",children:l===H.id?t.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin","aria-hidden":"true"}):t.jsx(gt,{size:16,"aria-hidden":"true"})})]})},J=()=>(N||j!=="all"||_!=="all"||M!=="all")&&t.jsx("button",{onClick:()=>{k(""),w("all"),R("all"),E("all")},className:"text-xs text-blue-600 dark:text-blue-400 hover:underline whitespace-nowrap",children:"Clear all"}),X=()=>{const H=(_!=="all"?1:0)+(M!=="all"?1:0);return t.jsxs("div",{className:"flex flex-col gap-3 mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex-1 max-w-sm",children:[t.jsx(lr,{size:16,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none z-10"}),t.jsx("input",{type:"text","aria-label":"Search datasets",placeholder:"Search datasets...",value:N,onChange:W=>{k(W.target.value)},className:"w-full pl-8 pr-3 py-1.5 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),t.jsxs("button",{onClick:()=>{S(!T)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md border transition-colors ${T||_!=="all"?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300":"bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700"}`,children:[t.jsx(On,{size:14}),"Filters",H>0&&t.jsx("span",{className:"ml-1 w-5 h-5 flex items-center justify-center rounded-full bg-blue-600 text-white text-xs",children:H})]}),J()]}),T&&t.jsxs("div",{className:"flex items-center gap-4 pl-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Type"}),t.jsxs("select",{value:_,onChange:W=>{R(W.target.value)},className:"px-2 py-1 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All types"}),[...new Set(a.map(W=>W.type))].map(W=>t.jsx("option",{value:W,children:W},W))]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Format"}),t.jsxs("select",{value:M,onChange:W=>{E(W.target.value)},className:"px-2 py-1 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All formats"}),[...new Set(a.map(W=>W.format||"csv"))].map(W=>t.jsx("option",{value:W,children:W.toUpperCase()},W))]})]})]}),t.jsx("div",{className:"flex items-center gap-2 overflow-x-auto pb-1 scrollbar-hide",children:["all","completed","processing","failed","cancelled"].map(W=>t.jsx("button",{onClick:()=>{w(W)},className:`px-3 py-1.5 rounded-full text-sm font-medium transition-colors whitespace-nowrap ${j===W?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-700"}`,children:W.charAt(0).toUpperCase()+W.slice(1)},W))})]})},oe=H=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/20 rounded text-blue-600 dark:text-blue-400",children:t.jsx(Dr,{size:18})}),t.jsxs("div",{children:[t.jsxs("div",{className:"font-medium text-slate-900 dark:text-slate-100 flex items-center gap-2",children:[H.name,D(H)]}),(A(H)==="failed"||A(H)==="cancelled")&&t.jsx("p",{className:`mt-1 text-xs rounded px-2 py-1 ${A(H)==="failed"?"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/10":"text-slate-600 dark:text-slate-400 bg-slate-100 dark:bg-slate-800"}`,children:B(H)}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 font-mono mt-0.5",title:"Dataset ID",children:H.source_id||H.id})]})]}),ve=()=>t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm text-left",children:[t.jsx("thead",{className:"text-xs text-slate-500 dark:text-slate-400 uppercase bg-slate-50 dark:bg-slate-800 border-b border-slate-200 dark:border-slate-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-4 font-semibold",children:"Dataset Name"}),t.jsx("th",{className:"px-3 py-4 font-semibold",children:"Type"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Format"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Size"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Created"}),t.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),t.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700 bg-white dark:bg-slate-900",children:n&&a.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:6,children:t.jsx(Rs,{message:"Loading datasets..."})})}):F.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:6,children:a.length===0?t.jsx(os,{icon:t.jsx(Ct,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No datasets found",description:"Upload a dataset to get started with your analysis."}):t.jsx(os,{title:"No datasets match your search or filters"})})}):F.map(H=>{var W;return t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[t.jsx("td",{className:"px-3 py-4",children:oe(H)}),t.jsx("td",{className:"px-3 py-4",children:t.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border ${H.type==="s3"?"bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-900/20 dark:text-orange-400 dark:border-orange-800":H.type==="file"?"bg-slate-100 text-slate-700 border-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:border-slate-700":"bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-900/20 dark:text-indigo-400 dark:border-indigo-800"}`,children:H.type==="file"?"Upload":H.type.toUpperCase()})}),t.jsx("td",{className:"px-6 py-4",children:t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200 uppercase border border-slate-200 dark:border-slate-700",children:H.format||"CSV"})}),t.jsx("td",{className:"px-6 py-4 text-slate-600 dark:text-slate-300",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium",children:Ho(H.size_bytes||0)}),t.jsxs("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:[((W=H.rows)==null?void 0:W.toLocaleString())||"-"," rows β€’ ",H.columns||"-"," cols"]})]})}),t.jsx("td",{className:"px-6 py-4 text-slate-600 dark:text-slate-300",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_l,{size:14,className:"text-slate-500 dark:text-slate-400"}),new Date(H.created_at).toLocaleDateString()]})}),t.jsx("td",{className:"px-6 py-4 text-right",children:G(H)})]},H.id)})})]})})});return t.jsxs("div",{className:"p-8 space-y-6",children:[t.jsx(Ow,{dataset:g,isOpen:!!g,onClose:()=>{b(null)}}),t.jsx(zw,{isOpen:m,onClose:()=>{h(!1)},onSuccess:q}),t.jsx(Vw,{isOpen:x,onClose:()=>{f(!1)},datasets:a,onRefresh:()=>{r.refetch()},onRetry:re}),t.jsx(Gw,{isOpen:!!y,onClose:()=>{v(null)},datasetId:(y==null?void 0:y.id)??null,...y!=null&&y.name?{datasetName:y.name}:{},onRestore:H=>{y&&e(`/canvas?source_id=${y.id}`,{state:{restoreVersion:H}})}}),t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-slate-900 dark:text-slate-100",children:"Data Sources"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Upload a file or connect an S3 source, then send it to the Canvas pipeline builder or the EDA explorer."})]}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsxs("button",{onClick:()=>{f(!0)},className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md shadow-sm hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-700 dark:text-slate-200",children:[t.jsx(_l,{size:18}),"Ingestion Jobs"]}),t.jsxs("button",{onClick:()=>{h(!0)},className:"flex items-center gap-2 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 border border-slate-300 dark:border-slate-600 px-4 py-2 rounded-md shadow-sm transition-all hover:bg-slate-50 dark:hover:bg-slate-700",children:[t.jsx(Ct,{size:18}),"Add Source"]}),t.jsxs("button",{onClick:()=>{u(!d)},className:"flex items-center gap-2 action-primary px-4 py-2 rounded-md shadow-sm transition-all hover:opacity-90 focus-ring",children:[t.jsx(Es,{size:18}),d?"Cancel Upload":"Upload File"]})]})]}),d&&t.jsx("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm animate-in fade-in slide-in-from-top-4",children:t.jsx(Jh,{onUploadComplete:O,onCancel:()=>{u(!1)}})}),X(),ve()]})},xr=class xr{constructor(){Pt(this,"nodes",new Map)}static getInstance(){return xr.instance||(xr.instance=new xr),xr.instance}register(s){if(this.nodes.has(s.type)){const r=`Node type "${s.type}" is already registered. Overwriting.`;console.error(r)}this.nodes.set(s.type,s)}get(s){return this.nodes.get(s)}getAll(){return Array.from(this.nodes.values())}getByCategory(){const s={};return this.nodes.forEach(r=>{const a=s[r.category]??[];a.push(r),s[r.category]=a}),s}};Pt(xr,"instance");let Xl=xr;const ie=Xl.getInstance(),Jw={scale_numeric_features:"normalize normalise normalization standardize standardise standardization min max z score",imputation_node:"fill blanks null nan impute missing data",MissingIndicator:"flag missing data null nan blanks",drop_missing_rows:"remove missing data null nan blanks",deduplicate:"remove duplicates repeated rows",encoding:"one hot categorical numbers dummy ordinal label encoder",ResamplingNode:"imbalanced classes class imbalance smote balance classes",TrainTestSplitter:"holdout validation split train test",feature_target_split:"separate features target x y",classification:"predict classes categories labels classify",regression:"predict numbers numeric continuous values price",text_classification:"classify text sentiment predict text labels",SegmentationNode:"cluster clustering group similar records",data_preview:"inspect data view sample rows table"};function tn(e){return e.toLowerCase().replace(/[-_\s]+/g," ").trim()}function Go(e,s){const r=e.filter(o=>!o.hidden),a=tn(s);if(!a)return r;const n=a.split(" ");return r.map(o=>{const i=tn(o.label),l=tn(o.description),c=tn(o.category),d=tn(o.type),u=Jw[o.type]??"",m=`${i} ${l} ${c} ${d} ${u}`;if(!n.every(x=>m.includes(x)))return{node:o,score:0};const h=i===a?200:i.startsWith(a)?150:i.includes(a)?100:u.includes(a)?60:c.includes(a)?40:d.includes(a)?30:l.includes(a)?20:10;return{node:o,score:h}}).filter(o=>o.score>0).sort((o,i)=>i.score-o.score).map(o=>o.node)}const Yh=[{id:"clean",label:"Data cleaning",types:["drop_missing_columns","imputation_node","drop_missing_rows","deduplicate","MissingIndicator","outlier","value_replacement","AliasReplacement","InvalidValueReplacement"]},{id:"numeric",label:"Numeric & categorical",types:["casting","scale_numeric_features","encoding","TransformationNode","BinningNode"]},{id:"features",label:"Feature engineering",types:["FeatureGenerationNode","PolynomialFeaturesNode","FeatureInteractionNode","feature_selection","TimeSeriesNode"]},{id:"text",label:"Text processing",types:["TextCleaning","count_vectorizer","tfidf_vectorizer","hashing_vectorizer","tokenizer","sentence_embedder"]},{id:"split",label:"Splitting & sampling",types:["TrainTestSplitter","feature_target_split","ResamplingNode"]}],Yw=new Set(Yh.flatMap(e=>e.types));function Qw(e){const s=e.filter(r=>r.category==="Preprocessing"&&!r.hidden);return[...Yh.map(r=>({id:r.id,label:r.label,nodes:s.filter(a=>r.types.includes(a.type))})),{id:"other",label:"Other preprocessing",nodes:s.filter(r=>!Yw.has(r.type))}].filter(r=>r.nodes.length>0)}var ku=(e,s,r)=>(n,o)=>({pastStates:(r==null?void 0:r.pastStates)||[],futureStates:(r==null?void 0:r.futureStates)||[],undo:(i=1)=>{var l,c;if(o().pastStates.length){const d=((l=r==null?void 0:r.partialize)==null?void 0:l.call(r,s()))||s(),u=o().pastStates.splice(-i,i),m=u.shift();e(m),n({pastStates:o().pastStates,futureStates:o().futureStates.concat(((c=r==null?void 0:r.diff)==null?void 0:c.call(r,d,m))||d,u.reverse())})}},redo:(i=1)=>{var l,c;if(o().futureStates.length){const d=((l=r==null?void 0:r.partialize)==null?void 0:l.call(r,s()))||s(),u=o().futureStates.splice(-i,i),m=u.shift();e(m),n({pastStates:o().pastStates.concat(((c=r==null?void 0:r.diff)==null?void 0:c.call(r,d,m))||d,u.reverse()),futureStates:o().futureStates})}},clear:()=>n({pastStates:[],futureStates:[]}),isTracking:!0,pause:()=>n({isTracking:!1}),resume:()=>n({isTracking:!0}),setOnSave:i=>n({_onSave:i}),_onSave:r==null?void 0:r.onSave,_handleSet:(i,l,c,d)=>{var u,m;r!=null&&r.limit&&o().pastStates.length>=(r==null?void 0:r.limit)&&o().pastStates.shift(),(m=(u=o())._onSave)==null||m.call(u,i,c),n({pastStates:o().pastStates.concat(d||i),futureStates:[]})}}),Xw=(e,s)=>(a,n,o)=>{var d,u;o.temporal=wp(((d=s==null?void 0:s.wrapTemporal)==null?void 0:d.call(s,ku(a,n,s)))||ku(a,n,s));const i=((u=s==null?void 0:s.handleSet)==null?void 0:u.call(s,o.temporal.getState()._handleSet))||o.temporal.getState()._handleSet,l=m=>{var f,g,b;if(!o.temporal.getState().isTracking)return;const h=((f=s==null?void 0:s.partialize)==null?void 0:f.call(s,n()))||n(),x=(g=s==null?void 0:s.diff)==null?void 0:g.call(s,m,h);x===null||(b=s==null?void 0:s.equality)!=null&&b.call(s,m,h)||i(m,void 0,h,x)},c=o.setState;return o.setState=(...m)=>{var x;const h=((x=s==null?void 0:s.partialize)==null?void 0:x.call(s,n()))||n();c(...m),l(h)},e((...m)=>{var x;const h=((x=s==null?void 0:s.partialize)==null?void 0:x.call(s,n()))||n();a(...m),l(h)},n,o)};const nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function Zw(e,s=0){return(nt[e[s+0]]+nt[e[s+1]]+nt[e[s+2]]+nt[e[s+3]]+"-"+nt[e[s+4]]+nt[e[s+5]]+"-"+nt[e[s+6]]+nt[e[s+7]]+"-"+nt[e[s+8]]+nt[e[s+9]]+"-"+nt[e[s+10]]+nt[e[s+11]]+nt[e[s+12]]+nt[e[s+13]]+nt[e[s+14]]+nt[e[s+15]]).toLowerCase()}let Qi;const eN=new Uint8Array(16);function tN(){if(!Qi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qi=crypto.getRandomValues.bind(crypto)}return Qi(eN)}const sN=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_u={randomUUID:sN};function rN(e,s,r){var n;e=e||{};const a=e.random??((n=e.rng)==null?void 0:n.call(e))??tN();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,Zw(a)}function er(e,s,r){return _u.randomUUID&&!e?_u.randomUUID():rN(e)}const aN=e=>e&&typeof e=="object"?e:{},Qh=e=>aN(e).merge_strategy??"last_wins";var Ts=(e=>(e.DATA_LOADER="data_loader",e.FEATURE_ENGINEERING="feature_engineering",e.TRAINING="training",e.CLASSIFICATION="classification",e.REGRESSION="regression",e.TEXT_CLASSIFICATION="text_classification",e))(Ts||{});const nN=e=>({stepType:Ts.DATA_LOADER,params:{dataset_id:e.data.datasetId}}),oN=e=>{let s="unknown",r={};const a=e.data.method||"simple";return a==="knn"?(s="KNNImputer",r={columns:e.data.columns,n_neighbors:e.data.n_neighbors,weights:e.data.weights}):a==="iterative"?(s="IterativeImputer",r={columns:e.data.columns,max_iter:e.data.max_iter,estimator:e.data.estimator,...e.data.random_state!=null?{random_state:e.data.random_state}:{}}):(s="SimpleImputer",r={columns:e.data.columns,strategy:e.data.strategy,fill_value:e.data.fill_value}),{stepType:s,params:r}},iN=e=>({stepType:"SimpleImputer",params:e.data||{}}),Su=e=>({stepType:"DropMissingColumns",params:{columns:e.data.columns||[],missing_threshold:e.data.missing_threshold}}),Cu=e=>{const s="DropMissingRows",r=e.data,n=r.drop_if_any_missing===!0||r.missing_threshold==null||r.missing_threshold<=0?{how:"any"}:{missing_threshold:r.missing_threshold};return{stepType:s,params:n}},Eu=e=>({stepType:"Deduplicate",params:{subset:e.data.subset,keep:e.data.keep}}),Ru=e=>({stepType:"Casting",params:{column_types:e.data.column_types}}),Tu=e=>({stepType:"MissingIndicator",params:{columns:e.data.columns,flag_suffix:e.data.flag_suffix}}),lN=new Map([["minmax","MinMaxScaler"],["maxabs","MaxAbsScaler"],["robust","RobustScaler"]]);function cN(e,s){return e==="minmax"?{feature_range:[s.feature_range_min??0,s.feature_range_max??1]}:e==="robust"?{quantile_range:[s.quantile_range_min??25,s.quantile_range_max??75]}:{}}const dN=e=>{const s=e.data&&typeof e.data=="object"?e.data:{},r=s.method||"standard";return{stepType:lN.get(r)??"StandardScaler",params:{...s,...cN(r,s)}}},uN=e=>{let s="unknown",r={};const a=e.data.method;return a==="onehot"?s="OneHotEncoder":a==="dummy"?s="DummyEncoder":a==="label"?s="LabelEncoder":a==="ordinal"?s="OrdinalEncoder":a==="target"?s="TargetEncoder":a==="hash"?s="HashEncoder":a==="woe"?s="WOEEncoder":s="OneHotEncoder",r=e.data,{stepType:s,params:r}},mN=e=>({stepType:"TrainTestSplitter",params:e.data||{}}),pN=e=>({stepType:"LabelEncoder",params:e.data||{}}),hN=e=>({stepType:"feature_target_split",params:e.data||{}}),xN=e=>({stepType:"feature_selection",params:e.data||{}}),gN=e=>{let s="unknown",r={};const a=e.data.method||"iqr";return a==="iqr"?s="IQR":a==="zscore"?s="ZScore":a==="winsorize"?s="Winsorize":a==="elliptic_envelope"?s="EllipticEnvelope":s="IQR",r=e.data,{stepType:s,params:r}},fN=e=>{const s="GeneralTransformation",r=e.data.transformations||[],a=[];for(const o of r){const i=o;if(i.columns&&Array.isArray(i.columns))for(const l of i.columns)a.push({column:l,method:i.method,...i.params})}return{stepType:s,params:{transformations:a}}},bN=e=>({stepType:"GeneralBinning",params:{columns:e.data.columns,strategy:e.data.strategy,n_bins:e.data.n_bins,label_format:e.data.label_format,output_suffix:e.data.output_suffix,drop_original:e.data.drop_original,custom_bins:e.data.custom_bins,custom_labels:e.data.custom_labels,precision:e.data.precision}}),yN=e=>{let s="unknown",r={};return(e.data.type||"oversampling")==="oversampling"?s="Oversampling":s="Undersampling",r=e.data,{stepType:s,params:r}},vN=e=>({stepType:"FeatureMath",params:{operations:e.data.operations}}),jN=e=>({stepType:"PolynomialFeatures",params:{columns:e.data.columns,degree:e.data.degree,interaction_only:e.data.interaction_only,include_bias:e.data.include_bias,output_prefix:e.data.output_prefix,include_input_features:e.data.include_input_features}}),wN=e=>({stepType:"FeatureInteraction",params:{columns:e.data.columns,degree:e.data.degree,interaction_only:e.data.interaction_only,include_bias:e.data.include_bias}}),NN=e=>{let s="unknown",r={};const a=e.data.method;return a==="rolling"?s="RollingAggregate":a==="date"?s="DateFeatures":s="LagFeatures",r=e.data,{stepType:s,params:r}},kN=e=>({stepType:"TextCleaning",params:e.data}),sn=e=>({stepType:e.data.definitionType,params:e.data}),Mu=e=>({stepType:"ValueReplacement",params:e.data}),_N=e=>({stepType:"AliasReplacement",params:e.data}),SN=e=>({stepType:"InvalidValueReplacement",params:e.data}),CN=()=>({stepType:"data_preview",params:{}}),EN=e=>(console.warn(`Unknown node type: ${e.data.definitionType}`),{stepType:"Unknown",params:e.data&&typeof e.data=="object"?e.data:{}}),RN=new Map([["dataset_node",nN],["imputation_node",oN],["simple_imputer",iN],["drop_missing_columns",Su],["DropMissingColumns",Su],["drop_missing_rows",Cu],["DropMissingRows",Cu],["deduplicate",Eu],["Deduplicate",Eu],["casting",Ru],["Casting",Ru],["MissingIndicator",Tu],["missing_indicator",Tu],["scale_numeric_features",dN],["encoding",uN],["TrainTestSplitter",mN],["label_encoding",pN],["feature_target_split",hN],["feature_selection",xN],["outlier",gN],["TransformationNode",fN],["BinningNode",bN],["ResamplingNode",yN],["FeatureGenerationNode",vN],["PolynomialFeaturesNode",jN],["FeatureInteractionNode",wN],["TimeSeriesNode",NN],["TextCleaning",kN],["count_vectorizer",sn],["tfidf_vectorizer",sn],["hashing_vectorizer",sn],["tokenizer",sn],["sentence_embedder",sn],["ValueReplacement",Mu],["value_replacement",Mu],["AliasReplacement",_N],["InvalidValueReplacement",SN],["data_preview",CN]]),Xh=e=>({target_column:e.target_column,model_type:e.model_type,hyperparameters:e.hyperparameters,cv_enabled:e.cv_enabled,cv_folds:e.cv_folds,cv_type:e.cv_type,cv_shuffle:e.cv_shuffle,cv_random_state:e.cv_random_state,cv_time_column:e.cv_time_column,execution_mode:e.execution_mode}),Zh=e=>({strategy:e.search_strategy,strategy_params:e.strategy_params||{},metric:e.metric,n_trials:e.n_trials,cv_enabled:e.cv_enabled,cv_folds:e.cv_folds,cv_type:e.cv_type,cv_shuffle:e.cv_shuffle,cv_random_state:e.cv_random_state,cv_time_column:e.cv_time_column,random_state:e.random_state,tune_threshold:e.tune_threshold??!1}),vo=e=>{const s=Ts.TRAINING;let r={};return e.data.run_mode==="advanced"?r={run_mode:"tuned",target_column:e.data.target_column,algorithm:e.data.model_type,execution_mode:e.data.execution_mode,tuning_config:{...Zh(e.data),search_space:e.data.search_space}}:r={run_mode:"fixed",...Xh(e.data)},{stepType:s,params:r}},TN=e=>{const s=Ts.TRAINING,r={run_mode:"fixed",target_column:"",model_type:e.data.model_type,hyperparameters:e.data.hyperparameters,cv_enabled:!1,execution_mode:e.data.execution_mode,reference_column:e.data.reference_column||void 0};return{stepType:s,params:r}},MN=new Set(["training","classification","regression","text_classification"]),PN={classification:{logistic_regression:"logistic_regression",random_forest_classifier:"random_forest",extra_trees_classifier:"extra_trees",gradient_boosting_classifier:"gradient_boosting",hist_gradient_boosting_classifier:"hist_gradient_boosting",adaboost_classifier:"adaboost",decision_tree_classifier:"decision_tree",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",k_neighbors_classifier:"knn",xgboost_classifier:"xgboost",lgbm_classifier:"lightgbm"},regression:{linear_regression:"linear_regression",ridge_regression:"ridge",lasso_regression:"lasso",elasticnet_regression:"elasticnet",random_forest_regressor:"random_forest",extra_trees_regressor:"extra_trees",gradient_boosting_regressor:"gradient_boosting",hist_gradient_boosting_regressor:"hist_gradient_boosting",adaboost_regressor:"adaboost",decision_tree_regressor:"decision_tree",svr:"svr",k_neighbors_regressor:"knn",xgboost_regressor:"xgboost",lgbm_regressor:"lightgbm"}},ex=e=>typeof e=="string"&&MN.has(e),IN=(e,s)=>typeof e!="string"?null:PN[s==="regression"?"regression":"classification"][e]??null,AN=(e,s,r)=>{const a=[],n={},o=new Set;for(const i of s){const l=e.find(u=>u.id===i.source);if(!l||!ex(l.data.definitionType))continue;o.add(l.id);const c=IN(l.data.model_type,r);if(!c)continue;a.includes(c)||a.push(c);const d=l.data.hyperparameters;$N(d)&&(n[c]=d)}return{baseEstimators:a,baseParams:n,modelSourceIds:o}};function $N(e){return!!(e&&typeof e=="object"&&Object.keys(e).length>0)}function FN(e,s){const r=s.baseEstimators.length>0,a=r?s.baseEstimators:e.base_estimators,n=r?{...e.base_estimator_params??{},...s.baseParams}:e.base_estimator_params;return{base_estimators:a,voting:e.voting,final_estimator:e.final_estimator,cv:e.cv,passthrough:e.passthrough,weights:DN(e,a),n_jobs:e.n_jobs,...LN(e),base_estimator_params:n,final_estimator_params:e.final_estimator_params}}function DN(e,s){if(e.strategy!=="voting")return;const r=e.weights,a=s??[];if(!(!r||a.length===0||!a.some(o=>typeof r[o]=="number"&&r[o]!==1)))return a.map(o=>typeof r[o]=="number"?r[o]:1)}function LN(e){const s=e.task==="classification"&&e.calibrate_base_models===!0;return{calibrate_base_models:s||void 0,calibration_method:s?e.calibration_method:void 0,calibration_cv:s?e.calibration_cv:void 0}}function ON(e,s,r){if(s.size===0)return e;const a=e.filter(o=>!s.has(o));if(a.length>0)return a;const n=new Set;for(const o of s)for(const i of r.filter(l=>l.target===o))s.has(i.source)||n.add(i.source);return Array.from(n)}function zN(e,s){return e.run_mode==="advanced"?{run_mode:"tuned",target_column:e.target_column,algorithm:e.model_type,execution_mode:e.execution_mode,tuning_config:{...Zh(e),...s,tune_base_models:e.tune_base_models}}:{run_mode:"fixed",...Xh(e),hyperparameters:s}}function BN(e,s,r,a,n){const o=AN(s,a,e.data.task),i=FN(e.data,o);return{stepType:Ts.TRAINING,params:zN(e.data,i),inputs:ON(n,o.modelSourceIds,r)}}function VN(e,s,r){const a=new Set(s.filter(n=>n.data.definitionType==="EnsembleNode").map(n=>n.id));return a.size===0?e:e.filter(n=>{const o=s.find(l=>l.id===n.node_id);if(!o||!ex(o.data.definitionType))return!0;const i=r.filter(l=>l.source===n.node_id);return i.length===0||!i.every(l=>a.has(l.target))})}function UN(e){const s=new Set([Ts.TRAINING,"data_preview"]),r=e.filter(i=>s.has(i.step_type));if(e.length<=1)return r;const a=new Set(e.flatMap(i=>i.inputs)),n=e.filter(i=>!a.has(i.node_id));if(r.length===0)return n.length>1?n:r;const o=new Set(r.map(i=>i.node_id));return[...r,...n.filter(i=>!o.has(i.node_id))]}function HN(e){const s=UN(e);if(s.length===0)return e;const r=new Set,a=s.map(n=>n.node_id);for(;a.length>0;){const n=a.shift();if(r.has(n))continue;r.add(n);const o=e.find(i=>i.node_id===n);if(o!=null&&o.inputs)for(const i of o.inputs)a.push(i)}return e.filter(n=>r.has(n.node_id))}const WN=new Map([...RN,["training",vo],["classification",vo],["regression",vo],["text_classification",vo],["SegmentationNode",TN]]);function GN(e,s,r){const a=r.filter(i=>i.target===e.id),n=Array.from(new Set(a.map(i=>i.source)));return e.data.definitionType==="EnsembleNode"?BN(e,s,r,a,n):{...(WN.get(e.data.definitionType)??EN)(e),inputs:n}}function qN(e){var n;const s=e.label||e.title,r=e.definitionType,a=r?(n=ie.get(r))==null?void 0:n.label:void 0;return s||a}function KN(e,s){const r=Qh(e.data),a=qN(e.data),n={...s};return r&&r!=="last_wins"&&(n._merge_strategy=r),a&&(n._display_name=a),n}const Ms=(e,s)=>{var l;const r=e.filter(c=>c.data.definitionType==="dataset_node"),a=r.map(c=>c.id),n=new Set,o=[];for(;a.length>0;){const c=a.shift();if(!c||n.has(c))continue;n.add(c);const d=e.find(m=>m.id===c);if(!d)continue;const u=GN(d,e,s);o.push({node_id:d.id,step_type:u.stepType,params:KN(d,u.params),inputs:u.inputs??[]}),s.filter(m=>m.source===c).forEach(m=>a.push(m.target))}const i=VN(o,e,s);return{pipeline_id:`preview_${er()}`,nodes:HN(i),metadata:{dataset_source_id:(l=r[0])==null?void 0:l.data.datasetId}}};function JN(e){const{known:s,inputs:r,children:a,inDegree:n}=QN(e),o=XN(a,n),i=new Set([...s].filter(c=>!o.has(c))),l=[];for(;i.size>0&&(ZN(i,a),i.size!==0);){const c=YN(i,r);l.push({loopNodeIds:c});for(const d of c)i.delete(d)}return l}function YN(e,s){const r=e.values().next().value,a=[r],n=new Map([[r,0]]);let o=r;for(;;){const i=s.get(o).find(c=>e.has(c)),l=n.get(i);if(l!==void 0)return a.slice(l);n.set(i,a.length),a.push(i),o=i}}function QN(e){const s=new Set(e.map(o=>o.node_id)),r=new Map,a=new Map;for(const o of e)r.set(o.node_id,o.inputs.filter(i=>s.has(i))),a.set(o.node_id,[]);const n=new Map;for(const[o,i]of r){n.set(o,i.length);for(const l of i)a.get(l).push(o)}return{known:s,inputs:r,children:a,inDegree:n}}function XN(e,s){const r=new Set,a=[...s.entries()].filter(([,n])=>n===0).map(([n])=>n);for(;a.length>0;){const n=a.shift();r.add(n);for(const o of e.get(n)){const i=s.get(o)-1;s.set(o,i),i===0&&a.push(o)}}return r}function ZN(e,s){let r=!0;for(;r;){r=!1;for(const a of[...e])s.get(a).some(n=>e.has(n))||(e.delete(a),r=!0)}}const ek=["SimpleImputer","KNNImputer","IterativeImputer","StandardScaler","MinMaxScaler","RobustScaler","MaxAbsScaler","OneHotEncoder","LabelEncoder","OrdinalEncoder","DummyEncoder","TargetEncoder","WOEEncoder","HashEncoder","IQR","ZScore","Winsorize","EllipticEnvelope","VarianceThreshold","CorrelationThreshold","UnivariateSelection","ModelBasedSelection","feature_selection","GeneralBinning","EqualWidthBinning","EqualFrequencyBinning","KBinsDiscretizer","CustomBinning","PowerTransformer","GeneralTransformation","FeatureGeneration","FeatureMath","FeatureGenerationNode","PolynomialFeatures","PolynomialFeaturesNode","Casting","count_vectorizer","tfidf_vectorizer","MissingIndicator","DropMissingColumns","Deduplicate","Oversampling","Undersampling"],tk=["TrainTestSplitter","Split"],Zl=new Set(ek),qo=new Set(tk);let tx=0;const ec=new Set,Pu=()=>tx;function sk(e){return ec.add(e),()=>{ec.delete(e)}}function rk(){tx+=1,ec.forEach(e=>e())}function ak(e){if(e.length!==0){Zl.clear(),qo.clear();for(const s of e){const r=[s.id,...s.aliases??[]];s.learns_from_data&&r.forEach(a=>Zl.add(a)),s.is_splitter&&r.forEach(a=>qo.add(a))}rk()}}const nk=new Set(["LabelEncoder","OrdinalEncoder"]),ok=new Set(["train_test_split","TrainTestSplitter","Split","feature_target_split","training"]);function ik(e,s){const r=new Set;for(const a of e){if(!s.has(a.node_id)||!ok.has(a.step_type))continue;const n=a.params.target_column;typeof n=="string"&&n&&r.add(n)}return r.size===1?[...r][0]:void 0}function lk(e,s,r){if(!nk.has(e))return!1;const a=s.columns;return Array.isArray(a)&&a.length===0||e==="LabelEncoder"&&a==null?!0:!!r&&Array.isArray(a)&&a.length===1&&a[0]===r}function ck(e,s){if(e!=="DropMissingColumns")return!1;const r=s.missing_threshold;return!((typeof r=="number"?r:typeof r=="string"&&r!==""?Number(r):Number.NaN)>0)}function dk(e,s){return e==="SimpleImputer"&&s.strategy==="constant"}function uk(e,s){if(e!=="MissingIndicator")return!1;const r=s.columns;return Array.isArray(r)&&r.length>0}function mk(e,s){return e==="HashEncoder"&&Array.isArray(s.columns)}const pk=new Set(["OneHotEncoder","DummyEncoder","TargetEncoder","WOEEncoder","PowerTransformer","StandardScaler","MinMaxScaler","MaxAbsScaler","RobustScaler","SimpleImputer","KNNImputer","IterativeImputer","GeneralBinning","KBinsDiscretizer","CustomBinning","IQR","ZScore","Winsorize","EllipticEnvelope"]),hk=new Set(["FeatureGeneration","FeatureMath","FeatureGenerationNode"]),xk=new Set(["log","sqrt","square_root","cube_root","reciprocal","square","exp","exponential"]),gk=new Set(["arithmetic","ratio","similarity","datetime_extract"]);function tc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function fk(e){const s=new Map(tc(e.column_types)?Object.entries(e.column_types):[]),r=e.target_type;if(Array.isArray(e.columns)&&typeof r=="string"&&r)for(const a of e.columns)typeof a=="string"&&s.set(a,r);return![...s.values()].some(a=>typeof a=="string"&&["category","categorical"].includes(a.toLowerCase()))}function bk(e,s,r){return pk.has(e)&&Array.isArray(s.columns)&&s.columns.length===0?!0:e==="CustomBinning"?Array.isArray(s.columns):e==="Casting"?fk(s):e==="PolynomialFeatures"||e==="PolynomialFeaturesNode"?yk(s):e==="count_vectorizer"||e==="tfidf_vectorizer"?vk(s,r):jk(e,s)}function yk(e){return!e.auto_detect||Array.isArray(e.columns)&&e.columns.length>0}function vk(e,s){const r=e.columns;return r==null||Array.isArray(r)&&(r.length===0||!!s&&r.every(a=>a===s))}function jk(e,s){if(e==="GeneralTransformation"){const r=s.transformations??[];return Array.isArray(r)&&r.every(a=>tc(a)&&typeof a.method=="string"&&xk.has(a.method))}if(hk.has(e)){const r=s.operations??[];return Array.isArray(r)&&r.every(a=>{if(!tc(a))return!1;const n=a.operation_type===void 0?"arithmetic":a.operation_type;return typeof n=="string"&&gk.has(n)})}return!1}function qc(e){var u;const s=new Set(e.filter(m=>qo.has(m.step_type)).map(m=>m.node_id));if(s.size===0)return[];const r=new Map;for(const m of e)r.set(m.node_id,[]);for(const m of e)for(const h of m.inputs)(u=r.get(h))==null||u.push(m.node_id);const a=new Map,n=new Set;function o(m){const h=a.get(m);if(h)return h;if(n.has(m))return new Set;n.add(m);const x=new Set;for(const f of r.get(m)??[]){x.add(f);for(const g of o(f))x.add(g)}return n.delete(m),a.set(m,x),x}const i=new Map(e.map(m=>[m.node_id,m])),l=new Map;function c(m,h=new Set){if(s.has(m))return!0;const x=l.get(m);if(x!==void 0)return x;const f=i.get(m);if(!(f!=null&&f.inputs.length)||h.has(m))return!1;h.add(m);const g=f.inputs.every(b=>c(b,h));return h.delete(m),l.set(m,g),g}const d=[];for(const m of e){if(!Zl.has(m.step_type)||c(m.node_id))continue;const h=Nk(m,o(m.node_id),i),x=ik(e,h);if(kk(m,x))continue;const f=o(m.node_id),g=[...s].find(b=>f.has(b));g&&d.push({nodeId:m.node_id,stepType:m.step_type,splitterNodeId:g})}return d}function wk(e){return`Data leakage risk: node '${e.nodeId}' (${e.stepType}) fits on the whole dataset before the '${e.splitterNodeId}' train/test split downstream. Move it so it runs AFTER the train/test splitter (Splitter -> Preprocessing -> Model).`}function Kc(e){const s=qc(e.nodes);return s.length===0?!1:(le.error("Data leakage risk detected",wk(s[0])),!0)}function Nk(e,s,r){var i;const a=new Set([e.node_id,...s]),n=[...e.inputs],o=new Set;for(;n.length;){const l=n.pop();o.has(l)||(o.add(l),a.add(l),n.push(...((i=r.get(l))==null?void 0:i.inputs)??[]))}return a}function kk(e,s){return!!(lk(e.step_type,e.params,s)||ck(e.step_type,e.params)||dk(e.step_type,e.params)||uk(e.step_type,e.params)||mk(e.step_type,e.params)||bk(e.step_type,e.params,s))}const _k=e=>e.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase()),na=e=>{const s=ie.get(e.data.definitionType),r=e.data??{};return typeof r.label=="string"&&r.label||typeof r.title=="string"&&r.title||(s==null?void 0:s.label)||(typeof e.data.definitionType=="string"?_k(e.data.definitionType):e.id)};function za(e,s){const r=new Set(e.filter(l=>l.data.definitionType==="data_preview").map(l=>l.id)),a=e.filter(l=>!r.has(l.id)),n=s.filter(l=>!r.has(l.source)&&!r.has(l.target)),o=[];for(const l of a)Sk(l,n,o);const i=Ms(a,n);return Ek(i.nodes,a,o),Rk(i.nodes,a,o),o}function Sk(e,s,r){const a=ie.get(e.data.definitionType),n=na(e);if(!a){r.push({nodeId:e.id,nodeLabel:n,category:"configuration",message:`Refresh or re-add ${n} so the canvas knows how to validate it.`});return}const o=a.validate(e.data);o.isValid||r.push({nodeId:e.id,nodeLabel:n,category:"configuration",message:`Fix the ${n} settings before running preview${o.message?`: ${o.message}`:"."}`,...o.field?{field:o.field}:{}}),a.inputs.length>0&&(s.some(l=>l.target===e.id)||r.push({nodeId:e.id,nodeLabel:n,category:"connection",message:`Connect an upstream node to ${n} before running preview.`})),Ck(e,n,s,r)}function Ck(e,s,r,a){if(e.data.definitionType==="dataset_node"){const n=typeof e.data.datasetId=="string"&&!!e.data.datasetId,o=r.some(i=>i.source===e.id);n&&!o&&a.push({nodeId:e.id,nodeLabel:s,category:"connection",message:"Connect a downstream node to this Dataset before running preview."})}}function Ek(e,s,r){const a=qc(e);for(const n of a){const o=s.find(l=>l.id===n.nodeId),i=s.find(l=>l.id===n.splitterNodeId);!o||!i||r.push({nodeId:o.id,nodeLabel:na(o),category:"leakage",message:`Move ${na(o)} after ${na(i)} so it only fits on training data.`})}}function Rk(e,s,r){const a=JN(e);for(const n of a){const o=n.loopNodeIds.map(i=>s.find(l=>l.id===i)).filter(i=>!!i);o.length!==0&&r.push({nodeId:o[0].id,nodeLabel:na(o[0]),category:"cycle",message:`Cycle detected: ${o.map(i=>na(i)).join(" -> ")} feed back into each other. Remove one of these connections so the pipeline flows in one direction.`})}}function Cr(e){return(e==null?void 0:e.data.definitionType)==="TrainTestSplitter"?Number(e.data.validation_size??0)>0?["train","validation","test"]:["train","test"]:(e==null?void 0:e.data.definitionType)==="feature_target_split"?["X","y"]:[]}function Iu(e,s){const r=Cr(e.find(a=>a.id===s.source));return r.length?{...s,sourceHandle:r[0]}:s}function Tk(e,s){var o,i;const r=new Map(e.map(l=>[l.id,l])),a=new Map,n=[];for(const l of s){const c=Cr(r.get(l.source));if(!c.length){n.push(l);continue}const d=r.get(l.target),u=l.targetHandle??((i=(o=ie.get(String(d==null?void 0:d.data.definitionType)))==null?void 0:o.inputs[0])==null?void 0:i.id)??null,m=JSON.stringify([l.source,l.target,u]),h=a.get(m);if(h!==void 0){const x=n[h];n[h]={...x,selected:!!(x.selected||l.selected),...l.deletable===!1?{deletable:!1}:{}}}else a.set(m,n.length),n.push({...l,type:"custom",sourceHandle:c[0],targetHandle:u})}return n}function Mk(e,s,r){if(s===r)return!0;const a=[r],n=new Set;for(;a.length>0;){const o=a.pop();if(o===s)return!0;if(!n.has(o)){n.add(o);for(const i of e)i.source===o&&a.push(i.target)}}return!1}const sx=["classification","regression","text_classification","SegmentationNode","EnsembleNode"];function Pk(e,s){return sx.includes(e)&&s!=="EnsembleNode"}const Ik="This connection would create a loop. Pipelines must flow in one direction β€” remove the backwards wire instead.",Ak="Training nodes are the end of a pipeline: their output is a trained model, not data. Only an Ensemble can consume a model output β€” wire preprocessing or training from the dataset branch instead.";function Pr(e,s,r){const a=e.find(l=>l.id===r.source),n=e.find(l=>l.id===r.target);if(!a||!n)return"This node is no longer available. Choose an existing node.";if(a.connectable===!1||n.connectable===!1)return"Connections are disabled for this node. Choose another node.";if(Mk(s,a.id,n.id))return Ik;const o=String(a.data.definitionType),i=String(n.data.definitionType);return Pk(o,i)?Ak:$k(a,n,o,i,s,r)}function $k(e,s,r,a,n,o){const{outputs:i,inputs:l,output:c,input:d}=Fk(r,a,o);if(!c||!d)return"Choose an output and an input on registered nodes. Data sources have no input.";const u=Cr(e);if(u.length&&!u.includes(c.id))return"Validation is disabled. Set Validation Size above zero, or connect from Train or Test.";const m=Dk(a,c,d);return m||(n.some(h=>{var x,f;return h.source===e.id&&h.target===s.id&&(u.length>0||(h.sourceHandle??((x=i[0])==null?void 0:x.id))===c.id)&&(h.targetHandle??((f=l[0])==null?void 0:f.id))===d.id})?"These ports are already connected. Choose another input or remove the existing connection.":null)}function Fk(e,s,r){var l,c;const a=((l=ie.get(e))==null?void 0:l.outputs)??[],n=((c=ie.get(s))==null?void 0:c.inputs)??[],o=r.sourceHandle==null?a[0]:a.find(d=>d.id===r.sourceHandle),i=r.targetHandle==null?n[0]:n.find(d=>d.id===r.targetHandle);return{outputs:a,inputs:n,output:o,input:i}}function Dk(e,s,r){return!(e==="EnsembleNode"&&s.type==="model")&&s.type!=="any"&&r.type!=="any"&&s.type!==r.type?`${s.label} provides ${s.type}, but ${r.label} needs ${r.type}. Choose an input of the same kind.`:null}function Au(e,s,r){const a=new Set,n=new Set,o=[e];for(;o.length>0;){const i=o.pop();if(n.has(i))continue;n.add(i);const l=s.find(c=>c.id===i);if((l==null?void 0:l.data.definitionType)==="dataset_node"){a.add(i);continue}for(const c of r.filter(d=>d.target===i))o.push(c.source)}return a}function Lk(e,s,r){const a=Au(e.source,s,r),n=new Set;for(const o of r.filter(i=>i.target===e.target))for(const i of Au(o.source,s,r))n.add(i);return n.size>0&&a.size>0&&![...a].some(o=>n.has(o))}function Ok(e,s,r,a,n){return r!=="EnsembleNode"||!["classification","regression","text_classification","SegmentationNode"].includes(s)||!Lk(e,a,n)?!0:window.confirm(`Warning: this model comes from a different dataset than the ensemble's other inputs. +${r}`:s)}const le={success:(e,s)=>{bo("success",e,s)},error:(e,s)=>{bo("error",e,s)},info:(e,s)=>{bo("info",e,s)},warning:(e,s)=>{bo("warning",e,s)}},yo=new Set(["pending","processing"]),Nu=(e,s)=>{var a;const r=(a=e.source_metadata)==null?void 0:a.ingestion_status;return(r==null?void 0:r.message)||(r==null?void 0:r.error)||s},Bw=e=>{var a;const s=(a=e.source_metadata)==null?void 0:a.ingestion_status,r=(s==null?void 0:s.status)||"completed";return r==="failed"?Nu(e,"Ingestion failed"):r==="cancelled"?Nu(e,"Ingestion cancelled"):r==="pending"?"Queued for ingestion":r==="processing"?"Processing ingestion":(s==null?void 0:s.message)||"Ingestion completed successfully"},Vw=({isOpen:e,onClose:s,datasets:r,onRefresh:a,onRetry:n})=>{const o=Gh(),i=o.isPending?o.variables??null:null,l=Yt(),[c,d]=ae.useState(null),u=async v=>{if(await l({title:"Cancel ingestion job?",message:"Are you sure you want to cancel this ingestion job?",confirmLabel:"Cancel job",variant:"danger"}))try{await o.mutateAsync(v),a&&a()}catch(w){console.error("Failed to cancel ingestion:",w),le.error("Failed to cancel ingestion")}},m=async v=>{if(n){d(v.id);try{await n(v)}finally{d(null)}}},h=r.map(v=>{var w,N;const j=((N=(w=v.source_metadata)==null?void 0:w.ingestion_status)==null?void 0:N.status)||"completed";return{dataset:v,id:v.id,name:v.name,status:j,createdAt:v.created_at,message:Bw(v)}}).sort((v,j)=>new Date(j.createdAt).getTime()-new Date(v.createdAt).getTime()),x=h.filter(v=>yo.has(v.status)),f=h.filter(v=>!yo.has(v.status)),g=v=>{const j=v.status==="failed",w=v.status==="cancelled";return v.status==="processing"||v.status==="pending"?t.jsx(ge,{className:"text-blue-500 animate-spin",size:20,"aria-hidden":"true"}):j?t.jsx(ir,{className:"text-red-500",size:20,"aria-hidden":"true"}):w?t.jsx(Nl,{className:"text-slate-500",size:20,"aria-hidden":"true"}):t.jsx(Ut,{className:"text-green-500",size:20,"aria-hidden":"true"})},b=v=>{const j=yo.has(v.status),w=v.status==="failed",N=v.status==="cancelled";return t.jsxs(t.Fragment,{children:[j?t.jsx("p",{role:"status","aria-atomic":"true",className:"text-sm text-slate-600 dark:text-slate-400 mt-1",children:v.status==="processing"?"Processing ingestion":"Queued for ingestion"}):t.jsxs("p",{className:"text-sm text-slate-600 dark:text-slate-400 mt-1",children:["Status: ",t.jsx("span",{className:"capitalize",children:v.status})]}),(w||N)&&t.jsx("p",{className:`text-sm mt-1 p-2 rounded ${w?"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/10":"text-slate-600 dark:text-slate-400 bg-slate-100 dark:bg-slate-800"}`,role:w?"alert":"status","aria-atomic":"true",children:v.message})]})},y=v=>{const j=yo.has(v.status),w=v.status==="failed",N=j,k=w&&n;return t.jsx("div",{className:"pb-4",children:t.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-lg border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-800/50",children:[t.jsx("div",{className:"mt-1",children:g(v)}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("h4",{className:"font-medium text-slate-900 dark:text-slate-100",children:v.name}),t.jsxs("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[t.jsx(_t,{size:12,"aria-hidden":"true"}),new Date(v.createdAt).toLocaleString()]})]}),b(v)]}),N&&t.jsx("button",{onClick:()=>{u(v.id)},disabled:i===v.id,className:"p-2 text-slate-400 hover:text-orange-600 hover:bg-orange-50 dark:hover:bg-orange-900/20 rounded-md transition-colors disabled:opacity-50",title:"Cancel ingestion","aria-label":"Cancel ingestion",children:i===v.id?t.jsx(ge,{className:"animate-spin",size:20,"aria-hidden":"true"}):t.jsx(Nl,{size:20,"aria-hidden":"true"})}),k&&t.jsxs("button",{onClick:()=>{m(v.dataset)},disabled:c===v.id,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium text-blue-700 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors disabled:opacity-50",children:[c===v.id?t.jsx(ge,{className:"animate-spin",size:16,"aria-hidden":"true"}):t.jsx(us,{size:16,"aria-hidden":"true"}),"Retry"]})]})})};return t.jsx(Tt,{isOpen:e,onClose:s,title:"Data Ingestion Activity",size:"3xl",children:t.jsx("div",{className:"p-6 max-h-[70vh] flex flex-col",children:h.length===0?t.jsx("div",{className:"text-center text-slate-500 py-8",children:"No ingestion activity found."}):t.jsxs("div",{className:"flex flex-col gap-6 overflow-y-auto pr-1",children:[t.jsxs("section",{"aria-label":"Active ingestions",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:"Active ingestions"})}),x.length===0?t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"No active ingestions."}):t.jsx(Uo,{items:x,getKey:v=>v.id,estimateSize:108,className:"space-y-4",renderItem:y})]}),t.jsxs("section",{"aria-label":"Ingestion history",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:"Ingestion history"})}),f.length===0?t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"No ingestion history yet."}):t.jsx(Uo,{items:f,getKey:v=>v.id,estimateSize:108,className:"space-y-4",renderItem:y})]})]})})})};function Yi(e){return{id:e.id,datasetId:e.dataset_source_id,versionInt:e.version_int,name:e.name,...e.note?{note:e.note}:{},kind:e.kind==="auto"?"auto":"manual",pinned:!!e.pinned,nodeCount:e.node_count,edgeCount:e.edge_count,...e.dataset_name?{datasetName:e.dataset_name}:{},createdAt:e.created_at,graph:e.graph}}const ea={async list(e){return(await se.get(`/pipeline/versions/${encodeURIComponent(e)}`)).data.map(Yi)},async create(e,s){const r=s.graph!==void 0?s.graph:{nodes:s.nodes??[],edges:s.edges??[]},a={name:s.name,graph:r,...s.note?{note:s.note}:{},...s.datasetName?{dataset_name:s.datasetName}:{},kind:s.kind??"manual",pinned:!!s.pinned},n=await se.post(`/pipeline/versions/${encodeURIComponent(e)}`,a);return Yi(n.data)},async update(e,s,r){const a={};r.name!==void 0&&(a.name=r.name),r.note!==void 0&&(a.note=r.note??""),r.pinned!==void 0&&(a.pinned=r.pinned);const n=await se.patch(`/pipeline/versions/${encodeURIComponent(e)}/${s}`,a);return Yi(n.data)},async togglePin(e,s,r){return this.update(e,s,{pinned:r})},async rename(e,s,r){return this.update(e,s,{name:r})},async remove(e,s){await se.delete(`/pipeline/versions/${encodeURIComponent(e)}/${s}`)},async audit(e,s=50,r={}){const a=new URLSearchParams({limit:String(s)});return r.actor&&a.set("actor",r.actor),r.kind&&a.set("kind",r.kind),r.createdAfter&&a.set("created_after",r.createdAfter),r.createdBefore&&a.set("created_before",r.createdBefore),(await se.get(`/pipeline/versions/${encodeURIComponent(e)}/audit?${a.toString()}`)).data}},b6="__anonymous__";function Uw(e){const s=Date.now()-new Date(e).getTime();if(Number.isNaN(s)||s<0)return"just now";const r=Math.floor(s/1e3);if(r<45)return"just now";const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const n=Math.floor(a/60);if(n<24)return`${n}h ago`;const o=Math.floor(n/24);return o<30?`${o}d ago`:new Date(e).toLocaleDateString()}function Hw(e,s){for(const r of e){if(!r||typeof r!="object")continue;const a=r.data,n=a&&typeof a=="object"?a.definitionType??a.catalogType:void 0,o=r.type,i=String(n??o??"unknown");s(i)}}function Ww(e){const s=new Map,r=a=>{s.set(a,(s.get(a)??0)+1)};if(e&&typeof e=="object"&&"nodes"in e){const a=e.nodes;Array.isArray(a)&&Hw(a,r)}else if(Array.isArray(e)){for(const a of e)if(a&&typeof a=="object"){const n=a.step_type;r(String(n??"unknown"))}}return[...s.entries()].sort((a,n)=>n[1]-a[1]).slice(0,8)}const Gw=({isOpen:e,onClose:s,datasetId:r,datasetName:a,onRestore:n})=>{const o=Yt(),[i,l]=p.useState([]),[c,d]=p.useState(!1),[u,m]=p.useState(null),[h,x]=p.useState(null),[f,g]=p.useState(""),[b,y]=p.useState(""),[v,j]=p.useState(null),w=p.useCallback(async()=>{if(r){d(!0),m(null);try{const P=await ea.list(r);l(P)}catch(P){m(P instanceof Error?P.message:String(P))}finally{d(!1)}}},[r]);p.useEffect(()=>{e&&r&&w(),e||(x(null),g(""),y(""),j(null))},[e,r,w]);const N=P=>{x(P.id),g(P.name),y(P.note??"")},k=()=>{x(null),g(""),y("")},_=async P=>{if(!r)return;const I=f.trim();if(!I){le.error("Name cannot be empty");return}try{const A={};I!==P.name&&(A.name=I),A.note=b.trim()||null,await ea.update(r,P.id,A),k(),w(),le.success("Version updated")}catch(A){le.error("Failed to update version",String(A))}},R=async P=>{if(r)try{await ea.togglePin(r,P.id,!P.pinned),w()}catch(I){le.error("Failed to toggle pin",String(I))}},M=async P=>{if(!(!r||!await o({title:`Delete v${P.versionInt}?`,message:`"${P.name}" will be permanently removed from the version history. This cannot be undone.`,confirmLabel:"Delete",variant:"danger"})))try{await ea.remove(r,P.id),w(),le.success("Version deleted")}catch(A){le.error("Failed to delete version",String(A))}},E=async P=>{await o({title:`Restore v${P.versionInt} "${P.name}"?`,message:"This will load the snapshot into the canvas and overwrite any unsaved work there. Continue?",confirmLabel:"Restore",variant:"danger"})&&(n==null||n(P),s())},T=P=>t.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[t.jsx("button",{onClick:()=>{E(P)},title:"Restore this version","aria-label":"Restore version",className:"p-1.5 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 text-blue-600 dark:text-blue-400",children:t.jsx(ms,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>j(I=>I===P.id?null:P.id),title:v===P.id?"Hide details":"Show details","aria-label":"Toggle version details","aria-expanded":v===P.id,className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:v===P.id?t.jsx(Ia,{className:"w-3.5 h-3.5"}):t.jsx(Qe,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>{R(P)},title:P.pinned?"Unpin":"Pin (exempt from cleanup)","aria-label":P.pinned?"Unpin version":"Pin version",className:"p-1.5 rounded hover:bg-amber-50 dark:hover:bg-amber-900/20 text-muted-foreground hover:text-amber-600",children:P.pinned?t.jsx($p,{className:"w-3.5 h-3.5"}):t.jsx(hn,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>N(P),title:"Edit name & note","aria-label":"Edit version",className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:t.jsx(Nc,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>{M(P)},title:"Delete version","aria-label":"Delete version",className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-muted-foreground hover:text-red-600 dark:hover:text-red-400",children:t.jsx(gt,{className:"w-3.5 h-3.5"})})]}),S=()=>t.jsxs(t.Fragment,{children:[c&&t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx(ge,{className:"w-6 h-6 animate-spin text-muted-foreground"})}),!c&&u&&t.jsxs("div",{className:"p-4 text-sm text-red-600 dark:text-red-400",children:["Failed to load versions: ",u]}),!c&&!u&&i.length===0&&t.jsxs("div",{className:"p-8 text-center text-sm text-muted-foreground",children:[t.jsx(kl,{className:"w-10 h-10 mx-auto mb-2 opacity-40"}),t.jsx("p",{className:"font-medium text-foreground/80 mb-1",children:"No versions yet"}),t.jsx("p",{children:"Saving a pipeline against this dataset stamps a version automatically. They show up here for cross-device restore."})]}),!c&&!u&&i.length>0&&t.jsx("div",{className:"max-h-[70vh] flex flex-col border rounded-md overflow-hidden",children:t.jsx(Uo,{items:i,getKey:P=>P.id,estimateSize:80,className:"flex-1 overflow-y-auto",renderItem:P=>{const I=h===P.id;return t.jsxs("div",{className:"p-3 border-b last:border-b-0 hover:bg-accent/40 transition-colors",children:[I?t.jsxs("div",{className:"space-y-2",children:[t.jsx("input",{type:"text",value:f,onChange:A=>g(A.target.value),placeholder:"Pipeline name","aria-label":"Pipeline name",className:"w-full px-2 py-1 text-sm bg-background border rounded outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),t.jsx("textarea",{value:b,onChange:A=>y(A.target.value),placeholder:"Note (optional) β€” describe what changed","aria-label":"Version note",rows:2,className:"w-full px-2 py-1 text-sm bg-background border rounded outline-none focus:ring-1 focus:ring-primary resize-none"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>{_(P)},className:"flex items-center gap-1 px-2 py-1 text-xs action-primary rounded hover:opacity-90",children:[t.jsx(ai,{className:"w-3 h-3"})," Save"]}),t.jsxs("button",{onClick:k,className:"flex items-center gap-1 px-2 py-1 text-xs border rounded hover:bg-accent",children:[t.jsx(Ee,{className:"w-3 h-3"})," Cancel"]})]})]}):t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[P.pinned&&t.jsx(hn,{className:"w-3 h-3 text-amber-500 flex-shrink-0","aria-label":"Pinned"}),t.jsx("span",{className:"font-medium truncate",title:P.name,children:P.name}),t.jsxs("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex-shrink-0",children:["v",P.versionInt]}),P.kind==="auto"&&t.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 flex-shrink-0",title:"Auto-snapshot from a successful save or run",children:"auto"})]}),P.note&&t.jsxs("div",{className:"text-xs text-foreground/80 mt-0.5 flex items-start gap-1",title:P.note,children:[t.jsx(O0,{className:"w-3 h-3 mt-0.5 flex-shrink-0 text-muted-foreground"}),t.jsx("span",{className:"break-words",children:P.note})]}),t.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-3 mt-1 tabular-nums",children:[t.jsx("span",{children:Uw(P.createdAt)}),t.jsxs("span",{children:[P.nodeCount," nodes Β· ",P.edgeCount," edges"]})]})]}),T(P)]}),v===P.id&&!I&&t.jsxs("div",{className:"mt-2 pt-2 border-t text-xs space-y-1.5 text-muted-foreground",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Created: "}),new Date(P.createdAt).toLocaleString()]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Kind: "}),P.kind]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Version: "}),"v",P.versionInt," ",t.jsxs("span",{className:"opacity-60",children:["(#",P.id,")"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-foreground/70 font-medium",children:"Dataset: "}),t.jsx("span",{className:"font-mono",children:P.datasetId})]})]}),(()=>{const A=Ww(P.graph);return A.length===0?t.jsx("div",{className:"italic opacity-70",children:"Snapshot graph is empty or in an unrecognised shape."}):t.jsxs("div",{children:[t.jsx("div",{className:"text-foreground/70 font-medium mb-1",children:"Node breakdown"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:A.map(([B,F])=>t.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-muted text-foreground/80 tabular-nums",title:B,children:[B," ",t.jsxs("span",{className:"opacity-60",children:["Γ—",F]})]},B))})]})})()]})]})}})})]});return t.jsx(Tt,{isOpen:e,onClose:s,size:"3xl",title:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(kl,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),t.jsx("span",{children:"Pipeline Versions"}),a&&t.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["Β· ",a]})]}),children:S()})};function qw(e,s){if(s){const r=s.toLowerCase(),a=e.name.toLowerCase().includes(r),n=(e.source_id||e.id).toLowerCase().includes(r),o=(e.format||"csv").toLowerCase().includes(r);if(!a&&!n&&!o)return!1}return!0}const Kw=()=>{const e=Oa(),s=Yt(),r=Nw({refetchInterval:H=>_w(H.state.data)?5e3:!1}),a=r.data??[],n=r.isLoading,o=Sw(),i=Gh(),l=o.isPending?o.variables??null:null,c=i.isPending?i.variables??null:null,[d,u]=p.useState(!1),[m,h]=p.useState(!1),[x,f]=p.useState(!1),[g,b]=p.useState(null),[y,v]=p.useState(null),[j,w]=p.useState("all"),[N,k]=p.useState(""),[_,R]=p.useState("all"),[M,E]=p.useState("all"),[T,S]=p.useState(!1),[P,I]=p.useState(new Set),A=H=>{var W,ue;return((ue=(W=H.source_metadata)==null?void 0:W.ingestion_status)==null?void 0:ue.status)||"completed"},B=H=>{var je;const W=(je=H.source_metadata)==null?void 0:je.ingestion_status,ue=A(H);return ue==="failed"?(W==null?void 0:W.message)||(W==null?void 0:W.error)||"Ingestion failed":ue==="cancelled"?(W==null?void 0:W.message)||(W==null?void 0:W.error)||"Ingestion cancelled":(W==null?void 0:W.message)||""},F=a.filter(H=>{var ue,je;const W=((je=(ue=H.source_metadata)==null?void 0:ue.ingestion_status)==null?void 0:je.status)||"completed";return j!=="all"&&W!==j||_!=="all"&&H.type!==_||M!=="all"&&(H.format||"csv")!==M?!1:qw(H,N)}),z=async H=>{if(await s({title:"Delete dataset?",message:"Are you sure you want to delete this dataset? This cannot be undone.",confirmLabel:"Delete",variant:"danger"}))try{await o.mutateAsync(H)}catch{le.error("Failed to delete dataset")}},L=async H=>{I(W=>new Set(W).add(H));try{await Wt.exportData(H,"csv")}catch{le.error("Export failed","Could not export the dataset. Please try again.")}finally{I(W=>{const ue=new Set(W);return ue.delete(H),ue})}},K=async H=>{if(await s({title:"Cancel ingestion job?",message:"Are you sure you want to cancel this ingestion job?",confirmLabel:"Cancel job",variant:"danger"}))try{await i.mutateAsync(H)}catch{le.error("Failed to cancel ingestion")}},re=async H=>{H.type==="file"?(u(!0),h(!1)):(h(!0),u(!1)),f(!1),le.info("Open the source form to retry ingestion.")},de=H=>{e(`/canvas?source_id=${H}`)},O=()=>{u(!1)},q=()=>{h(!1)},D=H=>{const W=A(H);return!W||W==="completed"?null:W==="failed"?t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400",children:"Failed"}):W==="cancelled"?t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400",children:"Cancelled"}):t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400",children:[t.jsx(ge,{size:12,className:"animate-spin","aria-hidden":"true"}),W==="processing"?"Processing ingestion":"Queued for ingestion"]})},G=H=>{var W,ue,je,Ye,we,ee,Y,U,pe,fe;return t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[(!((ue=(W=H.source_metadata)==null?void 0:W.ingestion_status)!=null&&ue.status)||((Ye=(je=H.source_metadata)==null?void 0:je.ingestion_status)==null?void 0:Ye.status)==="completed")&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{b(H)},className:"p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors",title:"Preview Dataset","aria-label":"Preview dataset",children:t.jsx(Fp,{size:16})}),t.jsxs("button",{onClick:()=>{de(H.id)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors",title:"Use in Canvas",children:[t.jsx(ms,{size:16}),"Canvas"]}),t.jsxs("button",{onClick:()=>{e(`/eda?dataset_id=${H.id}`)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-md transition-colors",title:"Analyze with EDA",children:[t.jsx(Fn,{size:16}),"EDA"]}),t.jsxs("button",{onClick:()=>{L(H.id)},disabled:P.has(H.id),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20 rounded-md transition-colors disabled:opacity-50",title:"Download CSV",children:[P.has(H.id)?t.jsx("div",{className:"w-4 h-4 border-2 border-green-600 border-t-transparent rounded-full animate-spin"}):t.jsx(Ae,{size:16}),"CSV"]}),t.jsxs("button",{onClick:()=>{v(H)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-amber-600 dark:text-amber-400 hover:bg-amber-50 dark:hover:bg-amber-900/20 rounded-md transition-colors",title:"Pipeline versions for this dataset","aria-label":"View pipeline versions",children:[t.jsx(kl,{size:16}),"Versions"]})]}),(((ee=(we=H.source_metadata)==null?void 0:we.ingestion_status)==null?void 0:ee.status)==="pending"||((U=(Y=H.source_metadata)==null?void 0:Y.ingestion_status)==null?void 0:U.status)==="processing")&&t.jsx("button",{onClick:()=>{K(H.id)},disabled:c===H.id,className:"p-2 text-slate-400 hover:text-orange-600 hover:bg-orange-50 dark:hover:bg-orange-900/20 rounded-md transition-colors disabled:opacity-50",title:"Cancel ingestion","aria-label":"Cancel ingestion",children:c===H.id?t.jsx("div",{className:"w-4 h-4 border-2 border-orange-600 border-t-transparent rounded-full animate-spin","aria-hidden":"true"}):t.jsx(ir,{size:16,"aria-hidden":"true"})}),((fe=(pe=H.source_metadata)==null?void 0:pe.ingestion_status)==null?void 0:fe.status)==="failed"&&t.jsxs("button",{onClick:()=>{re(H)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-md transition-colors","aria-label":"Retry ingestion",children:[t.jsx(us,{size:16,"aria-hidden":"true"}),"Retry"]}),t.jsx("button",{onClick:()=>{z(H.id)},disabled:l===H.id,className:"p-2 text-slate-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-md transition-colors disabled:opacity-50",title:"Delete Dataset","aria-label":"Delete dataset",children:l===H.id?t.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin","aria-hidden":"true"}):t.jsx(gt,{size:16,"aria-hidden":"true"})})]})},J=()=>(N||j!=="all"||_!=="all"||M!=="all")&&t.jsx("button",{onClick:()=>{k(""),w("all"),R("all"),E("all")},className:"text-xs text-blue-600 dark:text-blue-400 hover:underline whitespace-nowrap",children:"Clear all"}),X=()=>{const H=(_!=="all"?1:0)+(M!=="all"?1:0);return t.jsxs("div",{className:"flex flex-col gap-3 mb-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex-1 max-w-sm",children:[t.jsx(lr,{size:16,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none z-10"}),t.jsx("input",{type:"text","aria-label":"Search datasets",placeholder:"Search datasets...",value:N,onChange:W=>{k(W.target.value)},className:"w-full pl-8 pr-3 py-1.5 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),t.jsxs("button",{onClick:()=>{S(!T)},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md border transition-colors ${T||_!=="all"?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300":"bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700"}`,children:[t.jsx(On,{size:14}),"Filters",H>0&&t.jsx("span",{className:"ml-1 w-5 h-5 flex items-center justify-center rounded-full bg-blue-600 text-white text-xs",children:H})]}),J()]}),T&&t.jsxs("div",{className:"flex items-center gap-4 pl-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Type"}),t.jsxs("select",{value:_,onChange:W=>{R(W.target.value)},className:"px-2 py-1 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All types"}),[...new Set(a.map(W=>W.type))].map(W=>t.jsx("option",{value:W,children:W},W))]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Format"}),t.jsxs("select",{value:M,onChange:W=>{E(W.target.value)},className:"px-2 py-1 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[t.jsx("option",{value:"all",children:"All formats"}),[...new Set(a.map(W=>W.format||"csv"))].map(W=>t.jsx("option",{value:W,children:W.toUpperCase()},W))]})]})]}),t.jsx("div",{className:"flex items-center gap-2 overflow-x-auto pb-1 scrollbar-hide",children:["all","completed","processing","failed","cancelled"].map(W=>t.jsx("button",{onClick:()=>{w(W)},className:`px-3 py-1.5 rounded-full text-sm font-medium transition-colors whitespace-nowrap ${j===W?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-700"}`,children:W.charAt(0).toUpperCase()+W.slice(1)},W))})]})},oe=H=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"p-2 bg-blue-50 dark:bg-blue-900/20 rounded text-blue-600 dark:text-blue-400",children:t.jsx(Dr,{size:18})}),t.jsxs("div",{children:[t.jsxs("div",{className:"font-medium text-slate-900 dark:text-slate-100 flex items-center gap-2",children:[H.name,D(H)]}),(A(H)==="failed"||A(H)==="cancelled")&&t.jsx("p",{className:`mt-1 text-xs rounded px-2 py-1 ${A(H)==="failed"?"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/10":"text-slate-600 dark:text-slate-400 bg-slate-100 dark:bg-slate-800"}`,children:B(H)}),t.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400 font-mono mt-0.5",title:"Dataset ID",children:H.source_id||H.id})]})]}),ve=()=>t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm text-left",children:[t.jsx("thead",{className:"text-xs text-slate-500 dark:text-slate-400 uppercase bg-slate-50 dark:bg-slate-800 border-b border-slate-200 dark:border-slate-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-4 font-semibold",children:"Dataset Name"}),t.jsx("th",{className:"px-3 py-4 font-semibold",children:"Type"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Format"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Size"}),t.jsx("th",{className:"px-6 py-4 font-semibold",children:"Created"}),t.jsx("th",{className:"px-6 py-4 font-semibold text-right",children:"Actions"})]})}),t.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700 bg-white dark:bg-slate-900",children:n&&a.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:6,children:t.jsx(Rs,{message:"Loading datasets..."})})}):F.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:6,children:a.length===0?t.jsx(os,{icon:t.jsx(Ct,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No datasets found",description:"Upload a dataset to get started with your analysis."}):t.jsx(os,{title:"No datasets match your search or filters"})})}):F.map(H=>{var W;return t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[t.jsx("td",{className:"px-3 py-4",children:oe(H)}),t.jsx("td",{className:"px-3 py-4",children:t.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border ${H.type==="s3"?"bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-900/20 dark:text-orange-400 dark:border-orange-800":H.type==="file"?"bg-slate-100 text-slate-700 border-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:border-slate-700":"bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-900/20 dark:text-indigo-400 dark:border-indigo-800"}`,children:H.type==="file"?"Upload":H.type.toUpperCase()})}),t.jsx("td",{className:"px-6 py-4",children:t.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200 uppercase border border-slate-200 dark:border-slate-700",children:H.format||"CSV"})}),t.jsx("td",{className:"px-6 py-4 text-slate-600 dark:text-slate-300",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium",children:Ho(H.size_bytes||0)}),t.jsxs("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:[((W=H.rows)==null?void 0:W.toLocaleString())||"-"," rows β€’ ",H.columns||"-"," cols"]})]})}),t.jsx("td",{className:"px-6 py-4 text-slate-600 dark:text-slate-300",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_l,{size:14,className:"text-slate-500 dark:text-slate-400"}),new Date(H.created_at).toLocaleDateString()]})}),t.jsx("td",{className:"px-6 py-4 text-right",children:G(H)})]},H.id)})})]})})});return t.jsxs("div",{className:"p-8 space-y-6",children:[t.jsx(Ow,{dataset:g,isOpen:!!g,onClose:()=>{b(null)}}),t.jsx(zw,{isOpen:m,onClose:()=>{h(!1)},onSuccess:q}),t.jsx(Vw,{isOpen:x,onClose:()=>{f(!1)},datasets:a,onRefresh:()=>{r.refetch()},onRetry:re}),t.jsx(Gw,{isOpen:!!y,onClose:()=>{v(null)},datasetId:(y==null?void 0:y.id)??null,...y!=null&&y.name?{datasetName:y.name}:{},onRestore:H=>{y&&e(`/canvas?source_id=${y.id}`,{state:{restoreVersion:H}})}}),t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:justify-between sm:items-center",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-slate-900 dark:text-slate-100",children:"Data Sources"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Upload a file or connect an S3 source, then send it to the Canvas pipeline builder or the EDA explorer."})]}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsxs("button",{onClick:()=>{f(!0)},className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md shadow-sm hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-700 dark:text-slate-200",children:[t.jsx(_l,{size:18}),"Ingestion Jobs"]}),t.jsxs("button",{onClick:()=>{h(!0)},className:"flex items-center gap-2 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 border border-slate-300 dark:border-slate-600 px-4 py-2 rounded-md shadow-sm transition-all hover:bg-slate-50 dark:hover:bg-slate-700",children:[t.jsx(Ct,{size:18}),"Add Source"]}),t.jsxs("button",{onClick:()=>{u(!d)},className:"flex items-center gap-2 action-primary px-4 py-2 rounded-md shadow-sm transition-all hover:opacity-90 focus-ring",children:[t.jsx(Es,{size:18}),d?"Cancel Upload":"Upload File"]})]})]}),d&&t.jsx("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm animate-in fade-in slide-in-from-top-4",children:t.jsx(Jh,{onUploadComplete:O,onCancel:()=>{u(!1)}})}),X(),ve()]})},xr=class xr{constructor(){Pt(this,"nodes",new Map)}static getInstance(){return xr.instance||(xr.instance=new xr),xr.instance}register(s){if(this.nodes.has(s.type)){const r=`Node type "${s.type}" is already registered. Overwriting.`;console.error(r)}this.nodes.set(s.type,s)}get(s){return this.nodes.get(s)}getAll(){return Array.from(this.nodes.values())}getByCategory(){const s={};return this.nodes.forEach(r=>{const a=s[r.category]??[];a.push(r),s[r.category]=a}),s}};Pt(xr,"instance");let Xl=xr;const ie=Xl.getInstance(),Jw={scale_numeric_features:"normalize normalise normalization standardize standardise standardization min max z score",imputation_node:"fill blanks null nan impute missing data",MissingIndicator:"flag missing data null nan blanks",drop_missing_rows:"remove missing data null nan blanks",deduplicate:"remove duplicates repeated rows",encoding:"one hot categorical numbers dummy ordinal label encoder",ResamplingNode:"imbalanced classes class imbalance smote balance classes",TrainTestSplitter:"holdout validation split train test",feature_target_split:"separate features target x y",classification:"predict classes categories labels classify",regression:"predict numbers numeric continuous values price",text_classification:"classify text sentiment predict text labels",SegmentationNode:"cluster clustering group similar records",data_preview:"inspect data view sample rows table"};function tn(e){return e.toLowerCase().replace(/[-_\s]+/g," ").trim()}function Go(e,s){const r=e.filter(o=>!o.hidden),a=tn(s);if(!a)return r;const n=a.split(" ");return r.map(o=>{const i=tn(o.label),l=tn(o.description),c=tn(o.category),d=tn(o.type),u=Jw[o.type]??"",m=`${i} ${l} ${c} ${d} ${u}`;if(!n.every(x=>m.includes(x)))return{node:o,score:0};const h=i===a?200:i.startsWith(a)?150:i.includes(a)?100:u.includes(a)?60:c.includes(a)?40:d.includes(a)?30:l.includes(a)?20:10;return{node:o,score:h}}).filter(o=>o.score>0).sort((o,i)=>i.score-o.score).map(o=>o.node)}const Yh=[{id:"clean",label:"Data cleaning",types:["drop_missing_columns","imputation_node","drop_missing_rows","deduplicate","MissingIndicator","outlier","value_replacement","AliasReplacement","InvalidValueReplacement"]},{id:"numeric",label:"Numeric & categorical",types:["casting","scale_numeric_features","encoding","TransformationNode","BinningNode"]},{id:"features",label:"Feature engineering",types:["FeatureGenerationNode","PolynomialFeaturesNode","FeatureInteractionNode","feature_selection","TimeSeriesNode"]},{id:"text",label:"Text processing",types:["TextCleaning","count_vectorizer","tfidf_vectorizer","hashing_vectorizer","tokenizer","sentence_embedder"]},{id:"split",label:"Splitting & sampling",types:["TrainTestSplitter","feature_target_split","ResamplingNode"]}],Yw=new Set(Yh.flatMap(e=>e.types));function Qw(e){const s=e.filter(r=>r.category==="Preprocessing"&&!r.hidden);return[...Yh.map(r=>({id:r.id,label:r.label,nodes:s.filter(a=>r.types.includes(a.type))})),{id:"other",label:"Other preprocessing",nodes:s.filter(r=>!Yw.has(r.type))}].filter(r=>r.nodes.length>0)}var ku=(e,s,r)=>(n,o)=>({pastStates:(r==null?void 0:r.pastStates)||[],futureStates:(r==null?void 0:r.futureStates)||[],undo:(i=1)=>{var l,c;if(o().pastStates.length){const d=((l=r==null?void 0:r.partialize)==null?void 0:l.call(r,s()))||s(),u=o().pastStates.splice(-i,i),m=u.shift();e(m),n({pastStates:o().pastStates,futureStates:o().futureStates.concat(((c=r==null?void 0:r.diff)==null?void 0:c.call(r,d,m))||d,u.reverse())})}},redo:(i=1)=>{var l,c;if(o().futureStates.length){const d=((l=r==null?void 0:r.partialize)==null?void 0:l.call(r,s()))||s(),u=o().futureStates.splice(-i,i),m=u.shift();e(m),n({pastStates:o().pastStates.concat(((c=r==null?void 0:r.diff)==null?void 0:c.call(r,d,m))||d,u.reverse()),futureStates:o().futureStates})}},clear:()=>n({pastStates:[],futureStates:[]}),isTracking:!0,pause:()=>n({isTracking:!1}),resume:()=>n({isTracking:!0}),setOnSave:i=>n({_onSave:i}),_onSave:r==null?void 0:r.onSave,_handleSet:(i,l,c,d)=>{var u,m;r!=null&&r.limit&&o().pastStates.length>=(r==null?void 0:r.limit)&&o().pastStates.shift(),(m=(u=o())._onSave)==null||m.call(u,i,c),n({pastStates:o().pastStates.concat(d||i),futureStates:[]})}}),Xw=(e,s)=>(a,n,o)=>{var d,u;o.temporal=wp(((d=s==null?void 0:s.wrapTemporal)==null?void 0:d.call(s,ku(a,n,s)))||ku(a,n,s));const i=((u=s==null?void 0:s.handleSet)==null?void 0:u.call(s,o.temporal.getState()._handleSet))||o.temporal.getState()._handleSet,l=m=>{var f,g,b;if(!o.temporal.getState().isTracking)return;const h=((f=s==null?void 0:s.partialize)==null?void 0:f.call(s,n()))||n(),x=(g=s==null?void 0:s.diff)==null?void 0:g.call(s,m,h);x===null||(b=s==null?void 0:s.equality)!=null&&b.call(s,m,h)||i(m,void 0,h,x)},c=o.setState;return o.setState=(...m)=>{var x;const h=((x=s==null?void 0:s.partialize)==null?void 0:x.call(s,n()))||n();c(...m),l(h)},e((...m)=>{var x;const h=((x=s==null?void 0:s.partialize)==null?void 0:x.call(s,n()))||n();a(...m),l(h)},n,o)};const nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function Zw(e,s=0){return(nt[e[s+0]]+nt[e[s+1]]+nt[e[s+2]]+nt[e[s+3]]+"-"+nt[e[s+4]]+nt[e[s+5]]+"-"+nt[e[s+6]]+nt[e[s+7]]+"-"+nt[e[s+8]]+nt[e[s+9]]+"-"+nt[e[s+10]]+nt[e[s+11]]+nt[e[s+12]]+nt[e[s+13]]+nt[e[s+14]]+nt[e[s+15]]).toLowerCase()}let Qi;const eN=new Uint8Array(16);function tN(){if(!Qi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qi=crypto.getRandomValues.bind(crypto)}return Qi(eN)}const sN=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_u={randomUUID:sN};function rN(e,s,r){var n;e=e||{};const a=e.random??((n=e.rng)==null?void 0:n.call(e))??tN();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,Zw(a)}function er(e,s,r){return _u.randomUUID&&!e?_u.randomUUID():rN(e)}const aN=e=>e&&typeof e=="object"?e:{},Qh=e=>aN(e).merge_strategy??"last_wins";var Ts=(e=>(e.DATA_LOADER="data_loader",e.FEATURE_ENGINEERING="feature_engineering",e.TRAINING="training",e.CLASSIFICATION="classification",e.REGRESSION="regression",e.TEXT_CLASSIFICATION="text_classification",e))(Ts||{});const nN=e=>({stepType:Ts.DATA_LOADER,params:{dataset_id:e.data.datasetId}}),oN=e=>{let s="unknown",r={};const a=e.data.method||"simple";return a==="knn"?(s="KNNImputer",r={columns:e.data.columns,n_neighbors:e.data.n_neighbors,weights:e.data.weights}):a==="iterative"?(s="IterativeImputer",r={columns:e.data.columns,max_iter:e.data.max_iter,estimator:e.data.estimator,...e.data.random_state!=null?{random_state:e.data.random_state}:{}}):(s="SimpleImputer",r={columns:e.data.columns,strategy:e.data.strategy,fill_value:e.data.fill_value}),{stepType:s,params:r}},iN=e=>({stepType:"SimpleImputer",params:e.data||{}}),Su=e=>({stepType:"DropMissingColumns",params:{columns:e.data.columns||[],missing_threshold:e.data.missing_threshold}}),Cu=e=>{const s="DropMissingRows",r=e.data,n=r.drop_if_any_missing===!0||r.missing_threshold==null||r.missing_threshold<=0?{how:"any"}:{missing_threshold:r.missing_threshold};return{stepType:s,params:n}},Eu=e=>({stepType:"Deduplicate",params:{subset:e.data.subset,keep:e.data.keep}}),Ru=e=>({stepType:"Casting",params:{column_types:e.data.column_types}}),Tu=e=>({stepType:"MissingIndicator",params:{columns:e.data.columns,flag_suffix:e.data.flag_suffix}}),lN=new Map([["minmax","MinMaxScaler"],["maxabs","MaxAbsScaler"],["robust","RobustScaler"]]);function cN(e,s){return e==="minmax"?{feature_range:[s.feature_range_min??0,s.feature_range_max??1]}:e==="robust"?{quantile_range:[s.quantile_range_min??25,s.quantile_range_max??75]}:{}}const dN=e=>{const s=e.data&&typeof e.data=="object"?e.data:{},r=s.method||"standard";return{stepType:lN.get(r)??"StandardScaler",params:{...s,...cN(r,s)}}},uN=e=>{let s="unknown",r={};const a=e.data.method;return a==="onehot"?s="OneHotEncoder":a==="dummy"?s="DummyEncoder":a==="label"?s="LabelEncoder":a==="ordinal"?s="OrdinalEncoder":a==="target"?s="TargetEncoder":a==="hash"?s="HashEncoder":a==="woe"?s="WOEEncoder":s="OneHotEncoder",r=e.data,{stepType:s,params:r}},mN=e=>{const s=new Set(["test_size","validation_size","random_state","shuffle","stratify","target_column"]);return{stepType:"TrainTestSplitter",params:Object.fromEntries(Object.entries(e.data||{}).filter(([r])=>s.has(r)))}},pN=e=>({stepType:"LabelEncoder",params:e.data||{}}),hN=e=>({stepType:"feature_target_split",params:e.data||{}}),xN=e=>({stepType:"feature_selection",params:e.data||{}}),gN=e=>{let s="unknown",r={};const a=e.data.method||"iqr";return a==="iqr"?s="IQR":a==="zscore"?s="ZScore":a==="winsorize"?s="Winsorize":a==="elliptic_envelope"?s="EllipticEnvelope":s="IQR",r=e.data,{stepType:s,params:r}},fN=e=>{const s="GeneralTransformation",r=e.data.transformations||[],a=[];for(const o of r){const i=o;if(i.columns&&Array.isArray(i.columns))for(const l of i.columns)a.push({column:l,method:i.method,...i.params})}return{stepType:s,params:{transformations:a}}},bN=e=>({stepType:"GeneralBinning",params:{columns:e.data.columns,strategy:e.data.strategy,n_bins:e.data.n_bins,label_format:e.data.label_format,output_suffix:e.data.output_suffix,drop_original:e.data.drop_original,custom_bins:e.data.custom_bins,custom_labels:e.data.custom_labels,precision:e.data.precision}}),yN=e=>{let s="unknown",r={};return(e.data.type||"oversampling")==="oversampling"?s="Oversampling":s="Undersampling",r=e.data,{stepType:s,params:r}},vN=e=>({stepType:"FeatureMath",params:{operations:e.data.operations}}),jN=e=>({stepType:"PolynomialFeatures",params:{columns:e.data.columns,degree:e.data.degree,interaction_only:e.data.interaction_only,include_bias:e.data.include_bias,output_prefix:e.data.output_prefix,include_input_features:e.data.include_input_features}}),wN=e=>({stepType:"FeatureInteraction",params:{columns:e.data.columns,degree:e.data.degree,interaction_only:e.data.interaction_only,include_bias:e.data.include_bias}}),NN=e=>{let s="unknown",r={};const a=e.data.method;return a==="rolling"?s="RollingAggregate":a==="date"?s="DateFeatures":s="LagFeatures",r=e.data,{stepType:s,params:r}},kN=e=>({stepType:"TextCleaning",params:e.data}),sn=e=>({stepType:e.data.definitionType,params:e.data}),Mu=e=>({stepType:"ValueReplacement",params:e.data}),_N=e=>({stepType:"AliasReplacement",params:e.data}),SN=e=>({stepType:"InvalidValueReplacement",params:e.data}),CN=()=>({stepType:"data_preview",params:{}}),EN=e=>(console.warn(`Unknown node type: ${e.data.definitionType}`),{stepType:"Unknown",params:e.data&&typeof e.data=="object"?e.data:{}}),RN=new Map([["dataset_node",nN],["imputation_node",oN],["simple_imputer",iN],["drop_missing_columns",Su],["DropMissingColumns",Su],["drop_missing_rows",Cu],["DropMissingRows",Cu],["deduplicate",Eu],["Deduplicate",Eu],["casting",Ru],["Casting",Ru],["MissingIndicator",Tu],["missing_indicator",Tu],["scale_numeric_features",dN],["encoding",uN],["TrainTestSplitter",mN],["label_encoding",pN],["feature_target_split",hN],["feature_selection",xN],["outlier",gN],["TransformationNode",fN],["BinningNode",bN],["ResamplingNode",yN],["FeatureGenerationNode",vN],["PolynomialFeaturesNode",jN],["FeatureInteractionNode",wN],["TimeSeriesNode",NN],["TextCleaning",kN],["count_vectorizer",sn],["tfidf_vectorizer",sn],["hashing_vectorizer",sn],["tokenizer",sn],["sentence_embedder",sn],["ValueReplacement",Mu],["value_replacement",Mu],["AliasReplacement",_N],["InvalidValueReplacement",SN],["data_preview",CN]]),Xh=e=>({target_column:e.target_column,model_type:e.model_type,hyperparameters:e.hyperparameters,cv_enabled:e.cv_enabled,cv_folds:e.cv_folds,cv_type:e.cv_type,cv_shuffle:e.cv_shuffle,cv_random_state:e.cv_random_state,cv_time_column:e.cv_time_column,execution_mode:e.execution_mode}),Zh=e=>({strategy:e.search_strategy,strategy_params:e.strategy_params||{},metric:e.metric,n_trials:e.n_trials,cv_enabled:e.cv_enabled,cv_folds:e.cv_folds,cv_type:e.cv_type,cv_shuffle:e.cv_shuffle,cv_random_state:e.cv_random_state,cv_time_column:e.cv_time_column,random_state:e.random_state,tune_threshold:e.tune_threshold??!1}),vo=e=>{const s=Ts.TRAINING;let r={};return e.data.run_mode==="advanced"?r={run_mode:"tuned",target_column:e.data.target_column,algorithm:e.data.model_type,execution_mode:e.data.execution_mode,tuning_config:{...Zh(e.data),search_space:e.data.search_space}}:r={run_mode:"fixed",...Xh(e.data)},{stepType:s,params:r}},TN=e=>{const s=Ts.TRAINING,r={run_mode:"fixed",target_column:"",model_type:e.data.model_type,hyperparameters:e.data.hyperparameters,cv_enabled:!1,execution_mode:e.data.execution_mode,reference_column:e.data.reference_column||void 0};return{stepType:s,params:r}},MN=new Set(["training","classification","regression","text_classification"]),PN={classification:{logistic_regression:"logistic_regression",random_forest_classifier:"random_forest",extra_trees_classifier:"extra_trees",gradient_boosting_classifier:"gradient_boosting",hist_gradient_boosting_classifier:"hist_gradient_boosting",adaboost_classifier:"adaboost",decision_tree_classifier:"decision_tree",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",k_neighbors_classifier:"knn",xgboost_classifier:"xgboost",lgbm_classifier:"lightgbm"},regression:{linear_regression:"linear_regression",ridge_regression:"ridge",lasso_regression:"lasso",elasticnet_regression:"elasticnet",random_forest_regressor:"random_forest",extra_trees_regressor:"extra_trees",gradient_boosting_regressor:"gradient_boosting",hist_gradient_boosting_regressor:"hist_gradient_boosting",adaboost_regressor:"adaboost",decision_tree_regressor:"decision_tree",svr:"svr",k_neighbors_regressor:"knn",xgboost_regressor:"xgboost",lgbm_regressor:"lightgbm"}},ex=e=>typeof e=="string"&&MN.has(e),IN=(e,s)=>typeof e!="string"?null:PN[s==="regression"?"regression":"classification"][e]??null,AN=(e,s,r)=>{const a=[],n={},o=new Set;for(const i of s){const l=e.find(u=>u.id===i.source);if(!l||!ex(l.data.definitionType))continue;o.add(l.id);const c=IN(l.data.model_type,r);if(!c)continue;a.includes(c)||a.push(c);const d=l.data.hyperparameters;$N(d)&&(n[c]=d)}return{baseEstimators:a,baseParams:n,modelSourceIds:o}};function $N(e){return!!(e&&typeof e=="object"&&Object.keys(e).length>0)}function FN(e,s){const r=s.baseEstimators.length>0,a=r?s.baseEstimators:e.base_estimators,n=r?{...e.base_estimator_params??{},...s.baseParams}:e.base_estimator_params;return{base_estimators:a,voting:e.voting,final_estimator:e.final_estimator,cv:e.cv,passthrough:e.passthrough,weights:DN(e,a),n_jobs:e.n_jobs,...LN(e),base_estimator_params:n,final_estimator_params:e.final_estimator_params}}function DN(e,s){if(e.strategy!=="voting")return;const r=e.weights,a=s??[];if(!(!r||a.length===0||!a.some(o=>typeof r[o]=="number"&&r[o]!==1)))return a.map(o=>typeof r[o]=="number"?r[o]:1)}function LN(e){const s=e.task==="classification"&&e.calibrate_base_models===!0;return{calibrate_base_models:s||void 0,calibration_method:s?e.calibration_method:void 0,calibration_cv:s?e.calibration_cv:void 0}}function ON(e,s,r){if(s.size===0)return e;const a=e.filter(o=>!s.has(o));if(a.length>0)return a;const n=new Set;for(const o of s)for(const i of r.filter(l=>l.target===o))s.has(i.source)||n.add(i.source);return Array.from(n)}function zN(e,s){return e.run_mode==="advanced"?{run_mode:"tuned",target_column:e.target_column,algorithm:e.model_type,execution_mode:e.execution_mode,tuning_config:{...Zh(e),...s,tune_base_models:e.tune_base_models}}:{run_mode:"fixed",...Xh(e),hyperparameters:s}}function BN(e,s,r,a,n){const o=AN(s,a,e.data.task),i=FN(e.data,o);return{stepType:Ts.TRAINING,params:zN(e.data,i),inputs:ON(n,o.modelSourceIds,r)}}function VN(e,s,r){const a=new Set(s.filter(n=>n.data.definitionType==="EnsembleNode").map(n=>n.id));return a.size===0?e:e.filter(n=>{const o=s.find(l=>l.id===n.node_id);if(!o||!ex(o.data.definitionType))return!0;const i=r.filter(l=>l.source===n.node_id);return i.length===0||!i.every(l=>a.has(l.target))})}function UN(e){const s=new Set([Ts.TRAINING,"data_preview"]),r=e.filter(i=>s.has(i.step_type));if(e.length<=1)return r;const a=new Set(e.flatMap(i=>i.inputs)),n=e.filter(i=>!a.has(i.node_id));if(r.length===0)return n.length>1?n:r;const o=new Set(r.map(i=>i.node_id));return[...r,...n.filter(i=>!o.has(i.node_id))]}function HN(e){const s=UN(e);if(s.length===0)return e;const r=new Set,a=s.map(n=>n.node_id);for(;a.length>0;){const n=a.shift();if(r.has(n))continue;r.add(n);const o=e.find(i=>i.node_id===n);if(o!=null&&o.inputs)for(const i of o.inputs)a.push(i)}return e.filter(n=>r.has(n.node_id))}const WN=new Map([...RN,["training",vo],["classification",vo],["regression",vo],["text_classification",vo],["SegmentationNode",TN]]);function GN(e,s,r){const a=r.filter(i=>i.target===e.id),n=Array.from(new Set(a.map(i=>i.source)));return e.data.definitionType==="EnsembleNode"?BN(e,s,r,a,n):{...(WN.get(e.data.definitionType)??EN)(e),inputs:n}}function qN(e){var n;const s=e.label||e.title,r=e.definitionType,a=r?(n=ie.get(r))==null?void 0:n.label:void 0;return s||a}function KN(e,s){const r=Qh(e.data),a=qN(e.data),n={...s};return r&&r!=="last_wins"&&(n._merge_strategy=r),a&&(n._display_name=a),n}const Ms=(e,s)=>{var l;const r=e.filter(c=>c.data.definitionType==="dataset_node"),a=r.map(c=>c.id),n=new Set,o=[];for(;a.length>0;){const c=a.shift();if(!c||n.has(c))continue;n.add(c);const d=e.find(m=>m.id===c);if(!d)continue;const u=GN(d,e,s);o.push({node_id:d.id,step_type:u.stepType,params:KN(d,u.params),inputs:u.inputs??[]}),s.filter(m=>m.source===c).forEach(m=>a.push(m.target))}const i=VN(o,e,s);return{pipeline_id:`preview_${er()}`,nodes:HN(i),metadata:{dataset_source_id:(l=r[0])==null?void 0:l.data.datasetId}}};function JN(e){const{known:s,inputs:r,children:a,inDegree:n}=QN(e),o=XN(a,n),i=new Set([...s].filter(c=>!o.has(c))),l=[];for(;i.size>0&&(ZN(i,a),i.size!==0);){const c=YN(i,r);l.push({loopNodeIds:c});for(const d of c)i.delete(d)}return l}function YN(e,s){const r=e.values().next().value,a=[r],n=new Map([[r,0]]);let o=r;for(;;){const i=s.get(o).find(c=>e.has(c)),l=n.get(i);if(l!==void 0)return a.slice(l);n.set(i,a.length),a.push(i),o=i}}function QN(e){const s=new Set(e.map(o=>o.node_id)),r=new Map,a=new Map;for(const o of e)r.set(o.node_id,o.inputs.filter(i=>s.has(i))),a.set(o.node_id,[]);const n=new Map;for(const[o,i]of r){n.set(o,i.length);for(const l of i)a.get(l).push(o)}return{known:s,inputs:r,children:a,inDegree:n}}function XN(e,s){const r=new Set,a=[...s.entries()].filter(([,n])=>n===0).map(([n])=>n);for(;a.length>0;){const n=a.shift();r.add(n);for(const o of e.get(n)){const i=s.get(o)-1;s.set(o,i),i===0&&a.push(o)}}return r}function ZN(e,s){let r=!0;for(;r;){r=!1;for(const a of[...e])s.get(a).some(n=>e.has(n))||(e.delete(a),r=!0)}}const ek=["SimpleImputer","KNNImputer","IterativeImputer","StandardScaler","MinMaxScaler","RobustScaler","MaxAbsScaler","OneHotEncoder","LabelEncoder","OrdinalEncoder","DummyEncoder","TargetEncoder","WOEEncoder","HashEncoder","IQR","ZScore","Winsorize","EllipticEnvelope","VarianceThreshold","CorrelationThreshold","UnivariateSelection","ModelBasedSelection","feature_selection","GeneralBinning","EqualWidthBinning","EqualFrequencyBinning","KBinsDiscretizer","CustomBinning","PowerTransformer","GeneralTransformation","FeatureGeneration","FeatureMath","FeatureGenerationNode","PolynomialFeatures","PolynomialFeaturesNode","Casting","count_vectorizer","tfidf_vectorizer","MissingIndicator","DropMissingColumns","Deduplicate","Oversampling","Undersampling"],tk=["TrainTestSplitter","Split"],Zl=new Set(ek),qo=new Set(tk);let tx=0;const ec=new Set,Pu=()=>tx;function sk(e){return ec.add(e),()=>{ec.delete(e)}}function rk(){tx+=1,ec.forEach(e=>e())}function ak(e){if(e.length!==0){Zl.clear(),qo.clear();for(const s of e){const r=[s.id,...s.aliases??[]];s.learns_from_data&&r.forEach(a=>Zl.add(a)),s.is_splitter&&r.forEach(a=>qo.add(a))}rk()}}const nk=new Set(["LabelEncoder","OrdinalEncoder"]),ok=new Set(["train_test_split","TrainTestSplitter","Split","feature_target_split","training"]);function ik(e,s){const r=new Set;for(const a of e){if(!s.has(a.node_id)||!ok.has(a.step_type))continue;const n=a.params.target_column;typeof n=="string"&&n&&r.add(n)}return r.size===1?[...r][0]:void 0}function lk(e,s,r){if(!nk.has(e))return!1;const a=s.columns;return Array.isArray(a)&&a.length===0||e==="LabelEncoder"&&a==null?!0:!!r&&Array.isArray(a)&&a.length===1&&a[0]===r}function ck(e,s){if(e!=="DropMissingColumns")return!1;const r=s.missing_threshold;return!((typeof r=="number"?r:typeof r=="string"&&r!==""?Number(r):Number.NaN)>0)}function dk(e,s){return e==="SimpleImputer"&&s.strategy==="constant"}function uk(e,s){if(e!=="MissingIndicator")return!1;const r=s.columns;return Array.isArray(r)&&r.length>0}function mk(e,s){return e==="HashEncoder"&&Array.isArray(s.columns)}const pk=new Set(["OneHotEncoder","DummyEncoder","TargetEncoder","WOEEncoder","PowerTransformer","StandardScaler","MinMaxScaler","MaxAbsScaler","RobustScaler","SimpleImputer","KNNImputer","IterativeImputer","GeneralBinning","KBinsDiscretizer","CustomBinning","IQR","ZScore","Winsorize","EllipticEnvelope"]),hk=new Set(["FeatureGeneration","FeatureMath","FeatureGenerationNode"]),xk=new Set(["log","sqrt","square_root","cube_root","reciprocal","square","exp","exponential"]),gk=new Set(["arithmetic","ratio","similarity","datetime_extract"]);function tc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function fk(e){const s=new Map(tc(e.column_types)?Object.entries(e.column_types):[]),r=e.target_type;if(Array.isArray(e.columns)&&typeof r=="string"&&r)for(const a of e.columns)typeof a=="string"&&s.set(a,r);return![...s.values()].some(a=>typeof a=="string"&&["category","categorical"].includes(a.toLowerCase()))}function bk(e,s,r){return pk.has(e)&&Array.isArray(s.columns)&&s.columns.length===0?!0:e==="CustomBinning"?Array.isArray(s.columns):e==="Casting"?fk(s):e==="PolynomialFeatures"||e==="PolynomialFeaturesNode"?yk(s):e==="count_vectorizer"||e==="tfidf_vectorizer"?vk(s,r):jk(e,s)}function yk(e){return!e.auto_detect||Array.isArray(e.columns)&&e.columns.length>0}function vk(e,s){const r=e.columns;return r==null||Array.isArray(r)&&(r.length===0||!!s&&r.every(a=>a===s))}function jk(e,s){if(e==="GeneralTransformation"){const r=s.transformations??[];return Array.isArray(r)&&r.every(a=>tc(a)&&typeof a.method=="string"&&xk.has(a.method))}if(hk.has(e)){const r=s.operations??[];return Array.isArray(r)&&r.every(a=>{if(!tc(a))return!1;const n=a.operation_type===void 0?"arithmetic":a.operation_type;return typeof n=="string"&&gk.has(n)})}return!1}function qc(e){var u;const s=new Set(e.filter(m=>qo.has(m.step_type)).map(m=>m.node_id));if(s.size===0)return[];const r=new Map;for(const m of e)r.set(m.node_id,[]);for(const m of e)for(const h of m.inputs)(u=r.get(h))==null||u.push(m.node_id);const a=new Map,n=new Set;function o(m){const h=a.get(m);if(h)return h;if(n.has(m))return new Set;n.add(m);const x=new Set;for(const f of r.get(m)??[]){x.add(f);for(const g of o(f))x.add(g)}return n.delete(m),a.set(m,x),x}const i=new Map(e.map(m=>[m.node_id,m])),l=new Map;function c(m,h=new Set){if(s.has(m))return!0;const x=l.get(m);if(x!==void 0)return x;const f=i.get(m);if(!(f!=null&&f.inputs.length)||h.has(m))return!1;h.add(m);const g=f.inputs.every(b=>c(b,h));return h.delete(m),l.set(m,g),g}const d=[];for(const m of e){if(!Zl.has(m.step_type)||c(m.node_id))continue;const h=Nk(m,o(m.node_id),i),x=ik(e,h);if(kk(m,x))continue;const f=o(m.node_id),g=[...s].find(b=>f.has(b));g&&d.push({nodeId:m.node_id,stepType:m.step_type,splitterNodeId:g})}return d}function wk(e){return`Data leakage risk: node '${e.nodeId}' (${e.stepType}) fits on the whole dataset before the '${e.splitterNodeId}' train/test split downstream. Move it so it runs AFTER the train/test splitter (Splitter -> Preprocessing -> Model).`}function Kc(e){const s=qc(e.nodes);return s.length===0?!1:(le.error("Data leakage risk detected",wk(s[0])),!0)}function Nk(e,s,r){var i;const a=new Set([e.node_id,...s]),n=[...e.inputs],o=new Set;for(;n.length;){const l=n.pop();o.has(l)||(o.add(l),a.add(l),n.push(...((i=r.get(l))==null?void 0:i.inputs)??[]))}return a}function kk(e,s){return!!(lk(e.step_type,e.params,s)||ck(e.step_type,e.params)||dk(e.step_type,e.params)||uk(e.step_type,e.params)||mk(e.step_type,e.params)||bk(e.step_type,e.params,s))}const _k=e=>e.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase()),na=e=>{const s=ie.get(e.data.definitionType),r=e.data??{};return typeof r.label=="string"&&r.label||typeof r.title=="string"&&r.title||(s==null?void 0:s.label)||(typeof e.data.definitionType=="string"?_k(e.data.definitionType):e.id)};function za(e,s){const r=new Set(e.filter(l=>l.data.definitionType==="data_preview").map(l=>l.id)),a=e.filter(l=>!r.has(l.id)),n=s.filter(l=>!r.has(l.source)&&!r.has(l.target)),o=[];for(const l of a)Sk(l,n,o);const i=Ms(a,n);return Ek(i.nodes,a,o),Rk(i.nodes,a,o),o}function Sk(e,s,r){const a=ie.get(e.data.definitionType),n=na(e);if(!a){r.push({nodeId:e.id,nodeLabel:n,category:"configuration",message:`Refresh or re-add ${n} so the canvas knows how to validate it.`});return}const o=a.validate(e.data);o.isValid||r.push({nodeId:e.id,nodeLabel:n,category:"configuration",message:`Fix the ${n} settings before running preview${o.message?`: ${o.message}`:"."}`,...o.field?{field:o.field}:{}}),a.inputs.length>0&&(s.some(l=>l.target===e.id)||r.push({nodeId:e.id,nodeLabel:n,category:"connection",message:`Connect an upstream node to ${n} before running preview.`})),Ck(e,n,s,r)}function Ck(e,s,r,a){if(e.data.definitionType==="dataset_node"){const n=typeof e.data.datasetId=="string"&&!!e.data.datasetId,o=r.some(i=>i.source===e.id);n&&!o&&a.push({nodeId:e.id,nodeLabel:s,category:"connection",message:"Connect a downstream node to this Dataset before running preview."})}}function Ek(e,s,r){const a=qc(e);for(const n of a){const o=s.find(l=>l.id===n.nodeId),i=s.find(l=>l.id===n.splitterNodeId);!o||!i||r.push({nodeId:o.id,nodeLabel:na(o),category:"leakage",message:`Move ${na(o)} after ${na(i)} so it only fits on training data.`})}}function Rk(e,s,r){const a=JN(e);for(const n of a){const o=n.loopNodeIds.map(i=>s.find(l=>l.id===i)).filter(i=>!!i);o.length!==0&&r.push({nodeId:o[0].id,nodeLabel:na(o[0]),category:"cycle",message:`Cycle detected: ${o.map(i=>na(i)).join(" -> ")} feed back into each other. Remove one of these connections so the pipeline flows in one direction.`})}}function Cr(e){return(e==null?void 0:e.data.definitionType)==="TrainTestSplitter"?Number(e.data.validation_size??0)>0?["train","validation","test"]:["train","test"]:(e==null?void 0:e.data.definitionType)==="feature_target_split"?["X","y"]:[]}function Iu(e,s){const r=Cr(e.find(a=>a.id===s.source));return r.length?{...s,sourceHandle:r[0]}:s}function Tk(e,s){var o,i;const r=new Map(e.map(l=>[l.id,l])),a=new Map,n=[];for(const l of s){const c=Cr(r.get(l.source));if(!c.length){n.push(l);continue}const d=r.get(l.target),u=l.targetHandle??((i=(o=ie.get(String(d==null?void 0:d.data.definitionType)))==null?void 0:o.inputs[0])==null?void 0:i.id)??null,m=JSON.stringify([l.source,l.target,u]),h=a.get(m);if(h!==void 0){const x=n[h];n[h]={...x,selected:!!(x.selected||l.selected),...l.deletable===!1?{deletable:!1}:{}}}else a.set(m,n.length),n.push({...l,type:"custom",sourceHandle:c[0],targetHandle:u})}return n}function Mk(e,s,r){if(s===r)return!0;const a=[r],n=new Set;for(;a.length>0;){const o=a.pop();if(o===s)return!0;if(!n.has(o)){n.add(o);for(const i of e)i.source===o&&a.push(i.target)}}return!1}const sx=["classification","regression","text_classification","SegmentationNode","EnsembleNode"];function Pk(e,s){return sx.includes(e)&&s!=="EnsembleNode"}const Ik="This connection would create a loop. Pipelines must flow in one direction β€” remove the backwards wire instead.",Ak="Training nodes are the end of a pipeline: their output is a trained model, not data. Only an Ensemble can consume a model output β€” wire preprocessing or training from the dataset branch instead.";function Pr(e,s,r){const a=e.find(l=>l.id===r.source),n=e.find(l=>l.id===r.target);if(!a||!n)return"This node is no longer available. Choose an existing node.";if(a.connectable===!1||n.connectable===!1)return"Connections are disabled for this node. Choose another node.";if(Mk(s,a.id,n.id))return Ik;const o=String(a.data.definitionType),i=String(n.data.definitionType);return Pk(o,i)?Ak:$k(a,n,o,i,s,r)}function $k(e,s,r,a,n,o){const{outputs:i,inputs:l,output:c,input:d}=Fk(r,a,o);if(!c||!d)return"Choose an output and an input on registered nodes. Data sources have no input.";const u=Cr(e);if(u.length&&!u.includes(c.id))return"Validation is disabled. Set Validation Size above zero, or connect from Train or Test.";const m=Dk(a,c,d);return m||(n.some(h=>{var x,f;return h.source===e.id&&h.target===s.id&&(u.length>0||(h.sourceHandle??((x=i[0])==null?void 0:x.id))===c.id)&&(h.targetHandle??((f=l[0])==null?void 0:f.id))===d.id})?"These ports are already connected. Choose another input or remove the existing connection.":null)}function Fk(e,s,r){var l,c;const a=((l=ie.get(e))==null?void 0:l.outputs)??[],n=((c=ie.get(s))==null?void 0:c.inputs)??[],o=r.sourceHandle==null?a[0]:a.find(d=>d.id===r.sourceHandle),i=r.targetHandle==null?n[0]:n.find(d=>d.id===r.targetHandle);return{outputs:a,inputs:n,output:o,input:i}}function Dk(e,s,r){return!(e==="EnsembleNode"&&s.type==="model")&&s.type!=="any"&&r.type!=="any"&&s.type!==r.type?`${s.label} provides ${s.type}, but ${r.label} needs ${r.type}. Choose an input of the same kind.`:null}function Au(e,s,r){const a=new Set,n=new Set,o=[e];for(;o.length>0;){const i=o.pop();if(n.has(i))continue;n.add(i);const l=s.find(c=>c.id===i);if((l==null?void 0:l.data.definitionType)==="dataset_node"){a.add(i);continue}for(const c of r.filter(d=>d.target===i))o.push(c.source)}return a}function Lk(e,s,r){const a=Au(e.source,s,r),n=new Set;for(const o of r.filter(i=>i.target===e.target))for(const i of Au(o.source,s,r))n.add(i);return n.size>0&&a.size>0&&![...a].some(o=>n.has(o))}function Ok(e,s,r,a,n){return r!=="EnsembleNode"||!["classification","regression","text_classification","SegmentationNode"].includes(s)||!Lk(e,a,n)?!0:window.confirm(`Warning: this model comes from a different dataset than the ensemble's other inputs. The ensemble re-fits every base learner on a single dataset, so mixing models trained on unrelated data is usually a wiring mistake. @@ -115,9 +115,9 @@ ${k?"βœ“ Correct prediction":"βœ— Misclassification"}`,children:[t.jsx("span",{c ↑ Raise threshold β†’ fewer positives predicted, lower recall, higher precision. ↓ Lower threshold β†’ more positives predicted, higher recall, lower precision. Green cells = correct; red cells = errors. Percentages show % of each actual class row.`,align:"center"})]})]}),h&&t.jsx("div",{className:"mt-2 grid grid-cols-4 gap-1.5 text-xs w-full",children:[{label:"Accuracy",value:h.accuracy,tip:"Overall fraction of correct predictions (OvR: treats selected class as positive)."},{label:"Precision",value:h.precision,tip:"Of all samples predicted as this class, how many actually are? High = few false alarms."},{label:"Recall",value:h.recall,tip:"Of all actual samples of this class, how many did the model catch? High = few misses."},{label:"F1",value:h.f1,tip:"Harmonic mean of Precision and Recall. Balances both β€” best single metric for imbalanced classes."}].map(({label:y,value:v,tip:j})=>{const w=v>=.8?"text-green-600 dark:text-green-400":v>=.6?"text-yellow-500 dark:text-yellow-400":"text-red-500 dark:text-red-400";return t.jsxs("div",{className:"flex flex-col items-center bg-gray-50 dark:bg-gray-900 rounded px-1.5 py-1.5 gap-0.5",children:[t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:y}),t.jsx(me,{text:j,size:"sm",align:"center"})]}),t.jsx("span",{className:`font-mono font-semibold ${w}`,children:v.toFixed(3)})]},y)})}),u.length===2&&t.jsxs("div",{className:"mt-3 border-t border-gray-100 dark:border-gray-700 pt-3",children:[t.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[t.jsx("span",{className:"text-[11px] font-medium text-gray-500 dark:text-gray-400",children:"Per Class"}),t.jsx(me,{text:"Precision, Recall and F1 for each class individually. For binary problems both classes are always shown here.",size:"sm"})]}),t.jsx("div",{className:"grid grid-cols-2 gap-2",children:u.map((y,v)=>{var M;const j=((M=m[v])==null?void 0:M[v])??0,w=m.reduce((E,T,S)=>S!==v?E+(T[v]??0):E,0),N=(m[v]??[]).reduce((E,T,S)=>S!==v?E+T:E,0),k=j+w>0?j/(j+w):0,_=j+N>0?j/(j+N):0,R=k+_>0?2*k*_/(k+_):0;return t.jsxs("div",{className:"flex flex-col items-center p-2 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:[t.jsx("span",{className:"text-[10px] font-semibold text-gray-600 dark:text-gray-300 mb-1.5",children:String(y)}),t.jsx("div",{className:"grid grid-cols-3 gap-1 text-[10px] w-full",children:[{l:"Prec",v:k},{l:"Rec",v:_},{l:"F1",v:R}].map(({l:E,v:T})=>t.jsxs("div",{className:"flex flex-col items-center bg-white dark:bg-gray-800 rounded py-1",children:[t.jsx("span",{className:"text-gray-400",children:E}),t.jsx("span",{className:`font-mono font-semibold ${T>=.8?"text-green-500":T>=.6?"text-yellow-500":"text-red-500"}`,children:T.toFixed(2)})]},E))})]},String(y))})})]})]})})()]}),s.y_proba&&t.jsxs("div",{className:"h-[340px] w-full relative group",id:`${e}-roc`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-roc`,`${e}_roc_curve`),disabled:o===`${e}-roc`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-roc`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-roc`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),(()=>{if(!r)return t.jsx("div",{className:"text-center text-xs text-gray-400",children:"Select a class"});const d=HM(s.y_true,s.y_proba,r);if(!d)return t.jsx("div",{className:"text-center text-xs text-gray-400",children:"ROC not available (multiclass or missing proba)"});const u=d.map(b=>({...b,random:b.fpr})),m=d.reduce((b,y,v)=>{if(v===0)return 0;const j=d[v-1];return b+Math.abs(y.fpr-j.fpr)*(y.tpr+j.tpr)/2},0),h=s.y_proba;let x=null;const g=((h.labels&&h.labels.length===h.classes.length?h.labels:void 0)??h.classes).findIndex(b=>String(b)===r);if(g!==-1){const b=h.values.map(w=>w[g]??0),y=s.y_true.map(w=>String(w)===r?1:0),v=y.filter(w=>w===1).length,j=y.length-v;if(v>0&&j>0){let w=0,N=0;b.forEach((k,_)=>{k>=a&&(y[_]===1?w++:N++)}),x={fpr:N/j,tpr:w/v}}}return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["ROC Curve β€” ",r,t.jsxs("span",{className:"ml-2 font-mono text-purple-600 dark:text-purple-400",children:["AUC=",m.toFixed(3)]})]}),t.jsx(me,{text:`ROC (Receiver Operating Characteristic) curve for class "${r}" vs all others. AUC=${m.toFixed(3)}: closer to 1.0 is better; 0.5 = random. The red dot marks where the model operates at threshold t=${a.toFixed(2)} β€” drag the slider to move it along the curve and see the precision/recall trade-off in real time.`,align:"center"})]}),t.jsxs("div",{className:"flex items-center justify-center gap-4 text-[10px] text-gray-500 dark:text-gray-400 mb-1",children:[t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx("span",{className:"font-semibold",children:"TPR"}),t.jsx(me,{text:"True Positive Rate (Recall / Sensitivity): TP Γ· (TP + FN). Of all actual positives, how many did the model correctly detect? Higher = fewer misses. This is the Y-axis.",size:"sm"}),t.jsx("span",{className:"ml-0.5 font-mono",children:"= TP / (TP+FN)"})]}),t.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"Β·"}),t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx("span",{className:"font-semibold",children:"FPR"}),t.jsx(me,{text:"False Positive Rate (Fall-out): FP Γ· (FP + TN). Of all actual negatives, how many were incorrectly flagged as positive? Lower = fewer false alarms. This is the X-axis.",size:"sm"}),t.jsx("span",{className:"ml-0.5 font-mono",children:"= FP / (FP+TN)"})]})]}),t.jsx($e,{width:"100%",height:"92%",children:t.jsxs(Zr,{data:u,margin:{top:5,right:20,bottom:42,left:40},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"aucFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:"#8b5cf6",stopOpacity:.25}),t.jsx("stop",{offset:"95%",stopColor:"#8b5cf6",stopOpacity:.03})]})}),t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{type:"number",dataKey:"fpr",domain:[0,1],tickFormatter:b=>b.toFixed(1),tick:{fontSize:10},label:{value:"FPR (Fall-out)",position:"insideBottom",offset:-8,fontSize:11,fill:"#9ca3af"}}),t.jsx(ze,{type:"number",dataKey:"tpr",domain:[0,1],tickFormatter:b=>b.toFixed(1),tick:{fontSize:10},label:{value:"TPR (Recall)",angle:-90,position:"insideLeft",offset:10,fontSize:11,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:b,payload:y})=>{var j;if(!b||!(y!=null&&y.length))return null;const v=(j=y[0])==null?void 0:j.payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded shadow-sm p-2 text-xs space-y-0.5",children:[t.jsx("p",{className:"font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"ROC point"}),t.jsxs("p",{className:"text-gray-700 dark:text-gray-200",children:["TPR (Recall) ",t.jsx("span",{className:"font-mono text-purple-600 dark:text-purple-400",children:v.tpr.toFixed(3)})]}),t.jsxs("p",{className:"text-gray-500 dark:text-gray-400",children:["FPR (Fall-out) ",t.jsx("span",{className:"font-mono",children:v.fpr.toFixed(3)})]}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 text-[10px] pt-0.5 border-t border-gray-100 dark:border-gray-700",children:"Precision = TP / (TP+FP) Β Β·Β  Recall = TP / (TP+FN)"})]})}}),t.jsx(Vi,{type:"monotone",dataKey:"tpr",stroke:"none",fill:"url(#aucFill)",isAnimationActive:!1,legendType:"none"}),t.jsx(ht,{type:"monotone",dataKey:"tpr",stroke:"#8b5cf6",dot:!1,activeDot:{r:5},strokeWidth:2.5,name:"ROC",isAnimationActive:!1}),t.jsx(ht,{type:"linear",dataKey:"random",stroke:"#d1d5db",strokeDasharray:"4 3",dot:!1,tooltipType:"none",legendType:"none",strokeWidth:1,isAnimationActive:!1}),x&&t.jsx(Vd,{x:x.fpr,y:x.tpr,r:7,fill:"#ef4444",stroke:"#fff",strokeWidth:2,label:{value:`t=${a.toFixed(2)}`,position:"top",fontSize:10,fill:"#ef4444"}})]})})]})})()]})]}),s.y_proba&&r&&(()=>{var b;const d=WM(s.y_true,s.y_proba,r),u=GM(s.y_true,s.y_proba,r);if(!d||!u)return null;let m=0;for(let y=1;yString(y)===r).length,f=h>0?x/h:0,g=d.map(y=>({...y,noSkill:f}));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mt-5 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"h-[280px] relative group",id:`${e}-pr-curve`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-pr-curve`,`${e}_pr_curve`),disabled:o===`${e}-pr-curve`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-pr-curve`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-pr-curve`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["PR Curve β€” ",r,t.jsxs("span",{className:"ml-2 font-mono text-blue-600 dark:text-blue-400",children:["AUC-PR=",m.toFixed(3)]})]}),t.jsx(me,{text:`Precision-Recall curve for class "${r}". AUC-PR=${m.toFixed(3)}: closer to 1.0 is better. Unlike ROC, PR is not inflated by true negatives β€” prefer PR for imbalanced classes. High precision = few false alarms; high recall = few misses.`,align:"center"})]}),t.jsx($e,{width:"100%",height:"90%",children:t.jsxs(Zr,{data:g,margin:{top:5,right:20,bottom:35,left:40},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"prFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.2}),t.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:.02})]})}),t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{type:"number",dataKey:"recall",domain:[0,1],tickFormatter:y=>y.toFixed(1),tick:{fontSize:10},label:{value:"Recall",position:"insideBottom",offset:-8,fontSize:11,fill:"#9ca3af"}}),t.jsx(ze,{type:"number",dataKey:"precision",domain:[0,1],tickFormatter:y=>y.toFixed(1),tick:{fontSize:10},label:{value:"Precision",angle:-90,position:"insideLeft",offset:10,fontSize:11,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:y,payload:v})=>{if(y&&(v!=null&&v.length)){const j=v.find(N=>N.payload.score!=null);if(!j)return null;const w=j.payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 border border-gray-200 dark:border-gray-700 shadow-sm rounded text-xs",children:[t.jsx("p",{className:"font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"PR point"}),t.jsxs("p",{children:["Recall ",t.jsx("span",{className:"font-mono text-blue-600 dark:text-blue-400",children:w.recall.toFixed(3)})]}),t.jsxs("p",{children:["Precision ",t.jsx("span",{className:"font-mono",children:w.precision.toFixed(3)})]})]})}return null}}),t.jsx(Vi,{type:"monotone",dataKey:"precision",stroke:"none",fill:"url(#prFill)",isAnimationActive:!1,legendType:"none"}),t.jsx(ht,{type:"monotone",dataKey:"precision",stroke:"#3b82f6",dot:!1,activeDot:{r:5},strokeWidth:2.5,name:"PR",isAnimationActive:!1}),t.jsx(ht,{type:"linear",dataKey:"noSkill",stroke:"#d1d5db",strokeDasharray:"4 3",dot:!1,tooltipType:"none",legendType:"none",strokeWidth:1,isAnimationActive:!1}),(()=>{const y=[...d].reverse().find(v=>v.score>=a)??d[d.length-1];return y?t.jsx(Vd,{x:y.recall,y:y.precision,r:6,fill:"#ef4444",stroke:"#fff",strokeWidth:2,label:{value:`t=${a.toFixed(2)}`,position:"top",fontSize:10,fill:"#ef4444"}}):null})()]})})]}),t.jsxs("div",{className:"h-[280px] relative group",id:`${e}-score-dist`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-score-dist`,`${e}_score_distribution`),disabled:o===`${e}-score-dist`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-score-dist`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-score-dist`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["Score Distribution β€” ",r]}),t.jsx(me,{text:`How well does the model separate the two classes? Green bars = samples that truly belong to "${r}"; red = samples that don't. Good separation: green stacks up near score 1, red stacks up near 0, with little overlap in the middle. Heavy overlap around the current threshold (red line) means many borderline predictions β€” consider raising or lowering t.`,align:"center"})]}),t.jsx($e,{width:"100%",height:"90%",children:t.jsxs(Jt,{data:u,barCategoryGap:"1%",margin:{top:5,right:20,bottom:35,left:40},children:[t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{dataKey:"range",tick:{fontSize:9},interval:3,label:{value:`P("${r}")`,position:"insideBottom",offset:-8,fontSize:11,fill:"#9ca3af"}}),t.jsx(ze,{tick:{fontSize:10},label:{value:"Count",angle:-90,position:"insideLeft",style:{textAnchor:"middle"},fontSize:11,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:y,payload:v})=>{if(y&&(v!=null&&v.length)){const j=v[0].payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 border border-gray-200 dark:border-gray-700 shadow-sm rounded text-xs",children:[t.jsxs("p",{className:"font-semibold mb-1",children:["Score bin β‰₯ ",j.range]}),t.jsxs("p",{className:"text-green-600 dark:text-green-400",children:["Actual positive: ",j.pos]}),t.jsxs("p",{className:"text-red-500 dark:text-red-400",children:["Actual negative: ",j.neg]})]})}return null}}),t.jsx(ct,{x:((b=u[Math.min(Math.floor(a*20),19)])==null?void 0:b.range)??"",stroke:"#ef4444",strokeDasharray:"3 3",strokeWidth:1.5,label:{value:`t=${a.toFixed(2)}`,position:"top",fontSize:10,fill:"#ef4444"}}),t.jsx(lt,{dataKey:"pos",name:"Actual +",stackId:"a",fill:"#22c55e",fillOpacity:.7,isAnimationActive:!1}),t.jsx(lt,{dataKey:"neg",name:"Actual βˆ’",stackId:"a",fill:"#ef4444",fillOpacity:.5,isAnimationActive:!1}),t.jsx(Lr,{verticalAlign:"top",height:18,iconSize:10,formatter:y=>t.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:y})})]})})]})]}),t.jsxs("div",{className:"mt-5 grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(()=>{const y=qM(s.y_true,s.y_proba,r);if(!y||y.length<2)return null;const v=y.map(j=>({...j,perfect:j.midpoint}));return t.jsxs("div",{className:"h-[260px] relative group",id:`${e}-calibration`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-calibration`,`${e}_calibration`),disabled:o===`${e}-calibration`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-calibration`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-calibration`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["Calibration β€” ",r]}),t.jsx(me,{text:"Is the model's confidence score trustworthy? X = what score the model gave; Y = how often that class actually appeared at that score. If the model says 80% confidence but only 40% of those samples are truly positive, it is over-confident (point sits below the diagonal). A well-calibrated model's dots hug the diagonal closely.",align:"center",size:"sm"})]}),t.jsx($e,{width:"100%",height:"90%",children:t.jsxs(Zr,{data:v,margin:{top:5,right:15,bottom:32,left:40},children:[t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{type:"number",dataKey:"midpoint",domain:[0,1],tickFormatter:j=>j.toFixed(1),tick:{fontSize:10},label:{value:"Mean predicted prob.",position:"insideBottom",offset:-8,fontSize:10,fill:"#9ca3af"}}),t.jsx(ze,{type:"number",domain:[0,1],tickFormatter:j=>j.toFixed(1),tick:{fontSize:10},label:{value:"Fraction positives",angle:-90,position:"insideLeft",offset:8,fontSize:10,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:j,payload:w})=>{if(!j||!(w!=null&&w.length))return null;const N=w[0].payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 border border-gray-200 dark:border-gray-700 rounded text-xs shadow-sm",children:[t.jsx("p",{className:"font-semibold mb-1",children:"Calibration bin"}),t.jsxs("p",{children:["Predicted confidence ",t.jsx("span",{className:"font-mono text-purple-600 dark:text-purple-400",children:N.midpoint.toFixed(2)})]}),t.jsxs("p",{children:["Actual positive rate ",t.jsx("span",{className:"font-mono",children:N.fracPos.toFixed(3)})]}),t.jsxs("p",{className:"text-gray-400 text-[10px]",children:[N.count," samples in this bin"]})]})}}),t.jsx(ht,{type:"linear",dataKey:"perfect",stroke:"#d1d5db",strokeDasharray:"4 3",dot:!1,legendType:"none",tooltipType:"none",strokeWidth:1,isAnimationActive:!1}),t.jsx(ht,{type:"linear",dataKey:"fracPos",stroke:"#8b5cf6",strokeWidth:2,dot:{r:5,fill:"#8b5cf6",stroke:"#fff",strokeWidth:1.5},activeDot:{r:7},isAnimationActive:!1,name:"Calibration"})]})})]})})(),(()=>{const y=KM(s.y_true,s.y_proba,r);if(!y)return null;const v=y.map(j=>({...j,random:j.pct}));return t.jsxs("div",{className:"h-[260px] relative group",id:`${e}-cum-gains`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-cum-gains`,`${e}_cumulative_gains`),disabled:o===`${e}-cum-gains`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-cum-gains`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-cum-gains`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["Cumulative Gains β€” ",r]}),t.jsx(me,{text:"Samples sorted by score (highest first). X = % of population contacted; Y = % of total positives captured. The diagonal = random. If the blue curve reaches 80% of positives after contacting only 40% β€” the model has 2Γ— lift there. Useful for targeting campaigns.",align:"center",size:"sm"})]}),t.jsx($e,{width:"100%",height:"90%",children:t.jsxs(Zr,{data:v,margin:{top:5,right:15,bottom:32,left:40},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"gainsFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:"#10b981",stopOpacity:.2}),t.jsx("stop",{offset:"95%",stopColor:"#10b981",stopOpacity:.02})]})}),t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{type:"number",dataKey:"pct",domain:[0,1],tickFormatter:j=>`${Math.round(j*100)}%`,tick:{fontSize:10},label:{value:"% Population",position:"insideBottom",offset:-8,fontSize:10,fill:"#9ca3af"}}),t.jsx(ze,{type:"number",dataKey:"gain",domain:[0,1],tickFormatter:j=>`${Math.round(j*100)}%`,tick:{fontSize:10},label:{value:"% Positives",angle:-90,position:"insideLeft",offset:8,fontSize:10,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:j,payload:w})=>{if(!j||!(w!=null&&w.length))return null;const N=w.find(_=>_.payload.lift!=null);if(!N)return null;const k=N.payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 border border-gray-200 dark:border-gray-700 rounded text-xs shadow-sm",children:[t.jsx("p",{className:"font-semibold mb-1",children:"Gains point"}),t.jsxs("p",{children:["Population ",t.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[(k.pct*100).toFixed(1),"%"]})]}),t.jsxs("p",{children:["Positives caught ",t.jsxs("span",{className:"font-mono",children:[(k.gain*100).toFixed(1),"%"]})]}),t.jsxs("p",{className:"text-gray-500 dark:text-gray-400",children:["Lift ",t.jsxs("span",{className:"font-mono",children:[k.lift.toFixed(2),"Γ—"]})]})]})}}),t.jsx(ht,{type:"linear",dataKey:"random",stroke:"#d1d5db",strokeDasharray:"4 3",dot:!1,tooltipType:"none",legendType:"none",strokeWidth:1,isAnimationActive:!1}),t.jsx(Vi,{type:"monotone",dataKey:"gain",stroke:"none",fill:"url(#gainsFill)",isAnimationActive:!1,legendType:"none"}),t.jsx(ht,{type:"monotone",dataKey:"gain",stroke:"#10b981",strokeWidth:2.5,dot:!1,activeDot:{r:5},isAnimationActive:!1,name:"Gains"})]})})]})})(),(()=>{const y=JM(s.y_true,s.y_proba,r);if(!y)return null;const v=y.reduce((j,w)=>w.mcc>j.mcc?w:j,y[0]);return t.jsxs("div",{className:"h-[260px] relative group",id:`${e}-mcc`,children:[t.jsx("div",{className:"absolute top-0 right-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void n(`${e}-mcc`,`${e}_mcc`),disabled:o===`${e}-mcc`,className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:o===`${e}-mcc`?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):i===`${e}-mcc`?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-1",children:[t.jsxs("h5",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 text-center",children:["MCC vs Threshold β€” ",r,t.jsxs("span",{className:"ml-2 font-mono text-orange-500 dark:text-orange-400",children:["best t=",v.threshold.toFixed(2)," (MCC=",v.mcc.toFixed(2),")"]})]}),t.jsx(me,{text:"Which threshold gives the best overall balance between precision and recall β€” even for imbalanced classes? MCC (Matthews Correlation Coefficient) scores from βˆ’1 (completely wrong) to +1 (perfect); 0 = random guessing. The orange peak is the threshold where MCC is highest. The red line is your current threshold. If the red line is far from the orange peak, consider moving your threshold there for better overall performance.",align:"center",size:"sm"})]}),t.jsx($e,{width:"100%",height:"90%",children:t.jsxs(Zr,{data:y,margin:{top:5,right:15,bottom:32,left:40},children:[t.jsx(Ue,{strokeDasharray:"3 3",opacity:.08}),t.jsx(Oe,{type:"number",dataKey:"threshold",domain:[0,1],tickFormatter:j=>j.toFixed(1),tick:{fontSize:10},label:{value:"Threshold",position:"insideBottom",offset:-8,fontSize:10,fill:"#9ca3af"}}),t.jsx(ze,{type:"number",dataKey:"mcc",domain:[-1,1],tickFormatter:j=>j.toFixed(1),tick:{fontSize:10},label:{value:"MCC",angle:-90,position:"insideLeft",offset:8,fontSize:10,fill:"#9ca3af"}}),t.jsx(Fe,{content:({active:j,payload:w})=>{if(!j||!(w!=null&&w.length))return null;const N=w[0].payload;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-2 border border-gray-200 dark:border-gray-700 rounded text-xs shadow-sm",children:[t.jsx("p",{className:"font-semibold mb-1",children:"MCC point"}),t.jsxs("p",{children:["t = ",t.jsx("span",{className:"font-mono",children:N.threshold.toFixed(2)})]}),t.jsxs("p",{children:["MCC = ",t.jsx("span",{className:"font-mono text-orange-500",children:N.mcc.toFixed(4)})]})]})}}),t.jsx(ct,{y:0,stroke:"#d1d5db",strokeDasharray:"3 3",strokeWidth:1}),t.jsx(ct,{x:a,stroke:"#ef4444",strokeDasharray:"3 3",strokeWidth:1.5,label:{value:`t=${a.toFixed(2)}`,position:"top",fontSize:10,fill:"#ef4444"}}),t.jsx(ct,{x:v.threshold,stroke:"#f97316",strokeDasharray:"4 2",strokeWidth:1.5,label:{value:"best",position:"insideTopLeft",fontSize:9,fill:"#f97316"}}),t.jsx(ht,{type:"monotone",dataKey:"mcc",stroke:"#f97316",strokeWidth:2,dot:!1,isAnimationActive:!1,name:"MCC"})]})})]})})()]})]})})()]})};function PI(e,s,r,a){const n=Object.entries(e),o=s?n.find(([c])=>c==="train"):void 0,i=r?n.find(([c])=>c==="test"):void 0,l=a?n.find(([c])=>c==="validation"):void 0;return{trainEntry:o,testEntry:i,valEntry:l}}function II(e,s){var u;const r=((u=e[s])==null?void 0:u[s])??0,a=e.reduce((m,h,x)=>x!==s?m+(h[s]??0):m,0),n=(e[s]??[]).reduce((m,h,x)=>x!==s?m+h:m,0),i=e.flat().reduce((m,h)=>m+h,0)-r-a-n,l=r+a>0?r/(r+a):0,c=r+n>0?r/(r+n):0,d=l+c>0?2*l*c/(l+c):0;return{tp:r,fp:a,fn:n,tn:i,prec:l,rec:c,f1c:d}}const Um=({evaluationData:e,selectedRocClass:s,threshold:r,showTrainMetrics:a,showTestMetrics:n,showValMetrics:o,handleDownload:i,downloadingChart:l,doneChart:c,tunedThresholds:d,useTunedThresholds:u})=>{var j,w,N,k;const m=p.useMemo(()=>{const _={};for(const[R,M]of Object.entries(e.splits))_[R]=u&&d?BM(M,d):pn(M,s,r);return _},[e.splits,s,r,d,u]);if((((w=(j=e.splits.train)==null?void 0:j.y_proba)==null?void 0:w.classes.length)??0)<2)return null;const h=(_,R)=>{const{classes:M,matrix:E}=m[_]??pn(R,s,r),T=`binary-cm-${_}`,S=M.map((I,A)=>{var de;const B=((de=E[A])==null?void 0:de[A])??0,F=E.reduce((O,q,D)=>D!==A?O+(q[A]??0):O,0),z=(E[A]??[]).reduce((O,q,D)=>D!==A?O+q:O,0),L=B+F>0?B/(B+F):0,K=B+z>0?B/(B+z):0,re=L+K>0?2*L*K/(L+K):0;return{cls:I,prec:L,rec:K,f1:re}}),P=I=>I>=.8?"text-green-500":I>=.6?"text-yellow-500":"text-red-500";return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 dark:border-gray-700 pb-1.5 mb-1",children:[t.jsxs("h4",{className:"text-sm font-semibold text-gray-600 dark:text-gray-300 capitalize",children:[_," Set"]}),t.jsx("button",{id:`${T}-dl`,onClick:()=>void i(T,`${_}_binary_tuned`),disabled:l===T,className:"p-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-400 hover:text-blue-600 disabled:opacity-50",title:"Download Confusion Matrix",children:l===T?t.jsx(ge,{className:"w-3 h-3 animate-spin"}):c===T?t.jsx(Ie,{className:"w-3 h-3 text-green-500"}):t.jsx(Ae,{className:"w-3 h-3"})})]}),t.jsxs("div",{id:T,className:"flex flex-col items-center",children:[t.jsxs("div",{className:"flex flex-col",children:[t.jsx("div",{className:"flex mb-0.5 gap-0.5",style:{marginLeft:"70px"},children:M.map(I=>t.jsx("span",{className:"w-16 text-center text-[10px] text-gray-500 dark:text-gray-400 truncate font-medium",title:String(I),children:String(I)},String(I)))}),E.map((I,A)=>t.jsxs("div",{className:"flex items-center gap-0.5 mb-0.5",children:[t.jsx("span",{className:"text-right text-[10px] text-gray-500 dark:text-gray-400 pr-1 truncate font-medium",style:{width:"70px"},title:String(M[A]),children:String(M[A])}),I.map((B,F)=>{const z=A===F,L=Math.max(...I,1),K=z?`rgba(34,197,94,${Math.min(B/L*.75+.1,.85)})`:`rgba(239,68,68,${Math.min(B/L*.65+.05,.75)})`;return t.jsx("div",{className:"w-16 h-14 flex flex-col items-center justify-center rounded border border-gray-100 dark:border-gray-700 cursor-default",style:{backgroundColor:K},title:`true=${String(M[A])}, pred=${String(M[F])}: ${B}`,children:t.jsx("span",{className:"text-sm font-mono font-bold leading-none",children:B})},F)})]},A))]}),t.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2 text-[10px] w-full max-w-xs",children:S.map(({cls:I,prec:A,rec:B,f1:F})=>t.jsxs("div",{className:"flex flex-col items-center bg-gray-50 dark:bg-gray-900 rounded py-1.5 px-1",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium truncate w-full text-center",title:String(I),children:String(I)}),t.jsxs("div",{className:"flex gap-2 mt-0.5",children:[t.jsxs("span",{title:"Precision",children:["P:",t.jsx("span",{className:`font-mono font-semibold ml-0.5 ${P(A)}`,children:A.toFixed(2)})]}),t.jsxs("span",{title:"Recall",children:["R:",t.jsx("span",{className:`font-mono font-semibold ml-0.5 ${P(B)}`,children:B.toFixed(2)})]}),t.jsxs("span",{title:"F1",children:["F1:",t.jsx("span",{className:`font-mono font-semibold ml-0.5 ${P(F)}`,children:F.toFixed(2)})]})]})]},String(I)))})]})]})},x=(_,R)=>{const{classes:M,matrix:E}=m[_]??pn(R,s,r),T=`per-class-${_}`;return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 dark:border-gray-700 pb-1.5 mb-1",children:[t.jsxs("h4",{className:"text-sm font-semibold text-gray-600 dark:text-gray-300 capitalize",children:[_," Set"]}),t.jsx("button",{id:`${T}-dl`,onClick:()=>void i(T,`${_}_per_class`),disabled:l===T,className:"p-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-400 hover:text-blue-600 disabled:opacity-50",title:"Download Per-Class View",children:l===T?t.jsx(ge,{className:"w-3 h-3 animate-spin"}):c===T?t.jsx(Ie,{className:"w-3 h-3 text-green-500"}):t.jsx(Ae,{className:"w-3 h-3"})})]}),t.jsx("div",{id:T,className:`grid ${M.length<=4?"grid-cols-2":"grid-cols-3"} gap-2`,children:M.map((S,P)=>{const{tp:I,fp:A,fn:B,tn:F,prec:z,rec:L,f1c:K}=II(E,P),re=String(S)===s,de=M.filter((H,W)=>W!==P),O=de.length===1?String(de[0]):"Others",q=[String(S),O],D=[["TP","FN"],["FP","TN"]],G=Math.round(L*100),J=I+B>0?B:0,X=K>=.8?`t=${r.toFixed(2)}: catches ${G}% of ${String(S)} β€” strong.`:K>=.6?`t=${r.toFixed(2)}: catches ${G}% of ${String(S)} β€” room to improve.`:`t=${r.toFixed(2)}: only ${G}% caught β€” model struggles here.`,oe=[`Out of ${I+J} actual "${String(S)}" samples, the model correctly caught ${I} of them = ${G}%.`,"",`How: Recall = TP Γ· (TP + FN) = ${I} Γ· ${I+J} = ${G}%`,` TP ${I}: labelled "${String(S)}" and actually "${String(S)}" βœ“`,` FN ${J}: actually "${String(S)}" but predicted as something else βœ—`,"",`Threshold (β‰₯ ${r.toFixed(2)}): the model predicts "${String(S)}" only when it is ${Math.round(r*100)}%+ confident.`,"↑ Raise threshold β†’ harder to trigger, fewer catches (recall ↓), more precise (precision ↑).","↓ Lower threshold β†’ easier to trigger, more catches (recall ↑), more false alarms (precision ↓)."].join(` -`),ve=K>=.8?"text-green-600 dark:text-green-400":K>=.6?"text-yellow-600 dark:text-yellow-400":"text-red-500 dark:text-red-400";return t.jsxs("div",{className:`flex flex-col items-center p-2 rounded-lg border ${re?"border-blue-400 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700"}`,children:[t.jsxs("span",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-1.5 w-full text-center truncate",title:`${String(S)} vs Rest`,children:[String(S)," vs Rest"]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex mb-0.5 gap-0.5",style:{marginLeft:"60px"},children:[t.jsx("span",{className:"w-14 text-center text-[9px] text-gray-500 dark:text-gray-400 truncate font-medium",title:String(S),children:String(S)}),t.jsx("span",{className:"w-14 text-center text-[9px] text-gray-500 dark:text-gray-400 truncate font-medium",title:de.map(String).join(", "),children:O})]}),[[I,B],[A,F]].map((H,W)=>t.jsxs("div",{className:"flex items-center gap-0.5 mb-0.5",children:[t.jsx("span",{className:"text-right text-[9px] text-gray-500 dark:text-gray-400 pr-1 truncate font-medium",style:{width:"60px"},title:q[W],children:q[W]}),H.map((ue,je)=>{var Y,U;const Ye=W===je,we=Math.max(...H,1),ee=Ye?`rgba(34,197,94,${Math.min(ue/we*.75+.1,.85)})`:`rgba(239,68,68,${Math.min(ue/we*.65+.05,.75)})`;return t.jsxs("div",{className:"w-14 h-11 flex flex-col items-center justify-center rounded border border-gray-100 dark:border-gray-700 cursor-default",style:{backgroundColor:ee},title:`${((Y=D[W])==null?void 0:Y[je])??""}=${ue}`,children:[t.jsx("span",{className:"text-[11px] font-mono font-bold leading-none",children:ue}),t.jsx("span",{className:"text-[9px] font-semibold opacity-80 mt-0.5",children:(U=D[W])==null?void 0:U[je]})]},je)})]},W))]}),t.jsx("div",{className:"mt-1.5 grid grid-cols-3 gap-1 text-[10px] w-full",children:[{l:"Prec",v:z},{l:"Rec",v:L},{l:"F1",v:K}].map(({l:H,v:W})=>t.jsxs("div",{className:"flex flex-col items-center bg-gray-50 dark:bg-gray-900 rounded py-1",children:[t.jsx("span",{className:"text-gray-400",children:H}),t.jsx("span",{className:`font-mono font-semibold ${W>=.8?"text-green-500":W>=.6?"text-yellow-500":"text-red-500"}`,children:W.toFixed(2)})]},H))}),t.jsxs("div",{className:`mt-1.5 flex items-center justify-center gap-0.5 ${ve}`,children:[t.jsx("p",{className:"text-[9px] leading-snug text-center",children:X}),t.jsx(me,{text:oe,size:"sm"})]})]},String(S))})})]})},{trainEntry:f,testEntry:g,valEntry:b}=PI(e.splits,a,n,o),v=(((k=(N=e.splits.train)==null?void 0:N.y_proba)==null?void 0:k.classes.length)??0)===2?h:x;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[f&&v(f[0],f[1]),g&&v(g[0],g[1]),!f&&!g&&t.jsx("p",{className:"col-span-2 text-xs text-gray-400 text-center py-8",children:"Enable Train or Test splits above to compare."})]}),b&&t.jsx("div",{className:"mt-6 pt-4 border-t border-gray-100 dark:border-gray-700",children:v(b[0],b[1])})]})};function AI({evaluationData:e,activeTab:s,cmView:r}){var a,n;return e.problem_type==="regression"||s==="slider"&&(r==="overall"||((n=(a=e.splits.train)==null?void 0:a.y_proba)==null?void 0:n.classes.length)===2)}function $I({evaluationData:e,showTrainMetrics:s,showTestMetrics:r,showValMetrics:a},n){return Object.entries(e.splits).filter(([o])=>e.problem_type==="regression"?o===n:!(o==="train"&&!s||o==="test"&&!r||o==="validation"&&!a))}function FI(e){const{evaluationData:s,activeTab:r,cmView:a,activeRegressionSplit:n,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tuningPreview:x}=e;return t.jsxs(t.Fragment,{children:[AI(e)&&t.jsx("div",{className:"flex flex-col gap-6",children:$I(e,n).map(([f,g])=>t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[s.problem_type!=="regression"&&t.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-4 capitalize",children:[f," Set"]}),s.problem_type==="regression"?t.jsx(EI,{splitName:f,splitData:g,handleDownload:u,downloadingChart:m,doneChart:h}):t.jsx(MI,{splitName:f,splitData:g,selectedRocClass:o,threshold:i,handleDownload:u,downloadingChart:m,doneChart:h})]},f))}),r==="slider"&&s.problem_type==="classification"&&a==="per-class"&&t.jsx(Um,{evaluationData:s,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tunedThresholds:null,useTunedThresholds:!1}),r==="tuning"&&s.problem_type==="classification"&&(x?t.jsx(Um,{evaluationData:s,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tunedThresholds:x.thresholds,useTunedThresholds:!0}):t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 italic text-center py-8 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:"Click Preview above to see tuned thresholds applied to your confusion matrix."}))]})}function DI(e){const{evalError:s,evaluationData:r,isEvalLoading:a,fetchEvaluationData:n,evalJobId:o,eligibleJobIds:i}=e,l=o??i[0]??null;return s?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(sr,{error:s,onRetry:l?()=>n(l):void 0})}):r?r.problem_type==="clustering"?t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"This is a Segmentation (clustering) run."}),t.jsx("p",{className:"text-xs mt-2 opacity-70",children:'See the "Segmentation" tab for cluster sizes, centroids, and quality metrics.'})]}):t.jsx(LI,{...e,evaluationData:r}):a?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(Rs,{message:"Loading evaluation data..."})}):t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"Select a completed job to view evaluation details."}),t.jsx("p",{className:"text-xs mt-2 opacity-70",children:"(Note: Only jobs run after this update have evaluation artifacts)"})]})}function LI(e){const{evaluationData:s,isEvalLoading:r,activeTab:a}=e;return t.jsxs("div",{className:`space-y-6 transition-opacity ${r?"opacity-60":""}`,children:[r&&t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 italic",children:"Loading evaluation data…"}),t.jsx(pI,{...e}),s.problem_type==="classification"&&t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic px-1",children:a==="slider"?"Manually explore how a single threshold changes predictions β€” nothing here is saved or used for real predictions.":"Let the optimizer find the best per-class threshold(s) for a metric you choose, preview its effect, then save it to actually change how this model predicts."}),a==="tuning"&&s.problem_type==="classification"&&t.jsx(fI,{...e}),t.jsx(FI,{...e})]})}const OI=e=>{const s=lI(),r=cI(e);return t.jsxs("div",{className:"space-y-6",children:[t.jsx(dI,{...e,eligibleRunLabels:r.eligibleRunLabels}),t.jsx(DI,{...e,...r,...s})]})},Yr=["#8884d8","#82ca9d","#ffc658","#ff7300","#0088fe","#00C49F","#ff6b6b","#4ecdc4"],zI={silhouette_score:"Silhouette Score",calinski_harabasz_score:"Calinski-Harabasz Score",davies_bouldin_score:"Davies-Bouldin Score"};function BI({isEvalLoading:e,currentSplit:s,clustering:r,currentSplitName:a,splitTabs:n,setActiveSplit:o,clusterSizeChartData:i,clusterSizeTableRows:l,metricTableRows:c,chartTheme:d,handleDownload:u,downloadingChart:m,doneChart:h}){return t.jsxs("div",{className:`space-y-6 transition-opacity ${e?"opacity-60":""}`,children:[n.length>1&&t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mr-1",children:"Split:"}),n.map(x=>t.jsx("button",{onClick:()=>{o(x)},className:`px-3 py-1 text-xs font-medium rounded ${a===x?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:x==="validation"?"Validation":x.charAt(0).toUpperCase()+x.slice(1)},x))]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[t.jsx("h4",{className:"text-xs font-semibold text-purple-900 dark:text-purple-100 mb-1",children:"Clusters Found"}),t.jsx("p",{className:"text-2xl font-bold text-purple-700 dark:text-purple-300",children:r.n_clusters})]}),["silhouette_score","calinski_harabasz_score","davies_bouldin_score"].map(x=>{var g;const f=(g=s.metrics)==null?void 0:g[x];return t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between gap-1 mb-1",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400",children:zI[x]}),t.jsx(Ii,{direction:Er(x)})]}),t.jsx("p",{className:"text-2xl font-bold text-gray-800 dark:text-gray-100",children:typeof f=="number"?f.toFixed(3):"not reported"})]},x)})]}),t.jsx(ti,{columns:[{key:"metric",label:"Metric"},{key:"value",label:"Value"},{key:"direction",label:"Direction"}],rows:c,filename:`segmentation_metrics_${a??"split"}`,caption:"Cluster quality metrics with direction (higher/lower is better) for this run and split"}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6 relative group",id:"segmentation-cluster-sizes-chart",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void u("segmentation-cluster-sizes-chart","segmentation_cluster_sizes"),disabled:m==="segmentation-cluster-sizes-chart",className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:m==="segmentation-cluster-sizes-chart"?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):h==="segmentation-cluster-sizes-chart"?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-4",children:"Cluster Sizes"}),t.jsx("div",{className:"h-[300px]",children:t.jsx($e,{width:"100%",height:"100%",children:t.jsxs(Jt,{data:i,margin:{top:5,right:20,bottom:5,left:0},children:[t.jsx(Ue,{strokeDasharray:"3 3",opacity:.1,stroke:d.gridColor}),t.jsx(Oe,{dataKey:"cluster",tick:{fontSize:12,fill:d.axisColor}}),t.jsx(ze,{tick:{fontSize:12,fill:d.axisColor}}),t.jsx(Fe,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),t.jsx(lt,{dataKey:"size",radius:[4,4,0,0],children:i.map(x=>t.jsx(wa,{fill:Yr[x.clusterId%Yr.length]},x.clusterId))})]})})}),t.jsx(ti,{columns:[{key:"cluster",label:"Cluster"},{key:"size",label:"Size (rows)"}],rows:l,filename:`segmentation_cluster_sizes_${a??"split"}`,caption:"Cluster size data, as an alternative to the bar chart above"})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Cluster Profiles (Centroids)"}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.centroids.map(x=>t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[t.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:Yr[x.cluster_id%Yr.length]}}),"Cluster ",x.cluster_id]}),t.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[x.percentage.toFixed(1),"% (",x.size,")"]})]}),t.jsxs("div",{className:"space-y-1",children:[Object.entries(x.center).sort(([,f],[,g])=>Math.abs(g)-Math.abs(f)).slice(0,5).map(([f,g])=>t.jsxs("div",{className:"flex justify-between text-xs",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:f,children:f}),t.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:g.toFixed(2)})]},f)),Object.keys(x.center).length>5&&t.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(x.center).length-5," more features"]})]}),x.profile&&t.jsx("div",{className:"mt-2 pt-2 border-t border-gray-100 dark:border-gray-700 text-xs text-gray-500 dark:text-gray-400 italic",children:x.profile})]},x.cluster_id))})]}),r.reference_crosstab&&r.reference_column&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Reference Column Breakdown (",r.reference_column,")"]}),t.jsx(me,{text:`How rows are distributed across "${r.reference_column}" within each cluster. This column was excluded from training β€” it's shown here only to help you interpret which cluster corresponds to which real-world group.`,align:"center"})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(r.reference_crosstab).sort(([x],[f])=>Number(x)-Number(f)).map(([x,f])=>{const g=Object.values(f).reduce((y,v)=>y+v,0),b=Object.entries(f).sort(([,y],[,v])=>v-y);return t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center mb-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:Yr[Number(x)%Yr.length]}}),t.jsxs("span",{className:"font-bold text-gray-900 dark:text-white",children:["Cluster ",x]})]}),t.jsx("div",{className:"space-y-1",children:b.map(([y,v])=>t.jsxs("div",{className:"flex justify-between text-xs",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:y,children:y}),t.jsxs("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:[v," (",g?(v/g*100).toFixed(0):0,"%)"]})]},y))})]},x)})})]})]})}function VI({evalError:e,evaluationData:s,isEvalLoading:r,retryJobId:a,fetchEvaluationData:n,hasSummary:o,children:i}){return t.jsx(t.Fragment,{children:e?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(sr,{error:e,onRetry:a?()=>n(a):void 0})}):s?s.problem_type!=="clustering"?t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"The selected run is not a Segmentation (clustering) job."}),t.jsx("p",{className:"text-xs mt-1 not-italic",children:"See the availability list above for which selected runs do support clustering."})]}):o?i:t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"No cluster summary available for this run."}),t.jsx("p",{className:"text-xs mt-1 not-italic",children:"This run supports clustering but hasn't produced a summary yet β€” see the availability list above for details."})]}):r?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(Rs,{message:"Loading segmentation data..."})}):t.jsx("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:t.jsx("p",{children:"Select a completed Segmentation run to view cluster details."})})})}function UI(e,s){return e&&e.problem_type==="clustering"&&s?e.splits[s]??null:null}const HI={silhouette_score:"Silhouette Score",calinski_harabasz_score:"Calinski-Harabasz Score",davies_bouldin_score:"Davies-Bouldin Score"},WI=({selectedJobIds:e,coverageEntries:s,evalJobId:r,fetchEvaluationData:a,isEvalLoading:n,evalError:o,evaluationData:i,handleDownload:l,downloadingChart:c,doneChart:d})=>{const u=hs(),m=p.useMemo(()=>!i||i.problem_type!=="clustering"?[]:["train","test","validation"].filter(w=>i.splits[w]!=null),[i]),[h,x]=ae.useState(null),f=h&&m.includes(h)?h:m[0]??null,g=UI(i,f),b=p.useMemo(()=>g!=null&&g.clustering?Object.entries(g.clustering.cluster_sizes).sort(([w],[N])=>Number(w)-Number(N)).map(([w,N])=>({cluster:`Cluster ${w}`,size:N,clusterId:Number(w)})):[],[g]),y=p.useMemo(()=>b.map(w=>({cluster:w.cluster,size:w.size})),[b]),v=p.useMemo(()=>g?["silhouette_score","calinski_harabasz_score","davies_bouldin_score"].map(w=>{var _;const N=(_=g.metrics)==null?void 0:_[w],k=Er(w);return{metric:HI[w]??w,value:typeof N=="number"?Number(N.toFixed(4)):"not reported",direction:k==="higher"?"Higher is better":k==="lower"?"Lower is better":"Direction unknown"}}):[],[g]),j=r??e[0]??null;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(zn,{className:"w-5 h-5 text-purple-500"}),"Segmentation"]}),t.jsx(me,{text:"Cluster quality metrics, sizes, per-cluster centroids (mean feature values), and an auto-generated characteristic profile for this run. There is no ground truth here β€” these metrics describe how well-separated the discovered groups are, not prediction accuracy. If you set a Reference Column, its breakdown per cluster is shown below to help you interpret what each cluster represents.",align:"center"})]}),t.jsx(_d,{entries:s}),e.length>1&&t.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",role:"tablist","aria-label":"Select run for segmentation",children:e.map(w=>{const N=r===w;return t.jsx("button",{type:"button",role:"tab","aria-selected":N,onClick:()=>{a(w)},className:`px-3 py-1 text-xs font-mono rounded border whitespace-nowrap focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 ${N?"bg-blue-100 border-blue-300 text-blue-700 dark:bg-blue-900/30 dark:border-blue-700 dark:text-blue-300":"bg-white border-gray-200 text-gray-600 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:w.slice(0,8)},w)})}),t.jsx(VI,{evalError:o,evaluationData:i,isEvalLoading:n,retryJobId:j,fetchEvaluationData:a,hasSummary:!!(g!=null&&g.clustering),children:(g==null?void 0:g.clustering)&&t.jsx(BI,{isEvalLoading:n,currentSplit:g,clustering:g.clustering,currentSplitName:f,splitTabs:m,setActiveSplit:x,clusterSizeChartData:b,clusterSizeTableRows:y,metricTableRows:v,chartTheme:u,handleDownload:l,downloadingChart:c,doneChart:d})})]})};let gl=null;function GI(){return gl||(gl=cr(()=>import("./mermaid.core-DBa20IFF.js").then(e=>e.bj),__vite__mapDeps([0,1,2,3])).then(e=>{const s=e.default,r=typeof document<"u"&&document.documentElement.classList.contains("dark");return s.initialize({startOnLoad:!1,securityLevel:"strict",theme:r?"dark":"default"}),s})),gl}function qI(e){return new DOMParser().parseFromString(e,"text/html").querySelector("svg")}let KI=0;const JI=({chart:e,className:s})=>{const r=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{let n=!1;const o=`skyulf-mermaid-${++KI}`,i=(l,c=!1)=>{const d=a.current;d&&(d.textContent=l??"",d.classList.toggle("!text-red-500",c),d.classList.toggle("dark:!text-red-400",c))};return i("Rendering diagram…"),GI().then(async l=>{const{svg:c}=await l.render(o,e);if(n||!r.current)return;const d=qI(c);if(!d)throw new Error("mermaid produced no SVG output");r.current.replaceChildren(d),i(null)}).catch(l=>{n||i(`Failed to render pipeline diagram: ${l instanceof Error?l.message:"unknown error"}`,!0)}),()=>{n=!0}},[e]),t.jsxs("div",{className:s,children:[t.jsx("div",{ref:a,className:"text-sm text-gray-400 dark:text-gray-500 p-4 empty:hidden",role:"status"}),t.jsx("div",{ref:r,className:"flex justify-center overflow-x-auto [&>svg]:max-w-full [&>svg]:h-auto"})]})};function Hm(e){var a;const r=(e.metrics??((a=e.result)==null?void 0:a.metrics)??{}).pipeline_diagram;return typeof r=="string"&&r.length>0?r:null}const YI=({diagram:e})=>{const[s,r]=ae.useState("idle"),a=ae.useRef(null);ae.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);const n=async()=>{try{await navigator.clipboard.writeText("```mermaid\n"+e+"\n```\n"),r("copied")}catch{r("error")}a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>r("idle"),2e3)};return t.jsx("button",{type:"button",onClick:n,"data-testid":"copy-mermaid-button",className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:s==="copied"?"Copied!":s==="error"?"Copy failed":"Copy mermaid"})},QI=({jobs:e})=>{const s=e.filter(r=>Hm(r)!==null);return s.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8 text-center text-gray-500 dark:text-gray-400",children:"None of the selected runs carry a pipeline diagram yet. Diagrams are recorded automatically for runs completed after this feature shipped."}):t.jsx("div",{className:`grid gap-6 ${s.length>1?"grid-cols-1 xl:grid-cols-2":"grid-cols-1"}`,"data-testid":"pipeline-diagram-view",children:e.map(r=>{const a=Hm(r);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[t.jsxs("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:["Run ",qe(r)]}),t.jsxs("div",{className:"flex items-center gap-3",children:[a&&t.jsx(YI,{diagram:a}),r.model_type&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:r.model_type})]})]}),a?t.jsx(JI,{chart:a,className:"p-4"}):t.jsx("div",{className:"p-6 text-sm text-gray-400 dark:text-gray-500",children:"No diagram recorded for this run (legacy job)."})]},r.job_id)})})},XI=({datasets:e,selectedDatasetId:s,setSelectedDatasetId:r,filterType:a,setFilterType:n})=>t.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-4 flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:"Experiments & Comparison"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Compare metrics and parameters across multiple runs"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("select",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5",value:s,onChange:o=>{r(o.target.value)},children:[t.jsx("option",{value:"all",children:"All Datasets"}),e.map(o=>t.jsx("option",{value:o.id,children:o.name},o.id))]}),t.jsxs("select",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5",value:a,onChange:o=>{n(o.target.value)},children:[t.jsx("option",{value:"all",children:"All Experiments"}),t.jsx("option",{value:"classification",children:"Classification"}),t.jsx("option",{value:"regression",children:"Regression"}),t.jsx("option",{value:"text_classification",children:"Text Classification"}),t.jsx("option",{value:"segmentation",children:"Segmentation"}),t.jsx("option",{value:"ensemble",children:"Ensemble"})]})]})]}),ZI="px-4 py-2 text-sm font-medium border-b-2 transition-colors",zs=e=>`${ZI} ${e?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,eA=({activeView:e,setActiveView:s,hasFeatureImportances:r,hasShapSummary:a,hasSegmentation:n,hasPipelineDiagram:o})=>t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[t.jsx("button",{className:zs(e==="charts"),onClick:()=>{s("charts")},children:"Visual Comparison"}),t.jsx("button",{className:zs(e==="table"),onClick:()=>{s("table")},children:"Detailed Metrics & Params"}),t.jsx("button",{className:zs(e==="evaluation"),onClick:()=>{s("evaluation")},children:"Model Evaluation"}),t.jsx("button",{className:zs(e==="diff"),onClick:()=>{s("diff")},"data-testid":"experiments-tab-diff",children:"Pipeline Diff"}),o&&t.jsx("button",{className:zs(e==="diagram"),onClick:()=>{s("diagram")},"data-testid":"experiments-tab-diagram",children:"Pipeline Diagram"}),r&&t.jsx("button",{className:zs(e==="importance"),onClick:()=>{s("importance")},children:"Feature Importance"}),a&&t.jsx("button",{className:zs(e==="shap"),onClick:()=>{s("shap")},children:"SHAP Explainability"}),n&&t.jsx("button",{className:zs(e==="segmentation"),onClick:()=>{s("segmentation")},"data-testid":"experiments-tab-segmentation",children:"Segmentation"})]}),tA=e=>e==="best_score"?{type:"val",base:"best_score"}:e.startsWith("train_")?{type:"train",base:e.replace("train_","")}:e.startsWith("test_")?{type:"test",base:e.replace("test_","")}:e.startsWith("val_")?{type:"val",base:e.replace("val_","")}:{type:"other",base:e},sA=()=>{const{jobs:e,fetchJobs:s,hasMore:r,loadMoreJobs:a,isLoading:n,promoteJob:o,unpromoteJob:i}=Ke(),l=Yt(),[c,d]=p.useState([]),[u,m]=p.useState("all"),[h,x]=p.useState([]),[f,g]=p.useState("all"),[b,y]=p.useState([]),[v,j]=p.useState(null),[w,N]=p.useState(!1),[k,_]=p.useState(!0),[R,M]=p.useState(!0),[E,T]=p.useState(!0),[S,P]=p.useState(!1),[I,A]=p.useState(!0),[B,F]=p.useState(!0),[z,L]=p.useState(!0),[K,re]=p.useState(!0),[de,O]=p.useState("charts"),{evaluationData:q,setEvaluationData:D,isEvalLoading:G,evalError:J,evalJobId:X,setEvalJobId:oe,selectedTuningMetric:ve,setSelectedTuningMetric:H,tuningPreview:W,setTuningPreview:ue,hasSavedThresholds:je,setHasSavedThresholds:Ye,useTunedThresholds:we,setUseTunedThresholds:ee,tuningError:Y,setTuningError:U,selectedThresholdMetric:pe,setSelectedThresholdMetric:fe,fetchEvaluationData:Xe}=ZM(e),[dt,ut]=p.useState(null),[Ur,Pd]=p.useState(null),[ao,Id]=p.useState(null),[Vf,Uf]=p.useState(.5),[Hf,Wf]=p.useState("overall"),[Gf,qf]=p.useState("slider"),[Kf,Jf]=p.useState(null),Yf=p.useMemo(()=>{if(!q||!ao||q.problem_type==="clustering")return[];const $=q.splits,te=[{key:"validation",visible:E,label:"validation"},{key:"test",visible:R,label:"test"},{key:"train",visible:k,label:"train"}].filter(fs=>{var As;return(As=$[fs.key])==null?void 0:As.y_proba}),Ne=te.filter(fs=>fs.visible);return(Ne.length>0?Ne:te).flatMap(({key:fs,label:As})=>{const $s=$[fs];if(!($s!=null&&$s.y_proba))return[];const Od=UM($s.y_true,$s.y_proba,ao,pe);return Od?[{...Od,splitLabel:As,metricName:pe}]:[]})},[q,ao,pe,E,R,k]);p.useEffect(()=>{s(),Qf(),Xf()},[s]),p.useEffect(()=>{var $,Z,te;if((q==null?void 0:q.problem_type)!=="clustering"&&((Z=($=q==null?void 0:q.splits.train)==null?void 0:$.y_proba)!=null&&Z.classes)&&q.splits.train.y_proba.classes.length>0){const Ne=q.splits.train.y_proba,Mt=((te=Ne.labels)==null?void 0:te[0])??Ne.classes[0];Id(String(Mt))}},[q]);const Qf=async()=>{try{const $=await se.get("/pipeline/datasets/list");x($.data)}catch($){console.error("Failed to fetch datasets",$),le.error("Failed to load datasets","The dataset filter may be incomplete. Please retry.")}},Xf=async()=>{try{const $=await zr.getAllNodes();y($)}catch($){console.error("Failed to fetch node registry",$)}},Zf=async($,Z)=>{if($.stopPropagation(),!!await l({title:"Deploy to production?",message:"Are you sure you want to deploy this model to production?",confirmLabel:"Deploy"}))try{await Z3.deployModel(Z),le.success("Model deployed")}catch{le.error("Failed to deploy model")}},e0=async($,Z)=>{$.stopPropagation();try{Z.promoted_at?await i(Z.job_id):await o(Z.job_id)}catch{le.error("Failed to update promotion status")}},no=async($,Z)=>{const te=document.getElementById($);if(!te)return;ut($);const Mt=document.documentElement.classList.contains("dark")?"#1f2937":"#ffffff";try{const fs=await Lp(te,{backgroundColor:Mt,pixelRatio:2,filter:$s=>!($s instanceof HTMLElement&&$s.dataset.exportIgnore==="true")}),As=document.createElement("a");As.download=`${Z}.png`,As.href=fs,As.click()}catch(fs){le.error("Image download failed",String(fs))}finally{ut(null),Pd($),setTimeout(()=>Pd(null),1200)}},t0=async()=>{var $,Z;if(X){U(null);try{const te=await mn.preview(X,ve);ue(te)}catch(te){console.error("Failed to preview thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to preview thresholds";throw U(Ne),te}}},s0=async()=>{var $,Z;if(!(!X||!W)){U(null);try{await mn.save(X,W),Ye(!0),ee(!0)}catch(te){console.error("Failed to save thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to save thresholds";throw U(Ne),te}}},r0=async $=>{var Z,te;if(X){U(null);try{await mn.toggle(X,$),ee($)}catch(Ne){console.error("Failed to toggle thresholds",Ne);const Mt=((te=(Z=Ne.response)==null?void 0:Z.data)==null?void 0:te.detail)||"Failed to toggle thresholds";throw U(Mt),Ne}}},a0=async()=>{var $,Z;if(X){U(null);try{await mn.clear(X),Ye(!1),ue(null),ee(!1)}catch(te){console.error("Failed to clear thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to clear thresholds";throw U(Ne),te}}},$i=p.useMemo(()=>e.filter($=>{const Z=u==="all"||kt($.model_type,b)===u,te=f==="all"||$.dataset_id===f,Ne=$.status==="completed";return Z&&te&&Ne}).sort(($,Z)=>$.promoted_at&&!Z.promoted_at?-1:!$.promoted_at&&Z.promoted_at?1:0),[e,u,f,b]),De=p.useMemo(()=>e.filter($=>c.includes($.job_id)),[e,c]),Ad=p.useMemo(()=>new Map(e.map($=>[$.job_id,$])),[e]),mr=p.useMemo(()=>{const $=new Set($i.map(Z=>Z.job_id));return c.flatMap(Z=>{const te=e.find(Ne=>Ne.job_id===Z);return te?[{jobId:Z,task:kt(te.model_type,b),visible:$.has(Z)}]:[]})},[c,e,$i,b]),oo=p.useMemo(()=>MM(mr),[mr]),n0=p.useMemo(()=>oo.hidden.flatMap($=>e.filter(Z=>Z.job_id===$)),[oo.hidden,e]),Fi=p.useMemo(()=>PM("evaluation",mr),[mr]),o0=p.useMemo(()=>Fi.flatMap($=>{const Z=Ad.get($);return Z?[{jobId:$,pipeline_id:Z.pipeline_id,parent_pipeline_id:Z.parent_pipeline_id??null}]:[]}),[Fi,Ad]),io=p.useMemo(()=>de!=="evaluation"&&de!=="segmentation"?null:IM(de,mr,X),[de,mr,X]);p.useEffect(()=>{if(!(de!=="evaluation"&&de!=="segmentation")){if(io===null){D(null),oe(null);return}io!==X&&Xe(io)}},[de,io,X,D,oe,Xe]);const i0=$=>{d(Z=>Z.includes($)?Z.filter(te=>te!==$):[...Z,$])},l0=p.useMemo(()=>De.map($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return{name:qe($),...Z}}),[De]),Is=p.useMemo(()=>Array.from(new Set(De.flatMap($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return Object.keys(Z).filter(Ne=>{const Mt=Z[Ne];return typeof Mt=="number"&&!Number.isNaN(Mt)})}))),[De]),c0=p.useMemo(()=>Is.some($=>$.startsWith("train_")),[Is]),d0=p.useMemo(()=>Is.some($=>$.startsWith("test_")),[Is]),u0=p.useMemo(()=>Is.some($=>$.startsWith("val_")),[Is]),m0=p.useMemo(()=>Is.some($=>$.startsWith("cv_")||$==="best_score"),[Is]),Di=p.useMemo(()=>c4(Array.from(new Set(De.flatMap($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return Object.keys(Z).filter(Ne=>{const Mt=Z[Ne];return typeof Mt=="number"&&!Number.isNaN(Mt)})}))),{train:k,test:R,val:E,cv:S}),[De,k,R,E,S]),Li=p.useMemo(()=>{const $=new Map;return Di.forEach(Z=>{var Ne;const{base:te}=tA(Z);$.has(te)||$.set(te,[]),(Ne=$.get(te))==null||Ne.push(Z)}),$.forEach((Z,te)=>{$.set(te,Z.sort())}),$},[Di]),Oi=p.useMemo(()=>Array.from(Li.keys()).sort(),[Li]),p0=v&&Oi.includes(v)?v:Oi[0]||null,Ya=p.useMemo(()=>De.map($=>{const Z=$.result??{},te=Z.metrics,Ne=(te==null?void 0:te.feature_importances)??Z.feature_importances;return{jobId:$.job_id,pipeline_id:$.pipeline_id,parent_pipeline_id:$.parent_pipeline_id??null,modelType:$.model_type??"unknown",importances:Ne??null}}),[De]),$d=p.useMemo(()=>Ya.some($=>$.importances!==null),[Ya]),h0=p.useMemo(()=>Ya.map(($,Z)=>{const te=De[Z];return{jobId:$.jobId,label:$.modelType!=="unknown"?`${$.modelType} (${qe($)})`:qe($),task:kt(te.model_type,b),status:te.status,error:te.error,hasArtifact:$.importances!==null}}),[Ya,De,b]),Qa=p.useMemo(()=>De.map($=>{const Z=$.result??{},te=Z.metrics,Ne=(te==null?void 0:te.shap_explanation)??Z.shap_explanation;return{jobId:$.job_id,pipeline_id:$.pipeline_id,parent_pipeline_id:$.parent_pipeline_id??null,modelType:$.model_type??"unknown",shapExplanation:Ne??null}}),[De]),Fd=p.useMemo(()=>Qa.some($=>$.shapExplanation!==null),[Qa]),x0=p.useMemo(()=>Qa.map(($,Z)=>{const te=De[Z];return{jobId:$.jobId,label:$.modelType!=="unknown"?`${$.modelType} (${qe($)})`:qe($),task:kt(te.model_type,b),status:te.status,error:te.error,hasArtifact:$.shapExplanation!==null}}),[Qa,De,b]),Dd=p.useMemo(()=>De.some($=>kt($.model_type,b)==="segmentation"),[De,b]),Ld=p.useMemo(()=>De.some($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return typeof Z.pipeline_diagram=="string"&&Z.pipeline_diagram.length>0}),[De]),g0=p.useMemo(()=>De.map($=>{const Z=kt($.model_type,b);return{jobId:$.job_id,label:$.model_type?`${$.model_type} (${qe($)})`:qe($),...kd("segmentation",{task:Z,status:$.status,error:$.error,hasArtifact:!0})}}),[De,b]);return t.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[t.jsx(XI,{datasets:h,selectedDatasetId:f,setSelectedDatasetId:g,filterType:u,setFilterType:m}),t.jsx(rA,{hiddenSelectedJobs:n0,visibleIds:oo.visible,selectedCount:mr.length,onShowAll:()=>{m("all"),g("all")},onClearHidden:()=>d(oo.visible)}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsx(oI,{filteredJobs:$i,selectedJobIds:c,isSidebarCollapsed:w,setIsSidebarCollapsed:N,toggleJobSelection:i0,hasMore:r,isLoading:n,loadMoreJobs:a,handlePromote:e0,handleDeploy:Zf,getDuration:Wo}),t.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:De.length===0?t.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[t.jsx(On,{className:"w-12 h-12 mb-4 opacity-20"}),t.jsx("p",{children:"Select runs from the sidebar to compare them."})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(eA,{activeView:de,setActiveView:O,hasFeatureImportances:$d,hasShapSummary:Fd,hasSegmentation:Dd,hasPipelineDiagram:Ld}),t.jsx(ZP,{selectedJobs:De,getDuration:Wo}),de==="charts"&&t.jsx(tI,{metricsData:l0,metricGroups:Li,availableMetrics:Oi,activeMetric:p0,setSelectedMetric:j,showTrainMetrics:k,setShowTrainMetrics:_,showTestMetrics:R,setShowTestMetrics:M,showValMetrics:E,setShowValMetrics:T,showCvMetrics:S,setShowCvMetrics:P,hasTrainMetrics:c0,hasTestMetrics:d0,hasValMetrics:u0,hasCvMetrics:m0}),de==="table"&&t.jsx(_P,{selectedJobs:De,metricKeys:Di,isPipelineExpanded:K,setIsPipelineExpanded:re,isMetricsExpanded:I,setIsMetricsExpanded:A,isParamsExpanded:B,setIsParamsExpanded:F,isTuningExpanded:z,setIsTuningExpanded:L}),de==="evaluation"&&t.jsx(OI,{eligibleJobIds:Fi,eligibleJobs:o0,evalJobId:X,fetchEvaluationData:Xe,isEvalLoading:G,evalError:J,evaluationData:q,selectedRegressionSplit:Kf,setSelectedRegressionSplit:Jf,showTrainMetrics:k,setShowTrainMetrics:_,showTestMetrics:R,setShowTestMetrics:M,showValMetrics:E,setShowValMetrics:T,threshold:Vf,setThreshold:Uf,selectedRocClass:ao,setSelectedRocClass:Id,cmView:Hf,setCmView:Wf,activeTab:Gf,setActiveTab:qf,selectedMetric:pe,setSelectedMetric:fe,bestMetricInfos:Yf,handleDownload:no,downloadingChart:dt,doneChart:Ur,selectedTuningMetric:ve,onSelectedTuningMetricChange:H,tuningPreview:W,tuningError:Y,useTunedThresholds:we,hasSavedThresholds:je,onPreviewThresholds:t0,onSaveThresholds:s0,onToggleThresholds:r0,onClearThresholds:a0}),de==="diff"&&t.jsx(SM,{jobs:De}),t.jsx(aA,{activeView:de,hasPipelineDiagram:Ld,hasFeatureImportances:$d,hasShapSummary:Fd,hasSegmentation:Dd,diagramProps:{jobs:De},importanceProps:{featureImportancesByJob:Ya,coverageInputs:h0,handleDownload:no,downloadingChart:dt,doneChart:Ur},shapProps:{shapExplanationByJob:Qa,coverageInputs:x0,handleDownload:no,downloadingChart:dt,doneChart:Ur},segmentationProps:{selectedJobIds:c,coverageEntries:g0,evalJobId:X,fetchEvaluationData:Xe,isEvalLoading:G,evalError:J,evaluationData:q,handleDownload:no,downloadingChart:dt,doneChart:Ur}})]})})]})]})};function rA({hiddenSelectedJobs:e,visibleIds:s,selectedCount:r,onShowAll:a,onClearHidden:n}){return t.jsx(t.Fragment,{children:e.length>0&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[t.jsxs("span",{className:"font-medium",children:[s.length," of ",r," selected runs visible"]}),t.jsxs("span",{className:"flex-1 min-w-[14rem]",children:["Still comparing ",e.length," run",e.length===1?"":"s"," hidden by the current filters:"," ",e.map(o=>qe(o)).join(", ")]}),t.jsx("button",{onClick:a,className:"rounded-md border border-amber-300 px-2.5 py-1 font-medium hover:bg-amber-100 dark:border-amber-800 dark:hover:bg-amber-900/40",children:"Show all selected"}),t.jsx("button",{onClick:n,className:"rounded-md border border-amber-300 px-2.5 py-1 font-medium hover:bg-amber-100 dark:border-amber-800 dark:hover:bg-amber-900/40",children:"Clear hidden"})]})})}function aA({activeView:e,hasPipelineDiagram:s,hasFeatureImportances:r,hasShapSummary:a,hasSegmentation:n,diagramProps:o,importanceProps:i,shapProps:l,segmentationProps:c}){return t.jsxs(t.Fragment,{children:[e==="diagram"&&s&&t.jsx(QI,{...o}),e==="importance"&&r&&t.jsx(RP,{...i}),e==="shap"&&a&&t.jsx(XP,{...l}),e==="segmentation"&&n&&t.jsx(WI,{...c})]})}const nA=ae.lazy(()=>cr(()=>import("./InferencePage-B6M0swMs.js"),__vite__mapDeps([4,2,1,3])).then(e=>({default:e.InferencePage}))),oA=()=>{const{activeView:e,isPropertiesPanelExpanded:s,resultsPanelHeight:r}=be(),a=ae.useRef(null),[n,o]=ae.useState(624);ae.useEffect(()=>{const h=a.current;if(!h)return;const x=new ResizeObserver(([f])=>{f&&f.contentRect.height>0&&o(f.contentRect.height)});return x.observe(h),()=>x.disconnect()},[]);const i=Math.max(200,Math.min(720,Math.floor(n-240))),[l,c]=ae.useState(()=>new Set([e]));ae.useEffect(()=>{c(h=>h.has(e)?h:new Set(h).add(e))},[e]);const d=Or();K3(),X3();const[u,m]=ae.useState(!1);return Xk({onToggleHelp:()=>m(h=>!h),onCloseHelp:()=>m(!1)}),ae.useEffect(()=>{const h=()=>m(!0);return window.addEventListener(Ko,h),()=>window.removeEventListener(Ko,h)},[]),t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden flex-col",children:[t.jsx(G3,{}),t.jsx(OR,{}),t.jsx("div",{style:{display:e==="canvas"?"contents":"none"},children:t.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[!d&&t.jsx(e_,{}),t.jsxs("main",{className:"flex-1 min-w-0 h-full relative flex flex-col transition-all duration-300 ease-in-out",children:[!s&&t.jsx($E,{}),t.jsxs("div",{ref:a,className:"flex-1 min-h-0 relative",style:{"--results-panel-height":`${Math.min(r,i)}px`},children:[t.jsx(s5,{}),t.jsx(HR,{}),t.jsx(iR,{maxHeight:i})]})]}),!d&&t.jsx(_5,{})]})}),t.jsx("div",{style:{display:e==="experiments"?"contents":"none"},children:l.has("experiments")&&t.jsx(sA,{})}),t.jsx("div",{style:{display:e==="inference"?"contents":"none"},children:l.has("inference")&&t.jsx(Gc,{children:t.jsx(ae.Suspense,{fallback:t.jsx(Fh,{}),children:t.jsx(nA,{})})})}),t.jsx(KR,{open:u,onClose:()=>m(!1)}),t.jsx(JR,{})]})},iA=["canvas","experiments","inference"],lA=e=>e!==null&&iA.includes(e),cA={"/errors":"Error Log","/slow-nodes":"Slow Nodes","/jobs":"Jobs","/drift":"Drift","/audit":"Audit Log"},dA=()=>{const e=V(y=>y.addNode),s=V(y=>y.setGraph),r=V(y=>y.selectNode),a=V(y=>y.nodes),[n,o]=Mh(),i=Rt(),l=Oa(),c=p.useRef(!1),d=p.useRef(!1),u=p.useRef(null),[m,h]=p.useState(null),x=be(y=>y.activeView),f=be(y=>y.setView),g=p.useRef(!1),b=p.useRef(!1);return p.useEffect(()=>{const y=n.get("view");lA(y)&&y!==be.getState().activeView&&(b.current=!0,f(y))},[n,f]),p.useEffect(()=>{if(b.current){b.current=!1;return}const y=be.getState().activeView;if(n.get("view")===y){g.current=!0;return}const v=new URLSearchParams(n);v.set("view",y),o(v,{replace:!g.current}),g.current=!0},[x]),p.useEffect(()=>{const y=i.state,v=y==null?void 0:y.restoreVersion;if(!v||d.current)return;d.current=!0;const j=v.graph;if(j&&Array.isArray(j.nodes)&&Array.isArray(j.edges)){s(j.nodes,j.edges),c.current=!0;const w=new URLSearchParams(n);w.delete("source_id"),o(w,{replace:!0}),l(i.pathname+i.search,{replace:!0,state:null}),le.success(`Restored "${v.name}"`,`Version v${v.versionInt}`)}else le.error("Restore failed","Snapshot graph is not in a recognised shape.")},[i,l,s,n,o]),p.useEffect(()=>{const y=n.get("source_id");if(y){if(c.current)return;if(a.some(w=>{var N;return w.type==="dataset_node"&&((N=w.data)==null?void 0:N.datasetId)===y})){const w=new URLSearchParams(n);w.delete("source_id"),o(w,{replace:!0});return}c.current=!0,e("dataset_node",{x:100,y:100},{datasetId:y});const j=new URLSearchParams(n);j.delete("source_id"),o(j,{replace:!0})}},[n,e,a,o]),p.useEffect(()=>{const y=Bh(n);if(!y||y.ref.kind!=="node")return;const v=n.toString();if(u.current===v)return;u.current=v;const{nodeId:j,pipelineId:w}=y.ref;if(r(j)){h(null),window.dispatchEvent(new CustomEvent(Ir,{detail:{id:j,focusWrapper:!0}}));return}h(w!==void 0?{kind:"different-pipeline",nodeId:j,pipelineId:w,...y.origin?{origin:y.origin}:{}}:{kind:"not-found",nodeId:j,...y.origin?{origin:y.origin}:{}})},[n,r]),t.jsxs("div",{className:"relative h-full w-full",children:[m&&t.jsx("div",{className:"absolute top-4 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 px-4",children:t.jsxs("div",{className:"relative rounded-lg border border-amber-300 bg-white shadow-lg dark:border-amber-700 dark:bg-slate-800",children:[t.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Dismiss",className:"absolute right-2 top-2 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700",children:t.jsx(Ee,{className:"h-4 w-4","aria-hidden":"true"})}),t.jsx(sr,{error:m.kind==="different-pipeline"?`Node ${m.nodeId} belongs to pipeline ${m.pipelineId}, which isn't the pipeline currently open on this canvas. Load that pipeline's version from Data Sources to inspect it, or return to where you came from to re-run the investigation.`:`Node ${m.nodeId} could not be found on this canvas. It may have been removed or renamed.`}),m.origin&&t.jsx("div",{className:"border-t border-slate-100 px-4 pb-4 pt-2 text-center dark:border-slate-700",children:t.jsxs(ls,{to:m.origin,className:"text-sm font-medium text-blue-600 hover:underline dark:text-blue-400",children:["Back to ",cA[m.origin]??m.origin]})})]})}),t.jsx(oA,{})]})},_f=[{task:"classification",label:"Classification",icon:t.jsx(Gp,{size:16})},{task:"regression",label:"Regression",icon:t.jsx(jc,{size:16})},{task:"text_classification",label:"Text Classification",icon:t.jsx(Dr,{size:16})},{task:"segmentation",label:"Segmentation",icon:t.jsx(zn,{size:16})},{task:"ensemble",label:"Ensemble",icon:t.jsx(Ln,{size:16})}],uA=_f.map(e=>e.task),Qr=e=>uA.includes(e),mA=()=>{const e=Oa(),[s]=Mh(),[r,a]=p.useState("classification"),[n,o]=p.useState([]),[i,l]=p.useState(!0),[c,d]=p.useState(""),[u,m]=p.useState("all"),[h,x]=p.useState(!1),[f,g]=p.useState("all"),b=25,[y,v]=p.useState([]),[j,w]=p.useState(!0),N=p.useRef(0),k=p.useRef(!1),[_,R]=p.useState([]),[M,E]=p.useState(0),[T,S]=p.useState(!0),[P,I]=p.useState({eda:{data:[],skip:0,hasMore:!0},ingestion:{data:[],skip:0,hasMore:!0}}),A=p.useMemo(()=>Bh(s),[s]),B=(A==null?void 0:A.ref.kind)==="job"?A.ref.jobId:null,F=p.useRef(null);p.useEffect(()=>{if(!(A!=null&&A.filters)||F.current===B)return;F.current=B;const ee=A.filters;ee.tab&&a(ee.tab),ee.q!==void 0&&d(ee.q),ee.status&&m(ee.status),ee.ensemble&&g(ee.ensemble)},[A,B]);const[z,L]=p.useState(null),[K,re]=p.useState(!1),[de,O]=p.useState(null),q=B?[...y,..._,...P.eda.data,...P.ingestion.data].find(ee=>ee.job_id===B):void 0;p.useEffect(()=>{if(!B||q){L(null),O(null);return}let ee=!1;return re(!0),O(null),Re.getJob(B).then(Y=>{ee||L(Y)}).catch(()=>{ee||O("This job could not be found. It may have been removed.")}).finally(()=>{ee||re(!1)}),()=>{ee=!0}},[B,!!q]);const D=q??z??null,G=()=>({tab:r,q:c,status:u,...r==="ensemble"?{ensemble:f}:{}}),J=()=>{e("/jobs",{replace:!0})};p.useEffect(()=>{let ee=!1;return zr.getAllNodes().then(Y=>{ee||o(Y)}).catch(Y=>{console.error("Failed to fetch node registry:",Y)}),()=>{ee=!0}},[]);const X=async(ee=!1)=>{if(!k.current){k.current=!0,ee&&(l(!0),v([]),N.current=0,w(!0));try{const Y=ee?0:N.current,U=await Re.getJobs(b,Y);U.sort((fe,Xe)=>new Date(Xe.created_at).getTime()-new Date(fe.created_at).getTime());const pe=U.length>=b;w(pe),v(fe=>{if(ee)return U;const Xe=new Set(fe.map(ut=>ut.job_id)),dt=U.filter(ut=>!Xe.has(ut.job_id));return[...fe,...dt]}),N.current=Y+b}catch(Y){console.error("Failed to fetch jobs:",Y)}finally{l(!1),k.current=!1}}},oe=async(ee=!1)=>{ee&&(l(!0),R([]),E(0),S(!0));try{const Y=ee?0:M;let U=[];r==="eda"?U=await Re.getEDAJobs(b):r==="ingestion"&&(U=await Re.getIngestionJobs(b,Y)),U.sort((fe,Xe)=>new Date(Xe.created_at).getTime()-new Date(fe.created_at).getTime());const pe=U.length>=b;pe||S(!1),ee?(R(U),I(fe=>({...fe,[r]:{data:U,skip:Y+b,hasMore:pe}}))):R(fe=>{const Xe=[...fe,...U];return I(dt=>({...dt,[r]:{data:Xe,skip:Y+b,hasMore:pe}})),Xe}),E(Y+b)}catch(Y){console.error("Failed to fetch jobs:",Y)}finally{l(!1)}};p.useEffect(()=>{if(Qr(r)){y.length===0?X(!0):l(!1);return}const ee=P[r];ee.data.length>0?(R(ee.data),E(ee.skip),S(ee.hasMore),l(!1)):oe(!0)},[r]);const ve=5,[H,W]=p.useState(0);p.useEffect(()=>{W(0)},[r]),p.useEffect(()=>{r!=="ensemble"&&g("all")},[r]),p.useEffect(()=>{if(!Qr(r)||i||!j||H>=ve)return;y.filter(Y=>kt(Y.model_type,n)===r).lengthY+1),X(!1))},[r,y,j,i,n]);const ue=()=>{Qr(r)?X(!1):oe(!1)},je=Qr(r)?y.filter(ee=>kt(ee.model_type,n)===r).filter(ee=>r!=="ensemble"||f==="all"||Kn(ee.model_type)===f):_,Ye=Qr(r)?j:T,we=je.filter(ee=>{if(u!=="all"&&ee.status.toLowerCase()!==u)return!1;if(c){const Y=c.toLowerCase();return ee.job_id.toLowerCase().includes(Y)||ee.model_type&&ee.model_type.toLowerCase().includes(Y)||ee.dataset_name&&ee.dataset_name.toLowerCase().includes(Y)}return!0});return B?t.jsx(hA,{selectedJob:D,fallbackLoading:K,fallbackError:de,handleBackFromDetails:J,listFilterSnapshot:G}):t.jsxs("div",{className:"p-8 space-y-6 animate-in fade-in duration-500",children:[t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-slate-900 dark:text-slate-100",children:"Jobs"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Monitor and manage all your pipeline activities"})]}),t.jsxs("button",{onClick:()=>Qr(r)?X(!0):oe(!0),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-700 dark:text-slate-300",children:[t.jsx(us,{size:16}),"Refresh"]})]}),t.jsx(xA,{activeTab:r,setActiveTab:a,searchTerm:c,setSearchTerm:d,statusFilter:u,setStatusFilter:m,showFilters:h,setShowFilters:x,ensembleSubFilter:f,setEnsembleSubFilter:g,visibleJobs:je}),t.jsx(gA,{loading:i,filteredJobs:we,registryItems:n,listFilterSnapshot:G,visibleHasMore:Ye,handleLoadMore:ue})]})},fl=({active:e,onClick:s,icon:r,label:a})=>t.jsxs("button",{onClick:s,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all whitespace-nowrap ${e?"bg-indigo-600 text-white shadow-sm":"text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-700"}`,children:[r,a]}),pA=({status:e})=>{const s={succeeded:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",completed:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",failed:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",running:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",queued:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400"},r={succeeded:t.jsx(Ut,{size:14}),completed:t.jsx(Ut,{size:14}),failed:t.jsx(ir,{size:14}),running:t.jsx(at,{size:14,className:"animate-pulse"}),pending:t.jsx(_t,{size:14}),queued:t.jsx(_t,{size:14})},a=e.toLowerCase(),n=s[a]||"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400",o=r[a]||t.jsx(_t,{size:14});return t.jsxs("span",{className:`px-2.5 py-1 inline-flex items-center gap-1.5 text-xs font-medium rounded-full ${n}`,children:[o,e.charAt(0).toUpperCase()+e.slice(1)]})};function hA({selectedJob:e,fallbackLoading:s,fallbackError:r,handleBackFromDetails:a,listFilterSnapshot:n}){return t.jsx("div",{className:"p-8 animate-in fade-in duration-500",children:t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm h-[calc(100vh-8rem)] overflow-hidden",children:e?t.jsx(mf,{job:e,onBack:a,onClose:a,origin:"/jobs",filters:n()}):s?t.jsx(Rs,{message:"Loading job details..."}):t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(sr,{error:r??"This job could not be found."}),t.jsx("div",{className:"flex justify-center",children:t.jsx("button",{onClick:a,className:"text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 font-medium px-4 py-2 rounded-md hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-colors",children:"Back to Jobs"})})]})})})}function xA({activeTab:e,setActiveTab:s,searchTerm:r,setSearchTerm:a,statusFilter:n,setStatusFilter:o,showFilters:i,setShowFilters:l,ensembleSubFilter:c,setEnsembleSubFilter:d,visibleJobs:u}){const m=n!=="all"?1:0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4 bg-white dark:bg-slate-800 p-4 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsxs("div",{className:"flex gap-2 overflow-x-auto w-full md:w-auto pb-2 md:pb-0",children:[_f.map(({task:h,label:x,icon:f})=>t.jsx(fl,{active:e===h,onClick:()=>s(h),icon:f,label:x},h)),t.jsx(fl,{active:e==="eda",onClick:()=>s("eda"),icon:t.jsx(Fn,{size:16}),label:"EDA"}),t.jsx(fl,{active:e==="ingestion",onClick:()=>s("ingestion"),icon:t.jsx(Ct,{size:16}),label:"Ingestion"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative w-full md:w-56",children:[t.jsx(lr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none z-10",size:16}),t.jsx("input",{type:"text",placeholder:"Search jobs...",value:r,onChange:h=>a(h.target.value),className:"w-full pl-8 pr-4 py-2 text-sm bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:text-slate-100"})]}),t.jsxs("button",{onClick:()=>l(!i),className:`flex items-center gap-1.5 px-3 py-2 text-sm rounded-md border transition-colors ${i||n!=="all"?"bg-indigo-50 dark:bg-indigo-900/20 border-indigo-200 dark:border-indigo-800 text-indigo-700 dark:text-indigo-300":"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"}`,children:[t.jsx(On,{size:14}),"Filters",m>0&&t.jsx("span",{className:"ml-0.5 w-5 h-5 flex items-center justify-center rounded-full bg-indigo-600 text-white text-xs",children:m})]}),(r||n!=="all")&&t.jsx("button",{onClick:()=>{a(""),o("all")},className:"text-xs text-indigo-600 dark:text-indigo-400 hover:underline whitespace-nowrap",children:"Clear all"})]})]}),e==="ensemble"&&t.jsx("div",{className:"flex items-center gap-1.5 px-4 py-2 bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:["all","classification","regression"].map(h=>t.jsx("button",{onClick:()=>d(h),className:`px-2.5 py-1 text-xs rounded-full border transition-colors capitalize ${c===h?"bg-indigo-50 dark:bg-indigo-900/20 border-indigo-200 dark:border-indigo-800 text-indigo-700 dark:text-indigo-300":"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"}`,children:h},h))}),i&&t.jsxs("div",{className:"flex items-center gap-4 px-4 py-3 bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Status"}),t.jsxs("select",{value:n,onChange:h=>o(h.target.value),className:"px-2.5 py-1.5 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-900 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:[t.jsx("option",{value:"all",children:"All statuses"}),[...new Set(u.map(h=>h.status.toLowerCase()))].sort().map(h=>t.jsx("option",{value:h,children:h.charAt(0).toUpperCase()+h.slice(1)},h))]})]})]})}function gA({loading:e,filteredJobs:s,registryItems:r,listFilterSnapshot:a,visibleHasMore:n,handleLoadMore:o}){return t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden",children:[e?t.jsx(Rs,{message:"Loading jobs..."}):s.length===0?t.jsx(os,{title:"No jobs found matching your criteria."}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[t.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Job ID"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Type"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Details"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Duration"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:s.map(i=>t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx(pA,{status:i.status})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-slate-100",children:t.jsx("span",{className:"font-mono text-xs bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded",title:i.job_id,children:i.job_id.substring(0,8)})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:tT(i,r)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:i.model_type||i.dataset_name||i.target_column||"-"}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400 font-mono",children:Wo(i.start_time,i.end_time)}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:[new Date(i.created_at).toLocaleDateString()," ",t.jsx("span",{className:"text-xs opacity-70",children:new Date(i.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:t.jsx(rr,{recordRef:{kind:"job",jobId:i.job_id},origin:"/jobs",filters:a(),label:"View details"})})]},i.job_id))})]})}),!e&&n&&s.length>0&&t.jsx("div",{className:"p-4 border-t border-slate-200 dark:border-slate-700 flex justify-center",children:t.jsx("button",{onClick:o,className:"text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 font-medium flex items-center gap-1 px-4 py-2 rounded-md hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-colors",children:"Load More"})})]})}const fA=[{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"},{label:"All",value:"all"}];function Wm(e){if(e==="all")return;const s={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5}[e];return new Date(Date.now()-s).toISOString()}const bA={critical:"error",warning:"warning",info:"info"},Ai={critical:"Critical",warning:"Warning",info:"Info"};function Sd(e){return e==="critical"?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e==="warning"?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-slate-100 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}function yA(e){const s=["id","severity","status_code","error_type","message","route","job_id","created_at"],r=i=>`"${String(i??"").replace(/"/g,'""')}"`,a=[s.join(","),...e.map(i=>[i.id,i.severity,i.status_code,i.error_type,i.message,i.route,i.job_id??"",i.created_at].map(r).join(","))],n=new Blob([a.join(` +`),ve=K>=.8?"text-green-600 dark:text-green-400":K>=.6?"text-yellow-600 dark:text-yellow-400":"text-red-500 dark:text-red-400";return t.jsxs("div",{className:`flex flex-col items-center p-2 rounded-lg border ${re?"border-blue-400 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700"}`,children:[t.jsxs("span",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300 mb-1.5 w-full text-center truncate",title:`${String(S)} vs Rest`,children:[String(S)," vs Rest"]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex mb-0.5 gap-0.5",style:{marginLeft:"60px"},children:[t.jsx("span",{className:"w-14 text-center text-[9px] text-gray-500 dark:text-gray-400 truncate font-medium",title:String(S),children:String(S)}),t.jsx("span",{className:"w-14 text-center text-[9px] text-gray-500 dark:text-gray-400 truncate font-medium",title:de.map(String).join(", "),children:O})]}),[[I,B],[A,F]].map((H,W)=>t.jsxs("div",{className:"flex items-center gap-0.5 mb-0.5",children:[t.jsx("span",{className:"text-right text-[9px] text-gray-500 dark:text-gray-400 pr-1 truncate font-medium",style:{width:"60px"},title:q[W],children:q[W]}),H.map((ue,je)=>{var Y,U;const Ye=W===je,we=Math.max(...H,1),ee=Ye?`rgba(34,197,94,${Math.min(ue/we*.75+.1,.85)})`:`rgba(239,68,68,${Math.min(ue/we*.65+.05,.75)})`;return t.jsxs("div",{className:"w-14 h-11 flex flex-col items-center justify-center rounded border border-gray-100 dark:border-gray-700 cursor-default",style:{backgroundColor:ee},title:`${((Y=D[W])==null?void 0:Y[je])??""}=${ue}`,children:[t.jsx("span",{className:"text-[11px] font-mono font-bold leading-none",children:ue}),t.jsx("span",{className:"text-[9px] font-semibold opacity-80 mt-0.5",children:(U=D[W])==null?void 0:U[je]})]},je)})]},W))]}),t.jsx("div",{className:"mt-1.5 grid grid-cols-3 gap-1 text-[10px] w-full",children:[{l:"Prec",v:z},{l:"Rec",v:L},{l:"F1",v:K}].map(({l:H,v:W})=>t.jsxs("div",{className:"flex flex-col items-center bg-gray-50 dark:bg-gray-900 rounded py-1",children:[t.jsx("span",{className:"text-gray-400",children:H}),t.jsx("span",{className:`font-mono font-semibold ${W>=.8?"text-green-500":W>=.6?"text-yellow-500":"text-red-500"}`,children:W.toFixed(2)})]},H))}),t.jsxs("div",{className:`mt-1.5 flex items-center justify-center gap-0.5 ${ve}`,children:[t.jsx("p",{className:"text-[9px] leading-snug text-center",children:X}),t.jsx(me,{text:oe,size:"sm"})]})]},String(S))})})]})},{trainEntry:f,testEntry:g,valEntry:b}=PI(e.splits,a,n,o),v=(((k=(N=e.splits.train)==null?void 0:N.y_proba)==null?void 0:k.classes.length)??0)===2?h:x;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[f&&v(f[0],f[1]),g&&v(g[0],g[1]),!f&&!g&&t.jsx("p",{className:"col-span-2 text-xs text-gray-400 text-center py-8",children:"Enable Train or Test splits above to compare."})]}),b&&t.jsx("div",{className:"mt-6 pt-4 border-t border-gray-100 dark:border-gray-700",children:v(b[0],b[1])})]})};function AI({evaluationData:e,activeTab:s,cmView:r}){var a,n;return e.problem_type==="regression"||s==="slider"&&(r==="overall"||((n=(a=e.splits.train)==null?void 0:a.y_proba)==null?void 0:n.classes.length)===2)}function $I({evaluationData:e,showTrainMetrics:s,showTestMetrics:r,showValMetrics:a},n){return Object.entries(e.splits).filter(([o])=>e.problem_type==="regression"?o===n:!(o==="train"&&!s||o==="test"&&!r||o==="validation"&&!a))}function FI(e){const{evaluationData:s,activeTab:r,cmView:a,activeRegressionSplit:n,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tuningPreview:x}=e;return t.jsxs(t.Fragment,{children:[AI(e)&&t.jsx("div",{className:"flex flex-col gap-6",children:$I(e,n).map(([f,g])=>t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[s.problem_type!=="regression"&&t.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-4 capitalize",children:[f," Set"]}),s.problem_type==="regression"?t.jsx(EI,{splitName:f,splitData:g,handleDownload:u,downloadingChart:m,doneChart:h}):t.jsx(MI,{splitName:f,splitData:g,selectedRocClass:o,threshold:i,handleDownload:u,downloadingChart:m,doneChart:h})]},f))}),r==="slider"&&s.problem_type==="classification"&&a==="per-class"&&t.jsx(Um,{evaluationData:s,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tunedThresholds:null,useTunedThresholds:!1}),r==="tuning"&&s.problem_type==="classification"&&(x?t.jsx(Um,{evaluationData:s,selectedRocClass:o,threshold:i,showTrainMetrics:l,showTestMetrics:c,showValMetrics:d,handleDownload:u,downloadingChart:m,doneChart:h,tunedThresholds:x.thresholds,useTunedThresholds:!0}):t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 italic text-center py-8 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:"Click Preview above to see tuned thresholds applied to your confusion matrix."}))]})}function DI(e){const{evalError:s,evaluationData:r,isEvalLoading:a,fetchEvaluationData:n,evalJobId:o,eligibleJobIds:i}=e,l=o??i[0]??null;return s?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(sr,{error:s,onRetry:l?()=>n(l):void 0})}):r?r.problem_type==="clustering"?t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"This is a Segmentation (clustering) run."}),t.jsx("p",{className:"text-xs mt-2 opacity-70",children:'See the "Segmentation" tab for cluster sizes, centroids, and quality metrics.'})]}):t.jsx(LI,{...e,evaluationData:r}):a?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(Rs,{message:"Loading evaluation data..."})}):t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"Select a completed job to view evaluation details."}),t.jsx("p",{className:"text-xs mt-2 opacity-70",children:"(Note: Only jobs run after this update have evaluation artifacts)"})]})}function LI(e){const{evaluationData:s,isEvalLoading:r,activeTab:a}=e;return t.jsxs("div",{className:`space-y-6 transition-opacity ${r?"opacity-60":""}`,children:[r&&t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 italic",children:"Loading evaluation data…"}),t.jsx(pI,{...e}),s.problem_type==="classification"&&t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic px-1",children:a==="slider"?"Manually explore how a single threshold changes predictions β€” nothing here is saved or used for real predictions.":"Let the optimizer find the best per-class threshold(s) for a metric you choose, preview its effect, then save it to actually change how this model predicts."}),a==="tuning"&&s.problem_type==="classification"&&t.jsx(fI,{...e}),t.jsx(FI,{...e})]})}const OI=e=>{const s=lI(),r=cI(e);return t.jsxs("div",{className:"space-y-6",children:[t.jsx(dI,{...e,eligibleRunLabels:r.eligibleRunLabels}),t.jsx(DI,{...e,...r,...s})]})},Yr=["#8884d8","#82ca9d","#ffc658","#ff7300","#0088fe","#00C49F","#ff6b6b","#4ecdc4"],zI={silhouette_score:"Silhouette Score",calinski_harabasz_score:"Calinski-Harabasz Score",davies_bouldin_score:"Davies-Bouldin Score"};function BI({isEvalLoading:e,currentSplit:s,clustering:r,currentSplitName:a,splitTabs:n,setActiveSplit:o,clusterSizeChartData:i,clusterSizeTableRows:l,metricTableRows:c,chartTheme:d,handleDownload:u,downloadingChart:m,doneChart:h}){return t.jsxs("div",{className:`space-y-6 transition-opacity ${e?"opacity-60":""}`,children:[n.length>1&&t.jsxs("div",{className:"flex items-center gap-0.5",children:[t.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide mr-1",children:"Split:"}),n.map(x=>t.jsx("button",{onClick:()=>{o(x)},className:`px-3 py-1 text-xs font-medium rounded ${a===x?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:x==="validation"?"Validation":x.charAt(0).toUpperCase()+x.slice(1)},x))]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[t.jsx("h4",{className:"text-xs font-semibold text-purple-900 dark:text-purple-100 mb-1",children:"Clusters Found"}),t.jsx("p",{className:"text-2xl font-bold text-purple-700 dark:text-purple-300",children:r.n_clusters})]}),["silhouette_score","calinski_harabasz_score","davies_bouldin_score"].map(x=>{var g;const f=(g=s.metrics)==null?void 0:g[x];return t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between gap-1 mb-1",children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400",children:zI[x]}),t.jsx(Ii,{direction:Er(x)})]}),t.jsx("p",{className:"text-2xl font-bold text-gray-800 dark:text-gray-100",children:typeof f=="number"?f.toFixed(3):"not reported"})]},x)})]}),t.jsx(ti,{columns:[{key:"metric",label:"Metric"},{key:"value",label:"Value"},{key:"direction",label:"Direction"}],rows:c,filename:`segmentation_metrics_${a??"split"}`,caption:"Cluster quality metrics with direction (higher/lower is better) for this run and split"}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-6 relative group",id:"segmentation-cluster-sizes-chart",children:[t.jsx("div",{className:"absolute top-4 right-4 z-10 opacity-0 group-hover:opacity-100 transition-opacity","data-export-ignore":"true",children:t.jsx("button",{onClick:()=>void u("segmentation-cluster-sizes-chart","segmentation_cluster_sizes"),disabled:m==="segmentation-cluster-sizes-chart",className:"p-1.5 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded shadow-sm text-gray-500 hover:text-blue-600 disabled:opacity-50",title:"Download Graph",children:m==="segmentation-cluster-sizes-chart"?t.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"}):h==="segmentation-cluster-sizes-chart"?t.jsx(Ie,{className:"w-3.5 h-3.5 text-green-500"}):t.jsx(Ae,{className:"w-3.5 h-3.5"})})}),t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-4",children:"Cluster Sizes"}),t.jsx("div",{className:"h-[300px]",children:t.jsx($e,{width:"100%",height:"100%",children:t.jsxs(Jt,{data:i,margin:{top:5,right:20,bottom:5,left:0},children:[t.jsx(Ue,{strokeDasharray:"3 3",opacity:.1,stroke:d.gridColor}),t.jsx(Oe,{dataKey:"cluster",tick:{fontSize:12,fill:d.axisColor}}),t.jsx(ze,{tick:{fontSize:12,fill:d.axisColor}}),t.jsx(Fe,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),t.jsx(lt,{dataKey:"size",radius:[4,4,0,0],children:i.map(x=>t.jsx(wa,{fill:Yr[x.clusterId%Yr.length]},x.clusterId))})]})})}),t.jsx(ti,{columns:[{key:"cluster",label:"Cluster"},{key:"size",label:"Size (rows)"}],rows:l,filename:`segmentation_cluster_sizes_${a??"split"}`,caption:"Cluster size data, as an alternative to the bar chart above"})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Cluster Profiles (Centroids)"}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.centroids.map(x=>t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[t.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:Yr[x.cluster_id%Yr.length]}}),"Cluster ",x.cluster_id]}),t.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[x.percentage.toFixed(1),"% (",x.size,")"]})]}),t.jsxs("div",{className:"space-y-1",children:[Object.entries(x.center).sort(([,f],[,g])=>Math.abs(g)-Math.abs(f)).slice(0,5).map(([f,g])=>t.jsxs("div",{className:"flex justify-between text-xs",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:f,children:f}),t.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:g.toFixed(2)})]},f)),Object.keys(x.center).length>5&&t.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(x.center).length-5," more features"]})]}),x.profile&&t.jsx("div",{className:"mt-2 pt-2 border-t border-gray-100 dark:border-gray-700 text-xs text-gray-500 dark:text-gray-400 italic",children:x.profile})]},x.cluster_id))})]}),r.reference_crosstab&&r.reference_column&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Reference Column Breakdown (",r.reference_column,")"]}),t.jsx(me,{text:`How rows are distributed across "${r.reference_column}" within each cluster. This column was excluded from training β€” it's shown here only to help you interpret which cluster corresponds to which real-world group.`,align:"center"})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(r.reference_crosstab).sort(([x],[f])=>Number(x)-Number(f)).map(([x,f])=>{const g=Object.values(f).reduce((y,v)=>y+v,0),b=Object.entries(f).sort(([,y],[,v])=>v-y);return t.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center mb-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:Yr[Number(x)%Yr.length]}}),t.jsxs("span",{className:"font-bold text-gray-900 dark:text-white",children:["Cluster ",x]})]}),t.jsx("div",{className:"space-y-1",children:b.map(([y,v])=>t.jsxs("div",{className:"flex justify-between text-xs",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:y,children:y}),t.jsxs("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:[v," (",g?(v/g*100).toFixed(0):0,"%)"]})]},y))})]},x)})})]})]})}function VI({evalError:e,evaluationData:s,isEvalLoading:r,retryJobId:a,fetchEvaluationData:n,hasSummary:o,children:i}){return t.jsx(t.Fragment,{children:e?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(sr,{error:e,onRetry:a?()=>n(a):void 0})}):s?s.problem_type!=="clustering"?t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"The selected run is not a Segmentation (clustering) job."}),t.jsx("p",{className:"text-xs mt-1 not-italic",children:"See the availability list above for which selected runs do support clustering."})]}):o?i:t.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:[t.jsx("p",{children:"No cluster summary available for this run."}),t.jsx("p",{className:"text-xs mt-1 not-italic",children:"This run supports clustering but hasn't produced a summary yet β€” see the availability list above for details."})]}):r?t.jsx("div",{className:"h-64 flex items-center justify-center",children:t.jsx(Rs,{message:"Loading segmentation data..."})}):t.jsx("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400 italic text-center",children:t.jsx("p",{children:"Select a completed Segmentation run to view cluster details."})})})}function UI(e,s){return e&&e.problem_type==="clustering"&&s?e.splits[s]??null:null}const HI={silhouette_score:"Silhouette Score",calinski_harabasz_score:"Calinski-Harabasz Score",davies_bouldin_score:"Davies-Bouldin Score"},WI=({selectedJobIds:e,coverageEntries:s,evalJobId:r,fetchEvaluationData:a,isEvalLoading:n,evalError:o,evaluationData:i,handleDownload:l,downloadingChart:c,doneChart:d})=>{const u=hs(),m=p.useMemo(()=>!i||i.problem_type!=="clustering"?[]:["train","test","validation"].filter(w=>i.splits[w]!=null),[i]),[h,x]=ae.useState(null),f=h&&m.includes(h)?h:m[0]??null,g=UI(i,f),b=p.useMemo(()=>g!=null&&g.clustering?Object.entries(g.clustering.cluster_sizes).sort(([w],[N])=>Number(w)-Number(N)).map(([w,N])=>({cluster:`Cluster ${w}`,size:N,clusterId:Number(w)})):[],[g]),y=p.useMemo(()=>b.map(w=>({cluster:w.cluster,size:w.size})),[b]),v=p.useMemo(()=>g?["silhouette_score","calinski_harabasz_score","davies_bouldin_score"].map(w=>{var _;const N=(_=g.metrics)==null?void 0:_[w],k=Er(w);return{metric:HI[w]??w,value:typeof N=="number"?Number(N.toFixed(4)):"not reported",direction:k==="higher"?"Higher is better":k==="lower"?"Lower is better":"Direction unknown"}}):[],[g]),j=r??e[0]??null;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(zn,{className:"w-5 h-5 text-purple-500"}),"Segmentation"]}),t.jsx(me,{text:"Cluster quality metrics, sizes, per-cluster centroids (mean feature values), and an auto-generated characteristic profile for this run. There is no ground truth here β€” these metrics describe how well-separated the discovered groups are, not prediction accuracy. If you set a Reference Column, its breakdown per cluster is shown below to help you interpret what each cluster represents.",align:"center"})]}),t.jsx(_d,{entries:s}),e.length>1&&t.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",role:"tablist","aria-label":"Select run for segmentation",children:e.map(w=>{const N=r===w;return t.jsx("button",{type:"button",role:"tab","aria-selected":N,onClick:()=>{a(w)},className:`px-3 py-1 text-xs font-mono rounded border whitespace-nowrap focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 ${N?"bg-blue-100 border-blue-300 text-blue-700 dark:bg-blue-900/30 dark:border-blue-700 dark:text-blue-300":"bg-white border-gray-200 text-gray-600 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700"}`,children:w.slice(0,8)},w)})}),t.jsx(VI,{evalError:o,evaluationData:i,isEvalLoading:n,retryJobId:j,fetchEvaluationData:a,hasSummary:!!(g!=null&&g.clustering),children:(g==null?void 0:g.clustering)&&t.jsx(BI,{isEvalLoading:n,currentSplit:g,clustering:g.clustering,currentSplitName:f,splitTabs:m,setActiveSplit:x,clusterSizeChartData:b,clusterSizeTableRows:y,metricTableRows:v,chartTheme:u,handleDownload:l,downloadingChart:c,doneChart:d})})]})};let gl=null;function GI(){return gl||(gl=cr(()=>import("./mermaid.core-Bh6LVe7i.js").then(e=>e.bj),__vite__mapDeps([0,1,2,3])).then(e=>{const s=e.default,r=typeof document<"u"&&document.documentElement.classList.contains("dark");return s.initialize({startOnLoad:!1,securityLevel:"strict",theme:r?"dark":"default"}),s})),gl}function qI(e){return new DOMParser().parseFromString(e,"text/html").querySelector("svg")}let KI=0;const JI=({chart:e,className:s})=>{const r=p.useRef(null),a=p.useRef(null);return p.useEffect(()=>{let n=!1;const o=`skyulf-mermaid-${++KI}`,i=(l,c=!1)=>{const d=a.current;d&&(d.textContent=l??"",d.classList.toggle("!text-red-500",c),d.classList.toggle("dark:!text-red-400",c))};return i("Rendering diagram…"),GI().then(async l=>{const{svg:c}=await l.render(o,e);if(n||!r.current)return;const d=qI(c);if(!d)throw new Error("mermaid produced no SVG output");r.current.replaceChildren(d),i(null)}).catch(l=>{n||i(`Failed to render pipeline diagram: ${l instanceof Error?l.message:"unknown error"}`,!0)}),()=>{n=!0}},[e]),t.jsxs("div",{className:s,children:[t.jsx("div",{ref:a,className:"text-sm text-gray-400 dark:text-gray-500 p-4 empty:hidden",role:"status"}),t.jsx("div",{ref:r,className:"flex justify-center overflow-x-auto [&>svg]:max-w-full [&>svg]:h-auto"})]})};function Hm(e){var a;const r=(e.metrics??((a=e.result)==null?void 0:a.metrics)??{}).pipeline_diagram;return typeof r=="string"&&r.length>0?r:null}const YI=({diagram:e})=>{const[s,r]=ae.useState("idle"),a=ae.useRef(null);ae.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);const n=async()=>{try{await navigator.clipboard.writeText("```mermaid\n"+e+"\n```\n"),r("copied")}catch{r("error")}a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>r("idle"),2e3)};return t.jsx("button",{type:"button",onClick:n,"data-testid":"copy-mermaid-button",className:"text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:s==="copied"?"Copied!":s==="error"?"Copy failed":"Copy mermaid"})},QI=({jobs:e})=>{const s=e.filter(r=>Hm(r)!==null);return s.length===0?t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8 text-center text-gray-500 dark:text-gray-400",children:"None of the selected runs carry a pipeline diagram yet. Diagrams are recorded automatically for runs completed after this feature shipped."}):t.jsx("div",{className:`grid gap-6 ${s.length>1?"grid-cols-1 xl:grid-cols-2":"grid-cols-1"}`,"data-testid":"pipeline-diagram-view",children:e.map(r=>{const a=Hm(r);return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[t.jsxs("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:["Run ",qe(r)]}),t.jsxs("div",{className:"flex items-center gap-3",children:[a&&t.jsx(YI,{diagram:a}),r.model_type&&t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:r.model_type})]})]}),a?t.jsx(JI,{chart:a,className:"p-4"}):t.jsx("div",{className:"p-6 text-sm text-gray-400 dark:text-gray-500",children:"No diagram recorded for this run (legacy job)."})]},r.job_id)})})},XI=({datasets:e,selectedDatasetId:s,setSelectedDatasetId:r,filterType:a,setFilterType:n})=>t.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-4 flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-gray-100",children:"Experiments & Comparison"}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Compare metrics and parameters across multiple runs"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("select",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5",value:s,onChange:o=>{r(o.target.value)},children:[t.jsx("option",{value:"all",children:"All Datasets"}),e.map(o=>t.jsx("option",{value:o.id,children:o.name},o.id))]}),t.jsxs("select",{className:"bg-gray-50 dark:bg-gray-900 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5",value:a,onChange:o=>{n(o.target.value)},children:[t.jsx("option",{value:"all",children:"All Experiments"}),t.jsx("option",{value:"classification",children:"Classification"}),t.jsx("option",{value:"regression",children:"Regression"}),t.jsx("option",{value:"text_classification",children:"Text Classification"}),t.jsx("option",{value:"segmentation",children:"Segmentation"}),t.jsx("option",{value:"ensemble",children:"Ensemble"})]})]})]}),ZI="px-4 py-2 text-sm font-medium border-b-2 transition-colors",zs=e=>`${ZI} ${e?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,eA=({activeView:e,setActiveView:s,hasFeatureImportances:r,hasShapSummary:a,hasSegmentation:n,hasPipelineDiagram:o})=>t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[t.jsx("button",{className:zs(e==="charts"),onClick:()=>{s("charts")},children:"Visual Comparison"}),t.jsx("button",{className:zs(e==="table"),onClick:()=>{s("table")},children:"Detailed Metrics & Params"}),t.jsx("button",{className:zs(e==="evaluation"),onClick:()=>{s("evaluation")},children:"Model Evaluation"}),t.jsx("button",{className:zs(e==="diff"),onClick:()=>{s("diff")},"data-testid":"experiments-tab-diff",children:"Pipeline Diff"}),o&&t.jsx("button",{className:zs(e==="diagram"),onClick:()=>{s("diagram")},"data-testid":"experiments-tab-diagram",children:"Pipeline Diagram"}),r&&t.jsx("button",{className:zs(e==="importance"),onClick:()=>{s("importance")},children:"Feature Importance"}),a&&t.jsx("button",{className:zs(e==="shap"),onClick:()=>{s("shap")},children:"SHAP Explainability"}),n&&t.jsx("button",{className:zs(e==="segmentation"),onClick:()=>{s("segmentation")},"data-testid":"experiments-tab-segmentation",children:"Segmentation"})]}),tA=e=>e==="best_score"?{type:"val",base:"best_score"}:e.startsWith("train_")?{type:"train",base:e.replace("train_","")}:e.startsWith("test_")?{type:"test",base:e.replace("test_","")}:e.startsWith("val_")?{type:"val",base:e.replace("val_","")}:{type:"other",base:e},sA=()=>{const{jobs:e,fetchJobs:s,hasMore:r,loadMoreJobs:a,isLoading:n,promoteJob:o,unpromoteJob:i}=Ke(),l=Yt(),[c,d]=p.useState([]),[u,m]=p.useState("all"),[h,x]=p.useState([]),[f,g]=p.useState("all"),[b,y]=p.useState([]),[v,j]=p.useState(null),[w,N]=p.useState(!1),[k,_]=p.useState(!0),[R,M]=p.useState(!0),[E,T]=p.useState(!0),[S,P]=p.useState(!1),[I,A]=p.useState(!0),[B,F]=p.useState(!0),[z,L]=p.useState(!0),[K,re]=p.useState(!0),[de,O]=p.useState("charts"),{evaluationData:q,setEvaluationData:D,isEvalLoading:G,evalError:J,evalJobId:X,setEvalJobId:oe,selectedTuningMetric:ve,setSelectedTuningMetric:H,tuningPreview:W,setTuningPreview:ue,hasSavedThresholds:je,setHasSavedThresholds:Ye,useTunedThresholds:we,setUseTunedThresholds:ee,tuningError:Y,setTuningError:U,selectedThresholdMetric:pe,setSelectedThresholdMetric:fe,fetchEvaluationData:Xe}=ZM(e),[dt,ut]=p.useState(null),[Ur,Pd]=p.useState(null),[ao,Id]=p.useState(null),[Vf,Uf]=p.useState(.5),[Hf,Wf]=p.useState("overall"),[Gf,qf]=p.useState("slider"),[Kf,Jf]=p.useState(null),Yf=p.useMemo(()=>{if(!q||!ao||q.problem_type==="clustering")return[];const $=q.splits,te=[{key:"validation",visible:E,label:"validation"},{key:"test",visible:R,label:"test"},{key:"train",visible:k,label:"train"}].filter(fs=>{var As;return(As=$[fs.key])==null?void 0:As.y_proba}),Ne=te.filter(fs=>fs.visible);return(Ne.length>0?Ne:te).flatMap(({key:fs,label:As})=>{const $s=$[fs];if(!($s!=null&&$s.y_proba))return[];const Od=UM($s.y_true,$s.y_proba,ao,pe);return Od?[{...Od,splitLabel:As,metricName:pe}]:[]})},[q,ao,pe,E,R,k]);p.useEffect(()=>{s(),Qf(),Xf()},[s]),p.useEffect(()=>{var $,Z,te;if((q==null?void 0:q.problem_type)!=="clustering"&&((Z=($=q==null?void 0:q.splits.train)==null?void 0:$.y_proba)!=null&&Z.classes)&&q.splits.train.y_proba.classes.length>0){const Ne=q.splits.train.y_proba,Mt=((te=Ne.labels)==null?void 0:te[0])??Ne.classes[0];Id(String(Mt))}},[q]);const Qf=async()=>{try{const $=await se.get("/pipeline/datasets/list");x($.data)}catch($){console.error("Failed to fetch datasets",$),le.error("Failed to load datasets","The dataset filter may be incomplete. Please retry.")}},Xf=async()=>{try{const $=await zr.getAllNodes();y($)}catch($){console.error("Failed to fetch node registry",$)}},Zf=async($,Z)=>{if($.stopPropagation(),!!await l({title:"Deploy to production?",message:"Are you sure you want to deploy this model to production?",confirmLabel:"Deploy"}))try{await Z3.deployModel(Z),le.success("Model deployed")}catch{le.error("Failed to deploy model")}},e0=async($,Z)=>{$.stopPropagation();try{Z.promoted_at?await i(Z.job_id):await o(Z.job_id)}catch{le.error("Failed to update promotion status")}},no=async($,Z)=>{const te=document.getElementById($);if(!te)return;ut($);const Mt=document.documentElement.classList.contains("dark")?"#1f2937":"#ffffff";try{const fs=await Lp(te,{backgroundColor:Mt,pixelRatio:2,filter:$s=>!($s instanceof HTMLElement&&$s.dataset.exportIgnore==="true")}),As=document.createElement("a");As.download=`${Z}.png`,As.href=fs,As.click()}catch(fs){le.error("Image download failed",String(fs))}finally{ut(null),Pd($),setTimeout(()=>Pd(null),1200)}},t0=async()=>{var $,Z;if(X){U(null);try{const te=await mn.preview(X,ve);ue(te)}catch(te){console.error("Failed to preview thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to preview thresholds";throw U(Ne),te}}},s0=async()=>{var $,Z;if(!(!X||!W)){U(null);try{await mn.save(X,W),Ye(!0),ee(!0)}catch(te){console.error("Failed to save thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to save thresholds";throw U(Ne),te}}},r0=async $=>{var Z,te;if(X){U(null);try{await mn.toggle(X,$),ee($)}catch(Ne){console.error("Failed to toggle thresholds",Ne);const Mt=((te=(Z=Ne.response)==null?void 0:Z.data)==null?void 0:te.detail)||"Failed to toggle thresholds";throw U(Mt),Ne}}},a0=async()=>{var $,Z;if(X){U(null);try{await mn.clear(X),Ye(!1),ue(null),ee(!1)}catch(te){console.error("Failed to clear thresholds",te);const Ne=((Z=($=te.response)==null?void 0:$.data)==null?void 0:Z.detail)||"Failed to clear thresholds";throw U(Ne),te}}},$i=p.useMemo(()=>e.filter($=>{const Z=u==="all"||kt($.model_type,b)===u,te=f==="all"||$.dataset_id===f,Ne=$.status==="completed";return Z&&te&&Ne}).sort(($,Z)=>$.promoted_at&&!Z.promoted_at?-1:!$.promoted_at&&Z.promoted_at?1:0),[e,u,f,b]),De=p.useMemo(()=>e.filter($=>c.includes($.job_id)),[e,c]),Ad=p.useMemo(()=>new Map(e.map($=>[$.job_id,$])),[e]),mr=p.useMemo(()=>{const $=new Set($i.map(Z=>Z.job_id));return c.flatMap(Z=>{const te=e.find(Ne=>Ne.job_id===Z);return te?[{jobId:Z,task:kt(te.model_type,b),visible:$.has(Z)}]:[]})},[c,e,$i,b]),oo=p.useMemo(()=>MM(mr),[mr]),n0=p.useMemo(()=>oo.hidden.flatMap($=>e.filter(Z=>Z.job_id===$)),[oo.hidden,e]),Fi=p.useMemo(()=>PM("evaluation",mr),[mr]),o0=p.useMemo(()=>Fi.flatMap($=>{const Z=Ad.get($);return Z?[{jobId:$,pipeline_id:Z.pipeline_id,parent_pipeline_id:Z.parent_pipeline_id??null}]:[]}),[Fi,Ad]),io=p.useMemo(()=>de!=="evaluation"&&de!=="segmentation"?null:IM(de,mr,X),[de,mr,X]);p.useEffect(()=>{if(!(de!=="evaluation"&&de!=="segmentation")){if(io===null){D(null),oe(null);return}io!==X&&Xe(io)}},[de,io,X,D,oe,Xe]);const i0=$=>{d(Z=>Z.includes($)?Z.filter(te=>te!==$):[...Z,$])},l0=p.useMemo(()=>De.map($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return{name:qe($),...Z}}),[De]),Is=p.useMemo(()=>Array.from(new Set(De.flatMap($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return Object.keys(Z).filter(Ne=>{const Mt=Z[Ne];return typeof Mt=="number"&&!Number.isNaN(Mt)})}))),[De]),c0=p.useMemo(()=>Is.some($=>$.startsWith("train_")),[Is]),d0=p.useMemo(()=>Is.some($=>$.startsWith("test_")),[Is]),u0=p.useMemo(()=>Is.some($=>$.startsWith("val_")),[Is]),m0=p.useMemo(()=>Is.some($=>$.startsWith("cv_")||$==="best_score"),[Is]),Di=p.useMemo(()=>c4(Array.from(new Set(De.flatMap($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return Object.keys(Z).filter(Ne=>{const Mt=Z[Ne];return typeof Mt=="number"&&!Number.isNaN(Mt)})}))),{train:k,test:R,val:E,cv:S}),[De,k,R,E,S]),Li=p.useMemo(()=>{const $=new Map;return Di.forEach(Z=>{var Ne;const{base:te}=tA(Z);$.has(te)||$.set(te,[]),(Ne=$.get(te))==null||Ne.push(Z)}),$.forEach((Z,te)=>{$.set(te,Z.sort())}),$},[Di]),Oi=p.useMemo(()=>Array.from(Li.keys()).sort(),[Li]),p0=v&&Oi.includes(v)?v:Oi[0]||null,Ya=p.useMemo(()=>De.map($=>{const Z=$.result??{},te=Z.metrics,Ne=(te==null?void 0:te.feature_importances)??Z.feature_importances;return{jobId:$.job_id,pipeline_id:$.pipeline_id,parent_pipeline_id:$.parent_pipeline_id??null,modelType:$.model_type??"unknown",importances:Ne??null}}),[De]),$d=p.useMemo(()=>Ya.some($=>$.importances!==null),[Ya]),h0=p.useMemo(()=>Ya.map(($,Z)=>{const te=De[Z];return{jobId:$.jobId,label:$.modelType!=="unknown"?`${$.modelType} (${qe($)})`:qe($),task:kt(te.model_type,b),status:te.status,error:te.error,hasArtifact:$.importances!==null}}),[Ya,De,b]),Qa=p.useMemo(()=>De.map($=>{const Z=$.result??{},te=Z.metrics,Ne=(te==null?void 0:te.shap_explanation)??Z.shap_explanation;return{jobId:$.job_id,pipeline_id:$.pipeline_id,parent_pipeline_id:$.parent_pipeline_id??null,modelType:$.model_type??"unknown",shapExplanation:Ne??null}}),[De]),Fd=p.useMemo(()=>Qa.some($=>$.shapExplanation!==null),[Qa]),x0=p.useMemo(()=>Qa.map(($,Z)=>{const te=De[Z];return{jobId:$.jobId,label:$.modelType!=="unknown"?`${$.modelType} (${qe($)})`:qe($),task:kt(te.model_type,b),status:te.status,error:te.error,hasArtifact:$.shapExplanation!==null}}),[Qa,De,b]),Dd=p.useMemo(()=>De.some($=>kt($.model_type,b)==="segmentation"),[De,b]),Ld=p.useMemo(()=>De.some($=>{var te;const Z=$.metrics||((te=$.result)==null?void 0:te.metrics)||{};return typeof Z.pipeline_diagram=="string"&&Z.pipeline_diagram.length>0}),[De]),g0=p.useMemo(()=>De.map($=>{const Z=kt($.model_type,b);return{jobId:$.job_id,label:$.model_type?`${$.model_type} (${qe($)})`:qe($),...kd("segmentation",{task:Z,status:$.status,error:$.error,hasArtifact:!0})}}),[De,b]);return t.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[t.jsx(XI,{datasets:h,selectedDatasetId:f,setSelectedDatasetId:g,filterType:u,setFilterType:m}),t.jsx(rA,{hiddenSelectedJobs:n0,visibleIds:oo.visible,selectedCount:mr.length,onShowAll:()=>{m("all"),g("all")},onClearHidden:()=>d(oo.visible)}),t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsx(oI,{filteredJobs:$i,selectedJobIds:c,isSidebarCollapsed:w,setIsSidebarCollapsed:N,toggleJobSelection:i0,hasMore:r,isLoading:n,loadMoreJobs:a,handlePromote:e0,handleDeploy:Zf,getDuration:Wo}),t.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:De.length===0?t.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[t.jsx(On,{className:"w-12 h-12 mb-4 opacity-20"}),t.jsx("p",{children:"Select runs from the sidebar to compare them."})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsx(eA,{activeView:de,setActiveView:O,hasFeatureImportances:$d,hasShapSummary:Fd,hasSegmentation:Dd,hasPipelineDiagram:Ld}),t.jsx(ZP,{selectedJobs:De,getDuration:Wo}),de==="charts"&&t.jsx(tI,{metricsData:l0,metricGroups:Li,availableMetrics:Oi,activeMetric:p0,setSelectedMetric:j,showTrainMetrics:k,setShowTrainMetrics:_,showTestMetrics:R,setShowTestMetrics:M,showValMetrics:E,setShowValMetrics:T,showCvMetrics:S,setShowCvMetrics:P,hasTrainMetrics:c0,hasTestMetrics:d0,hasValMetrics:u0,hasCvMetrics:m0}),de==="table"&&t.jsx(_P,{selectedJobs:De,metricKeys:Di,isPipelineExpanded:K,setIsPipelineExpanded:re,isMetricsExpanded:I,setIsMetricsExpanded:A,isParamsExpanded:B,setIsParamsExpanded:F,isTuningExpanded:z,setIsTuningExpanded:L}),de==="evaluation"&&t.jsx(OI,{eligibleJobIds:Fi,eligibleJobs:o0,evalJobId:X,fetchEvaluationData:Xe,isEvalLoading:G,evalError:J,evaluationData:q,selectedRegressionSplit:Kf,setSelectedRegressionSplit:Jf,showTrainMetrics:k,setShowTrainMetrics:_,showTestMetrics:R,setShowTestMetrics:M,showValMetrics:E,setShowValMetrics:T,threshold:Vf,setThreshold:Uf,selectedRocClass:ao,setSelectedRocClass:Id,cmView:Hf,setCmView:Wf,activeTab:Gf,setActiveTab:qf,selectedMetric:pe,setSelectedMetric:fe,bestMetricInfos:Yf,handleDownload:no,downloadingChart:dt,doneChart:Ur,selectedTuningMetric:ve,onSelectedTuningMetricChange:H,tuningPreview:W,tuningError:Y,useTunedThresholds:we,hasSavedThresholds:je,onPreviewThresholds:t0,onSaveThresholds:s0,onToggleThresholds:r0,onClearThresholds:a0}),de==="diff"&&t.jsx(SM,{jobs:De}),t.jsx(aA,{activeView:de,hasPipelineDiagram:Ld,hasFeatureImportances:$d,hasShapSummary:Fd,hasSegmentation:Dd,diagramProps:{jobs:De},importanceProps:{featureImportancesByJob:Ya,coverageInputs:h0,handleDownload:no,downloadingChart:dt,doneChart:Ur},shapProps:{shapExplanationByJob:Qa,coverageInputs:x0,handleDownload:no,downloadingChart:dt,doneChart:Ur},segmentationProps:{selectedJobIds:c,coverageEntries:g0,evalJobId:X,fetchEvaluationData:Xe,isEvalLoading:G,evalError:J,evaluationData:q,handleDownload:no,downloadingChart:dt,doneChart:Ur}})]})})]})]})};function rA({hiddenSelectedJobs:e,visibleIds:s,selectedCount:r,onShowAll:a,onClearHidden:n}){return t.jsx(t.Fragment,{children:e.length>0&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[t.jsxs("span",{className:"font-medium",children:[s.length," of ",r," selected runs visible"]}),t.jsxs("span",{className:"flex-1 min-w-[14rem]",children:["Still comparing ",e.length," run",e.length===1?"":"s"," hidden by the current filters:"," ",e.map(o=>qe(o)).join(", ")]}),t.jsx("button",{onClick:a,className:"rounded-md border border-amber-300 px-2.5 py-1 font-medium hover:bg-amber-100 dark:border-amber-800 dark:hover:bg-amber-900/40",children:"Show all selected"}),t.jsx("button",{onClick:n,className:"rounded-md border border-amber-300 px-2.5 py-1 font-medium hover:bg-amber-100 dark:border-amber-800 dark:hover:bg-amber-900/40",children:"Clear hidden"})]})})}function aA({activeView:e,hasPipelineDiagram:s,hasFeatureImportances:r,hasShapSummary:a,hasSegmentation:n,diagramProps:o,importanceProps:i,shapProps:l,segmentationProps:c}){return t.jsxs(t.Fragment,{children:[e==="diagram"&&s&&t.jsx(QI,{...o}),e==="importance"&&r&&t.jsx(RP,{...i}),e==="shap"&&a&&t.jsx(XP,{...l}),e==="segmentation"&&n&&t.jsx(WI,{...c})]})}const nA=ae.lazy(()=>cr(()=>import("./InferencePage-BvDNVaSU.js"),__vite__mapDeps([4,2,1,3])).then(e=>({default:e.InferencePage}))),oA=()=>{const{activeView:e,isPropertiesPanelExpanded:s,resultsPanelHeight:r}=be(),a=ae.useRef(null),[n,o]=ae.useState(624);ae.useEffect(()=>{const h=a.current;if(!h)return;const x=new ResizeObserver(([f])=>{f&&f.contentRect.height>0&&o(f.contentRect.height)});return x.observe(h),()=>x.disconnect()},[]);const i=Math.max(200,Math.min(720,Math.floor(n-240))),[l,c]=ae.useState(()=>new Set([e]));ae.useEffect(()=>{c(h=>h.has(e)?h:new Set(h).add(e))},[e]);const d=Or();K3(),X3();const[u,m]=ae.useState(!1);return Xk({onToggleHelp:()=>m(h=>!h),onCloseHelp:()=>m(!1)}),ae.useEffect(()=>{const h=()=>m(!0);return window.addEventListener(Ko,h),()=>window.removeEventListener(Ko,h)},[]),t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden flex-col",children:[t.jsx(G3,{}),t.jsx(OR,{}),t.jsx("div",{style:{display:e==="canvas"?"contents":"none"},children:t.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[!d&&t.jsx(e_,{}),t.jsxs("main",{className:"flex-1 min-w-0 h-full relative flex flex-col transition-all duration-300 ease-in-out",children:[!s&&t.jsx($E,{}),t.jsxs("div",{ref:a,className:"flex-1 min-h-0 relative",style:{"--results-panel-height":`${Math.min(r,i)}px`},children:[t.jsx(s5,{}),t.jsx(HR,{}),t.jsx(iR,{maxHeight:i})]})]}),!d&&t.jsx(_5,{})]})}),t.jsx("div",{style:{display:e==="experiments"?"contents":"none"},children:l.has("experiments")&&t.jsx(sA,{})}),t.jsx("div",{style:{display:e==="inference"?"contents":"none"},children:l.has("inference")&&t.jsx(Gc,{children:t.jsx(ae.Suspense,{fallback:t.jsx(Fh,{}),children:t.jsx(nA,{})})})}),t.jsx(KR,{open:u,onClose:()=>m(!1)}),t.jsx(JR,{})]})},iA=["canvas","experiments","inference"],lA=e=>e!==null&&iA.includes(e),cA={"/errors":"Error Log","/slow-nodes":"Slow Nodes","/jobs":"Jobs","/drift":"Drift","/audit":"Audit Log"},dA=()=>{const e=V(y=>y.addNode),s=V(y=>y.setGraph),r=V(y=>y.selectNode),a=V(y=>y.nodes),[n,o]=Mh(),i=Rt(),l=Oa(),c=p.useRef(!1),d=p.useRef(!1),u=p.useRef(null),[m,h]=p.useState(null),x=be(y=>y.activeView),f=be(y=>y.setView),g=p.useRef(!1),b=p.useRef(!1);return p.useEffect(()=>{const y=n.get("view");lA(y)&&y!==be.getState().activeView&&(b.current=!0,f(y))},[n,f]),p.useEffect(()=>{if(b.current){b.current=!1;return}const y=be.getState().activeView;if(n.get("view")===y){g.current=!0;return}const v=new URLSearchParams(n);v.set("view",y),o(v,{replace:!g.current}),g.current=!0},[x]),p.useEffect(()=>{const y=i.state,v=y==null?void 0:y.restoreVersion;if(!v||d.current)return;d.current=!0;const j=v.graph;if(j&&Array.isArray(j.nodes)&&Array.isArray(j.edges)){s(j.nodes,j.edges),c.current=!0;const w=new URLSearchParams(n);w.delete("source_id"),o(w,{replace:!0}),l(i.pathname+i.search,{replace:!0,state:null}),le.success(`Restored "${v.name}"`,`Version v${v.versionInt}`)}else le.error("Restore failed","Snapshot graph is not in a recognised shape.")},[i,l,s,n,o]),p.useEffect(()=>{const y=n.get("source_id");if(y){if(c.current)return;if(a.some(w=>{var N;return w.type==="dataset_node"&&((N=w.data)==null?void 0:N.datasetId)===y})){const w=new URLSearchParams(n);w.delete("source_id"),o(w,{replace:!0});return}c.current=!0,e("dataset_node",{x:100,y:100},{datasetId:y});const j=new URLSearchParams(n);j.delete("source_id"),o(j,{replace:!0})}},[n,e,a,o]),p.useEffect(()=>{const y=Bh(n);if(!y||y.ref.kind!=="node")return;const v=n.toString();if(u.current===v)return;u.current=v;const{nodeId:j,pipelineId:w}=y.ref;if(r(j)){h(null),window.dispatchEvent(new CustomEvent(Ir,{detail:{id:j,focusWrapper:!0}}));return}h(w!==void 0?{kind:"different-pipeline",nodeId:j,pipelineId:w,...y.origin?{origin:y.origin}:{}}:{kind:"not-found",nodeId:j,...y.origin?{origin:y.origin}:{}})},[n,r]),t.jsxs("div",{className:"relative h-full w-full",children:[m&&t.jsx("div",{className:"absolute top-4 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 px-4",children:t.jsxs("div",{className:"relative rounded-lg border border-amber-300 bg-white shadow-lg dark:border-amber-700 dark:bg-slate-800",children:[t.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Dismiss",className:"absolute right-2 top-2 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700",children:t.jsx(Ee,{className:"h-4 w-4","aria-hidden":"true"})}),t.jsx(sr,{error:m.kind==="different-pipeline"?`Node ${m.nodeId} belongs to pipeline ${m.pipelineId}, which isn't the pipeline currently open on this canvas. Load that pipeline's version from Data Sources to inspect it, or return to where you came from to re-run the investigation.`:`Node ${m.nodeId} could not be found on this canvas. It may have been removed or renamed.`}),m.origin&&t.jsx("div",{className:"border-t border-slate-100 px-4 pb-4 pt-2 text-center dark:border-slate-700",children:t.jsxs(ls,{to:m.origin,className:"text-sm font-medium text-blue-600 hover:underline dark:text-blue-400",children:["Back to ",cA[m.origin]??m.origin]})})]})}),t.jsx(oA,{})]})},_f=[{task:"classification",label:"Classification",icon:t.jsx(Gp,{size:16})},{task:"regression",label:"Regression",icon:t.jsx(jc,{size:16})},{task:"text_classification",label:"Text Classification",icon:t.jsx(Dr,{size:16})},{task:"segmentation",label:"Segmentation",icon:t.jsx(zn,{size:16})},{task:"ensemble",label:"Ensemble",icon:t.jsx(Ln,{size:16})}],uA=_f.map(e=>e.task),Qr=e=>uA.includes(e),mA=()=>{const e=Oa(),[s]=Mh(),[r,a]=p.useState("classification"),[n,o]=p.useState([]),[i,l]=p.useState(!0),[c,d]=p.useState(""),[u,m]=p.useState("all"),[h,x]=p.useState(!1),[f,g]=p.useState("all"),b=25,[y,v]=p.useState([]),[j,w]=p.useState(!0),N=p.useRef(0),k=p.useRef(!1),[_,R]=p.useState([]),[M,E]=p.useState(0),[T,S]=p.useState(!0),[P,I]=p.useState({eda:{data:[],skip:0,hasMore:!0},ingestion:{data:[],skip:0,hasMore:!0}}),A=p.useMemo(()=>Bh(s),[s]),B=(A==null?void 0:A.ref.kind)==="job"?A.ref.jobId:null,F=p.useRef(null);p.useEffect(()=>{if(!(A!=null&&A.filters)||F.current===B)return;F.current=B;const ee=A.filters;ee.tab&&a(ee.tab),ee.q!==void 0&&d(ee.q),ee.status&&m(ee.status),ee.ensemble&&g(ee.ensemble)},[A,B]);const[z,L]=p.useState(null),[K,re]=p.useState(!1),[de,O]=p.useState(null),q=B?[...y,..._,...P.eda.data,...P.ingestion.data].find(ee=>ee.job_id===B):void 0;p.useEffect(()=>{if(!B||q){L(null),O(null);return}let ee=!1;return re(!0),O(null),Re.getJob(B).then(Y=>{ee||L(Y)}).catch(()=>{ee||O("This job could not be found. It may have been removed.")}).finally(()=>{ee||re(!1)}),()=>{ee=!0}},[B,!!q]);const D=q??z??null,G=()=>({tab:r,q:c,status:u,...r==="ensemble"?{ensemble:f}:{}}),J=()=>{e("/jobs",{replace:!0})};p.useEffect(()=>{let ee=!1;return zr.getAllNodes().then(Y=>{ee||o(Y)}).catch(Y=>{console.error("Failed to fetch node registry:",Y)}),()=>{ee=!0}},[]);const X=async(ee=!1)=>{if(!k.current){k.current=!0,ee&&(l(!0),v([]),N.current=0,w(!0));try{const Y=ee?0:N.current,U=await Re.getJobs(b,Y);U.sort((fe,Xe)=>new Date(Xe.created_at).getTime()-new Date(fe.created_at).getTime());const pe=U.length>=b;w(pe),v(fe=>{if(ee)return U;const Xe=new Set(fe.map(ut=>ut.job_id)),dt=U.filter(ut=>!Xe.has(ut.job_id));return[...fe,...dt]}),N.current=Y+b}catch(Y){console.error("Failed to fetch jobs:",Y)}finally{l(!1),k.current=!1}}},oe=async(ee=!1)=>{ee&&(l(!0),R([]),E(0),S(!0));try{const Y=ee?0:M;let U=[];r==="eda"?U=await Re.getEDAJobs(b):r==="ingestion"&&(U=await Re.getIngestionJobs(b,Y)),U.sort((fe,Xe)=>new Date(Xe.created_at).getTime()-new Date(fe.created_at).getTime());const pe=U.length>=b;pe||S(!1),ee?(R(U),I(fe=>({...fe,[r]:{data:U,skip:Y+b,hasMore:pe}}))):R(fe=>{const Xe=[...fe,...U];return I(dt=>({...dt,[r]:{data:Xe,skip:Y+b,hasMore:pe}})),Xe}),E(Y+b)}catch(Y){console.error("Failed to fetch jobs:",Y)}finally{l(!1)}};p.useEffect(()=>{if(Qr(r)){y.length===0?X(!0):l(!1);return}const ee=P[r];ee.data.length>0?(R(ee.data),E(ee.skip),S(ee.hasMore),l(!1)):oe(!0)},[r]);const ve=5,[H,W]=p.useState(0);p.useEffect(()=>{W(0)},[r]),p.useEffect(()=>{r!=="ensemble"&&g("all")},[r]),p.useEffect(()=>{if(!Qr(r)||i||!j||H>=ve)return;y.filter(Y=>kt(Y.model_type,n)===r).lengthY+1),X(!1))},[r,y,j,i,n]);const ue=()=>{Qr(r)?X(!1):oe(!1)},je=Qr(r)?y.filter(ee=>kt(ee.model_type,n)===r).filter(ee=>r!=="ensemble"||f==="all"||Kn(ee.model_type)===f):_,Ye=Qr(r)?j:T,we=je.filter(ee=>{if(u!=="all"&&ee.status.toLowerCase()!==u)return!1;if(c){const Y=c.toLowerCase();return ee.job_id.toLowerCase().includes(Y)||ee.model_type&&ee.model_type.toLowerCase().includes(Y)||ee.dataset_name&&ee.dataset_name.toLowerCase().includes(Y)}return!0});return B?t.jsx(hA,{selectedJob:D,fallbackLoading:K,fallbackError:de,handleBackFromDetails:J,listFilterSnapshot:G}):t.jsxs("div",{className:"p-8 space-y-6 animate-in fade-in duration-500",children:[t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-slate-900 dark:text-slate-100",children:"Jobs"}),t.jsx("p",{className:"text-slate-500 dark:text-slate-400 mt-1",children:"Monitor and manage all your pipeline activities"})]}),t.jsxs("button",{onClick:()=>Qr(r)?X(!0):oe(!0),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-700 dark:text-slate-300",children:[t.jsx(us,{size:16}),"Refresh"]})]}),t.jsx(xA,{activeTab:r,setActiveTab:a,searchTerm:c,setSearchTerm:d,statusFilter:u,setStatusFilter:m,showFilters:h,setShowFilters:x,ensembleSubFilter:f,setEnsembleSubFilter:g,visibleJobs:je}),t.jsx(gA,{loading:i,filteredJobs:we,registryItems:n,listFilterSnapshot:G,visibleHasMore:Ye,handleLoadMore:ue})]})},fl=({active:e,onClick:s,icon:r,label:a})=>t.jsxs("button",{onClick:s,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all whitespace-nowrap ${e?"bg-indigo-600 text-white shadow-sm":"text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-700"}`,children:[r,a]}),pA=({status:e})=>{const s={succeeded:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",completed:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",failed:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",running:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",queued:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400"},r={succeeded:t.jsx(Ut,{size:14}),completed:t.jsx(Ut,{size:14}),failed:t.jsx(ir,{size:14}),running:t.jsx(at,{size:14,className:"animate-pulse"}),pending:t.jsx(_t,{size:14}),queued:t.jsx(_t,{size:14})},a=e.toLowerCase(),n=s[a]||"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-400",o=r[a]||t.jsx(_t,{size:14});return t.jsxs("span",{className:`px-2.5 py-1 inline-flex items-center gap-1.5 text-xs font-medium rounded-full ${n}`,children:[o,e.charAt(0).toUpperCase()+e.slice(1)]})};function hA({selectedJob:e,fallbackLoading:s,fallbackError:r,handleBackFromDetails:a,listFilterSnapshot:n}){return t.jsx("div",{className:"p-8 animate-in fade-in duration-500",children:t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm h-[calc(100vh-8rem)] overflow-hidden",children:e?t.jsx(mf,{job:e,onBack:a,onClose:a,origin:"/jobs",filters:n()}):s?t.jsx(Rs,{message:"Loading job details..."}):t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx(sr,{error:r??"This job could not be found."}),t.jsx("div",{className:"flex justify-center",children:t.jsx("button",{onClick:a,className:"text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 font-medium px-4 py-2 rounded-md hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-colors",children:"Back to Jobs"})})]})})})}function xA({activeTab:e,setActiveTab:s,searchTerm:r,setSearchTerm:a,statusFilter:n,setStatusFilter:o,showFilters:i,setShowFilters:l,ensembleSubFilter:c,setEnsembleSubFilter:d,visibleJobs:u}){const m=n!=="all"?1:0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4 bg-white dark:bg-slate-800 p-4 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsxs("div",{className:"flex gap-2 overflow-x-auto w-full md:w-auto pb-2 md:pb-0",children:[_f.map(({task:h,label:x,icon:f})=>t.jsx(fl,{active:e===h,onClick:()=>s(h),icon:f,label:x},h)),t.jsx(fl,{active:e==="eda",onClick:()=>s("eda"),icon:t.jsx(Fn,{size:16}),label:"EDA"}),t.jsx(fl,{active:e==="ingestion",onClick:()=>s("ingestion"),icon:t.jsx(Ct,{size:16}),label:"Ingestion"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative w-full md:w-56",children:[t.jsx(lr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none z-10",size:16}),t.jsx("input",{type:"text",placeholder:"Search jobs...",value:r,onChange:h=>a(h.target.value),className:"w-full pl-8 pr-4 py-2 text-sm bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:text-slate-100"})]}),t.jsxs("button",{onClick:()=>l(!i),className:`flex items-center gap-1.5 px-3 py-2 text-sm rounded-md border transition-colors ${i||n!=="all"?"bg-indigo-50 dark:bg-indigo-900/20 border-indigo-200 dark:border-indigo-800 text-indigo-700 dark:text-indigo-300":"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"}`,children:[t.jsx(On,{size:14}),"Filters",m>0&&t.jsx("span",{className:"ml-0.5 w-5 h-5 flex items-center justify-center rounded-full bg-indigo-600 text-white text-xs",children:m})]}),(r||n!=="all")&&t.jsx("button",{onClick:()=>{a(""),o("all")},className:"text-xs text-indigo-600 dark:text-indigo-400 hover:underline whitespace-nowrap",children:"Clear all"})]})]}),e==="ensemble"&&t.jsx("div",{className:"flex items-center gap-1.5 px-4 py-2 bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:["all","classification","regression"].map(h=>t.jsx("button",{onClick:()=>d(h),className:`px-2.5 py-1 text-xs rounded-full border transition-colors capitalize ${c===h?"bg-indigo-50 dark:bg-indigo-900/20 border-indigo-200 dark:border-indigo-800 text-indigo-700 dark:text-indigo-300":"bg-slate-50 dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"}`,children:h},h))}),i&&t.jsxs("div",{className:"flex items-center gap-4 px-4 py-3 bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm",children:[t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400 font-medium",children:"Status"}),t.jsxs("select",{value:n,onChange:h=>o(h.target.value),className:"px-2.5 py-1.5 text-sm rounded-md border border-slate-200 dark:border-slate-700 bg-slate-50 dark:bg-slate-900 text-slate-700 dark:text-slate-200 focus:outline-none focus:ring-1 focus:ring-indigo-500",children:[t.jsx("option",{value:"all",children:"All statuses"}),[...new Set(u.map(h=>h.status.toLowerCase()))].sort().map(h=>t.jsx("option",{value:h,children:h.charAt(0).toUpperCase()+h.slice(1)},h))]})]})]})}function gA({loading:e,filteredJobs:s,registryItems:r,listFilterSnapshot:a,visibleHasMore:n,handleLoadMore:o}){return t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden",children:[e?t.jsx(Rs,{message:"Loading jobs..."}):s.length===0?t.jsx(os,{title:"No jobs found matching your criteria."}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[t.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Job ID"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Type"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Details"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Duration"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:s.map(i=>t.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx(pA,{status:i.status})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-slate-100",children:t.jsx("span",{className:"font-mono text-xs bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded",title:i.job_id,children:i.job_id.substring(0,8)})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:tT(i,r)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:i.model_type||i.dataset_name||i.target_column||"-"}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400 font-mono",children:Wo(i.start_time,i.end_time)}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:[new Date(i.created_at).toLocaleDateString()," ",t.jsx("span",{className:"text-xs opacity-70",children:new Date(i.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:t.jsx(rr,{recordRef:{kind:"job",jobId:i.job_id},origin:"/jobs",filters:a(),label:"View details"})})]},i.job_id))})]})}),!e&&n&&s.length>0&&t.jsx("div",{className:"p-4 border-t border-slate-200 dark:border-slate-700 flex justify-center",children:t.jsx("button",{onClick:o,className:"text-sm text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 font-medium flex items-center gap-1 px-4 py-2 rounded-md hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-colors",children:"Load More"})})]})}const fA=[{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"},{label:"All",value:"all"}];function Wm(e){if(e==="all")return;const s={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5}[e];return new Date(Date.now()-s).toISOString()}const bA={critical:"error",warning:"warning",info:"info"},Ai={critical:"Critical",warning:"Warning",info:"Info"};function Sd(e){return e==="critical"?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e==="warning"?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-slate-100 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}function yA(e){const s=["id","severity","status_code","error_type","message","route","job_id","created_at"],r=i=>`"${String(i??"").replace(/"/g,'""')}"`,a=[s.join(","),...e.map(i=>[i.id,i.severity,i.status_code,i.error_type,i.message,i.route,i.job_id??"",i.created_at].map(r).join(","))],n=new Blob([a.join(` `)],{type:"text/csv"}),o=document.createElement("a");o.href=URL.createObjectURL(n),o.download=`error-log-${new Date().toISOString().slice(0,10)}.csv`,o.click(),URL.revokeObjectURL(o.href)}function Sf(e){return e>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":e>=400?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-slate-100 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}function Ta(e){const s=Date.now()-new Date(e).getTime(),r=Math.floor(s/1e3);if(r<60)return`${r}s ago`;const a=Math.floor(r/60);if(a<60)return`${a}m ago`;const n=Math.floor(a/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function vA(e){return e.slice(11,16)}function bl(e){const s=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}T${s(e.getHours())}`}function jA(e){const s=new Map;return e.filter(r=>r.level==="error").forEach(r=>{const a=r.node_type??"unknown",n=s.get(a);n?(n.count++,r.run_at&&(r.run_at>n.last_seen&&(n.last_seen=r.run_at),r.run_ata.count-r.count)}function wA(e,s){const r=Array.from({length:24},(n,o)=>{const i=new Date;return i.setMinutes(0,0,0),i.setHours(i.getHours()-(23-o)),{hour:bl(i)+":00:00",_key:bl(i),count:0}}),a=new Map(r.map(n=>[n._key,n]));return e.forEach(n=>{const o=n.hour.length>=13?n.hour.slice(0,13)+":00:00Z":n.hour,i=new Date(o);if(Number.isNaN(i.getTime()))return;const l=bl(i),c=a.get(l);c&&(c.count+=n.count)}),s.forEach(n=>{if(!n.run_at)return;const o=n.run_at.replace(" ","T").slice(0,13),i=a.get(o);i&&(i.count+=1)}),r}function NA(){const e=p.useRef(0),[s,r]=p.useState([]),[a,n]=p.useState(0),[o,i]=p.useState(0),[l,c]=p.useState({severities:[],error_types:[],job_ids:[]}),[d,u]=p.useState(!0),[m,h]=p.useState(""),[x,f]=p.useState("24h"),[g,b]=p.useState(!1),[y,v]=p.useState(""),[j,w]=p.useState(""),[N,k]=p.useState(""),[_,R]=p.useState(""),[M,E]=p.useState(null),[T,S]=p.useState(!1),[P,I]=p.useState(null),[A,B]=p.useState([]),[F,z]=p.useState("events"),[L,K]=p.useState([]),[re,de]=p.useState([]),[O,q]=p.useState({node_types:[],node_ids:[]}),D=x==="all"?"all":x,G=p.useMemo(()=>{const Y={};return g&&(Y.showResolved="true"),y&&(Y.severity=y),j&&(Y.errorType=j),N&&(Y.jobId=N),_&&(Y.nodeId=_),m&&(Y.q=m),Y},[g,y,j,N,_,m]),J=p.useCallback(async Y=>{try{const U=await yt.getPipelineLogs(200,Wm(x),void 0,{...m?{q:m}:{},...y?{level:bA[y]}:{},..._?{nodeId:_}:{}});if(Y!==e.current)return;de(U.entries),q({node_types:U.facets.node_types,node_ids:U.facets.node_ids})}catch(U){if(Y!==e.current)return;console.debug("[error-log] failed to fetch pipeline logs",U)}},[x,m,y,_]),X=p.useCallback(async()=>{try{await yt.clearPipelineLogs(),de([])}catch(Y){console.error("Failed to clear pipeline logs",Y),le.error("Failed to clear pipeline logs","Please try again.")}},[]),oe=p.useCallback(()=>Promise.all([yt.getErrors(500,Wm(x),g,{...m?{q:m}:{},...y?{severity:y}:{},...j?{errorType:j}:{},...N?{jobId:N}:{}}),yt.getTimeline(24),yt.getGrouped()]),[x,g,m,y,j,N]),ve=p.useCallback(async()=>{const Y=e.current+1;e.current=Y,u(!0),I(null);try{const[U,pe,fe]=await oe();if(Y!==e.current)return;r(U.entries),n(U.total),i(U.total_unfiltered),c(U.facets),B(pe),K(fe),J(Y)}catch{if(Y!==e.current)return;I("Could not reach the backend. Is the server running?")}finally{Y===e.current&&u(!1)}},[oe,J]);p.useEffect(()=>(ve(),()=>{e.current++}),[ve]);const H=Yt(),W=async()=>{if(await H({title:"Delete all error events?",message:`Delete all ${s.length} error events? This cannot be undone.`,confirmLabel:"Delete all",variant:"danger"})){S(!0);try{await yt.clearErrors(),r([])}finally{S(!1)}}},ue=async Y=>{try{const U=await yt.getError(Y);E(U)}catch(U){console.error("Failed to load error sample",U),le.error("Failed to load error sample","Please try again.")}},je=async Y=>{const U=Y.resolved_at?await yt.unresolveError(Y.id):await yt.resolveError(Y.id);r(pe=>pe.map(fe=>fe.id===U.id?U:fe))},Ye=!!m||!!y||!!j||!!N||!!_,we=p.useMemo(()=>jA(re),[re]),ee=p.useMemo(()=>wA(A,re),[A,re]);return{events:s,eventsTotal:a,eventsTotalUnfiltered:o,errorFacets:l,loading:d,search:m,setSearch:h,timeRange:x,setTimeRange:f,showResolved:g,setShowResolved:b,severityFilter:y,setSeverityFilter:v,errorTypeFilter:j,setErrorTypeFilter:w,jobIdFilter:N,setJobIdFilter:k,nodeIdFilter:_,setNodeIdFilter:R,modal:M,setModal:E,clearing:T,error:P,view:F,setView:z,grouped:L,pipelineLogs:re,pipelineFacets:O,operationalTimeRange:D,linkFilters:G,load:ve,handleClear:W,handleClearPipelineLogs:X,handleViewSample:ue,handleResolve:je,hasActiveFilters:Ye,pipelineIssues:we,mergedTimeline:ee}}const kA=({load:e,loading:s,pipelineLogs:r,handleClearPipelineLogs:a,events:n,handleClear:o,clearing:i})=>t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:t.jsx(Te,{size:20,className:"text-red-500"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-bold text-slate-800 dark:text-slate-100",children:"Error Log"}),t.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:"In-house tracker β€” all unhandled 5xx and pipeline failures"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:e,className:"flex items-center gap-2 px-3 py-2 text-sm bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-600 dark:text-slate-300",children:[t.jsx(us,{size:14,className:s?"animate-spin":""}),"Refresh"]}),r.length>0&&t.jsxs("button",{onClick:()=>void a(),className:"flex items-center gap-2 px-3 py-2 text-sm bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg hover:bg-amber-100 dark:hover:bg-amber-900/40 transition-colors text-amber-600 dark:text-amber-400",children:[t.jsx(gt,{size:14}),"Clear pipeline"]}),n.length>0&&t.jsxs("button",{onClick:o,disabled:i,className:"flex items-center gap-2 px-3 py-2 text-sm bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg hover:bg-red-100 dark:hover:bg-red-900/40 transition-colors text-red-600 dark:text-red-400",children:[t.jsx(gt,{size:14}),"Clear HTTP"]}),n.length>0&&t.jsxs("button",{onClick:()=>yA(n),className:"flex items-center gap-2 px-3 py-2 text-sm bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors text-slate-600 dark:text-slate-300",children:[t.jsx(Ae,{size:14}),"Export CSV"]})]})]})}),_A=({view:e,setView:s,grouped:r,pipelineIssues:a,events:n,pipelineLogs:o})=>t.jsx(t.Fragment,{children:t.jsx("div",{className:"flex items-center gap-1 mb-4",children:["events","issues"].map(i=>t.jsx("button",{onClick:()=>s(i),className:`flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-lg border transition-colors capitalize ${e===i?"bg-slate-800 dark:bg-slate-200 text-white dark:text-slate-900 border-slate-800 dark:border-slate-200":"bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 hover:bg-slate-50"}`,children:i==="issues"?`Issues (${r.length+a.length})`:`Events (${n.length+o.length})`},i))})}),SA=({loading:e,events:s,pipelineLogs:r,mergedTimeline:a})=>{if(e||s.length===0&&r.length===0)return null;const n=s.filter(o=>o.status_code>=500).length;return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[{label:"HTTP events",value:s.length,color:"text-slate-700 dark:text-slate-200"},{label:"Server errors (5xx)",value:n,color:"text-red-600 dark:text-red-400"},{label:"Pipeline failures",value:r.filter(o=>o.level==="error").length,color:"text-amber-600 dark:text-amber-400"}].map(o=>t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-4",children:[t.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400 mb-1",children:o.label}),t.jsx("p",{className:`text-2xl font-bold ${o.color}`,children:o.value})]},o.label))}),t.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-4 mb-6",children:[t.jsx("p",{className:"text-xs font-medium text-slate-500 dark:text-slate-400 mb-3",children:"Errors per hour β€” last 24 h"}),t.jsx($e,{width:"100%",height:80,children:t.jsxs(Jt,{data:a,margin:{top:0,right:0,left:-30,bottom:0},children:[t.jsx(Oe,{dataKey:"hour",tickFormatter:o=>o.slice(11,16),tick:{fontSize:10,fill:"#94a3b8"},interval:"preserveStartEnd",axisLine:!1,tickLine:!1}),t.jsx(ze,{allowDecimals:!1,tick:{fontSize:10,fill:"#94a3b8"},axisLine:!1,tickLine:!1}),t.jsx(Fe,{formatter:o=>[o,"errors"],labelFormatter:o=>`Hour starting ${o}`,contentStyle:{fontSize:12,borderRadius:8,border:"1px solid #e2e8f0"}}),t.jsx(lt,{dataKey:"count",radius:[3,3,0,0],children:a.map((o,i)=>t.jsx(wa,{fill:o.count>0?"#ef4444":"#e2e8f0",fillOpacity:o.count>0?.85:.4},i))})]})})]})]})},Ro=({id:e,label:s,value:r,onChange:a,options:n,optionLabel:o})=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("label",{htmlFor:e,className:"sr-only",children:s}),t.jsxs("select",{id:e,value:r,onChange:i=>a(i.target.value),className:"px-3 py-1.5 text-xs rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"",children:s}),n.map(i=>t.jsx("option",{value:i,children:o?o(i):i},i))]})]}),CA=({view:e,search:s,setSearch:r,timeRange:a,setTimeRange:n,showResolved:o,setShowResolved:i,hasActiveFilters:l,eventsTotalUnfiltered:c,eventsTotal:d,severityFilter:u,setSeverityFilter:m,errorTypeFilter:h,setErrorTypeFilter:x,jobIdFilter:f,setJobIdFilter:g,nodeIdFilter:b,setNodeIdFilter:y,errorFacets:v,pipelineFacets:j})=>t.jsxs("div",{className:`flex flex-col gap-3 mb-4 ${e==="issues"?"hidden":""}`,children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsxs("div",{className:"relative flex-1 max-w-sm",children:[t.jsx(lr,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search errors, job id, node id…",value:s,onChange:w=>r(w.target.value),className:"w-full pl-9 pr-4 py-2 text-sm bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-slate-200"})]}),t.jsx("div",{className:"flex items-center gap-1 bg-slate-100 dark:bg-slate-800 rounded-lg p-1",children:fA.map(w=>t.jsx("button",{onClick:()=>n(w.value),className:`px-3 py-1 text-xs rounded-md font-medium transition-colors ${a===w.value?"bg-white dark:bg-slate-700 text-slate-800 dark:text-slate-100 shadow-sm":"text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,children:w.label},w.value))}),t.jsx("button",{onClick:()=>i(w=>!w),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg font-medium border transition-colors ${o?"bg-slate-200 dark:bg-slate-700 border-slate-300 dark:border-slate-600 text-slate-700 dark:text-slate-200":"bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700 text-slate-500 dark:text-slate-400 hover:text-slate-700"}`,children:o?"βœ“ Showing resolved":"Show resolved"}),l&&t.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:c===0?"No history recorded yet":`${d} of ${c} HTTP events match`})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(Ro,{id:"facet-severity",label:"All severities",value:u,onChange:w=>m(w),options:v.severities,optionLabel:w=>Ai[w]??w}),t.jsx(Ro,{id:"facet-error-type",label:"All error types",value:h,onChange:x,options:v.error_types}),t.jsx(Ro,{id:"facet-job-id",label:"All job IDs",value:f,onChange:g,options:v.job_ids}),t.jsx(Ro,{id:"facet-node-id",label:"All node IDs",value:b,onChange:y,options:j.node_ids})]})]}),EA=({issue:e,onViewSample:s})=>t.jsxs("tr",{className:"border-b border-slate-100 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.75rem] h-6 px-1.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-bold",children:e.count})}),t.jsx("td",{className:"px-4 py-3 font-mono text-sm text-slate-700 dark:text-slate-300 max-w-[200px] truncate",children:e.error_type}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-500 dark:text-slate-400 font-mono max-w-[220px] truncate",children:e.route||"β€”"}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:Ta(e.last_seen)}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:Ta(e.first_seen)}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("button",{className:"text-xs text-blue-500 hover:underline",onClick:()=>s(e.sample_id),children:"View sample"})})]}),RA=({issue:e})=>t.jsxs("tr",{className:"border-b border-slate-100 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors",children:[t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.75rem] h-6 px-1.5 rounded-full bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 text-xs font-bold",children:e.count})}),t.jsx("td",{className:"px-4 py-3 font-mono text-sm text-slate-700 dark:text-slate-300 max-w-[200px] truncate",children:e.node_type}),t.jsx("td",{className:"px-4 py-3 text-xs text-amber-600 dark:text-amber-400 font-medium",children:"pipeline"}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:e.last_seen?Ta(e.last_seen):"β€”"}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:e.first_seen?Ta(e.first_seen):"β€”"}),t.jsx("td",{className:"px-4 py-3"})]}),TA=({grouped:e,pipelineIssues:s,handleViewSample:r})=>e.length===0&&s.length===0?t.jsx(os,{icon:t.jsx(ri,{size:40,className:"text-slate-300"}),title:"No open issues",description:"All errors have been resolved, or none have been recorded yet."}):t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 overflow-hidden",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"text-left text-xs text-slate-500 dark:text-slate-400 bg-slate-50 dark:bg-slate-900/50 border-b border-slate-200 dark:border-slate-700",children:[t.jsx("th",{className:"px-4 py-3",children:"Count"}),t.jsx("th",{className:"px-4 py-3",children:"Type"}),t.jsx("th",{className:"px-4 py-3",children:"Route"}),t.jsx("th",{className:"px-4 py-3",children:"Last seen"}),t.jsx("th",{className:"px-4 py-3",children:"First seen"}),t.jsx("th",{className:"px-4 py-3"})]})}),t.jsxs("tbody",{children:[s.map((a,n)=>t.jsx(RA,{issue:a},`pi-${n}`)),e.map((a,n)=>t.jsx(EA,{issue:a,onViewSample:r},n))]})]})}),Cd=({id:e,label:s})=>{const[r,a]=p.useState(!1),n=p.useCallback(async()=>{try{await navigator.clipboard.writeText(String(e)),a(!0),window.setTimeout(()=>a(!1),1500)}catch{}},[e]);return t.jsxs("button",{type:"button",onClick:()=>void n(),className:"inline-flex items-center gap-1 text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200","aria-label":r?"Diagnostic ID copied":`Copy ${s}`,title:r?"Copied":`Copy ${s}`,children:[r?t.jsx(Ie,{size:12}):t.jsx(Dn,{size:12}),t.jsx("span",{className:"font-mono",children:e})]})},so=({jobId:e,nodeId:s,pipelineId:r,origin:a,timeRange:n,filters:o})=>e?t.jsx(rr,{recordRef:{kind:"job",jobId:e},origin:a,timeRange:n,filters:o}):s?t.jsx(Uh,{nodeId:s,pipelineId:r??null,origin:a,filters:o}):r?t.jsx(rr,{recordRef:{kind:"pipeline",pipelineId:r},origin:a,timeRange:n,filters:o}):t.jsx("span",{className:"text-xs text-slate-400 italic",children:"No target available"}),MA=({event:e,onClose:s,origin:r,timeRange:a,filters:n})=>t.jsx(t.Fragment,{children:t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:s,children:t.jsxs("div",{className:"relative bg-slate-900 text-slate-100 rounded-xl shadow-2xl w-full max-w-4xl max-h-[80vh] flex flex-col",onClick:o=>o.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-700",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ri,{size:18,className:"text-red-400"}),t.jsx("span",{className:"font-semibold text-sm",children:e.error_type}),t.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-mono ${Sf(e.status_code)}`,children:e.status_code}),t.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-semibold ${Sd(e.severity)}`,children:Ai[e.severity]})]}),t.jsx("button",{onClick:s,className:"text-slate-400 hover:text-white transition-colors",children:t.jsx(Ee,{size:18})})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4 px-5 py-3 border-b border-slate-700 text-xs text-slate-400",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(ub,{size:12}),e.route||"β€”"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(_t,{size:12}),new Date(e.created_at).toLocaleString()]}),e.job_id&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wc,{size:12}),"job: ",e.job_id]}),t.jsx(Cd,{id:e.id,label:"diagnostic ID"}),t.jsx(so,{jobId:e.job_id,origin:r,timeRange:a,filters:n})]}),t.jsx("div",{className:"px-5 py-3 border-b border-slate-700",children:t.jsx("p",{className:"text-sm text-slate-200",children:e.message})}),t.jsx("div",{className:"flex-1 overflow-auto px-5 py-4",children:e.traceback?t.jsx("pre",{className:"text-xs font-mono text-slate-300 whitespace-pre-wrap leading-relaxed",children:e.traceback}):t.jsx("p",{className:"text-xs text-slate-500 italic",children:"No traceback recorded."})})]})})}),PA=({event:e,onExpand:s,onResolve:r,origin:a,timeRange:n,filters:o})=>{const[i,l]=p.useState(!1),c=!!e.resolved_at;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:`border-b border-slate-100 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors cursor-pointer ${c?"opacity-50":""}`,onClick:()=>l(d=>!d),children:[t.jsx("td",{className:"px-4 py-3 w-8 text-slate-400",children:i?t.jsx(Ce,{size:14}):t.jsx(tt,{size:14})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-semibold whitespace-nowrap ${Sd(e.severity)}`,children:Ai[e.severity]})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`text-xs font-mono px-2 py-0.5 rounded font-semibold ${Sf(e.status_code)}`,children:e.status_code})}),t.jsx("td",{className:`px-4 py-3 font-mono text-sm text-slate-700 dark:text-slate-300 max-w-[200px] truncate ${c?"line-through":""}`,children:e.error_type}),t.jsx("td",{className:"px-4 py-3 text-sm text-slate-600 dark:text-slate-400 max-w-[300px] truncate",children:e.message}),t.jsx("td",{className:"px-4 py-3 text-xs",onClick:d=>d.stopPropagation(),children:t.jsx(so,{jobId:e.job_id,origin:a,timeRange:n,filters:o})}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:Ta(e.created_at)}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsx(DA,{event:e,onResolve:r}),t.jsx("button",{className:"text-xs text-blue-500 hover:underline",onClick:d=>{d.stopPropagation(),s(e)},children:"Traceback"})]})})]}),i&&t.jsx($A,{event:e,origin:a,timeRange:n,filters:o})]})},IA={error:"critical",warning:"warning",info:"info"},AA=({log:e,origin:s,timeRange:r,filters:a})=>{const[n,o]=p.useState(!1),i=e.level==="error",l=IA[e.level]??"info";return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:"border-b border-slate-100 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800/50 transition-colors cursor-pointer",onClick:()=>o(c=>!c),children:[t.jsx("td",{className:"px-4 py-3 w-8 text-slate-400",children:n?t.jsx(Ce,{size:14}):t.jsx(tt,{size:14})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`text-xs px-2 py-0.5 rounded font-semibold whitespace-nowrap ${Sd(l)}`,children:Ai[l]})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`text-xs font-mono px-2 py-0.5 rounded font-semibold ${i?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"}`,children:i?"FAIL":"WARN"})}),t.jsx("td",{className:"px-4 py-3 font-mono text-sm text-slate-700 dark:text-slate-300 max-w-[200px] truncate",children:e.node_type??"pipeline"}),t.jsx("td",{className:"px-4 py-3 text-sm text-slate-600 dark:text-slate-400 max-w-[300px] truncate",children:e.message}),t.jsx("td",{className:"px-4 py-3 text-xs",onClick:c=>c.stopPropagation(),children:t.jsx(so,{nodeId:e.node_id,pipelineId:e.pipeline_id,origin:s,timeRange:r,filters:a})}),t.jsx("td",{className:"px-4 py-3 text-xs text-slate-400 whitespace-nowrap",children:e.run_at?t.jsx("span",{title:Ta(e.run_at),children:vA(e.run_at)}):"β€”"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400",children:"pipeline"})})]}),n&&t.jsx(FA,{log:e,origin:s,timeRange:r,filters:a})]})},$A=({event:e,origin:s,timeRange:r,filters:a})=>{const n=!!e.resolved_at;return t.jsx("tr",{className:"bg-slate-50 dark:bg-slate-800/40",children:t.jsxs("td",{colSpan:8,className:"px-6 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3 text-slate-500 dark:text-slate-400",children:[t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Route:"})," ",e.route||"β€”"]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Time:"})," ",new Date(e.created_at).toLocaleString()]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Diagnostic ID:"})," ",t.jsx(Cd,{id:e.id,label:"diagnostic ID"})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Target:"})," ",t.jsx(so,{jobId:e.job_id,origin:s,timeRange:r,filters:a})]}),n&&e.resolved_at&&t.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[t.jsx("strong",{children:"Resolved:"})," ",new Date(e.resolved_at).toLocaleString()]})]}),e.traceback?t.jsxs("pre",{className:"text-xs font-mono bg-slate-900 text-slate-200 rounded-lg p-4 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:[e.traceback.slice(0,800),e.traceback.length>800?` -…(click Traceback for full output)`:""]}):t.jsx("p",{className:"text-xs text-slate-400 italic",children:"No traceback recorded."})]})})},FA=({log:e,origin:s,timeRange:r,filters:a})=>t.jsx("tr",{className:"bg-slate-50 dark:bg-slate-800/40",children:t.jsxs("td",{colSpan:8,className:"px-6 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3 text-slate-500 dark:text-slate-400",children:[e.node_id&&t.jsxs("span",{children:[t.jsx("strong",{children:"Node ID:"})," ",e.node_id]}),e.pipeline_id&&t.jsxs("span",{children:[t.jsx("strong",{children:"Pipeline:"})," ",e.pipeline_id]}),e.run_at&&t.jsxs("span",{children:[t.jsx("strong",{children:"Time:"})," ",new Date(e.run_at).toLocaleString()]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Diagnostic ID:"})," ",t.jsx(Cd,{id:e.id,label:"diagnostic ID"})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Target:"})," ",t.jsx(so,{nodeId:e.node_id,pipelineId:e.pipeline_id,origin:s,timeRange:r,filters:a})]})]}),t.jsx("pre",{className:"text-xs font-mono bg-slate-900 text-slate-200 rounded-lg p-4 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:e.message})]})}),DA=({event:e,onResolve:s})=>{const r=!!e.resolved_at;return t.jsx("button",{className:`text-xs font-medium px-2 py-0.5 rounded border transition-colors ${r?"border-green-300 dark:border-green-700 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20":"border-slate-200 dark:border-slate-600 text-slate-500 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-700"}`,title:r?"Reopen":"Mark resolved",onClick:a=>{a.stopPropagation(),s(e)},children:r?"↩ Reopen":"βœ“ Resolve"})},LA=({events:e,pipelineLogs:s,hasActiveFilters:r,eventsTotalUnfiltered:a,operationalTimeRange:n,linkFilters:o,setModal:i,handleResolve:l})=>e.length===0&&s.length===0?t.jsx(os,{icon:t.jsx(ri,{size:40,className:"text-slate-300"}),title:r?"No matching errors":"No errors recorded",description:r?a===0?"No error events have been recorded yet β€” nothing to search or filter.":`No events match the current search/facets out of ${a} recorded. Try widening the time range or clearing a facet.`:"Any unhandled 5xx or failed pipeline will appear here automatically."}):t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 overflow-hidden",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"text-left text-xs text-slate-500 dark:text-slate-400 bg-slate-50 dark:bg-slate-900/50 border-b border-slate-200 dark:border-slate-700",children:[t.jsx("th",{className:"px-4 py-3 w-8"}),t.jsx("th",{className:"px-4 py-3",children:"Severity"}),t.jsx("th",{className:"px-4 py-3",children:"Code"}),t.jsx("th",{className:"px-4 py-3",children:"Type"}),t.jsx("th",{className:"px-4 py-3",children:"Message"}),t.jsx("th",{className:"px-4 py-3",children:"Target"}),t.jsx("th",{className:"px-4 py-3",children:"When"}),t.jsx("th",{className:"px-4 py-3"})]})}),t.jsxs("tbody",{children:[s.map(c=>t.jsx(AA,{log:c,origin:"/errors",timeRange:n,filters:o},`pl-${c.id}`)),e.map(c=>t.jsx(PA,{event:c,onExpand:i,onResolve:l,origin:"/errors",timeRange:n,filters:o},c.id))]})]})}),OA=({page:e})=>e.loading?t.jsx(Rs,{message:"Loading error events…"}):e.error?t.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-xl text-amber-700 dark:text-amber-400 text-sm",children:[t.jsx(Te,{size:16}),e.error]}):e.view==="issues"?t.jsx(TA,{...e}):t.jsx(LA,{...e}),zA=()=>{const e=NA();return t.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[t.jsx(kA,{...e}),t.jsx(SA,{...e}),t.jsx(_A,{...e}),t.jsx(CA,{...e}),t.jsx(OA,{page:e}),e.modal&&t.jsx(MA,{event:e.modal,onClose:()=>e.setModal(null),origin:"/errors",timeRange:e.operationalTimeRange,filters:e.linkFilters})]})},BA=p.lazy(()=>cr(()=>import("./EDAPage-CC9tylrM.js"),__vite__mapDeps([5,2,1,3,6,7,8])).then(e=>({default:e.EDAPage}))),VA=p.lazy(()=>cr(()=>import("./DataDriftPage-FTzER2c0.js"),__vite__mapDeps([9,2,1,3,6])).then(e=>({default:e.DataDriftPage}))),UA=p.lazy(()=>cr(()=>import("./ModelRegistry-8Pg2diG_.js"),__vite__mapDeps([10,2,1,3])).then(e=>({default:e.ModelRegistry}))),HA=p.lazy(()=>cr(()=>import("./DeploymentsPage-BJQ6Vxf0.js"),__vite__mapDeps([11,2,1,3])).then(e=>({default:e.DeploymentsPage}))),WA=p.lazy(()=>cr(()=>import("./SlowNodesPage-ixEyO8cV.js"),__vite__mapDeps([12,2,1,3])).then(e=>({default:e.SlowNodesPage}))),GA=p.lazy(()=>cr(()=>import("./AuditLogPage-Dyr3ReJ0.js"),__vite__mapDeps([13,2,1,3])).then(e=>({default:e.AuditLogPage}))),qA=()=>t.jsx(Fh,{}),Xr=({children:e})=>t.jsx(Gc,{children:t.jsx(p.Suspense,{fallback:t.jsx(qA,{}),children:e})});function KA(){return t.jsx(qv,{children:t.jsx(wv,{children:t.jsxs(vt,{path:"/",element:t.jsx(Lj,{}),children:[t.jsx(vt,{index:!0,element:t.jsx(vw,{})}),t.jsx(vt,{path:"jobs",element:t.jsx(mA,{})}),t.jsx(vt,{path:"data",element:t.jsx(Kw,{})}),t.jsx(vt,{path:"eda",element:t.jsx(Xr,{children:t.jsx(BA,{})})}),t.jsx(vt,{path:"drift",element:t.jsx(Xr,{children:t.jsx(VA,{})})}),t.jsx(vt,{path:"canvas",element:t.jsx(dA,{})}),t.jsx(vt,{path:"registry",element:t.jsx(Xr,{children:t.jsx(UA,{})})}),t.jsx(vt,{path:"deployments",element:t.jsx(Xr,{children:t.jsx(HA,{})})}),t.jsx(vt,{path:"errors",element:t.jsx(zA,{})}),t.jsx(vt,{path:"slow-nodes",element:t.jsx(Xr,{children:t.jsx(WA,{})})}),t.jsx(vt,{path:"audit",element:t.jsx(Xr,{children:t.jsx(GA,{})})})]})})})}const Tr=e=>e&&typeof e=="object"?e:null,JA=e=>{const s=Tr(e),r=s==null?void 0:s.sample;if(!s||!Array.isArray(r)||r.length===0)return t.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No data available"});const a=Tr(r[0])??{},n=Object.keys(a),{name:o,rows:i,colsCount:l}=XA(s),c=r.slice(0,20);return t.jsxs("div",{className:"overflow-x-auto rounded border border-border max-h-72",children:[t.jsxs("div",{className:"text-xs font-semibold mb-1 flex justify-between p-2 bg-muted/50 border-b border-border sticky top-0 z-10",children:[t.jsx("span",{children:o}),t.jsxs("span",{className:"text-muted-foreground",children:[i??"?"," rows x ",l??n.length," cols",c.lengtht.jsx("th",{className:"p-2 border-b border-r border-border text-left font-medium text-muted-foreground last:border-r-0 whitespace-nowrap",children:d},d))})}),t.jsx("tbody",{children:c.map((d,u)=>t.jsx("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20",children:n.map(m=>{var h;return t.jsx("td",{className:"p-2 border-r border-border truncate max-w-[120px] last:border-r-0",children:String(((h=Tr(d))==null?void 0:h[m])??"")},m)})},u))})]})]})},YA=({config:e,onChange:s,nodeId:r})=>{var E;const{nodes:a,edges:n}=V(Qc(T=>({nodes:T.nodes,edges:T.edges}))),[o,i]=p.useState(!1),[l,c]=p.useState(null),[d,u]=p.useState(null),m=p.useMemo(()=>e.lastRunJobIds&&e.lastRunJobIds.length>0?e.lastRunJobIds:e.lastRunJobId?[e.lastRunJobId]:[],[e.lastRunJobIds,e.lastRunJobId]),h=p.useMemo(()=>!r||m.length<=1?[]:n.filter(S=>S.target===r).map((S,P)=>{const I=String.fromCharCode(65+P),A=a.find(z=>z.id===S.source),B=(A==null?void 0:A.data)??{},F=B.label||B.title||(typeof B.definitionType=="string"?B.definitionType.replace(/_/g," ").replace(/\b\w/g,z=>z.toUpperCase()):"");return F?`Path ${I} Β· ${F}`:`Path ${I}`}),[a,n,r,m.length]),{jobs:x}=fd(m,{intervalMs:2e3}),f=async()=>{var S;if(!r)return;be.getState().setLeakageNotice(null);const T=Ca(a,n);i(!0);try{const P=Ms(a,n);if(Kc(P))return;const I=await Re.runPipeline({...P,target_node_id:r,job_type:"preview"}),A=(S=I.job_ids)!=null&&S.length?I.job_ids:[I.job_id];c(null),u(null),s({...e,lastRunJobId:A[0],lastRunJobIds:A})}catch(P){console.error("Failed to run preview:",P);const I=Sn(P);I&&be.getState().setLeakageNotice({message:I,graphSignature:T}),le.error("Failed to start preview job",I??void 0)}finally{i(!1)}},g=p.useMemo(()=>m.map((T,S)=>({label:h[S]||(m.length>1?`Path ${String.fromCharCode(65+S)}`:"Result"),jobId:T,job:x[T]})),[m,h,x]),b=p.useMemo(()=>dd(g.length),[g.length]);p.useEffect(()=>{g.length>0?(!l||!g.some(T=>T.label===l))&&c(g[0].label):l!==null&&c(null)},[g,l]);const y=g.find(T=>T.label===l)||g[0],v=y==null?void 0:y.job,j=((E=v==null?void 0:v.result)==null?void 0:E.metrics)??(v==null?void 0:v.result),w=Tr(j),N=w?Tr(w.data_summary):null,k=w==null?void 0:w.operation_mode,_=typeof k=="string"?k:void 0,R=p.useMemo(()=>N?["train","test","validation","full"].filter(T=>N[T]):[],[N]);p.useEffect(()=>{if(R.length===0){d!==null&&u(null);return}(!d||!R.includes(d))&&u(R[0]??null)},[R,d]);const M=p.useMemo(()=>{if(g.length===0)return"idle";const T=g.map(S=>{var P;return(P=S.job)==null?void 0:P.status});return T.some(S=>S==="failed")?"failed":T.every(S=>S==="completed")?"completed":"running"},[g]);return t.jsxs("div",{className:"p-4 space-y-4 h-full overflow-y-auto",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:"Connect this node to any data output to inspect the data state, schema, and applied transformations. Connecting two or more upstream paths shows each one in its own tab."}),t.jsxs("button",{onClick:()=>{f()},disabled:o,className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-[#38bdf8] via-[#6366f1] to-[#a855f7] text-white px-3 py-1.5 rounded-md hover:opacity-90 disabled:opacity-50 transition-all text-xs font-medium shadow-md",children:[o?t.jsx(at,{size:14,className:"animate-spin"}):t.jsx(ms,{size:14}),o?"Running...":"Run Preview"]}),t.jsx(ZA,{jobIds:m,aggregateStatus:M,branchResults:g}),M!=="idle"&&j&&t.jsx(e$,{branchResults:g,activeBranch:l,branchColors:b,setActiveBranch:c,setActiveTab:u,operationModeText:_,dataSummary:N,splitTabs:R,activeTab:d,activeJob:v,resultRec:w})]})},QA=({data:e})=>{const s=p.useMemo(()=>e.lastRunJobIds&&e.lastRunJobIds.length>0?e.lastRunJobIds:e.lastRunJobId?[e.lastRunJobId]:[],[e.lastRunJobId,e.lastRunJobIds]),{aggregateStatus:r}=fd(s,{intervalMs:5e3}),a=r==="idle"?null:r,n=s.length>0;return t.jsx("div",{className:"text-xs flex items-center gap-2",children:n?a==="completed"?t.jsxs("span",{className:"text-green-600 dark:text-green-400 font-medium flex items-center gap-1",children:[t.jsx(Ut,{size:12})," Ready"]}):a==="failed"?t.jsxs("span",{className:"text-red-600 dark:text-red-400 font-medium flex items-center gap-1",children:[t.jsx($t,{size:12})," Failed"]}):t.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-medium flex items-center gap-1",children:[t.jsx(at,{size:12,className:"animate-spin"})," Running"]}):t.jsx("span",{className:"text-muted-foreground italic",children:"Not run yet"})})};function XA(e){const s=typeof e.name=="string"?e.name:"Dataset",r=Array.isArray(e.shape)?e.shape:null,a=r&&r.length>0?r[0]:void 0,n=r&&r.length>1?r[1]:void 0;return{name:s,rows:a,colsCount:n}}function ZA({jobIds:e,aggregateStatus:s,branchResults:r}){return e.length>0&&s!=="completed"&&t.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2 p-2 bg-muted/30 rounded border border-border",children:[t.jsx("span",{children:"Status:"}),t.jsx("span",{className:`ml-auto font-medium px-1.5 py-0.5 rounded text-[10px] ${s==="failed"?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,children:s}),r.length>1&&t.jsxs("span",{className:"text-[10px] opacity-80",children:[r.filter(a=>{var n;return((n=a.job)==null?void 0:n.status)==="completed"}).length,"/",r.length," branches"]})]})}function e$({branchResults:e,activeBranch:s,branchColors:r,setActiveBranch:a,setActiveTab:n,operationModeText:o,dataSummary:i,splitTabs:l,activeTab:c,activeJob:d,resultRec:u}){return t.jsxs("div",{className:"space-y-3 border-t border-border pt-4 animate-in fade-in slide-in-from-top-2 duration-300",children:[e.length>1&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border pb-1",children:[t.jsx(ds,{size:12,className:"text-muted-foreground mr-1"}),e.map((m,h)=>{var g;const x=s===m.label,f=(g=m.job)==null?void 0:g.status;return t.jsxs("button",{onClick:()=>{a(m.label),n(null)},className:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium rounded-md border transition-colors ${x?"bg-background text-foreground border-border":"bg-muted/30 text-muted-foreground hover:bg-muted/50 border-transparent"}`,title:f?`${m.label} β€” ${f}`:m.label,children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:r[h]}}),m.label,f==="failed"&&t.jsx($t,{size:10,className:"text-red-500"}),f==="completed"&&t.jsx(Ut,{size:10,className:"text-green-500"}),f&&f!=="completed"&&f!=="failed"&&t.jsx(at,{size:10,className:"animate-spin"})]},m.label)})]}),t.jsxs("div",{className:"text-[10px] bg-blue-50 dark:bg-blue-950/30 text-blue-700 dark:text-blue-300 p-2 rounded border border-blue-100 dark:border-blue-900/50",children:[t.jsx("strong",{className:"block mb-0.5",children:"Operation Mode"}),o||"Unknown"]}),t.jsx(t$,{dataSummary:i,splitTabs:l,activeTab:c,setActiveTab:n}),(d==null?void 0:d.status)==="failed"&&t.jsxs("div",{className:"text-[10px] bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-400 p-2 rounded border border-red-100 dark:border-red-900/50",children:[t.jsx("strong",{className:"block mb-0.5",children:"Branch failed"}),t.jsx("span",{className:"font-mono whitespace-pre-wrap",children:d.error||"Unknown error"})]}),t.jsx(s$,{resultRec:u})]})}function t$({dataSummary:e,splitTabs:s,activeTab:r,setActiveTab:a}){return e&&s.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex border-b border-border",children:s.map(n=>t.jsx("button",{className:`text-[10px] px-3 py-1.5 border-b-2 transition-colors ${r===n?"border-primary font-medium text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>{a(n)},children:n.charAt(0).toUpperCase()+n.slice(1)},n))}),r&&e[r]?JA(e[r]):t.jsxs("div",{className:"text-xs text-muted-foreground p-4 text-center border border-dashed border-border rounded",children:["No ",r??"data"," available"]})]})}function s$({resultRec:e}){return Array.isArray(e==null?void 0:e.applied_transformations)&&e.applied_transformations.length>0&&t.jsxs("div",{className:"pt-2 border-t border-border",children:[t.jsx("div",{className:"text-[10px] font-semibold mb-2 text-foreground",children:"Applied Steps"}),t.jsx("div",{className:"space-y-1.5",children:e.applied_transformations.map((s,r)=>{var a,n;return t.jsxs("div",{className:"text-[10px] flex items-center gap-2 text-muted-foreground p-1.5 bg-muted/30 rounded border border-border",children:[t.jsx("span",{className:"w-4 h-4 rounded-full bg-muted flex items-center justify-center text-[8px] font-medium text-foreground",children:r+1}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium text-foreground",children:String(((a=Tr(s))==null?void 0:a.transformer_name)??"")}),t.jsx("span",{className:"text-[9px] opacity-80",children:String(((n=Tr(s))==null?void 0:n.transformer_type)??"")})]})]},r)})})]})}const r$={type:"data_preview",label:"Data Preview",category:"Evaluation",description:"Inspect data state and transformations at this point.",icon:Vp,inputs:[{id:"in",label:"Input Data",type:"any"}],outputs:[],component:QA,settings:YA,validate:()=>({isValid:!0}),getDefaultConfig:()=>({})},Me=e=>li({queryKey:["dataset-schema",e],queryFn:()=>gj(e),enabled:!!e,staleTime:1e3*60*5,retry:(s,r)=>{var o;const a=(o=r==null?void 0:r.response)==null?void 0:o.status;return a!==void 0&&a>=500&&s<3}}),a$=({config:e,onChange:s})=>{const r=p.useId(),[a,n]=p.useState(!1),o=p.useRef(null),i=p.useRef(null),l=p.useRef(null);gs(g=>{g==="datasetId"&&n(!1)});const{data:c,isLoading:d}=Me(e.datasetId),u=kw(),m=u.data??[],h=u.isLoading;p.useEffect(()=>{if(!a&&l.current){const g=l.current==="dataset"?i.current:o.current;g&&(l.current=null,g.focus())}},[a,h]);const x=g=>{const b=g.target.value,y=m.find(v=>String(v.id)===b);s({...e,datasetId:b,datasetName:y==null?void 0:y.name})},f=(g,b)=>{l.current="dataset",n(!1),s({...e,datasetId:g,datasetName:b})};return a?t.jsx(Jh,{onUploadComplete:f,onCancel:()=>{l.current="opener",n(!1)}}):t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("label",{htmlFor:r,className:"block text-sm font-medium",children:"Select Dataset"}),t.jsxs("button",{ref:o,onClick:()=>{n(!0)},className:"text-xs flex items-center gap-1 text-link hover:underline font-medium focus-ring",children:[t.jsx(Es,{size:14}),"New Upload"]})]}),t.jsx(ce,{field:"datasetId",children:h?t.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading datasets..."}):t.jsxs("select",{ref:i,id:r,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.datasetId||"",onChange:x,children:[t.jsx("option",{value:"",children:"-- Select --"}),m.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))]})})]}),e.datasetId&&t.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[t.jsx(mb,{size:14}),t.jsx("span",{children:"Dataset Schema"})]}),d?t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."}):c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border rounded-md bg-muted/10 max-h-60 overflow-auto",children:t.jsxs("table",{className:"w-full text-xs text-left min-w-max",children:[t.jsx("thead",{className:"bg-muted/20 sticky top-0 z-10",children:t.jsxs("tr",{children:[t.jsx("th",{className:"p-2 font-medium border-b bg-muted/20",children:"Column"}),t.jsx("th",{className:"p-2 font-medium border-b bg-muted/20",children:"Type"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Missing"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Unique"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Min"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Max"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Mean"})]})}),t.jsx("tbody",{children:Object.values(c.columns).map(g=>t.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/20",children:[t.jsx("td",{className:"p-2 font-mono font-medium whitespace-nowrap",children:g.name}),t.jsx("td",{className:"p-2 text-muted-foreground whitespace-nowrap",children:g.dtype}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.missing_count}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.unique_count}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.min_value!==void 0?Number(g.min_value).toFixed(2):"-"}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.max_value!==void 0?Number(g.max_value).toFixed(2):"-"}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.mean_value!==void 0?Number(g.mean_value).toFixed(2):"-"})]},g.name))})]})}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1 text-center italic",children:"Expand node to see full details"})]}):t.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No schema available."})]})]})},n$=({data:e})=>{const[s,r]=p.useState(void 0);p.useEffect(()=>{e.datasetId&&!e.datasetName&&s===void 0&&Wt.getById(e.datasetId).then(n=>{r(n.name)}).catch(()=>{r(e.datasetId)})},[e.datasetId,e.datasetName,s]);const a=e.datasetName||s||e.datasetId;return t.jsx("div",{className:"text-xs",children:e.datasetId?t.jsx("div",{className:"font-medium truncate max-w-[150px]",title:a,children:a||"Loading..."}):t.jsx("div",{className:"text-muted-foreground italic",children:"Select a dataset"})})},o$={type:"dataset_node",label:"Dataset",category:"Data Source",description:"Load a dataset from the registry.",icon:Ct,inputs:[],outputs:[{id:"data",label:"Data",type:"dataset"}],settings:a$,component:n$,validate:e=>({isValid:!!e.datasetId,message:e.datasetId?void 0:"Dataset is required",field:e.datasetId?void 0:"datasetId"}),getDefaultConfig:()=>({datasetId:""})},Cf=(e,s,r,a=new Set)=>{var o;if(a.has(e.id))return;if(a.add(e.id),(o=e.data)!=null&&o.datasetId)return e.data.datasetId;const n=Kt(e,s,r);for(const i of n){const l=Cf(i,s,r,a);if(l)return l}},Be=e=>{const s=V(a=>a.nodes),r=V(a=>a.edges);return p.useMemo(()=>{const a=s.find(o=>o.id===e);return a?Kt(a,s,r).map(o=>{const i=Cf(o,s,r);return i&&!o.data.datasetId?{...o.data,datasetId:i}:o.data}):[]},[e,s,r])};function Ef(e,s,r,a=new Set){var o;if(a.has(e.id))return new Set;a.add(e.id);const n=new Set;((o=e.data)==null?void 0:o.definitionType)==="drop_missing_columns"&&Array.isArray(e.data.columns)&&e.data.columns.forEach(i=>n.add(i));for(const i of Kt(e,s,r))Ef(i,s,r,a).forEach(l=>n.add(l));return n}function Je(e){const s=V(a=>a.nodes),r=V(a=>a.edges);return p.useMemo(()=>{if(!e)return new Set;const a=s.find(o=>o.id===e);if(!a)return new Set;const n=new Set;for(const o of Kt(a,s,r))Ef(o,s,r).forEach(i=>n.add(i));return n},[e,s,r])}const Ja=(e,s={})=>{var o;const a=(o=Be(e).find(i=>i.datasetId))==null?void 0:o.datasetId,n=V(i=>i.executionResult);return p.useMemo(()=>!a||!(n!=null&&n.recommendations)?[]:n.recommendations.filter(i=>{var l,c;if(s.types||s.suggestedNodeTypes){const d=(l=s.types)==null?void 0:l.includes(i.type),u=(c=s.suggestedNodeTypes)==null?void 0:c.includes(i.suggested_node_type);if(!d&&!u)return!1}return!(s.scope==="column"&&(!i.target_columns||i.target_columns.length===0))}),[n,a,s.types,s.suggestedNodeTypes,s.scope])},Vr=({recommendations:e,onApply:s,className:r=""})=>!e||e.length===0?null:t.jsxs("div",{className:`bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded-md p-3 ${r}`,children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-blue-800 dark:text-blue-300 font-medium text-sm",children:[t.jsx(qp,{className:"w-4 h-4"}),t.jsx("span",{children:"Recommendations"})]}),t.jsx("div",{className:"space-y-2",children:e.map(a=>t.jsx("div",{className:"bg-white dark:bg-slate-800 border border-blue-100 dark:border-blue-800/60 rounded p-2 text-sm shadow-sm hover:shadow-md transition-shadow",children:t.jsxs("div",{className:"flex justify-between items-start gap-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-gray-800 dark:text-slate-200 font-medium text-xs mb-1",children:a.type.replace("_"," ").toUpperCase()}),t.jsx("p",{className:"text-gray-600 dark:text-slate-400 text-xs leading-relaxed",children:a.description}),a.reasoning&&t.jsxs("p",{className:"text-gray-500 dark:text-slate-400 text-[10px] mt-1 italic",children:["Why: ",a.reasoning]})]}),s&&t.jsx("button",{onClick:()=>s(a),className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/30",title:"Apply Recommendation",children:t.jsx(Ut,{className:"w-5 h-5"})})]})},a.rule_id))})]});function Ma(e){return e&&typeof e=="object"?e:null}function Gm(e,s){const r=Ma(e[s]);return Ma(r==null?void 0:r.details)}function i$(e){const s=Ma(e);return Ma(s==null?void 0:s.steps)!==null}function Qt(e,s){const r=Ma(e);if(!r)return null;const a=Ma(r.steps);if(!a)return r;const n=Object.keys(a).filter(o=>Gm(a,o));return n.length!==1?null:Gm(a,n[0])}function Pe({columns:e,selected:s,onChange:r,label:a,"aria-label":n,variant:o="panel",showFooterCount:i=!1,isLoading:l=!1,emptyMessage:c="No columns available",single:d=!1,renderItemBadge:u,fillHeight:m=!0,className:h=""}){const[x,f]=p.useState(""),g=n??a??"Columns",b=e.filter(k=>k.toLowerCase().includes(x.toLowerCase())),y=k=>{if(d){r([k]);return}r(s.includes(k)?s.filter(_=>_!==k):[...s,k])},v=()=>{r(Array.from(new Set([...s,...b])))},j=()=>{r(s.filter(k=>!b.includes(k)))},w=o==="panel",N=w&&m;return t.jsxs("div",{role:"group","aria-label":g,className:`flex flex-col border rounded-md bg-background overflow-hidden ${l$(N,w)} ${h}`,children:[t.jsxs("div",{className:`border-b bg-muted/30 flex flex-col gap-2 shrink-0 ${w?"p-2":"p-1.5"}`,children:[t.jsx(c$,{label:a,isPanel:w,single:d,selectedCount:s.length,accessibleName:g,selectAll:v,selectNone:j}),t.jsxs("div",{className:"relative",children:[t.jsx(lr,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"}),t.jsx("input",{"aria-label":`Search ${g}`,type:"text",placeholder:"Search columns...",value:x,onChange:k=>{f(k.target.value)},className:"w-full text-xs pl-6 pr-2 py-1.5 border rounded bg-background outline-none focus:ring-1 focus:ring-primary focus:border-primary transition-all"})]})]}),t.jsx("div",{className:`overflow-y-auto p-1 space-y-0.5 ${N?"flex-1":w?"max-h-72":"max-h-40"}`,children:t.jsx(d$,{columns:e,filtered:b,selected:s,searchTerm:x,isLoading:l,emptyMessage:c,renderItemBadge:u,toggle:y})}),!w&&i&&t.jsxs("div",{className:"text-[10px] text-muted-foreground text-right px-2 py-1 border-t shrink-0",children:[s.length," selected"]})]})}function l$(e,s){return e?"h-full min-h-[200px]":s?"min-h-[160px]":""}function c$({label:e,isPanel:s,single:r,selectedCount:a,accessibleName:n,selectAll:o,selectNone:i}){const l=s&&!r;return t.jsx(t.Fragment,{children:(e??s)&&t.jsxs("div",{className:"flex items-center justify-between",children:[e&&t.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:[e,!r&&` (${a})`]}),l&&t.jsxs("div",{className:`flex gap-1 ${e?"":"ml-auto"}`,children:[t.jsx("button",{type:"button",onClick:o,"aria-label":`Select all matching ${n}`,className:"text-[10px] px-2 py-1 hover:bg-accent rounded text-muted-foreground hover:text-foreground transition-colors",children:"All"}),t.jsx("button",{type:"button",onClick:i,"aria-label":`Select none of the matching ${n}`,className:"text-[10px] px-2 py-1 hover:bg-accent rounded text-muted-foreground hover:text-foreground transition-colors",children:"None"})]})]})})}function d$({columns:e,filtered:s,selected:r,searchTerm:a,isLoading:n,emptyMessage:o,renderItemBadge:i,toggle:l}){return n?t.jsx("div",{className:"text-xs text-muted-foreground italic p-8 text-center",children:"Loading columns..."}):e.length===0?t.jsx("div",{className:"text-xs text-muted-foreground italic p-8 text-center",children:o}):s.length===0?t.jsxs("div",{className:"text-xs text-muted-foreground text-center py-8",children:['No columns match "',a,'"']}):s.map(c=>{const d=r.includes(c),u=i==null?void 0:i(c);return t.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs px-2 py-1.5 rounded cursor-pointer select-none transition-colors hover:bg-accent/50",children:[t.jsxs("span",{className:"flex items-center gap-2 overflow-hidden",children:[t.jsx("input",{type:"checkbox",checked:d,onChange:()=>{l(c)},className:"rounded border-gray-300 text-primary focus:ring-primary w-3.5 h-3.5 shrink-0"}),t.jsx("span",{className:"truncate font-mono",title:c,children:c})]}),u]},c)})}function st(e,s){const r=Number.parseInt(e,10);return Number.isNaN(r)?s??0:r}function Ve(e=450){const s=p.useRef(null),[r,a]=p.useState(!1);return p.useEffect(()=>{if(!s.current)return;const n=new ResizeObserver(o=>{for(const i of o)a(i.contentRect.width>e)});return n.observe(s.current),()=>{n.disconnect()}},[e]),[s,r]}function u$({metrics:e}){return e&&e.dropped_columns_count!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Columns Dropped:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.dropped_columns_count)})]}),Array.isArray(e.dropped_columns)&&e.dropped_columns.length>0&&t.jsxs("div",{className:"pt-1 border-t mt-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1",children:"Dropped Names:"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.dropped_columns.map(s=>{const r=String(s);return t.jsx("span",{className:"px-1.5 py-0.5 bg-background border rounded text-[10px] font-mono",children:r},r)})})]})]})]})}function m$({datasetId:e,isLoading:s}){return t.jsxs(t.Fragment,{children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function p$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-3 p-3 border rounded-md bg-muted/5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Missing Value Threshold"}),t.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Drop columns with >",e.missing_threshold??0,"% missing values"]})]}),t.jsxs("span",{className:"text-sm font-mono font-bold text-primary bg-primary/10 px-2 py-1 rounded",children:[e.missing_threshold??0,"%"]})]}),t.jsx("input",{"aria-label":"Missing Value Threshold",type:"range",min:"0",max:"100",step:"5",value:e.missing_threshold??0,onChange:r=>s({...e,missing_threshold:st(r.target.value,e.missing_threshold)}),className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary"})]})}const h$=({config:e,onChange:s,nodeId:r})=>{var b;const n=(b=Be(r||"").find(y=>y.datasetId))==null?void 0:b.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(y=>y.name).filter(y=>!l.has(y)):[],[o,l]),d=V(y=>y.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve(),f=Ja(r||"",{types:["cleaning","feature_selection"],suggestedNodeTypes:["DropMissingColumns"],scope:"column"}),g=y=>{var v;if((v=y.target_columns)!=null&&v.length){const j=Array.from(new Set([...e.columns,...y.target_columns]));s({...e,columns:j})}};return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:t.jsx(m$,{datasetId:n,isLoading:i})}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[f.length>0&&t.jsx("div",{className:"shrink-0",children:t.jsx(Vr,{recommendations:f,onApply:g})}),t.jsx(p$,{config:e,onChange:s}),t.jsx(u$,{metrics:m})]}),t.jsx("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:x?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:c,selected:e.columns,onChange:y=>{s({...e,columns:y})},label:"Explicitly Drop Columns",variant:"panel",isLoading:i,fillHeight:x})})})]})]})},x$={type:"drop_missing_columns",label:"Drop Columns",category:"Preprocessing",description:"Remove specific columns.",icon:gt,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Data",type:"dataset"}],settings:h$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.missing_threshold??0;return s>0&&r>0?`Drop ${s} cols Β· missing > ${r}%`:s>0?`Drop ${s} ${s===1?"col":"cols"}`:r>0?`Drop missing > ${r}%`:null},validate:e=>{var s,r;return{field:"columns",isValid:(((s=e.columns)==null?void 0:s.length)??0)>0||(e.missing_threshold??0)>0,message:(((r=e.columns)==null?void 0:r.length)??0)===0&&(!e.missing_threshold||e.missing_threshold===0)?"Select columns or set a threshold":void 0}},getDefaultConfig:()=>({columns:[],missing_threshold:0})};function g$(e){const s=e!=null&&e.fill_values&&typeof e.fill_values=="object"?e.fill_values:null,r=e!=null&&e.missing_counts&&typeof e.missing_counts=="object"?e.missing_counts:null;return{fillValues:s,missingCounts:r}}function f$(e){var m;const r=(m=Be(e||"").find(h=>h.datasetId))==null?void 0:m.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=p.useMemo(()=>a?Object.values(a.columns).map(h=>h.name).filter(h=>!o.has(h)):[],[a,o]),l=V(h=>h.executionResult),c=e?l==null?void 0:l.node_results[e]:null,d=Qt(c==null?void 0:c.metrics),u=Ja(e||"",{types:["imputation"],suggestedNodeTypes:["SimpleImputer","KNNImputer","IterativeImputer"],scope:"column"});return{datasetId:r,isLoading:n,availableColumns:i,nodeResult:c,metrics:d,recommendations:u,...g$(d)}}function b$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Imputation Method"}),t.jsxs("select",{"aria-label":"Imputation Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method||"simple",onChange:r=>s({...e,method:r.target.value}),children:[t.jsx("option",{value:"simple",children:"Simple Imputer (Univariate)"}),t.jsx("option",{value:"knn",children:"KNN Imputer (Multivariate)"}),t.jsx("option",{value:"iterative",children:"Iterative Imputer (MICE)"})]})]}),(e.method==="simple"||!e.method)&&t.jsx(y$,{config:e,onChange:s}),e.method==="knn"&&t.jsx(v$,{config:e,onChange:s}),e.method==="iterative"&&t.jsx(j$,{config:e,onChange:s})]})}function y$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Strategy"}),t.jsxs("select",{"aria-label":"Strategy",className:"w-full p-2 border rounded bg-background text-sm",value:e.strategy,onChange:r=>s({...e,strategy:r.target.value}),children:[t.jsx("option",{value:"mean",children:"Mean (Average)"}),t.jsx("option",{value:"median",children:"Median (Middle Value)"}),t.jsx("option",{value:"most_frequent",children:"Most Frequent (Mode)"}),t.jsx("option",{value:"constant",children:"Constant Value"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[e.strategy==="mean"&&"Replaces missing values with the mean of the column. (Numeric only)",e.strategy==="median"&&"Replaces missing values with the median. (Robust to outliers)",e.strategy==="most_frequent"&&"Replaces missing with the most common value. (Categorical/Numeric)",e.strategy==="constant"&&"Replaces missing values with a specific value."]})]}),e.strategy==="constant"&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Fill Value"}),t.jsx(ce,{field:"fill_value",children:t.jsx("input",{"aria-label":"Fill Value",type:"text",className:"w-full p-2 border rounded bg-background text-sm",value:e.fill_value||"",onChange:r=>s({...e,fill_value:r.target.value}),placeholder:"Enter value..."})})]})]})}function v$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Number of Neighbors"}),t.jsx("input",{"aria-label":"Number of Neighbors",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.n_neighbors||5,onChange:r=>s({...e,n_neighbors:st(r.target.value,e.n_neighbors)})})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Weights"}),t.jsxs("select",{"aria-label":"Weights",className:"w-full p-2 border rounded bg-background text-sm",value:e.weights||"uniform",onChange:r=>s({...e,weights:r.target.value}),children:[t.jsx("option",{value:"uniform",children:"Uniform"}),t.jsx("option",{value:"distance",children:"Distance"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Uniform: All points in each neighborhood are weighted equally. Distance: Weight points by the inverse of their distance."})]})]})}function j$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Max Iterations"}),t.jsx("input",{"aria-label":"Max Iterations",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.max_iter||10,onChange:r=>s({...e,max_iter:st(r.target.value,e.max_iter)})})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Estimator"}),t.jsxs("select",{"aria-label":"Estimator",className:"w-full p-2 border rounded bg-background text-sm",value:e.estimator||"bayesian_ridge",onChange:r=>s({...e,estimator:r.target.value}),children:[t.jsx("option",{value:"bayesian_ridge",children:"Bayesian Ridge"}),t.jsx("option",{value:"decision_tree",children:"Decision Tree"}),t.jsx("option",{value:"extra_trees",children:"Extra Trees"}),t.jsx("option",{value:"knn",children:"KNN"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"The estimator to use for the imputation steps."})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Random State"}),t.jsx("input",{"aria-label":"Random State",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.random_state??0,onChange:r=>s({...e,random_state:st(r.target.value,e.random_state)})})]})]})}function w$({datasetId:e,isLoading:s}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function N$({config:e,onChange:s,availableColumns:r,missingCounts:a,isLoading:n,isWide:o}){return t.jsx("div",{className:`flex flex-col overflow-hidden ${o?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:o?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:r,selected:e.columns,onChange:i=>{s({...e,columns:i})},label:"Target Columns",variant:"panel",isLoading:n,fillHeight:o,renderItemBadge:i=>a&&a[i]!==void 0?t.jsx("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0 bg-muted px-1.5 py-0.5 rounded",title:`${String(a[i])} missing values filled`,children:String(a[i])}):null})})})}function qm({metrics:e,fillValues:s,missingCounts:r,nodeResult:a}){return e?t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs",children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-2",children:"Execution Feedback"}),s&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Imputed Values:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 max-h-32 overflow-y-auto",children:Object.entries(s).map(([n,o])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:n,children:[n,":"]}),t.jsx("span",{className:"font-mono",children:typeof o=="number"?o.toFixed(4):String(o)})]},n))})]}),r&&t.jsxs("div",{className:"space-y-1 mt-2",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Missing Values Filled:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 max-h-32 overflow-y-auto",children:Object.entries(r).map(([n,o])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:n,children:[n,":"]}),t.jsx("span",{className:"font-mono",children:String(o)})]},n))}),e.total_missing!==void 0&&t.jsxs("div",{className:"text-[10px] text-muted-foreground mt-1 pt-1 border-t",children:["Total Filled: ",t.jsx("span",{className:"font-mono font-medium",children:String(e.total_missing)})]})]}),!s&&!r&&(a==null?void 0:a.status)==="success"&&t.jsx("div",{className:"text-green-600",children:"Imputation completed successfully."})]}):null}const k$=({config:e,onChange:s,nodeId:r})=>{const a=f$(r),{datasetId:n,isLoading:o,availableColumns:i,missingCounts:l,recommendations:c}=a,[d,u]=Ve(),m=h=>{if(h.target_columns.length>0){const x=Array.from(new Set([...e.columns,...h.target_columns]));s({...e,columns:x})}};return t.jsxs("div",{ref:d,className:`flex flex-col h-full w-full bg-background ${u?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(w$,{datasetId:n,isLoading:o}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${u?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${u?"overflow-y-auto pr-2":"shrink-0"}`,children:[c.length>0&&t.jsx("div",{className:"shrink-0",children:t.jsx(Vr,{recommendations:c,onApply:m})}),t.jsx(b$,{config:e,onChange:s}),u&&t.jsx(qm,{...a})]}),t.jsx(N$,{config:e,onChange:s,availableColumns:i,missingCounts:l,isLoading:o,isWide:u}),!u&&t.jsx(qm,{...a})]})]})},_$={type:"imputation_node",label:"Imputation",category:"Preprocessing",description:"Fill missing values.",icon:pb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Cleaned Data",type:"dataset"}],settings:k$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.strategy??e.method??"mean";return s===0?null:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:e=>e.columns.length===0?{isValid:!1,field:"columns",message:"Select at least one column"}:e.method==="simple"&&e.strategy==="constant"&&(e.fill_value===void 0||e.fill_value==="")?{isValid:!1,field:"fill_value",message:"Fill value is required for Constant strategy"}:{isValid:!0},getDefaultConfig:()=>({columns:[],method:"simple",strategy:"mean",fill_value:0,n_neighbors:5,weights:"uniform",max_iter:10,estimator:"bayesian_ridge",random_state:0})},S$=e=>({field:"columns",isValid:e.columns.length>0,message:e.columns.length===0?"Select at least one column":void 0});function C$(e){switch(e.method){case"standard":return"Target: ΞΌ β‰ˆ 0, Οƒ β‰ˆ 1";case"minmax":return`Target: ${e.feature_range_min??0} to ${e.feature_range_max??1}`;case"robust":return"Target: Median β‰ˆ 0, IQR β‰ˆ 1";case"maxabs":return"Target: MaxAbs = 1";default:return""}}function yl(e,s,r,a,n,o){const i=e[r]?e[r][s]:void 0,l=e[a]?e[a][s]:void 0;return typeof i!="number"?"":`${n}=${i.toFixed(2)}, ${o}=${typeof l=="number"?l.toFixed(2):"-"}`}function E$(e,s,r){switch(e.method){case"standard":return yl(s,r,"mean","scale","ΞΌ","Οƒ");case"minmax":return yl(s,r,"data_min","data_max","Min","Max");case"robust":return yl(s,r,"center","scale","Med","IQR");case"maxabs":{const a=s.max_abs?s.max_abs[r]:void 0;return typeof a=="number"?`MaxAbs=${a.toFixed(2)}`:""}default:return""}}function Km({config:e,metrics:s}){if(!s)return null;const r=s.columns;return r?t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs space-y-2",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("div",{className:"font-medium text-muted-foreground",children:"Scaling Statistics"}),t.jsx("div",{className:"text-[10px] text-primary/80 bg-primary/5 px-1.5 py-0.5 rounded border border-primary/10",title:"Values close to these targets indicate successful scaling.",children:C$(e)})]}),t.jsx("div",{className:"max-h-40 overflow-y-auto bg-background p-2 rounded border space-y-1",children:r.map((a,n)=>{const o=E$(e,s,n);return t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[100px] font-medium",title:a,children:a}),t.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:o})]},a)})})]}):null}function R$({config:e,onChange:s}){return t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Scaling Method"}),t.jsxs("select",{"aria-label":"Scaling Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method,onChange:r=>s({...e,method:r.target.value}),children:[t.jsx("option",{value:"standard",children:"Standard Scaler (Z-Score)"}),t.jsx("option",{value:"minmax",children:"MinMax Scaler (0-1)"}),t.jsx("option",{value:"maxabs",children:"MaxAbs Scaler"}),t.jsx("option",{value:"robust",children:"Robust Scaler (Outlier Safe)"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[e.method==="standard"&&"Centers data around 0 with unit variance.",e.method==="minmax"&&"Scales data to a fixed range [0, 1].",e.method==="maxabs"&&"Scales data by its maximum absolute value.",e.method==="robust"&&"Scales data using statistics that are robust to outliers."]})]})}function T$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_mean??!0,onChange:r=>s({...e,with_mean:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Center Data (with_mean)"})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_std??!0,onChange:r=>s({...e,with_std:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Scale Variance (with_std)"})]})]})}function M$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Feature Range"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("input",{"aria-label":"Feature Range Minimum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Min (0)",value:e.feature_range_min??0,onChange:r=>s({...e,feature_range_min:Number.parseFloat(r.target.value)})}),t.jsx("span",{className:"text-muted-foreground",children:"-"}),t.jsx("input",{"aria-label":"Feature Range Maximum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Max (1)",value:e.feature_range_max??1,onChange:r=>s({...e,feature_range_max:Number.parseFloat(r.target.value)})})]})]})}function P$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Quantile Range"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("input",{"aria-label":"Quantile Range Minimum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Min (25.0)",value:e.quantile_range_min??25,onChange:r=>s({...e,quantile_range_min:Number.parseFloat(r.target.value)})}),t.jsx("span",{className:"text-muted-foreground",children:"-"}),t.jsx("input",{"aria-label":"Quantile Range Maximum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Max (75.0)",value:e.quantile_range_max??75,onChange:r=>s({...e,quantile_range_max:Number.parseFloat(r.target.value)})})]}),t.jsxs("div",{className:"space-y-2 mt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_centering??!0,onChange:r=>s({...e,with_centering:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Center Data (Median)"})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_scaling??!0,onChange:r=>s({...e,with_scaling:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Scale Data (IQR)"})]})]})]})}function I$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsx(R$,{config:e,onChange:s}),e.method==="standard"&&t.jsx(T$,{config:e,onChange:s}),e.method==="minmax"&&t.jsx(M$,{config:e,onChange:s}),e.method==="robust"&&t.jsx(P$,{config:e,onChange:s})]})}function A$(e){var u;const r=(u=Be(e||"").find(m=>m.datasetId))==null?void 0:u.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=V(m=>m.executionResult),l=e?i==null?void 0:i.node_results[e]:null,c=Qt(l==null?void 0:l.metrics),d=a?Object.values(a.columns).filter(m=>["int","float","number"].some(h=>m.dtype.toLowerCase().includes(h))).filter(m=>!o.has(m.name)).map(m=>m.name):[];return{datasetId:r,isLoading:n,numericColumns:d,metrics:c}}const $$=({config:e,onChange:s,nodeId:r})=>{const{datasetId:a,isLoading:n,numericColumns:o,metrics:i}=A$(r),[l,c]=Ve();return t.jsxs("div",{ref:l,className:`flex flex-col h-full w-full bg-background ${c?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:!a&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."})}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${c?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${c?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(I$,{config:e,onChange:s}),c&&t.jsx(Km,{config:e,metrics:i})]}),t.jsx("div",{className:`flex flex-col overflow-hidden ${c?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:c?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:o,selected:e.columns,onChange:d=>{s({...e,columns:d})},label:"Numeric Columns",variant:"panel",isLoading:n,emptyMessage:"No numeric columns found",fillHeight:c})})}),!c&&t.jsx(Km,{config:e,metrics:i})]})]})},F$={type:"scale_numeric_features",label:"Scaling",category:"Preprocessing",description:"Scale numeric features to a standard range.",icon:hb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Scaled Data",type:"dataset"}],settings:$$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.method??"standard";return s===0?r:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:S$,getDefaultConfig:()=>({columns:[],method:"standard"})};function D$(e){const s=e.data,r=(s==null?void 0:s.datasetId)??(s==null?void 0:s.dataset_id);if(r)return r;const a=s==null?void 0:s.config,n=(a==null?void 0:a.datasetId)??(a==null?void 0:a.dataset_id);if(n)return n;const o=s==null?void 0:s.params;return(o==null?void 0:o.datasetId)??(o==null?void 0:o.dataset_id)}function L$(e,s){var o;const r=new Map(e.nodes.map(i=>[i.node_id,i])),a=new Set,n=[s];for(;n.length>0;){const i=n.pop();a.has(i)||(a.add(i),n.push(...((o=r.get(i))==null?void 0:o.inputs)??[]))}return e.nodes.filter(i=>a.has(i.node_id))}function Rf(e){return e==="tuning"?"Tuning":"Training"}function O$(e,s){const r=String(e.data.model_type||e.data.label||"selected model").replace(/_/g," ");return`${Rf(s)} β€” ${r}`}function z$(e,s){return s??(e instanceof Error&&e.message?e.message:"Check your connection and settings, then try again.")}function B$(e,s,r){if(!e)return;const a=new Set,n=[e];for(;n.length>0;){const o=n.shift();if(!o||a.has(o))continue;a.add(o);const i=s.find(l=>l.id===o);if(i){if(o!==e){const l=D$(i);if(l)return l}for(const l of Kt(i,s,r))n.push(l.id)}}}function Tf(e){var f;const s=V(g=>g.nodes),r=V(g=>g.edges),a=Be(e||""),{toggleDrawer:n,setTab:o,setActiveParallelRun:i,startPolling:l}=Ke(),c=Ke(g=>e?g.nodeSubmissions[e]:void 0),d=p.useMemo(()=>B$(e,s,r),[e,s,r]),{data:u}=Me(d),m=p.useMemo(()=>u?Object.values(u.columns):[],[u]),h=(f=a.find(g=>g.target_column))==null?void 0:f.target_column,x=p.useCallback(async(g,b)=>{var N,k;if(!e||(N=Ke.getState().nodeSubmissions[e])!=null&&N.pending)return;const y=s.find(_=>_.id===e);if(!y)return;const v=O$(y,g),j=_=>Ke.getState().setNodeSubmission(e,_);if(!d){j({pending:!1,run:null,message:`${v} blocked. Connect a dataset upstream and select a dataset.`});return}be.getState().setLeakageNotice(null);const w=Ca(s,r);j({pending:!0,run:null,message:`${v}: Submitting...`});try{const _=Ms(s,r),R=L$(_,e);if(Kc({nodes:R})){j({pending:!1,run:null,message:`${v} blocked. Move data-learning preprocessing after the train/test split.`});return}const M=await Re.runPipeline({..._,target_node_id:e,job_type:g}),E=(k=M.job_ids)!=null&&k.length?M.job_ids:[M.job_id],T=E.length;j({pending:!1,message:"",run:{label:v,jobIds:E}}),l(),T>1?(i({jobIds:M.job_ids,startedAt:new Date().toISOString()}),le.success("Parallel execution started",`${T} branches submitted.`)):le.success(`${Rf(g)} job submitted`),o(b),Ke.getState().setInspectedRun(null),n(!0)}catch(_){console.error("Failed to submit job:",_);const R=Sn(_);R&&be.getState().setLeakageNotice({message:R,graphSignature:w});const M=z$(_,R);j({pending:!1,run:null,message:`${v}: Submission failed. ${M}`}),le.error("Failed to submit job",M)}},[e,s,r,d,i,l,o,n]);return{availableColumns:m,upstreamTarget:h,datasetId:d,runJob:x,isSubmitting:(c==null?void 0:c.pending)??!1,submissionMessage:(c==null?void 0:c.message)??"",runFeedback:(c==null?void 0:c.run)??null}}const V$={classification:"classification",regression:"regression",text_classification:"text"},U$=(e,s)=>{if(!e.depends_on)return!0;const{param:r,value:a}=e.depends_on;return(s[r]??e.default)===a},H$=(e,s)=>{if(!e.depends_on)return!0;const{param:r,value:a}=e.depends_on,n=s[r];return Array.isArray(n)&&n.includes(a)};function W$(e,s){var r;return e!==void 0?e!=="regression":((r=s==null?void 0:s.tags)==null?void 0:r.includes("classification"))??!1}function G$(e,s){var n,o;const r=e.category==="Model"||e.category==="Modeling",a=((n=e.tags)==null?void 0:n.includes("clustering"))??!1;return!r||a?!1:s?((o=e.tags)==null?void 0:o.includes(s))??!1:!0}function Jm(e){return e==="grid"||e==="halving_grid"}function q$(e,s,r){return!e&&!s&&r.length>0}function K$(e,s,r,a){var Ye;const n=e.run_mode==="advanced",o=a?V$[a]:void 0,[i,l]=p.useState([]),[c,d]=p.useState(!1),[u,m]=p.useState([]),[h,x]=p.useState(!1),f=p.useId(),[g,b]=p.useState(!1),[y,v]=p.useState(!1),[j,w]=p.useState(()=>!sessionStorage.getItem("hide_info_training_node")),{availableColumns:N,upstreamTarget:k,datasetId:_,runJob:R,isSubmitting:M,submissionMessage:E,runFeedback:T}=Tf(r),[S,P]=Ve(),[I,A]=p.useState("model");gs(we=>{(we==="model_type"||we==="target_column")&&A("model")});const[B,F]=p.useState(!1),[z,L]=p.useState([]),[K,re]=p.useState(!1),[de,O]=p.useState(!0),q=z.find(we=>we.id===e.model_type),D=(Ye=q==null?void 0:q.tags)==null?void 0:Ye.includes("requires_scaling"),G=W$(a,q);p.useEffect(()=>{(async()=>{re(!0);try{const Y=(await zr.getAllNodes()).filter(U=>G$(U,o));L(Y)}catch(ee){console.error("Failed to fetch models:",ee),L([{id:"random_forest_classifier",name:"Random Forest Classifier",category:"Modeling",description:"",params:{}},{id:"logistic_regression",name:"Logistic Regression",category:"Modeling",description:"",params:{}},{id:"sgd_classifier",name:"SGD Classifier",category:"Modeling",description:"",params:{}},{id:"ridge_regression",name:"Ridge Regression",category:"Modeling",description:"",params:{}},{id:"random_forest_regressor",name:"Random Forest Regressor",category:"Modeling",description:"",params:{}}])}finally{re(!1)}})()},[o]);const J=p.useRef(!1);p.useEffect(()=>{n||e.model_type&&(d(!0),Re.getHyperparameters(e.model_type).then(we=>{const ee=we;if(l(ee),J.current){const Y={};ee.forEach(U=>{Y[U.name]=U.default}),s({...e,hyperparameters:Y}),J.current=!1}}).catch(console.error).finally(()=>{d(!1)}))},[e.model_type,n]);const X=p.useRef(null),oe=p.useRef(null);p.useEffect(()=>{if(!n)return;const we=(Y,U,pe)=>{s({...e,search_space:Y||{}}),X.current=U,oe.current=pe};(async()=>{const Y=e.model_type,U=e.search_strategy??"random";if(!Y)return;const pe=Y!==X.current,fe=Jm(oe.current),Xe=Jm(U),dt=fe!==Xe;if(!q$(pe,dt,u)){x(!0);try{if(pe){const ut=await Re.getHyperparameters(Y);m(ut)}if(pe||dt){const ut=await Re.getDefaultSearchSpace(Y,U);we(ut,Y,U)}}catch(ut){console.error("Failed to load model hyperparameters:",ut)}finally{x(!1)}}})()},[e.model_type,e.search_strategy,n]),p.useEffect(()=>{k&&e.target_column!==k&&(n?s({...e,target_column:k}):e.target_column||s({...e,target_column:k}))},[k,e.target_column,n]);const ve=a??kt(e.model_type,z),H=ve==="other"?"classification":ve,W=async()=>{await R(n?"tuning":"training",H)},ue=Object.keys(e.hyperparameters).length>0;return{config:e,onChange:s,isAdvanced:n,hyperparameters:i,isLoadingHyperparamDefs:c,searchSpaceDefs:u,isLoadingSearchSpaceDefs:h,fieldId:f,showStrategyModal:g,setShowStrategyModal:b,showParamsModal:y,setShowParamsModal:v,showInfo:j,setShowInfo:w,availableColumns:N,datasetId:_,isSubmitting:M,submissionMessage:E,runFeedback:T,containerRef:S,isWide:P,activeTab:I,setActiveTab:A,showCV:B,setShowCV:F,availableModels:z,isLoadingModels:K,showScalingAlert:de,setShowScalingAlert:O,selectedModelItem:q,requiresScaling:D,isClassification:G,keepCustomizationOpen:J,historyTask:H,handleSubmit:W,useCustomParams:ue,toggleCustomParams:we=>{if(we){const ee={};i.forEach(Y=>{ee[Y.name]=Y.default}),Object.keys(e.hyperparameters).length===0&&s({...e,hyperparameters:ee})}else s({...e,hyperparameters:{}})}}}const Ze=({text:e,placement:s="top"})=>t.jsx(ef,{delayDuration:0,children:t.jsxs(tf,{children:[t.jsx(sf,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":"Help",className:"inline-flex shrink-0 rounded focus-ring",children:t.jsx(Wp,{"aria-hidden":"true",className:"w-3 h-3 text-gray-400 cursor-help"})})}),t.jsx(T4,{children:t.jsxs(wd,{side:s==="bottom-left"?"bottom":"top",align:s==="bottom-left"?"start":"center",sideOffset:6,collisionPadding:8,onEscapeKeyDown:r=>r.stopPropagation(),className:`z-[200] rounded-md bg-gray-900 p-2.5 text-xs text-white shadow-xl ${s==="bottom-left"?"w-56":"w-48"}`,children:[e,t.jsx(M4,{className:"fill-gray-900"})]})})]})}),J$=({strategy:e,strategyParams:s,onCustomize:r})=>{if(s!=null&&Object.keys(s).length>0){const o=Y$(e,s);return t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"mt-1.5 text-xs text-blue-600 dark:text-blue-400",children:["βš™ ",o.join(" Β· ")]}),e==="halving_grid"&&t.jsxs("p",{className:"mt-1 text-xs text-amber-600 dark:text-amber-400",children:["⚠️ Evaluates the full grid β€” large search spaces can take many minutes. Reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section below, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]})}const n=e==="optuna"?"sampler: tpe Β· pruner: median":"factor: 3 Β· min: exhaust";return t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"mt-1.5 text-xs text-gray-500 dark:text-gray-400",children:["Using defaults (",n,")."," ",t.jsx("button",{type:"button",onClick:r,className:"underline hover:text-blue-500 transition-colors",children:"Customize"})]}),e==="halving_grid"&&t.jsxs("p",{className:"mt-1 text-xs text-amber-600 dark:text-amber-400",children:["⚠️ Evaluates the full grid β€” large search spaces can take many minutes. Reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section below, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]})};function Y$(e,s){if(e==="optuna"){const a=[`sampler: ${s.sampler??"tpe"}`,`pruner: ${s.pruner??"median"}`];return s.timeout&&a.push(`timeout: ${s.timeout}s`),a}const r=[];return s.factor&&r.push(`factor: ${s.factor}`),s.min_resources&&r.push(`min: ${s.min_resources}`),r}function Q$({config:e,onChange:s,fieldId:r,isClassification:a,setShowStrategyModal:n}){return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700"}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Tuning Strategy"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("label",{htmlFor:`${r}-search-method`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Search Method"}),t.jsx(Ze,{placement:"bottom-left",text:X$(e.search_strategy)})]}),Ym(e.search_strategy)&&t.jsx("button",{type:"button",onClick:()=>n(!0),className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 transition group flex items-center justify-center","aria-label":"Search strategy settings",title:`${e.search_strategy.replace("_"," ")} Settings`,children:t.jsx(Aa,{size:14,className:"group-hover:rotate-45 transition-transform duration-300"})})]}),t.jsxs("select",{id:`${r}-search-method`,value:e.search_strategy??"random",onChange:o=>{const i=o.target.value;s({...e,search_strategy:i,strategy_params:{}})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"random",children:"Random Search"}),t.jsx("option",{value:"grid",children:"Grid Search"}),t.jsx("option",{value:"halving_grid",children:"Successive Halving (Grid)"}),t.jsx("option",{value:"halving_random",children:"Successive Halving (Randomized)"}),t.jsx("option",{value:"optuna",children:"Optuna Search"})]}),Ym(e.search_strategy)&&t.jsx(J$,{strategy:e.search_strategy,strategyParams:e.strategy_params,onCustomize:()=>n(!0)})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-metric`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Metric"}),t.jsxs("select",{id:`${r}-metric`,value:e.metric,onChange:o=>s({...e,metric:o.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"accuracy",children:"Accuracy"}),t.jsx("option",{value:"f1",children:"F1 Score"}),t.jsx("option",{value:"roc_auc",children:"ROC AUC"}),t.jsx("option",{value:"mse",children:"MSE"}),t.jsx("option",{value:"rmse",children:"RMSE"}),t.jsx("option",{value:"mae",children:"MAE"}),t.jsx("option",{value:"r2",children:"R2 Score"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-trials`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Trials"}),t.jsx("input",{id:`${r}-trials`,type:"number",value:e.n_trials,onChange:o=>s({...e,n_trials:Number(o.target.value)}),disabled:["grid","halving_grid"].includes(e.search_strategy),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 disabled:opacity-50",min:1})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-random-state`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Random State"}),t.jsx(Ze,{text:"Seed for the search and the final refit β€” same seed + same data = identical tuning outcome. Applies to every candidate, not just the winner."})]}),t.jsx("input",{id:`${r}-random-state`,type:"number",value:e.random_state??42,onChange:o=>s({...e,random_state:Number(o.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:0})]}),a&&t.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-tune_threshold`,checked:e.tune_threshold??!1,onChange:o=>s({...e,tune_threshold:o.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-tune_threshold`,className:"text-xs text-gray-600 dark:text-gray-400",children:"Tune decision threshold"}),t.jsx(Ze,{text:"After tuning, picks the probability cutoff that maximises your metric on the validation split (binary targets). Predictions then use that cutoff instead of the default 0.5. Needs a validation split; probability-only metrics like ROC AUC fall back to balanced accuracy for the cutoff search."})]})]})]})]})}function Ym(e){return["halving_grid","halving_random","optuna"].includes(e)}function X$(e){switch(e){case"optuna":return"Optuna uses Bayesian optimization (TPE) to efficiently find optimal hyperparameters with early pruning.";case"halving_grid":return"Successive Halving (Grid) tests all combinations but quickly drops poorly performing candidates to save time.";case"halving_random":return"Successive Halving (Random) tests random combinations but quickly drops poorly performing candidates.";case"grid":return"Grid Search tests every single combination in the search space. Can be very slow and computationally expensive.";default:return"Random Search tests a random subset of parameter combinations. Fast and often surprisingly effective compared to Grid Search."}}function Z$({config:e,onChange:s,fieldId:r,isAdvanced:a,showCV:n,setShowCV:o,availableColumns:i}){return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{"aria-expanded":n,onClick:()=>{o(!n)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mc,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Cross Validation"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${n?"rotate-90":""}`})]}),n&&t.jsxs("div",{className:"p-3 space-y-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-cv_enabled`,checked:e.cv_enabled!==!1,onChange:l=>s({...e,cv_enabled:l.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-cv_enabled`,className:"text-sm text-gray-700 dark:text-gray-300",children:"Enable Cross-Validation"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 pl-6",children:a?"Candidates are already scored by CV during the search. This re-evaluates the winning model after tuning (full metric panel + fold-to-fold variance); it never changes the selected hyperparameters.":"Runs a k-fold evaluation of the trained model after training. Evaluation only, it measures generalization and never changes the model or its hyperparameters."}),e.cv_enabled!==!1&&t.jsx(eF,{config:e,onChange:s,fieldId:r,availableColumns:i})]})]})}function eF({config:e,onChange:s,fieldId:r,availableColumns:a}){return t.jsxs("div",{className:"space-y-3 pl-6 border-l-2 border-gray-100 dark:border-gray-800",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-folds`,className:"block text-xs text-gray-500 mb-1",children:"Folds"}),t.jsx("input",{id:`${r}-cv-folds`,type:"number",value:e.cv_folds??5,onChange:n=>s({...e,cv_folds:Number(n.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:2})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-method`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${r}-cv-method`,value:e.cv_type??"k_fold",onChange:n=>s({...e,cv_type:n.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"k_fold",children:"K-Fold"}),t.jsx("option",{value:"stratified_k_fold",children:"Stratified"}),t.jsx("option",{value:"time_series_split",children:"Time Series"}),t.jsx("option",{value:"shuffle_split",children:"Shuffle Split"}),t.jsx("option",{value:"nested_cv",children:"Nested CV"})]})]})]}),e.cv_type==="time_series_split"&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-start gap-1.5 p-2 bg-amber-50 dark:bg-amber-900/20 rounded text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsx("span",{children:"Data must be sorted by time. Select a date column below or ensure your data is pre-sorted."})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-time-column`,className:"block text-xs text-gray-500 mb-1",children:"Time Column (optional)"}),t.jsxs("select",{id:`${r}-cv-time-column`,value:e.cv_time_column??"",onChange:n=>s({...e,cv_time_column:n.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"",children:"Auto-detect"}),a.filter(n=>{const o=String(n.dtype).toLowerCase();return o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp")}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name)),a.filter(n=>{const o=String(n.dtype).toLowerCase();return!(o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp"))}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-cv_shuffle`,checked:e.cv_shuffle!==!1,onChange:n=>s({...e,cv_shuffle:n.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-cv_shuffle`,className:"text-xs text-gray-600 dark:text-gray-400",children:"Shuffle Data"})]}),e.cv_shuffle!==!1&&e.cv_type!=="time_series_split"&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-cv-seed`,className:"block text-xs text-gray-500",children:"Fold Split Seed"}),t.jsx(Ze,{text:"Seed controlling how rows are dealt to folds β€” same seed = identical fold splits, so CV scores stay comparable across runs."})]}),t.jsx("input",{id:`${r}-cv-seed`,type:"number",value:e.cv_random_state??42,onChange:n=>s({...e,cv_random_state:Number(n.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:0})]})]})}const tF=({value:e,onSelect:s})=>t.jsx("div",{role:"group","aria-label":"Training Mode",className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:[["basic","Basic"],["advanced","Advanced (Tuning)"]].map(([r,a])=>t.jsx("button",{type:"button","aria-pressed":e===r,onClick:()=>{s(r)},className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${e===r?"bg-white dark:bg-gray-700 text-purple-600 dark:text-purple-300 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:a},r))});function sF({config:e,onChange:s,isAdvanced:r,fieldId:a,availableModels:n,isLoadingModels:o,requiresScaling:i,showScalingAlert:l,setShowScalingAlert:c,keepCustomizationOpen:d,availableColumns:u,isClassification:m,setShowStrategyModal:h,showCV:x,setShowCV:f}){return t.jsxs("div",{className:"space-y-5 animate-in fade-in duration-300",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Training Mode"}),t.jsx(tF,{value:e.run_mode,onSelect:g=>{s({...e,run_mode:g})}})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Configuration"}),t.jsxs("div",{className:"grid gap-3",children:[t.jsxs(ce,{field:"model_type",children:[t.jsx("label",{htmlFor:`${a}-model`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Model Type"}),t.jsxs("div",{className:"relative",children:[t.jsx("select",{id:`${a}-model`,value:e.model_type,onChange:g=>{if(r){s({...e,model_type:g.target.value,search_space:{}});return}Object.keys(e.hyperparameters).length>0&&(d.current=!0),s({...e,model_type:g.target.value,hyperparameters:{}})},className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:o,children:n.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]}),i&&t.jsxs("div",{className:"mt-2 text-xs border border-blue-200 dark:border-blue-800 rounded-md bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 overflow-hidden transition-all",children:[t.jsxs("button",{"aria-expanded":l,onClick:()=>c(!l),className:"w-full flex items-center justify-between p-2 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[t.jsx($t,{className:"w-3 h-3"}),t.jsx("span",{children:"Scale Your Data"})]}),t.jsx(Ce,{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`})]}),l&&t.jsx("div",{className:"p-2 pt-0 opacity-90 animate-in slide-in-from-top-1 pl-7",children:'This model performs best with scaled features. Consider adding a "Feature Scaling" node.'})]})]}),t.jsxs(ce,{field:"target_column",children:[t.jsx("label",{htmlFor:`${a}-target`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Target Column"}),u.length===0&&t.jsxs("div",{className:"mb-2 p-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded text-xs text-yellow-700 dark:text-yellow-400 flex items-center gap-2",children:[t.jsx(Te,{className:"w-3 h-3"}),t.jsx("span",{children:"Connect a dataset node to see available columns"})]}),t.jsxs("div",{className:"relative",children:[u.length>0?t.jsxs("select",{id:`${a}-target`,value:e.target_column,onChange:g=>s({...e,target_column:g.target.value}),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:[t.jsx("option",{value:"",children:"Select target..."}),u.map(g=>t.jsx("option",{value:g.name,children:g.name},g.name))]}):t.jsx("input",{id:`${a}-target`,type:"text",value:e.target_column,onChange:g=>s({...e,target_column:g.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",placeholder:"e.g., target"}),u.length>0&&t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]})]})]})]}),r&&t.jsx(Q$,{config:e,onChange:s,fieldId:a,isClassification:m,setShowStrategyModal:h}),t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700"}),t.jsx(Z$,{config:e,onChange:s,fieldId:a,isAdvanced:r,showCV:x,setShowCV:f,availableColumns:u})]})]})}const Mf=({id:e,value:s,type:r,onChange:a,step:n,min:o,max:i})=>{const[l,c]=p.useState("");p.useEffect(()=>{c(s===null?"None":(s==null?void 0:s.toString())??"")},[s]);const d=m=>{if(m==="")return;const h=Number(m);Number.isNaN(h)?c(s===null?"None":(s==null?void 0:s.toString())??""):a(h)},u=()=>{const m=l.trim();if(m.toLowerCase()==="none"){a(null);return}r==="number"?d(m):r==="boolean"?m.toLowerCase()==="true"?a(!0):m.toLowerCase()==="false"?a(!1):c((s==null?void 0:s.toString())??""):a(m)};return t.jsx("input",{id:e,type:"text",value:l,onChange:m=>{c(m.target.value)},onBlur:u,placeholder:s===null?"None":"",className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",...r==="number"?{step:n,min:o,max:i}:{}})};function rF({def:e}){var s;return t.jsx(t.Fragment,{children:e.exclusive_options&&e.exclusive_options.length>0&&t.jsxs("p",{className:"mt-1 text-[10px] text-gray-400 italic",children:[(s=e.options)==null?void 0:s.filter(r=>{var a;return(a=e.exclusive_options)==null?void 0:a.includes(r.value)}).map(r=>`"${r.label}"`).join(", ")," can't be combined with other options here β€” selecting it clears the rest."]})})}const aF=({def:e,value:s,onChange:r})=>{const a=p.useId(),[n,o]=p.useState(""),[i,l]=p.useState(null);p.useEffect(()=>{o(Array.isArray(s)?s.map(u=>u===null?"None":u).join(", "):"")},[s]);const c=u=>{if(!u.trim())return[];const m=u.split(",").map(x=>x.trim()).filter(x=>x!==""),h=[];for(const x of m){if(x.toLowerCase()==="none"){h.push(null);continue}if(e.type==="number"){const f=Number(x);if(Number.isNaN(f))throw new Error(`"${x}" is not a valid number`);h.push(f)}else if(e.type==="boolean"){const f=x.toLowerCase();if(f==="true")h.push(!0);else if(f==="false")h.push(!1);else throw new Error(`"${x}" must be true or false`)}else h.push(x)}return h},d=()=>{try{const u=c(n),m=e.exclusive_options??[],h=u.filter(x=>m.includes(x));if(h.length>0&&u.length>h.length)throw new Error(`"${String(h[0])}" can't be combined with other options here β€” use it alone.`);l(null),JSON.stringify(u)!==JSON.stringify(s)&&r(u)}catch(u){l(u.message)}};return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-300 flex items-center gap-1",children:[t.jsx("label",{htmlFor:a,children:e.label}),e.description&&t.jsx(Ze,{text:e.description,placement:"bottom-left"})]}),t.jsx("span",{className:"text-[10px] text-gray-400 uppercase",children:e.type})]}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:a,"aria-invalid":i?!0:void 0,"aria-describedby":i?`${a}-error`:void 0,type:"text",className:`w-full border rounded px-2 py-1.5 text-sm font-mono bg-white dark:bg-gray-900 dark:text-gray-100 outline-none transition-all ${i?"border-red-500 focus:ring-2 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-purple-500/20 focus:border-purple-500"}`,placeholder:e.type==="select"?"e.g. lbfgs, liblinear":"e.g. 10, 50, 100",value:n,onChange:u=>{o(u.target.value),l(null)},onBlur:d}),e.type==="select"&&e.options&&t.jsx("div",{role:"group","aria-label":`${e.label} options`,className:"mt-1 flex flex-wrap gap-1",children:e.options.map(u=>t.jsx("button",{type:"button","aria-pressed":s.includes(u.value),onClick:()=>{const m=c(n),h=m.includes(u.value),x=e.exclusive_options??[];let f;h?f=m.filter(g=>g!==u.value):x.includes(u.value)?f=[u.value]:f=[...m.filter(g=>!x.includes(g)),u.value],r(f)},className:`text-[10px] px-1.5 py-0.5 rounded border transition-colors ${s.includes(u.value)?"bg-purple-100 border-purple-200 text-purple-700 dark:bg-purple-900/30 dark:border-purple-800 dark:text-purple-300":"bg-gray-50 border-gray-200 text-gray-600 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:u.label},String(u.value)))}),t.jsx(rF,{def:e})]}),i&&t.jsxs("p",{id:`${a}-error`,role:"alert",className:"text-[10px] text-red-500 flex items-center gap-1",children:[t.jsx($t,{className:"w-3 h-3"}),i]})]})};function nF({config:e,onChange:s,fieldId:r,hyperparameters:a,isLoadingHyperparamDefs:n,useCustomParams:o,toggleCustomParams:i,setShowParamsModal:l}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-blue-500"}),"Hyperparameters"]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs("label",{className:`text-xs text-gray-500 dark:text-gray-400 flex items-center gap-2 cursor-pointer select-none ${n?"opacity-50 cursor-not-allowed":""}`,children:[t.jsx("input",{type:"checkbox",checked:o,onChange:c=>{i(c.target.checked)},className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:n}),"Customize"]})})]}),o?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex justify-end mb-2",children:t.jsxs("button",{onClick:()=>{l(!0)},className:"text-xs flex items-center gap-1.5 px-2 py-1 text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded transition-colors",children:[t.jsx(Ae,{className:"w-3 h-3"}),"Load Best"]})}),n?t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(ge,{className:"w-5 h-5 animate-spin text-blue-500"})}):a.filter(c=>U$(c,e.hyperparameters)).map(c=>{var d;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("label",{htmlFor:`${r}-param-${c.name}`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:c.label}),c.description&&t.jsx(Ze,{text:c.description})]}),c.type==="select"?t.jsx("select",{id:`${r}-param-${c.name}`,value:e.hyperparameters[c.name]??c.default,onChange:u=>s({...e,hyperparameters:{...e.hyperparameters,[c.name]:u.target.value}}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:(d=c.options)==null?void 0:d.map(u=>t.jsx("option",{value:String(u.value),children:u.label},String(u.value)))}):t.jsx(Mf,{id:`${r}-param-${c.name}`,type:c.type,value:e.hyperparameters[c.name]??c.default,onChange:u=>s({...e,hyperparameters:{...e.hyperparameters,[c.name]:u}}),step:c.step,min:c.min,max:c.max})]},c.name)}),a.length===0&&!n&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 italic text-center py-4",children:"No parameters available."})]}):t.jsxs("div",{className:"text-center py-8 bg-gray-50 dark:bg-gray-900/50 rounded-lg border border-dashed border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Using default hyperparameters."}),t.jsxs("button",{onClick:()=>{l(!0)},className:"mt-3 text-xs flex items-center gap-1.5 px-3 py-1.5 mx-auto bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 rounded-md border border-purple-200 dark:border-purple-800 hover:bg-purple-100 dark:hover:bg-purple-900/40 transition-colors shadow-sm",children:[t.jsx(Ae,{className:"w-3 h-3"}),"Load Best Params"]})]})]})}function oF({config:e,onChange:s,searchSpaceDefs:r,isLoadingSearchSpaceDefs:a}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-purple-500"}),"Hyperparameters"]})}),a?t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(ge,{className:"w-6 h-6 animate-spin text-purple-500"})}):t.jsxs("div",{className:"space-y-3",children:[r.filter(n=>n.tunable!==!1&&H$(n,e.search_space)).map(n=>{var o;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsx(aF,{def:n,value:((o=e.search_space)==null?void 0:o[n.name])||[],onChange:i=>{s({...e,search_space:{...e.search_space,[n.name]:i}})}}),n.depends_on&&t.jsxs("p",{className:"mt-1 text-[10px] text-gray-400 italic",children:['Shown because "',n.depends_on.param,'" search space includes "',String(n.depends_on.value),'".']})]},`${e.model_type}-${n.name}`)}),r.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 text-sm",children:"No hyperparameters available for this model."})]})]})}const iF=({isOpen:e,onClose:s,modelType:r,availableModels:a=[],onSelect:n,theme:o="blue"})=>{const i=p.useId(),l=p.useRef(null);Gn({isOpen:e,containerRef:l}),p.useEffect(()=>{if(!e)return;const v=j=>{j.key==="Escape"&&s()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e,s]);const[c,d]=p.useState(r),[u,m]=p.useState([]),[h,x]=p.useState(!1),[f,g]=p.useState(null),b=o==="purple"?{iconBg:"bg-purple-100 dark:bg-purple-900/30",iconText:"text-purple-600 dark:text-purple-400",spinner:"text-purple-500",ring:"focus:ring-purple-500",hoverBorder:"hover:border-purple-200 dark:hover:border-purple-800"}:{iconBg:"bg-blue-100 dark:bg-blue-900/30",iconText:"text-blue-600 dark:text-blue-400",spinner:"text-blue-500",ring:"focus:ring-blue-500",hoverBorder:"hover:border-blue-200 dark:hover:border-blue-800"};p.useEffect(()=>{e&&d(r)},[e,r]);const y=p.useCallback(()=>{c&&(x(!0),g(null),Re.getTuningHistory(c).then(v=>{m(v)}).catch(v=>{console.error("Failed to fetch jobs",v),g("Failed to load history.")}).finally(()=>{x(!1)}))},[c]);return p.useEffect(()=>{e&&y()},[e,y]),e?t.jsxs("div",{className:"fixed inset-0 z-[100] flex justify-center items-center p-4",children:[t.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s}),t.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":`${i}-title`,tabIndex:-1,className:"relative w-full max-w-2xl max-h-[85vh] bg-white dark:bg-gray-800 shadow-2xl rounded-xl flex flex-col border border-gray-200 dark:border-gray-700 overflow-hidden animate-in fade-in zoom-in duration-200",children:[t.jsxs("div",{className:"p-4 border-b border-gray-100 dark:border-gray-700 flex justify-between items-center bg-gray-50/50 dark:bg-gray-800/50",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:`p-2 ${b.iconBg} rounded-lg`,children:t.jsx(at,{className:`w-5 h-5 ${b.iconText}`})}),t.jsxs("div",{children:[t.jsx("h3",{id:`${i}-title`,className:"font-semibold text-gray-900 dark:text-gray-100",children:"Best Parameters History"}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("label",{htmlFor:`${i}-model`,className:"text-xs text-gray-500 dark:text-gray-400",children:n?"Select parameters for:":"View parameters for:"}),t.jsx("select",{id:`${i}-model`,value:c,onChange:v=>{d(v.target.value)},className:`text-xs border border-gray-200 dark:border-gray-700 rounded px-2 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 focus:ring-1 ${b.ring} outline-none`,children:a.length>0?a.map(v=>t.jsx("option",{value:v.id,children:v.name},v.id)):t.jsxs(t.Fragment,{children:[t.jsx("option",{value:"random_forest_classifier",children:"Random Forest Classifier"}),t.jsx("option",{value:"logistic_regression",children:"Logistic Regression"}),t.jsx("option",{value:"ridge_regression",children:"Ridge Regression"}),t.jsx("option",{value:"random_forest_regressor",children:"Random Forest Regressor"})]})})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button","aria-label":"Refresh history",onClick:y,className:"p-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh",children:t.jsx(us,{className:`w-4 h-4 ${h?"animate-spin":""}`})}),t.jsx("button",{type:"button","aria-label":"Close history",onClick:s,className:"p-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 transition-colors focus-ring",children:t.jsx(Ee,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 bg-gray-50/30 dark:bg-gray-900/30",children:h?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[t.jsx(ge,{className:`w-8 h-8 animate-spin mb-2 ${b.spinner}`}),t.jsx("p",{className:"text-sm",children:"Loading history..."})]}):f?t.jsxs("div",{className:"text-center py-12 text-red-500 bg-red-50 dark:bg-red-900/10 rounded-lg border border-red-100 dark:border-red-900/20",children:[t.jsx($t,{className:"w-8 h-8 mx-auto mb-2"}),t.jsx("p",{className:"text-sm",children:f}),t.jsx("button",{onClick:y,className:"mt-2 text-xs underline hover:text-red-600",children:"Try Again"})]}):u.length===0?t.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-dashed border-gray-300 dark:border-gray-700",children:[t.jsx(Ct,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No completed optimization jobs found."}),t.jsx("p",{className:"text-xs opacity-70 mt-1",children:"Run an optimization job to see results here."})]}):u.map(v=>{var j,w;return t.jsx("div",{className:`group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md ${b.hoverBorder} transition-all`,children:t.jsxs("div",{className:"flex justify-between items-start mb-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs font-mono bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded text-gray-600 dark:text-gray-300",children:["#",v.job_id.slice(0,8)]}),t.jsx("span",{className:"text-xs text-gray-400",children:v.end_time?new Date(v.end_time).toLocaleString():"Unknown Date"})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[typeof((j=v.result)==null?void 0:j.best_score)=="number"&&t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{className:"text-xs font-medium text-gray-500",children:[qn(v.result.scoring_metric)||"Score",":"]}),t.jsx("span",{className:"text-sm font-bold text-green-600 dark:text-green-400",children:v.result.best_score.toFixed(4)})]}),t.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 rounded-full flex items-center gap-1",children:[t.jsx(Ie,{className:"w-3 h-3"})," Model Ready"]})]})]}),n&&((w=v.result)==null?void 0:w.best_params)!=null&&t.jsxs("button",{onClick:()=>{n({params:v.result.best_params,modelType:c}),s()},className:"text-xs action-primary px-3 py-1.5 rounded-md transition-colors flex items-center gap-1 shadow-sm",children:[t.jsx(Ie,{className:"w-3 h-3"}),"Apply"]})]})},v.job_id)})})]})]}):null},lF=new Set(["logistic_regression","random_forest_classifier","random_forest_regressor","ridge_regression","linear_regression","svc","svr","k_neighbors_classifier","k_neighbors_regressor","decision_tree_classifier","decision_tree_regressor","extra_trees_classifier","extra_trees_regressor","lgbm_classifier","lgbm_regressor"]);function cF({config:e,setConfig:s,fieldId:r,strategy:a}){return t.jsxs(t.Fragment,{children:[a==="halving_grid"&&t.jsxs("div",{className:"flex items-start gap-2 p-2.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"halving_grid"})," evaluates the full cartesian product of your search space across multiple halving rounds. Large grids can take many minutes β€” reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section of the node, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-factor`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Factor"}),t.jsx(Ze,{placement:"bottom-left",text:"The rate at which candidate combinations are reduced in each iteration. For example, a factor of 3 means only the best 1/3 of candidates survive to the next round."})]}),t.jsx("input",{type:"number",min:"2",id:`${r}-factor`,value:e.factor??3,onChange:n=>s({...e,factor:Number.parseInt(n.target.value,10)}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Typical values are 2 or 3."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-min_resources`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Min Resources"}),t.jsx(Ze,{placement:"bottom-left",text:"'exhaust' automatically calculates the maximum resources to use. Alternatively, input an integer like 10 or 100 to set the starting budget explicitly."})]}),t.jsx("input",{type:"text",id:`${r}-min_resources`,value:e.min_resources??"exhaust",onChange:n=>s({...e,min_resources:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",placeholder:"e.g., 'exhaust', 'smallest', or an integer"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Starting budget for the first iteration."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-resource`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Resource"}),t.jsx(Ze,{placement:"bottom-left",text:"Determines how resources are limited during fast initial rounds. 'n_samples' limits the amount of training data used, while 'n_estimators' limits the number of trees in ensemble models."})]}),t.jsxs("select",{id:`${r}-resource`,value:e.resource??"n_samples",onChange:n=>s({...e,resource:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"n_samples",children:"n_samples (Rows of Data)"}),t.jsx("option",{value:"n_estimators",children:"n_estimators (Trees)"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"What defines the training budget."})]})]})}function dF({config:e,setConfig:s,fieldId:r,showCmaesWarning:a}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-sampler`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Sampler"}),t.jsx(Ze,{placement:"bottom-left",text:"TPE provides smart Bayesian learning based on past trials. Random is purely blind chance. CMA-ES is advanced evolutionary sampling meant for complex continuous search spaces."})]}),t.jsxs("select",{id:`${r}-sampler`,value:e.sampler??"tpe",onChange:n=>s({...e,sampler:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"tpe",children:"TPE (Bayesian Optimization)"}),t.jsx("option",{value:"random",children:"Random Sampler"}),t.jsx("option",{value:"cmaes",children:"CMA-ES"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Algorithm to suggest new parameters."}),a&&e.sampler==="cmaes"&&t.jsxs("div",{className:"mt-2 flex items-start gap-2 p-2.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"Partial CMA-ES coverage."})," This model has string or boolean parameters (e.g. solver, kernel, criterion) that CMA-ES cannot optimize β€” they will be sampled randomly. For full CMA-ES benefit, use ",t.jsx("strong",{children:"XGBoost"})," or ",t.jsx("strong",{children:"Gradient Boosting"}),". Alternatively, switch to ",t.jsx("strong",{children:"TPE"})," which handles mixed spaces natively."]})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-pruner`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Pruner"}),t.jsx(Ze,{placement:"bottom-left",text:"Median prunes trials worse than the median of previous runs. Hyperband is an aggressively fast early-stopping algorithm. None disables early stopping."})]}),t.jsxs("select",{id:`${r}-pruner`,value:e.pruner??"median",onChange:n=>s({...e,pruner:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"median",children:"Median Pruner"}),t.jsx("option",{value:"hyperband",children:"Hyperband Pruner"}),t.jsx("option",{value:"none",children:"None (No Pruning)"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Algorithm to kill bad trials early."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-timeout`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Timeout (Seconds)"}),t.jsx(Ze,{placement:"bottom-left",text:"Set a hard time limit for the entire Optuna study. Regardless of N-Trials, optimization will yield the best found parameters once time is up."})]}),t.jsx("input",{type:"number",min:"1",id:`${r}-timeout`,value:e.timeout??"",onChange:n=>s({...e,timeout:n.target.value?Number.parseInt(n.target.value,10):""}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",placeholder:"e.g. 300 (Optional)"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Stop tuning after X seconds."})]})]})}const Pf=({isOpen:e,onClose:s,onSave:r,strategy:a,initialConfig:n,modelKey:o})=>{const i=p.useId(),l=a==="optuna"&&o!==void 0&&lF.has(o),c=a==="halving_grid"||a==="halving_random",d=a==="optuna",u={factor:3,min_resources:"exhaust",resource:"n_samples"},m={pruner:"median",sampler:"tpe",timeout:""},[h,x]=p.useState({});if(p.useEffect(()=>{e&&(n&&Object.keys(n).length>0?x(n):x(c?u:m))},[e,a,n]),!c&&!d)return null;const f=()=>{const b={...h};d&&(b.timeout===""||b.timeout===void 0)?delete b.timeout:d&&typeof b.timeout=="string"&&(b.timeout=Number.parseInt(b.timeout,10)),r(b),s()},g=()=>{x(c?u:m)};return t.jsx(Tt,{isOpen:e,onClose:s,zIndex:"z-[100]",size:"md",title:c?"Successive Halving Settings":"Optuna Settings",footer:t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsxs("button",{onClick:g,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition",children:[t.jsx(Pp,{size:16}),"Reset"]}),t.jsxs("button",{onClick:f,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium action-primary rounded-lg transition shadow-sm",children:[t.jsx(ai,{size:16}),"Apply Settings"]})]}),children:t.jsxs("div",{className:"p-5 space-y-4",children:[c&&t.jsx(cF,{config:h,setConfig:x,fieldId:i,strategy:a}),d&&t.jsx(dF,{config:h,setConfig:x,fieldId:i,showCmaesWarning:l})]})})};function uF({config:e,onChange:s,isAdvanced:r,showParamsModal:a,setShowParamsModal:n,availableModels:o,showStrategyModal:i,setShowStrategyModal:l}){return t.jsxs(t.Fragment,{children:[t.jsx(iF,{isOpen:a,onClose:()=>{n(!1)},modelType:e.model_type,availableModels:o,theme:r?"purple":"blue",...r?{}:{onSelect:c=>{c.modelType&&c.modelType!==e.model_type?s({...e,model_type:c.modelType,hyperparameters:c.params}):s({...e,hyperparameters:c.params})}}}),r&&t.jsx(Pf,{isOpen:i,onClose:()=>l(!1),strategy:e.search_strategy||"random",initialConfig:e.strategy_params,modelKey:e.model_type,onSave:c=>{s({...e,strategy_params:c})}})]})}function Ed({children:e,details:s}){const r=p.useRef(null),a=p.useRef(null),[n,o]=p.useState(!1),[i,l]=p.useState(!1),c=n||i;return p.useEffect(()=>{const d=r.current;if(!d)return;if(typeof IntersectionObserver>"u"){o(!0);return}let u=d.parentElement;for(;u&&!/auto|scroll/.test(getComputedStyle(u).overflowY);)u=u.parentElement;const m=new IntersectionObserver(([h])=>{h&&o(h.isIntersecting)},{root:u});return m.observe(d),()=>m.disconnect()},[]),p.useLayoutEffect(()=>{a.current&&(a.current.inert=!c)},[c]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:r,className:"h-px shrink-0","aria-hidden":"true"}),t.jsxs("div",{"data-testid":"training-action-footer","data-expanded":c,className:"sticky bottom-0 z-10 flex flex-col items-center gap-2 border-t border-border bg-background py-2",children:[e,t.jsx("div",{className:`grid w-full transition-[grid-template-rows,opacity] duration-200 motion-reduce:transition-none ${c?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0 -mt-2"}`,"aria-hidden":!c,ref:a,onFocusCapture:()=>l(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||l(!1)},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"flex flex-col items-center gap-2",children:s})})})]})]})}function mF({config:e,isAdvanced:s,selectedModelItem:r,fieldId:a,datasetId:n,isSubmitting:o,setShowParamsModal:i,handleSubmit:l,submissionMessage:c,runFeedback:d,historyTask:u}){return t.jsxs(Ed,{details:t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"text-xs text-center text-gray-600 dark:text-gray-400 break-words",children:["Selected model: ",(r==null?void 0:r.name)||e.model_type.replace(/_/g," ")]}),t.jsx("p",{id:`${a}-run-help`,className:"text-xs text-center text-gray-600 dark:text-gray-400",children:pF(e,n,s)}),s&&t.jsxs("button",{onClick:()=>{i(!0)},className:"text-xs text-gray-500 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 flex items-center gap-1.5 transition-colors px-3 py-1 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800",children:[t.jsx(at,{className:"w-3.5 h-3.5"}),"View Best Parameters History"]})]}),children:[t.jsxs("button",{type:"button",onClick:()=>{l()},disabled:hF(e,n,o),"aria-describedby":`${a}-run-help`,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed focus-ring",children:[o?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:o?"Submitting job...":s?"Tune model":"Train model"})]}),c&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:c}),d&&t.jsx(hi,{run:d,task:u})]})}function pF(e,s,r){var a;return s?(a=e.target_column)!=null&&a.trim()?e.model_type?r?"Searches hyperparameters and trains the selected model in the background.":"Trains the selected model with fixed parameters in the background.":"Choose a model to enable this action.":"Choose a target column to enable this action.":"Connect a dataset node upstream and select a dataset to enable this action."}function hF(e,s,r){var a;return!s||r||!((a=e.target_column)!=null&&a.trim())||!e.model_type}function xF({showInfo:e,setShowInfo:s}){return t.jsx(t.Fragment,{children:e&&t.jsxs("div",{className:"mb-4 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded text-xs text-blue-700 dark:text-blue-300 flex justify-between items-start gap-2",children:[t.jsx("span",{children:"Train a model with fixed parameters, or switch to Advanced to automatically tune it."}),t.jsx("button",{"aria-label":"Dismiss training information",onClick:()=>{s(!1),sessionStorage.setItem("hide_info_training_node","true")},className:"text-blue-400 hover:text-blue-600 dark:hover:text-blue-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]})})}function gF({isWide:e,activeTab:s,setActiveTab:r,isAdvanced:a,modelPanel:n,secondaryPanel:o}){const i=a?"Search Space":"Hyperparameters";return t.jsxs(t.Fragment,{children:[!e&&t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700 mb-4",children:[t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${s==="model"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":s==="model",onClick:()=>{r("model")},children:"Configuration"}),t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${s==="params"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":s==="params",onClick:()=>{r("params")},children:i})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4 custom-scrollbar",children:e?t.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[t.jsx("div",{className:"overflow-y-auto pr-2",children:n}),t.jsx("div",{className:"overflow-y-auto pl-2 border-l border-gray-100 dark:border-gray-800",children:o})]}):t.jsxs(t.Fragment,{children:[s==="model"&&n,s==="params"&&o]})})]})}const Rd=({config:e,onChange:s,nodeId:r,task:a})=>{const n=K$(e,s,r,a),o=n.isAdvanced?t.jsx(oF,{...n}):t.jsx(nF,{...n});return t.jsxs("div",{className:"flex flex-col h-full",ref:n.containerRef,children:[t.jsx(xF,{...n}),t.jsx(uF,{...n}),t.jsx(gF,{...n,modelPanel:t.jsx(sF,{...n}),secondaryPanel:o}),t.jsx(mF,{...n})]})},ro=({type:e,label:s,description:r,icon:a,settings:n,defaultConfig:o,validate:i,bodyPreview:l,category:c="Modeling",inputs:d=[{id:"in",label:"Training Data",type:"dataset"}],outputs:u=[{id:"model",label:"Model",type:"model"}]})=>({type:e,label:s,category:c,description:r,icon:a,inputs:d,outputs:u,settings:n,bodyPreview:l||(m=>{const h=m.model_type,x=m.target_column;return h&&x?`${h} β†’ ${x}`:h||(x?`target: ${x}`:null)}),validate:i||(m=>m.target_column?{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"}),getDefaultConfig:()=>({target_column:"",model_type:"random_forest_classifier",...o})}),fF=ro({type:Ts.CLASSIFICATION,label:"Classification",description:"Train a classifier to predict a categorical target β€” fixed parameters or automatic tuning.",icon:Gp,settings:e=>t.jsx(Rd,{...e,task:"classification"}),defaultConfig:{run_mode:"basic",model_type:"random_forest_classifier",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"accuracy",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),bF=ro({type:Ts.REGRESSION,label:"Regression",description:"Train a regressor to predict a numeric target β€” fixed parameters or automatic tuning.",icon:jc,settings:e=>t.jsx(Rd,{...e,task:"regression"}),defaultConfig:{run_mode:"basic",model_type:"random_forest_regressor",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"r2",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),yF=ro({type:Ts.TEXT_CLASSIFICATION,label:"Text Classification",description:"Train a classifier on vectorized text features β€” fixed parameters or automatic tuning.",icon:Dr,settings:e=>t.jsx(Rd,{...e,task:"text_classification"}),defaultConfig:{run_mode:"basic",model_type:"multinomial_nb",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"accuracy",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),vF=[{label:"Logistic Regression",value:"logistic_regression"},{label:"Random Forest",value:"random_forest"},{label:"Extra Trees",value:"extra_trees"},{label:"Gradient Boosting",value:"gradient_boosting"},{label:"Hist Gradient Boosting",value:"hist_gradient_boosting"},{label:"AdaBoost",value:"adaboost"},{label:"Decision Tree",value:"decision_tree"},{label:"Gaussian Naive Bayes",value:"gaussian_nb"},{label:"SGD Classifier",value:"sgd_classifier"},{label:"Support Vector Classifier",value:"svc"},{label:"K-Nearest Neighbors",value:"knn"}],jF=[{label:"Linear Regression",value:"linear_regression"},{label:"Ridge",value:"ridge"},{label:"Lasso",value:"lasso"},{label:"ElasticNet",value:"elasticnet"},{label:"Random Forest",value:"random_forest"},{label:"Extra Trees",value:"extra_trees"},{label:"Gradient Boosting",value:"gradient_boosting"},{label:"Hist Gradient Boosting",value:"hist_gradient_boosting"},{label:"AdaBoost",value:"adaboost"},{label:"Decision Tree",value:"decision_tree"},{label:"Support Vector Regressor",value:"svr"},{label:"K-Nearest Neighbors",value:"knn"}];function wF(e,s,r=[]){const a=e==="classification"?[...vF]:[...jF],n=e==="classification"?"classifier":"regressor",o=[{label:"XGBoost",value:"xgboost",registryId:`xgboost_${n}`},{label:"LightGBM",value:"lightgbm",registryId:`lgbm_${n}`}];for(const{label:i,value:l,registryId:c}of o)(s!=null&&s.has(c)||r.includes(l))&&a.push({label:i,value:l});return a}function si(e,s){return`${s}_${e==="classification"?"classifier":"regressor"}`}function If(e){return e==="classification"?["random_forest","logistic_regression","gradient_boosting"]:["random_forest","gradient_boosting","ridge"]}function Af(e){return e==="classification"?"logistic_regression":"ridge"}function $f(e){return e==="classification"?"accuracy":"r2"}function NF(e){if(!e)return null;const s=String(e.dtype).toLowerCase();return s.includes("bool")||["object","string","category","text"].some(r=>s.includes(r))?"classification":["float","double","decimal"].some(r=>s.includes(r))?"regression":s.includes("int")?e.unique_count>0&&e.unique_count<=20?"classification":"regression":null}function kF(e){return e==="classification"?[{label:"Accuracy",value:"accuracy"},{label:"F1",value:"f1"},{label:"Balanced Accuracy",value:"balanced_accuracy"},{label:"ROC AUC",value:"roc_auc"}]:[{label:"RΒ²",value:"r2"},{label:"RMSE",value:"rmse"},{label:"MAE",value:"mae"}]}const _F=[{label:"Random",value:"random"},{label:"Grid",value:"grid"},{label:"Optuna",value:"optuna"},{label:"Halving Random",value:"halving_random"},{label:"Halving Grid",value:"halving_grid"}],bc={classification:{logistic_regression:"logistic_regression",random_forest_classifier:"random_forest",extra_trees_classifier:"extra_trees",gradient_boosting_classifier:"gradient_boosting",hist_gradient_boosting_classifier:"hist_gradient_boosting",adaboost_classifier:"adaboost",decision_tree_classifier:"decision_tree",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",k_neighbors_classifier:"knn",xgboost_classifier:"xgboost",lgbm_classifier:"lightgbm"},regression:{linear_regression:"linear_regression",ridge_regression:"ridge",lasso_regression:"lasso",elasticnet_regression:"elasticnet",random_forest_regressor:"random_forest",extra_trees_regressor:"extra_trees",gradient_boosting_regressor:"gradient_boosting",hist_gradient_boosting_regressor:"hist_gradient_boosting",adaboost_regressor:"adaboost",decision_tree_regressor:"decision_tree",svr:"svr",k_neighbors_regressor:"knn",xgboost_regressor:"xgboost",lgbm_regressor:"lightgbm"}};function SF(e){return e in bc.classification?"classification":e in bc.regression?"regression":e.endsWith("_classifier")||["logistic_regression","gaussian_nb","sgd_classifier","svc"].includes(e)?"classification":e.endsWith("_regressor")||e.includes("regression")||["linear_regression","svr"].includes(e)?"regression":null}function CF(e,s){return bc[s][e]??null}function Ff(e){return Object.fromEntries(e.map(s=>[s.value,s.label]))}function Qm(e,s,r){if(!e)return[];const a=[];for(const n of r.filter(o=>o.target===e)){const o=s.find(i=>i.id===n.source);o&&["training","classification","regression","text_classification"].includes(o.data.definitionType)&&a.push(o)}return a}function EF(e,s){if(s.task_manual)return{};for(const{data:r}of e){if(!r.model_type)continue;const a=SF(r.model_type);if(a)return a===s.task?{}:{task:a,model_type:si(a,s.strategy)}}return{}}function RF(e,s){const r=e.find(a=>a.data.run_mode==="advanced");return r?{run_mode:"advanced",search_strategy:r.data.search_strategy||s.search_strategy,n_trials:r.data.n_trials||s.n_trials,metric:r.data.metric||s.metric}:{run_mode:"basic"}}function TF(e,s){const r=e.cv_time_column||s.cv_time_column;return{cv_enabled:e.cv_enabled!==void 0?e.cv_enabled:s.cv_enabled,cv_folds:e.cv_folds||s.cv_folds,cv_type:e.cv_type||s.cv_type,cv_shuffle:e.cv_shuffle!==void 0?e.cv_shuffle:s.cv_shuffle,cv_random_state:e.cv_random_state??s.cv_random_state,...r!==void 0?{cv_time_column:r}:{}}}function MF(e,s,r){const a=e.hyperparameters||e.search_space||e.params;a&&typeof a=="object"&&Object.keys(a).length>0&&(r[s]={...r[s]||{},...a})}function PF(e,s,r){const a=[],n={...r.base_estimator_params||{}};for(const{data:o}of e){if(!o.model_type)continue;const i=CF(o.model_type,s);i&&(a.includes(i)||a.push(i),MF(o,i,n))}return{estimators:a,params:n}}function IF(e,s){var r;return e.length>0&&(e.length!==((r=s.base_estimators)==null?void 0:r.length)||!e.every(a=>{var n;return(n=s.base_estimators)==null?void 0:n.includes(a)}))}function AF(e,s){return Object.fromEntries(Object.entries(s).filter(([r,a])=>e[r]!==a))}function $F(e,s){const r=e[0];if(!r)return null;const a=EF(e,s),{estimators:n,params:o}=PF(e,a.task??s.task,s),i={...a,...RF(e,s),...TF(r.data,s)};IF(n,s)&&(i.base_estimators=n);const l=r.data.target_column||s.target_column;l&&(i.target_column=l);const c=AF(s,i);return Object.keys(c).length===0?null:{...c,base_estimator_params:o}}const FF={classification:{logistic_regression:"logistic_regression",random_forest:"random_forest_classifier",extra_trees:"extra_trees_classifier",gradient_boosting:"gradient_boosting_classifier",hist_gradient_boosting:"hist_gradient_boosting_classifier",adaboost:"adaboost_classifier",decision_tree:"decision_tree_classifier",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",knn:"k_neighbors_classifier",xgboost:"xgboost_classifier",lightgbm:"lgbm_classifier"},regression:{linear_regression:"linear_regression",ridge:"ridge_regression",lasso:"lasso_regression",elasticnet:"elasticnet_regression",random_forest:"random_forest_regressor",extra_trees:"extra_trees_regressor",gradient_boosting:"gradient_boosting_regressor",hist_gradient_boosting:"hist_gradient_boosting_regressor",adaboost:"adaboost_regressor",decision_tree:"decision_tree_regressor",svr:"svr",knn:"k_neighbors_regressor",xgboost:"xgboost_regressor",lightgbm:"lgbm_regressor"}};function Xm(e,s){return e.type==="number"?s===""?void 0:Number(s):e.type==="boolean"?s==="true":s===""?void 0:s}function DF({id:e,def:s,value:r,onChange:a}){const n=r??"",o="w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-xs bg-white dark:bg-gray-800 dark:text-gray-100";return s.type==="select"&&s.options?t.jsxs("select",{id:e,className:o,value:String(n),onChange:i=>{a(Xm(s,i.target.value))},children:[t.jsx("option",{value:"",children:"default"}),s.options.map(i=>t.jsx("option",{value:String(i.value),children:i.label},String(i.value)))]}):s.type==="boolean"?t.jsxs("select",{id:e,className:o,value:n===""?"":String(n),onChange:i=>{a(i.target.value===""?void 0:i.target.value==="true")},children:[t.jsx("option",{value:"",children:"default"}),t.jsx("option",{value:"true",children:"True"}),t.jsx("option",{value:"false",children:"False"})]}):t.jsx("input",{id:e,type:"number",className:o,min:s.min,max:s.max,step:s.step,value:String(n),placeholder:"default",onChange:i=>{a(Xm(s,i.target.value))}})}function Zm({label:e,defs:s,values:r,onParam:a}){const[n,o]=p.useState(!1),i=p.useId(),l=Object.keys(r).length,c=s.filter(d=>d.type!=="multiselect");return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":`${i}-params`,onClick:()=>{o(!n)},className:"w-full flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:e}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[l>0&&t.jsxs("span",{className:"text-[10px] text-purple-600 dark:text-purple-300",children:[l," set"]}),t.jsx(tt,{className:`w-3.5 h-3.5 text-gray-400 transition-transform ${n?"rotate-90":""}`})]})]}),n&&t.jsxs("div",{id:`${i}-params`,role:"group","aria-label":e,className:"p-2 grid grid-cols-2 gap-2 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:[c.length===0&&t.jsx("p",{className:"col-span-2 text-[11px] text-gray-400",children:"No tunable parameters."}),c.map(d=>t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${i}-${d.name}`,className:"block text-[10px] text-gray-500 mb-0.5 truncate",title:d.description,children:d.label}),t.jsx(DF,{id:`${i}-${d.name}`,def:d,value:r[d.name],onChange:u=>{a(d.name,u)}})]},d.name))]})]})}function LF({task:e,baseEstimators:s,finalEstimator:r,optionLabels:a,baseParams:n,finalParams:o,onChange:i}){const[l,c]=p.useState({}),d=p.useMemo(()=>{const h=new Set(s);return r&&h.add(r),Array.from(h)},[s,r]);p.useEffect(()=>{let h=!1;const x=d.filter(f=>!(f in l));if(x.length!==0)return Promise.all(x.map(async f=>{const g=FF[e][f];if(!g)return[f,[]];try{const b=await Re.getHyperparameters(g);return[f,b]}catch{return[f,[]]}})).then(f=>{h||c(g=>({...g,...Object.fromEntries(f)}))}),()=>{h=!0}},[d,e,l]);const u=(h,x,f)=>{const g={...n[h]??{}};f===void 0||f===""?delete g[x]:g[x]=f;const b={...n};Object.keys(g).length===0?delete b[h]:b[h]=g,i(b,o)},m=(h,x)=>{const f={...o};x===void 0||x===""?delete f[h]:f[h]=x,i(n,f)};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xb,{className:"w-3.5 h-3.5 text-purple-500"}),t.jsx("span",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:"Optional β€” leave blank to use each model's defaults."})]}),s.map(h=>t.jsx(Zm,{label:a[h]??h,defs:l[h]??[],values:n[h]??{},onParam:(x,f)=>{u(h,x,f)}},h)),r&&t.jsx(Zm,{label:`Final Β· ${a[r]??r}`,defs:l[r]??[],values:o,onParam:m},`final-${r}`)]})}function OF({ariaLabel:e,options:s,selected:r,onChange:a}){const n=o=>{r.includes(o)?a(r.filter(i=>i!==o)):a([...r,o])};return t.jsx("div",{role:"group","aria-label":e,className:"flex flex-wrap gap-1.5",children:s.map(o=>{const i=r.includes(o.value);return t.jsxs("button",{type:"button","aria-pressed":i,onClick:()=>{n(o.value)},className:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs border transition-colors ${i?"bg-blue-500 text-white border-blue-500":"bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:[i&&t.jsx(Ie,{size:11,className:"shrink-0"}),o.label]},String(o.value))})})}function Lo({label:e,options:s,value:r,onSelect:a}){return t.jsx("div",{role:"group","aria-label":e,className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:s.map(n=>t.jsx("button",{type:"button","aria-pressed":r===n.value,onClick:()=>{a(n.value)},className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${r===n.value?"bg-white dark:bg-gray-700 text-purple-600 dark:text-purple-300 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:n.label},n.value))})}function zF({config:e,update:s,options:r}){const a=p.useId();return e.strategy==="voting"?e.task!=="classification"?null:t.jsxs("div",{children:[t.jsx("span",{className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Voting Type"}),t.jsx(Lo,{options:[{label:"Soft (probabilities)",value:"soft"},{label:"Hard (majority)",value:"hard"}],label:"Voting Type",value:e.voting,onSelect:n=>{s({voting:n})}})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-final_estimator`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Final Estimator (meta-learner)"}),t.jsx("select",{id:`${a}-final_estimator`,value:e.final_estimator,onChange:n=>{s({final_estimator:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:r.map(n=>t.jsx("option",{value:n.value,children:n.label},n.value))})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[t.jsx("label",{htmlFor:`${a}-cv`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Stacking CV Folds"}),t.jsx(Ze,{text:"Out-of-fold folds used to train the final estimator without leakage. Keep small (e.g. 3) when also running an outer hyperparameter search."})]}),t.jsx("input",{id:`${a}-cv`,type:"number",min:2,max:10,value:e.cv,onChange:n=>{s({cv:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.passthrough===!0,onChange:n=>{s({passthrough:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Passthrough features"]}),t.jsx("p",{className:"mt-1 pl-6 text-xs text-gray-500 dark:text-gray-400",children:"Let the meta-learner also see the original features, not just the base predictions."})]})]})}function BF({config:e,update:s,optionLabels:r}){const a=p.useId(),n=e.base_estimators??[];if(e.strategy!=="voting"||n.length===0)return null;const o=e.weights??{},i=(l,c)=>{s({weights:{...o,[l]:c}})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Weights"}),t.jsx(Ze,{text:"Relative weight of each base model when averaging votes/probabilities. Leave at 1 for equal weighting; raise a model's weight to trust it more."})]}),t.jsx("div",{className:"space-y-1.5",children:n.map(l=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{htmlFor:`${a}-weight-${l}`,className:"flex-1 text-xs text-gray-700 dark:text-gray-300 truncate",children:r[l]??l}),t.jsx("input",{type:"number",min:0,step:.5,id:`${a}-weight-${l}`,"aria-label":`${r[l]??l} weight`,value:o[l]??1,onChange:c=>{i(l,Number(c.target.value))},className:"w-20 border border-gray-300 dark:border-gray-600 rounded-lg p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]},l))})]})}function VF({config:e,update:s}){const r=p.useId(),a=[{label:"Sequential (1)",value:"1"},{label:"2 cores",value:"2"},{label:"4 cores",value:"4"},{label:"8 cores",value:"8"},{label:"All cores (-1)",value:"-1"}];return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("label",{htmlFor:`${r}-n_jobs`,className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Parallel Jobs"}),t.jsx(Ze,{text:"How many base models to fit in parallel. -1 uses all CPU cores; 1 trains sequentially."})]}),t.jsx("select",{id:`${r}-n_jobs`,value:String(e.n_jobs??1),onChange:n=>{s({n_jobs:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:a.map(n=>t.jsx("option",{value:n.value,children:n.label},n.value))})]})}function UF({config:e,update:s}){const r=p.useId();if(e.task!=="classification")return null;const a=e.calibrate_base_models===!0;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:n=>{s({calibrate_base_models:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Calibrate base models"]}),t.jsx("p",{className:"mt-1 pl-6 text-xs text-gray-500 dark:text-gray-400",children:"Wrap each base classifier in CalibratedClassifierCV so its probabilities are well-calibrated β€” improves soft voting and stacking."})]}),a&&t.jsxs("div",{className:"grid grid-cols-2 gap-3 pl-6",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-calibration_method`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${r}-calibration_method`,"aria-label":"Calibration Method",value:e.calibration_method??"sigmoid",onChange:n=>{s({calibration_method:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"sigmoid",children:"Sigmoid (Platt)"}),t.jsx("option",{value:"isotonic",children:"Isotonic"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-calibration_cv`,className:"block text-xs text-gray-500 mb-1",children:"CV Folds"}),t.jsx("input",{id:`${r}-calibration_cv`,"aria-label":"Calibration CV Folds",type:"number",min:2,max:10,value:e.calibration_cv??3,onChange:n=>{s({calibration_cv:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]})]})}function HF({config:e,update:s,columns:r}){const a=p.useId();return t.jsxs(ce,{field:"target_column",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Target Column"}),r.length===0?t.jsx("input",{id:`${a}-target_column`,type:"text",value:e.target_column,onChange:n=>{s({target_column:n.target.value})},placeholder:"Type the target column name",className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"}):t.jsxs("select",{id:`${a}-target_column`,value:e.target_column,onChange:n=>{s({target_column:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:[t.jsx("option",{value:"",children:"Select target…"}),r.map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})}function WF({config:e,update:s,open:r,setOpen:a,options:n}){return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{a(!r)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tr,{className:"w-4 h-4 text-purple-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Base Model Hyperparameters"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${r?"rotate-90":""}`})]}),r&&t.jsx("div",{className:"p-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:t.jsx(LF,{task:e.task,baseEstimators:e.base_estimators??[],finalEstimator:e.strategy==="stacking"?e.final_estimator:void 0,optionLabels:Ff(n),baseParams:e.base_estimator_params??{},finalParams:e.final_estimator_params??{},onChange:(o,i)=>{s({base_estimator_params:o,final_estimator_params:i})}})})]})}function GF({config:e,update:s,currentOptions:r,columns:a,tooFewModels:n}){var l;const o=c=>{s({task:c,task_manual:!0,model_type:si(c,e.strategy),base_estimators:If(c),final_estimator:Af(c),metric:$f(c)})},i=c=>{s({strategy:c,model_type:si(e.task,c)})};return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Task"}),e.task_manual?t.jsxs("button",{type:"button",onClick:()=>{s({task_manual:!1})},className:"text-[10px] text-purple-600 dark:text-purple-400 hover:underline flex items-center gap-0.5",title:"Re-enable automatic detection from the target column",children:[t.jsx(tr,{className:"w-2.5 h-2.5"})," Auto-detect"]}):t.jsxs("span",{className:"text-[10px] text-gray-500 dark:text-gray-400 flex items-center gap-0.5",title:"Inferred from the target column's type",children:[t.jsx(tr,{className:"w-2.5 h-2.5"})," Auto"]})]}),t.jsx(Lo,{options:[{label:"Classification",value:"classification"},{label:"Regression",value:"regression"}],label:"Task",value:e.task,onSelect:c=>{o(c)}})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Strategy"}),t.jsx(Lo,{options:[{label:"Voting",value:"voting"},{label:"Stacking",value:"stacking"}],label:"Strategy",value:e.strategy,onSelect:c=>{i(c)}})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Training Mode"}),t.jsx(Lo,{options:[{label:"Basic",value:"basic"},{label:"Advanced (Tuning)",value:"advanced"}],label:"Training Mode",value:e.run_mode,onSelect:c=>{s({run_mode:c})}})]}),t.jsx(ce,{field:"base_estimators",children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Base Models"}),t.jsxs("span",{className:"text-[10px] text-gray-400",children:[((l=e.base_estimators)==null?void 0:l.length)??0," selected"]})]}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:"Click to add or remove each model in the ensemble."}),t.jsx(OF,{ariaLabel:"Base Models",options:r,selected:e.base_estimators??[],onChange:c=>{s({base_estimators:c})}}),t.jsx("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:"Tip: wire model nodes into this ensemble's input to use them as base learners automatically β€” connected models override the selection above."}),n&&t.jsxs("div",{className:"flex items-start gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),t.jsx("span",{children:"Pick at least two base models for a meaningful ensemble."})]})]})}),t.jsx(HF,{config:e,update:s,columns:a})]})}function qF(e,s,r){var a;return s?(a=e.target_column)!=null&&a.trim()?r?{canRun:!1,description:"Choose at least two base models to enable this action."}:{canRun:!0,description:`${e.run_mode==="advanced"?"Tunes":"Trains"} the ${e.strategy} ensemble with ${e.base_estimators.length} base models in the background.`}:{canRun:!1,description:"Choose a target column to enable this action."}:{canRun:!1,description:"Connect a dataset node upstream and select a dataset to enable this action."}}function KF({config:e,datasetId:s,runJob:r,isSubmitting:a,submissionMessage:n,runFeedback:o,runHelpId:i,tooFewModels:l}){const c=e.run_mode==="advanced",d=qF(e,s,l);return t.jsxs(Ed,{details:t.jsx("p",{id:i,className:"text-xs text-center text-muted-foreground",children:d.description}),children:[t.jsxs("button",{type:"button",onClick:()=>{r(c?"tuning":"training","ensemble")},disabled:!d.canRun||a,"aria-describedby":i,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-lg transition-all hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 focus-ring",children:[a?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):c?t.jsx(tr,{className:"w-4 h-4"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:a?"Submitting job...":c?"Tune ensemble":"Train ensemble"})]}),n&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:n}),o&&t.jsx(hi,{run:o,task:"ensemble"})]})}function JF({config:e,update:s}){const r=p.useId(),[a,n]=p.useState(!1),[o,i]=p.useState(!1),l=["halving_grid","halving_random","optuna"].includes(e.search_strategy);return t.jsxs("div",{className:"space-y-3 p-3 rounded-lg border border-purple-100 dark:border-purple-800 bg-purple-50/50 dark:bg-purple-900/10",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(tr,{className:"w-3.5 h-3.5 text-purple-500"}),t.jsx("span",{className:"text-xs font-semibold text-purple-700 dark:text-purple-300",children:"Hyperparameter Tuning"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("label",{htmlFor:`${r}-search_strategy`,children:"Search Strategy"}),t.jsx(Ze,{placement:"bottom-left",text:`Searches the ensemble's own params (e.g. voting/cv), not each base model. Enable "Tune base model hyperparameters" below to also search each model's params.`})]}),l&&t.jsx("button",{type:"button",onClick:()=>{n(!0)},className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 p-0.5 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 transition group flex items-center justify-center","aria-label":"Search strategy settings",title:`${e.search_strategy.replace("_"," ")} Settings`,children:t.jsx(Aa,{size:13,className:"group-hover:rotate-45 transition-transform duration-300"})})]}),t.jsx("select",{id:`${r}-search_strategy`,value:e.search_strategy,onChange:c=>{s({search_strategy:c.target.value,strategy_params:{}})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:_F.map(c=>t.jsx("option",{value:c.value,children:c.label},c.value))})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-n_trials`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Trials"}),t.jsx("input",{id:`${r}-n_trials`,type:"number",min:1,value:e.n_trials,onChange:c=>{s({n_trials:Number(c.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t.jsx("label",{htmlFor:`${r}-random_state`,children:"Random State"}),t.jsx(Ze,{text:"Seed for the search and the final refit β€” same seed + same data = identical tuning outcome."})]}),t.jsx("input",{id:`${r}-random_state`,type:"number",min:0,value:e.random_state??42,onChange:c=>{s({random_state:Number(c.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-metric`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Optimize Metric"}),t.jsx("select",{id:`${r}-metric`,value:e.metric,onChange:c=>{s({metric:c.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:kF(e.task).map(c=>t.jsx("option",{value:c.value,children:c.label},c.value))})]}),t.jsxs("label",{className:"flex items-start gap-2 text-xs text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.tune_base_models!==!1,onChange:c=>{s({tune_base_models:c.target.checked})},className:"mt-0.5 rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),t.jsxs("span",{className:"flex-1",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("strong",{children:"Tune base model hyperparameters"}),t.jsx("button",{type:"button","aria-label":"Base model tuning details","aria-expanded":o,onClick:()=>{i(!o)},className:"text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:o?"Hide details":"Show details",children:t.jsx(tt,{className:`w-3 h-3 transition-transform ${o?"rotate-90":""}`})})]}),o&&t.jsxs("span",{className:"block mt-1 text-gray-500 dark:text-gray-400",children:["Automatically searches each selected base learner's default parameter range (e.g. ",t.jsx("code",{children:"random_forest__n_estimators"}),"), in addition to the ensemble's own params. Ranges are picked automatically per model β€” uncheck this to tune only the ensemble-level params and keep base models at the fixed values set in Basic mode."]})]})]}),a&&t.jsx(Pf,{isOpen:a,onClose:()=>{n(!1)},onSave:c=>{s({strategy_params:c})},strategy:e.search_strategy,initialConfig:e.strategy_params,modelKey:e.model_type})]})}function YF({config:e,update:s,showCV:r,setShowCV:a,columns:n}){const o=p.useId();return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{a(!r)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mc,{className:"w-4 h-4 text-purple-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Cross Validation"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${r?"rotate-90":""}`})]}),r&&t.jsxs("div",{className:"p-3 space-y-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.cv_enabled!==!1,onChange:i=>{s({cv_enabled:i.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Enable Cross-Validation"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 pl-6",children:e.run_mode==="advanced"?"Candidates are already scored by CV during the search. This re-evaluates the winning ensemble after tuning (full metric panel + fold-to-fold variance); it never changes the selected hyperparameters.":"Runs a k-fold evaluation of the trained ensemble after training. Evaluation only β€” it measures generalization and never changes the model or its configuration."}),e.cv_enabled!==!1&&t.jsx(QF,{config:e,update:s,columns:n,fieldId:o})]})]})}function QF({config:e,update:s,columns:r,fieldId:a}){return t.jsxs("div",{className:"space-y-3 pl-6 border-l-2 border-gray-100 dark:border-gray-800",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_folds`,className:"block text-xs text-gray-500 mb-1",children:"Folds"}),t.jsx("input",{id:`${a}-cv_folds`,type:"number",min:2,value:e.cv_folds??5,onChange:n=>{s({cv_folds:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_type`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${a}-cv_type`,value:e.cv_type??"k_fold",onChange:n=>{s({cv_type:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"k_fold",children:"K-Fold"}),t.jsx("option",{value:"stratified_k_fold",children:"Stratified"}),t.jsx("option",{value:"time_series_split",children:"Time Series"}),t.jsx("option",{value:"shuffle_split",children:"Shuffle Split"}),t.jsx("option",{value:"nested_cv",children:"Nested CV"})]})]})]}),e.cv_type==="time_series_split"&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-start gap-1.5 p-2 bg-amber-50 dark:bg-amber-900/20 rounded text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsx("span",{children:"Data must be sorted by time. Select a date column below or ensure your data is pre-sorted."})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_time_column`,className:"block text-xs text-gray-500 mb-1",children:"Time Column (optional)"}),t.jsxs("select",{id:`${a}-cv_time_column`,value:e.cv_time_column??"",onChange:n=>{s({cv_time_column:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"",children:"Auto-detect"}),r.filter(n=>{const o=String(n.dtype).toLowerCase();return o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp")}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name)),r.filter(n=>{const o=String(n.dtype).toLowerCase();return!(o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp"))}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("input",{type:"checkbox",checked:e.cv_shuffle!==!1,onChange:n=>{s({cv_shuffle:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Shuffle Data"]}),e.cv_shuffle!==!1&&e.cv_type!=="time_series_split"&&t.jsxs("div",{children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs text-gray-500 mb-1",children:[t.jsx("label",{htmlFor:`${a}-cv_random_state`,children:"Fold Split Seed"}),t.jsx(Ze,{text:"Seed controlling how rows are dealt to folds β€” same seed = identical fold splits, so CV scores stay comparable across runs."})]}),t.jsx("input",{id:`${a}-cv_random_state`,type:"number",min:0,value:e.cv_random_state??42,onChange:n=>{s({cv_random_state:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]})}function XF({config:e,onChange:s,nodeId:r}){var S;const[a,n]=Ve(560),[o,i]=p.useState(!1),[l,c]=p.useState(!1),[d,u]=p.useState(()=>!sessionStorage.getItem("hide_info_ensemble")),{availableColumns:m,upstreamTarget:h,datasetId:x,runJob:f,isSubmitting:g,submissionMessage:b,runFeedback:y}=Tf(r),v=p.useId(),[j,w]=p.useState(new Set);p.useEffect(()=>{let P=!0;return zr.getAllNodes().then(I=>{P&&w(new Set(I.map(A=>A.id)))}).catch(I=>{console.error("Failed to resolve model registry for ensemble settings:",I)}),()=>{P=!1}},[]);const N=p.useMemo(()=>{const P=[...e.base_estimators??[],...e.final_estimator?[e.final_estimator]:[]];return wF(e.task,j,P)},[e.task,j,e.base_estimators,e.final_estimator]),k=P=>{s({...e,...P})},_=V(P=>P.nodes),R=V(P=>P.edges);p.useEffect(()=>{const P=Qm(r,_,R),I=$F(P,e);I&&s({...e,...I})},[r,R,_,e.task,e.strategy,e.run_mode,e.search_strategy,e.n_trials,e.metric,e.base_estimators,e.target_column,e.cv_enabled,e.cv_folds,e.cv_type,e.cv_shuffle,e.cv_random_state,e.cv_time_column,e.base_estimator_params,s]),p.useEffect(()=>{h&&!e.target_column&&s({...e,target_column:h})},[h,e.target_column]);const M=p.useMemo(()=>Qm(r,_,R).length>0,[r,R,_]);p.useEffect(()=>{if(M||e.task_manual||!e.target_column)return;const P=m.find(A=>A.name===e.target_column),I=NF(P);I&&I!==e.task&&s({...e,task:I,model_type:si(I,e.strategy),base_estimators:If(I),final_estimator:Af(I),metric:$f(I)})},[M,e.task_manual,e.target_column,e.strategy,m]);const E=e.run_mode==="advanced",T=(((S=e.base_estimators)==null?void 0:S.length)??0)<2;return t.jsxs("div",{className:"flex flex-col h-full",ref:a,children:[d&&t.jsxs("div",{className:"mb-4 p-2 bg-purple-50 dark:bg-purple-900/20 border border-purple-100 dark:border-purple-800 rounded text-xs text-purple-700 dark:text-purple-300 flex justify-between items-start gap-2",children:[t.jsxs("span",{children:["Combine several models into one. ",t.jsx("strong",{children:"Voting"})," averages their predictions; ",t.jsx("strong",{children:"Stacking"})," trains a meta-learner on their out-of-fold predictions."]}),t.jsx("button",{type:"button","aria-label":"Dismiss ensemble information",onClick:()=>{u(!1),sessionStorage.setItem("hide_info_ensemble","true")},className:"text-purple-400 hover:text-purple-600 dark:hover:text-purple-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4",children:t.jsxs("div",{className:n?"grid grid-cols-2 gap-x-6 gap-y-5 items-start":"space-y-5",children:[t.jsx(GF,{config:e,update:k,currentOptions:N,columns:m,tooFewModels:T}),t.jsxs("div",{className:"space-y-5",children:[t.jsx(zF,{config:e,update:k,options:N}),t.jsx(BF,{config:e,update:k,optionLabels:Ff(N)}),t.jsx(VF,{config:e,update:k}),t.jsx(UF,{config:e,update:k}),E&&t.jsx(JF,{config:e,update:k}),t.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded px-2 py-1.5",children:[t.jsx(Qe,{className:"w-3 h-3 mt-0.5 shrink-0"}),t.jsxs("span",{children:["Models like SVC/KNN/Logistic Regression benefit from a ",t.jsx("strong",{children:"Scaler"})," node upstream."]})]}),!E&&t.jsx(WF,{config:e,update:k,open:l,setOpen:c,options:N}),t.jsx(YF,{config:e,update:k,showCV:o,setShowCV:i,columns:m})]})]})}),t.jsx(KF,{config:e,datasetId:x,runJob:f,isSubmitting:g,submissionMessage:b,runFeedback:y,runHelpId:v,tooFewModels:T})]})}const ZF=ro({type:"EnsembleNode",label:"Ensemble",description:"Combine multiple models via Voting or Stacking.",icon:zn,settings:XF,defaultConfig:{task:"classification",strategy:"voting",model_type:"voting_classifier",base_estimators:["random_forest","logistic_regression","gradient_boosting"],voting:"soft",final_estimator:"logistic_regression",cv:5,passthrough:!1,n_jobs:1,calibrate_base_models:!1,calibration_method:"sigmoid",calibration_cv:3,cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",base_estimator_params:{},final_estimator_params:{},run_mode:"basic",search_strategy:"random",n_trials:20,metric:"accuracy",tune_base_models:!0,random_state:42},bodyPreview:e=>{var a;const s=((a=e.base_estimators)==null?void 0:a.length)??0,r=e.strategy??"voting";return s?`${r} Β· ${s} ${s===1?"model":"models"}`:r},validate:e=>{var s;return e.target_column?(((s=e.base_estimators)==null?void 0:s.length)??0)<2?{isValid:!1,message:"Select at least two base models.",field:"base_estimators"}:{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"}},inputs:[{id:"in",label:"Data / Models",type:"any"}],outputs:[{id:"model",label:"Ensemble Model",type:"model"}]});function ep(e){if(e.datasetId)return e.datasetId;if(e.dataset_id)return e.dataset_id}function eD(e){var s,r,a,n;if((s=e.data)!=null&&s.datasetId)return e.data.datasetId;if((r=e.data)!=null&&r.dataset_id)return e.data.dataset_id;if((a=e.data)!=null&&a.config){const o=ep(e.data.config);if(o)return o}if((n=e.data)!=null&&n.params)return ep(e.data.params)}function tD(e,s,r){const a=new Set,n=[e];for(;n.length>0;){const o=n.shift();if(!o||a.has(o))continue;a.add(o);const i=s.find(c=>c.id===o);if(!i)continue;if(o!==e){const c=eD(i);if(c)return c}const l=Kt(i,s,r);for(const c of l)n.push(c.id)}}function sD(e,s){var f;const[r,a]=p.useState([]),[n,o]=p.useState(!1),[i,l]=p.useState([]),[c,d]=p.useState(!1),u=i.find(g=>g.id===e.model_type),m=(f=u==null?void 0:u.tags)==null?void 0:f.includes("requires_scaling");p.useEffect(()=>{(async()=>{d(!0);try{const y=(await zr.getAllNodes()).filter(v=>{var N;const j=v.category==="Model"||v.category==="Modeling",w=((N=v.tags)==null?void 0:N.includes("clustering"))??!1;return j&&w});l(y)}catch(b){console.error("Failed to fetch clustering models:",b),l([{id:"kmeans",name:"K-Means",category:"Modeling",description:"",params:{},tags:["clustering"]}])}finally{d(!1)}})()},[]);const h=p.useRef(!1);return p.useEffect(()=>{e.model_type&&(o(!0),Re.getHyperparameters(e.model_type).then(g=>{const b=g;if(a(b),h.current||Object.keys(e.hyperparameters).length===0){const y={};b.forEach(v=>{y[v.name]=v.default}),s({...e,hyperparameters:y}),h.current=!1}}).catch(console.error).finally(()=>{o(!1)}))},[e.model_type]),{hyperparameters:r,isLoadingDefs:n,availableModels:i,isLoadingModels:c,selectedModelItem:u,requiresScaling:m,changeModel:g=>{Object.keys(e.hyperparameters).length>0&&(h.current=!0),s({...e,model_type:g,hyperparameters:{}})}}}function rD(e,s,r,a,n){const o=Ke(g=>s?g.nodeSubmissions[s]:void 0),i=(o==null?void 0:o.pending)??!1,l=(o==null?void 0:o.message)??"",c=o==null?void 0:o.run,{toggleDrawer:d,setTab:u,setActiveParallelRun:m,startPolling:h}=Ke(),x=(g,b,y)=>{var w,N;const v=((w=g.job_ids)==null?void 0:w.length)||1,j={label:b,jobIds:(N=g.job_ids)!=null&&N.length?g.job_ids:[g.job_id]};y({pending:!1,run:j,message:""}),h(),v>1?(m({jobIds:g.job_ids,startedAt:new Date().toISOString()}),le.success("Parallel execution started",`${v} branches submitted.`)):le.success("Segmentation job submitted"),u("segmentation"),Ke.getState().setInspectedRun(null),d(!0)};return{isSubmitting:i,submissionMessage:l,runFeedback:c,handleTrain:async()=>{var v;if(!s||(v=Ke.getState().nodeSubmissions[s])!=null&&v.pending)return;if(!r){le.error("No dataset connected","Connect a dataset node upstream before starting training.");return}const g=j=>Ke.getState().setNodeSubmission(s,j),b=`Segmentation β€” ${e.model_type.replace(/_/g," ")}`;be.getState().setLeakageNotice(null);const y=Ca(a,n);g({pending:!0,run:null,message:`${b}: Submitting...`});try{const j=Ms(a,n);if(Kc(j)){g({pending:!1,run:null,message:`${b} blocked. Move data-learning preprocessing after the train/test split.`});return}const w=await Re.runPipeline({...j,target_node_id:s,job_type:"training"});x(w,b,g)}catch(j){console.error("Failed to submit segmentation job:",j);const w=Sn(j);w&&be.getState().setLeakageNotice({message:w,graphSignature:y}),g({pending:!1,run:null,message:`${b}: Submission failed. ${w??"Check your connection and settings, then try again."}`}),le.error("Failed to submit segmentation job",w??"Check console for details.")}}}}function aD({config:e,onChange:s,fieldId:r,availableModels:a,isLoadingModels:n,requiresScaling:o,showScalingAlert:i,setShowScalingAlert:l,availableColumns:c,changeModel:d}){return t.jsx("div",{className:"space-y-5 animate-in fade-in duration-300",children:t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Configuration"}),t.jsxs("div",{className:"grid gap-3",children:[t.jsxs(ce,{field:"model_type",children:[t.jsx("label",{htmlFor:`${r}-model_type`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Clustering Algorithm"}),t.jsxs("div",{className:"relative",children:[t.jsx("select",{id:`${r}-model_type`,value:e.model_type,onChange:u=>d(u.target.value),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:n,children:a.map(u=>t.jsx("option",{value:u.id,children:u.name},u.id))}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]}),o&&t.jsxs("div",{className:"mt-2 text-xs border border-blue-200 dark:border-blue-800 rounded-md bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 overflow-hidden transition-all",children:[t.jsxs("button",{"aria-expanded":i,onClick:()=>l(!i),className:"w-full flex items-center justify-between p-2 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[t.jsx($t,{className:"w-3 h-3"}),t.jsx("span",{children:"Scale Your Data"})]}),t.jsx(Ce,{className:`w-3 h-3 transition-transform ${i?"rotate-180":""}`})]}),i&&t.jsx("div",{className:"p-2 pt-0 opacity-90 animate-in slide-in-from-top-1 pl-7",children:'This model performs best with scaled features. Consider adding a "Feature Scaling" node.'})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-reference_column`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Reference Column (optional)"}),t.jsx(Ze,{text:"A column with a known real-world label (e.g. a species/customer-type name) that you want excluded from clustering, but kept around afterward to see which cluster corresponds to which group β€” e.g. 'Cluster 0 is 92% setosa'. The model never sees this column."})]}),t.jsxs("div",{className:"relative",children:[t.jsxs("select",{id:`${r}-reference_column`,value:e.reference_column??"",onChange:u=>s({...e,reference_column:u.target.value||void 0}),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:c.length===0,children:[t.jsx("option",{value:"",children:"None"}),c.map(u=>t.jsx("option",{value:u.name,children:u.name},u.name))]}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]})]})]})]})})})}function nD({config:e,onChange:s,fieldId:r,hyperparameters:a,isLoadingDefs:n}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-blue-500"}),"Hyperparameters"]})}),t.jsxs("div",{className:"space-y-3",children:[n?t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(ge,{className:"w-5 h-5 animate-spin text-blue-500"})}):a.map(o=>t.jsx(oD,{param:o,config:e,onChange:s,fieldId:r},o.name)),a.length===0&&!n&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 italic text-center py-4",children:"No parameters available."})]})]})}function oD({param:e,config:s,onChange:r,fieldId:a}){var n;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("label",{htmlFor:`${a}-param-${e.name}`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:e.label}),e.description&&t.jsx(Ze,{text:e.description})]}),e.type==="select"?t.jsx("select",{id:`${a}-param-${e.name}`,value:s.hyperparameters[e.name]??e.default,onChange:o=>r({...s,hyperparameters:{...s.hyperparameters,[e.name]:o.target.value}}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:(n=e.options)==null?void 0:n.map(o=>t.jsx("option",{value:String(o.value),children:o.label},String(o.value)))}):t.jsx(Mf,{id:`${a}-param-${e.name}`,type:e.type,value:s.hyperparameters[e.name]??e.default,onChange:o=>r({...s,hyperparameters:{...s.hyperparameters,[e.name]:o}}),step:e.step,min:e.min,max:e.max})]})}function iD({runHelpId:e,datasetId:s,config:r,selectedModelItem:a,isSubmitting:n,handleTrain:o,submissionMessage:i,runFeedback:l}){return t.jsxs(Ed,{details:t.jsx("p",{id:e,className:"text-xs text-center text-muted-foreground",children:s?r.model_type?`Trains ${(a==null?void 0:a.name)||r.model_type.replace(/_/g," ")} in the background without a target column.`:"Choose a clustering algorithm to enable this action.":"Connect a dataset node upstream and select a dataset to enable this action."}),children:[t.jsxs("button",{type:"button",onClick:()=>{o()},disabled:!s||!r.model_type||n,"aria-describedby":e,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-lg transition-all hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-lg disabled:hover:translate-y-0 focus-ring",children:[n?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:n?"Submitting job...":"Train segmentation"})]}),i&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:i}),l&&t.jsx(hi,{run:l,task:"segmentation"})]})}const lD=({config:e,onChange:s,nodeId:r})=>{const a=p.useId(),n=p.useId(),[o,i]=p.useState(()=>!sessionStorage.getItem("hide_info_segmentation")),l=V(k=>k.nodes),c=V(k=>k.edges),d=tD(r||"",l,c),{data:u}=Me(d),m=u?Object.values(u.columns):[],[h,x]=Ve(),[f,g]=p.useState("model");gs(k=>{k==="model_type"&&g("model")});const[b,y]=p.useState(!0),v=sD(e,s),j=rD(e,r,d,l,c),w=t.jsx(aD,{config:e,onChange:s,fieldId:n,availableColumns:m,availableModels:v.availableModels,isLoadingModels:v.isLoadingModels,requiresScaling:v.requiresScaling,changeModel:v.changeModel,showScalingAlert:b,setShowScalingAlert:y}),N=t.jsx(nD,{config:e,onChange:s,fieldId:n,hyperparameters:v.hyperparameters,isLoadingDefs:v.isLoadingDefs});return t.jsxs("div",{className:"flex flex-col h-full",ref:h,children:[o&&t.jsxs("div",{className:"mb-4 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded text-xs text-blue-700 dark:text-blue-300 flex justify-between items-start gap-2",children:[t.jsx("span",{children:"Group rows into clusters by similarity β€” no target column needed."}),t.jsx("button",{"aria-label":"Dismiss segmentation information",onClick:()=>{i(!1),sessionStorage.setItem("hide_info_segmentation","true")},className:"text-blue-400 hover:text-blue-600 dark:hover:text-blue-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]}),!x&&t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700 mb-4",children:[t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${f==="model"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":f==="model",onClick:()=>{g("model")},children:"Configuration"}),t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${f==="params"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":f==="params",onClick:()=>{g("params")},children:"Hyperparameters"})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4 custom-scrollbar",children:x?t.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[t.jsx("div",{className:"overflow-y-auto pr-2",children:w}),t.jsx("div",{className:"overflow-y-auto pl-2 border-l border-gray-100 dark:border-gray-800",children:N})]}):t.jsxs(t.Fragment,{children:[f==="model"&&w,f==="params"&&N]})}),t.jsx(iD,{runHelpId:a,datasetId:d,config:e,selectedModelItem:v.selectedModelItem,...j})]})},cD=ro({type:"SegmentationNode",label:"Segmentation",description:"Group rows into clusters (segments) by similarity β€” no target column needed.",icon:zn,settings:e=>t.jsx(lD,{...e}),defaultConfig:{model_type:"kmeans",hyperparameters:{}},bodyPreview:e=>e.model_type?`${e.model_type}`:null,validate:e=>e.model_type?{isValid:!0}:{isValid:!1,message:"Select a clustering algorithm.",field:"model_type"},outputs:[{id:"model",label:"Trained Model",type:"model"}]});function dD(e,s,r){var o;const a=new Set,n=[e];for(;n.length>0;){const i=n.shift();if(!i||a.has(i))continue;a.add(i);const l=s.find(d=>d.id===i);if(!l)continue;if(i!==e&&((o=l.data)!=null&&o.datasetId))return l.data.datasetId;const c=Kt(l,s,r);for(const d of c)n.push(d.id)}}function uD({config:e,onChange:s,nodeId:r}){var x;const a=Be(r||""),n=V(f=>f.nodes),o=V(f=>f.edges),i=V(f=>f.executionResult),l=dD(r||"",n,o),c=(x=a.find(f=>f.target_column))==null?void 0:x.target_column;p.useEffect(()=>{const f={};l&&e.datasetId!==l?f.datasetId=l:!l&&e.datasetId&&(f.datasetId=void 0),c&&e.target_column!==c&&(f.target_column=c),Object.keys(f).length>0&&s({...e,...f})},[l,c,e.datasetId,e.target_column,s]);const{data:d,isLoading:u}=Me(l||e.datasetId),m=Je(r),h=d?Object.values(d.columns).map(f=>f.name).filter(f=>!m.has(f)):[];return{upstreamDatasetId:l,upstreamTargetColumn:c,columns:h,isLoading:u,result:i==null?void 0:i.node_results[r||""]}}function mD({upstreamDatasetId:e,isLoading:s}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to configure."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function pD({config:e,onChange:s,columns:r,upstreamTargetColumn:a,showInvalidTarget:n}){return t.jsx(t.Fragment,{children:(e.method!=="variance_threshold"&&e.method!=="correlation_threshold"||n)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Target Column"}),a?t.jsxs("div",{className:"p-2 bg-muted rounded text-sm text-muted-foreground border",children:[a," ",t.jsx("span",{className:"text-xs italic",children:"(Auto-detected)"})]}):t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column??"",onChange:o=>s({...e,target_column:o.target.value}),children:[t.jsx("option",{value:"",children:"Select Target..."}),r.map(o=>t.jsx("option",{value:o,children:o},o))]})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for supervised selection methods."})]})})}function hD(e){const{config:s,onChange:r}=e,a=["select_k_best","select_percentile","select_fpr","select_fdr","select_fwe","generic_univariate_select"].includes(s.method),n=["select_from_model","rfe"].includes(s.method);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Selection Method"}),t.jsxs("select",{"aria-label":"Selection Method",className:"w-full p-2 border rounded bg-background text-sm",value:s.method,onChange:o=>r({...s,method:o.target.value}),children:[t.jsxs("optgroup",{label:"Simple",children:[t.jsx("option",{value:"variance_threshold",children:"Variance Threshold"}),t.jsx("option",{value:"correlation_threshold",children:"Correlation Threshold"})]}),t.jsxs("optgroup",{label:"Univariate",children:[t.jsx("option",{value:"select_k_best",children:"Select K Best"}),t.jsx("option",{value:"select_percentile",children:"Select Percentile"}),t.jsx("option",{value:"select_fpr",children:"False Positive Rate (FPR)"}),t.jsx("option",{value:"select_fdr",children:"False Discovery Rate (FDR)"}),t.jsx("option",{value:"select_fwe",children:"Family-wise Error (FWE)"}),t.jsx("option",{value:"generic_univariate_select",children:"Generic Univariate"})]}),t.jsxs("optgroup",{label:"Model Based",children:[t.jsx("option",{value:"select_from_model",children:"Select From Model"}),t.jsx("option",{value:"rfe",children:"Recursive Feature Elimination (RFE)"})]})]})]}),t.jsx(pD,{...e}),(a||n)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Problem Type"}),t.jsxs("select",{"aria-label":"Problem Type",className:"w-full p-2 border rounded bg-background text-sm",value:s.problem_type??"auto",onChange:o=>r({...s,problem_type:o.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto-detect"}),t.jsx("option",{value:"classification",children:"Classification"}),t.jsx("option",{value:"regression",children:"Regression"})]})]})]})}function xD(e){const s=e.problem_type||"auto";return s==="classification"?[{value:"f_classif",label:"ANOVA F-value"},{value:"mutual_info_classif",label:"Mutual Information"},{value:"chi2",label:"Chi-squared"}]:s==="regression"?[{value:"f_regression",label:"F-value"},{value:"mutual_info_regression",label:"Mutual Information"},{value:"r_regression",label:"Pearson Correlation"}]:[{value:"f_classif",label:"ANOVA F-value (Classif)"},{value:"f_regression",label:"F-value (Reg)"},{value:"mutual_info_classif",label:"Mutual Info (Classif)"},{value:"mutual_info_regression",label:"Mutual Info (Reg)"}]}function gD({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="variance_threshold"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"number",step:"0.01",className:"w-full p-2 border rounded bg-background text-sm",value:e.threshold??0,onChange:r=>s({...e,threshold:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Features with variance lower than this will be removed."})]}),e.method==="correlation_threshold"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"number",step:"0.01",max:"1",min:"0",className:"w-full p-2 border rounded bg-background text-sm",value:e.threshold??.95,onChange:r=>s({...e,threshold:Number.parseFloat(r.target.value)})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Method"}),t.jsxs("select",{"aria-label":"Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.correlation_method??"pearson",onChange:r=>s({...e,correlation_method:r.target.value}),children:[t.jsx("option",{value:"pearson",children:"Pearson"}),t.jsx("option",{value:"spearman",children:"Spearman"}),t.jsx("option",{value:"kendall",children:"Kendall"})]})]})]})]})}function fD({config:e,onChange:s}){const r=["select_k_best","select_percentile","select_fpr","select_fdr","select_fwe","generic_univariate_select"].includes(e.method);return t.jsx(t.Fragment,{children:r&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Scoring Function"}),t.jsxs("select",{"aria-label":"Scoring Function",className:"w-full p-2 border rounded bg-background text-sm",value:e.score_func??"",onChange:a=>s({...e,score_func:a.target.value}),children:[t.jsx("option",{value:"",children:"Auto (Default)"}),xD(e).map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]})]})})}function bD({config:e,onChange:s}){return t.jsx(t.Fragment,{children:(e.method==="select_k_best"||e.method==="rfe")&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"K (Number of Features)"}),t.jsx("input",{"aria-label":"K (Number of Features)",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.k??10,onChange:r=>s({...e,k:st(r.target.value,e.k)})})]})})}function yD({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="select_percentile"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Percentile"}),t.jsx("input",{"aria-label":"Percentile",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.percentile??10,onChange:r=>s({...e,percentile:st(r.target.value,e.percentile)})})]}),["select_fpr","select_fdr","select_fwe"].includes(e.method)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Alpha (Significance)"}),t.jsx("input",{"aria-label":"Alpha (Significance)",type:"number",step:"0.001",className:"w-full p-2 border rounded bg-background text-sm",value:e.alpha??.05,onChange:r=>s({...e,alpha:Number.parseFloat(r.target.value)})})]}),e.method==="generic_univariate_select"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Mode"}),t.jsxs("select",{"aria-label":"Mode",className:"w-full p-2 border rounded bg-background text-sm",value:e.mode??"k_best",onChange:r=>s({...e,mode:r.target.value}),children:[t.jsx("option",{value:"k_best",children:"K Best"}),t.jsx("option",{value:"percentile",children:"Percentile"}),t.jsx("option",{value:"fpr",children:"FPR"}),t.jsx("option",{value:"fdr",children:"FDR"}),t.jsx("option",{value:"fwe",children:"FWE"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Parameter"}),t.jsx("input",{"aria-label":"Parameter",type:"number",step:"0.001",className:"w-full p-2 border rounded bg-background text-sm",value:e.param??1e-5,onChange:r=>s({...e,param:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Value for the selected mode (e.g., k, percentile, or alpha)."})]})]})]})}function vD({config:e,onChange:s}){const r=["select_from_model","rfe"].includes(e.method);return t.jsxs(t.Fragment,{children:[r&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Estimator"}),t.jsxs("select",{"aria-label":"Estimator",className:"w-full p-2 border rounded bg-background text-sm",value:e.estimator??"auto",onChange:a=>s({...e,estimator:a.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"RandomForest",children:"Random Forest"}),t.jsx("option",{value:"LogisticRegression",children:"Logistic Regression"}),t.jsx("option",{value:"LinearRegression",children:"Linear Regression"})]})]}),e.method==="select_from_model"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"text",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"e.g., median, mean, 1.25*mean",value:e.threshold??"median",onChange:a=>s({...e,threshold:a.target.value})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:'String (e.g. "median") or float.'}),t.jsx("span",{className:"text-sm font-medium",children:"Max Features"}),t.jsx("input",{"aria-label":"Max Features",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Optional",value:e.max_features??"",onChange:a=>s({...e,max_features:st(a.target.value,e.max_features)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional cap on the number of features to select. Leave empty for no cap."})]}),e.method==="rfe"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Step"}),t.jsx("input",{"aria-label":"Step",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.step??1,onChange:a=>s({...e,step:st(a.target.value,e.step)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Features to remove at each iteration."})]})]})}function jD({id:e,...s}){const{config:r,onChange:a}=s;return t.jsxs(t.Fragment,{children:[t.jsx(gD,{...s}),t.jsx(fD,{...s}),t.jsx(bD,{...s}),t.jsx(yD,{...s}),t.jsx(vD,{...s}),t.jsxs("div",{className:"flex items-center space-x-2 pt-2 border-t",children:[t.jsx("input",{type:"checkbox",id:`${e}-drop-columns`,className:"rounded border-gray-300",checked:r.drop_columns!==!1,onChange:n=>a({...r,drop_columns:n.target.checked})}),t.jsx("label",{htmlFor:`${e}-drop-columns`,className:"text-sm font-medium",children:"Drop Columns"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"If unchecked, columns will be identified but not removed from the dataset."})]})}function wD(e,s){var r;return(r=s==null?void 0:s.dropped_columns)!=null&&r.length?"dropped":e.status!=="success"?"hidden":s?"none":i$(e.metrics)?"unavailable":"hidden"}function ND({column:e,metrics:s}){var l,c,d,u,m;const r=(l=s.feature_scores)==null?void 0:l[e],a=(c=s.p_values)==null?void 0:c[e],n=(d=s.feature_importances)==null?void 0:d[e],o=(u=s.variances)==null?void 0:u[e],i=(m=s.ranking)==null?void 0:m[e];return t.jsxs("div",{className:"flex flex-col items-end text-[10px] text-muted-foreground",children:[r!==void 0&&t.jsxs("span",{children:["Score: ",r.toFixed(4)]}),a!==void 0&&t.jsxs("span",{children:["p-val: ",a.toExponential(2)]}),n!==void 0&&t.jsxs("span",{children:["Imp: ",n.toFixed(4)]}),o!==void 0&&t.jsxs("span",{children:["Var: ",o.toFixed(4)]}),i!==void 0&&t.jsxs("span",{children:["Rank: ",i]})]})}function kD({metrics:e}){const s=e.dropped_columns;return t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1 flex justify-between items-center",children:t.jsxs("span",{children:["Dropped Columns (",s.length,")"]})}),t.jsx("div",{className:"max-h-40 overflow-y-auto bg-background p-2 rounded border space-y-1",children:s.map(r=>t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[120px] font-medium text-destructive",title:r,children:r}),t.jsx(ND,{column:r,metrics:e})]},r))})]})}function _D({config:e}){return t.jsxs("div",{className:"text-green-600 text-[10px] space-y-1",children:[t.jsx("div",{children:"No columns were dropped."}),e.method==="variance_threshold"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["All features have variance > ",e.threshold??0,". Try increasing the threshold."]}),e.method==="select_k_best"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["K (",e.k??10,") is likely larger than or equal to the number of features. Try reducing K."]}),e.method==="correlation_threshold"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["No feature pairs found with correlation > ",e.threshold??.95,"."]})]})}function SD({state:e,metrics:s,config:r}){switch(e){case"dropped":return t.jsx(kD,{metrics:s});case"unavailable":return t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 rounded border border-yellow-200 dark:border-yellow-800",children:"Feature-selection drop details were unavailable because this wrapped metrics payload could not be resolved to a single step."});case"none":return t.jsx(_D,{config:r});default:return null}}function CD({values:e}){return e?t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1",children:"Top 5 Features"}),t.jsx("div",{className:"max-h-32 overflow-y-auto bg-background p-2 rounded border space-y-1",children:Object.entries(e).sort(([,s],[,r])=>r-s).slice(0,5).map(([s,r])=>t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"truncate max-w-[120px]",title:s,children:s}),t.jsx("span",{className:"font-mono text-[10px]",children:r.toFixed(4)})]},s))})]}):null}function tp({result:e,config:s}){if(!e)return null;const r=Qt(e.metrics),a=wD(e,r),n=(r==null?void 0:r.feature_scores)||(r==null?void 0:r.feature_importances);return!e.error&&a==="hidden"&&!n?null:t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs space-y-3",children:[t.jsx("div",{className:"font-medium text-muted-foreground",children:"Execution Feedback"}),e.error&&t.jsx("div",{className:"p-2 bg-destructive/10 text-destructive rounded border border-destructive/20",children:e.error}),t.jsx(SD,{state:a,metrics:r,config:s}),t.jsx(CD,{values:n})]})}const ED=({config:e,onChange:s,nodeId:r})=>{const a=ae.useId(),{upstreamDatasetId:n,upstreamTargetColumn:o,columns:i,isLoading:l,result:c}=uD({config:e,onChange:s,nodeId:r}),[d,u]=p.useState(!1);gs(x=>{x==="target_column"&&u(!0)});const[m,h]=Ve();return t.jsxs("div",{ref:m,className:`flex flex-col h-full w-full bg-background ${h?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(mD,{upstreamDatasetId:n,isLoading:l}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${h?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${h?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(hD,{config:e,onChange:s,columns:i,upstreamTargetColumn:o,showInvalidTarget:d}),h&&t.jsx(tp,{config:e,result:c})]}),t.jsxs("div",{className:`space-y-4 ${h?"overflow-y-auto pl-2 border-l":"shrink-0 border-t pt-4"}`,children:[t.jsx("h4",{className:"text-xs font-semibold uppercase text-muted-foreground mb-2",children:"Parameters"}),t.jsx(jD,{config:e,onChange:s,id:a}),!h&&t.jsx(tp,{config:e,result:c})]})]})]})},RD={type:"feature_selection",label:"Feature Selection",category:"Preprocessing",description:"Select the most important features.",icon:On,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Selected",type:"dataset"}],settings:ED,bodyPreview:e=>{const s=e.method??"variance_threshold";return(s==="select_k_best"||s==="rfe")&&e.k!=null?`${s} Β· k=${e.k}`:s==="select_percentile"&&e.percentile!=null?`${s} Β· ${e.percentile}%`:s==="variance_threshold"&&e.threshold!=null?`${s} Β· Οƒ>${e.threshold}`:s},validate:e=>e.method!=="variance_threshold"&&e.method!=="correlation_threshold"&&!e.target_column?{isValid:!1,field:"target_column",message:"Target column is required for this method."}:{isValid:!0},getDefaultConfig:()=>({method:"select_k_best",k:10})};function TD({config:e,onChange:s,fieldId:r}){const a=e.validation_size||0,n=1-e.test_size-a;return t.jsxs(t.Fragment,{children:[t.jsx(ce,{field:"test_size",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-test_size`,className:"text-sm font-medium",children:"Test Size (0.0 - 1.0)"}),t.jsx("input",{type:"number",step:"0.05",min:"0.05",max:"0.95",className:"w-full p-2 border rounded bg-background text-sm",id:`${r}-test_size`,value:e.test_size,onChange:o=>s({...e,test_size:Number.parseFloat(o.target.value)})})]})}),t.jsx(ce,{field:"validation_size",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-validation_size`,className:"text-sm font-medium",children:"Validation Size (0.0 - 1.0)"}),t.jsx("input",{type:"number",step:"0.05",min:"0.00",max:"0.95",className:"w-full p-2 border rounded bg-background text-sm",id:`${r}-validation_size`,value:a,onChange:o=>s({...e,validation_size:Number.parseFloat(o.target.value)})}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(n*100),"% Training, ",Math.round(a*100),"% Validation, ",Math.round(e.test_size*100),"% Testing"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"The validation split grades hyperparameter candidates during tuning (instead of CV folds) and is used for threshold tuning. If left at 0, tuning scores candidates with CV folds inside the training split and threshold tuning falls back to the test split."}),n<=0&&t.jsx("p",{className:"text-xs text-red-500 font-medium",children:"Error: Total split size exceeds 100%"})]})})]})}function MD({upstreamDatasetId:e,datasetId:s,isLoading:r}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&!s&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),r&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}const PD=({config:e,onChange:s,nodeId:r})=>{var h,x;const a=p.useId(),n=Be(r||""),o=(h=n.find(f=>f.datasetId))==null?void 0:h.datasetId,i=(x=n.find(f=>f.target_column))==null?void 0:x.target_column;ae.useEffect(()=>{const f={};o&&e.datasetId!==o?f.datasetId=o:!o&&e.datasetId&&(f.datasetId=void 0),i&&e.target_column!==i&&(f.target_column=i),Object.keys(f).length>0&&s({...e,...f})},[o,i,e.datasetId,e.target_column,s]);const{data:l,isLoading:c}=Me(o||e.datasetId),d=l?Object.values(l.columns).map(f=>f.name):[],[u,m]=Ve();return t.jsxs("div",{ref:u,className:`flex flex-col h-full w-full bg-background ${m?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(MD,{upstreamDatasetId:o,datasetId:e.datasetId,isLoading:c}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${m?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${m?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(TD,{config:e,onChange:s,fieldId:a}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${a}-random_state`,className:"text-sm font-medium",children:"Random State"}),t.jsx("input",{type:"number",className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-random_state`,value:e.random_state,onChange:f=>s({...e,random_state:st(f.target.value,e.random_state)})})]})]}),t.jsxs("div",{className:`space-y-4 ${m?"overflow-y-auto pl-2 border-l":"shrink-0 pt-4 border-t"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${a}-shuffle`,checked:e.shuffle,onChange:f=>s({...e,shuffle:f.target.checked})}),t.jsx("label",{htmlFor:`${a}-shuffle`,className:"text-sm font-medium",children:"Shuffle Data"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${a}-stratify`,checked:e.stratify,onChange:f=>s({...e,stratify:f.target.checked})}),t.jsx("label",{htmlFor:`${a}-stratify`,className:"text-sm font-medium",children:"Stratify by Target"})]}),t.jsxs("div",{className:"space-y-2 pl-6 border-l-2 border-muted",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"text-sm font-medium",children:"Target Column"}),t.jsxs("select",{className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-target_column`,value:e.target_column??"",onChange:f=>s({...e,target_column:f.target.value}),disabled:!e.stratify,children:[t.jsx("option",{value:"",children:"-- Select Target --"}),d.map(f=>t.jsx("option",{value:f,children:f},f))]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for stratification. If input is already separated (X, y), this is ignored."})]})]})]})]})},ID={type:"TrainTestSplitter",label:"Train-Test Split",category:"Preprocessing",description:"Split data into training and testing sets.",icon:Ec,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"train",label:"Train",type:"dataset"},{id:"validation",label:"Validation",type:"dataset"},{id:"test",label:"Test",type:"dataset"}],settings:PD,bodyPreview:e=>{const s=e.test_size??.2,r=e.validation_size??0,a=Math.max(0,1-s-r),n=o=>o.toFixed(2).replace(/\.?0+$/,"")||"0";return r>0?`${n(a)} / ${n(r)} / ${n(s)}`:`${n(a)} / ${n(s)}`},validate:e=>{if(e.test_size<=0||e.test_size>=1)return{isValid:!1,message:"Test size must be between 0 and 1.",field:"test_size"};const s=e.validation_size||0;return s<0||s>=1?{isValid:!1,message:"Validation size must be between 0 and 1.",field:"validation_size"}:e.test_size+s>=1?{isValid:!1,message:"Sum of Test and Validation sizes must be less than 1.",field:"validation_size"}:{isValid:!0}},getDefaultConfig:()=>({test_size:.2,validation_size:0,random_state:42,stratify:!1,shuffle:!0})},AD=({config:e,onChange:s,nodeId:r})=>{const a=p.useId(),n=V(u=>u.nodes),o=V(u=>u.edges),l=(u=>{var x;const m=new Set,h=[u];for(;h.length>0;){const f=h.shift();if(!f||m.has(f))continue;m.add(f);const g=n.find(y=>y.id===f);if(!g)continue;if(f!==u&&((x=g.data)!=null&&x.datasetId))return g.data.datasetId;const b=Kt(g,n,o);for(const y of b)h.push(y.id)}})(r||"");ae.useEffect(()=>{l&&e.datasetId!==l?s({...e,datasetId:l}):!l&&e.datasetId&&s({...e,datasetId:void 0})},[l,e.datasetId,s]);const{data:c}=Me(l||e.datasetId),d=c?Object.values(c.columns).map(u=>u.name):[];return t.jsx("div",{className:"p-4 space-y-4",children:t.jsx(ce,{field:"target_column",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"text-sm font-medium",children:"Target Column"}),t.jsxs("select",{className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-target_column`,value:e.target_column,onChange:u=>s({...e,target_column:u.target.value}),children:[t.jsx("option",{value:"",children:"-- Select Target --"}),d.map(u=>t.jsx("option",{value:u,children:u},u))]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This column will be separated as the target (y), and all other columns will be features (X)."})]})})})},$D={type:"feature_target_split",label:"Feature-Target Split",category:"Preprocessing",description:"Separate features (X) from target (y).",icon:Ec,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"X",label:"Features (X)",type:"dataset"},{id:"y",label:"Target (y)",type:"dataset"}],settings:AD,bodyPreview:e=>{const s=e.target_column;return s&&s.trim()?`target: ${s}`:"Set target"},validate:e=>e.target_column?{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"},getDefaultConfig:()=>({target_column:""})};function FD({metrics:e}){return e&&e.DropMissingRows_rows_removed!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Removed:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.DropMissingRows_rows_removed)})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Remaining:"}),t.jsx("span",{className:"font-medium",children:String(e.DropMissingRows_rows_remaining)})]}),t.jsxs("div",{className:"flex justify-between pt-1 border-t",children:[t.jsx("span",{className:"text-muted-foreground",children:"Total Rows:"}),t.jsx("span",{className:"font-medium",children:String(e.DropMissingRows_rows_total)})]})]})]})}const DD=({config:e,onChange:s,nodeId:r})=>{var m;const n=(m=Be(r||"").find(h=>h.datasetId))==null?void 0:m.datasetId,{isLoading:o}=Me(n),i=V(h=>h.executionResult),l=r?i==null?void 0:i.node_results[r]:null,c=Qt(l==null?void 0:l.metrics),[d,u]=Ve();return t.jsxs("div",{ref:d,className:"p-4 space-y-4 h-full overflow-y-auto",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),o&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."}),t.jsxs("div",{className:u?"grid grid-cols-2 gap-6 items-start":"space-y-4",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[t.jsx("input",{type:"checkbox",checked:e.drop_if_any_missing,onChange:h=>s({...e,drop_if_any_missing:h.target.checked}),className:"rounded border-gray-300"}),"Drop rows with ANY missing values"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"If checked, any row containing at least one missing value will be removed."})]}),t.jsxs("div",{className:`space-y-2 ${e.drop_if_any_missing?"opacity-50 pointer-events-none":""}`,children:[t.jsx("span",{className:"block text-sm font-medium",children:"Missing Value Threshold (%)"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{"aria-label":"Missing Value Threshold (%)",type:"range",min:"0",max:"100",value:e.missing_threshold||0,onChange:h=>s({...e,missing_threshold:st(h.target.value,e.missing_threshold)}),className:"flex-1"}),t.jsxs("span",{className:"text-sm w-12 text-right",children:[e.missing_threshold||0,"%"]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop rows that have more than this percentage of missing values."})]})]}),t.jsx(FD,{metrics:c})]})]})},LD={type:"drop_missing_rows",label:"Drop Rows",category:"Preprocessing",description:"Drop rows based on missing values.",icon:gb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Cleaned Data",type:"dataset"}],settings:DD,bodyPreview:e=>{if(e.drop_if_any_missing)return"Drop rows with any missing";const s=e.missing_threshold??0;return s>0?`Drop rows missing > ${s}%`:null},validate:e=>({isValid:!0}),getDefaultConfig:()=>({drop_if_any_missing:!1,missing_threshold:50})};function OD({metrics:e}){return e&&e.Deduplicate_rows_removed!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Duplicates Removed:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.Deduplicate_rows_removed)})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Remaining:"}),t.jsx("span",{className:"font-medium",children:String(e.Deduplicate_rows_remaining)})]}),t.jsxs("div",{className:"flex justify-between pt-1 border-t",children:[t.jsx("span",{className:"text-muted-foreground",children:"Total Rows:"}),t.jsx("span",{className:"font-medium",children:String(e.Deduplicate_rows_total)})]})]})]})}const zD=({config:e,onChange:s,nodeId:r})=>{var f;const n=(f=Be(r||"").find(g=>g.datasetId))==null?void 0:f.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(g=>g.name).filter(g=>!l.has(g)):[],[o,l]),d=V(g=>g.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve();return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),i&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Keep Strategy"}),t.jsxs("select",{"aria-label":"Keep Strategy",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.keep,onChange:g=>s({...e,keep:g.target.value}),children:[t.jsx("option",{value:"first",children:"Keep First Occurrence"}),t.jsx("option",{value:"last",children:"Keep Last Occurrence"}),t.jsx("option",{value:"none",children:"Drop All Duplicates"})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Determines which duplicates (if any) to keep."})]}),t.jsx(OD,{metrics:m})]}),t.jsxs("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Only consider these columns for identifying duplicates. If empty, all columns are used."}),t.jsx(Pe,{columns:c,selected:e.subset,onChange:g=>{s({...e,subset:g})},label:"Subset Columns (Optional)",variant:"panel",isLoading:i,fillHeight:x})]})]})]})},BD={type:"deduplicate",label:"Deduplicate",category:"Preprocessing",description:"Remove duplicate rows.",icon:fb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Unique Data",type:"dataset"}],settings:zD,bodyPreview:e=>{var n;const s=((n=e.subset)==null?void 0:n.length)??0,r=e.keep??"first";return`Subset: ${s===0?"all":`${s} ${s===1?"col":"cols"}`} Β· keep ${r}`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({subset:[],keep:"first"})},VD=[{value:"float",label:"Float (Decimal)"},{value:"float32",label:"Float32"},{value:"int",label:"Integer"},{value:"int8",label:"Int8"},{value:"int16",label:"Int16"},{value:"int32",label:"Int32"},{value:"int64",label:"Int64"},{value:"uint8",label:"UInt8"},{value:"uint16",label:"UInt16"},{value:"uint32",label:"UInt32"},{value:"uint64",label:"UInt64"},{value:"string",label:"String (Text)"},{value:"category",label:"Category"},{value:"bool",label:"Boolean"},{value:"datetime",label:"Datetime"}];function UD({metrics:e}){return e&&(e.cast_errors!==void 0||e.casted_columns_count!==void 0)&&t.jsxs("div",{className:"mt-4 p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[e.casted_columns_count!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Columns Casted:"}),t.jsx("span",{className:"font-medium",children:String(e.casted_columns_count)})]}),e.cast_errors!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Errors Encountered:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.cast_errors)})]})]})]})}function HD({datasetId:e,isLoading:s}){return t.jsxs(t.Fragment,{children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}const WD=({config:e,onChange:s,nodeId:r})=>{var j;const n=(j=Be(r||"").find(w=>w.datasetId))==null?void 0:j.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=o?Object.values(o.columns).map(w=>w.name).filter(w=>!l.has(w)):[],d=c.find(w=>!e.column_types[w]),u=V(w=>w.executionResult),m=r?u==null?void 0:u.node_results[r]:null,h=Qt(m==null?void 0:m.metrics),[x,f]=Ve(),g=()=>{d!==void 0&&s({...e,column_types:{...e.column_types,[d]:"float"}})},b=w=>{const N={...e.column_types};Reflect.deleteProperty(N,w),s({...e,column_types:N})},y=(w,N)=>{if(w===N)return;const k=e.column_types[w];if(k===void 0)return;const _={...e.column_types};Reflect.deleteProperty(_,w),_[N]=k,s({...e,column_types:_})},v=(w,N)=>{s({...e,column_types:{...e.column_types,[w]:N}})};return t.jsxs("div",{ref:x,className:"p-4 space-y-4 h-full overflow-y-auto",children:[t.jsx(HD,{datasetId:n,isLoading:i}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:"Casting Rules"}),t.jsx("button",{"aria-label":"Add Casting Rule",onClick:g,disabled:!n||d===void 0,className:"p-1.5 action-primary rounded disabled:opacity-50 transition-colors",title:"Add Casting Rule",children:t.jsx(Es,{className:"w-4 h-4"})})]}),t.jsxs("div",{className:`space-y-2 ${f?"grid grid-cols-2 gap-2 space-y-0":""}`,children:[Object.entries(e.column_types).map(([w,N])=>t.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded bg-muted/10 group",children:[t.jsxs("div",{className:"flex-1 space-y-2 min-w-0",children:[t.jsx("select",{"aria-label":`Column for casting rule ${w}`,className:"w-full p-1.5 text-sm border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:w,onChange:k=>{y(w,k.target.value)},children:c.map(k=>t.jsx("option",{value:k,disabled:k!==w&&!!e.column_types[k],children:k},k))}),t.jsx("select",{"aria-label":`Data type for ${w}`,className:"w-full p-1.5 text-sm border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:N,onChange:k=>{v(w,k.target.value)},children:VD.map(k=>t.jsx("option",{value:k.value,children:k.label},k.value))})]}),t.jsx("button",{"aria-label":`Remove casting rule for ${w}`,onClick:()=>{b(w)},className:"p-1.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded transition-colors",title:"Remove Rule",children:t.jsx(gt,{className:"w-4 h-4"})})]},w)),Object.keys(e.column_types).length===0&&t.jsx("div",{className:`text-xs text-muted-foreground italic border border-dashed rounded p-8 text-center ${f?"col-span-2":""}`,children:"No casting rules defined. Click + to add one."})]})]}),t.jsx(UD,{metrics:h})]})},GD={type:"casting",label:"Cast Types",category:"Preprocessing",description:"Cast columns to specific data types.",icon:bb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Casted Data",type:"dataset"}],settings:WD,bodyPreview:e=>{const s=Object.keys(e.column_types??{}).length;return s===0?null:`Cast ${s} ${s===1?"col":"cols"}`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({column_types:{}})};function qD({metrics:e}){const s=e==null?void 0:e.missing_indicators_created,r=Array.isArray(e==null?void 0:e.missing_indicators_columns)?e==null?void 0:e.missing_indicators_columns:[];return s!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Indicators Created:"}),t.jsx("span",{className:"font-medium text-primary",children:String(s)})]}),r.length>0&&t.jsxs("div",{className:"pt-1 border-t mt-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1",children:"New Columns:"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(a=>{const n=String(a);return t.jsx("span",{className:"px-1.5 py-0.5 bg-background border rounded text-[10px] font-mono",children:n},n)})})]})]})]})}const KD=({config:e,onChange:s,nodeId:r})=>{var f;const n=(f=Be(r||"").find(g=>g.datasetId))==null?void 0:f.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(g=>g.name).filter(g=>!l.has(g)):[],[o,l]),d=V(g=>g.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve();return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),i&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Indicator Suffix"}),t.jsx("input",{"aria-label":"Indicator Suffix",type:"text",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.flag_suffix,onChange:g=>s({...e,flag_suffix:g.target.value}),placeholder:"_was_missing"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Suffix added to the new indicator columns (e.g., "Age_was_missing").'})]}),t.jsx(qD,{metrics:m})]}),t.jsxs("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Create indicators for these columns. If empty, all columns with missing values are used."}),t.jsx(Pe,{columns:c,selected:e.columns,onChange:g=>{s({...e,columns:g})},label:"Target Columns (Optional)",variant:"panel",isLoading:i,fillHeight:x})]})]})]})},JD={type:"MissingIndicator",label:"Missing Indicator",category:"Preprocessing",description:"Create binary indicators for missing values.",icon:yb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Augmented Data",type:"dataset"}],settings:KD,bodyPreview:e=>{var r;const s=((r=e.columns)==null?void 0:r.length)??0;return s===0?null:`${s} ${s===1?"col":"cols"} β†’ flags`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({columns:[],flag_suffix:"_was_missing"})};function YD(e,s){return e?Object.values(e.columns).map(r=>r.name).filter(r=>!s.has(r)):[]}function QD(e){return e.suggested_node_type==="encoding"||e.type.includes("encoding")||e.type.includes("cardinality")}function XD(e){var c;const r=(c=Be(e||"").find(d=>d.datasetId))==null?void 0:c.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=V(d=>d.executionResult),l=e?i==null?void 0:i.node_results[e]:null;return{datasetId:r,schema:a,isLoading:n,categoricalColumns:YD(a,o),metrics:Qt(l==null?void 0:l.metrics),filteredRecommendations:((i==null?void 0:i.recommendations)||[]).filter(QD)}}const sp={onehot:"Creates binary columns for each category.",dummy:"Like One-Hot but drops first category to avoid collinearity.",label:"Assigns a unique integer to each category.",ordinal:"Encodes categories as ordered integers.",target:"Encodes categories based on target mean.",woe:"Replaces each category with its Weight of Evidence (log-odds of a binary target).",hash:"Maps categories to a fixed number of features."},vl=t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"Feature columns only"})," β€” target is always excluded. Use Label Encoder for the target."]})]}),rp={label:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Encodes ",t.jsx("strong",{children:"target (y)"})," by default. Place after Feature/Target Split."]})]}),ordinal:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Target-safe β€” no columns selected encodes ",t.jsx("strong",{children:"y"}),". Use when order matters (low/mid/high)."]})]}),target:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Replaces each category with the ",t.jsx("strong",{children:"mean of the target"}),". Select the target column on the right."]})]}),woe:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Needs a ",t.jsx("strong",{children:"binary target"})," (exactly 2 classes). The target is auto-excluded β€” use Label Encoder for the target itself. Non-binary targets are ",t.jsx("strong",{children:"skipped"})," (columns pass through unchanged), not an error. Records Information Value (IV) per column."]})]}),onehot:vl,dummy:vl,hash:vl};function ZD({config:e,onChange:s,id:r}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-encoding-method`,className:"block text-sm font-medium",children:"Encoding Method"}),t.jsxs("select",{id:`${r}-encoding-method`,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.method,onChange:a=>s({...e,method:a.target.value}),children:[t.jsx("option",{value:"onehot",children:"One-Hot Encoding"}),t.jsx("option",{value:"dummy",children:"Dummy Encoding"}),t.jsx("option",{value:"label",children:"Label Encoding"}),t.jsx("option",{value:"ordinal",children:"Ordinal Encoding"}),t.jsx("option",{value:"target",children:"Target Encoding"}),t.jsx("option",{value:"woe",children:"Weight of Evidence (WOE)"}),t.jsx("option",{value:"hash",children:"Hash Encoding"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:Object.prototype.hasOwnProperty.call(sp,e.method)&&sp[e.method]}),Object.prototype.hasOwnProperty.call(rp,e.method)&&rp[e.method],e.method==="onehot"&&t.jsxs("div",{className:"pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_original!==!1,onChange:a=>s({...e,drop_original:a.target.checked}),className:"rounded border-gray-300"}),"Drop Original Column"]}),t.jsx("p",{className:"text-[10px] text-muted-foreground ml-5",children:"If unchecked, keeps the original column alongside encoded features."})]})]})}function eL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_first||!1,onChange:r=>s({...e,drop_first:r.target.checked}),className:"rounded border-gray-300"}),"Drop First Category"]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Handle Unknown"}),t.jsxs("select",{"aria-label":"Handle Unknown",className:"w-full p-1 text-sm border rounded",value:e.handle_unknown||"ignore",onChange:r=>s({...e,handle_unknown:r.target.value}),title:"How to handle categories seen in test data but not in training data.",children:[t.jsx("option",{value:"ignore",children:"Ignore (Zeros)"}),t.jsx("option",{value:"error",children:"Raise Error"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:'"Ignore" produces all-zeros for unknown categories.'})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Max Categories"}),t.jsx("input",{"aria-label":"Max Categories",type:"number",min:"2",max:"200",className:"w-full p-1 text-sm border rounded",value:e.max_categories??20,onChange:r=>s({...e,max_categories:st(r.target.value,e.max_categories)}),title:"Caps the number of one-hot columns per feature."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Caps columns per feature (default 20)."})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[t.jsx("input",{type:"checkbox",checked:e.include_missing||!1,onChange:r=>s({...e,include_missing:r.target.checked}),className:"rounded border-gray-300"}),"Include missing as category"]})]})}function tL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_first||!1,onChange:r=>s({...e,drop_first:r.target.checked}),className:"rounded border-gray-300"}),"Drop First Category"]}),t.jsx("p",{className:"text-[10px] text-muted-foreground ml-5",children:"Recommended: avoids the dummy variable trap (multicollinearity)."})]})}function sL({config:e,onChange:s,schema:r,categoricalColumns:a}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Target Column"}),t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column||"",onChange:n=>s({...e,target_column:n.target.value}),children:[t.jsx("option",{value:"",children:"Select a target column..."}),a.map(n=>{const o=r==null?void 0:r.columns[n];return t.jsxs("option",{value:n,children:[n,o?` (${o.dtype})`:""]},n)})]})}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Smoothing"}),t.jsx("input",{"aria-label":"Smoothing",type:"text",className:"w-full p-1 text-sm border rounded",value:e.smooth??"auto",onChange:n=>{const o=n.target.value;s({...e,smooth:o==="auto"||Number.isNaN(Number(o))?"auto":Number(o)})},placeholder:"auto or number",title:"Smoothing strength. 'auto' uses sklearn's default."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Higher = shrinks more toward global mean (default: auto)."})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Target Type"}),t.jsxs("select",{"aria-label":"Target Type",className:"w-full p-1 text-sm border rounded",value:e.target_type||"auto",onChange:n=>s({...e,target_type:n.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto-detect"}),t.jsx("option",{value:"continuous",children:"Continuous (regression)"}),t.jsx("option",{value:"binary",children:"Binary classification"}),t.jsx("option",{value:"multiclass",children:"Multiclass classification"})]})]})]})}function rL({config:e,onChange:s,schema:r}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Target Column"}),t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column||"",onChange:a=>s({...e,target_column:a.target.value}),children:[t.jsx("option",{value:"",children:"Select a binary target column..."}),Object.keys((r==null?void 0:r.columns)??{}).map(a=>{const n=r==null?void 0:r.columns[a];return t.jsxs("option",{value:a,children:[a,n?` (${n.dtype})`:""]},a)})]})}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Target must have exactly 2 classes."}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Regularization"}),t.jsx("input",{"aria-label":"Regularization",type:"number",step:"0.1",min:"0",className:"w-full p-2 border rounded",value:e.regularization??.5,onChange:a=>s({...e,regularization:Number.parseFloat(a.target.value)}),title:"Laplace smoothing added to event/non-event counts to avoid division by zero."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Smoothing for rare categories (default 0.5)."})]})]})}function aL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Number of Features"}),t.jsx("input",{"aria-label":"Number of Features",type:"number",min:"1",className:"w-full p-2 border rounded",value:e.n_features??8,onChange:r=>s({...e,n_features:st(r.target.value,e.n_features)}),title:"Number of hash buckets."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Buckets to hash categories into (default 8)."})]})}function nL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Handle Unknown"}),t.jsxs("select",{"aria-label":"Handle Unknown",className:"w-full p-1 text-sm border rounded",value:e.handle_unknown==="ignore"||!e.handle_unknown?"use_encoded_value":e.handle_unknown,onChange:r=>s({...e,handle_unknown:r.target.value}),title:"How to handle categories not seen during training.",children:[t.jsx("option",{value:"use_encoded_value",children:"Use encoded value (–1)"}),t.jsx("option",{value:"error",children:"Raise error"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:'"Use encoded value" assigns the integer below to unknown categories.'})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Unknown Value"}),t.jsx("input",{"aria-label":"Unknown Value",type:"number",className:"w-full p-2 border rounded",value:e.unknown_value??-1,disabled:e.handle_unknown==="error",onChange:r=>s({...e,unknown_value:st(r.target.value,e.unknown_value)}),title:"Integer to assign for unknown categories."})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("span",{className:"block text-xs font-medium",children:["Category Order ",t.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),t.jsx("textarea",{"aria-label":"Category Order (optional)",className:"w-full p-1.5 text-xs border rounded font-mono resize-y min-h-[56px]",placeholder:`One line per column: +…(click Traceback for full output)`:""]}):t.jsx("p",{className:"text-xs text-slate-400 italic",children:"No traceback recorded."})]})})},FA=({log:e,origin:s,timeRange:r,filters:a})=>t.jsx("tr",{className:"bg-slate-50 dark:bg-slate-800/40",children:t.jsxs("td",{colSpan:8,className:"px-6 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3 text-slate-500 dark:text-slate-400",children:[e.node_id&&t.jsxs("span",{children:[t.jsx("strong",{children:"Node ID:"})," ",e.node_id]}),e.pipeline_id&&t.jsxs("span",{children:[t.jsx("strong",{children:"Pipeline:"})," ",e.pipeline_id]}),e.run_at&&t.jsxs("span",{children:[t.jsx("strong",{children:"Time:"})," ",new Date(e.run_at).toLocaleString()]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Diagnostic ID:"})," ",t.jsx(Cd,{id:e.id,label:"diagnostic ID"})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("strong",{children:"Target:"})," ",t.jsx(so,{nodeId:e.node_id,pipelineId:e.pipeline_id,origin:s,timeRange:r,filters:a})]})]}),t.jsx("pre",{className:"text-xs font-mono bg-slate-900 text-slate-200 rounded-lg p-4 overflow-auto max-h-48 whitespace-pre-wrap leading-relaxed",children:e.message})]})}),DA=({event:e,onResolve:s})=>{const r=!!e.resolved_at;return t.jsx("button",{className:`text-xs font-medium px-2 py-0.5 rounded border transition-colors ${r?"border-green-300 dark:border-green-700 text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20":"border-slate-200 dark:border-slate-600 text-slate-500 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-700"}`,title:r?"Reopen":"Mark resolved",onClick:a=>{a.stopPropagation(),s(e)},children:r?"↩ Reopen":"βœ“ Resolve"})},LA=({events:e,pipelineLogs:s,hasActiveFilters:r,eventsTotalUnfiltered:a,operationalTimeRange:n,linkFilters:o,setModal:i,handleResolve:l})=>e.length===0&&s.length===0?t.jsx(os,{icon:t.jsx(ri,{size:40,className:"text-slate-300"}),title:r?"No matching errors":"No errors recorded",description:r?a===0?"No error events have been recorded yet β€” nothing to search or filter.":`No events match the current search/facets out of ${a} recorded. Try widening the time range or clearing a facet.`:"Any unhandled 5xx or failed pipeline will appear here automatically."}):t.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 overflow-hidden",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"text-left text-xs text-slate-500 dark:text-slate-400 bg-slate-50 dark:bg-slate-900/50 border-b border-slate-200 dark:border-slate-700",children:[t.jsx("th",{className:"px-4 py-3 w-8"}),t.jsx("th",{className:"px-4 py-3",children:"Severity"}),t.jsx("th",{className:"px-4 py-3",children:"Code"}),t.jsx("th",{className:"px-4 py-3",children:"Type"}),t.jsx("th",{className:"px-4 py-3",children:"Message"}),t.jsx("th",{className:"px-4 py-3",children:"Target"}),t.jsx("th",{className:"px-4 py-3",children:"When"}),t.jsx("th",{className:"px-4 py-3"})]})}),t.jsxs("tbody",{children:[s.map(c=>t.jsx(AA,{log:c,origin:"/errors",timeRange:n,filters:o},`pl-${c.id}`)),e.map(c=>t.jsx(PA,{event:c,onExpand:i,onResolve:l,origin:"/errors",timeRange:n,filters:o},c.id))]})]})}),OA=({page:e})=>e.loading?t.jsx(Rs,{message:"Loading error events…"}):e.error?t.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-xl text-amber-700 dark:text-amber-400 text-sm",children:[t.jsx(Te,{size:16}),e.error]}):e.view==="issues"?t.jsx(TA,{...e}):t.jsx(LA,{...e}),zA=()=>{const e=NA();return t.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[t.jsx(kA,{...e}),t.jsx(SA,{...e}),t.jsx(_A,{...e}),t.jsx(CA,{...e}),t.jsx(OA,{page:e}),e.modal&&t.jsx(MA,{event:e.modal,onClose:()=>e.setModal(null),origin:"/errors",timeRange:e.operationalTimeRange,filters:e.linkFilters})]})},BA=p.lazy(()=>cr(()=>import("./EDAPage-BkzWx__1.js"),__vite__mapDeps([5,2,1,3,6,7,8])).then(e=>({default:e.EDAPage}))),VA=p.lazy(()=>cr(()=>import("./DataDriftPage-DBBkKEof.js"),__vite__mapDeps([9,2,1,3,6])).then(e=>({default:e.DataDriftPage}))),UA=p.lazy(()=>cr(()=>import("./ModelRegistry-Bw2YKOFO.js"),__vite__mapDeps([10,2,1,3])).then(e=>({default:e.ModelRegistry}))),HA=p.lazy(()=>cr(()=>import("./DeploymentsPage-DlnI46US.js"),__vite__mapDeps([11,2,1,3])).then(e=>({default:e.DeploymentsPage}))),WA=p.lazy(()=>cr(()=>import("./SlowNodesPage-DjArPNLO.js"),__vite__mapDeps([12,2,1,3])).then(e=>({default:e.SlowNodesPage}))),GA=p.lazy(()=>cr(()=>import("./AuditLogPage-DPVze77q.js"),__vite__mapDeps([13,2,1,3])).then(e=>({default:e.AuditLogPage}))),qA=()=>t.jsx(Fh,{}),Xr=({children:e})=>t.jsx(Gc,{children:t.jsx(p.Suspense,{fallback:t.jsx(qA,{}),children:e})});function KA(){return t.jsx(qv,{children:t.jsx(wv,{children:t.jsxs(vt,{path:"/",element:t.jsx(Lj,{}),children:[t.jsx(vt,{index:!0,element:t.jsx(vw,{})}),t.jsx(vt,{path:"jobs",element:t.jsx(mA,{})}),t.jsx(vt,{path:"data",element:t.jsx(Kw,{})}),t.jsx(vt,{path:"eda",element:t.jsx(Xr,{children:t.jsx(BA,{})})}),t.jsx(vt,{path:"drift",element:t.jsx(Xr,{children:t.jsx(VA,{})})}),t.jsx(vt,{path:"canvas",element:t.jsx(dA,{})}),t.jsx(vt,{path:"registry",element:t.jsx(Xr,{children:t.jsx(UA,{})})}),t.jsx(vt,{path:"deployments",element:t.jsx(Xr,{children:t.jsx(HA,{})})}),t.jsx(vt,{path:"errors",element:t.jsx(zA,{})}),t.jsx(vt,{path:"slow-nodes",element:t.jsx(Xr,{children:t.jsx(WA,{})})}),t.jsx(vt,{path:"audit",element:t.jsx(Xr,{children:t.jsx(GA,{})})})]})})})}const Tr=e=>e&&typeof e=="object"?e:null,JA=e=>{const s=Tr(e),r=s==null?void 0:s.sample;if(!s||!Array.isArray(r)||r.length===0)return t.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No data available"});const a=Tr(r[0])??{},n=Object.keys(a),{name:o,rows:i,colsCount:l}=XA(s),c=r.slice(0,20);return t.jsxs("div",{className:"overflow-x-auto rounded border border-border max-h-72",children:[t.jsxs("div",{className:"text-xs font-semibold mb-1 flex justify-between p-2 bg-muted/50 border-b border-border sticky top-0 z-10",children:[t.jsx("span",{children:o}),t.jsxs("span",{className:"text-muted-foreground",children:[i??"?"," rows x ",l??n.length," cols",c.lengtht.jsx("th",{className:"p-2 border-b border-r border-border text-left font-medium text-muted-foreground last:border-r-0 whitespace-nowrap",children:d},d))})}),t.jsx("tbody",{children:c.map((d,u)=>t.jsx("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20",children:n.map(m=>{var h;return t.jsx("td",{className:"p-2 border-r border-border truncate max-w-[120px] last:border-r-0",children:String(((h=Tr(d))==null?void 0:h[m])??"")},m)})},u))})]})]})},YA=({config:e,onChange:s,nodeId:r})=>{var E;const{nodes:a,edges:n}=V(Qc(T=>({nodes:T.nodes,edges:T.edges}))),[o,i]=p.useState(!1),[l,c]=p.useState(null),[d,u]=p.useState(null),m=p.useMemo(()=>e.lastRunJobIds&&e.lastRunJobIds.length>0?e.lastRunJobIds:e.lastRunJobId?[e.lastRunJobId]:[],[e.lastRunJobIds,e.lastRunJobId]),h=p.useMemo(()=>!r||m.length<=1?[]:n.filter(S=>S.target===r).map((S,P)=>{const I=String.fromCharCode(65+P),A=a.find(z=>z.id===S.source),B=(A==null?void 0:A.data)??{},F=B.label||B.title||(typeof B.definitionType=="string"?B.definitionType.replace(/_/g," ").replace(/\b\w/g,z=>z.toUpperCase()):"");return F?`Path ${I} Β· ${F}`:`Path ${I}`}),[a,n,r,m.length]),{jobs:x}=fd(m,{intervalMs:2e3}),f=async()=>{var S;if(!r)return;be.getState().setLeakageNotice(null);const T=Ca(a,n);i(!0);try{const P=Ms(a,n);if(Kc(P))return;const I=await Re.runPipeline({...P,target_node_id:r,job_type:"preview"}),A=(S=I.job_ids)!=null&&S.length?I.job_ids:[I.job_id];c(null),u(null),s({...e,lastRunJobId:A[0],lastRunJobIds:A})}catch(P){console.error("Failed to run preview:",P);const I=Sn(P);I&&be.getState().setLeakageNotice({message:I,graphSignature:T}),le.error("Failed to start preview job",I??void 0)}finally{i(!1)}},g=p.useMemo(()=>m.map((T,S)=>({label:h[S]||(m.length>1?`Path ${String.fromCharCode(65+S)}`:"Result"),jobId:T,job:x[T]})),[m,h,x]),b=p.useMemo(()=>dd(g.length),[g.length]);p.useEffect(()=>{g.length>0?(!l||!g.some(T=>T.label===l))&&c(g[0].label):l!==null&&c(null)},[g,l]);const y=g.find(T=>T.label===l)||g[0],v=y==null?void 0:y.job,j=((E=v==null?void 0:v.result)==null?void 0:E.metrics)??(v==null?void 0:v.result),w=Tr(j),N=w?Tr(w.data_summary):null,k=w==null?void 0:w.operation_mode,_=typeof k=="string"?k:void 0,R=p.useMemo(()=>N?["train","test","validation","full"].filter(T=>N[T]):[],[N]);p.useEffect(()=>{if(R.length===0){d!==null&&u(null);return}(!d||!R.includes(d))&&u(R[0]??null)},[R,d]);const M=p.useMemo(()=>{if(g.length===0)return"idle";const T=g.map(S=>{var P;return(P=S.job)==null?void 0:P.status});return T.some(S=>S==="failed")?"failed":T.every(S=>S==="completed")?"completed":"running"},[g]);return t.jsxs("div",{className:"p-4 space-y-4 h-full overflow-y-auto",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:"Connect this node to any data output to inspect the data state, schema, and applied transformations. Connecting two or more upstream paths shows each one in its own tab."}),t.jsxs("button",{onClick:()=>{f()},disabled:o,className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-[#38bdf8] via-[#6366f1] to-[#a855f7] text-white px-3 py-1.5 rounded-md hover:opacity-90 disabled:opacity-50 transition-all text-xs font-medium shadow-md",children:[o?t.jsx(at,{size:14,className:"animate-spin"}):t.jsx(ms,{size:14}),o?"Running...":"Run Preview"]}),t.jsx(ZA,{jobIds:m,aggregateStatus:M,branchResults:g}),M!=="idle"&&j&&t.jsx(e$,{branchResults:g,activeBranch:l,branchColors:b,setActiveBranch:c,setActiveTab:u,operationModeText:_,dataSummary:N,splitTabs:R,activeTab:d,activeJob:v,resultRec:w})]})},QA=({data:e})=>{const s=p.useMemo(()=>e.lastRunJobIds&&e.lastRunJobIds.length>0?e.lastRunJobIds:e.lastRunJobId?[e.lastRunJobId]:[],[e.lastRunJobId,e.lastRunJobIds]),{aggregateStatus:r}=fd(s,{intervalMs:5e3}),a=r==="idle"?null:r,n=s.length>0;return t.jsx("div",{className:"text-xs flex items-center gap-2",children:n?a==="completed"?t.jsxs("span",{className:"text-green-600 dark:text-green-400 font-medium flex items-center gap-1",children:[t.jsx(Ut,{size:12})," Ready"]}):a==="failed"?t.jsxs("span",{className:"text-red-600 dark:text-red-400 font-medium flex items-center gap-1",children:[t.jsx($t,{size:12})," Failed"]}):t.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-medium flex items-center gap-1",children:[t.jsx(at,{size:12,className:"animate-spin"})," Running"]}):t.jsx("span",{className:"text-muted-foreground italic",children:"Not run yet"})})};function XA(e){const s=typeof e.name=="string"?e.name:"Dataset",r=Array.isArray(e.shape)?e.shape:null,a=r&&r.length>0?r[0]:void 0,n=r&&r.length>1?r[1]:void 0;return{name:s,rows:a,colsCount:n}}function ZA({jobIds:e,aggregateStatus:s,branchResults:r}){return e.length>0&&s!=="completed"&&t.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2 p-2 bg-muted/30 rounded border border-border",children:[t.jsx("span",{children:"Status:"}),t.jsx("span",{className:`ml-auto font-medium px-1.5 py-0.5 rounded text-[10px] ${s==="failed"?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,children:s}),r.length>1&&t.jsxs("span",{className:"text-[10px] opacity-80",children:[r.filter(a=>{var n;return((n=a.job)==null?void 0:n.status)==="completed"}).length,"/",r.length," branches"]})]})}function e$({branchResults:e,activeBranch:s,branchColors:r,setActiveBranch:a,setActiveTab:n,operationModeText:o,dataSummary:i,splitTabs:l,activeTab:c,activeJob:d,resultRec:u}){return t.jsxs("div",{className:"space-y-3 border-t border-border pt-4 animate-in fade-in slide-in-from-top-2 duration-300",children:[e.length>1&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border pb-1",children:[t.jsx(ds,{size:12,className:"text-muted-foreground mr-1"}),e.map((m,h)=>{var g;const x=s===m.label,f=(g=m.job)==null?void 0:g.status;return t.jsxs("button",{onClick:()=>{a(m.label),n(null)},className:`flex items-center gap-1.5 px-2 py-1 text-[10px] font-medium rounded-md border transition-colors ${x?"bg-background text-foreground border-border":"bg-muted/30 text-muted-foreground hover:bg-muted/50 border-transparent"}`,title:f?`${m.label} β€” ${f}`:m.label,children:[t.jsx("span",{className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:r[h]}}),m.label,f==="failed"&&t.jsx($t,{size:10,className:"text-red-500"}),f==="completed"&&t.jsx(Ut,{size:10,className:"text-green-500"}),f&&f!=="completed"&&f!=="failed"&&t.jsx(at,{size:10,className:"animate-spin"})]},m.label)})]}),t.jsxs("div",{className:"text-[10px] bg-blue-50 dark:bg-blue-950/30 text-blue-700 dark:text-blue-300 p-2 rounded border border-blue-100 dark:border-blue-900/50",children:[t.jsx("strong",{className:"block mb-0.5",children:"Operation Mode"}),o||"Unknown"]}),t.jsx(t$,{dataSummary:i,splitTabs:l,activeTab:c,setActiveTab:n}),(d==null?void 0:d.status)==="failed"&&t.jsxs("div",{className:"text-[10px] bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-400 p-2 rounded border border-red-100 dark:border-red-900/50",children:[t.jsx("strong",{className:"block mb-0.5",children:"Branch failed"}),t.jsx("span",{className:"font-mono whitespace-pre-wrap",children:d.error||"Unknown error"})]}),t.jsx(s$,{resultRec:u})]})}function t$({dataSummary:e,splitTabs:s,activeTab:r,setActiveTab:a}){return e&&s.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"flex border-b border-border",children:s.map(n=>t.jsx("button",{className:`text-[10px] px-3 py-1.5 border-b-2 transition-colors ${r===n?"border-primary font-medium text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>{a(n)},children:n.charAt(0).toUpperCase()+n.slice(1)},n))}),r&&e[r]?JA(e[r]):t.jsxs("div",{className:"text-xs text-muted-foreground p-4 text-center border border-dashed border-border rounded",children:["No ",r??"data"," available"]})]})}function s$({resultRec:e}){return Array.isArray(e==null?void 0:e.applied_transformations)&&e.applied_transformations.length>0&&t.jsxs("div",{className:"pt-2 border-t border-border",children:[t.jsx("div",{className:"text-[10px] font-semibold mb-2 text-foreground",children:"Applied Steps"}),t.jsx("div",{className:"space-y-1.5",children:e.applied_transformations.map((s,r)=>{var a,n;return t.jsxs("div",{className:"text-[10px] flex items-center gap-2 text-muted-foreground p-1.5 bg-muted/30 rounded border border-border",children:[t.jsx("span",{className:"w-4 h-4 rounded-full bg-muted flex items-center justify-center text-[8px] font-medium text-foreground",children:r+1}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"font-medium text-foreground",children:String(((a=Tr(s))==null?void 0:a.transformer_name)??"")}),t.jsx("span",{className:"text-[9px] opacity-80",children:String(((n=Tr(s))==null?void 0:n.transformer_type)??"")})]})]},r)})})]})}const r$={type:"data_preview",label:"Data Preview",category:"Evaluation",description:"Inspect data state and transformations at this point.",icon:Vp,inputs:[{id:"in",label:"Input Data",type:"any"}],outputs:[],component:QA,settings:YA,validate:()=>({isValid:!0}),getDefaultConfig:()=>({})},Me=e=>li({queryKey:["dataset-schema",e],queryFn:()=>gj(e),enabled:!!e,staleTime:1e3*60*5,retry:(s,r)=>{var o;const a=(o=r==null?void 0:r.response)==null?void 0:o.status;return a!==void 0&&a>=500&&s<3}}),a$=({config:e,onChange:s})=>{const r=p.useId(),[a,n]=p.useState(!1),o=p.useRef(null),i=p.useRef(null),l=p.useRef(null);gs(g=>{g==="datasetId"&&n(!1)});const{data:c,isLoading:d}=Me(e.datasetId),u=kw(),m=u.data??[],h=u.isLoading;p.useEffect(()=>{if(!a&&l.current){const g=l.current==="dataset"?i.current:o.current;g&&(l.current=null,g.focus())}},[a,h]);const x=g=>{const b=g.target.value,y=m.find(v=>String(v.id)===b);s({...e,datasetId:b,datasetName:y==null?void 0:y.name})},f=(g,b)=>{l.current="dataset",n(!1),s({...e,datasetId:g,datasetName:b})};return a?t.jsx(Jh,{onUploadComplete:f,onCancel:()=>{l.current="opener",n(!1)}}):t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("label",{htmlFor:r,className:"block text-sm font-medium",children:"Select Dataset"}),t.jsxs("button",{ref:o,onClick:()=>{n(!0)},className:"text-xs flex items-center gap-1 text-link hover:underline font-medium focus-ring",children:[t.jsx(Es,{size:14}),"New Upload"]})]}),t.jsx(ce,{field:"datasetId",children:h?t.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading datasets..."}):t.jsxs("select",{ref:i,id:r,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.datasetId||"",onChange:x,children:[t.jsx("option",{value:"",children:"-- Select --"}),m.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))]})})]}),e.datasetId&&t.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[t.jsx(mb,{size:14}),t.jsx("span",{children:"Dataset Schema"})]}),d?t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."}):c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border rounded-md bg-muted/10 max-h-60 overflow-auto",children:t.jsxs("table",{className:"w-full text-xs text-left min-w-max",children:[t.jsx("thead",{className:"bg-muted/20 sticky top-0 z-10",children:t.jsxs("tr",{children:[t.jsx("th",{className:"p-2 font-medium border-b bg-muted/20",children:"Column"}),t.jsx("th",{className:"p-2 font-medium border-b bg-muted/20",children:"Type"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Missing"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Unique"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Min"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Max"}),t.jsx("th",{className:"p-2 font-medium border-b text-right bg-muted/20",children:"Mean"})]})}),t.jsx("tbody",{children:Object.values(c.columns).map(g=>t.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/20",children:[t.jsx("td",{className:"p-2 font-mono font-medium whitespace-nowrap",children:g.name}),t.jsx("td",{className:"p-2 text-muted-foreground whitespace-nowrap",children:g.dtype}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.missing_count}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.unique_count}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.min_value!==void 0?Number(g.min_value).toFixed(2):"-"}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.max_value!==void 0?Number(g.max_value).toFixed(2):"-"}),t.jsx("td",{className:"p-2 text-right text-muted-foreground",children:g.mean_value!==void 0?Number(g.mean_value).toFixed(2):"-"})]},g.name))})]})}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1 text-center italic",children:"Expand node to see full details"})]}):t.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No schema available."})]})]})},n$=({data:e})=>{const[s,r]=p.useState(void 0);p.useEffect(()=>{e.datasetId&&!e.datasetName&&s===void 0&&Wt.getById(e.datasetId).then(n=>{r(n.name)}).catch(()=>{r(e.datasetId)})},[e.datasetId,e.datasetName,s]);const a=e.datasetName||s||e.datasetId;return t.jsx("div",{className:"text-xs",children:e.datasetId?t.jsx("div",{className:"font-medium truncate max-w-[150px]",title:a,children:a||"Loading..."}):t.jsx("div",{className:"text-muted-foreground italic",children:"Select a dataset"})})},o$={type:"dataset_node",label:"Dataset",category:"Data Source",description:"Load a dataset from the registry.",icon:Ct,inputs:[],outputs:[{id:"data",label:"Data",type:"dataset"}],settings:a$,component:n$,validate:e=>({isValid:!!e.datasetId,message:e.datasetId?void 0:"Dataset is required",field:e.datasetId?void 0:"datasetId"}),getDefaultConfig:()=>({datasetId:""})},Cf=(e,s,r,a=new Set)=>{var o;if(a.has(e.id))return;if(a.add(e.id),(o=e.data)!=null&&o.datasetId)return e.data.datasetId;const n=Kt(e,s,r);for(const i of n){const l=Cf(i,s,r,a);if(l)return l}},Be=e=>{const s=V(a=>a.nodes),r=V(a=>a.edges);return p.useMemo(()=>{const a=s.find(o=>o.id===e);return a?Kt(a,s,r).map(o=>{const i=Cf(o,s,r);return i&&!o.data.datasetId?{...o.data,datasetId:i}:o.data}):[]},[e,s,r])};function Ef(e,s,r,a=new Set){var o;if(a.has(e.id))return new Set;a.add(e.id);const n=new Set;((o=e.data)==null?void 0:o.definitionType)==="drop_missing_columns"&&Array.isArray(e.data.columns)&&e.data.columns.forEach(i=>n.add(i));for(const i of Kt(e,s,r))Ef(i,s,r,a).forEach(l=>n.add(l));return n}function Je(e){const s=V(a=>a.nodes),r=V(a=>a.edges);return p.useMemo(()=>{if(!e)return new Set;const a=s.find(o=>o.id===e);if(!a)return new Set;const n=new Set;for(const o of Kt(a,s,r))Ef(o,s,r).forEach(i=>n.add(i));return n},[e,s,r])}const Ja=(e,s={})=>{var o;const a=(o=Be(e).find(i=>i.datasetId))==null?void 0:o.datasetId,n=V(i=>i.executionResult);return p.useMemo(()=>!a||!(n!=null&&n.recommendations)?[]:n.recommendations.filter(i=>{var l,c;if(s.types||s.suggestedNodeTypes){const d=(l=s.types)==null?void 0:l.includes(i.type),u=(c=s.suggestedNodeTypes)==null?void 0:c.includes(i.suggested_node_type);if(!d&&!u)return!1}return!(s.scope==="column"&&(!i.target_columns||i.target_columns.length===0))}),[n,a,s.types,s.suggestedNodeTypes,s.scope])},Vr=({recommendations:e,onApply:s,className:r=""})=>!e||e.length===0?null:t.jsxs("div",{className:`bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded-md p-3 ${r}`,children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-blue-800 dark:text-blue-300 font-medium text-sm",children:[t.jsx(qp,{className:"w-4 h-4"}),t.jsx("span",{children:"Recommendations"})]}),t.jsx("div",{className:"space-y-2",children:e.map(a=>t.jsx("div",{className:"bg-white dark:bg-slate-800 border border-blue-100 dark:border-blue-800/60 rounded p-2 text-sm shadow-sm hover:shadow-md transition-shadow",children:t.jsxs("div",{className:"flex justify-between items-start gap-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-gray-800 dark:text-slate-200 font-medium text-xs mb-1",children:a.type.replace("_"," ").toUpperCase()}),t.jsx("p",{className:"text-gray-600 dark:text-slate-400 text-xs leading-relaxed",children:a.description}),a.reasoning&&t.jsxs("p",{className:"text-gray-500 dark:text-slate-400 text-[10px] mt-1 italic",children:["Why: ",a.reasoning]})]}),s&&t.jsx("button",{onClick:()=>s(a),className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/30",title:"Apply Recommendation",children:t.jsx(Ut,{className:"w-5 h-5"})})]})},a.rule_id))})]});function Ma(e){return e&&typeof e=="object"?e:null}function Gm(e,s){const r=Ma(e[s]);return Ma(r==null?void 0:r.details)}function i$(e){const s=Ma(e);return Ma(s==null?void 0:s.steps)!==null}function Qt(e,s){const r=Ma(e);if(!r)return null;const a=Ma(r.steps);if(!a)return r;const n=Object.keys(a).filter(o=>Gm(a,o));return n.length!==1?null:Gm(a,n[0])}function Pe({columns:e,selected:s,onChange:r,label:a,"aria-label":n,variant:o="panel",showFooterCount:i=!1,isLoading:l=!1,emptyMessage:c="No columns available",single:d=!1,renderItemBadge:u,fillHeight:m=!0,className:h=""}){const[x,f]=p.useState(""),g=n??a??"Columns",b=e.filter(k=>k.toLowerCase().includes(x.toLowerCase())),y=k=>{if(d){r([k]);return}r(s.includes(k)?s.filter(_=>_!==k):[...s,k])},v=()=>{r(Array.from(new Set([...s,...b])))},j=()=>{r(s.filter(k=>!b.includes(k)))},w=o==="panel",N=w&&m;return t.jsxs("div",{role:"group","aria-label":g,className:`flex flex-col border rounded-md bg-background overflow-hidden ${l$(N,w)} ${h}`,children:[t.jsxs("div",{className:`border-b bg-muted/30 flex flex-col gap-2 shrink-0 ${w?"p-2":"p-1.5"}`,children:[t.jsx(c$,{label:a,isPanel:w,single:d,selectedCount:s.length,accessibleName:g,selectAll:v,selectNone:j}),t.jsxs("div",{className:"relative",children:[t.jsx(lr,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"}),t.jsx("input",{"aria-label":`Search ${g}`,type:"text",placeholder:"Search columns...",value:x,onChange:k=>{f(k.target.value)},className:"w-full text-xs pl-6 pr-2 py-1.5 border rounded bg-background outline-none focus:ring-1 focus:ring-primary focus:border-primary transition-all"})]})]}),t.jsx("div",{className:`overflow-y-auto p-1 space-y-0.5 ${N?"flex-1":w?"max-h-72":"max-h-40"}`,children:t.jsx(d$,{columns:e,filtered:b,selected:s,searchTerm:x,isLoading:l,emptyMessage:c,renderItemBadge:u,toggle:y})}),!w&&i&&t.jsxs("div",{className:"text-[10px] text-muted-foreground text-right px-2 py-1 border-t shrink-0",children:[s.length," selected"]})]})}function l$(e,s){return e?"h-full min-h-[200px]":s?"min-h-[160px]":""}function c$({label:e,isPanel:s,single:r,selectedCount:a,accessibleName:n,selectAll:o,selectNone:i}){const l=s&&!r;return t.jsx(t.Fragment,{children:(e??s)&&t.jsxs("div",{className:"flex items-center justify-between",children:[e&&t.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:[e,!r&&` (${a})`]}),l&&t.jsxs("div",{className:`flex gap-1 ${e?"":"ml-auto"}`,children:[t.jsx("button",{type:"button",onClick:o,"aria-label":`Select all matching ${n}`,className:"text-[10px] px-2 py-1 hover:bg-accent rounded text-muted-foreground hover:text-foreground transition-colors",children:"All"}),t.jsx("button",{type:"button",onClick:i,"aria-label":`Select none of the matching ${n}`,className:"text-[10px] px-2 py-1 hover:bg-accent rounded text-muted-foreground hover:text-foreground transition-colors",children:"None"})]})]})})}function d$({columns:e,filtered:s,selected:r,searchTerm:a,isLoading:n,emptyMessage:o,renderItemBadge:i,toggle:l}){return n?t.jsx("div",{className:"text-xs text-muted-foreground italic p-8 text-center",children:"Loading columns..."}):e.length===0?t.jsx("div",{className:"text-xs text-muted-foreground italic p-8 text-center",children:o}):s.length===0?t.jsxs("div",{className:"text-xs text-muted-foreground text-center py-8",children:['No columns match "',a,'"']}):s.map(c=>{const d=r.includes(c),u=i==null?void 0:i(c);return t.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs px-2 py-1.5 rounded cursor-pointer select-none transition-colors hover:bg-accent/50",children:[t.jsxs("span",{className:"flex items-center gap-2 overflow-hidden",children:[t.jsx("input",{type:"checkbox",checked:d,onChange:()=>{l(c)},className:"rounded border-gray-300 text-primary focus:ring-primary w-3.5 h-3.5 shrink-0"}),t.jsx("span",{className:"truncate font-mono",title:c,children:c})]}),u]},c)})}function st(e,s){const r=Number.parseInt(e,10);return Number.isNaN(r)?s??0:r}function Ve(e=450){const s=p.useRef(null),[r,a]=p.useState(!1);return p.useEffect(()=>{if(!s.current)return;const n=new ResizeObserver(o=>{for(const i of o)a(i.contentRect.width>e)});return n.observe(s.current),()=>{n.disconnect()}},[e]),[s,r]}function u$({metrics:e}){return e&&e.dropped_columns_count!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Columns Dropped:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.dropped_columns_count)})]}),Array.isArray(e.dropped_columns)&&e.dropped_columns.length>0&&t.jsxs("div",{className:"pt-1 border-t mt-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1",children:"Dropped Names:"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.dropped_columns.map(s=>{const r=String(s);return t.jsx("span",{className:"px-1.5 py-0.5 bg-background border rounded text-[10px] font-mono",children:r},r)})})]})]})]})}function m$({datasetId:e,isLoading:s}){return t.jsxs(t.Fragment,{children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function p$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-3 p-3 border rounded-md bg-muted/5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Missing Value Threshold"}),t.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Drop columns with >",e.missing_threshold??0,"% missing values"]})]}),t.jsxs("span",{className:"text-sm font-mono font-bold text-primary bg-primary/10 px-2 py-1 rounded",children:[e.missing_threshold??0,"%"]})]}),t.jsx("input",{"aria-label":"Missing Value Threshold",type:"range",min:"0",max:"100",step:"5",value:e.missing_threshold??0,onChange:r=>s({...e,missing_threshold:st(r.target.value,e.missing_threshold)}),className:"w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer accent-primary"})]})}const h$=({config:e,onChange:s,nodeId:r})=>{var b;const n=(b=Be(r||"").find(y=>y.datasetId))==null?void 0:b.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(y=>y.name).filter(y=>!l.has(y)):[],[o,l]),d=V(y=>y.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve(),f=Ja(r||"",{types:["cleaning","feature_selection"],suggestedNodeTypes:["DropMissingColumns"],scope:"column"}),g=y=>{var v;if((v=y.target_columns)!=null&&v.length){const j=Array.from(new Set([...e.columns,...y.target_columns]));s({...e,columns:j})}};return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:t.jsx(m$,{datasetId:n,isLoading:i})}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[f.length>0&&t.jsx("div",{className:"shrink-0",children:t.jsx(Vr,{recommendations:f,onApply:g})}),t.jsx(p$,{config:e,onChange:s}),t.jsx(u$,{metrics:m})]}),t.jsx("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:x?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:c,selected:e.columns,onChange:y=>{s({...e,columns:y})},label:"Explicitly Drop Columns",variant:"panel",isLoading:i,fillHeight:x})})})]})]})},x$={type:"drop_missing_columns",label:"Drop Columns",category:"Preprocessing",description:"Remove specific columns.",icon:gt,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Data",type:"dataset"}],settings:h$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.missing_threshold??0;return s>0&&r>0?`Drop ${s} cols Β· missing > ${r}%`:s>0?`Drop ${s} ${s===1?"col":"cols"}`:r>0?`Drop missing > ${r}%`:null},validate:e=>{var s,r;return{field:"columns",isValid:(((s=e.columns)==null?void 0:s.length)??0)>0||(e.missing_threshold??0)>0,message:(((r=e.columns)==null?void 0:r.length)??0)===0&&(!e.missing_threshold||e.missing_threshold===0)?"Select columns or set a threshold":void 0}},getDefaultConfig:()=>({columns:[],missing_threshold:0})};function g$(e){const s=e!=null&&e.fill_values&&typeof e.fill_values=="object"?e.fill_values:null,r=e!=null&&e.missing_counts&&typeof e.missing_counts=="object"?e.missing_counts:null;return{fillValues:s,missingCounts:r}}function f$(e){var m;const r=(m=Be(e||"").find(h=>h.datasetId))==null?void 0:m.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=p.useMemo(()=>a?Object.values(a.columns).map(h=>h.name).filter(h=>!o.has(h)):[],[a,o]),l=V(h=>h.executionResult),c=e?l==null?void 0:l.node_results[e]:null,d=Qt(c==null?void 0:c.metrics),u=Ja(e||"",{types:["imputation"],suggestedNodeTypes:["SimpleImputer","KNNImputer","IterativeImputer"],scope:"column"});return{datasetId:r,isLoading:n,availableColumns:i,nodeResult:c,metrics:d,recommendations:u,...g$(d)}}function b$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Imputation Method"}),t.jsxs("select",{"aria-label":"Imputation Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method||"simple",onChange:r=>s({...e,method:r.target.value}),children:[t.jsx("option",{value:"simple",children:"Simple Imputer (Univariate)"}),t.jsx("option",{value:"knn",children:"KNN Imputer (Multivariate)"}),t.jsx("option",{value:"iterative",children:"Iterative Imputer (MICE)"})]})]}),(e.method==="simple"||!e.method)&&t.jsx(y$,{config:e,onChange:s}),e.method==="knn"&&t.jsx(v$,{config:e,onChange:s}),e.method==="iterative"&&t.jsx(j$,{config:e,onChange:s})]})}function y$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Strategy"}),t.jsxs("select",{"aria-label":"Strategy",className:"w-full p-2 border rounded bg-background text-sm",value:e.strategy,onChange:r=>s({...e,strategy:r.target.value}),children:[t.jsx("option",{value:"mean",children:"Mean (Average)"}),t.jsx("option",{value:"median",children:"Median (Middle Value)"}),t.jsx("option",{value:"most_frequent",children:"Most Frequent (Mode)"}),t.jsx("option",{value:"constant",children:"Constant Value"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[e.strategy==="mean"&&"Replaces missing values with the mean of the column. (Numeric only)",e.strategy==="median"&&"Replaces missing values with the median. (Robust to outliers)",e.strategy==="most_frequent"&&"Replaces missing with the most common value. (Categorical/Numeric)",e.strategy==="constant"&&"Replaces missing values with a specific value."]})]}),e.strategy==="constant"&&t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Fill Value"}),t.jsx(ce,{field:"fill_value",children:t.jsx("input",{"aria-label":"Fill Value",type:"text",className:"w-full p-2 border rounded bg-background text-sm",value:e.fill_value||"",onChange:r=>s({...e,fill_value:r.target.value}),placeholder:"Enter value..."})})]})]})}function v$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Number of Neighbors"}),t.jsx("input",{"aria-label":"Number of Neighbors",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.n_neighbors||5,onChange:r=>s({...e,n_neighbors:st(r.target.value,e.n_neighbors)})})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Weights"}),t.jsxs("select",{"aria-label":"Weights",className:"w-full p-2 border rounded bg-background text-sm",value:e.weights||"uniform",onChange:r=>s({...e,weights:r.target.value}),children:[t.jsx("option",{value:"uniform",children:"Uniform"}),t.jsx("option",{value:"distance",children:"Distance"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Uniform: All points in each neighborhood are weighted equally. Distance: Weight points by the inverse of their distance."})]})]})}function j$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Max Iterations"}),t.jsx("input",{"aria-label":"Max Iterations",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.max_iter||10,onChange:r=>s({...e,max_iter:st(r.target.value,e.max_iter)})})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Estimator"}),t.jsxs("select",{"aria-label":"Estimator",className:"w-full p-2 border rounded bg-background text-sm",value:e.estimator||"bayesian_ridge",onChange:r=>s({...e,estimator:r.target.value}),children:[t.jsx("option",{value:"bayesian_ridge",children:"Bayesian Ridge"}),t.jsx("option",{value:"decision_tree",children:"Decision Tree"}),t.jsx("option",{value:"extra_trees",children:"Extra Trees"}),t.jsx("option",{value:"knn",children:"KNN"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"The estimator to use for the imputation steps."})]}),t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Random State"}),t.jsx("input",{"aria-label":"Random State",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.random_state??0,onChange:r=>s({...e,random_state:st(r.target.value,e.random_state)})})]})]})}function w$({datasetId:e,isLoading:s}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function N$({config:e,onChange:s,availableColumns:r,missingCounts:a,isLoading:n,isWide:o}){return t.jsx("div",{className:`flex flex-col overflow-hidden ${o?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:o?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:r,selected:e.columns,onChange:i=>{s({...e,columns:i})},label:"Target Columns",variant:"panel",isLoading:n,fillHeight:o,renderItemBadge:i=>a&&a[i]!==void 0?t.jsx("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0 bg-muted px-1.5 py-0.5 rounded",title:`${String(a[i])} missing values filled`,children:String(a[i])}):null})})})}function qm({metrics:e,fillValues:s,missingCounts:r,nodeResult:a}){return e?t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs",children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-2",children:"Execution Feedback"}),s&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Imputed Values:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 max-h-32 overflow-y-auto",children:Object.entries(s).map(([n,o])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:n,children:[n,":"]}),t.jsx("span",{className:"font-mono",children:typeof o=="number"?o.toFixed(4):String(o)})]},n))})]}),r&&t.jsxs("div",{className:"space-y-1 mt-2",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Missing Values Filled:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 max-h-32 overflow-y-auto",children:Object.entries(r).map(([n,o])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:n,children:[n,":"]}),t.jsx("span",{className:"font-mono",children:String(o)})]},n))}),e.total_missing!==void 0&&t.jsxs("div",{className:"text-[10px] text-muted-foreground mt-1 pt-1 border-t",children:["Total Filled: ",t.jsx("span",{className:"font-mono font-medium",children:String(e.total_missing)})]})]}),!s&&!r&&(a==null?void 0:a.status)==="success"&&t.jsx("div",{className:"text-green-600",children:"Imputation completed successfully."})]}):null}const k$=({config:e,onChange:s,nodeId:r})=>{const a=f$(r),{datasetId:n,isLoading:o,availableColumns:i,missingCounts:l,recommendations:c}=a,[d,u]=Ve(),m=h=>{if(h.target_columns.length>0){const x=Array.from(new Set([...e.columns,...h.target_columns]));s({...e,columns:x})}};return t.jsxs("div",{ref:d,className:`flex flex-col h-full w-full bg-background ${u?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(w$,{datasetId:n,isLoading:o}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${u?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${u?"overflow-y-auto pr-2":"shrink-0"}`,children:[c.length>0&&t.jsx("div",{className:"shrink-0",children:t.jsx(Vr,{recommendations:c,onApply:m})}),t.jsx(b$,{config:e,onChange:s}),u&&t.jsx(qm,{...a})]}),t.jsx(N$,{config:e,onChange:s,availableColumns:i,missingCounts:l,isLoading:o,isWide:u}),!u&&t.jsx(qm,{...a})]})]})},_$={type:"imputation_node",label:"Imputation",category:"Preprocessing",description:"Fill missing values.",icon:pb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Cleaned Data",type:"dataset"}],settings:k$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.strategy??e.method??"mean";return s===0?null:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:e=>e.columns.length===0?{isValid:!1,field:"columns",message:"Select at least one column"}:e.method==="simple"&&e.strategy==="constant"&&(e.fill_value===void 0||e.fill_value==="")?{isValid:!1,field:"fill_value",message:"Fill value is required for Constant strategy"}:{isValid:!0},getDefaultConfig:()=>({columns:[],method:"simple",strategy:"mean",fill_value:0,n_neighbors:5,weights:"uniform",max_iter:10,estimator:"bayesian_ridge",random_state:0})},S$=e=>({field:"columns",isValid:e.columns.length>0,message:e.columns.length===0?"Select at least one column":void 0});function C$(e){switch(e.method){case"standard":return"Target: ΞΌ β‰ˆ 0, Οƒ β‰ˆ 1";case"minmax":return`Target: ${e.feature_range_min??0} to ${e.feature_range_max??1}`;case"robust":return"Target: Median β‰ˆ 0, IQR β‰ˆ 1";case"maxabs":return"Target: MaxAbs = 1";default:return""}}function yl(e,s,r,a,n,o){const i=e[r]?e[r][s]:void 0,l=e[a]?e[a][s]:void 0;return typeof i!="number"?"":`${n}=${i.toFixed(2)}, ${o}=${typeof l=="number"?l.toFixed(2):"-"}`}function E$(e,s,r){switch(e.method){case"standard":return yl(s,r,"mean","scale","ΞΌ","Οƒ");case"minmax":return yl(s,r,"data_min","data_max","Min","Max");case"robust":return yl(s,r,"center","scale","Med","IQR");case"maxabs":{const a=s.max_abs?s.max_abs[r]:void 0;return typeof a=="number"?`MaxAbs=${a.toFixed(2)}`:""}default:return""}}function Km({config:e,metrics:s}){if(!s)return null;const r=s.columns;return r?t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs space-y-2",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("div",{className:"font-medium text-muted-foreground",children:"Scaling Statistics"}),t.jsx("div",{className:"text-[10px] text-primary/80 bg-primary/5 px-1.5 py-0.5 rounded border border-primary/10",title:"Values close to these targets indicate successful scaling.",children:C$(e)})]}),t.jsx("div",{className:"max-h-40 overflow-y-auto bg-background p-2 rounded border space-y-1",children:r.map((a,n)=>{const o=E$(e,s,n);return t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[100px] font-medium",title:a,children:a}),t.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:o})]},a)})})]}):null}function R$({config:e,onChange:s}){return t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Scaling Method"}),t.jsxs("select",{"aria-label":"Scaling Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method,onChange:r=>s({...e,method:r.target.value}),children:[t.jsx("option",{value:"standard",children:"Standard Scaler (Z-Score)"}),t.jsx("option",{value:"minmax",children:"MinMax Scaler (0-1)"}),t.jsx("option",{value:"maxabs",children:"MaxAbs Scaler"}),t.jsx("option",{value:"robust",children:"Robust Scaler (Outlier Safe)"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[e.method==="standard"&&"Centers data around 0 with unit variance.",e.method==="minmax"&&"Scales data to a fixed range [0, 1].",e.method==="maxabs"&&"Scales data by its maximum absolute value.",e.method==="robust"&&"Scales data using statistics that are robust to outliers."]})]})}function T$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_mean??!0,onChange:r=>s({...e,with_mean:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Center Data (with_mean)"})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_std??!0,onChange:r=>s({...e,with_std:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Scale Variance (with_std)"})]})]})}function M$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Feature Range"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("input",{"aria-label":"Feature Range Minimum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Min (0)",value:e.feature_range_min??0,onChange:r=>s({...e,feature_range_min:Number.parseFloat(r.target.value)})}),t.jsx("span",{className:"text-muted-foreground",children:"-"}),t.jsx("input",{"aria-label":"Feature Range Maximum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Max (1)",value:e.feature_range_max??1,onChange:r=>s({...e,feature_range_max:Number.parseFloat(r.target.value)})})]})]})}function P$({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 border-t pt-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Quantile Range"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("input",{"aria-label":"Quantile Range Minimum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Min (25.0)",value:e.quantile_range_min??25,onChange:r=>s({...e,quantile_range_min:Number.parseFloat(r.target.value)})}),t.jsx("span",{className:"text-muted-foreground",children:"-"}),t.jsx("input",{"aria-label":"Quantile Range Maximum",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Max (75.0)",value:e.quantile_range_max??75,onChange:r=>s({...e,quantile_range_max:Number.parseFloat(r.target.value)})})]}),t.jsxs("div",{className:"space-y-2 mt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_centering??!0,onChange:r=>s({...e,with_centering:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Center Data (Median)"})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:e.with_scaling??!0,onChange:r=>s({...e,with_scaling:r.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("span",{children:"Scale Data (IQR)"})]})]})]})}function I$({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsx(R$,{config:e,onChange:s}),e.method==="standard"&&t.jsx(T$,{config:e,onChange:s}),e.method==="minmax"&&t.jsx(M$,{config:e,onChange:s}),e.method==="robust"&&t.jsx(P$,{config:e,onChange:s})]})}function A$(e){var u;const r=(u=Be(e||"").find(m=>m.datasetId))==null?void 0:u.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=V(m=>m.executionResult),l=e?i==null?void 0:i.node_results[e]:null,c=Qt(l==null?void 0:l.metrics),d=a?Object.values(a.columns).filter(m=>["int","float","number"].some(h=>m.dtype.toLowerCase().includes(h))).filter(m=>!o.has(m.name)).map(m=>m.name):[];return{datasetId:r,isLoading:n,numericColumns:d,metrics:c}}const $$=({config:e,onChange:s,nodeId:r})=>{const{datasetId:a,isLoading:n,numericColumns:o,metrics:i}=A$(r),[l,c]=Ve();return t.jsxs("div",{ref:l,className:`flex flex-col h-full w-full bg-background ${c?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:!a&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."})}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${c?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${c?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(I$,{config:e,onChange:s}),c&&t.jsx(Km,{config:e,metrics:i})]}),t.jsx("div",{className:`flex flex-col overflow-hidden ${c?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:c?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:o,selected:e.columns,onChange:d=>{s({...e,columns:d})},label:"Numeric Columns",variant:"panel",isLoading:n,emptyMessage:"No numeric columns found",fillHeight:c})})}),!c&&t.jsx(Km,{config:e,metrics:i})]})]})},F$={type:"scale_numeric_features",label:"Scaling",category:"Preprocessing",description:"Scale numeric features to a standard range.",icon:hb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Scaled Data",type:"dataset"}],settings:$$,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.method??"standard";return s===0?r:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:S$,getDefaultConfig:()=>({columns:[],method:"standard"})};function D$(e){const s=e.data,r=(s==null?void 0:s.datasetId)??(s==null?void 0:s.dataset_id);if(r)return r;const a=s==null?void 0:s.config,n=(a==null?void 0:a.datasetId)??(a==null?void 0:a.dataset_id);if(n)return n;const o=s==null?void 0:s.params;return(o==null?void 0:o.datasetId)??(o==null?void 0:o.dataset_id)}function L$(e,s){var o;const r=new Map(e.nodes.map(i=>[i.node_id,i])),a=new Set,n=[s];for(;n.length>0;){const i=n.pop();a.has(i)||(a.add(i),n.push(...((o=r.get(i))==null?void 0:o.inputs)??[]))}return e.nodes.filter(i=>a.has(i.node_id))}function Rf(e){return e==="tuning"?"Tuning":"Training"}function O$(e,s){const r=String(e.data.model_type||e.data.label||"selected model").replace(/_/g," ");return`${Rf(s)} β€” ${r}`}function z$(e,s){return s??(e instanceof Error&&e.message?e.message:"Check your connection and settings, then try again.")}function B$(e,s,r){if(!e)return;const a=new Set,n=[e];for(;n.length>0;){const o=n.shift();if(!o||a.has(o))continue;a.add(o);const i=s.find(l=>l.id===o);if(i){if(o!==e){const l=D$(i);if(l)return l}for(const l of Kt(i,s,r))n.push(l.id)}}}function Tf(e){var f;const s=V(g=>g.nodes),r=V(g=>g.edges),a=Be(e||""),{toggleDrawer:n,setTab:o,setActiveParallelRun:i,startPolling:l}=Ke(),c=Ke(g=>e?g.nodeSubmissions[e]:void 0),d=p.useMemo(()=>B$(e,s,r),[e,s,r]),{data:u}=Me(d),m=p.useMemo(()=>u?Object.values(u.columns):[],[u]),h=(f=a.find(g=>g.target_column))==null?void 0:f.target_column,x=p.useCallback(async(g,b)=>{var N,k;if(!e||(N=Ke.getState().nodeSubmissions[e])!=null&&N.pending)return;const y=s.find(_=>_.id===e);if(!y)return;const v=O$(y,g),j=_=>Ke.getState().setNodeSubmission(e,_);if(!d){j({pending:!1,run:null,message:`${v} blocked. Connect a dataset upstream and select a dataset.`});return}be.getState().setLeakageNotice(null);const w=Ca(s,r);j({pending:!0,run:null,message:`${v}: Submitting...`});try{const _=Ms(s,r),R=L$(_,e);if(Kc({nodes:R})){j({pending:!1,run:null,message:`${v} blocked. Move data-learning preprocessing after the train/test split.`});return}const M=await Re.runPipeline({..._,target_node_id:e,job_type:g}),E=(k=M.job_ids)!=null&&k.length?M.job_ids:[M.job_id],T=E.length;j({pending:!1,message:"",run:{label:v,jobIds:E}}),l(),T>1?(i({jobIds:M.job_ids,startedAt:new Date().toISOString()}),le.success("Parallel execution started",`${T} branches submitted.`)):le.success(`${Rf(g)} job submitted`),o(b),Ke.getState().setInspectedRun(null),n(!0)}catch(_){console.error("Failed to submit job:",_);const R=Sn(_);R&&be.getState().setLeakageNotice({message:R,graphSignature:w});const M=z$(_,R);j({pending:!1,run:null,message:`${v}: Submission failed. ${M}`}),le.error("Failed to submit job",M)}},[e,s,r,d,i,l,o,n]);return{availableColumns:m,upstreamTarget:h,datasetId:d,runJob:x,isSubmitting:(c==null?void 0:c.pending)??!1,submissionMessage:(c==null?void 0:c.message)??"",runFeedback:(c==null?void 0:c.run)??null}}const V$={classification:"classification",regression:"regression",text_classification:"text"},U$=(e,s)=>{if(!e.depends_on)return!0;const{param:r,value:a}=e.depends_on;return(s[r]??e.default)===a},H$=(e,s)=>{if(!e.depends_on)return!0;const{param:r,value:a}=e.depends_on,n=s[r];return Array.isArray(n)&&n.includes(a)};function W$(e,s){var r;return e!==void 0?e!=="regression":((r=s==null?void 0:s.tags)==null?void 0:r.includes("classification"))??!1}function G$(e,s){var n,o;const r=e.category==="Model"||e.category==="Modeling",a=((n=e.tags)==null?void 0:n.includes("clustering"))??!1;return!r||a?!1:s?((o=e.tags)==null?void 0:o.includes(s))??!1:!0}function Jm(e){return e==="grid"||e==="halving_grid"}function q$(e,s,r){return!e&&!s&&r.length>0}function K$(e,s,r,a){var Ye;const n=e.run_mode==="advanced",o=a?V$[a]:void 0,[i,l]=p.useState([]),[c,d]=p.useState(!1),[u,m]=p.useState([]),[h,x]=p.useState(!1),f=p.useId(),[g,b]=p.useState(!1),[y,v]=p.useState(!1),[j,w]=p.useState(()=>!sessionStorage.getItem("hide_info_training_node")),{availableColumns:N,upstreamTarget:k,datasetId:_,runJob:R,isSubmitting:M,submissionMessage:E,runFeedback:T}=Tf(r),[S,P]=Ve(),[I,A]=p.useState("model");gs(we=>{(we==="model_type"||we==="target_column")&&A("model")});const[B,F]=p.useState(!1),[z,L]=p.useState([]),[K,re]=p.useState(!1),[de,O]=p.useState(!0),q=z.find(we=>we.id===e.model_type),D=(Ye=q==null?void 0:q.tags)==null?void 0:Ye.includes("requires_scaling"),G=W$(a,q);p.useEffect(()=>{(async()=>{re(!0);try{const Y=(await zr.getAllNodes()).filter(U=>G$(U,o));L(Y)}catch(ee){console.error("Failed to fetch models:",ee),L([{id:"random_forest_classifier",name:"Random Forest Classifier",category:"Modeling",description:"",params:{}},{id:"logistic_regression",name:"Logistic Regression",category:"Modeling",description:"",params:{}},{id:"sgd_classifier",name:"SGD Classifier",category:"Modeling",description:"",params:{}},{id:"ridge_regression",name:"Ridge Regression",category:"Modeling",description:"",params:{}},{id:"random_forest_regressor",name:"Random Forest Regressor",category:"Modeling",description:"",params:{}}])}finally{re(!1)}})()},[o]);const J=p.useRef(!1);p.useEffect(()=>{n||e.model_type&&(d(!0),Re.getHyperparameters(e.model_type).then(we=>{const ee=we;if(l(ee),J.current){const Y={};ee.forEach(U=>{Y[U.name]=U.default}),s({...e,hyperparameters:Y}),J.current=!1}}).catch(console.error).finally(()=>{d(!1)}))},[e.model_type,n]);const X=p.useRef(null),oe=p.useRef(null);p.useEffect(()=>{if(!n)return;const we=(Y,U,pe)=>{s({...e,search_space:Y||{}}),X.current=U,oe.current=pe};(async()=>{const Y=e.model_type,U=e.search_strategy??"random";if(!Y)return;const pe=Y!==X.current,fe=Jm(oe.current),Xe=Jm(U),dt=fe!==Xe;if(!q$(pe,dt,u)){x(!0);try{if(pe){const ut=await Re.getHyperparameters(Y);m(ut)}if(pe||dt){const ut=await Re.getDefaultSearchSpace(Y,U);we(ut,Y,U)}}catch(ut){console.error("Failed to load model hyperparameters:",ut)}finally{x(!1)}}})()},[e.model_type,e.search_strategy,n]),p.useEffect(()=>{k&&e.target_column!==k&&(n?s({...e,target_column:k}):e.target_column||s({...e,target_column:k}))},[k,e.target_column,n]);const ve=a??kt(e.model_type,z),H=ve==="other"?"classification":ve,W=async()=>{await R(n?"tuning":"training",H)},ue=Object.keys(e.hyperparameters).length>0;return{config:e,onChange:s,isAdvanced:n,hyperparameters:i,isLoadingHyperparamDefs:c,searchSpaceDefs:u,isLoadingSearchSpaceDefs:h,fieldId:f,showStrategyModal:g,setShowStrategyModal:b,showParamsModal:y,setShowParamsModal:v,showInfo:j,setShowInfo:w,availableColumns:N,datasetId:_,isSubmitting:M,submissionMessage:E,runFeedback:T,containerRef:S,isWide:P,activeTab:I,setActiveTab:A,showCV:B,setShowCV:F,availableModels:z,isLoadingModels:K,showScalingAlert:de,setShowScalingAlert:O,selectedModelItem:q,requiresScaling:D,isClassification:G,keepCustomizationOpen:J,historyTask:H,handleSubmit:W,useCustomParams:ue,toggleCustomParams:we=>{if(we){const ee={};i.forEach(Y=>{ee[Y.name]=Y.default}),Object.keys(e.hyperparameters).length===0&&s({...e,hyperparameters:ee})}else s({...e,hyperparameters:{}})}}}const Ze=({text:e,placement:s="top"})=>t.jsx(ef,{delayDuration:0,children:t.jsxs(tf,{children:[t.jsx(sf,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":"Help",className:"inline-flex shrink-0 rounded focus-ring",children:t.jsx(Wp,{"aria-hidden":"true",className:"w-3 h-3 text-gray-400 cursor-help"})})}),t.jsx(T4,{children:t.jsxs(wd,{side:s==="bottom-left"?"bottom":"top",align:s==="bottom-left"?"start":"center",sideOffset:6,collisionPadding:8,onEscapeKeyDown:r=>r.stopPropagation(),className:`z-[200] rounded-md bg-gray-900 p-2.5 text-xs text-white shadow-xl ${s==="bottom-left"?"w-56":"w-48"}`,children:[e,t.jsx(M4,{className:"fill-gray-900"})]})})]})}),J$=({strategy:e,strategyParams:s,onCustomize:r})=>{if(s!=null&&Object.keys(s).length>0){const o=Y$(e,s);return t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"mt-1.5 text-xs text-blue-600 dark:text-blue-400",children:["βš™ ",o.join(" Β· ")]}),e==="halving_grid"&&t.jsxs("p",{className:"mt-1 text-xs text-amber-600 dark:text-amber-400",children:["⚠️ Evaluates the full grid β€” large search spaces can take many minutes. Reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section below, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]})}const n=e==="optuna"?"sampler: tpe Β· pruner: median":"factor: 3 Β· min: exhaust";return t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"mt-1.5 text-xs text-gray-500 dark:text-gray-400",children:["Using defaults (",n,")."," ",t.jsx("button",{type:"button",onClick:r,className:"underline hover:text-blue-500 transition-colors",children:"Customize"})]}),e==="halving_grid"&&t.jsxs("p",{className:"mt-1 text-xs text-amber-600 dark:text-amber-400",children:["⚠️ Evaluates the full grid β€” large search spaces can take many minutes. Reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section below, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]})};function Y$(e,s){if(e==="optuna"){const a=[`sampler: ${s.sampler??"tpe"}`,`pruner: ${s.pruner??"median"}`];return s.timeout&&a.push(`timeout: ${s.timeout}s`),a}const r=[];return s.factor&&r.push(`factor: ${s.factor}`),s.min_resources&&r.push(`min: ${s.min_resources}`),r}function Q$({config:e,onChange:s,fieldId:r,isClassification:a,setShowStrategyModal:n}){return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700"}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Tuning Strategy"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("label",{htmlFor:`${r}-search-method`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Search Method"}),t.jsx(Ze,{placement:"bottom-left",text:X$(e.search_strategy)})]}),Ym(e.search_strategy)&&t.jsx("button",{type:"button",onClick:()=>n(!0),className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 p-1 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 transition group flex items-center justify-center","aria-label":"Search strategy settings",title:`${e.search_strategy.replace("_"," ")} Settings`,children:t.jsx(Aa,{size:14,className:"group-hover:rotate-45 transition-transform duration-300"})})]}),t.jsxs("select",{id:`${r}-search-method`,value:e.search_strategy??"random",onChange:o=>{const i=o.target.value;s({...e,search_strategy:i,strategy_params:{}})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"random",children:"Random Search"}),t.jsx("option",{value:"grid",children:"Grid Search"}),t.jsx("option",{value:"halving_grid",children:"Successive Halving (Grid)"}),t.jsx("option",{value:"halving_random",children:"Successive Halving (Randomized)"}),t.jsx("option",{value:"optuna",children:"Optuna Search"})]}),Ym(e.search_strategy)&&t.jsx(J$,{strategy:e.search_strategy,strategyParams:e.strategy_params,onCustomize:()=>n(!0)})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-metric`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Metric"}),t.jsxs("select",{id:`${r}-metric`,value:e.metric,onChange:o=>s({...e,metric:o.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"accuracy",children:"Accuracy"}),t.jsx("option",{value:"f1",children:"F1 Score"}),t.jsx("option",{value:"roc_auc",children:"ROC AUC"}),t.jsx("option",{value:"mse",children:"MSE"}),t.jsx("option",{value:"rmse",children:"RMSE"}),t.jsx("option",{value:"mae",children:"MAE"}),t.jsx("option",{value:"r2",children:"R2 Score"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-trials`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Trials"}),t.jsx("input",{id:`${r}-trials`,type:"number",value:e.n_trials,onChange:o=>s({...e,n_trials:Number(o.target.value)}),disabled:["grid","halving_grid"].includes(e.search_strategy),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 disabled:opacity-50",min:1})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-random-state`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Random State"}),t.jsx(Ze,{text:"Seed for the search and the final refit β€” same seed + same data = identical tuning outcome. Applies to every candidate, not just the winner."})]}),t.jsx("input",{id:`${r}-random-state`,type:"number",value:e.random_state??42,onChange:o=>s({...e,random_state:Number(o.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:0})]}),a&&t.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-tune_threshold`,checked:e.tune_threshold??!1,onChange:o=>s({...e,tune_threshold:o.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-tune_threshold`,className:"text-xs text-gray-600 dark:text-gray-400",children:"Tune decision threshold"}),t.jsx(Ze,{text:"After tuning, picks the probability cutoff that maximises your metric on the validation split (binary targets). Predictions then use that cutoff instead of the default 0.5. Needs a validation split; probability-only metrics like ROC AUC fall back to balanced accuracy for the cutoff search."})]})]})]})]})}function Ym(e){return["halving_grid","halving_random","optuna"].includes(e)}function X$(e){switch(e){case"optuna":return"Optuna uses Bayesian optimization (TPE) to efficiently find optimal hyperparameters with early pruning.";case"halving_grid":return"Successive Halving (Grid) tests all combinations but quickly drops poorly performing candidates to save time.";case"halving_random":return"Successive Halving (Random) tests random combinations but quickly drops poorly performing candidates.";case"grid":return"Grid Search tests every single combination in the search space. Can be very slow and computationally expensive.";default:return"Random Search tests a random subset of parameter combinations. Fast and often surprisingly effective compared to Grid Search."}}function Z$({config:e,onChange:s,fieldId:r,isAdvanced:a,showCV:n,setShowCV:o,availableColumns:i}){return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{"aria-expanded":n,onClick:()=>{o(!n)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mc,{className:"w-4 h-4 text-blue-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Cross Validation"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${n?"rotate-90":""}`})]}),n&&t.jsxs("div",{className:"p-3 space-y-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-cv_enabled`,checked:e.cv_enabled!==!1,onChange:l=>s({...e,cv_enabled:l.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-cv_enabled`,className:"text-sm text-gray-700 dark:text-gray-300",children:"Enable Cross-Validation"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2 pl-6",children:a?"Candidates are already scored by CV during the search. This re-evaluates the winning model after tuning (full metric panel + fold-to-fold variance); it never changes the selected hyperparameters.":"Runs a k-fold evaluation of the trained model after training. Evaluation only, it measures generalization and never changes the model or its hyperparameters."}),e.cv_enabled!==!1&&t.jsx(eF,{config:e,onChange:s,fieldId:r,availableColumns:i})]})]})}function eF({config:e,onChange:s,fieldId:r,availableColumns:a}){return t.jsxs("div",{className:"space-y-3 pl-6 border-l-2 border-gray-100 dark:border-gray-800",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-folds`,className:"block text-xs text-gray-500 mb-1",children:"Folds"}),t.jsx("input",{id:`${r}-cv-folds`,type:"number",value:e.cv_folds??5,onChange:n=>s({...e,cv_folds:Number(n.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:2})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-method`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${r}-cv-method`,value:e.cv_type??"k_fold",onChange:n=>s({...e,cv_type:n.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"k_fold",children:"K-Fold"}),t.jsx("option",{value:"stratified_k_fold",children:"Stratified"}),t.jsx("option",{value:"time_series_split",children:"Time Series"}),t.jsx("option",{value:"shuffle_split",children:"Shuffle Split"}),t.jsx("option",{value:"nested_cv",children:"Nested CV"})]})]})]}),e.cv_type==="time_series_split"&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-start gap-1.5 p-2 bg-amber-50 dark:bg-amber-900/20 rounded text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsx("span",{children:"Data must be sorted by time. Select a date column below or ensure your data is pre-sorted."})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-cv-time-column`,className:"block text-xs text-gray-500 mb-1",children:"Time Column (optional)"}),t.jsxs("select",{id:`${r}-cv-time-column`,value:e.cv_time_column??"",onChange:n=>s({...e,cv_time_column:n.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"",children:"Auto-detect"}),a.filter(n=>{const o=String(n.dtype).toLowerCase();return o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp")}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name)),a.filter(n=>{const o=String(n.dtype).toLowerCase();return!(o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp"))}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${r}-cv_shuffle`,checked:e.cv_shuffle!==!1,onChange:n=>s({...e,cv_shuffle:n.target.checked}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{htmlFor:`${r}-cv_shuffle`,className:"text-xs text-gray-600 dark:text-gray-400",children:"Shuffle Data"})]}),e.cv_shuffle!==!1&&e.cv_type!=="time_series_split"&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-cv-seed`,className:"block text-xs text-gray-500",children:"Fold Split Seed"}),t.jsx(Ze,{text:"Seed controlling how rows are dealt to folds β€” same seed = identical fold splits, so CV scores stay comparable across runs."})]}),t.jsx("input",{id:`${r}-cv-seed`,type:"number",value:e.cv_random_state??42,onChange:n=>s({...e,cv_random_state:Number(n.target.value)}),className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",min:0})]})]})}const tF=({value:e,onSelect:s})=>t.jsx("div",{role:"group","aria-label":"Training Mode",className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:[["basic","Basic"],["advanced","Advanced (Tuning)"]].map(([r,a])=>t.jsx("button",{type:"button","aria-pressed":e===r,onClick:()=>{s(r)},className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${e===r?"bg-white dark:bg-gray-700 text-purple-600 dark:text-purple-300 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:a},r))});function sF({config:e,onChange:s,isAdvanced:r,fieldId:a,availableModels:n,isLoadingModels:o,requiresScaling:i,showScalingAlert:l,setShowScalingAlert:c,keepCustomizationOpen:d,availableColumns:u,isClassification:m,setShowStrategyModal:h,showCV:x,setShowCV:f}){return t.jsxs("div",{className:"space-y-5 animate-in fade-in duration-300",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Training Mode"}),t.jsx(tF,{value:e.run_mode,onSelect:g=>{s({...e,run_mode:g})}})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Configuration"}),t.jsxs("div",{className:"grid gap-3",children:[t.jsxs(ce,{field:"model_type",children:[t.jsx("label",{htmlFor:`${a}-model`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Model Type"}),t.jsxs("div",{className:"relative",children:[t.jsx("select",{id:`${a}-model`,value:e.model_type,onChange:g=>{if(r){s({...e,model_type:g.target.value,search_space:{}});return}Object.keys(e.hyperparameters).length>0&&(d.current=!0),s({...e,model_type:g.target.value,hyperparameters:{}})},className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:o,children:n.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]}),i&&t.jsxs("div",{className:"mt-2 text-xs border border-blue-200 dark:border-blue-800 rounded-md bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 overflow-hidden transition-all",children:[t.jsxs("button",{"aria-expanded":l,onClick:()=>c(!l),className:"w-full flex items-center justify-between p-2 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[t.jsx($t,{className:"w-3 h-3"}),t.jsx("span",{children:"Scale Your Data"})]}),t.jsx(Ce,{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`})]}),l&&t.jsx("div",{className:"p-2 pt-0 opacity-90 animate-in slide-in-from-top-1 pl-7",children:'This model performs best with scaled features. Consider adding a "Feature Scaling" node.'})]})]}),t.jsxs(ce,{field:"target_column",children:[t.jsx("label",{htmlFor:`${a}-target`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Target Column"}),u.length===0&&t.jsxs("div",{className:"mb-2 p-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded text-xs text-yellow-700 dark:text-yellow-400 flex items-center gap-2",children:[t.jsx(Te,{className:"w-3 h-3"}),t.jsx("span",{children:"Connect a dataset node to see available columns"})]}),t.jsxs("div",{className:"relative",children:[u.length>0?t.jsxs("select",{id:`${a}-target`,value:e.target_column,onChange:g=>s({...e,target_column:g.target.value}),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:[t.jsx("option",{value:"",children:"Select target..."}),u.map(g=>t.jsx("option",{value:g.name,children:g.name},g.name))]}):t.jsx("input",{id:`${a}-target`,type:"text",value:e.target_column,onChange:g=>s({...e,target_column:g.target.value}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",placeholder:"e.g., target"}),u.length>0&&t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]})]})]})]}),r&&t.jsx(Q$,{config:e,onChange:s,fieldId:a,isClassification:m,setShowStrategyModal:h}),t.jsx("div",{className:"border-t border-gray-100 dark:border-gray-700"}),t.jsx(Z$,{config:e,onChange:s,fieldId:a,isAdvanced:r,showCV:x,setShowCV:f,availableColumns:u})]})]})}const Mf=({id:e,value:s,type:r,onChange:a,step:n,min:o,max:i})=>{const[l,c]=p.useState("");p.useEffect(()=>{c(s===null?"None":(s==null?void 0:s.toString())??"")},[s]);const d=m=>{if(m==="")return;const h=Number(m);Number.isNaN(h)?c(s===null?"None":(s==null?void 0:s.toString())??""):a(h)},u=()=>{const m=l.trim();if(m.toLowerCase()==="none"){a(null);return}r==="number"?d(m):r==="boolean"?m.toLowerCase()==="true"?a(!0):m.toLowerCase()==="false"?a(!1):c((s==null?void 0:s.toString())??""):a(m)};return t.jsx("input",{id:e,type:"text",value:l,onChange:m=>{c(m.target.value)},onBlur:u,placeholder:s===null?"None":"",className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",...r==="number"?{step:n,min:o,max:i}:{}})};function rF({def:e}){var s;return t.jsx(t.Fragment,{children:e.exclusive_options&&e.exclusive_options.length>0&&t.jsxs("p",{className:"mt-1 text-[10px] text-gray-400 italic",children:[(s=e.options)==null?void 0:s.filter(r=>{var a;return(a=e.exclusive_options)==null?void 0:a.includes(r.value)}).map(r=>`"${r.label}"`).join(", ")," can't be combined with other options here β€” selecting it clears the rest."]})})}const aF=({def:e,value:s,onChange:r})=>{const a=p.useId(),[n,o]=p.useState(""),[i,l]=p.useState(null);p.useEffect(()=>{o(Array.isArray(s)?s.map(u=>u===null?"None":u).join(", "):"")},[s]);const c=u=>{if(!u.trim())return[];const m=u.split(",").map(x=>x.trim()).filter(x=>x!==""),h=[];for(const x of m){if(x.toLowerCase()==="none"){h.push(null);continue}if(e.type==="number"){const f=Number(x);if(Number.isNaN(f))throw new Error(`"${x}" is not a valid number`);h.push(f)}else if(e.type==="boolean"){const f=x.toLowerCase();if(f==="true")h.push(!0);else if(f==="false")h.push(!1);else throw new Error(`"${x}" must be true or false`)}else h.push(x)}return h},d=()=>{try{const u=c(n),m=e.exclusive_options??[],h=u.filter(x=>m.includes(x));if(h.length>0&&u.length>h.length)throw new Error(`"${String(h[0])}" can't be combined with other options here β€” use it alone.`);l(null),JSON.stringify(u)!==JSON.stringify(s)&&r(u)}catch(u){l(u.message)}};return t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-300 flex items-center gap-1",children:[t.jsx("label",{htmlFor:a,children:e.label}),e.description&&t.jsx(Ze,{text:e.description,placement:"bottom-left"})]}),t.jsx("span",{className:"text-[10px] text-gray-400 uppercase",children:e.type})]}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{id:a,"aria-invalid":i?!0:void 0,"aria-describedby":i?`${a}-error`:void 0,type:"text",className:`w-full border rounded px-2 py-1.5 text-sm font-mono bg-white dark:bg-gray-900 dark:text-gray-100 outline-none transition-all ${i?"border-red-500 focus:ring-2 focus:ring-red-500/20":"border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-purple-500/20 focus:border-purple-500"}`,placeholder:e.type==="select"?"e.g. lbfgs, liblinear":"e.g. 10, 50, 100",value:n,onChange:u=>{o(u.target.value),l(null)},onBlur:d}),e.type==="select"&&e.options&&t.jsx("div",{role:"group","aria-label":`${e.label} options`,className:"mt-1 flex flex-wrap gap-1",children:e.options.map(u=>t.jsx("button",{type:"button","aria-pressed":s.includes(u.value),onClick:()=>{const m=c(n),h=m.includes(u.value),x=e.exclusive_options??[];let f;h?f=m.filter(g=>g!==u.value):x.includes(u.value)?f=[u.value]:f=[...m.filter(g=>!x.includes(g)),u.value],r(f)},className:`text-[10px] px-1.5 py-0.5 rounded border transition-colors ${s.includes(u.value)?"bg-purple-100 border-purple-200 text-purple-700 dark:bg-purple-900/30 dark:border-purple-800 dark:text-purple-300":"bg-gray-50 border-gray-200 text-gray-600 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:u.label},String(u.value)))}),t.jsx(rF,{def:e})]}),i&&t.jsxs("p",{id:`${a}-error`,role:"alert",className:"text-[10px] text-red-500 flex items-center gap-1",children:[t.jsx($t,{className:"w-3 h-3"}),i]})]})};function nF({config:e,onChange:s,fieldId:r,hyperparameters:a,isLoadingHyperparamDefs:n,useCustomParams:o,toggleCustomParams:i,setShowParamsModal:l}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-blue-500"}),"Hyperparameters"]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs("label",{className:`text-xs text-gray-500 dark:text-gray-400 flex items-center gap-2 cursor-pointer select-none ${n?"opacity-50 cursor-not-allowed":""}`,children:[t.jsx("input",{type:"checkbox",checked:o,onChange:c=>{i(c.target.checked)},className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:n}),"Customize"]})})]}),o?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"flex justify-end mb-2",children:t.jsxs("button",{onClick:()=>{l(!0)},className:"text-xs flex items-center gap-1.5 px-2 py-1 text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded transition-colors",children:[t.jsx(Ae,{className:"w-3 h-3"}),"Load Best"]})}),n?t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(ge,{className:"w-5 h-5 animate-spin text-blue-500"})}):a.filter(c=>U$(c,e.hyperparameters)).map(c=>{var d;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("label",{htmlFor:`${r}-param-${c.name}`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:c.label}),c.description&&t.jsx(Ze,{text:c.description})]}),c.type==="select"?t.jsx("select",{id:`${r}-param-${c.name}`,value:e.hyperparameters[c.name]??c.default,onChange:u=>s({...e,hyperparameters:{...e.hyperparameters,[c.name]:u.target.value}}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:(d=c.options)==null?void 0:d.map(u=>t.jsx("option",{value:String(u.value),children:u.label},String(u.value)))}):t.jsx(Mf,{id:`${r}-param-${c.name}`,type:c.type,value:e.hyperparameters[c.name]??c.default,onChange:u=>s({...e,hyperparameters:{...e.hyperparameters,[c.name]:u}}),step:c.step,min:c.min,max:c.max})]},c.name)}),a.length===0&&!n&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 italic text-center py-4",children:"No parameters available."})]}):t.jsxs("div",{className:"text-center py-8 bg-gray-50 dark:bg-gray-900/50 rounded-lg border border-dashed border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Using default hyperparameters."}),t.jsxs("button",{onClick:()=>{l(!0)},className:"mt-3 text-xs flex items-center gap-1.5 px-3 py-1.5 mx-auto bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 rounded-md border border-purple-200 dark:border-purple-800 hover:bg-purple-100 dark:hover:bg-purple-900/40 transition-colors shadow-sm",children:[t.jsx(Ae,{className:"w-3 h-3"}),"Load Best Params"]})]})]})}function oF({config:e,onChange:s,searchSpaceDefs:r,isLoadingSearchSpaceDefs:a}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-purple-500"}),"Hyperparameters"]})}),a?t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(ge,{className:"w-6 h-6 animate-spin text-purple-500"})}):t.jsxs("div",{className:"space-y-3",children:[r.filter(n=>n.tunable!==!1&&H$(n,e.search_space)).map(n=>{var o;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsx(aF,{def:n,value:((o=e.search_space)==null?void 0:o[n.name])||[],onChange:i=>{s({...e,search_space:{...e.search_space,[n.name]:i}})}}),n.depends_on&&t.jsxs("p",{className:"mt-1 text-[10px] text-gray-400 italic",children:['Shown because "',n.depends_on.param,'" search space includes "',String(n.depends_on.value),'".']})]},`${e.model_type}-${n.name}`)}),r.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 text-sm",children:"No hyperparameters available for this model."})]})]})}const iF=({isOpen:e,onClose:s,modelType:r,availableModels:a=[],onSelect:n,theme:o="blue"})=>{const i=p.useId(),l=p.useRef(null);Gn({isOpen:e,containerRef:l}),p.useEffect(()=>{if(!e)return;const v=j=>{j.key==="Escape"&&s()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e,s]);const[c,d]=p.useState(r),[u,m]=p.useState([]),[h,x]=p.useState(!1),[f,g]=p.useState(null),b=o==="purple"?{iconBg:"bg-purple-100 dark:bg-purple-900/30",iconText:"text-purple-600 dark:text-purple-400",spinner:"text-purple-500",ring:"focus:ring-purple-500",hoverBorder:"hover:border-purple-200 dark:hover:border-purple-800"}:{iconBg:"bg-blue-100 dark:bg-blue-900/30",iconText:"text-blue-600 dark:text-blue-400",spinner:"text-blue-500",ring:"focus:ring-blue-500",hoverBorder:"hover:border-blue-200 dark:hover:border-blue-800"};p.useEffect(()=>{e&&d(r)},[e,r]);const y=p.useCallback(()=>{c&&(x(!0),g(null),Re.getTuningHistory(c).then(v=>{m(v)}).catch(v=>{console.error("Failed to fetch jobs",v),g("Failed to load history.")}).finally(()=>{x(!1)}))},[c]);return p.useEffect(()=>{e&&y()},[e,y]),e?t.jsxs("div",{className:"fixed inset-0 z-[100] flex justify-center items-center p-4",children:[t.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s}),t.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":`${i}-title`,tabIndex:-1,className:"relative w-full max-w-2xl max-h-[85vh] bg-white dark:bg-gray-800 shadow-2xl rounded-xl flex flex-col border border-gray-200 dark:border-gray-700 overflow-hidden animate-in fade-in zoom-in duration-200",children:[t.jsxs("div",{className:"p-4 border-b border-gray-100 dark:border-gray-700 flex justify-between items-center bg-gray-50/50 dark:bg-gray-800/50",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:`p-2 ${b.iconBg} rounded-lg`,children:t.jsx(at,{className:`w-5 h-5 ${b.iconText}`})}),t.jsxs("div",{children:[t.jsx("h3",{id:`${i}-title`,className:"font-semibold text-gray-900 dark:text-gray-100",children:"Best Parameters History"}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("label",{htmlFor:`${i}-model`,className:"text-xs text-gray-500 dark:text-gray-400",children:n?"Select parameters for:":"View parameters for:"}),t.jsx("select",{id:`${i}-model`,value:c,onChange:v=>{d(v.target.value)},className:`text-xs border border-gray-200 dark:border-gray-700 rounded px-2 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 focus:ring-1 ${b.ring} outline-none`,children:a.length>0?a.map(v=>t.jsx("option",{value:v.id,children:v.name},v.id)):t.jsxs(t.Fragment,{children:[t.jsx("option",{value:"random_forest_classifier",children:"Random Forest Classifier"}),t.jsx("option",{value:"logistic_regression",children:"Logistic Regression"}),t.jsx("option",{value:"ridge_regression",children:"Ridge Regression"}),t.jsx("option",{value:"random_forest_regressor",children:"Random Forest Regressor"})]})})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button","aria-label":"Refresh history",onClick:y,className:"p-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh",children:t.jsx(us,{className:`w-4 h-4 ${h?"animate-spin":""}`})}),t.jsx("button",{type:"button","aria-label":"Close history",onClick:s,className:"p-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 transition-colors focus-ring",children:t.jsx(Ee,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 bg-gray-50/30 dark:bg-gray-900/30",children:h?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[t.jsx(ge,{className:`w-8 h-8 animate-spin mb-2 ${b.spinner}`}),t.jsx("p",{className:"text-sm",children:"Loading history..."})]}):f?t.jsxs("div",{className:"text-center py-12 text-red-500 bg-red-50 dark:bg-red-900/10 rounded-lg border border-red-100 dark:border-red-900/20",children:[t.jsx($t,{className:"w-8 h-8 mx-auto mb-2"}),t.jsx("p",{className:"text-sm",children:f}),t.jsx("button",{onClick:y,className:"mt-2 text-xs underline hover:text-red-600",children:"Try Again"})]}):u.length===0?t.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-dashed border-gray-300 dark:border-gray-700",children:[t.jsx(Ct,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No completed optimization jobs found."}),t.jsx("p",{className:"text-xs opacity-70 mt-1",children:"Run an optimization job to see results here."})]}):u.map(v=>{var j,w;return t.jsx("div",{className:`group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md ${b.hoverBorder} transition-all`,children:t.jsxs("div",{className:"flex justify-between items-start mb-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs font-mono bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded text-gray-600 dark:text-gray-300",children:["#",v.job_id.slice(0,8)]}),t.jsx("span",{className:"text-xs text-gray-400",children:v.end_time?new Date(v.end_time).toLocaleString():"Unknown Date"})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[typeof((j=v.result)==null?void 0:j.best_score)=="number"&&t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{className:"text-xs font-medium text-gray-500",children:[qn(v.result.scoring_metric)||"Score",":"]}),t.jsx("span",{className:"text-sm font-bold text-green-600 dark:text-green-400",children:v.result.best_score.toFixed(4)})]}),t.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 rounded-full flex items-center gap-1",children:[t.jsx(Ie,{className:"w-3 h-3"})," Model Ready"]})]})]}),n&&((w=v.result)==null?void 0:w.best_params)!=null&&t.jsxs("button",{onClick:()=>{n({params:v.result.best_params,modelType:c}),s()},className:"text-xs action-primary px-3 py-1.5 rounded-md transition-colors flex items-center gap-1 shadow-sm",children:[t.jsx(Ie,{className:"w-3 h-3"}),"Apply"]})]})},v.job_id)})})]})]}):null},lF=new Set(["logistic_regression","random_forest_classifier","random_forest_regressor","ridge_regression","linear_regression","svc","svr","k_neighbors_classifier","k_neighbors_regressor","decision_tree_classifier","decision_tree_regressor","extra_trees_classifier","extra_trees_regressor","lgbm_classifier","lgbm_regressor"]);function cF({config:e,setConfig:s,fieldId:r,strategy:a}){return t.jsxs(t.Fragment,{children:[a==="halving_grid"&&t.jsxs("div",{className:"flex items-start gap-2 p-2.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"halving_grid"})," evaluates the full cartesian product of your search space across multiple halving rounds. Large grids can take many minutes β€” reduce candidate values in the ",t.jsx("strong",{children:"Search Space"})," section of the node, or switch to ",t.jsx("strong",{children:"halving_random"}),"."]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-factor`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Factor"}),t.jsx(Ze,{placement:"bottom-left",text:"The rate at which candidate combinations are reduced in each iteration. For example, a factor of 3 means only the best 1/3 of candidates survive to the next round."})]}),t.jsx("input",{type:"number",min:"2",id:`${r}-factor`,value:e.factor??3,onChange:n=>s({...e,factor:Number.parseInt(n.target.value,10)}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Typical values are 2 or 3."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-min_resources`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Min Resources"}),t.jsx(Ze,{placement:"bottom-left",text:"'exhaust' automatically calculates the maximum resources to use. Alternatively, input an integer like 10 or 100 to set the starting budget explicitly."})]}),t.jsx("input",{type:"text",id:`${r}-min_resources`,value:e.min_resources??"exhaust",onChange:n=>s({...e,min_resources:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",placeholder:"e.g., 'exhaust', 'smallest', or an integer"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Starting budget for the first iteration."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-resource`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Resource"}),t.jsx(Ze,{placement:"bottom-left",text:"Determines how resources are limited during fast initial rounds. 'n_samples' limits the amount of training data used, while 'n_estimators' limits the number of trees in ensemble models."})]}),t.jsxs("select",{id:`${r}-resource`,value:e.resource??"n_samples",onChange:n=>s({...e,resource:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"n_samples",children:"n_samples (Rows of Data)"}),t.jsx("option",{value:"n_estimators",children:"n_estimators (Trees)"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"What defines the training budget."})]})]})}function dF({config:e,setConfig:s,fieldId:r,showCmaesWarning:a}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-sampler`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Sampler"}),t.jsx(Ze,{placement:"bottom-left",text:"TPE provides smart Bayesian learning based on past trials. Random is purely blind chance. CMA-ES is advanced evolutionary sampling meant for complex continuous search spaces."})]}),t.jsxs("select",{id:`${r}-sampler`,value:e.sampler??"tpe",onChange:n=>s({...e,sampler:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"tpe",children:"TPE (Bayesian Optimization)"}),t.jsx("option",{value:"random",children:"Random Sampler"}),t.jsx("option",{value:"cmaes",children:"CMA-ES"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Algorithm to suggest new parameters."}),a&&e.sampler==="cmaes"&&t.jsxs("div",{className:"mt-2 flex items-start gap-2 p-2.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"Partial CMA-ES coverage."})," This model has string or boolean parameters (e.g. solver, kernel, criterion) that CMA-ES cannot optimize β€” they will be sampled randomly. For full CMA-ES benefit, use ",t.jsx("strong",{children:"XGBoost"})," or ",t.jsx("strong",{children:"Gradient Boosting"}),". Alternatively, switch to ",t.jsx("strong",{children:"TPE"})," which handles mixed spaces natively."]})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-pruner`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Pruner"}),t.jsx(Ze,{placement:"bottom-left",text:"Median prunes trials worse than the median of previous runs. Hyperband is an aggressively fast early-stopping algorithm. None disables early stopping."})]}),t.jsxs("select",{id:`${r}-pruner`,value:e.pruner??"median",onChange:n=>s({...e,pruner:n.target.value}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",children:[t.jsx("option",{value:"median",children:"Median Pruner"}),t.jsx("option",{value:"hyperband",children:"Hyperband Pruner"}),t.jsx("option",{value:"none",children:"None (No Pruning)"})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Algorithm to kill bad trials early."})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-timeout`,className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"Timeout (Seconds)"}),t.jsx(Ze,{placement:"bottom-left",text:"Set a hard time limit for the entire Optuna study. Regardless of N-Trials, optimization will yield the best found parameters once time is up."})]}),t.jsx("input",{type:"number",min:"1",id:`${r}-timeout`,value:e.timeout??"",onChange:n=>s({...e,timeout:n.target.value?Number.parseInt(n.target.value,10):""}),className:"w-full text-sm border-gray-300 dark:border-gray-600 rounded-lg p-2.5 bg-gray-50 dark:bg-gray-900 dark:text-white border focus:ring-2 focus:ring-blue-500",placeholder:"e.g. 300 (Optional)"}),t.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Stop tuning after X seconds."})]})]})}const Pf=({isOpen:e,onClose:s,onSave:r,strategy:a,initialConfig:n,modelKey:o})=>{const i=p.useId(),l=a==="optuna"&&o!==void 0&&lF.has(o),c=a==="halving_grid"||a==="halving_random",d=a==="optuna",u={factor:3,min_resources:"exhaust",resource:"n_samples"},m={pruner:"median",sampler:"tpe",timeout:""},[h,x]=p.useState({});if(p.useEffect(()=>{e&&(n&&Object.keys(n).length>0?x(n):x(c?u:m))},[e,a,n]),!c&&!d)return null;const f=()=>{const b={...h};d&&(b.timeout===""||b.timeout===void 0)?delete b.timeout:d&&typeof b.timeout=="string"&&(b.timeout=Number.parseInt(b.timeout,10)),r(b),s()},g=()=>{x(c?u:m)};return t.jsx(Tt,{isOpen:e,onClose:s,zIndex:"z-[100]",size:"md",title:c?"Successive Halving Settings":"Optuna Settings",footer:t.jsxs("div",{className:"flex justify-between gap-3",children:[t.jsxs("button",{onClick:g,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition",children:[t.jsx(Pp,{size:16}),"Reset"]}),t.jsxs("button",{onClick:f,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium action-primary rounded-lg transition shadow-sm",children:[t.jsx(ai,{size:16}),"Apply Settings"]})]}),children:t.jsxs("div",{className:"p-5 space-y-4",children:[c&&t.jsx(cF,{config:h,setConfig:x,fieldId:i,strategy:a}),d&&t.jsx(dF,{config:h,setConfig:x,fieldId:i,showCmaesWarning:l})]})})};function uF({config:e,onChange:s,isAdvanced:r,showParamsModal:a,setShowParamsModal:n,availableModels:o,showStrategyModal:i,setShowStrategyModal:l}){return t.jsxs(t.Fragment,{children:[t.jsx(iF,{isOpen:a,onClose:()=>{n(!1)},modelType:e.model_type,availableModels:o,theme:r?"purple":"blue",...r?{}:{onSelect:c=>{c.modelType&&c.modelType!==e.model_type?s({...e,model_type:c.modelType,hyperparameters:c.params}):s({...e,hyperparameters:c.params})}}}),r&&t.jsx(Pf,{isOpen:i,onClose:()=>l(!1),strategy:e.search_strategy||"random",initialConfig:e.strategy_params,modelKey:e.model_type,onSave:c=>{s({...e,strategy_params:c})}})]})}function Ed({children:e,details:s}){const r=p.useRef(null),a=p.useRef(null),[n,o]=p.useState(!1),[i,l]=p.useState(!1),c=n||i;return p.useEffect(()=>{const d=r.current;if(!d)return;if(typeof IntersectionObserver>"u"){o(!0);return}let u=d.parentElement;for(;u&&!/auto|scroll/.test(getComputedStyle(u).overflowY);)u=u.parentElement;const m=new IntersectionObserver(([h])=>{h&&o(h.isIntersecting)},{root:u});return m.observe(d),()=>m.disconnect()},[]),p.useLayoutEffect(()=>{a.current&&(a.current.inert=!c)},[c]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:r,className:"h-px shrink-0","aria-hidden":"true"}),t.jsxs("div",{"data-testid":"training-action-footer","data-expanded":c,className:"sticky bottom-0 z-10 flex flex-col items-center gap-2 border-t border-border bg-background py-2",children:[e,t.jsx("div",{className:`grid w-full transition-[grid-template-rows,opacity] duration-200 motion-reduce:transition-none ${c?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0 -mt-2"}`,"aria-hidden":!c,ref:a,onFocusCapture:()=>l(!0),onBlurCapture:d=>{d.currentTarget.contains(d.relatedTarget)||l(!1)},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsx("div",{className:"flex flex-col items-center gap-2",children:s})})})]})]})}function mF({config:e,isAdvanced:s,selectedModelItem:r,fieldId:a,datasetId:n,isSubmitting:o,setShowParamsModal:i,handleSubmit:l,submissionMessage:c,runFeedback:d,historyTask:u}){return t.jsxs(Ed,{details:t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"text-xs text-center text-gray-600 dark:text-gray-400 break-words",children:["Selected model: ",(r==null?void 0:r.name)||e.model_type.replace(/_/g," ")]}),t.jsx("p",{id:`${a}-run-help`,className:"text-xs text-center text-gray-600 dark:text-gray-400",children:pF(e,n,s)}),s&&t.jsxs("button",{onClick:()=>{i(!0)},className:"text-xs text-gray-500 hover:text-purple-600 dark:text-gray-400 dark:hover:text-purple-400 flex items-center gap-1.5 transition-colors px-3 py-1 rounded-md hover:bg-gray-50 dark:hover:bg-gray-800",children:[t.jsx(at,{className:"w-3.5 h-3.5"}),"View Best Parameters History"]})]}),children:[t.jsxs("button",{type:"button",onClick:()=>{l()},disabled:hF(e,n,o),"aria-describedby":`${a}-run-help`,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed focus-ring",children:[o?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:o?"Submitting job...":s?"Tune model":"Train model"})]}),c&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:c}),d&&t.jsx(hi,{run:d,task:u})]})}function pF(e,s,r){var a;return s?(a=e.target_column)!=null&&a.trim()?e.model_type?r?"Searches hyperparameters and trains the selected model in the background.":"Trains the selected model with fixed parameters in the background.":"Choose a model to enable this action.":"Choose a target column to enable this action.":"Connect a dataset node upstream and select a dataset to enable this action."}function hF(e,s,r){var a;return!s||r||!((a=e.target_column)!=null&&a.trim())||!e.model_type}function xF({showInfo:e,setShowInfo:s}){return t.jsx(t.Fragment,{children:e&&t.jsxs("div",{className:"mb-4 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded text-xs text-blue-700 dark:text-blue-300 flex justify-between items-start gap-2",children:[t.jsx("span",{children:"Train a model with fixed parameters, or switch to Advanced to automatically tune it."}),t.jsx("button",{"aria-label":"Dismiss training information",onClick:()=>{s(!1),sessionStorage.setItem("hide_info_training_node","true")},className:"text-blue-400 hover:text-blue-600 dark:hover:text-blue-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]})})}function gF({isWide:e,activeTab:s,setActiveTab:r,isAdvanced:a,modelPanel:n,secondaryPanel:o}){const i=a?"Search Space":"Hyperparameters";return t.jsxs(t.Fragment,{children:[!e&&t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700 mb-4",children:[t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${s==="model"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":s==="model",onClick:()=>{r("model")},children:"Configuration"}),t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${s==="params"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":s==="params",onClick:()=>{r("params")},children:i})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4 custom-scrollbar",children:e?t.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[t.jsx("div",{className:"overflow-y-auto pr-2",children:n}),t.jsx("div",{className:"overflow-y-auto pl-2 border-l border-gray-100 dark:border-gray-800",children:o})]}):t.jsxs(t.Fragment,{children:[s==="model"&&n,s==="params"&&o]})})]})}const Rd=({config:e,onChange:s,nodeId:r,task:a})=>{const n=K$(e,s,r,a),o=n.isAdvanced?t.jsx(oF,{...n}):t.jsx(nF,{...n});return t.jsxs("div",{className:"flex flex-col h-full",ref:n.containerRef,children:[t.jsx(xF,{...n}),t.jsx(uF,{...n}),t.jsx(gF,{...n,modelPanel:t.jsx(sF,{...n}),secondaryPanel:o}),t.jsx(mF,{...n})]})},ro=({type:e,label:s,description:r,icon:a,settings:n,defaultConfig:o,validate:i,bodyPreview:l,category:c="Modeling",inputs:d=[{id:"in",label:"Training Data",type:"dataset"}],outputs:u=[{id:"model",label:"Model",type:"model"}]})=>({type:e,label:s,category:c,description:r,icon:a,inputs:d,outputs:u,settings:n,bodyPreview:l||(m=>{const h=m.model_type,x=m.target_column;return h&&x?`${h} β†’ ${x}`:h||(x?`target: ${x}`:null)}),validate:i||(m=>m.target_column?{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"}),getDefaultConfig:()=>({target_column:"",model_type:"random_forest_classifier",...o})}),fF=ro({type:Ts.CLASSIFICATION,label:"Classification",description:"Train a classifier to predict a categorical target β€” fixed parameters or automatic tuning.",icon:Gp,settings:e=>t.jsx(Rd,{...e,task:"classification"}),defaultConfig:{run_mode:"basic",model_type:"random_forest_classifier",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"accuracy",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),bF=ro({type:Ts.REGRESSION,label:"Regression",description:"Train a regressor to predict a numeric target β€” fixed parameters or automatic tuning.",icon:jc,settings:e=>t.jsx(Rd,{...e,task:"regression"}),defaultConfig:{run_mode:"basic",model_type:"random_forest_regressor",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"r2",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),yF=ro({type:Ts.TEXT_CLASSIFICATION,label:"Text Classification",description:"Train a classifier on vectorized text features β€” fixed parameters or automatic tuning.",icon:Dr,settings:e=>t.jsx(Rd,{...e,task:"text_classification"}),defaultConfig:{run_mode:"basic",model_type:"multinomial_nb",hyperparameters:{},cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",n_trials:10,metric:"accuracy",search_strategy:"random",random_state:42,search_space:{}},outputs:[{id:"model",label:"Trained Model",type:"model"}]}),vF=[{label:"Logistic Regression",value:"logistic_regression"},{label:"Random Forest",value:"random_forest"},{label:"Extra Trees",value:"extra_trees"},{label:"Gradient Boosting",value:"gradient_boosting"},{label:"Hist Gradient Boosting",value:"hist_gradient_boosting"},{label:"AdaBoost",value:"adaboost"},{label:"Decision Tree",value:"decision_tree"},{label:"Gaussian Naive Bayes",value:"gaussian_nb"},{label:"SGD Classifier",value:"sgd_classifier"},{label:"Support Vector Classifier",value:"svc"},{label:"K-Nearest Neighbors",value:"knn"}],jF=[{label:"Linear Regression",value:"linear_regression"},{label:"Ridge",value:"ridge"},{label:"Lasso",value:"lasso"},{label:"ElasticNet",value:"elasticnet"},{label:"Random Forest",value:"random_forest"},{label:"Extra Trees",value:"extra_trees"},{label:"Gradient Boosting",value:"gradient_boosting"},{label:"Hist Gradient Boosting",value:"hist_gradient_boosting"},{label:"AdaBoost",value:"adaboost"},{label:"Decision Tree",value:"decision_tree"},{label:"Support Vector Regressor",value:"svr"},{label:"K-Nearest Neighbors",value:"knn"}];function wF(e,s,r=[]){const a=e==="classification"?[...vF]:[...jF],n=e==="classification"?"classifier":"regressor",o=[{label:"XGBoost",value:"xgboost",registryId:`xgboost_${n}`},{label:"LightGBM",value:"lightgbm",registryId:`lgbm_${n}`}];for(const{label:i,value:l,registryId:c}of o)(s!=null&&s.has(c)||r.includes(l))&&a.push({label:i,value:l});return a}function si(e,s){return`${s}_${e==="classification"?"classifier":"regressor"}`}function If(e){return e==="classification"?["random_forest","logistic_regression","gradient_boosting"]:["random_forest","gradient_boosting","ridge"]}function Af(e){return e==="classification"?"logistic_regression":"ridge"}function $f(e){return e==="classification"?"accuracy":"r2"}function NF(e){if(!e)return null;const s=String(e.dtype).toLowerCase();return s.includes("bool")||["object","string","category","text"].some(r=>s.includes(r))?"classification":["float","double","decimal"].some(r=>s.includes(r))?"regression":s.includes("int")?e.unique_count>0&&e.unique_count<=20?"classification":"regression":null}function kF(e){return e==="classification"?[{label:"Accuracy",value:"accuracy"},{label:"F1",value:"f1"},{label:"Balanced Accuracy",value:"balanced_accuracy"},{label:"ROC AUC",value:"roc_auc"}]:[{label:"RΒ²",value:"r2"},{label:"RMSE",value:"rmse"},{label:"MAE",value:"mae"}]}const _F=[{label:"Random",value:"random"},{label:"Grid",value:"grid"},{label:"Optuna",value:"optuna"},{label:"Halving Random",value:"halving_random"},{label:"Halving Grid",value:"halving_grid"}],bc={classification:{logistic_regression:"logistic_regression",random_forest_classifier:"random_forest",extra_trees_classifier:"extra_trees",gradient_boosting_classifier:"gradient_boosting",hist_gradient_boosting_classifier:"hist_gradient_boosting",adaboost_classifier:"adaboost",decision_tree_classifier:"decision_tree",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",k_neighbors_classifier:"knn",xgboost_classifier:"xgboost",lgbm_classifier:"lightgbm"},regression:{linear_regression:"linear_regression",ridge_regression:"ridge",lasso_regression:"lasso",elasticnet_regression:"elasticnet",random_forest_regressor:"random_forest",extra_trees_regressor:"extra_trees",gradient_boosting_regressor:"gradient_boosting",hist_gradient_boosting_regressor:"hist_gradient_boosting",adaboost_regressor:"adaboost",decision_tree_regressor:"decision_tree",svr:"svr",k_neighbors_regressor:"knn",xgboost_regressor:"xgboost",lgbm_regressor:"lightgbm"}};function SF(e){return e in bc.classification?"classification":e in bc.regression?"regression":e.endsWith("_classifier")||["logistic_regression","gaussian_nb","sgd_classifier","svc"].includes(e)?"classification":e.endsWith("_regressor")||e.includes("regression")||["linear_regression","svr"].includes(e)?"regression":null}function CF(e,s){return bc[s][e]??null}function Ff(e){return Object.fromEntries(e.map(s=>[s.value,s.label]))}function Qm(e,s,r){if(!e)return[];const a=[];for(const n of r.filter(o=>o.target===e)){const o=s.find(i=>i.id===n.source);o&&["training","classification","regression","text_classification"].includes(o.data.definitionType)&&a.push(o)}return a}function EF(e,s){if(s.task_manual)return{};for(const{data:r}of e){if(!r.model_type)continue;const a=SF(r.model_type);if(a)return a===s.task?{}:{task:a,model_type:si(a,s.strategy)}}return{}}function RF(e,s){const r=e.find(a=>a.data.run_mode==="advanced");return r?{run_mode:"advanced",search_strategy:r.data.search_strategy||s.search_strategy,n_trials:r.data.n_trials||s.n_trials,metric:r.data.metric||s.metric}:{run_mode:"basic"}}function TF(e,s){const r=e.cv_time_column||s.cv_time_column;return{cv_enabled:e.cv_enabled!==void 0?e.cv_enabled:s.cv_enabled,cv_folds:e.cv_folds||s.cv_folds,cv_type:e.cv_type||s.cv_type,cv_shuffle:e.cv_shuffle!==void 0?e.cv_shuffle:s.cv_shuffle,cv_random_state:e.cv_random_state??s.cv_random_state,...r!==void 0?{cv_time_column:r}:{}}}function MF(e,s,r){const a=e.hyperparameters||e.search_space||e.params;a&&typeof a=="object"&&Object.keys(a).length>0&&(r[s]={...r[s]||{},...a})}function PF(e,s,r){const a=[],n={...r.base_estimator_params||{}};for(const{data:o}of e){if(!o.model_type)continue;const i=CF(o.model_type,s);i&&(a.includes(i)||a.push(i),MF(o,i,n))}return{estimators:a,params:n}}function IF(e,s){var r;return e.length>0&&(e.length!==((r=s.base_estimators)==null?void 0:r.length)||!e.every(a=>{var n;return(n=s.base_estimators)==null?void 0:n.includes(a)}))}function AF(e,s){return Object.fromEntries(Object.entries(s).filter(([r,a])=>e[r]!==a))}function $F(e,s){const r=e[0];if(!r)return null;const a=EF(e,s),{estimators:n,params:o}=PF(e,a.task??s.task,s),i={...a,...RF(e,s),...TF(r.data,s)};IF(n,s)&&(i.base_estimators=n);const l=r.data.target_column||s.target_column;l&&(i.target_column=l);const c=AF(s,i);return Object.keys(c).length===0?null:{...c,base_estimator_params:o}}const FF={classification:{logistic_regression:"logistic_regression",random_forest:"random_forest_classifier",extra_trees:"extra_trees_classifier",gradient_boosting:"gradient_boosting_classifier",hist_gradient_boosting:"hist_gradient_boosting_classifier",adaboost:"adaboost_classifier",decision_tree:"decision_tree_classifier",gaussian_nb:"gaussian_nb",sgd_classifier:"sgd_classifier",svc:"svc",knn:"k_neighbors_classifier",xgboost:"xgboost_classifier",lightgbm:"lgbm_classifier"},regression:{linear_regression:"linear_regression",ridge:"ridge_regression",lasso:"lasso_regression",elasticnet:"elasticnet_regression",random_forest:"random_forest_regressor",extra_trees:"extra_trees_regressor",gradient_boosting:"gradient_boosting_regressor",hist_gradient_boosting:"hist_gradient_boosting_regressor",adaboost:"adaboost_regressor",decision_tree:"decision_tree_regressor",svr:"svr",knn:"k_neighbors_regressor",xgboost:"xgboost_regressor",lightgbm:"lgbm_regressor"}};function Xm(e,s){return e.type==="number"?s===""?void 0:Number(s):e.type==="boolean"?s==="true":s===""?void 0:s}function DF({id:e,def:s,value:r,onChange:a}){const n=r??"",o="w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-xs bg-white dark:bg-gray-800 dark:text-gray-100";return s.type==="select"&&s.options?t.jsxs("select",{id:e,className:o,value:String(n),onChange:i=>{a(Xm(s,i.target.value))},children:[t.jsx("option",{value:"",children:"default"}),s.options.map(i=>t.jsx("option",{value:String(i.value),children:i.label},String(i.value)))]}):s.type==="boolean"?t.jsxs("select",{id:e,className:o,value:n===""?"":String(n),onChange:i=>{a(i.target.value===""?void 0:i.target.value==="true")},children:[t.jsx("option",{value:"",children:"default"}),t.jsx("option",{value:"true",children:"True"}),t.jsx("option",{value:"false",children:"False"})]}):t.jsx("input",{id:e,type:"number",className:o,min:s.min,max:s.max,step:s.step,value:String(n),placeholder:"default",onChange:i=>{a(Xm(s,i.target.value))}})}function Zm({label:e,defs:s,values:r,onParam:a}){const[n,o]=p.useState(!1),i=p.useId(),l=Object.keys(r).length,c=s.filter(d=>d.type!=="multiselect");return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":n,"aria-controls":`${i}-params`,onClick:()=>{o(!n)},className:"w-full flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsx("span",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:e}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[l>0&&t.jsxs("span",{className:"text-[10px] text-purple-600 dark:text-purple-300",children:[l," set"]}),t.jsx(tt,{className:`w-3.5 h-3.5 text-gray-400 transition-transform ${n?"rotate-90":""}`})]})]}),n&&t.jsxs("div",{id:`${i}-params`,role:"group","aria-label":e,className:"p-2 grid grid-cols-2 gap-2 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:[c.length===0&&t.jsx("p",{className:"col-span-2 text-[11px] text-gray-400",children:"No tunable parameters."}),c.map(d=>t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${i}-${d.name}`,className:"block text-[10px] text-gray-500 mb-0.5 truncate",title:d.description,children:d.label}),t.jsx(DF,{id:`${i}-${d.name}`,def:d,value:r[d.name],onChange:u=>{a(d.name,u)}})]},d.name))]})]})}function LF({task:e,baseEstimators:s,finalEstimator:r,optionLabels:a,baseParams:n,finalParams:o,onChange:i}){const[l,c]=p.useState({}),d=p.useMemo(()=>{const h=new Set(s);return r&&h.add(r),Array.from(h)},[s,r]);p.useEffect(()=>{let h=!1;const x=d.filter(f=>!(f in l));if(x.length!==0)return Promise.all(x.map(async f=>{const g=FF[e][f];if(!g)return[f,[]];try{const b=await Re.getHyperparameters(g);return[f,b]}catch{return[f,[]]}})).then(f=>{h||c(g=>({...g,...Object.fromEntries(f)}))}),()=>{h=!0}},[d,e,l]);const u=(h,x,f)=>{const g={...n[h]??{}};f===void 0||f===""?delete g[x]:g[x]=f;const b={...n};Object.keys(g).length===0?delete b[h]:b[h]=g,i(b,o)},m=(h,x)=>{const f={...o};x===void 0||x===""?delete f[h]:f[h]=x,i(n,f)};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xb,{className:"w-3.5 h-3.5 text-purple-500"}),t.jsx("span",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:"Optional β€” leave blank to use each model's defaults."})]}),s.map(h=>t.jsx(Zm,{label:a[h]??h,defs:l[h]??[],values:n[h]??{},onParam:(x,f)=>{u(h,x,f)}},h)),r&&t.jsx(Zm,{label:`Final Β· ${a[r]??r}`,defs:l[r]??[],values:o,onParam:m},`final-${r}`)]})}function OF({ariaLabel:e,options:s,selected:r,onChange:a}){const n=o=>{r.includes(o)?a(r.filter(i=>i!==o)):a([...r,o])};return t.jsx("div",{role:"group","aria-label":e,className:"flex flex-wrap gap-1.5",children:s.map(o=>{const i=r.includes(o.value);return t.jsxs("button",{type:"button","aria-pressed":i,onClick:()=>{n(o.value)},className:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs border transition-colors ${i?"bg-blue-500 text-white border-blue-500":"bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:[i&&t.jsx(Ie,{size:11,className:"shrink-0"}),o.label]},String(o.value))})})}function Lo({label:e,options:s,value:r,onSelect:a}){return t.jsx("div",{role:"group","aria-label":e,className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:s.map(n=>t.jsx("button",{type:"button","aria-pressed":r===n.value,onClick:()=>{a(n.value)},className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors ${r===n.value?"bg-white dark:bg-gray-700 text-purple-600 dark:text-purple-300 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:n.label},n.value))})}function zF({config:e,update:s,options:r}){const a=p.useId();return e.strategy==="voting"?e.task!=="classification"?null:t.jsxs("div",{children:[t.jsx("span",{className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Voting Type"}),t.jsx(Lo,{options:[{label:"Soft (probabilities)",value:"soft"},{label:"Hard (majority)",value:"hard"}],label:"Voting Type",value:e.voting,onSelect:n=>{s({voting:n})}})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-final_estimator`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Final Estimator (meta-learner)"}),t.jsx("select",{id:`${a}-final_estimator`,value:e.final_estimator,onChange:n=>{s({final_estimator:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:r.map(n=>t.jsx("option",{value:n.value,children:n.label},n.value))})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[t.jsx("label",{htmlFor:`${a}-cv`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Stacking CV Folds"}),t.jsx(Ze,{text:"Out-of-fold folds used to train the final estimator without leakage. Keep small (e.g. 3) when also running an outer hyperparameter search."})]}),t.jsx("input",{id:`${a}-cv`,type:"number",min:2,max:10,value:e.cv,onChange:n=>{s({cv:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.passthrough===!0,onChange:n=>{s({passthrough:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Passthrough features"]}),t.jsx("p",{className:"mt-1 pl-6 text-xs text-gray-500 dark:text-gray-400",children:"Let the meta-learner also see the original features, not just the base predictions."})]})]})}function BF({config:e,update:s,optionLabels:r}){const a=p.useId(),n=e.base_estimators??[];if(e.strategy!=="voting"||n.length===0)return null;const o=e.weights??{},i=(l,c)=>{s({weights:{...o,[l]:c}})};return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Weights"}),t.jsx(Ze,{text:"Relative weight of each base model when averaging votes/probabilities. Leave at 1 for equal weighting; raise a model's weight to trust it more."})]}),t.jsx("div",{className:"space-y-1.5",children:n.map(l=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("label",{htmlFor:`${a}-weight-${l}`,className:"flex-1 text-xs text-gray-700 dark:text-gray-300 truncate",children:r[l]??l}),t.jsx("input",{type:"number",min:0,step:.5,id:`${a}-weight-${l}`,"aria-label":`${r[l]??l} weight`,value:o[l]??1,onChange:c=>{i(l,Number(c.target.value))},className:"w-20 border border-gray-300 dark:border-gray-600 rounded-lg p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]},l))})]})}function VF({config:e,update:s}){const r=p.useId(),a=[{label:"Sequential (1)",value:"1"},{label:"2 cores",value:"2"},{label:"4 cores",value:"4"},{label:"8 cores",value:"8"},{label:"All cores (-1)",value:"-1"}];return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("label",{htmlFor:`${r}-n_jobs`,className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Parallel Jobs"}),t.jsx(Ze,{text:"How many base models to fit in parallel. -1 uses all CPU cores; 1 trains sequentially."})]}),t.jsx("select",{id:`${r}-n_jobs`,value:String(e.n_jobs??1),onChange:n=>{s({n_jobs:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:a.map(n=>t.jsx("option",{value:n.value,children:n.label},n.value))})]})}function UF({config:e,update:s}){const r=p.useId();if(e.task!=="classification")return null;const a=e.calibrate_base_models===!0;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:a,onChange:n=>{s({calibrate_base_models:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Calibrate base models"]}),t.jsx("p",{className:"mt-1 pl-6 text-xs text-gray-500 dark:text-gray-400",children:"Wrap each base classifier in CalibratedClassifierCV so its probabilities are well-calibrated β€” improves soft voting and stacking."})]}),a&&t.jsxs("div",{className:"grid grid-cols-2 gap-3 pl-6",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-calibration_method`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${r}-calibration_method`,"aria-label":"Calibration Method",value:e.calibration_method??"sigmoid",onChange:n=>{s({calibration_method:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"sigmoid",children:"Sigmoid (Platt)"}),t.jsx("option",{value:"isotonic",children:"Isotonic"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-calibration_cv`,className:"block text-xs text-gray-500 mb-1",children:"CV Folds"}),t.jsx("input",{id:`${r}-calibration_cv`,"aria-label":"Calibration CV Folds",type:"number",min:2,max:10,value:e.calibration_cv??3,onChange:n=>{s({calibration_cv:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]})]})}function HF({config:e,update:s,columns:r}){const a=p.useId();return t.jsxs(ce,{field:"target_column",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Target Column"}),r.length===0?t.jsx("input",{id:`${a}-target_column`,type:"text",value:e.target_column,onChange:n=>{s({target_column:n.target.value})},placeholder:"Type the target column name",className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"}):t.jsxs("select",{id:`${a}-target_column`,value:e.target_column,onChange:n=>{s({target_column:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:[t.jsx("option",{value:"",children:"Select target…"}),r.map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})}function WF({config:e,update:s,open:r,setOpen:a,options:n}){return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{a(!r)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(tr,{className:"w-4 h-4 text-purple-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Base Model Hyperparameters"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${r?"rotate-90":""}`})]}),r&&t.jsx("div",{className:"p-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:t.jsx(LF,{task:e.task,baseEstimators:e.base_estimators??[],finalEstimator:e.strategy==="stacking"?e.final_estimator:void 0,optionLabels:Ff(n),baseParams:e.base_estimator_params??{},finalParams:e.final_estimator_params??{},onChange:(o,i)=>{s({base_estimator_params:o,final_estimator_params:i})}})})]})}function GF({config:e,update:s,currentOptions:r,columns:a,tooFewModels:n}){var l;const o=c=>{s({task:c,task_manual:!0,model_type:si(c,e.strategy),base_estimators:If(c),final_estimator:Af(c),metric:$f(c)})},i=c=>{s({strategy:c,model_type:si(e.task,c)})};return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Task"}),e.task_manual?t.jsxs("button",{type:"button",onClick:()=>{s({task_manual:!1})},className:"text-[10px] text-purple-600 dark:text-purple-400 hover:underline flex items-center gap-0.5",title:"Re-enable automatic detection from the target column",children:[t.jsx(tr,{className:"w-2.5 h-2.5"})," Auto-detect"]}):t.jsxs("span",{className:"text-[10px] text-gray-500 dark:text-gray-400 flex items-center gap-0.5",title:"Inferred from the target column's type",children:[t.jsx(tr,{className:"w-2.5 h-2.5"})," Auto"]})]}),t.jsx(Lo,{options:[{label:"Classification",value:"classification"},{label:"Regression",value:"regression"}],label:"Task",value:e.task,onSelect:c=>{o(c)}})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Strategy"}),t.jsx(Lo,{options:[{label:"Voting",value:"voting"},{label:"Stacking",value:"stacking"}],label:"Strategy",value:e.strategy,onSelect:c=>{i(c)}})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Training Mode"}),t.jsx(Lo,{options:[{label:"Basic",value:"basic"},{label:"Advanced (Tuning)",value:"advanced"}],label:"Training Mode",value:e.run_mode,onSelect:c=>{s({run_mode:c})}})]}),t.jsx(ce,{field:"base_estimators",children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Base Models"}),t.jsxs("span",{className:"text-[10px] text-gray-400",children:[((l=e.base_estimators)==null?void 0:l.length)??0," selected"]})]}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:"Click to add or remove each model in the ensemble."}),t.jsx(OF,{ariaLabel:"Base Models",options:r,selected:e.base_estimators??[],onChange:c=>{s({base_estimators:c})}}),t.jsx("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:"Tip: wire model nodes into this ensemble's input to use them as base learners automatically β€” connected models override the selection above."}),n&&t.jsxs("div",{className:"flex items-start gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),t.jsx("span",{children:"Pick at least two base models for a meaningful ensemble."})]})]})}),t.jsx(HF,{config:e,update:s,columns:a})]})}function qF(e,s,r){var a;return s?(a=e.target_column)!=null&&a.trim()?r?{canRun:!1,description:"Choose at least two base models to enable this action."}:{canRun:!0,description:`${e.run_mode==="advanced"?"Tunes":"Trains"} the ${e.strategy} ensemble with ${e.base_estimators.length} base models in the background.`}:{canRun:!1,description:"Choose a target column to enable this action."}:{canRun:!1,description:"Connect a dataset node upstream and select a dataset to enable this action."}}function KF({config:e,datasetId:s,runJob:r,isSubmitting:a,submissionMessage:n,runFeedback:o,runHelpId:i,tooFewModels:l}){const c=e.run_mode==="advanced",d=qF(e,s,l);return t.jsxs(Ed,{details:t.jsx("p",{id:i,className:"text-xs text-center text-muted-foreground",children:d.description}),children:[t.jsxs("button",{type:"button",onClick:()=>{r(c?"tuning":"training","ensemble")},disabled:!d.canRun||a,"aria-describedby":i,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-lg transition-all hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 focus-ring",children:[a?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):c?t.jsx(tr,{className:"w-4 h-4"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:a?"Submitting job...":c?"Tune ensemble":"Train ensemble"})]}),n&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:n}),o&&t.jsx(hi,{run:o,task:"ensemble"})]})}function JF({config:e,update:s}){const r=p.useId(),[a,n]=p.useState(!1),[o,i]=p.useState(!1),l=["halving_grid","halving_random","optuna"].includes(e.search_strategy);return t.jsxs("div",{className:"space-y-3 p-3 rounded-lg border border-purple-100 dark:border-purple-800 bg-purple-50/50 dark:bg-purple-900/10",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(tr,{className:"w-3.5 h-3.5 text-purple-500"}),t.jsx("span",{className:"text-xs font-semibold text-purple-700 dark:text-purple-300",children:"Hyperparameter Tuning"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-gray-700 dark:text-gray-300",children:[t.jsx("label",{htmlFor:`${r}-search_strategy`,children:"Search Strategy"}),t.jsx(Ze,{placement:"bottom-left",text:`Searches the ensemble's own params (e.g. voting/cv), not each base model. Enable "Tune base model hyperparameters" below to also search each model's params.`})]}),l&&t.jsx("button",{type:"button",onClick:()=>{n(!0)},className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 p-0.5 rounded hover:bg-blue-50 dark:hover:bg-blue-900/20 transition group flex items-center justify-center","aria-label":"Search strategy settings",title:`${e.search_strategy.replace("_"," ")} Settings`,children:t.jsx(Aa,{size:13,className:"group-hover:rotate-45 transition-transform duration-300"})})]}),t.jsx("select",{id:`${r}-search_strategy`,value:e.search_strategy,onChange:c=>{s({search_strategy:c.target.value,strategy_params:{}})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:_F.map(c=>t.jsx("option",{value:c.value,children:c.label},c.value))})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-n_trials`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Trials"}),t.jsx("input",{id:`${r}-n_trials`,type:"number",min:1,value:e.n_trials,onChange:c=>{s({n_trials:Number(c.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t.jsx("label",{htmlFor:`${r}-random_state`,children:"Random State"}),t.jsx(Ze,{text:"Seed for the search and the final refit β€” same seed + same data = identical tuning outcome."})]}),t.jsx("input",{id:`${r}-random_state`,type:"number",min:0,value:e.random_state??42,onChange:c=>{s({random_state:Number(c.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${r}-metric`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Optimize Metric"}),t.jsx("select",{id:`${r}-metric`,value:e.metric,onChange:c=>{s({metric:c.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 outline-none",children:kF(e.task).map(c=>t.jsx("option",{value:c.value,children:c.label},c.value))})]}),t.jsxs("label",{className:"flex items-start gap-2 text-xs text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.tune_base_models!==!1,onChange:c=>{s({tune_base_models:c.target.checked})},className:"mt-0.5 rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),t.jsxs("span",{className:"flex-1",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("strong",{children:"Tune base model hyperparameters"}),t.jsx("button",{type:"button","aria-label":"Base model tuning details","aria-expanded":o,onClick:()=>{i(!o)},className:"text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:o?"Hide details":"Show details",children:t.jsx(tt,{className:`w-3 h-3 transition-transform ${o?"rotate-90":""}`})})]}),o&&t.jsxs("span",{className:"block mt-1 text-gray-500 dark:text-gray-400",children:["Automatically searches each selected base learner's default parameter range (e.g. ",t.jsx("code",{children:"random_forest__n_estimators"}),"), in addition to the ensemble's own params. Ranges are picked automatically per model β€” uncheck this to tune only the ensemble-level params and keep base models at the fixed values set in Basic mode."]})]})]}),a&&t.jsx(Pf,{isOpen:a,onClose:()=>{n(!1)},onSave:c=>{s({strategy_params:c})},strategy:e.search_strategy,initialConfig:e.strategy_params,modelKey:e.model_type})]})}function YF({config:e,update:s,showCV:r,setShowCV:a,columns:n}){const o=p.useId();return t.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{a(!r)},className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mc,{className:"w-4 h-4 text-purple-500"}),t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Cross Validation"})]}),t.jsx(tt,{className:`w-4 h-4 text-gray-400 transition-transform ${r?"rotate-90":""}`})]}),r&&t.jsxs("div",{className:"p-3 space-y-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:e.cv_enabled!==!1,onChange:i=>{s({cv_enabled:i.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Enable Cross-Validation"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 pl-6",children:e.run_mode==="advanced"?"Candidates are already scored by CV during the search. This re-evaluates the winning ensemble after tuning (full metric panel + fold-to-fold variance); it never changes the selected hyperparameters.":"Runs a k-fold evaluation of the trained ensemble after training. Evaluation only β€” it measures generalization and never changes the model or its configuration."}),e.cv_enabled!==!1&&t.jsx(QF,{config:e,update:s,columns:n,fieldId:o})]})]})}function QF({config:e,update:s,columns:r,fieldId:a}){return t.jsxs("div",{className:"space-y-3 pl-6 border-l-2 border-gray-100 dark:border-gray-800",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_folds`,className:"block text-xs text-gray-500 mb-1",children:"Folds"}),t.jsx("input",{id:`${a}-cv_folds`,type:"number",min:2,value:e.cv_folds??5,onChange:n=>{s({cv_folds:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_type`,className:"block text-xs text-gray-500 mb-1",children:"Method"}),t.jsxs("select",{id:`${a}-cv_type`,value:e.cv_type??"k_fold",onChange:n=>{s({cv_type:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"k_fold",children:"K-Fold"}),t.jsx("option",{value:"stratified_k_fold",children:"Stratified"}),t.jsx("option",{value:"time_series_split",children:"Time Series"}),t.jsx("option",{value:"shuffle_split",children:"Shuffle Split"}),t.jsx("option",{value:"nested_cv",children:"Nested CV"})]})]})]}),e.cv_type==="time_series_split"&&t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-start gap-1.5 p-2 bg-amber-50 dark:bg-amber-900/20 rounded text-xs text-amber-700 dark:text-amber-400",children:[t.jsx(Te,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),t.jsx("span",{children:"Data must be sorted by time. Select a date column below or ensure your data is pre-sorted."})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:`${a}-cv_time_column`,className:"block text-xs text-gray-500 mb-1",children:"Time Column (optional)"}),t.jsxs("select",{id:`${a}-cv_time_column`,value:e.cv_time_column??"",onChange:n=>{s({cv_time_column:n.target.value})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100",children:[t.jsx("option",{value:"",children:"Auto-detect"}),r.filter(n=>{const o=String(n.dtype).toLowerCase();return o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp")}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name)),r.filter(n=>{const o=String(n.dtype).toLowerCase();return!(o.includes("datetime")||o.includes("date")||o.includes("time")||o.includes("timestamp"))}).map(n=>t.jsx("option",{value:n.name,children:n.name},n.name))]})]})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[t.jsx("input",{type:"checkbox",checked:e.cv_shuffle!==!1,onChange:n=>{s({cv_shuffle:n.target.checked})},className:"rounded border-gray-300 text-purple-600 focus:ring-purple-500"}),"Shuffle Data"]}),e.cv_shuffle!==!1&&e.cv_type!=="time_series_split"&&t.jsxs("div",{children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs text-gray-500 mb-1",children:[t.jsx("label",{htmlFor:`${a}-cv_random_state`,children:"Fold Split Seed"}),t.jsx(Ze,{text:"Seed controlling how rows are dealt to folds β€” same seed = identical fold splits, so CV scores stay comparable across runs."})]}),t.jsx("input",{id:`${a}-cv_random_state`,type:"number",min:0,value:e.cv_random_state??42,onChange:n=>{s({cv_random_state:Number(n.target.value)})},className:"w-full border border-gray-300 dark:border-gray-600 rounded p-1.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100"})]})]})}function XF({config:e,onChange:s,nodeId:r}){var S;const[a,n]=Ve(560),[o,i]=p.useState(!1),[l,c]=p.useState(!1),[d,u]=p.useState(()=>!sessionStorage.getItem("hide_info_ensemble")),{availableColumns:m,upstreamTarget:h,datasetId:x,runJob:f,isSubmitting:g,submissionMessage:b,runFeedback:y}=Tf(r),v=p.useId(),[j,w]=p.useState(new Set);p.useEffect(()=>{let P=!0;return zr.getAllNodes().then(I=>{P&&w(new Set(I.map(A=>A.id)))}).catch(I=>{console.error("Failed to resolve model registry for ensemble settings:",I)}),()=>{P=!1}},[]);const N=p.useMemo(()=>{const P=[...e.base_estimators??[],...e.final_estimator?[e.final_estimator]:[]];return wF(e.task,j,P)},[e.task,j,e.base_estimators,e.final_estimator]),k=P=>{s({...e,...P})},_=V(P=>P.nodes),R=V(P=>P.edges);p.useEffect(()=>{const P=Qm(r,_,R),I=$F(P,e);I&&s({...e,...I})},[r,R,_,e.task,e.strategy,e.run_mode,e.search_strategy,e.n_trials,e.metric,e.base_estimators,e.target_column,e.cv_enabled,e.cv_folds,e.cv_type,e.cv_shuffle,e.cv_random_state,e.cv_time_column,e.base_estimator_params,s]),p.useEffect(()=>{h&&!e.target_column&&s({...e,target_column:h})},[h,e.target_column]);const M=p.useMemo(()=>Qm(r,_,R).length>0,[r,R,_]);p.useEffect(()=>{if(M||e.task_manual||!e.target_column)return;const P=m.find(A=>A.name===e.target_column),I=NF(P);I&&I!==e.task&&s({...e,task:I,model_type:si(I,e.strategy),base_estimators:If(I),final_estimator:Af(I),metric:$f(I)})},[M,e.task_manual,e.target_column,e.strategy,m]);const E=e.run_mode==="advanced",T=(((S=e.base_estimators)==null?void 0:S.length)??0)<2;return t.jsxs("div",{className:"flex flex-col h-full",ref:a,children:[d&&t.jsxs("div",{className:"mb-4 p-2 bg-purple-50 dark:bg-purple-900/20 border border-purple-100 dark:border-purple-800 rounded text-xs text-purple-700 dark:text-purple-300 flex justify-between items-start gap-2",children:[t.jsxs("span",{children:["Combine several models into one. ",t.jsx("strong",{children:"Voting"})," averages their predictions; ",t.jsx("strong",{children:"Stacking"})," trains a meta-learner on their out-of-fold predictions."]}),t.jsx("button",{type:"button","aria-label":"Dismiss ensemble information",onClick:()=>{u(!1),sessionStorage.setItem("hide_info_ensemble","true")},className:"text-purple-400 hover:text-purple-600 dark:hover:text-purple-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4",children:t.jsxs("div",{className:n?"grid grid-cols-2 gap-x-6 gap-y-5 items-start":"space-y-5",children:[t.jsx(GF,{config:e,update:k,currentOptions:N,columns:m,tooFewModels:T}),t.jsxs("div",{className:"space-y-5",children:[t.jsx(zF,{config:e,update:k,options:N}),t.jsx(BF,{config:e,update:k,optionLabels:Ff(N)}),t.jsx(VF,{config:e,update:k}),t.jsx(UF,{config:e,update:k}),E&&t.jsx(JF,{config:e,update:k}),t.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded px-2 py-1.5",children:[t.jsx(Qe,{className:"w-3 h-3 mt-0.5 shrink-0"}),t.jsxs("span",{children:["Models like SVC/KNN/Logistic Regression benefit from a ",t.jsx("strong",{children:"Scaler"})," node upstream."]})]}),!E&&t.jsx(WF,{config:e,update:k,open:l,setOpen:c,options:N}),t.jsx(YF,{config:e,update:k,showCV:o,setShowCV:i,columns:m})]})]})}),t.jsx(KF,{config:e,datasetId:x,runJob:f,isSubmitting:g,submissionMessage:b,runFeedback:y,runHelpId:v,tooFewModels:T})]})}const ZF=ro({type:"EnsembleNode",label:"Ensemble",description:"Combine multiple models via Voting or Stacking.",icon:zn,settings:XF,defaultConfig:{task:"classification",strategy:"voting",model_type:"voting_classifier",base_estimators:["random_forest","logistic_regression","gradient_boosting"],voting:"soft",final_estimator:"logistic_regression",cv:5,passthrough:!1,n_jobs:1,calibrate_base_models:!1,calibration_method:"sigmoid",calibration_cv:3,cv_enabled:!0,cv_folds:5,cv_type:"k_fold",cv_shuffle:!0,cv_random_state:42,cv_time_column:"",base_estimator_params:{},final_estimator_params:{},run_mode:"basic",search_strategy:"random",n_trials:20,metric:"accuracy",tune_base_models:!0,random_state:42},bodyPreview:e=>{var a;const s=((a=e.base_estimators)==null?void 0:a.length)??0,r=e.strategy??"voting";return s?`${r} Β· ${s} ${s===1?"model":"models"}`:r},validate:e=>{var s;return e.target_column?(((s=e.base_estimators)==null?void 0:s.length)??0)<2?{isValid:!1,message:"Select at least two base models.",field:"base_estimators"}:{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"}},inputs:[{id:"in",label:"Data / Models",type:"any"}],outputs:[{id:"model",label:"Ensemble Model",type:"model"}]});function ep(e){if(e.datasetId)return e.datasetId;if(e.dataset_id)return e.dataset_id}function eD(e){var s,r,a,n;if((s=e.data)!=null&&s.datasetId)return e.data.datasetId;if((r=e.data)!=null&&r.dataset_id)return e.data.dataset_id;if((a=e.data)!=null&&a.config){const o=ep(e.data.config);if(o)return o}if((n=e.data)!=null&&n.params)return ep(e.data.params)}function tD(e,s,r){const a=new Set,n=[e];for(;n.length>0;){const o=n.shift();if(!o||a.has(o))continue;a.add(o);const i=s.find(c=>c.id===o);if(!i)continue;if(o!==e){const c=eD(i);if(c)return c}const l=Kt(i,s,r);for(const c of l)n.push(c.id)}}function sD(e,s){var f;const[r,a]=p.useState([]),[n,o]=p.useState(!1),[i,l]=p.useState([]),[c,d]=p.useState(!1),u=i.find(g=>g.id===e.model_type),m=(f=u==null?void 0:u.tags)==null?void 0:f.includes("requires_scaling");p.useEffect(()=>{(async()=>{d(!0);try{const y=(await zr.getAllNodes()).filter(v=>{var N;const j=v.category==="Model"||v.category==="Modeling",w=((N=v.tags)==null?void 0:N.includes("clustering"))??!1;return j&&w});l(y)}catch(b){console.error("Failed to fetch clustering models:",b),l([{id:"kmeans",name:"K-Means",category:"Modeling",description:"",params:{},tags:["clustering"]}])}finally{d(!1)}})()},[]);const h=p.useRef(!1);return p.useEffect(()=>{e.model_type&&(o(!0),Re.getHyperparameters(e.model_type).then(g=>{const b=g;if(a(b),h.current||Object.keys(e.hyperparameters).length===0){const y={};b.forEach(v=>{y[v.name]=v.default}),s({...e,hyperparameters:y}),h.current=!1}}).catch(console.error).finally(()=>{o(!1)}))},[e.model_type]),{hyperparameters:r,isLoadingDefs:n,availableModels:i,isLoadingModels:c,selectedModelItem:u,requiresScaling:m,changeModel:g=>{Object.keys(e.hyperparameters).length>0&&(h.current=!0),s({...e,model_type:g,hyperparameters:{}})}}}function rD(e,s,r,a,n){const o=Ke(g=>s?g.nodeSubmissions[s]:void 0),i=(o==null?void 0:o.pending)??!1,l=(o==null?void 0:o.message)??"",c=o==null?void 0:o.run,{toggleDrawer:d,setTab:u,setActiveParallelRun:m,startPolling:h}=Ke(),x=(g,b,y)=>{var w,N;const v=((w=g.job_ids)==null?void 0:w.length)||1,j={label:b,jobIds:(N=g.job_ids)!=null&&N.length?g.job_ids:[g.job_id]};y({pending:!1,run:j,message:""}),h(),v>1?(m({jobIds:g.job_ids,startedAt:new Date().toISOString()}),le.success("Parallel execution started",`${v} branches submitted.`)):le.success("Segmentation job submitted"),u("segmentation"),Ke.getState().setInspectedRun(null),d(!0)};return{isSubmitting:i,submissionMessage:l,runFeedback:c,handleTrain:async()=>{var v;if(!s||(v=Ke.getState().nodeSubmissions[s])!=null&&v.pending)return;if(!r){le.error("No dataset connected","Connect a dataset node upstream before starting training.");return}const g=j=>Ke.getState().setNodeSubmission(s,j),b=`Segmentation β€” ${e.model_type.replace(/_/g," ")}`;be.getState().setLeakageNotice(null);const y=Ca(a,n);g({pending:!0,run:null,message:`${b}: Submitting...`});try{const j=Ms(a,n);if(Kc(j)){g({pending:!1,run:null,message:`${b} blocked. Move data-learning preprocessing after the train/test split.`});return}const w=await Re.runPipeline({...j,target_node_id:s,job_type:"training"});x(w,b,g)}catch(j){console.error("Failed to submit segmentation job:",j);const w=Sn(j);w&&be.getState().setLeakageNotice({message:w,graphSignature:y}),g({pending:!1,run:null,message:`${b}: Submission failed. ${w??"Check your connection and settings, then try again."}`}),le.error("Failed to submit segmentation job",w??"Check console for details.")}}}}function aD({config:e,onChange:s,fieldId:r,availableModels:a,isLoadingModels:n,requiresScaling:o,showScalingAlert:i,setShowScalingAlert:l,availableColumns:c,changeModel:d}){return t.jsx("div",{className:"space-y-5 animate-in fade-in duration-300",children:t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Model Configuration"}),t.jsxs("div",{className:"grid gap-3",children:[t.jsxs(ce,{field:"model_type",children:[t.jsx("label",{htmlFor:`${r}-model_type`,className:"block text-xs font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Clustering Algorithm"}),t.jsxs("div",{className:"relative",children:[t.jsx("select",{id:`${r}-model_type`,value:e.model_type,onChange:u=>d(u.target.value),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:n,children:a.map(u=>t.jsx("option",{value:u.id,children:u.name},u.id))}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]}),o&&t.jsxs("div",{className:"mt-2 text-xs border border-blue-200 dark:border-blue-800 rounded-md bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 overflow-hidden transition-all",children:[t.jsxs("button",{"aria-expanded":i,onClick:()=>l(!i),className:"w-full flex items-center justify-between p-2 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[t.jsx($t,{className:"w-3 h-3"}),t.jsx("span",{children:"Scale Your Data"})]}),t.jsx(Ce,{className:`w-3 h-3 transition-transform ${i?"rotate-180":""}`})]}),i&&t.jsx("div",{className:"p-2 pt-0 opacity-90 animate-in slide-in-from-top-1 pl-7",children:'This model performs best with scaled features. Consider adding a "Feature Scaling" node.'})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx("label",{htmlFor:`${r}-reference_column`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Reference Column (optional)"}),t.jsx(Ze,{text:"A column with a known real-world label (e.g. a species/customer-type name) that you want excluded from clustering, but kept around afterward to see which cluster corresponds to which group β€” e.g. 'Cluster 0 is 92% setosa'. The model never sees this column."})]}),t.jsxs("div",{className:"relative",children:[t.jsxs("select",{id:`${r}-reference_column`,value:e.reference_column??"",onChange:u=>s({...e,reference_column:u.target.value||void 0}),className:"w-full appearance-none border border-gray-300 dark:border-gray-600 rounded-lg p-2.5 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-purple-500 focus:border-purple-500 outline-none transition-all",disabled:c.length===0,children:[t.jsx("option",{value:"",children:"None"}),c.map(u=>t.jsx("option",{value:u.name,children:u.name},u.name))]}),t.jsx(Ce,{className:"absolute right-3 top-3 w-4 h-4 text-gray-400 pointer-events-none"})]})]})]})]})})})}function nD({config:e,onChange:s,fieldId:r,hyperparameters:a,isLoadingDefs:n}){return t.jsxs("div",{className:"space-y-4 animate-in fade-in duration-300",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[t.jsx(Aa,{className:"w-4 h-4 text-blue-500"}),"Hyperparameters"]})}),t.jsxs("div",{className:"space-y-3",children:[n?t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(ge,{className:"w-5 h-5 animate-spin text-blue-500"})}):a.map(o=>t.jsx(oD,{param:o,config:e,onChange:s,fieldId:r},o.name)),a.length===0&&!n&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 italic text-center py-4",children:"No parameters available."})]})]})}function oD({param:e,config:s,onChange:r,fieldId:a}){var n;return t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[t.jsxs("div",{className:"flex justify-between items-center mb-2",children:[t.jsx("label",{htmlFor:`${a}-param-${e.name}`,className:"block text-xs font-medium text-gray-700 dark:text-gray-300",children:e.label}),e.description&&t.jsx(Ze,{text:e.description})]}),e.type==="select"?t.jsx("select",{id:`${a}-param-${e.name}`,value:s.hyperparameters[e.name]??e.default,onChange:o=>r({...s,hyperparameters:{...s.hyperparameters,[e.name]:o.target.value}}),className:"w-full border border-gray-300 dark:border-gray-600 rounded-lg p-2 text-sm bg-white dark:bg-gray-800 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all",children:(n=e.options)==null?void 0:n.map(o=>t.jsx("option",{value:String(o.value),children:o.label},String(o.value)))}):t.jsx(Mf,{id:`${a}-param-${e.name}`,type:e.type,value:s.hyperparameters[e.name]??e.default,onChange:o=>r({...s,hyperparameters:{...s.hyperparameters,[e.name]:o}}),step:e.step,min:e.min,max:e.max})]})}function iD({runHelpId:e,datasetId:s,config:r,selectedModelItem:a,isSubmitting:n,handleTrain:o,submissionMessage:i,runFeedback:l}){return t.jsxs(Ed,{details:t.jsx("p",{id:e,className:"text-xs text-center text-muted-foreground",children:s?r.model_type?`Trains ${(a==null?void 0:a.name)||r.model_type.replace(/_/g," ")} in the background without a target column.`:"Choose a clustering algorithm to enable this action.":"Connect a dataset node upstream and select a dataset to enable this action."}),children:[t.jsxs("button",{type:"button",onClick:()=>{o()},disabled:!s||!r.model_type||n,"aria-describedby":e,className:"w-full max-w-xs flex items-center justify-center gap-2 px-6 py-2.5 action-primary rounded-lg shadow-lg transition-all hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-lg disabled:hover:translate-y-0 focus-ring",children:[n?t.jsx(ge,{className:"w-4 h-4 animate-spin"}):t.jsx(ms,{className:"w-4 h-4 fill-current"}),t.jsx("span",{className:"text-sm font-semibold",children:n?"Submitting job...":"Train segmentation"})]}),i&&t.jsx("p",{role:"status","aria-atomic":"true",className:"text-xs text-center text-muted-foreground break-words",children:i}),l&&t.jsx(hi,{run:l,task:"segmentation"})]})}const lD=({config:e,onChange:s,nodeId:r})=>{const a=p.useId(),n=p.useId(),[o,i]=p.useState(()=>!sessionStorage.getItem("hide_info_segmentation")),l=V(k=>k.nodes),c=V(k=>k.edges),d=tD(r||"",l,c),{data:u}=Me(d),m=u?Object.values(u.columns):[],[h,x]=Ve(),[f,g]=p.useState("model");gs(k=>{k==="model_type"&&g("model")});const[b,y]=p.useState(!0),v=sD(e,s),j=rD(e,r,d,l,c),w=t.jsx(aD,{config:e,onChange:s,fieldId:n,availableColumns:m,availableModels:v.availableModels,isLoadingModels:v.isLoadingModels,requiresScaling:v.requiresScaling,changeModel:v.changeModel,showScalingAlert:b,setShowScalingAlert:y}),N=t.jsx(nD,{config:e,onChange:s,fieldId:n,hyperparameters:v.hyperparameters,isLoadingDefs:v.isLoadingDefs});return t.jsxs("div",{className:"flex flex-col h-full",ref:h,children:[o&&t.jsxs("div",{className:"mb-4 p-2 bg-blue-50 dark:bg-blue-900/20 border border-blue-100 dark:border-blue-800 rounded text-xs text-blue-700 dark:text-blue-300 flex justify-between items-start gap-2",children:[t.jsx("span",{children:"Group rows into clusters by similarity β€” no target column needed."}),t.jsx("button",{"aria-label":"Dismiss segmentation information",onClick:()=>{i(!1),sessionStorage.setItem("hide_info_segmentation","true")},className:"text-blue-400 hover:text-blue-600 dark:hover:text-blue-200",children:t.jsx(Ee,{className:"w-3 h-3"})})]}),!x&&t.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700 mb-4",children:[t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${f==="model"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":f==="model",onClick:()=>{g("model")},children:"Configuration"}),t.jsx("button",{className:`flex-1 py-2.5 text-xs font-medium text-center border-b-2 transition-colors ${f==="params"?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700"}`,"aria-pressed":f==="params",onClick:()=>{g("params")},children:"Hyperparameters"})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-1 pb-4 custom-scrollbar",children:x?t.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[t.jsx("div",{className:"overflow-y-auto pr-2",children:w}),t.jsx("div",{className:"overflow-y-auto pl-2 border-l border-gray-100 dark:border-gray-800",children:N})]}):t.jsxs(t.Fragment,{children:[f==="model"&&w,f==="params"&&N]})}),t.jsx(iD,{runHelpId:a,datasetId:d,config:e,selectedModelItem:v.selectedModelItem,...j})]})},cD=ro({type:"SegmentationNode",label:"Segmentation",description:"Group rows into clusters (segments) by similarity β€” no target column needed.",icon:zn,settings:e=>t.jsx(lD,{...e}),defaultConfig:{model_type:"kmeans",hyperparameters:{}},bodyPreview:e=>e.model_type?`${e.model_type}`:null,validate:e=>e.model_type?{isValid:!0}:{isValid:!1,message:"Select a clustering algorithm.",field:"model_type"},outputs:[{id:"model",label:"Trained Model",type:"model"}]});function dD(e,s,r){var o;const a=new Set,n=[e];for(;n.length>0;){const i=n.shift();if(!i||a.has(i))continue;a.add(i);const l=s.find(d=>d.id===i);if(!l)continue;if(i!==e&&((o=l.data)!=null&&o.datasetId))return l.data.datasetId;const c=Kt(l,s,r);for(const d of c)n.push(d.id)}}function uD({config:e,onChange:s,nodeId:r}){var x;const a=Be(r||""),n=V(f=>f.nodes),o=V(f=>f.edges),i=V(f=>f.executionResult),l=dD(r||"",n,o),c=(x=a.find(f=>f.target_column))==null?void 0:x.target_column;p.useEffect(()=>{const f={};l&&e.datasetId!==l?f.datasetId=l:!l&&e.datasetId&&(f.datasetId=void 0),c&&e.target_column!==c&&(f.target_column=c),Object.keys(f).length>0&&s({...e,...f})},[l,c,e.datasetId,e.target_column,s]);const{data:d,isLoading:u}=Me(l||e.datasetId),m=Je(r),h=d?Object.values(d.columns).map(f=>f.name).filter(f=>!m.has(f)):[];return{upstreamDatasetId:l,upstreamTargetColumn:c,columns:h,isLoading:u,result:i==null?void 0:i.node_results[r||""]}}function mD({upstreamDatasetId:e,isLoading:s}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to configure."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}function pD({config:e,onChange:s,columns:r,upstreamTargetColumn:a,showInvalidTarget:n}){return t.jsx(t.Fragment,{children:(e.method!=="variance_threshold"&&e.method!=="correlation_threshold"||n)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Target Column"}),a?t.jsxs("div",{className:"p-2 bg-muted rounded text-sm text-muted-foreground border",children:[a," ",t.jsx("span",{className:"text-xs italic",children:"(Auto-detected)"})]}):t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column??"",onChange:o=>s({...e,target_column:o.target.value}),children:[t.jsx("option",{value:"",children:"Select Target..."}),r.map(o=>t.jsx("option",{value:o,children:o},o))]})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for supervised selection methods."})]})})}function hD(e){const{config:s,onChange:r}=e,a=["select_k_best","select_percentile","select_fpr","select_fdr","select_fwe","generic_univariate_select"].includes(s.method),n=["select_from_model","rfe"].includes(s.method);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Selection Method"}),t.jsxs("select",{"aria-label":"Selection Method",className:"w-full p-2 border rounded bg-background text-sm",value:s.method,onChange:o=>r({...s,method:o.target.value}),children:[t.jsxs("optgroup",{label:"Simple",children:[t.jsx("option",{value:"variance_threshold",children:"Variance Threshold"}),t.jsx("option",{value:"correlation_threshold",children:"Correlation Threshold"})]}),t.jsxs("optgroup",{label:"Univariate",children:[t.jsx("option",{value:"select_k_best",children:"Select K Best"}),t.jsx("option",{value:"select_percentile",children:"Select Percentile"}),t.jsx("option",{value:"select_fpr",children:"False Positive Rate (FPR)"}),t.jsx("option",{value:"select_fdr",children:"False Discovery Rate (FDR)"}),t.jsx("option",{value:"select_fwe",children:"Family-wise Error (FWE)"}),t.jsx("option",{value:"generic_univariate_select",children:"Generic Univariate"})]}),t.jsxs("optgroup",{label:"Model Based",children:[t.jsx("option",{value:"select_from_model",children:"Select From Model"}),t.jsx("option",{value:"rfe",children:"Recursive Feature Elimination (RFE)"})]})]})]}),t.jsx(pD,{...e}),(a||n)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Problem Type"}),t.jsxs("select",{"aria-label":"Problem Type",className:"w-full p-2 border rounded bg-background text-sm",value:s.problem_type??"auto",onChange:o=>r({...s,problem_type:o.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto-detect"}),t.jsx("option",{value:"classification",children:"Classification"}),t.jsx("option",{value:"regression",children:"Regression"})]})]})]})}function xD(e){const s=e.problem_type||"auto";return s==="classification"?[{value:"f_classif",label:"ANOVA F-value"},{value:"mutual_info_classif",label:"Mutual Information"},{value:"chi2",label:"Chi-squared"}]:s==="regression"?[{value:"f_regression",label:"F-value"},{value:"mutual_info_regression",label:"Mutual Information"},{value:"r_regression",label:"Pearson Correlation"}]:[{value:"f_classif",label:"ANOVA F-value (Classif)"},{value:"f_regression",label:"F-value (Reg)"},{value:"mutual_info_classif",label:"Mutual Info (Classif)"},{value:"mutual_info_regression",label:"Mutual Info (Reg)"}]}function gD({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="variance_threshold"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"number",step:"0.01",className:"w-full p-2 border rounded bg-background text-sm",value:e.threshold??0,onChange:r=>s({...e,threshold:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Features with variance lower than this will be removed."})]}),e.method==="correlation_threshold"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"number",step:"0.01",max:"1",min:"0",className:"w-full p-2 border rounded bg-background text-sm",value:e.threshold??.95,onChange:r=>s({...e,threshold:Number.parseFloat(r.target.value)})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Method"}),t.jsxs("select",{"aria-label":"Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.correlation_method??"pearson",onChange:r=>s({...e,correlation_method:r.target.value}),children:[t.jsx("option",{value:"pearson",children:"Pearson"}),t.jsx("option",{value:"spearman",children:"Spearman"}),t.jsx("option",{value:"kendall",children:"Kendall"})]})]})]})]})}function fD({config:e,onChange:s}){const r=["select_k_best","select_percentile","select_fpr","select_fdr","select_fwe","generic_univariate_select"].includes(e.method);return t.jsx(t.Fragment,{children:r&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Scoring Function"}),t.jsxs("select",{"aria-label":"Scoring Function",className:"w-full p-2 border rounded bg-background text-sm",value:e.score_func??"",onChange:a=>s({...e,score_func:a.target.value}),children:[t.jsx("option",{value:"",children:"Auto (Default)"}),xD(e).map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]})]})})}function bD({config:e,onChange:s}){return t.jsx(t.Fragment,{children:(e.method==="select_k_best"||e.method==="rfe")&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"K (Number of Features)"}),t.jsx("input",{"aria-label":"K (Number of Features)",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.k??10,onChange:r=>s({...e,k:st(r.target.value,e.k)})})]})})}function yD({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="select_percentile"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Percentile"}),t.jsx("input",{"aria-label":"Percentile",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.percentile??10,onChange:r=>s({...e,percentile:st(r.target.value,e.percentile)})})]}),["select_fpr","select_fdr","select_fwe"].includes(e.method)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Alpha (Significance)"}),t.jsx("input",{"aria-label":"Alpha (Significance)",type:"number",step:"0.001",className:"w-full p-2 border rounded bg-background text-sm",value:e.alpha??.05,onChange:r=>s({...e,alpha:Number.parseFloat(r.target.value)})})]}),e.method==="generic_univariate_select"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Mode"}),t.jsxs("select",{"aria-label":"Mode",className:"w-full p-2 border rounded bg-background text-sm",value:e.mode??"k_best",onChange:r=>s({...e,mode:r.target.value}),children:[t.jsx("option",{value:"k_best",children:"K Best"}),t.jsx("option",{value:"percentile",children:"Percentile"}),t.jsx("option",{value:"fpr",children:"FPR"}),t.jsx("option",{value:"fdr",children:"FDR"}),t.jsx("option",{value:"fwe",children:"FWE"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Parameter"}),t.jsx("input",{"aria-label":"Parameter",type:"number",step:"0.001",className:"w-full p-2 border rounded bg-background text-sm",value:e.param??1e-5,onChange:r=>s({...e,param:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Value for the selected mode (e.g., k, percentile, or alpha)."})]})]})]})}function vD({config:e,onChange:s}){const r=["select_from_model","rfe"].includes(e.method);return t.jsxs(t.Fragment,{children:[r&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Estimator"}),t.jsxs("select",{"aria-label":"Estimator",className:"w-full p-2 border rounded bg-background text-sm",value:e.estimator??"auto",onChange:a=>s({...e,estimator:a.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"RandomForest",children:"Random Forest"}),t.jsx("option",{value:"LogisticRegression",children:"Logistic Regression"}),t.jsx("option",{value:"LinearRegression",children:"Linear Regression"})]})]}),e.method==="select_from_model"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Threshold"}),t.jsx("input",{"aria-label":"Threshold",type:"text",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"e.g., median, mean, 1.25*mean",value:e.threshold??"median",onChange:a=>s({...e,threshold:a.target.value})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:'String (e.g. "median") or float.'}),t.jsx("span",{className:"text-sm font-medium",children:"Max Features"}),t.jsx("input",{"aria-label":"Max Features",type:"number",className:"w-full p-2 border rounded bg-background text-sm",placeholder:"Optional",value:e.max_features??"",onChange:a=>s({...e,max_features:st(a.target.value,e.max_features)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional cap on the number of features to select. Leave empty for no cap."})]}),e.method==="rfe"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Step"}),t.jsx("input",{"aria-label":"Step",type:"number",min:"1",className:"w-full p-2 border rounded bg-background text-sm",value:e.step??1,onChange:a=>s({...e,step:st(a.target.value,e.step)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Features to remove at each iteration."})]})]})}function jD({id:e,...s}){const{config:r,onChange:a}=s;return t.jsxs(t.Fragment,{children:[t.jsx(gD,{...s}),t.jsx(fD,{...s}),t.jsx(bD,{...s}),t.jsx(yD,{...s}),t.jsx(vD,{...s}),t.jsxs("div",{className:"flex items-center space-x-2 pt-2 border-t",children:[t.jsx("input",{type:"checkbox",id:`${e}-drop-columns`,className:"rounded border-gray-300",checked:r.drop_columns!==!1,onChange:n=>a({...r,drop_columns:n.target.checked})}),t.jsx("label",{htmlFor:`${e}-drop-columns`,className:"text-sm font-medium",children:"Drop Columns"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"If unchecked, columns will be identified but not removed from the dataset."})]})}function wD(e,s){var r;return(r=s==null?void 0:s.dropped_columns)!=null&&r.length?"dropped":e.status!=="success"?"hidden":s?"none":i$(e.metrics)?"unavailable":"hidden"}function ND({column:e,metrics:s}){var l,c,d,u,m;const r=(l=s.feature_scores)==null?void 0:l[e],a=(c=s.p_values)==null?void 0:c[e],n=(d=s.feature_importances)==null?void 0:d[e],o=(u=s.variances)==null?void 0:u[e],i=(m=s.ranking)==null?void 0:m[e];return t.jsxs("div",{className:"flex flex-col items-end text-[10px] text-muted-foreground",children:[r!==void 0&&t.jsxs("span",{children:["Score: ",r.toFixed(4)]}),a!==void 0&&t.jsxs("span",{children:["p-val: ",a.toExponential(2)]}),n!==void 0&&t.jsxs("span",{children:["Imp: ",n.toFixed(4)]}),o!==void 0&&t.jsxs("span",{children:["Var: ",o.toFixed(4)]}),i!==void 0&&t.jsxs("span",{children:["Rank: ",i]})]})}function kD({metrics:e}){const s=e.dropped_columns;return t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1 flex justify-between items-center",children:t.jsxs("span",{children:["Dropped Columns (",s.length,")"]})}),t.jsx("div",{className:"max-h-40 overflow-y-auto bg-background p-2 rounded border space-y-1",children:s.map(r=>t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[120px] font-medium text-destructive",title:r,children:r}),t.jsx(ND,{column:r,metrics:e})]},r))})]})}function _D({config:e}){return t.jsxs("div",{className:"text-green-600 text-[10px] space-y-1",children:[t.jsx("div",{children:"No columns were dropped."}),e.method==="variance_threshold"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["All features have variance > ",e.threshold??0,". Try increasing the threshold."]}),e.method==="select_k_best"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["K (",e.k??10,") is likely larger than or equal to the number of features. Try reducing K."]}),e.method==="correlation_threshold"&&t.jsxs("div",{className:"text-muted-foreground italic",children:["No feature pairs found with correlation > ",e.threshold??.95,"."]})]})}function SD({state:e,metrics:s,config:r}){switch(e){case"dropped":return t.jsx(kD,{metrics:s});case"unavailable":return t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 rounded border border-yellow-200 dark:border-yellow-800",children:"Feature-selection drop details were unavailable because this wrapped metrics payload could not be resolved to a single step."});case"none":return t.jsx(_D,{config:r});default:return null}}function CD({values:e}){return e?t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1",children:"Top 5 Features"}),t.jsx("div",{className:"max-h-32 overflow-y-auto bg-background p-2 rounded border space-y-1",children:Object.entries(e).sort(([,s],[,r])=>r-s).slice(0,5).map(([s,r])=>t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"truncate max-w-[120px]",title:s,children:s}),t.jsx("span",{className:"font-mono text-[10px]",children:r.toFixed(4)})]},s))})]}):null}function tp({result:e,config:s}){if(!e)return null;const r=Qt(e.metrics),a=wD(e,r),n=(r==null?void 0:r.feature_scores)||(r==null?void 0:r.feature_importances);return!e.error&&a==="hidden"&&!n?null:t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs space-y-3",children:[t.jsx("div",{className:"font-medium text-muted-foreground",children:"Execution Feedback"}),e.error&&t.jsx("div",{className:"p-2 bg-destructive/10 text-destructive rounded border border-destructive/20",children:e.error}),t.jsx(SD,{state:a,metrics:r,config:s}),t.jsx(CD,{values:n})]})}const ED=({config:e,onChange:s,nodeId:r})=>{const a=ae.useId(),{upstreamDatasetId:n,upstreamTargetColumn:o,columns:i,isLoading:l,result:c}=uD({config:e,onChange:s,nodeId:r}),[d,u]=p.useState(!1);gs(x=>{x==="target_column"&&u(!0)});const[m,h]=Ve();return t.jsxs("div",{ref:m,className:`flex flex-col h-full w-full bg-background ${h?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(mD,{upstreamDatasetId:n,isLoading:l}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${h?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${h?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(hD,{config:e,onChange:s,columns:i,upstreamTargetColumn:o,showInvalidTarget:d}),h&&t.jsx(tp,{config:e,result:c})]}),t.jsxs("div",{className:`space-y-4 ${h?"overflow-y-auto pl-2 border-l":"shrink-0 border-t pt-4"}`,children:[t.jsx("h4",{className:"text-xs font-semibold uppercase text-muted-foreground mb-2",children:"Parameters"}),t.jsx(jD,{config:e,onChange:s,id:a}),!h&&t.jsx(tp,{config:e,result:c})]})]})]})},RD={type:"feature_selection",label:"Feature Selection",category:"Preprocessing",description:"Select the most important features.",icon:On,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Selected",type:"dataset"}],settings:ED,bodyPreview:e=>{const s=e.method??"variance_threshold";return(s==="select_k_best"||s==="rfe")&&e.k!=null?`${s} Β· k=${e.k}`:s==="select_percentile"&&e.percentile!=null?`${s} Β· ${e.percentile}%`:s==="variance_threshold"&&e.threshold!=null?`${s} Β· Οƒ>${e.threshold}`:s},validate:e=>e.method!=="variance_threshold"&&e.method!=="correlation_threshold"&&!e.target_column?{isValid:!1,field:"target_column",message:"Target column is required for this method."}:{isValid:!0},getDefaultConfig:()=>({method:"select_k_best",k:10})};function TD({config:e,onChange:s,fieldId:r}){const a=e.validation_size||0,n=1-e.test_size-a;return t.jsxs(t.Fragment,{children:[t.jsx(ce,{field:"test_size",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-test_size`,className:"text-sm font-medium",children:"Test Size (0.0 - 1.0)"}),t.jsx("input",{type:"number",step:"0.05",min:"0.05",max:"0.95",className:"w-full p-2 border rounded bg-background text-sm",id:`${r}-test_size`,value:e.test_size,onChange:o=>s({...e,test_size:Number.parseFloat(o.target.value)})})]})}),t.jsx(ce,{field:"validation_size",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-validation_size`,className:"text-sm font-medium",children:"Validation Size (0.0 - 1.0)"}),t.jsx("input",{type:"number",step:"0.05",min:"0.00",max:"0.95",className:"w-full p-2 border rounded bg-background text-sm",id:`${r}-validation_size`,value:a,onChange:o=>s({...e,validation_size:Number.parseFloat(o.target.value)})}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[Math.round(n*100),"% Training, ",Math.round(a*100),"% Validation, ",Math.round(e.test_size*100),"% Testing"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"The validation split grades hyperparameter candidates during tuning (instead of CV folds) and is used for threshold tuning. If left at 0, tuning scores candidates with CV folds inside the training split and threshold tuning falls back to the test split."}),n<=0&&t.jsx("p",{className:"text-xs text-red-500 font-medium",children:"Error: Total split size exceeds 100%"})]})})]})}function MD({upstreamDatasetId:e,datasetId:s,isLoading:r}){return t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!e&&!s&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),r&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}const PD=({config:e,onChange:s,nodeId:r})=>{var h,x;const a=p.useId(),n=Be(r||""),o=(h=n.find(f=>f.datasetId))==null?void 0:h.datasetId,i=(x=n.find(f=>f.target_column))==null?void 0:x.target_column;ae.useEffect(()=>{const f={};o&&e.datasetId!==o?f.datasetId=o:!o&&e.datasetId&&(f.datasetId=void 0),i&&e.target_column!==i&&(f.target_column=i),Object.keys(f).length>0&&s({...e,...f})},[o,i,e.datasetId,e.target_column,s]);const{data:l,isLoading:c}=Me(o||e.datasetId),d=l?Object.values(l.columns).map(f=>f.name):[],[u,m]=Ve();return t.jsxs("div",{ref:u,className:`flex flex-col h-full w-full bg-background ${m?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx(MD,{upstreamDatasetId:o,datasetId:e.datasetId,isLoading:c}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${m?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${m?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(TD,{config:e,onChange:s,fieldId:a}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${a}-random_state`,className:"text-sm font-medium",children:"Random State"}),t.jsx("input",{type:"number",className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-random_state`,value:e.random_state,onChange:f=>s({...e,random_state:st(f.target.value,e.random_state)})})]})]}),t.jsxs("div",{className:`space-y-4 ${m?"overflow-y-auto pl-2 border-l":"shrink-0 pt-4 border-t"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${a}-shuffle`,checked:e.shuffle,onChange:f=>s({...e,shuffle:f.target.checked})}),t.jsx("label",{htmlFor:`${a}-shuffle`,className:"text-sm font-medium",children:"Shuffle Data"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${a}-stratify`,checked:e.stratify,onChange:f=>s({...e,stratify:f.target.checked})}),t.jsx("label",{htmlFor:`${a}-stratify`,className:"text-sm font-medium",children:"Stratify by Target"})]}),t.jsxs("div",{className:"space-y-2 pl-6 border-l-2 border-muted",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"text-sm font-medium",children:"Target Column"}),t.jsxs("select",{className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-target_column`,value:e.target_column??"",onChange:f=>s({...e,target_column:f.target.value}),disabled:!e.stratify,children:[t.jsx("option",{value:"",children:"-- Select Target --"}),d.map(f=>t.jsx("option",{value:f,children:f},f))]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for stratification. If input is already separated (X, y), this is ignored."})]})]})]})]})},ID={type:"TrainTestSplitter",label:"Train-Test Split",category:"Preprocessing",description:"Split data into training and testing sets.",icon:Ec,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"train",label:"Train",type:"dataset"},{id:"validation",label:"Validation",type:"dataset"},{id:"test",label:"Test",type:"dataset"}],settings:PD,bodyPreview:e=>{const s=e.test_size??.2,r=e.validation_size??0,a=Math.max(0,1-s-r),n=o=>o.toFixed(2).replace(/\.?0+$/,"")||"0";return r>0?`${n(a)} / ${n(r)} / ${n(s)}`:`${n(a)} / ${n(s)}`},validate:e=>{if(e.test_size<=0||e.test_size>=1)return{isValid:!1,message:"Test size must be between 0 and 1.",field:"test_size"};const s=e.validation_size||0;return s<0||s>=1?{isValid:!1,message:"Validation size must be between 0 and 1.",field:"validation_size"}:e.test_size+s>=1?{isValid:!1,message:"Sum of Test and Validation sizes must be less than 1.",field:"validation_size"}:{isValid:!0}},getDefaultConfig:()=>({test_size:.2,validation_size:0,random_state:42,stratify:!1,shuffle:!0})},AD=({config:e,onChange:s,nodeId:r})=>{const a=p.useId(),n=V(u=>u.nodes),o=V(u=>u.edges),l=(u=>{var x;const m=new Set,h=[u];for(;h.length>0;){const f=h.shift();if(!f||m.has(f))continue;m.add(f);const g=n.find(y=>y.id===f);if(!g)continue;if(f!==u&&((x=g.data)!=null&&x.datasetId))return g.data.datasetId;const b=Kt(g,n,o);for(const y of b)h.push(y.id)}})(r||"");ae.useEffect(()=>{l&&e.datasetId!==l?s({...e,datasetId:l}):!l&&e.datasetId&&s({...e,datasetId:void 0})},[l,e.datasetId,s]);const{data:c}=Me(l||e.datasetId),d=c?Object.values(c.columns).map(u=>u.name):[];return t.jsx("div",{className:"p-4 space-y-4",children:t.jsx(ce,{field:"target_column",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${a}-target_column`,className:"text-sm font-medium",children:"Target Column"}),t.jsxs("select",{className:"w-full p-2 border rounded bg-background text-sm",id:`${a}-target_column`,value:e.target_column,onChange:u=>s({...e,target_column:u.target.value}),children:[t.jsx("option",{value:"",children:"-- Select Target --"}),d.map(u=>t.jsx("option",{value:u,children:u},u))]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This column will be separated as the target (y), and all other columns will be features (X)."})]})})})},$D={type:"feature_target_split",label:"Feature-Target Split",category:"Preprocessing",description:"Separate features (X) from target (y).",icon:Ec,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"X",label:"Features (X)",type:"dataset"},{id:"y",label:"Target (y)",type:"dataset"}],settings:AD,bodyPreview:e=>{const s=e.target_column;return s&&s.trim()?`target: ${s}`:"Set target"},validate:e=>e.target_column?{isValid:!0}:{isValid:!1,message:"Target column is required.",field:"target_column"},getDefaultConfig:()=>({target_column:""})};function FD({metrics:e}){return e&&e.DropMissingRows_rows_removed!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Removed:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.DropMissingRows_rows_removed)})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Remaining:"}),t.jsx("span",{className:"font-medium",children:String(e.DropMissingRows_rows_remaining)})]}),t.jsxs("div",{className:"flex justify-between pt-1 border-t",children:[t.jsx("span",{className:"text-muted-foreground",children:"Total Rows:"}),t.jsx("span",{className:"font-medium",children:String(e.DropMissingRows_rows_total)})]})]})]})}const DD=({config:e,onChange:s,nodeId:r})=>{var m;const n=(m=Be(r||"").find(h=>h.datasetId))==null?void 0:m.datasetId,{isLoading:o}=Me(n),i=V(h=>h.executionResult),l=r?i==null?void 0:i.node_results[r]:null,c=Qt(l==null?void 0:l.metrics),[d,u]=Ve();return t.jsxs("div",{ref:d,className:"p-4 space-y-4 h-full overflow-y-auto",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),o&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."}),t.jsxs("div",{className:u?"grid grid-cols-2 gap-6 items-start":"space-y-4",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[t.jsx("input",{type:"checkbox",checked:e.drop_if_any_missing,onChange:h=>s({...e,drop_if_any_missing:h.target.checked}),className:"rounded border-gray-300"}),"Drop rows with ANY missing values"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"If checked, any row containing at least one missing value will be removed."})]}),t.jsxs("div",{className:`space-y-2 ${e.drop_if_any_missing?"opacity-50 pointer-events-none":""}`,children:[t.jsx("span",{className:"block text-sm font-medium",children:"Missing Value Threshold (%)"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{"aria-label":"Missing Value Threshold (%)",type:"range",min:"0",max:"100",value:e.missing_threshold||0,onChange:h=>s({...e,missing_threshold:st(h.target.value,e.missing_threshold)}),className:"flex-1"}),t.jsxs("span",{className:"text-sm w-12 text-right",children:[e.missing_threshold||0,"%"]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop rows that have more than this percentage of missing values."})]})]}),t.jsx(FD,{metrics:c})]})]})},LD={type:"drop_missing_rows",label:"Drop Rows",category:"Preprocessing",description:"Drop rows based on missing values.",icon:gb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Cleaned Data",type:"dataset"}],settings:DD,bodyPreview:e=>{if(e.drop_if_any_missing)return"Drop rows with any missing";const s=e.missing_threshold??0;return s>0?`Drop rows missing > ${s}%`:null},validate:e=>({isValid:!0}),getDefaultConfig:()=>({drop_if_any_missing:!1,missing_threshold:50})};function OD({metrics:e}){return e&&e.Deduplicate_rows_removed!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Duplicates Removed:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.Deduplicate_rows_removed)})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Remaining:"}),t.jsx("span",{className:"font-medium",children:String(e.Deduplicate_rows_remaining)})]}),t.jsxs("div",{className:"flex justify-between pt-1 border-t",children:[t.jsx("span",{className:"text-muted-foreground",children:"Total Rows:"}),t.jsx("span",{className:"font-medium",children:String(e.Deduplicate_rows_total)})]})]})]})}const zD=({config:e,onChange:s,nodeId:r})=>{var f;const n=(f=Be(r||"").find(g=>g.datasetId))==null?void 0:f.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(g=>g.name).filter(g=>!l.has(g)):[],[o,l]),d=V(g=>g.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve();return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),i&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Keep Strategy"}),t.jsxs("select",{"aria-label":"Keep Strategy",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.keep,onChange:g=>s({...e,keep:g.target.value}),children:[t.jsx("option",{value:"first",children:"Keep First Occurrence"}),t.jsx("option",{value:"last",children:"Keep Last Occurrence"}),t.jsx("option",{value:"none",children:"Drop All Duplicates"})]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Determines which duplicates (if any) to keep."})]}),t.jsx(OD,{metrics:m})]}),t.jsxs("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Only consider these columns for identifying duplicates. If empty, all columns are used."}),t.jsx(Pe,{columns:c,selected:e.subset,onChange:g=>{s({...e,subset:g})},label:"Subset Columns (Optional)",variant:"panel",isLoading:i,fillHeight:x})]})]})]})},BD={type:"deduplicate",label:"Deduplicate",category:"Preprocessing",description:"Remove duplicate rows.",icon:fb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Unique Data",type:"dataset"}],settings:zD,bodyPreview:e=>{var n;const s=((n=e.subset)==null?void 0:n.length)??0,r=e.keep??"first";return`Subset: ${s===0?"all":`${s} ${s===1?"col":"cols"}`} Β· keep ${r}`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({subset:[],keep:"first"})},VD=[{value:"float",label:"Float (Decimal)"},{value:"float32",label:"Float32"},{value:"int",label:"Integer"},{value:"int8",label:"Int8"},{value:"int16",label:"Int16"},{value:"int32",label:"Int32"},{value:"int64",label:"Int64"},{value:"uint8",label:"UInt8"},{value:"uint16",label:"UInt16"},{value:"uint32",label:"UInt32"},{value:"uint64",label:"UInt64"},{value:"string",label:"String (Text)"},{value:"category",label:"Category"},{value:"bool",label:"Boolean"},{value:"datetime",label:"Datetime"}];function UD({metrics:e}){return e&&(e.cast_errors!==void 0||e.casted_columns_count!==void 0)&&t.jsxs("div",{className:"mt-4 p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[e.casted_columns_count!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Columns Casted:"}),t.jsx("span",{className:"font-medium",children:String(e.casted_columns_count)})]}),e.cast_errors!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Errors Encountered:"}),t.jsx("span",{className:"font-medium text-destructive",children:String(e.cast_errors)})]})]})]})}function HD({datasetId:e,isLoading:s}){return t.jsxs(t.Fragment,{children:[!e&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),s&&!!e&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]})}const WD=({config:e,onChange:s,nodeId:r})=>{var j;const n=(j=Be(r||"").find(w=>w.datasetId))==null?void 0:j.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=o?Object.values(o.columns).map(w=>w.name).filter(w=>!l.has(w)):[],d=c.find(w=>!e.column_types[w]),u=V(w=>w.executionResult),m=r?u==null?void 0:u.node_results[r]:null,h=Qt(m==null?void 0:m.metrics),[x,f]=Ve(),g=()=>{d!==void 0&&s({...e,column_types:{...e.column_types,[d]:"float"}})},b=w=>{const N={...e.column_types};Reflect.deleteProperty(N,w),s({...e,column_types:N})},y=(w,N)=>{if(w===N)return;const k=e.column_types[w];if(k===void 0)return;const _={...e.column_types};Reflect.deleteProperty(_,w),_[N]=k,s({...e,column_types:_})},v=(w,N)=>{s({...e,column_types:{...e.column_types,[w]:N}})};return t.jsxs("div",{ref:x,className:"p-4 space-y-4 h-full overflow-y-auto",children:[t.jsx(HD,{datasetId:n,isLoading:i}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:"Casting Rules"}),t.jsx("button",{"aria-label":"Add Casting Rule",onClick:g,disabled:!n||d===void 0,className:"p-1.5 action-primary rounded disabled:opacity-50 transition-colors",title:"Add Casting Rule",children:t.jsx(Es,{className:"w-4 h-4"})})]}),t.jsxs("div",{className:`space-y-2 ${f?"grid grid-cols-2 gap-2 space-y-0":""}`,children:[Object.entries(e.column_types).map(([w,N])=>t.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded bg-muted/10 group",children:[t.jsxs("div",{className:"flex-1 space-y-2 min-w-0",children:[t.jsx("select",{"aria-label":`Column for casting rule ${w}`,className:"w-full p-1.5 text-sm border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:w,onChange:k=>{y(w,k.target.value)},children:c.map(k=>t.jsx("option",{value:k,disabled:k!==w&&!!e.column_types[k],children:k},k))}),t.jsx("select",{"aria-label":`Data type for ${w}`,className:"w-full p-1.5 text-sm border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:N,onChange:k=>{v(w,k.target.value)},children:VD.map(k=>t.jsx("option",{value:k.value,children:k.label},k.value))})]}),t.jsx("button",{"aria-label":`Remove casting rule for ${w}`,onClick:()=>{b(w)},className:"p-1.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded transition-colors",title:"Remove Rule",children:t.jsx(gt,{className:"w-4 h-4"})})]},w)),Object.keys(e.column_types).length===0&&t.jsx("div",{className:`text-xs text-muted-foreground italic border border-dashed rounded p-8 text-center ${f?"col-span-2":""}`,children:"No casting rules defined. Click + to add one."})]})]}),t.jsx(UD,{metrics:h})]})},GD={type:"casting",label:"Cast Types",category:"Preprocessing",description:"Cast columns to specific data types.",icon:bb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Casted Data",type:"dataset"}],settings:WD,bodyPreview:e=>{const s=Object.keys(e.column_types??{}).length;return s===0?null:`Cast ${s} ${s===1?"col":"cols"}`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({column_types:{}})};function qD({metrics:e}){const s=e==null?void 0:e.missing_indicators_created,r=Array.isArray(e==null?void 0:e.missing_indicators_columns)?e==null?void 0:e.missing_indicators_columns:[];return s!==void 0&&t.jsxs("div",{className:"p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Indicators Created:"}),t.jsx("span",{className:"font-medium text-primary",children:String(s)})]}),r.length>0&&t.jsxs("div",{className:"pt-1 border-t mt-1",children:[t.jsx("span",{className:"text-muted-foreground block mb-1",children:"New Columns:"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(a=>{const n=String(a);return t.jsx("span",{className:"px-1.5 py-0.5 bg-background border rounded text-[10px] font-mono",children:n},n)})})]})]})]})}const KD=({config:e,onChange:s,nodeId:r})=>{var f;const n=(f=Be(r||"").find(g=>g.datasetId))==null?void 0:f.datasetId,{data:o,isLoading:i}=Me(n),l=Je(r),c=p.useMemo(()=>o?Object.values(o.columns).map(g=>g.name).filter(g=>!l.has(g)):[],[o,l]),d=V(g=>g.executionResult),u=r?d==null?void 0:d.node_results[r]:null,m=Qt(u==null?void 0:u.metrics),[h,x]=Ve();return t.jsxs("div",{ref:h,className:`flex flex-col h-full w-full bg-background ${x?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsxs("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),i&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."})]}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${x?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${x?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Indicator Suffix"}),t.jsx("input",{"aria-label":"Indicator Suffix",type:"text",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.flag_suffix,onChange:g=>s({...e,flag_suffix:g.target.value}),placeholder:"_was_missing"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Suffix added to the new indicator columns (e.g., "Age_was_missing").'})]}),t.jsx(qD,{metrics:m})]}),t.jsxs("div",{className:`flex flex-col overflow-hidden ${x?"min-h-0 flex-1":"shrink-0"}`,children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Create indicators for these columns. If empty, all columns with missing values are used."}),t.jsx(Pe,{columns:c,selected:e.columns,onChange:g=>{s({...e,columns:g})},label:"Target Columns (Optional)",variant:"panel",isLoading:i,fillHeight:x})]})]})]})},JD={type:"MissingIndicator",label:"Missing Indicator",category:"Preprocessing",description:"Create binary indicators for missing values.",icon:yb,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Augmented Data",type:"dataset"}],settings:KD,bodyPreview:e=>{var r;const s=((r=e.columns)==null?void 0:r.length)??0;return s===0?null:`${s} ${s===1?"col":"cols"} β†’ flags`},validate:e=>({isValid:!0}),getDefaultConfig:()=>({columns:[],flag_suffix:"_was_missing"})};function YD(e,s){return e?Object.values(e.columns).map(r=>r.name).filter(r=>!s.has(r)):[]}function QD(e){return e.suggested_node_type==="encoding"||e.type.includes("encoding")||e.type.includes("cardinality")}function XD(e){var c;const r=(c=Be(e||"").find(d=>d.datasetId))==null?void 0:c.datasetId,{data:a,isLoading:n}=Me(r),o=Je(e),i=V(d=>d.executionResult),l=e?i==null?void 0:i.node_results[e]:null;return{datasetId:r,schema:a,isLoading:n,categoricalColumns:YD(a,o),metrics:Qt(l==null?void 0:l.metrics),filteredRecommendations:((i==null?void 0:i.recommendations)||[]).filter(QD)}}const sp={onehot:"Creates binary columns for each category.",dummy:"Like One-Hot but drops first category to avoid collinearity.",label:"Assigns a unique integer to each category.",ordinal:"Encodes categories as ordered integers.",target:"Encodes categories based on target mean.",woe:"Replaces each category with its Weight of Evidence (log-odds of a binary target).",hash:"Maps categories to a fixed number of features."},vl=t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:[t.jsx("strong",{children:"Feature columns only"})," β€” target is always excluded. Use Label Encoder for the target."]})]}),rp={label:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Encodes ",t.jsx("strong",{children:"target (y)"})," by default. Place after Feature/Target Split."]})]}),ordinal:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-950/40 border border-blue-200 dark:border-blue-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Target-safe β€” no columns selected encodes ",t.jsx("strong",{children:"y"}),". Use when order matters (low/mid/high)."]})]}),target:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Replaces each category with the ",t.jsx("strong",{children:"mean of the target"}),". Select the target column on the right."]})]}),woe:t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[10px] text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-800 rounded px-2 py-1",children:[t.jsx(Qe,{size:10,className:"shrink-0"}),t.jsxs("span",{children:["Needs a ",t.jsx("strong",{children:"binary target"})," (exactly 2 classes). The target is auto-excluded β€” use Label Encoder for the target itself. Non-binary targets are ",t.jsx("strong",{children:"skipped"})," (columns pass through unchanged), not an error. Records Information Value (IV) per column."]})]}),onehot:vl,dummy:vl,hash:vl};function ZD({config:e,onChange:s,id:r}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:`${r}-encoding-method`,className:"block text-sm font-medium",children:"Encoding Method"}),t.jsxs("select",{id:`${r}-encoding-method`,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.method,onChange:a=>s({...e,method:a.target.value}),children:[t.jsx("option",{value:"onehot",children:"One-Hot Encoding"}),t.jsx("option",{value:"dummy",children:"Dummy Encoding"}),t.jsx("option",{value:"label",children:"Label Encoding"}),t.jsx("option",{value:"ordinal",children:"Ordinal Encoding"}),t.jsx("option",{value:"target",children:"Target Encoding"}),t.jsx("option",{value:"woe",children:"Weight of Evidence (WOE)"}),t.jsx("option",{value:"hash",children:"Hash Encoding"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:Object.prototype.hasOwnProperty.call(sp,e.method)&&sp[e.method]}),Object.prototype.hasOwnProperty.call(rp,e.method)&&rp[e.method],e.method==="onehot"&&t.jsxs("div",{className:"pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_original!==!1,onChange:a=>s({...e,drop_original:a.target.checked}),className:"rounded border-gray-300"}),"Drop Original Column"]}),t.jsx("p",{className:"text-[10px] text-muted-foreground ml-5",children:"If unchecked, keeps the original column alongside encoded features."})]})]})}function eL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_first||!1,onChange:r=>s({...e,drop_first:r.target.checked}),className:"rounded border-gray-300"}),"Drop First Category"]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Handle Unknown"}),t.jsxs("select",{"aria-label":"Handle Unknown",className:"w-full p-1 text-sm border rounded",value:e.handle_unknown||"ignore",onChange:r=>s({...e,handle_unknown:r.target.value}),title:"How to handle categories seen in test data but not in training data.",children:[t.jsx("option",{value:"ignore",children:"Ignore (Zeros)"}),t.jsx("option",{value:"error",children:"Raise Error"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:'"Ignore" produces all-zeros for unknown categories.'})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Max Categories"}),t.jsx("input",{"aria-label":"Max Categories",type:"number",min:"2",max:"200",className:"w-full p-1 text-sm border rounded",value:e.max_categories??20,onChange:r=>s({...e,max_categories:st(r.target.value,e.max_categories)}),title:"Caps the number of one-hot columns per feature."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Caps columns per feature (default 20)."})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[t.jsx("input",{type:"checkbox",checked:e.include_missing||!1,onChange:r=>s({...e,include_missing:r.target.checked}),className:"rounded border-gray-300"}),"Include missing as category"]})]})}function tL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:e.drop_first||!1,onChange:r=>s({...e,drop_first:r.target.checked}),className:"rounded border-gray-300"}),"Drop First Category"]}),t.jsx("p",{className:"text-[10px] text-muted-foreground ml-5",children:"Recommended: avoids the dummy variable trap (multicollinearity)."})]})}function sL({config:e,onChange:s,schema:r,categoricalColumns:a}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Target Column"}),t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column||"",onChange:n=>s({...e,target_column:n.target.value}),children:[t.jsx("option",{value:"",children:"Select a target column..."}),a.map(n=>{const o=r==null?void 0:r.columns[n];return t.jsxs("option",{value:n,children:[n,o?` (${o.dtype})`:""]},n)})]})}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Smoothing"}),t.jsx("input",{"aria-label":"Smoothing",type:"text",className:"w-full p-1 text-sm border rounded",value:e.smooth??"auto",onChange:n=>{const o=n.target.value;s({...e,smooth:o==="auto"||Number.isNaN(Number(o))?"auto":Number(o)})},placeholder:"auto or number",title:"Smoothing strength. 'auto' uses sklearn's default."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Higher = shrinks more toward global mean (default: auto)."})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Target Type"}),t.jsxs("select",{"aria-label":"Target Type",className:"w-full p-1 text-sm border rounded",value:e.target_type||"auto",onChange:n=>s({...e,target_type:n.target.value}),children:[t.jsx("option",{value:"auto",children:"Auto-detect"}),t.jsx("option",{value:"continuous",children:"Continuous (regression)"}),t.jsx("option",{value:"binary",children:"Binary classification"}),t.jsx("option",{value:"multiclass",children:"Multiclass classification"})]})]})]})}function rL({config:e,onChange:s,schema:r}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Target Column"}),t.jsx(ce,{field:"target_column",children:t.jsxs("select",{"aria-label":"Target Column",className:"w-full p-2 border rounded bg-background text-sm",value:e.target_column||"",onChange:a=>s({...e,target_column:a.target.value}),children:[t.jsx("option",{value:"",children:"Select a binary target column..."}),Object.keys((r==null?void 0:r.columns)??{}).map(a=>{const n=r==null?void 0:r.columns[a];return t.jsxs("option",{value:a,children:[a,n?` (${n.dtype})`:""]},a)})]})}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Target must have exactly 2 classes."}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Regularization"}),t.jsx("input",{"aria-label":"Regularization",type:"number",step:"0.1",min:"0",className:"w-full p-2 border rounded",value:e.regularization??.5,onChange:a=>s({...e,regularization:Number.parseFloat(a.target.value)}),title:"Laplace smoothing added to event/non-event counts to avoid division by zero."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Smoothing for rare categories (default 0.5)."})]})]})}function aL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Number of Features"}),t.jsx("input",{"aria-label":"Number of Features",type:"number",min:"1",className:"w-full p-2 border rounded",value:e.n_features??8,onChange:r=>s({...e,n_features:st(r.target.value,e.n_features)}),title:"Number of hash buckets."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Buckets to hash categories into (default 8)."})]})}function nL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Handle Unknown"}),t.jsxs("select",{"aria-label":"Handle Unknown",className:"w-full p-1 text-sm border rounded",value:e.handle_unknown==="ignore"||!e.handle_unknown?"use_encoded_value":e.handle_unknown,onChange:r=>s({...e,handle_unknown:r.target.value}),title:"How to handle categories not seen during training.",children:[t.jsx("option",{value:"use_encoded_value",children:"Use encoded value (–1)"}),t.jsx("option",{value:"error",children:"Raise error"})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:'"Use encoded value" assigns the integer below to unknown categories.'})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Unknown Value"}),t.jsx("input",{"aria-label":"Unknown Value",type:"number",className:"w-full p-2 border rounded",value:e.unknown_value??-1,disabled:e.handle_unknown==="error",onChange:r=>s({...e,unknown_value:st(r.target.value,e.unknown_value)}),title:"Integer to assign for unknown categories."})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsxs("span",{className:"block text-xs font-medium",children:["Category Order ",t.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),t.jsx("textarea",{"aria-label":"Category Order (optional)",className:"w-full p-1.5 text-xs border rounded font-mono resize-y min-h-[56px]",placeholder:`One line per column: low, medium, high cat1, cat2, cat3`,value:e.categories_order||"",rows:3,onChange:r=>s({...e,categories_order:r.target.value}),title:"Ordered categories per selected column. One line per column (in selection order). Leave empty for auto-detection."}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"One line per selected column, comma-separated in desired order. Leave blank for auto-detection."})]})]})}function oL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border h-full",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Missing/Unknown Code"}),t.jsx("input",{"aria-label":"Missing/Unknown Code",type:"number",className:"w-full p-2 border rounded",value:e.missing_code??-1,onChange:r=>s({...e,missing_code:st(r.target.value,e.missing_code)}),title:"Integer to assign for missing or unknown categories."}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Value assigned to missing/unknown categories (default: -1)."})]})}const ap={onehot:eL,dummy:tL,target:sL,woe:rL,hash:aL,ordinal:nL,label:oL};function iL(e){const s=Object.prototype.hasOwnProperty.call(ap,e.config.method)?ap[e.config.method]:null;return t.jsx("div",{className:"space-y-2",children:s?t.jsx(s,{...e}):null})}function np(e){return e&&typeof e=="object"?e:null}function lL({metrics:e}){if(!e)return null;const s=np(e.categories_count),r=np(e.classes_count);return t.jsxs("div",{className:"mt-4 p-3 bg-muted/30 rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm font-semibold text-primary",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Last Run Results"})]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[e.encoded_columns_count!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"Columns Encoded:"}),t.jsx("span",{className:"font-medium",children:String(e.encoded_columns_count)})]}),e.new_features_count!==void 0&&t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-muted-foreground",children:"New Features Created:"}),t.jsx("span",{className:"font-medium text-primary",children:String(e.new_features_count)})]}),s&&t.jsxs("div",{className:"mt-2 border-t pt-2",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Categories Found:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:Object.entries(s).map(([a,n])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:a,children:[a,":"]}),t.jsx("span",{className:"font-mono",children:String(n)})]},a))})]}),r&&t.jsxs("div",{className:"mt-2 border-t pt-2",children:[t.jsx("span",{className:"text-muted-foreground block mb-1 font-medium",children:"Classes Found:"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1",children:Object.entries(r).map(([a,n])=>t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"truncate max-w-[100px]",title:a,children:[a,":"]}),t.jsx("span",{className:"font-mono",children:String(n)})]},a))})]})]})]})}const cL=({config:e,onChange:s,nodeId:r})=>{const a=ae.useId(),{datasetId:n,schema:o,isLoading:i,categoricalColumns:l,metrics:c,filteredRecommendations:d}=XD(r),[u,m]=Ve(400);return t.jsxs("div",{ref:u,className:"p-4 space-y-4",children:[!n&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),i&&!!n&&t.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading schema..."}),t.jsxs("div",{className:`grid gap-4 ${m?"grid-cols-2":"grid-cols-1"}`,children:[t.jsx(ZD,{config:e,onChange:s,id:a}),t.jsx(iL,{config:e,onChange:s,schema:o,categoricalColumns:l})]}),t.jsx(ce,{field:"columns",children:t.jsx(Pe,{columns:l,selected:e.columns,onChange:h=>{s({...e,columns:h})},label:"Columns to Encode",variant:"panel",isLoading:i,emptyMessage:"No columns found β€” connect an upstream dataset node.",fillHeight:!1})}),d.length>0&&t.jsx(Vr,{recommendations:d}),t.jsx(lL,{metrics:c})]})},dL={type:"encoding",label:"Encoding",category:"Preprocessing",description:"Encode categorical variables.",icon:Kp,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Encoded Data",type:"dataset"}],settings:cL,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.method??"onehot";return s===0?r:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:e=>e.columns.length===0&&e.method!=="label"&&e.method!=="ordinal"?{isValid:!1,field:"columns",message:"Select at least one column"}:e.method==="woe"&&!e.target_column?{isValid:!1,field:"target_column",message:"WOE encoding requires a binary target column"}:{isValid:!0},getDefaultConfig:()=>({method:"onehot",columns:[],drop_first:!1,drop_original:!0,handle_unknown:"ignore",max_categories:20,include_missing:!1,n_features:8,smooth:"auto",target_type:"auto",regularization:.5,unknown_value:-1,missing_code:-1,categories_order:""})},uL=["mean","sum","min","max","std","median"],mL=["year","month","day","dayofweek","dayofyear","quarter","weekofyear","hour","minute","is_weekend","is_month_start","is_month_end"];function Df({options:e,selected:s,onChange:r}){const a=n=>{s.includes(n)?r(s.filter(o=>o!==n)):r([...s,n])};return t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(n=>{const o=s.includes(n);return t.jsx("button",{type:"button","aria-pressed":o,onClick:()=>{a(n)},className:`px-2 py-1 rounded text-[11px] border transition-colors ${o?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-accent border-muted-foreground/30"}`,children:n},n)})})}const pL={lag:"Shift columns by N rows to expose past values to the model.",rolling:"Rolling-window aggregates (mean/sum/min/max/std/median).",date:"Extract calendar parts (year, month, day-of-week, ...) from datetime columns."};function hL({config:e,allColumns:s,update:r}){var a;return t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Sort By (optional)"}),t.jsxs("select",{"aria-label":"Sort By (optional)",className:"w-full p-1.5 border rounded bg-background text-xs",value:e.sort_by??"",onChange:n=>{r({sort_by:n.target.value||void 0})},children:[t.jsx("option",{value:"",children:"β€” none β€”"}),s.map(n=>t.jsx("option",{value:n,children:n},n))]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Group By (optional)"}),t.jsxs("select",{"aria-label":"Group By (optional)",className:"w-full p-1.5 border rounded bg-background text-xs",value:((a=e.group_by)==null?void 0:a[0])??"",onChange:n=>{r({group_by:n.target.value?[n.target.value]:void 0})},children:[t.jsx("option",{value:"",children:"β€” none β€”"}),s.map(n=>t.jsx("option",{value:n,children:n},n))]})]})]})}function xL({config:e,update:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Lags (comma-separated)"}),t.jsx(ce,{field:"lags",children:t.jsx("input",{"aria-label":"Lags (comma-separated)",type:"text",className:"w-full p-1.5 border rounded text-sm",value:(e.lags??[1]).join(", "),onChange:r=>{const a=r.target.value.split(",").map(n=>Number.parseInt(n.trim(),10)).filter(n=>Number.isFinite(n));s({lags:a})},placeholder:"1, 2, 3"})}),t.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Each value creates a ",t.jsx("code",{children:"col_lag_N"})," column."]})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[t.jsx("input",{type:"checkbox",checked:e.drop_na??!1,onChange:r=>{s({drop_na:r.target.checked})}}),"Drop rows with NaN introduced by shifting"]})]})}function gL({config:e,update:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Window"}),t.jsx("input",{"aria-label":"Window",type:"number",min:"1",className:"w-full p-1.5 border rounded text-sm",value:e.window??3,onChange:r=>{s({window:Number.parseInt(r.target.value,10)})}})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Min Periods"}),t.jsx("input",{"aria-label":"Min Periods",type:"number",min:"1",className:"w-full p-1.5 border rounded text-sm",value:e.min_periods??1,onChange:r=>{s({min_periods:Number.parseInt(r.target.value,10)})}})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Aggregations"}),t.jsx(ce,{field:"aggregations",children:t.jsx(Df,{options:uL,selected:e.aggregations??["mean"],onChange:r=>{s({aggregations:r})}})})]})]})}function fL({config:e,update:s}){return t.jsxs("div",{className:"space-y-2 p-3 bg-muted/20 rounded border",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Calendar Features"}),t.jsx(ce,{field:"features",children:t.jsx(Df,{options:mL,selected:e.features??["year","month","day","dayofweek"],onChange:r=>{s({features:r})}})})]}),t.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[t.jsx("input",{type:"checkbox",checked:e.drop_original??!1,onChange:r=>{s({drop_original:r.target.checked})}}),"Drop the original datetime column"]})]})}function bL({config:e,onChange:s,nodeId:r}){var m;const n=(m=Be(r||"").find(h=>h.datasetId))==null?void 0:m.datasetId,{data:o}=Me(n),i=Je(r),l=o?Object.values(o.columns).filter(h=>!i.has(h.name)).map(h=>h.name):[],c=h=>{s({...e,...h})},[d,u]=Ve();return t.jsxs("div",{ref:d,className:`text-sm gap-4 ${u?"grid grid-cols-2 items-start":"space-y-3"}`,children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Method"}),t.jsxs("select",{"aria-label":"Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method,onChange:h=>{c({method:h.target.value})},children:[t.jsx("option",{value:"lag",children:"Lag Features"}),t.jsx("option",{value:"rolling",children:"Rolling Aggregate"}),t.jsx("option",{value:"date",children:"Date Features"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:pL[e.method]})]}),t.jsx(ce,{field:"columns",children:t.jsx(Pe,{variant:"compact",showFooterCount:!0,columns:l,selected:e.columns??[],onChange:h=>{c({columns:h})},label:e.method==="date"?"Datetime Columns":"Numeric Columns"})})]}),t.jsxs("div",{className:"space-y-3",children:[e.method!=="date"&&t.jsx(hL,{config:e,allColumns:l,update:c}),e.method==="lag"&&t.jsx(xL,{config:e,update:c}),e.method==="rolling"&&t.jsx(gL,{config:e,update:c}),e.method==="date"&&t.jsx(fL,{config:e,update:c}),t.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] text-muted-foreground bg-muted/20 border rounded px-2 py-1.5",children:[t.jsx(Qe,{size:11,className:"shrink-0 mt-0.5"}),t.jsxs("span",{children:["Time-series transforms assume rows are ordered. Use ",t.jsx("strong",{children:"Sort By"})," to enforce temporal order, and ",t.jsx("strong",{children:"Group By"})," to keep entities (e.g. per-store) independent."]})]})]})]})}function yL(e){var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=e.method??"lag";return s===0?r:`${r} Β· ${s} ${s===1?"col":"cols"}`}function vL(e){var s,r,a;switch(e.method){case"lag":return(((s=e.lags)==null?void 0:s.length)??0)===0?{isValid:!1,field:"lags",message:"Provide at least one lag value"}:{isValid:!0};case"rolling":return(((r=e.aggregations)==null?void 0:r.length)??0)===0?{isValid:!1,field:"aggregations",message:"Select at least one aggregation"}:{isValid:!0};case"date":return(((a=e.features)==null?void 0:a.length)??0)===0?{isValid:!1,field:"features",message:"Select at least one calendar feature"}:{isValid:!0};default:return{isValid:!0}}}function jL(e){var s;return(((s=e.columns)==null?void 0:s.length)??0)===0?{isValid:!1,field:"columns",message:"Select at least one column"}:vL(e)}const wL={type:"TimeSeriesNode",label:"Time Series",category:"Preprocessing",description:"Lag, rolling-window, and calendar features for time-series data.",icon:_t,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Featured Data",type:"dataset"}],settings:bL,bodyPreview:yL,validate:jL,getDefaultConfig:()=>({method:"lag",columns:[],lags:[1],drop_na:!1,window:3,aggregations:["mean"],min_periods:1,features:["year","month","day","dayofweek"],drop_original:!1})},NL=e=>e.columns.length===0?{isValid:!1,field:"columns",message:"Select at least one column."}:{isValid:!0};function kL(e){switch(e){case"elliptic_envelope":return"EllipticEnvelope";case"zscore":return"ZScore";case"winsorize":return"Winsorize";default:return"IQR"}}function _L(e,s){const r=[],a=s.rows_removed,o=s.rows_total??s[`${kL(e.method)}_rows_total`];if(a!==void 0&&o!==void 0&&o>0){const i=a/o;i>.2?r.push({rule_id:"high_data_loss",type:"warning",description:"High data loss (>20%).",reasoning:"Consider relaxing parameters (e.g., higher IQR multiplier or Z-Score threshold) or using Winsorization to clip values instead of removing rows.",suggested_node_type:"OutlierRemoval",suggested_params:{},confidence:1,target_columns:[]}):i===0&&e.method!=="winsorize"&&r.push({rule_id:"no_outliers",type:"info",description:"No outliers detected.",reasoning:"If you suspect outliers, try tightening the parameters (e.g., lower IQR multiplier).",suggested_node_type:"OutlierRemoval",suggested_params:{},confidence:1,target_columns:[]})}return r}function op({config:e,metrics:s,hasNodeResult:r,backendRecommendations:a}){const n=[];r&&s&&(n.push(..._L(e,s)),e.method==="elliptic_envelope"&&n.push({rule_id:"elliptic_stochastic",type:"info",description:"Stochastic Method",reasoning:"Elliptic Envelope is stochastic. Results may vary slightly between runs.",suggested_node_type:"OutlierRemoval",suggested_params:{},confidence:1,target_columns:[]}));const o=[...a,...n];return o.length===0?null:t.jsx("div",{className:"mt-4",children:t.jsx(Vr,{recommendations:o})})}function SL(e){switch(e.method){case"iqr":return"Removes statistical outliers (IQR)";case"zscore":return"Removes deviations > 3Οƒ";case"winsorize":return"Clips extreme values";case"elliptic_envelope":return"Detects multivariate anomalies";default:return""}}function CL(e){const{rows_removed:s,bounds:r,stats:a,contamination:n,warnings:o,values_clipped:i}=e;return!(s===void 0&&!r&&!a&&n===void 0&&!o&&i===void 0)}function EL({warnings:e}){return t.jsx(t.Fragment,{children:e&&e.length>0&&t.jsxs("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 rounded border border-yellow-200 dark:border-yellow-800",children:[t.jsx("div",{className:"font-medium mb-1",children:"Warnings"}),t.jsx("ul",{className:"list-disc list-inside space-y-0.5",children:e.map((s,r)=>t.jsx("li",{className:"truncate",title:s,children:s},r))})]})})}function RL({config:e,metrics:s}){const r=s.rows_removed,a=s.rows_remaining,n=s.rows_total??(r??0)+(a??0),o=s.values_clipped;return t.jsx(t.Fragment,{children:e.method==="winsorize"?t.jsxs("div",{className:"flex justify-between items-center p-2 bg-background rounded border",children:[t.jsx("span",{className:"text-muted-foreground",children:"Values Clipped"}),t.jsxs("div",{className:"text-right",children:[t.jsx("span",{className:"font-mono font-medium text-blue-600",children:o??0}),t.jsx("span",{className:"text-[10px] text-muted-foreground block",children:"(Replaced with bounds)"})]})]}):t.jsxs("div",{className:"flex justify-between items-center p-2 bg-background rounded border",children:[t.jsx("span",{className:"text-muted-foreground",children:"Rows Removed"}),t.jsxs("div",{className:"text-right",children:[t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx("span",{className:"font-mono font-medium text-destructive",children:r??0}),n>0&&t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",((r??0)/n*100).toFixed(1),"%)"]})]}),a!==void 0&&t.jsxs("span",{className:"text-[10px] text-muted-foreground block",children:[a," remaining"]})]})]})})}function TL({metrics:e}){const s=e.bounds,r=e.stats;return t.jsxs(t.Fragment,{children:[s&&t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1",children:"Calculated Bounds"}),t.jsx("div",{className:"max-h-32 overflow-y-auto bg-background p-2 rounded border space-y-1",children:Object.entries(s).map(([a,n])=>t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[100px] font-medium",title:a,children:a}),t.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["[",n.lower.toFixed(2),", ",n.upper.toFixed(2),"]"]})]},a))})]}),r&&t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-muted-foreground mb-1",children:"Z-Score Stats"}),t.jsx("div",{className:"max-h-32 overflow-y-auto bg-background p-2 rounded border space-y-1",children:Object.entries(r).map(([a,n])=>t.jsxs("div",{className:"flex justify-between items-center border-b border-border/50 last:border-0 pb-1 last:pb-0",children:[t.jsx("span",{className:"truncate max-w-[100px] font-medium",title:a,children:a}),t.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["ΞΌ=",n.mean.toFixed(2),", Οƒ=",n.std.toFixed(2)]})]},a))})]})]})}function ip({config:e,metrics:s}){if(!s||!CL(s))return null;const r=s.warnings,a=s.contamination;return t.jsxs("div",{className:"mt-4 p-3 bg-muted/50 rounded border text-xs space-y-3",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("div",{className:"font-medium text-muted-foreground",children:"Execution Feedback"}),t.jsx("div",{className:"text-[10px] text-primary/80 bg-primary/5 px-1.5 py-0.5 rounded border border-primary/10",title:"Goal of the selected method",children:SL(e)})]}),t.jsx(EL,{warnings:r}),t.jsx(RL,{config:e,metrics:s}),a!==void 0&&t.jsxs("div",{className:"flex justify-between items-center p-2 bg-background rounded border",children:[t.jsx("span",{className:"text-muted-foreground",children:"Contamination"}),t.jsxs("span",{className:"font-mono font-medium",children:[(a*100).toFixed(1),"%"]})]}),t.jsx(TL,{metrics:s})]})}function ML({config:e,onChange:s}){return t.jsxs("div",{children:[t.jsx("span",{className:"block text-sm font-medium mb-1",children:"Method"}),t.jsxs("select",{"aria-label":"Method",className:"w-full p-2 border rounded bg-background text-sm",value:e.method,onChange:r=>s({...e,method:r.target.value}),children:[t.jsx("option",{value:"iqr",children:"IQR (Interquartile Range)"}),t.jsx("option",{value:"zscore",children:"Z-Score (Standard Deviation)"}),t.jsx("option",{value:"winsorize",children:"Winsorize (Clip Values)"}),t.jsx("option",{value:"elliptic_envelope",children:"Elliptic Envelope (Multivariate)"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[e.method==="iqr"&&"Removes rows with values outside Q1/Q3 Β± multiplier * IQR.",e.method==="zscore"&&"Removes rows with values more than N standard deviations from mean.",e.method==="winsorize"&&"Clips values to specified percentiles instead of removing rows.",e.method==="elliptic_envelope"&&"Fits a robust covariance estimate to detect outliers."]})]})}function PL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Multiplier"}),t.jsx("input",{"aria-label":"Multiplier",type:"number",step:"0.1",className:"w-full p-2 border rounded bg-background text-sm",value:e.multiplier??1.5,onChange:r=>s({...e,multiplier:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Usually 1.5 for outliers, 3.0 for extreme outliers."})]})}function IL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Threshold (Sigma)"}),t.jsx("input",{"aria-label":"Threshold (Sigma)",type:"number",step:"0.1",className:"w-full p-2 border rounded bg-background text-sm",value:e.threshold??3,onChange:r=>s({...e,threshold:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Number of standard deviations to tolerate."})]})}function AL({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Percentiles"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Lower"}),t.jsx("input",{"aria-label":"Lower Percentile",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.lower_percentile??5,onChange:r=>s({...e,lower_percentile:Number.parseFloat(r.target.value)})})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Upper"}),t.jsx("input",{"aria-label":"Upper Percentile",type:"number",className:"w-full p-2 border rounded bg-background text-sm",value:e.upper_percentile??95,onChange:r=>s({...e,upper_percentile:Number.parseFloat(r.target.value)})})]})]})]})}function $L({config:e,onChange:s}){return t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Contamination"}),t.jsx("input",{"aria-label":"Contamination",type:"number",step:"0.01",min:"0",max:"0.5",className:"w-full p-2 border rounded bg-background text-sm",value:e.contamination??.01,onChange:r=>s({...e,contamination:Number.parseFloat(r.target.value)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Expected proportion of outliers in the dataset."})]})}function FL({config:e,onChange:s}){return t.jsxs(t.Fragment,{children:[t.jsx(ML,{config:e,onChange:s}),e.method==="iqr"&&t.jsx(PL,{config:e,onChange:s}),e.method==="zscore"&&t.jsx(IL,{config:e,onChange:s}),e.method==="winsorize"&&t.jsx(AL,{config:e,onChange:s}),e.method==="elliptic_envelope"&&t.jsx($L,{config:e,onChange:s})]})}function DL(e){const s=V(x=>x.nodes),r=V(x=>x.edges),n=(x=>{var b;const f=new Set,g=[x];for(;g.length>0;){const y=g.shift();if(!y||f.has(y))continue;f.add(y);const v=s.find(w=>w.id===y);if(!v)continue;if(y!==x&&((b=v.data)!=null&&b.datasetId))return v.data.datasetId;const j=Kt(v,s,r);for(const w of j)g.push(w.id)}})(e||""),{data:o,isLoading:i}=Me(n),l=Je(e),c=Ja(e||"",{types:["outlier_removal","cleaning"],suggestedNodeTypes:["OutlierRemoval","outlier"],scope:"column"}),d=V(x=>x.executionResult),u=e?d==null?void 0:d.node_results[e]:null,m=Qt(u==null?void 0:u.metrics),h=o?Object.values(o.columns).filter(x=>["int","float","number"].some(f=>x.dtype.toLowerCase().includes(f))).filter(x=>!l.has(x.name)).map(x=>x.name):[];return{datasetId:n,isLoading:i,numericColumns:h,metrics:m,nodeResult:u,backendRecommendations:c}}const LL=({config:e,onChange:s,nodeId:r})=>{const{datasetId:a,isLoading:n,numericColumns:o,metrics:i,nodeResult:l,backendRecommendations:c}=DL(r),[d,u]=Ve();return t.jsxs("div",{ref:d,className:`flex flex-col h-full w-full bg-background ${u?"overflow-hidden":"overflow-y-auto"}`,children:[t.jsx("div",{className:"shrink-0 p-4 pb-0 space-y-2",children:!a&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."})}),t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${u?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsxs("div",{className:`space-y-4 ${u?"overflow-y-auto pr-2":"shrink-0"}`,children:[t.jsx(FL,{config:e,onChange:s}),u&&t.jsxs(t.Fragment,{children:[t.jsx(ip,{config:e,metrics:i}),t.jsx(op,{config:e,metrics:i,hasNodeResult:!!l,backendRecommendations:c})]})]}),t.jsx("div",{className:`flex flex-col overflow-hidden ${u?"min-h-0 flex-1":"shrink-0"}`,children:t.jsx(ce,{field:"columns",className:u?"flex min-h-0 flex-1 flex-col":"",children:t.jsx(Pe,{columns:o,selected:e.columns,onChange:m=>{s({...e,columns:m})},label:"Numeric Columns",variant:"panel",isLoading:n,emptyMessage:"No numeric columns found",fillHeight:u})})}),!u&&t.jsxs(t.Fragment,{children:[t.jsx(ip,{config:e,metrics:i}),t.jsx(op,{config:e,metrics:i,hasNodeResult:!!l,backendRecommendations:c})]})]})]})},OL={type:"outlier",label:"Outlier Removal",category:"Preprocessing",description:"Detect and remove or clip outliers.",icon:Jp,inputs:[{id:"in",type:"dataset",label:"Dataset"}],outputs:[{id:"out",type:"dataset",label:"Cleaned"}],settings:LL,bodyPreview:e=>{var a;const s=((a=e.columns)==null?void 0:a.length)??0,r=(e.method??"iqr").toUpperCase();return s===0?r:`${r} Β· ${s} ${s===1?"col":"cols"}`},validate:NL,getDefaultConfig:()=>({method:"iqr",columns:[],multiplier:1.5,threshold:3,lower_percentile:5,upper_percentile:95,contamination:.01})},jl={power:{label:"Power Transforms",methods:[{value:"yeo-johnson",label:"Yeo-Johnson"},{value:"box-cox",label:"Box-Cox (>0 only)"}]},simple:{label:"Simple Math",methods:[{value:"log",label:"Log (log1p)"},{value:"square_root",label:"Square Root"},{value:"cube_root",label:"Cube Root"},{value:"reciprocal",label:"Reciprocal (1/x)"},{value:"square",label:"Square (xΒ²)"},{value:"exponential",label:"Exponential (eΛ£)"}]}},zL=e=>["yeo-johnson","box-cox"].includes(e)?"power":"simple";function BL({rule:e,idx:s,id:r,updateRule:a}){var n,o;return t.jsxs(t.Fragment,{children:[(e.method==="yeo-johnson"||e.method==="box-cox")&&t.jsxs("div",{className:"flex items-center gap-2 pt-1",onClick:i=>{i.stopPropagation()},children:[t.jsx("input",{"aria-label":`Standardize result for rule ${s+1}`,type:"checkbox",id:`${r}-std-${s}`,checked:((n=e.params)==null?void 0:n.standardize)!==!1,onChange:i=>{a(s,{params:{...e.params,standardize:i.target.checked}})}}),t.jsx("label",{htmlFor:`${r}-std-${s}`,className:"text-xs text-muted-foreground",children:"Standardize result"})]}),e.method==="exponential"&&t.jsxs("div",{className:"flex flex-col gap-1 pt-1",onClick:i=>{i.stopPropagation()},children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Clip Threshold:"}),t.jsx("input",{"aria-label":`Clip Threshold for rule ${s+1}`,type:"number",className:"w-full p-1 border rounded text-xs",value:((o=e.params)==null?void 0:o.clip_threshold)||700,onChange:i=>{a(s,{params:{...e.params,clip_threshold:Number.parseFloat(i.target.value)}})}})]})]})}const VL=({config:e,onChange:s,nodeId:r})=>{var N;const a=p.useMemo(()=>e||{transformations:[]},[e]),n=p.useMemo(()=>Array.isArray(a.transformations)?a.transformations:[],[a.transformations]),[o,i]=p.useState([]);gs(k=>{const _=/^transformations\.(\d+)\.columns$/.exec(k);if(!_)return;const R=Number(_[1]);i(M=>M.includes(R)?M:[...M,R])});const[l,c]=Ve(),d=ae.useId(),m=(N=Be(r||"").find(k=>k.datasetId))==null?void 0:N.datasetId,{data:h}=Me(m),x=Je(r),f=p.useMemo(()=>h!=null&&h.columns?Object.values(h.columns).filter(k=>["int","float","number"].some(_=>k.dtype.toLowerCase().includes(_))).filter(k=>!x.has(k.name)).map(k=>k.name):[],[h,x]),g=()=>{const k=n.length;i(_=>[..._,k]),s({transformations:[...n,{columns:[],method:"log",params:{}}]})},b=(k,_)=>{const R=[...n],M=R[k];M&&(R[k]={...M,..._},s({transformations:R}))},y=k=>{const _=[...n];_.splice(k,1),s({transformations:_}),i(R=>R.filter(M=>M!==k).map(M=>M>k?M-1:M))},v=k=>{i(_=>_.includes(k)?_.filter(R=>R!==k):[..._,k])},j=(k,_)=>{const R=jl[_].methods[0].value;b(k,{method:R})},w=Ja(r||"",{types:["transformation","preprocessing"],suggestedNodeTypes:["TransformationNode"],scope:"column"});return t.jsxs("div",{ref:l,className:"p-4 space-y-6 h-full overflow-y-auto",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:"Transformation Rules"}),t.jsx(ce,{field:"transformations",children:t.jsxs("button",{onClick:g,className:"flex items-center gap-1 text-xs action-primary px-2 py-1 rounded",children:[t.jsx(Es,{size:12})," Add Rule"]})})]}),t.jsxs("div",{className:"space-y-4",children:[n.map((k,_)=>{var T;const R=zL(k.method),M=o.includes(_),E=((T=jl[R].methods.find(S=>S.value===k.method))==null?void 0:T.label)||k.method;return t.jsxs("div",{className:"border rounded bg-card shadow-sm overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-3",children:[t.jsxs("button",{type:"button","aria-label":`${M?"Collapse":"Expand"} ${E} transformation rule ${_+1}`,"aria-expanded":M,onClick:()=>{v(_)},className:"flex flex-1 items-center gap-2 overflow-hidden text-left rounded hover:bg-accent/50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[M?t.jsx(Ce,{size:16,className:"text-muted-foreground flex-shrink-0"}):t.jsx(tt,{size:16,className:"text-muted-foreground flex-shrink-0"}),t.jsxs("span",{className:"flex flex-col overflow-hidden",children:[t.jsx("span",{className:"text-sm font-medium truncate",children:E}),t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:k.columns.length===0?"No columns selected":`${k.columns.length} columns`})]})]}),t.jsx("button",{"aria-label":`Remove transformation rule ${_+1}`,onClick:S=>{S.stopPropagation(),y(_)},className:"text-destructive hover:bg-destructive/10 p-1.5 rounded flex-shrink-0",title:"Remove rule",children:t.jsx(gt,{size:14})})]}),M&&t.jsxs("div",{className:`p-3 border-t bg-accent/5 animate-in slide-in-from-top-2 duration-200 ${c?"grid grid-cols-2 gap-4":"space-y-3"}`,children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Method"}),t.jsxs("select",{"aria-label":`Method type for rule ${_+1}`,className:"w-full p-1.5 border rounded text-xs bg-background font-medium",value:R,onChange:S=>{j(_,S.target.value)},onClick:S=>{S.stopPropagation()},children:[t.jsx("option",{value:"simple",children:"Simple Math"}),t.jsx("option",{value:"power",children:"Power Transform"})]}),t.jsx("select",{"aria-label":`Method for rule ${_+1}`,className:"w-full p-1.5 border rounded text-xs bg-background",value:k.method,onChange:S=>{b(_,{method:S.target.value})},onClick:S=>{S.stopPropagation()},children:jl[R].methods.map(S=>t.jsx("option",{value:S.value,children:S.label},S.value))})]}),t.jsx(BL,{rule:k,idx:_,id:d,updateRule:b})]}),t.jsxs("div",{className:"space-y-1 min-w-0",onClick:S=>{S.stopPropagation()},children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Target Columns"}),t.jsx(ce,{field:`transformations.${_}.columns`,children:t.jsx(Pe,{"aria-label":`Target Columns for rule ${_+1}`,columns:f,selected:k.columns,onChange:S=>{b(_,{columns:S})},variant:"panel",fillHeight:!1})})]})]})]},_)}),n.length===0&&t.jsxs("div",{className:"text-xs text-muted-foreground text-center py-8 border border-dashed rounded bg-muted/20",children:["No transformation rules defined.",t.jsx("br",{}),'Click "Add Rule" to start.']})]}),t.jsx(Vr,{recommendations:w||[],onApply:k=>{var E;const _=k,R=_.suggested_params.method||((E=_.params)==null?void 0:E.method)||"log",M=_.target_columns||[];if(M.length>0){const T=n.length;i(S=>[...S,T]),s({transformations:[...n,{columns:M,method:R,params:{}}]})}}})]})},UL={type:"TransformationNode",label:"Transformation",description:"Apply transformations.",icon:Yp,category:"Preprocessing",inputs:[{id:"in",type:"dataset",label:"Dataset"}],outputs:[{id:"out",type:"dataset",label:"Transformed"}],validate:e=>{if(e.transformations.length===0)return{isValid:!1,field:"transformations",message:"Add at least one transformation rule."};for(const[s,r]of e.transformations.entries())if(r.columns.length===0)return{isValid:!1,field:`transformations.${s}.columns`,message:"Each rule must have at least one column selected."};return{isValid:!0}},settings:VL,bodyPreview:e=>{var r,a;const s=((r=e.transformations)==null?void 0:r.length)??0;if(s===0)return null;if(s===1){const n=e.transformations[0],o=((a=n==null?void 0:n.columns)==null?void 0:a.length)??0;return`${(n==null?void 0:n.method)??"?"} Β· ${o} ${o===1?"col":"cols"}`}return`${s} ops`},getDefaultConfig:()=>({transformations:[]})},HL=({column:e,value:s,onChange:r})=>{const[a,n]=p.useState((s==null?void 0:s.join(", "))||""),o=p.useRef(s);p.useEffect(()=>{JSON.stringify(s)!==JSON.stringify(o.current)&&(n((s==null?void 0:s.join(", "))||""),o.current=s)},[s]);const i=()=>{const l=a.split(",").map(c=>Number.parseFloat(c.trim())).filter(c=>!Number.isNaN(c)).sort((c,d)=>c-d);r(l)};return t.jsx("input",{"aria-label":`Bin edges for ${e}`,type:"text",className:"w-full p-1 text-xs border rounded bg-background text-foreground",placeholder:"0, 10, 20, 100...",value:a,onChange:l=>{n(l.target.value)},onBlur:i})};function WL({config:e,onChange:s,showInvalidBinCount:r}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Binning Strategy"}),t.jsxs("select",{"aria-label":"Binning Strategy",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.strategy,onChange:a=>s({...e,strategy:a.target.value}),children:[t.jsx("option",{value:"equal_width",children:"Equal Width (Uniform)"}),t.jsx("option",{value:"equal_frequency",children:"Equal Frequency (Quantile)"}),t.jsx("option",{value:"kmeans",children:"K-Means Clustering"}),t.jsx("option",{value:"custom",children:"Custom Edges"})]}),t.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[e.strategy==="equal_width"&&"Bins have equal width ranges.",e.strategy==="equal_frequency"&&"Bins have equal number of records.",e.strategy==="kmeans"&&"Bins based on K-Means clustering centers.",e.strategy==="custom"&&"Define specific bin edges for each column."]})]}),(e.strategy!=="custom"||r)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Number of Bins"}),t.jsx(ce,{field:"n_bins",children:t.jsx("input",{"aria-label":"Number of Bins",type:"number",min:2,max:100,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.n_bins,onChange:a=>s({...e,n_bins:Number.parseInt(a.target.value)||5})})})]}),e.strategy==="custom"&&t.jsxs("div",{className:"space-y-2 border rounded p-2 bg-muted/10",children:[t.jsx("span",{className:"block text-xs font-medium",children:"Custom Edges"}),e.columns.length===0?t.jsx("div",{className:"text-xs text-muted-foreground",children:"Select columns first."}):t.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:e.columns.map(a=>{var n;return t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{className:"text-[10px] font-medium",children:a}),t.jsx(HL,{column:a,value:(n=e.custom_bins)==null?void 0:n[a],onChange:o=>s({...e,custom_bins:{...e.custom_bins,[a]:o}})})]},a)})})]})]})}const GL=({config:e,onChange:s,nodeId:r})=>{var f;const a=ae.useId(),o=(f=Be(r||"").find(g=>g.datasetId))==null?void 0:f.datasetId,{data:i,isLoading:l}=Me(o),c=Je(r),[d,u]=p.useState(!1);gs(g=>{g==="n_bins"&&u(!0)});const[m,h]=Ve(),x=i?Object.values(i.columns).filter(g=>["int","float","number"].some(b=>g.dtype.toLowerCase().includes(b))).filter(g=>!c.has(g.name)).map(g=>g.name):[];return t.jsxs("div",{ref:m,className:"p-4 space-y-4 h-full overflow-y-auto",children:[!o&&t.jsx("div",{className:"p-2 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-400 text-xs rounded border border-yellow-200 dark:border-yellow-800",children:"Connect a dataset node to see available columns."}),t.jsxs("div",{className:`grid gap-4 ${h?"grid-cols-2":"grid-cols-1"}`,children:[t.jsxs("div",{className:"space-y-4",children:[t.jsx(WL,{config:e,onChange:s,showInvalidBinCount:d}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Label Format"}),t.jsxs("select",{"aria-label":"Label Format",className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.label_format,onChange:g=>s({...e,label_format:g.target.value}),children:[t.jsx("option",{value:"ordinal",children:"Ordinal (0, 1, 2...)"}),t.jsx("option",{value:"range",children:"Range Intervals ([0-10], [10-20]...)"}),t.jsx("option",{value:"bin_index",children:"Bin Index"})]})]}),e.label_format==="range"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"block text-sm font-medium",children:"Precision (Decimals)"}),t.jsx("input",{"aria-label":"Precision (Decimals)",type:"number",min:0,max:10,className:"w-full p-2 border rounded bg-background focus:ring-1 focus:ring-primary outline-none",value:e.precision??3,onChange:g=>s({...e,precision:Number.parseInt(g.target.value)||0})}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Number of decimal places to show in interval labels (e.g. 2 gives [0.00, 10.00])."})]}),t.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:`${a}-drop-original`,checked:e.drop_original,onChange:g=>s({...e,drop_original:g.target.checked}),className:"rounded border-gray-300 text-primary focus:ring-primary"}),t.jsx("label",{htmlFor:`${a}-drop-original`,className:"text-sm",children:"Drop Original Columns"})]}),!e.drop_original&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output Suffix"}),t.jsx("input",{"aria-label":"Output Suffix",type:"text",className:"w-full p-1.5 border rounded text-xs",placeholder:"_binned",value:e.output_suffix||"",onChange:g=>s({...e,output_suffix:g.target.value})})]})]})]}),t.jsx(ce,{field:"columns",children:t.jsx(Pe,{columns:x,selected:e.columns,onChange:g=>{s({...e,columns:g})},label:"Target Columns",variant:"panel",isLoading:l,emptyMessage:"No numeric columns found.",fillHeight:!1})})]})]})},qL={type:"BinningNode",label:"Binning / Discretization",description:"Convert continuous variables into discrete bins.",icon:Mc,category:"Preprocessing",inputs:[{id:"in",type:"dataset",label:"Dataset"}],outputs:[{id:"out",type:"dataset",label:"Binned"}],validate:e=>e.columns.length===0?{isValid:!1,field:"columns",message:"Select at least one column to bin."}:e.n_bins<2?{isValid:!1,field:"n_bins",message:"Number of bins must be at least 2."}:{isValid:!0},settings:GL,bodyPreview:e=>{var n;const s=((n=e.columns)==null?void 0:n.length)??0,r=e.strategy??"equal_width",a=e.n_bins??5;return s===0?`${r} Β· q=${a}`:`${r} Β· q=${a} Β· ${s} ${s===1?"col":"cols"}`},getDefaultConfig:()=>({columns:[],strategy:"equal_width",n_bins:5,label_format:"ordinal",output_suffix:"_binned",drop_original:!1})};function KL(e,s,r){var u;const a=Be(e||""),n=Array.isArray(a)?a.filter(Boolean):[],o=(u=n.find(m=>typeof m.datasetId=="string"))==null?void 0:u.datasetId,{data:i}=Me(o),l=Je(e),c=n.find(m=>{const h=m.config;if(!h||typeof h!="object")return!1;const x=h.target_column;return typeof x=="string"&&x.trim().length>0}),d=c?c.config.target_column??void 0:void 0;return p.useEffect(()=>{if(!s.target_column){if(c&&d)r({...s,target_column:d});else if(i!=null&&i.columns){const m=Object.values(i.columns).find(h=>h.name.toLowerCase()==="target"||h.name.toLowerCase()==="class"||h.column_type==="target");m&&r({...s,target_column:m.name})}}},[i,c,d,s.target_column,s,r]),{schema:i,droppedUpstream:l,upstreamTarget:c}}function JL({id:e,value:s,columns:r,onChange:a}){const n=p.useRef(null),[o,i]=p.useState(!1),[l,c]=p.useState(-1),d=r.filter(y=>y.toLowerCase().includes(s.toLowerCase())),u=o&&d.length>0,m=`${e}-target-column-suggestions`,h=d[l],x=`${m}-${l}`;p.useEffect(()=>{var y,v;u&&((v=(y=document.getElementById(x))==null?void 0:y.scrollIntoView)==null||v.call(y,{block:"nearest"}))},[x,u]);const f=y=>{a(y),i(!1),c(-1)},g=(y,v)=>{y.preventDefault(),d.length&&(i(!0),c(j=>j<0?v>0?0:d.length-1:(j+v+d.length)%d.length))},b=y=>{switch(y.key){case"ArrowDown":g(y,1);break;case"ArrowUp":g(y,-1);break;case"Enter":u&&h!==void 0&&(y.preventDefault(),f(h));break;case"Escape":u&&(y.preventDefault(),y.stopPropagation(),i(!1));break}};return t.jsxs(Wa,{open:u,onOpenChange:i,children:[t.jsx(ce,{field:"target_column",children:t.jsx(Ci,{asChild:!0,children:t.jsx("input",{ref:n,"aria-label":"Target Column",role:"combobox",type:"text","aria-autocomplete":"list","aria-expanded":u,"aria-controls":u?m:void 0,"aria-activedescendant":u&&h!==void 0?x:void 0,autoComplete:"off",placeholder:"e.g., target",value:s,className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",onFocus:()=>i(!0),onClick:()=>i(!0),onKeyDown:b,onChange:y=>{a(y.target.value),c(-1),i(!0)}})})}),t.jsx(Ga,{children:t.jsx(qa,{id:m,role:"listbox","aria-label":"Target column suggestions",side:"bottom",align:"start",sideOffset:4,collisionPadding:8,onOpenAutoFocus:y=>y.preventDefault(),onCloseAutoFocus:y=>y.preventDefault(),onInteractOutside:y=>{y.detail.originalEvent.target===n.current&&y.preventDefault()},className:"z-50 overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",style:{width:"var(--radix-popover-trigger-width)",maxHeight:"min(192px, var(--radix-popover-content-available-height))"},children:d.map((y,v)=>t.jsx("button",{id:`${m}-${v}`,type:"button",role:"option",tabIndex:-1,"aria-selected":v===l,className:"block w-full truncate rounded px-2 py-1.5 text-left text-sm hover:bg-accent aria-selected:bg-accent",title:y,onMouseDown:j=>j.preventDefault(),onClick:()=>f(y),children:y},y))})})]})}function YL({config:e,handleChange:s,id:r,data:a}){const{schema:n,droppedUpstream:o,upstreamTarget:i}=a;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Resampling Type"}),t.jsxs("select",{"aria-label":"Resampling Type",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.type,onChange:l=>{s("type",l.target.value)},children:[t.jsx("option",{value:"oversampling",children:"Oversampling (Minority)"}),t.jsx("option",{value:"undersampling",children:"Undersampling (Majority)"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Method"}),t.jsx("select",{"aria-label":"Method",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.method,onChange:l=>{s("method",l.target.value)},children:e.type==="oversampling"?t.jsxs(t.Fragment,{children:[t.jsx("option",{value:"random_over",children:"Random Over Sampler"}),t.jsx("option",{value:"smote",children:"SMOTE"}),t.jsx("option",{value:"adasyn",children:"ADASYN"}),t.jsx("option",{value:"borderline_smote",children:"Borderline SMOTE"}),t.jsx("option",{value:"svm_smote",children:"SVM SMOTE"}),t.jsx("option",{value:"kmeans_smote",children:"KMeans SMOTE"}),t.jsx("option",{value:"smote_tomek",children:"SMOTE + Tomek"})]}):t.jsxs(t.Fragment,{children:[t.jsx("option",{value:"random_under_sampling",children:"Random Under Sampling"}),t.jsx("option",{value:"nearmiss",children:"NearMiss"}),t.jsx("option",{value:"tomek_links",children:"Tomek Links"}),t.jsx("option",{value:"edited_nearest_neighbours",children:"Edited Nearest Neighbours"})]})}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.type==="oversampling"?"Balance minority classes with duplicated or synthetic samples.":"Remove samples from the majority class."})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Target Column"}),t.jsx(JL,{id:r,value:e.target_column,columns:Object.values((n==null?void 0:n.columns)??{}).filter(l=>!o.has(l.name)).map(l=>l.name),onChange:l=>s("target_column",l)}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:i?"Auto-detected from upstream node.":"The column containing the class labels."})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Sampling Strategy"}),t.jsxs("select",{"aria-label":"Sampling Strategy",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.sampling_strategy,onChange:l=>{s("sampling_strategy",l.target.value)},children:[t.jsx("option",{value:"auto",children:"Auto (Resample all classes but majority)"}),t.jsx("option",{value:"minority",children:"Minority (Resample only minority class)"}),t.jsx("option",{value:"not minority",children:"Not Minority (Resample all but minority)"}),t.jsx("option",{value:"not majority",children:"Not Majority (Resample all but majority)"}),t.jsx("option",{value:"all",children:"All (Resample all classes)"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Defines which classes to resample."})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Random State"}),t.jsx("input",{"aria-label":"Random State",type:"number",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.random_state,onChange:l=>{s("random_state",st(l.target.value,e.random_state))}})]})]})}function QL(e){return e.config.type==="oversampling"?t.jsx(XL,{...e}):e.config.type==="undersampling"?t.jsx(eO,{...e}):null}function XL({config:e,handleChange:s}){return t.jsxs(t.Fragment,{children:[["smote","adasyn","borderline_smote","svm_smote","kmeans_smote"].includes(e.method)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"k Neighbors"}),t.jsx(ce,{field:"k_neighbors",children:t.jsx("input",{"aria-label":"k Neighbors",type:"number",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.k_neighbors??5,onChange:r=>{s("k_neighbors",st(r.target.value,e.k_neighbors))}})})]}),["borderline_smote","svm_smote"].includes(e.method)&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"m Neighbors"}),t.jsx("input",{"aria-label":"m Neighbors",type:"number",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.m_neighbors??10,onChange:r=>{s("m_neighbors",st(r.target.value,e.m_neighbors))}})]}),t.jsx(ZL,{config:e,handleChange:s})]})}function ZL({config:e,handleChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="borderline_smote"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Kind"}),t.jsxs("select",{"aria-label":"Kind",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.kind??"borderline-1",onChange:r=>{s("kind",r.target.value)},children:[t.jsx("option",{value:"borderline-1",children:"Borderline-1"}),t.jsx("option",{value:"borderline-2",children:"Borderline-2"})]})]}),e.method==="svm_smote"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Out Step"}),t.jsx("input",{"aria-label":"Out Step",type:"number",step:"0.1",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.out_step??.5,onChange:r=>{s("out_step",Number.parseFloat(r.target.value))}})]}),e.method==="kmeans_smote"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Cluster Balance Threshold"}),t.jsx("input",{"aria-label":"Cluster Balance Threshold",type:"number",step:"0.1",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.cluster_balance_threshold??.1,onChange:r=>{s("cluster_balance_threshold",Number.parseFloat(r.target.value))}})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Density Exponent"}),t.jsx("input",{"aria-label":"Density Exponent",type:"text",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.density_exponent??"auto",onChange:r=>{s("density_exponent",r.target.value)}})]})]})]})}function eO({config:e,handleChange:s}){return t.jsxs(t.Fragment,{children:[e.method==="random_under_sampling"&&t.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-md bg-gray-50 dark:bg-gray-800 dark:border-gray-700",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 block",children:"Replacement"}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sample with replacement"})]}),t.jsx("input",{"aria-label":"Replacement",type:"checkbox",className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500",checked:e.replacement??!1,onChange:r=>{s("replacement",r.target.checked)}})]}),e.method==="nearmiss"&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Version"}),t.jsxs("select",{"aria-label":"Version",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.version??1,onChange:r=>{s("version",st(r.target.value,e.version))},children:[t.jsx("option",{value:"1",children:"1"}),t.jsx("option",{value:"2",children:"2"}),t.jsx("option",{value:"3",children:"3"})]})]}),e.method==="edited_nearest_neighbours"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"n Neighbors"}),t.jsx("input",{"aria-label":"n Neighbors",type:"number",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.n_neighbors??3,onChange:r=>{s("n_neighbors",st(r.target.value,e.n_neighbors))}})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Selection Kind"}),t.jsxs("select",{"aria-label":"Selection Kind",className:"w-full rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 p-2 text-sm text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",value:e.kind_sel??"all",onChange:r=>{s("kind_sel",r.target.value)},children:[t.jsx("option",{value:"all",children:"All"}),t.jsx("option",{value:"mode",children:"Mode"})]})]})]})]})}function tO({recommendations:e,showRecommendations:s,setShowRecommendations:r,handleApplyRecommendation:a}){return t.jsx(t.Fragment,{children:e.length>0&&t.jsxs("div",{className:"mt-0 border rounded-md overflow-hidden border-gray-200 dark:border-gray-700",children:[t.jsxs("button",{className:"w-full flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",onClick:()=>{r(!s)},children:[t.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["Recommendations (",e.length,")"]}),s?t.jsx(Ia,{size:16}):t.jsx(Ce,{size:16})]}),s&&t.jsx("div",{className:"p-3 bg-white dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700",children:t.jsx(Vr,{recommendations:e,onApply:a})})]})})}const sO=({nodeId:e})=>{var n;const s=V(o=>o.executionResult),r=e?(n=s==null?void 0:s.node_results)==null?void 0:n[e]:void 0;if(!r)return null;const a=o=>t.jsx("div",{className:"space-y-1",children:Object.entries(o).map(([i,l])=>typeof l=="object"&&l!==null?t.jsxs("div",{className:"mt-1",children:[t.jsxs("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:[i.replace(/_/g," "),":"]}),t.jsx("div",{className:"pl-2 border-l-2 border-gray-200 dark:border-gray-700 ml-1",children:a(l)})]},i):t.jsxs("div",{className:"flex justify-between text-[10px]",children:[t.jsxs("span",{className:"text-gray-600 dark:text-gray-400 capitalize",children:[i.replace(/_/g," "),":"]}),t.jsx("span",{className:"font-mono text-gray-900 dark:text-gray-100",children:String(l)})]},i))});return t.jsxs("div",{className:"mt-6 p-4 border rounded-md bg-gray-50 dark:bg-gray-800 dark:border-gray-700",children:[t.jsx("h4",{className:"text-sm font-medium mb-2 text-gray-900 dark:text-gray-100",children:"Last Run Results"}),t.jsxs("div",{className:"text-xs space-y-1 text-gray-600 dark:text-gray-300",children:[r.metrics&&t.jsx("div",{className:"mt-2",children:a(r.metrics)}),r.error&&t.jsxs("div",{className:"mt-2 text-red-500 break-words",children:["Error: ",r.error]}),!r.metrics&&!r.error&&t.jsx("div",{className:"italic text-gray-500",children:"No metrics available"})]})]})},rO=({config:e,onChange:s,nodeId:r})=>{const a=ae.useId(),[n,o]=Ve(400),[i,l]=p.useState(!0),c=KL(r,e,s),d=Ja(r||"",{types:["resampling"],suggestedNodeTypes:["ResamplingNode"]}),u=h=>{h.suggested_params&&s({...e,...h.suggested_params})},m=(h,x)=>{const f={...e,[h]:x};h==="type"&&(x==="oversampling"?f.method="smote":f.method="random_under_sampling"),s(f)};return t.jsx("div",{ref:n,className:`flex flex-col h-full w-full bg-white dark:bg-gray-900 ${o?"overflow-hidden":"overflow-y-auto"}`,children:t.jsxs("div",{className:`flex-1 min-h-0 p-4 gap-4 ${o?"grid grid-cols-2":"flex flex-col"}`,children:[t.jsx("div",{className:`space-y-4 ${o?"overflow-y-auto pr-2":"shrink-0"}`,children:t.jsx(YL,{config:e,handleChange:m,id:a,data:c})}),t.jsxs("div",{className:`space-y-4 ${o?"overflow-y-auto pl-2 border-l border-gray-100 dark:border-gray-700":"shrink-0 pt-4 border-t border-gray-100 dark:border-gray-700"}`,children:[t.jsx(QL,{config:e,handleChange:m}),t.jsx(tO,{recommendations:d,showRecommendations:i,setShowRecommendations:l,handleApplyRecommendation:u}),r&&t.jsx(sO,{nodeId:r})]})]})})},aO=e=>e.target_column?e.type==="oversampling"&&["smote","adasyn","borderline_smote","svm_smote","kmeans_smote"].includes(e.method)&&(e.k_neighbors??5)<1?{isValid:!1,field:"k_neighbors",message:"k_neighbors must be at least 1."}:{isValid:!0}:{isValid:!1,field:"target_column",message:"Target column is required for resampling."},nO={type:"ResamplingNode",label:"Resampling",category:"Preprocessing",description:"Balance dataset classes using oversampling or undersampling techniques.",icon:at,inputs:[{id:"in",label:"Data",type:"dataset"}],outputs:[{id:"out",label:"Balanced Data",type:"dataset"}],settings:rO,bodyPreview:e=>{const s=(e.method??"smote").toUpperCase(),r=e.target_column;return r?`${s} β†’ ${r}`:s},validate:aO,getDefaultConfig:()=>({type:"oversampling",method:"smote",target_column:"",sampling_strategy:"auto",random_state:42,k_neighbors:5,replacement:!1,version:1,n_neighbors:3,kind_sel:"all"})};function oO(e){var d;const r=(d=Be(e||"").find(u=>u.datasetId))==null?void 0:d.datasetId,{data:a}=Me(r),n=Je(e),o=a?Object.values(a.columns).map(u=>u.name).filter(u=>!n.has(u)):[],i=a?Object.values(a.columns).filter(u=>["int","float","number"].some(m=>u.dtype.toLowerCase().includes(m))).filter(u=>!n.has(u.name)).map(u=>u.name):[],l=a?Object.values(a.columns).filter(u=>["date","time"].some(m=>u.dtype.toLowerCase().includes(m))).filter(u=>!n.has(u.name)).map(u=>u.name):[],c=a?Object.values(a.columns).filter(u=>["string","object","text"].some(m=>u.dtype.toLowerCase().includes(m))).filter(u=>!n.has(u.name)).map(u=>u.name):[];return{allColumns:o,numericColumns:i,dateColumns:l,stringColumns:c}}function iO(e,s){const[r,a]=p.useState([]);return gs(c=>{const d=/^operations\.(\d+)\./.exec(c);if(!d)return;const u=Number(d[1]);a(m=>m.includes(u)?m:[...m,u])}),{revealedOperations:r,addOperation:c=>{const d={operation_type:c,method:c==="arithmetic"?"add":c==="similarity"?"ratio":c==="group_agg"?"mean":"year",input_columns:[],output_column:"",datetime_features:c==="datetime_extract"?["year"]:void 0,isExpanded:!0};s({operations:[...e.operations||[],d]})},updateOperation:(c,d)=>{const u=[...e.operations||[]],m=u[c];m&&(u[c]={...m,...d},s({operations:u}))},removeOperation:(c,d)=>{d.stopPropagation();const u=[...e.operations||[]];u.splice(c,1),a(m=>m.filter(h=>h!==c).map(h=>h>c?h-1:h)),s({operations:u})},toggleExpand:c=>{const d=[...e.operations||[]],u=d[c];u&&(d[c]={...u,isExpanded:!(u.isExpanded||r.includes(c))},a(m=>m.filter(h=>h!==c)),s({operations:d}))}}}const lp=[{value:"arithmetic",label:"Arithmetic",icon:Pc},{value:"datetime_extract",label:"Date Extraction",icon:_l},{value:"ratio",label:"Ratio",icon:vb},{value:"similarity",label:"Similarity",icon:Tc},{value:"group_agg",label:"Group Agg",icon:Yp}],lO=["add","subtract","multiply","divide"],cO=["year","quarter","month","month_name","week","day","day_name","weekday","is_weekend","hour","minute","second","season","time_of_day"],dO={year:{type:"int",desc:"Calendar year (e.g. 2024)"},quarter:{type:"int",desc:"Quarter of year β€” 1 to 4"},month:{type:"int",desc:"Month number β€” 1 (Jan) to 12 (Dec)"},month_name:{type:"string",desc:'Full month name β€” "January" … "December"'},week:{type:"int",desc:"ISO week number β€” 1 to 53"},day:{type:"int",desc:"Day of month β€” 1 to 31"},day_name:{type:"string",desc:'Day of week name β€” "Monday" … "Sunday"'},weekday:{type:"int",desc:"Day of week β€” 0 (Mon) to 6 (Sun)"},is_weekend:{type:"int",desc:"Weekend flag β€” 1 if Sat/Sun, else 0"},hour:{type:"int",desc:"Hour of day β€” 0 to 23"},minute:{type:"int",desc:"Minute of hour β€” 0 to 59"},second:{type:"int",desc:"Second of minute β€” 0 to 59"},season:{type:"string",desc:'Meteorological season β€” "Winter", "Spring", "Summer", "Autumn"'},time_of_day:{type:"string",desc:'Hour bucket β€” "Morning" (5-11), "Afternoon" (12-16), "Evening" (17-20), "Night" (21-4)'}},uO=["ratio","token_sort_ratio","token_set_ratio"],mO=["mean","sum","count","min","max","std","median"];function pO({isWide:e,addOperation:s}){return t.jsx(t.Fragment,{children:e?t.jsxs(ce,{field:"operations",className:"w-20 border-r bg-muted/10 flex flex-col items-center py-4 gap-2 overflow-y-auto shrink-0",children:[t.jsx("span",{className:"text-[10px] font-bold text-muted-foreground mb-2 uppercase tracking-wider",children:"Add"}),lp.map(r=>t.jsxs("button",{onClick:()=>{s(r.value)},className:"flex flex-col items-center justify-center gap-1 p-1.5 rounded-md border bg-card hover:bg-accent hover:border-primary/50 transition-all group w-16 h-14 shadow-sm",title:r.label,children:[t.jsx(r.icon,{size:18,className:"text-muted-foreground group-hover:text-primary"}),t.jsx("span",{className:"text-[9px] font-medium text-muted-foreground group-hover:text-foreground text-center leading-tight line-clamp-2",children:r.label.replace(" ",` `)})]},r.value))]}):t.jsxs(ce,{field:"operations",className:"flex items-center gap-1.5 border-b bg-muted/10 px-2 py-2 overflow-x-auto shrink-0",children:[t.jsx("span",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider shrink-0 mr-1",children:"Add:"}),lp.map(r=>t.jsxs("button",{onClick:()=>{s(r.value)},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border bg-card hover:bg-accent hover:border-primary/50 transition-all group shrink-0 shadow-sm",title:r.label,children:[t.jsx(r.icon,{size:13,className:"text-muted-foreground group-hover:text-primary"}),t.jsx("span",{className:"text-[10px] font-medium text-muted-foreground group-hover:text-foreground whitespace-nowrap",children:r.label})]},r.value))]})})}function hO({op:e,idx:s,updateOperation:r,numericColumns:a}){var n;return t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("div",{className:"text-[10px] text-muted-foreground bg-muted/20 p-1.5 rounded border border-muted/20",children:e.method==="divide"?"Performs row-by-row division (Col A / Col B) for each record.":"Performs row-by-row arithmetic between two columns."}),t.jsx(ce,{field:`operations.${s}.input_columns`,children:t.jsx(Pe,{variant:"compact",label:"Column A (Left Operand)","aria-label":`Column A (Left Operand) for operation ${s+1}`,columns:a,selected:e.input_columns.slice(0,1),onChange:o=>{r(s,{input_columns:o})},single:!0})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-px bg-border flex-1"}),t.jsx("span",{className:"text-lg font-bold text-muted-foreground bg-muted/20 w-8 h-8 rounded flex items-center justify-center",children:e.method==="add"?"+":e.method==="subtract"?"-":e.method==="multiply"?"Γ—":"Γ·"}),t.jsx("div",{className:"h-px bg-border flex-1"})]}),t.jsx(ce,{field:`operations.${s}.secondary_columns`,children:t.jsx(Pe,{variant:"compact",label:"Column B (Right Operand)","aria-label":`Column B (Right Operand) for operation ${s+1}`,columns:a,selected:((n=e.secondary_columns)==null?void 0:n.slice(0,1))||[],onChange:o=>{r(s,{secondary_columns:o})},single:!0})})]})}function xO({op:e,idx:s,updateOperation:r,numericColumns:a}){return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"text-[10px] text-muted-foreground bg-muted/20 p-1.5 rounded border border-muted/20",children:["Calculates aggregate ratio: ",t.jsx("strong",{children:"Sum(Numerator) / Sum(Denominator)"}),"."]}),t.jsx(ce,{field:`operations.${s}.input_columns`,children:t.jsx(Pe,{variant:"compact",label:"Numerator (Sum)","aria-label":`Numerator (Sum) for operation ${s+1}`,columns:a,selected:e.input_columns,onChange:n=>{r(s,{input_columns:n})}})}),t.jsxs("div",{className:"relative flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 flex items-center",children:t.jsx("div",{className:"w-full border-t border-dashed"})}),t.jsx("span",{className:"relative bg-card px-2 text-xs text-muted-foreground font-medium",children:"Divided By"})]}),t.jsx(ce,{field:`operations.${s}.secondary_columns`,children:t.jsx(Pe,{variant:"compact",label:"Denominator (Sum)","aria-label":`Denominator (Sum) for operation ${s+1}`,columns:a,selected:e.secondary_columns||[],onChange:n=>{r(s,{secondary_columns:n})}})})]})}function gO({op:e,idx:s,updateOperation:r,stringColumns:a}){var n;return t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"text-[10px] text-muted-foreground bg-muted/20 p-1.5 rounded border border-muted/20 space-y-1",children:[t.jsx("p",{children:"Calculates string similarity score (0-100) between two text columns."}),t.jsxs("ul",{className:"list-disc pl-3 space-y-0.5 opacity-80",children:[t.jsxs("li",{children:[t.jsx("strong",{children:"Ratio:"}),' Strict character matching (Levenshtein). "apple banana" != "banana apple".']}),t.jsxs("li",{children:[t.jsx("strong",{children:"Token Sort:"}),' Sorts words alphabetically then compares. "apple banana" == "banana apple".']}),t.jsxs("li",{children:[t.jsx("strong",{children:"Token Set:"})," Compares intersection of words. Handles duplicates/subsets well."]})]})]}),t.jsx(ce,{field:`operations.${s}.input_columns`,children:t.jsx(Pe,{variant:"compact",label:"String A","aria-label":`String A for operation ${s+1}`,columns:a,selected:e.input_columns.slice(0,1),onChange:o=>r(s,{input_columns:o}),single:!0})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-px bg-border flex-1"}),t.jsx("span",{className:"text-xs font-bold text-muted-foreground bg-muted/20 px-2 py-1 rounded",children:"vs"}),t.jsx("div",{className:"h-px bg-border flex-1"})]}),t.jsx(ce,{field:`operations.${s}.secondary_columns`,children:t.jsx(Pe,{variant:"compact",label:"String B","aria-label":`String B for operation ${s+1}`,columns:a,selected:((n=e.secondary_columns)==null?void 0:n.slice(0,1))||[],onChange:o=>r(s,{secondary_columns:o}),single:!0})})]})}function fO({op:e,idx:s,updateOperation:r,stringColumns:a,allColumns:n,numericColumns:o}){var i;return t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"text-[10px] text-muted-foreground bg-muted/20 p-1.5 rounded border border-muted/20",children:"Calculates aggregate statistics (e.g., Mean Salary) grouped by a categorical column (e.g., Department) and assigns it back to each row."}),t.jsx(ce,{field:`operations.${s}.input_columns`,children:t.jsx(Pe,{variant:"compact",label:"Group By (Categorical)","aria-label":`Group By (Categorical) for operation ${s+1}`,columns:a.length>0?a:n,selected:e.input_columns.slice(0,1),onChange:l=>r(s,{input_columns:l}),single:!0})}),t.jsxs("div",{className:"relative flex items-center justify-center",children:[t.jsx("div",{className:"absolute inset-0 flex items-center",children:t.jsx("div",{className:"w-full border-t border-dashed"})}),t.jsx("span",{className:"relative bg-card px-2 text-xs text-muted-foreground font-medium",children:"Target Column"})]}),t.jsx(ce,{field:`operations.${s}.secondary_columns`,children:t.jsx(Pe,{variant:"compact",label:"Target (Numeric)","aria-label":`Target (Numeric) for operation ${s+1}`,columns:o,selected:((i=e.secondary_columns)==null?void 0:i.slice(0,1))||[],onChange:l=>r(s,{secondary_columns:l}),single:!0})})]})}function bO({op:e,idx:s,updateOperation:r,dateColumns:a,allColumns:n}){return t.jsxs("div",{className:"space-y-3",children:[t.jsx(ce,{field:`operations.${s}.input_columns`,children:t.jsx(Pe,{variant:"compact",label:"Date Column","aria-label":`Date Column for operation ${s+1}`,columns:a.length>0?a:n,selected:e.input_columns.slice(0,1),onChange:o=>r(s,{input_columns:o}),single:!0})}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Features to Extract"}),t.jsx("div",{className:"grid grid-cols-2 gap-2",children:cO.map(o=>{const i=dO[o],l=i?`${i.desc} diff --git a/static/ml_canvas/assets/infoDiagram-27XIBGKW-BKR9ZU8X.js b/static/ml_canvas/assets/infoDiagram-27XIBGKW-BYbjxULf.js similarity index 72% rename from static/ml_canvas/assets/infoDiagram-27XIBGKW-BKR9ZU8X.js rename to static/ml_canvas/assets/infoDiagram-27XIBGKW-BYbjxULf.js index 0c23434bb..b524e7643 100644 --- a/static/ml_canvas/assets/infoDiagram-27XIBGKW-BKR9ZU8X.js +++ b/static/ml_canvas/assets/infoDiagram-27XIBGKW-BYbjxULf.js @@ -1,2 +1,2 @@ -import{_ as e,l as o,C as n,d as i}from"./mermaid.core-DBa20IFF.js";import{p}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var g={parse:e(async r=>{const a=await p("info",r);o.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,s)=>{o.debug(`rendering info diagram +import{_ as e,l as o,C as n,d as i}from"./mermaid.core-Bh6LVe7i.js";import{p}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var g={parse:e(async r=>{const a=await p("info",r);o.debug(a)},"parse")},d={version:"11.17.2"},v=e(()=>d.version,"getVersion"),m={getVersion:v},c=e((r,a,s)=>{o.debug(`rendering info diagram `+r);const t=n(a);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${s}`)},"draw"),l={draw:c},S={parser:g,db:m,renderer:l};export{S as diagram}; diff --git a/static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-CiUVSvQn.js b/static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-C6U6iZ6u.js similarity index 99% rename from static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-CiUVSvQn.js rename to static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-C6U6iZ6u.js index 9970c21e5..2d2fab5c8 100644 --- a/static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-CiUVSvQn.js +++ b/static/ml_canvas/assets/ishikawaDiagram-5VMMS53U-C6U6iZ6u.js @@ -1,4 +1,4 @@ -import{_ as o,c as ot,D as ut,C as dt,a7 as yt,o as ft,j as pt,m as it,a as gt,b as kt,g as mt,s as wt,n as _t,d as bt}from"./mermaid.core-DBa20IFF.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var j in this.yy)Object.prototype.hasOwnProperty.call(this.yy,j)&&(C.yy[j]=this.yy[j]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(F,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: +import{_ as o,c as ot,D as ut,C as dt,a7 as yt,o as ft,j as pt,m as it,a as gt,b as kt,g as mt,s as wt,n as _t,d as bt}from"./mermaid.core-Bh6LVe7i.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var j in this.yy)Object.prototype.hasOwnProperty.call(this.yy,j)&&(C.yy[j]=this.yy[j]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(F,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,q,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`: `+b.showPosition()+` Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),q=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof q<"u")return q;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/journeyDiagram-3NMN7TZE-5Eg3OQkk.js b/static/ml_canvas/assets/journeyDiagram-3NMN7TZE-DLdfxAvt.js similarity index 98% rename from static/ml_canvas/assets/journeyDiagram-3NMN7TZE-5Eg3OQkk.js rename to static/ml_canvas/assets/journeyDiagram-3NMN7TZE-DLdfxAvt.js index 4c495030f..38136fb2a 100644 --- a/static/ml_canvas/assets/journeyDiagram-3NMN7TZE-5Eg3OQkk.js +++ b/static/ml_canvas/assets/journeyDiagram-3NMN7TZE-DLdfxAvt.js @@ -1,4 +1,4 @@ -import{g as gt}from"./chunk-5VM5RSS4-vgh9rKCo.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{g as _t,s as vt,a as bt,b as wt,n as Tt,m as St,_ as s,c as R,d as $t,o as Mt}from"./mermaid.core-DBa20IFF.js";import{s as X}from"./vendor-flow-Ct2sLZk5.js";import{k as it}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +import{g as gt}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{a as mt,b as lt,h as xt,d as kt}from"./chunk-F27PBJKO-CzX57j4f.js";import{g as _t,s as vt,a as bt,b as wt,n as Tt,m as St,_ as s,c as R,d as $t,o as Mt}from"./mermaid.core-Bh6LVe7i.js";import{s as X}from"./vendor-flow-Ct2sLZk5.js";import{k as it}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: `+_.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/kanban-definition-UXKFOSKX-DdgiJMlk.js b/static/ml_canvas/assets/kanban-definition-UXKFOSKX-BOJnqoJE.js similarity index 99% rename from static/ml_canvas/assets/kanban-definition-UXKFOSKX-DdgiJMlk.js rename to static/ml_canvas/assets/kanban-definition-UXKFOSKX-BOJnqoJE.js index f1c145273..cf86f1ab0 100644 --- a/static/ml_canvas/assets/kanban-definition-UXKFOSKX-DdgiJMlk.js +++ b/static/ml_canvas/assets/kanban-definition-UXKFOSKX-BOJnqoJE.js @@ -1,4 +1,4 @@ -import{_ as c,l as te,c as W,C as fe,a1 as ye,a2 as be,a3 as me,W as _e,A as Y,i as G,I as ke,J as Ee,T as Se,U as le,V as ce}from"./mermaid.core-DBa20IFF.js";import{g as Ne}from"./chunk-5VM5RSS4-vgh9rKCo.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: +import{_ as c,l as te,c as W,C as fe,a1 as ye,a2 as be,a3 as me,W as _e,A as Y,i as G,I as ke,J as Ee,T as Se,U as le,V as ce}from"./mermaid.core-Bh6LVe7i.js";import{g as Ne}from"./chunk-5VM5RSS4-C6GC8vvo.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],U=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:U}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:U}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`: `+m.showPosition()+` Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/layout-D4UUaX_9.js b/static/ml_canvas/assets/layout-s0gQ8r44.js similarity index 99% rename from static/ml_canvas/assets/layout-D4UUaX_9.js rename to static/ml_canvas/assets/layout-s0gQ8r44.js index f4bfd4b96..79b1d13eb 100644 --- a/static/ml_canvas/assets/layout-D4UUaX_9.js +++ b/static/ml_canvas/assets/layout-s0gQ8r44.js @@ -1 +1 @@ -import{av as B,aw as y,ax as ye,ay as V,az as U,aA as Ue,aB as oe,aC as We,aD as In,aE as qe,aF as _n,aG as kn,aH as jn,aI as ue,aJ as An,aK as Mn,aL as xe,aM as Oe,aN as fe,aO as de,aP as G,aQ as Xe,aR as He,aS as Rn,aT as T,aU as Sn,aV as $n,aW as Fn,aX as Ee,aY as Bn,aZ as Ke,a_ as N,a$ as Gn,b0 as Dn,b1 as Yn,b2 as S,b3 as ze,b4 as Je,b5 as Vn,b6 as se,b7 as Qe,b8 as Un,b9 as Ze,ba as Wn,bb as qn,Q as x,bc as c,bd as Xn,be as m,bf as M,bg as P,bh as W}from"./mermaid.core-DBa20IFF.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Qn=/^[-+]0x[0-9a-f]+$/i,Zn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Zn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Qn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ar(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ir=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(a--,o):void 0,i&&k(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),n=Object(n);++t2?n[2]:void 0;for(a&&k(n[0],n[1],a)&&(t=1);++r-1?a[o?n[i]:i]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:ar(r);return a<0&&(a=Mt(t+a,0)),Dn(e,N(n),a)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(a,o,i){t[++r]=n(a,o,i)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&i&&f&&!u&&!d||t&&i&&f||!r&&f||!a)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(i){return Ze(i,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var a=ln(e,function(o,i,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(a,function(o,i){return qt(o,i,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var a=-1,o=zt(Kt((n-e)/(r||1)),0),i=Array(o);o--;)i[++a]=e,e+=r;return i}function Qt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Zt=0;function pe(e){var n=++Zt;return qn(e)+n}function ea(e,n,r){for(var t=-1,a=e.length,o=n.length,i={};++t0;--u)if(i=n[u].dequeue(),i){t=t.concat(J(e,n,r,i,!0));break}}}return t}function J(e,n,r,t,a){var o=a?[]:void 0;return c(e.inEdges(t.v),function(i){var u=e.edge(i),f=e.node(i.v);a&&o.push({v:i.v,w:i.w}),f.out-=u,ie(n,r,f)}),c(e.outEdges(t.v),function(i){var u=e.edge(i),f=i.w,d=e.node(f);d.in-=u,ie(n,r,d)}),e.removeNode(t.v),o}function ua(e,n){var r=new x,t=0,a=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),a=Math.max(a,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(a+t+3).map(function(){return new ra}),i=t+1;return c(r.nodes(),function(u){ie(o,i,r.node(u))}),{graph:r,buckets:o,zeroIdx:i}}function ie(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fa(e){var n=e.graph().acyclicer==="greedy"?ia(e,r(e)):da(e);c(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,pe("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function da(e){var n=[],r={},t={};function a(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(i){Object.prototype.hasOwnProperty.call(r,i.w)?n.push(i):a(i.w)}),delete r[o])}return c(e.nodes(),a),n}function sa(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var a;do a=pe(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function ca(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,a=n.x-r,o=n.y-t,i=e.width/2,u=e.height/2;if(!a&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*i>Math.abs(a)*u?(o<0&&(u=-u),f=u*a/o,d=u):(a<0&&(i=-i),f=i,d=i*o/a),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),a=t.rank;m(a)||(n[a][t.order]=r)}),n}function la(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function ha(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var i=e.node(o).rank-n;r[i]||(r[i]=[]),r[i].push(o)});var t=0,a=e.graph().nodeRankFactor;c(r,function(o,i){m(o)&&i%a!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),I(e,"border",a,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function va(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pa(e,n){return n()}function ba(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,i=a.maxRank+1;oi.lim&&(u=i,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var a=r.v,o=r.w;e.removeEdge(a,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ka(e,n)}function ka(e,n){var r=le(e.nodes(),function(a){return!n.node(a).parent}),t=Ia(e,r);t=t.slice(1),c(t,function(a){var o=e.node(a).parent,i=n.edge(a,o),u=!1;i||(i=n.edge(o,a),u=!0),n.node(a).rank=n.node(o).rank+(u?i.minlen:-i.minlen)})}function ja(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Aa(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ra(e);break;case"longest-path":Ma(e);break;default:Ge(e)}}var Ma=be;function Ra(e){be(e),gn(e)}function Ge(e){E(e)}function Sa(e){var n=I(e,"root",{},"_root"),r=$a(e),t=O(P(r))-1,a=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(i){e.edge(i).minlen*=a});var o=Fa(e)+1;c(e.children(),function(i){Ln(e,n,a,o,t,r,i)}),e.graph().nodeRankFactor=a}function Ln(e,n,r,t,a,o,i){var u=e.children(i);if(!u.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(i);e.setParent(f,i),s.borderTop=f,e.setParent(d,i),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,a,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:a-o[i]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,f,{weight:0,minlen:a+o[i]})}function $a(e){var n={};function r(t,a){var o=e.children(t);o&&o.length&&c(o,function(i){r(i,a+1)}),n[t]=a}return c(e.children(),function(t){r(t,1)}),n}function Fa(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Ba(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Ga(e,n,r){var t={},a;c(r,function(o){for(var i=e.parent(o),u,f;i;){if(u=e.parent(i),u?(f=t[u],t[u]=i):(f=a,a=i),f&&f!==i){n.setEdge(f,i);return}i=u}})}function Da(e,n,r){var t=Ya(e),a=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var i=e.node(o),u=e.parent(o);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(a.setNode(o),a.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=a.edge(d,o),l=m(s)?0:s.weight;a.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&a.setNode(o,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),a}function Ya(e){for(var n;e.hasNode(n=pe("_root")););return n}function Va(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wa(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),a=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);a[f.rank].push(u),c(e.successors(u),o)}}var i=R(r,function(u){return e.node(u).rank});return c(i,o),a}function qa(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var a=W(t,function(o,i){var u=e.edge(i),f=e.node(i.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function Xa(e,n){var r={};c(e,function(a,o){var i=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:o};m(a.barycenter)||(i.barycenter=a.barycenter,i.weight=a.weight)}),c(n.edges(),function(a){var o=r[a.v],i=r[a.w];!m(o)&&!m(i)&&(i.indegree++,o.out.push(r[a.w]))});var t=M(r,function(a){return!a.indegree});return Ha(t)}function Ha(e){var n=[];function r(o){return function(i){i.merged||(m(i.barycenter)||m(o.barycenter)||i.barycenter>=o.barycenter)&&Ka(o,i)}}function t(o){return function(i){i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){var a=e.pop();n.push(a),c(a.in.reverse(),r(a)),c(a.out,t(a))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ka(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function za(e,n){var r=va(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,a=R(r.rhs,function(s){return-s.i}),o=[],i=0,u=0,f=0;t.sort(Ja(!!n)),f=De(o,a,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),i+=s.barycenter*s.weight,u+=s.weight,f=De(o,a,f)});var d={vs:C(o)};return u&&(d.barycenter=i/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ja(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var a=e.children(n),o=e.node(n),i=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};i&&(a=M(a,function(v){return v!==i&&v!==u}));var d=qa(e,a);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Za(v,w)}});var s=Xa(d,r);Qa(s,f);var l=za(s,t);if(i&&(l.vs=C([i,l.vs,u]),e.predecessors(i).length)){var h=e.node(e.predecessors(i)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Qa(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Za(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ei(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),a=Wa(e);Ve(e,a);for(var o=Number.POSITIVE_INFINITY,i,u=0,f=0;f<4;++u,++f){ni(u%2?r:t,u%4>=2),a=z(e);var d=Va(e,a);di||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:a.concat(o.reverse()),lca:d}}function ai(e){var n={},r=0;function t(a){var o=r;c(e.children(a),t),n[a]={low:o,lim:r++}}return c(e.children(),t),n}function ii(e,n){var r={};function t(a,o){var i=0,u=0,f=a.length,d=D(o);return c(o,function(s,l){var h=ui(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function a(o,i){var u=-1,f,d=0;return c(i,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(i,d,l,u,f),d=l,u=f)}t(i,d,i.length,f,o.length)}),i}return W(n,a),r}function ui(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fi(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function di(e,n,r,t){var a={},o={},i={};return c(n,function(u){c(u,function(f,d){a[f]=f,o[f]=f,i[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return i[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_i(e));r(" runLayout",()=>yi(t,r)),r(" updateInputGraph",()=>xi(e,t))})}function yi(e,n){n(" makeSpaceForEdgeLabels",()=>ki(e)),n(" removeSelfEdges",()=>Gi(e)),n(" acyclic",()=>fa(e)),n(" nestingGraph.run",()=>Sa(e)),n(" rank",()=>Aa(pn(e))),n(" injectEdgeLabelProxies",()=>ji(e)),n(" removeEmptyRanks",()=>ha(e)),n(" nestingGraph.cleanup",()=>Ba(e)),n(" normalizeRanks",()=>la(e)),n(" assignRankMinMax",()=>Ai(e)),n(" removeEdgeLabelProxies",()=>Mi(e)),n(" normalize.run",()=>xa(e)),n(" parentDummyChains",()=>ri(e)),n(" addBorderSegments",()=>ba(e)),n(" order",()=>ei(e)),n(" insertSelfEdges",()=>Di(e)),n(" adjustCoordinateSystem",()=>wa(e)),n(" position",()=>gi(e)),n(" positionSelfEdges",()=>Yi(e)),n(" removeBorderNodes",()=>Bi(e)),n(" normalize.undo",()=>Ea(e)),n(" fixupEdgeLabelCoords",()=>$i(e)),n(" undoCoordinateSystem",()=>ga(e)),n(" translateGraph",()=>Ri(e)),n(" assignNodeIntersects",()=>Si(e)),n(" reversePoints",()=>Fi(e)),n(" acyclic.undo",()=>sa(e))}function xi(e,n){c(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),c(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oi=["nodesep","edgesep","ranksep","marginx","marginy"],Ei={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ti=["acyclicer","ranker","rankdir","align"],Pi=["width","height"],Li={width:0,height:0},Ni=["minlen","weight","width","height","labeloffset"],Ci={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ii=["labelpos"];function _i(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ae({},Ei,ee(r,Oi),Y(r,Ti))),c(e.nodes(),function(t){var a=ne(e.node(t));n.setNode(t,_t(ee(a,Pi),Li)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var a=ne(e.edge(t));n.setEdge(t,ae({},Ci,ee(a,Ni),Y(a,Ii)))}),n}function ki(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ji(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),o={rank:(a.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Ai(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Mi(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ri(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,o=e.graph(),i=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),a=Math.max(a,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=i,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+i,o.height=a-t+u}function Si(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),o,i;r.points?(o=r.points[0],i=r.points[r.points.length-1]):(r.points=[],o=a,i=t),r.points.unshift(Re(t,o)),r.points.push(Re(a,i))})}function $i(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fi(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Bi(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),i=e.node(D(r.borderRight));r.width=Math.abs(i.x-o.x),r.height=Math.abs(a.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Gi(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Di(e){var n=z(e);c(n,function(r){var t=0;c(r,function(a,o){var i=e.node(a);i.order=o+t,c(i.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:i.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete i.selfEdges})})}function Yi(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,o=t.y,i=r.x-a,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*i/3,y:o-u},{x:a+5*i/6,y:o-u},{x:a+i,y:o},{x:a+5*i/6,y:o+u},{x:a+2*i/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ui as l}; +import{av as B,aw as y,ax as ye,ay as V,az as U,aA as Ue,aB as oe,aC as We,aD as In,aE as qe,aF as _n,aG as kn,aH as jn,aI as ue,aJ as An,aK as Mn,aL as xe,aM as Oe,aN as fe,aO as de,aP as G,aQ as Xe,aR as He,aS as Rn,aT as T,aU as Sn,aV as $n,aW as Fn,aX as Ee,aY as Bn,aZ as Ke,a_ as N,a$ as Gn,b0 as Dn,b1 as Yn,b2 as S,b3 as ze,b4 as Je,b5 as Vn,b6 as se,b7 as Qe,b8 as Un,b9 as Ze,ba as Wn,bb as qn,Q as x,bc as c,bd as Xn,be as m,bf as M,bg as P,bh as W}from"./mermaid.core-Bh6LVe7i.js";var Hn=/\s/;function Kn(e){for(var n=e.length;n--&&Hn.test(e.charAt(n)););return n}var zn=/^\s+/;function Jn(e){return e&&e.slice(0,Kn(e)+1).replace(zn,"")}var Te=NaN,Qn=/^[-+]0x[0-9a-f]+$/i,Zn=/^0b[01]+$/i,er=/^0o[0-7]+$/i,nr=parseInt;function rr(e){if(typeof e=="number")return e;if(B(e))return Te;if(y(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=y(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Jn(e);var r=Zn.test(e);return r||er.test(e)?nr(e.slice(2),r?2:8):Qn.test(e)?Te:+e}var Pe=1/0,tr=17976931348623157e292;function $(e){if(!e)return e===0?e:0;if(e=rr(e),e===Pe||e===-Pe){var n=e<0?-1:1;return n*tr}return e===e?e:0}function ar(e){var n=$(e),r=n%1;return n===n?r?n-r:n:0}var Le=Object.create,ir=(function(){function e(){}return function(n){if(!y(n))return{};if(Le)return Le(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function or(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(a--,o):void 0,i&&k(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),n=Object(n);++t2?n[2]:void 0;for(a&&k(n[0],n[1],a)&&(t=1);++r-1?a[o?n[i]:i]:void 0}}var Mt=Math.max;function Rt(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:ar(r);return a<0&&(a=Mt(t+a,0)),Dn(e,N(n),a)}var le=At(Rt);function ln(e,n){var r=-1,t=U(e)?Array(e.length):[];return Yn(e,function(a,o,i){t[++r]=n(a,o,i)}),t}function g(e,n){var r=T(e)?S:ln;return r(e,N(n))}function St(e,n){return e==null?e:Ke(e,ze(n),H)}function $t(e,n){return e&&Je(e,ze(n))}function Ft(e,n){return e>n}var Bt=Object.prototype,Gt=Bt.hasOwnProperty;function Dt(e,n){return e!=null&&Gt.call(e,n)}function hn(e,n){return e!=null&&Vn(e,n,Dt)}function vn(e,n){return en||o&&i&&f&&!u&&!d||t&&i&&f||!r&&f||!a)return 1;if(!t&&!o&&!d&&e=u)return f;var d=r[t];return f*(d=="desc"?-1:1)}}return e.index-n.index}function Xt(e,n,r){n.length?n=S(n,function(o){return T(o)?function(i){return Ze(i,o.length===1?o[0]:o)}:o}):n=[se];var t=-1;n=S(n,de(N));var a=ln(e,function(o,i,u){var f=S(n,function(d){return d(o)});return{criteria:f,index:++t,value:o}});return Ut(a,function(o,i){return qt(o,i,r)})}function Ht(e,n){return Vt(e,n,function(r,t){return Wn(e,t)})}var Y=pr(function(e,n){return e==null?{}:Ht(e,n)}),Kt=Math.ceil,zt=Math.max;function Jt(e,n,r,t){for(var a=-1,o=zt(Kt((n-e)/(r||1)),0),i=Array(o);o--;)i[++a]=e,e+=r;return i}function Qt(e){return function(n,r,t){return t&&typeof t!="number"&&k(n,r,t)&&(r=t=void 0),n=$(n),r===void 0?(r=n,n=0):r=$(r),t=t===void 0?n1&&k(e,n[0],n[1])?n=[]:r>2&&k(n[0],n[1],n[2])&&(n=[n[0]]),Xt(e,qe(n),[])}),Zt=0;function pe(e){var n=++Zt;return qn(e)+n}function ea(e,n,r){for(var t=-1,a=e.length,o=n.length,i={};++t0;--u)if(i=n[u].dequeue(),i){t=t.concat(J(e,n,r,i,!0));break}}}return t}function J(e,n,r,t,a){var o=a?[]:void 0;return c(e.inEdges(t.v),function(i){var u=e.edge(i),f=e.node(i.v);a&&o.push({v:i.v,w:i.w}),f.out-=u,ie(n,r,f)}),c(e.outEdges(t.v),function(i){var u=e.edge(i),f=i.w,d=e.node(f);d.in-=u,ie(n,r,d)}),e.removeNode(t.v),o}function ua(e,n){var r=new x,t=0,a=0;c(e.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(e.edges(),function(u){var f=r.edge(u.v,u.w)||0,d=n(u),s=f+d;r.setEdge(u.v,u.w,s),a=Math.max(a,r.node(u.v).out+=d),t=Math.max(t,r.node(u.w).in+=d)});var o=L(a+t+3).map(function(){return new ra}),i=t+1;return c(r.nodes(),function(u){ie(o,i,r.node(u))}),{graph:r,buckets:o,zeroIdx:i}}function ie(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function fa(e){var n=e.graph().acyclicer==="greedy"?ia(e,r(e)):da(e);c(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,pe("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function da(e){var n=[],r={},t={};function a(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(e.outEdges(o),function(i){Object.prototype.hasOwnProperty.call(r,i.w)?n.push(i):a(i.w)}),delete r[o])}return c(e.nodes(),a),n}function sa(e){c(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function I(e,n,r,t){var a;do a=pe(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function ca(e){var n=new x().setGraph(e.graph());return c(e.nodes(),function(r){n.setNode(r,e.node(r))}),c(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function pn(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return c(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),c(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Re(e,n){var r=e.x,t=e.y,a=n.x-r,o=n.y-t,i=e.width/2,u=e.height/2;if(!a&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var f,d;return Math.abs(o)*i>Math.abs(a)*u?(o<0&&(u=-u),f=u*a/o,d=u):(a<0&&(i=-i),f=i,d=i*o/a),{x:r+f,y:t+d}}function z(e){var n=g(L(bn(e)+1),function(){return[]});return c(e.nodes(),function(r){var t=e.node(r),a=t.rank;m(a)||(n[a][t.order]=r)}),n}function la(e){var n=j(g(e.nodes(),function(r){return e.node(r).rank}));c(e.nodes(),function(r){var t=e.node(r);hn(t,"rank")&&(t.rank-=n)})}function ha(e){var n=j(g(e.nodes(),function(o){return e.node(o).rank})),r=[];c(e.nodes(),function(o){var i=e.node(o).rank-n;r[i]||(r[i]=[]),r[i].push(o)});var t=0,a=e.graph().nodeRankFactor;c(r,function(o,i){m(o)&&i%a!==0?--t:t&&c(o,function(u){e.node(u).rank+=t})})}function Se(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),I(e,"border",a,n)}function bn(e){return O(g(e.nodes(),function(n){var r=e.node(n).rank;if(!m(r))return r}))}function va(e,n){var r={lhs:[],rhs:[]};return c(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function pa(e,n){return n()}function ba(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&c(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,i=a.maxRank+1;oi.lim&&(u=i,f=!0);var d=M(n.edges(),function(s){return f===Be(e,e.node(s.v),u)&&f!==Be(e,e.node(s.w),u)});return ve(d,function(s){return A(n,s)})}function Pn(e,n,r,t){var a=r.v,o=r.w;e.removeEdge(a,o),e.setEdge(t.v,t.w,{}),ge(e),we(e,n),ka(e,n)}function ka(e,n){var r=le(e.nodes(),function(a){return!n.node(a).parent}),t=Ia(e,r);t=t.slice(1),c(t,function(a){var o=e.node(a).parent,i=n.edge(a,o),u=!1;i||(i=n.edge(o,a),u=!0),n.node(a).rank=n.node(o).rank+(u?i.minlen:-i.minlen)})}function ja(e,n,r){return e.hasEdge(n,r)}function Be(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Aa(e){switch(e.graph().ranker){case"network-simplex":Ge(e);break;case"tight-tree":Ra(e);break;case"longest-path":Ma(e);break;default:Ge(e)}}var Ma=be;function Ra(e){be(e),gn(e)}function Ge(e){E(e)}function Sa(e){var n=I(e,"root",{},"_root"),r=$a(e),t=O(P(r))-1,a=2*t+1;e.graph().nestingRoot=n,c(e.edges(),function(i){e.edge(i).minlen*=a});var o=Fa(e)+1;c(e.children(),function(i){Ln(e,n,a,o,t,r,i)}),e.graph().nodeRankFactor=a}function Ln(e,n,r,t,a,o,i){var u=e.children(i);if(!u.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var f=Se(e,"_bt"),d=Se(e,"_bb"),s=e.node(i);e.setParent(f,i),s.borderTop=f,e.setParent(d,i),s.borderBottom=d,c(u,function(l){Ln(e,n,r,t,a,o,l);var h=e.node(l),p=h.borderTop?h.borderTop:l,v=h.borderBottom?h.borderBottom:l,w=h.borderTop?t:2*t,_=p!==v?1:a-o[i]+1;e.setEdge(f,p,{weight:w,minlen:_,nestingEdge:!0}),e.setEdge(v,d,{weight:w,minlen:_,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,f,{weight:0,minlen:a+o[i]})}function $a(e){var n={};function r(t,a){var o=e.children(t);o&&o.length&&c(o,function(i){r(i,a+1)}),n[t]=a}return c(e.children(),function(t){r(t,1)}),n}function Fa(e){return W(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function Ba(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,c(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function Ga(e,n,r){var t={},a;c(r,function(o){for(var i=e.parent(o),u,f;i;){if(u=e.parent(i),u?(f=t[u],t[u]=i):(f=a,a=i),f&&f!==i){n.setEdge(f,i);return}i=u}})}function Da(e,n,r){var t=Ya(e),a=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return c(e.nodes(),function(o){var i=e.node(o),u=e.parent(o);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(a.setNode(o),a.setParent(o,u||t),c(e[r](o),function(f){var d=f.v===o?f.w:f.v,s=a.edge(d,o),l=m(s)?0:s.weight;a.setEdge(d,o,{weight:e.edge(f).weight+l})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&a.setNode(o,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),a}function Ya(e){for(var n;e.hasNode(n=pe("_root")););return n}function Va(e,n){for(var r=0,t=1;t0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=d.weight;f+=d.weight*l})),f}function Wa(e){var n={},r=M(e.nodes(),function(u){return!e.children(u).length}),t=O(g(r,function(u){return e.node(u).rank})),a=g(L(t+1),function(){return[]});function o(u){if(!hn(n,u)){n[u]=!0;var f=e.node(u);a[f.rank].push(u),c(e.successors(u),o)}}var i=R(r,function(u){return e.node(u).rank});return c(i,o),a}function qa(e,n){return g(n,function(r){var t=e.inEdges(r);if(t.length){var a=W(t,function(o,i){var u=e.edge(i),f=e.node(i.v);return{sum:o.sum+u.weight*f.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function Xa(e,n){var r={};c(e,function(a,o){var i=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:o};m(a.barycenter)||(i.barycenter=a.barycenter,i.weight=a.weight)}),c(n.edges(),function(a){var o=r[a.v],i=r[a.w];!m(o)&&!m(i)&&(i.indegree++,o.out.push(r[a.w]))});var t=M(r,function(a){return!a.indegree});return Ha(t)}function Ha(e){var n=[];function r(o){return function(i){i.merged||(m(i.barycenter)||m(o.barycenter)||i.barycenter>=o.barycenter)&&Ka(o,i)}}function t(o){return function(i){i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){var a=e.pop();n.push(a),c(a.in.reverse(),r(a)),c(a.out,t(a))}return g(M(n,function(o){return!o.merged}),function(o){return Y(o,["vs","i","barycenter","weight"])})}function Ka(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function za(e,n){var r=va(e,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,a=R(r.rhs,function(s){return-s.i}),o=[],i=0,u=0,f=0;t.sort(Ja(!!n)),f=De(o,a,f),c(t,function(s){f+=s.vs.length,o.push(s.vs),i+=s.barycenter*s.weight,u+=s.weight,f=De(o,a,f)});var d={vs:C(o)};return u&&(d.barycenter=i/u,d.weight=u),d}function De(e,n,r){for(var t;n.length&&(t=D(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ja(e){return function(n,r){return n.barycenterr.barycenter?1:e?r.i-n.i:n.i-r.i}}function Nn(e,n,r,t){var a=e.children(n),o=e.node(n),i=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};i&&(a=M(a,function(v){return v!==i&&v!==u}));var d=qa(e,a);c(d,function(v){if(e.children(v.v).length){var w=Nn(e,v.v,r,t);f[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&Za(v,w)}});var s=Xa(d,r);Qa(s,f);var l=za(s,t);if(i&&(l.vs=C([i,l.vs,u]),e.predecessors(i).length)){var h=e.node(e.predecessors(i)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+p.order)/(l.weight+2),l.weight+=2}return l}function Qa(e,n){c(e,function(r){r.vs=C(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Za(e,n){m(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function ei(e){var n=bn(e),r=Ye(e,L(1,n+1),"inEdges"),t=Ye(e,L(n-1,-1,-1),"outEdges"),a=Wa(e);Ve(e,a);for(var o=Number.POSITIVE_INFINITY,i,u=0,f=0;f<4;++u,++f){ni(u%2?r:t,u%4>=2),a=z(e);var d=Va(e,a);di||u>n[f].lim));for(d=f,f=t;(f=e.parent(f))!==d;)o.push(f);return{path:a.concat(o.reverse()),lca:d}}function ai(e){var n={},r=0;function t(a){var o=r;c(e.children(a),t),n[a]={low:o,lim:r++}}return c(e.children(),t),n}function ii(e,n){var r={};function t(a,o){var i=0,u=0,f=a.length,d=D(o);return c(o,function(s,l){var h=ui(e,s),p=h?e.node(h).order:f;(h||s===d)&&(c(o.slice(u,l+1),function(v){c(e.predecessors(v),function(w){var _=e.node(w),me=_.order;(med)&&Cn(r,h,s)})})}function a(o,i){var u=-1,f,d=0;return c(i,function(s,l){if(e.node(s).dummy==="border"){var h=e.predecessors(s);h.length&&(f=e.node(h[0]).order,t(i,d,l,u,f),d=l,u=f)}t(i,d,i.length,f,o.length)}),i}return W(n,a),r}function ui(e,n){if(e.node(n).dummy)return le(e.predecessors(n),function(r){return e.node(r).dummy})}function Cn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function fi(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function di(e,n,r,t){var a={},o={},i={};return c(n,function(u){c(u,function(f,d){a[f]=f,o[f]=f,i[f]=d})}),c(n,function(u){var f=-1;c(u,function(d){var s=t(d);if(s.length){s=R(s,function(w){return i[w]});for(var l=(s.length-1)/2,h=Math.floor(l),p=Math.ceil(l);h<=p;++h){var v=s[h];o[d]===d&&f{var t=r(" buildLayoutGraph",()=>_i(e));r(" runLayout",()=>yi(t,r)),r(" updateInputGraph",()=>xi(e,t))})}function yi(e,n){n(" makeSpaceForEdgeLabels",()=>ki(e)),n(" removeSelfEdges",()=>Gi(e)),n(" acyclic",()=>fa(e)),n(" nestingGraph.run",()=>Sa(e)),n(" rank",()=>Aa(pn(e))),n(" injectEdgeLabelProxies",()=>ji(e)),n(" removeEmptyRanks",()=>ha(e)),n(" nestingGraph.cleanup",()=>Ba(e)),n(" normalizeRanks",()=>la(e)),n(" assignRankMinMax",()=>Ai(e)),n(" removeEdgeLabelProxies",()=>Mi(e)),n(" normalize.run",()=>xa(e)),n(" parentDummyChains",()=>ri(e)),n(" addBorderSegments",()=>ba(e)),n(" order",()=>ei(e)),n(" insertSelfEdges",()=>Di(e)),n(" adjustCoordinateSystem",()=>wa(e)),n(" position",()=>gi(e)),n(" positionSelfEdges",()=>Yi(e)),n(" removeBorderNodes",()=>Bi(e)),n(" normalize.undo",()=>Ea(e)),n(" fixupEdgeLabelCoords",()=>$i(e)),n(" undoCoordinateSystem",()=>ga(e)),n(" translateGraph",()=>Ri(e)),n(" assignNodeIntersects",()=>Si(e)),n(" reversePoints",()=>Fi(e)),n(" acyclic.undo",()=>sa(e))}function xi(e,n){c(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),c(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Oi=["nodesep","edgesep","ranksep","marginx","marginy"],Ei={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ti=["acyclicer","ranker","rankdir","align"],Pi=["width","height"],Li={width:0,height:0},Ni=["minlen","weight","width","height","labeloffset"],Ci={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ii=["labelpos"];function _i(e){var n=new x({multigraph:!0,compound:!0}),r=ne(e.graph());return n.setGraph(ae({},Ei,ee(r,Oi),Y(r,Ti))),c(e.nodes(),function(t){var a=ne(e.node(t));n.setNode(t,_t(ee(a,Pi),Li)),n.setParent(t,e.parent(t))}),c(e.edges(),function(t){var a=ne(e.edge(t));n.setEdge(t,ae({},Ci,ee(a,Ni),Y(a,Ii)))}),n}function ki(e){var n=e.graph();n.ranksep/=2,c(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function ji(e){c(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),o={rank:(a.rank-t.rank)/2+t.rank,e:n};I(e,"edge-proxy",o,"_ep")}})}function Ai(e){var n=0;c(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Mi(e){c(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Ri(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,o=e.graph(),i=o.marginx||0,u=o.marginy||0;function f(d){var s=d.x,l=d.y,h=d.width,p=d.height;n=Math.min(n,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-p/2),a=Math.max(a,l+p/2)}c(e.nodes(),function(d){f(e.node(d))}),c(e.edges(),function(d){var s=e.edge(d);Object.prototype.hasOwnProperty.call(s,"x")&&f(s)}),n-=i,t-=u,c(e.nodes(),function(d){var s=e.node(d);s.x-=n,s.y-=t}),c(e.edges(),function(d){var s=e.edge(d);c(s.points,function(l){l.x-=n,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=n),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-n+i,o.height=a-t+u}function Si(e){c(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),o,i;r.points?(o=r.points[0],i=r.points[r.points.length-1]):(r.points=[],o=a,i=t),r.points.unshift(Re(t,o)),r.points.push(Re(a,i))})}function $i(e){c(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Fi(e){c(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function Bi(e){c(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),o=e.node(D(r.borderLeft)),i=e.node(D(r.borderRight));r.width=Math.abs(i.x-o.x),r.height=Math.abs(a.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function Gi(e){c(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Di(e){var n=z(e);c(n,function(r){var t=0;c(r,function(a,o){var i=e.node(a);i.order=o+t,c(i.selfEdges,function(u){I(e,"selfedge",{width:u.label.width,height:u.label.height,rank:i.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete i.selfEdges})})}function Yi(e){c(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,o=t.y,i=r.x-a,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*i/3,y:o-u},{x:a+5*i/6,y:o-u},{x:a+i,y:o},{x:a+5*i/6,y:o+u},{x:a+2*i/3,y:o+u}],r.label.x=r.x,r.label.y=r.y}})}function ee(e,n){return K(Y(e,n),Number)}function ne(e){var n={};return c(e,function(r,t){n[t.toLowerCase()]=r}),n}export{Ui as l}; diff --git a/static/ml_canvas/assets/mermaid.core-DBa20IFF.js b/static/ml_canvas/assets/mermaid.core-Bh6LVe7i.js similarity index 99% rename from static/ml_canvas/assets/mermaid.core-DBa20IFF.js rename to static/ml_canvas/assets/mermaid.core-Bh6LVe7i.js index 6fc6e2159..62cff4d9b 100644 --- a/static/ml_canvas/assets/mermaid.core-DBa20IFF.js +++ b/static/ml_canvas/assets/mermaid.core-Bh6LVe7i.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-INFHLROL-DhKNPmyb.js","assets/index-_bluKNvP.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-charts-BkHP8M8k.js","assets/index-BgjiDTvn.css","assets/dagre-GXQ25YYZ-HI_1BsWY.js","assets/layout-D4UUaX_9.js","assets/swimlanes-42K2YHIH-Dd449bDi.js","assets/cose-bilkent-JH36ORCC-DSJwbOO-.js","assets/cytoscape.esm-Bch-eiPH.js","assets/c4Diagram-7LVT6UL2-CrUbY5T3.js","assets/chunk-F27PBJKO-B6ZPWwpd.js","assets/flowDiagram-HODETNUW-CY2uKpa5.js","assets/chunk-5VM5RSS4-vgh9rKCo.js","assets/chunk-XXDRQBXY-Bs02z9v-.js","assets/chunk-POPQ4Y6H-oeZXlwKE.js","assets/channel-DIwzyvS1.js","assets/swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js","assets/erDiagram-RLTQ6QDP-DUTJfcik.js","assets/gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js","assets/chunk-2Q5K7J3B-BBHJD4OQ.js","assets/chunk-JWPE2WC7-D_VUnfvZ.js","assets/cynefin-OW5HDTMX-DvaIaB7v.js","assets/ganttDiagram-EL5Y4UJY-BPTKWvnP.js","assets/infoDiagram-27XIBGKW-BKR9ZU8X.js","assets/pieDiagram-E7YTZNPT-B2e1MX98.js","assets/quadrantDiagram-AXDQQJYC-B8cLCZlE.js","assets/xychartDiagram-S5SC5T6Z-DvskLDdU.js","assets/requirementDiagram-BXWQKSXE-B8LHaj5a.js","assets/sequenceDiagram-WJ2MYXX4-BKpy-f0A.js","assets/classDiagram-ZZMXUADV-B-odMm70.js","assets/chunk-TICWLB2K-fDp21oQ3.js","assets/classDiagram-v2-VYDZK3BY-B-odMm70.js","assets/stateDiagram-D77RDMKH-DsmaWosA.js","assets/chunk-IMKFNOWR-D26YLBdf.js","assets/stateDiagram-v2-MP3YSRHH-D_3MdGaI.js","assets/journeyDiagram-3NMN7TZE-5Eg3OQkk.js","assets/timeline-definition-24CTP7MA-CSbm3DNI.js","assets/mindmap-definition-YA3MSWOX-DQIC6o-x.js","assets/kanban-definition-UXKFOSKX-DdgiJMlk.js","assets/sankeyDiagram-P5KCCOFB-BoZhgcxg.js","assets/diagram-Z3DM3KII-DZNpeXsQ.js","assets/diagram-UQ7AKVKN-B7U-fTJX.js","assets/blockDiagram-I7D4REHJ-01ED4W8y.js","assets/diagram-S7CK7UJ4-zlxvjyBt.js","assets/architectureDiagram-5GKGNRK7-DR-sbxhh.js","assets/diagram-VSXAHHWV-XaHXd--c.js","assets/ishikawaDiagram-5VMMS53U-CiUVSvQn.js","assets/vennDiagram-4TSXK5OY-U8E6M_Pt.js","assets/diagram-VX7I27RA-NQCb8NMS.js","assets/wardleyDiagram-VM6X3IG4-l1AdmyzU.js","assets/cynefinDiagram-5FMLGOSQ-DQF0zKIv.js","assets/railroadDiagram-O6MQD6OU-DqV6ivu7.js","assets/chunk-SVP7TREG-rNd1SwBb.js","assets/ebnfDiagram-PWID7BFC-5A6xA75D.js","assets/abnfDiagram-VCTEODGH-Da14qxKB.js","assets/pegDiagram-XKGWAZYB-BQQjq6hL.js"])))=>i.map(i=>d[i]); -var qm=Object.defineProperty;var Nm=(e,t,r)=>t in e?qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Vt=(e,t,r)=>Nm(e,typeof t!="symbol"?t+"":t,r);import{_ as Rt}from"./index-_bluKNvP.js";import{g as vn}from"./vendor-utils-VkF_O5b_.js";import{s as Pt}from"./vendor-flow-Ct2sLZk5.js";import{aw as bd,s as kd,ax as Wm,ay as zm,az as Hm,aA as jo,aB as Td,aC as Jl,aD as Za,w as Gs,aE as jm,aF as Sd,aG as wd,aH as Bd,aI as vd,aJ as Ld,aK as _d,aL as Ym,aM as Xs,aN as Fd,aO as Um,aP as Gm,aQ as Ed,aR as Xm,aS as Vm,aT as Zm,aU as Ad,aV as Md,aW as Km,aX as Qm,q as Yo,p as Jm}from"./vendor-charts-BkHP8M8k.js";var Od=Object.defineProperty,p=(e,t)=>Od(e,"name",{value:t,configurable:!0}),ty=(e,t)=>{for(var r in t)Od(e,r,{get:t[r],enumerable:!0})},Vs={exports:{}},ey=Vs.exports,th;function ry(){return th||(th=1,(function(e,t){(function(r,i){e.exports=i()})(ey,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",n="second",o="minute",l="hour",c="day",h="week",d="month",g="quarter",u="year",m="date",y="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var O=["th","st","nd","rd"],L=M%100;return"["+M+(O[(L-20)%10]||O[L]||O[0])+"]"}},S=function(M,O,L){var P=String(M);return!P||P.length>=O?M:""+Array(O+1-P.length).join(L)+M},w={s:S,z:function(M){var O=-M.utcOffset(),L=Math.abs(O),P=Math.floor(L/60),$=L%60;return(O<=0?"+":"-")+S(P,2,"0")+":"+S($,2,"0")},m:function M(O,L){if(O.date()1)return M(K[0])}else{var dt=O.name;_[dt]=O,$=dt}return!P&&$&&(v=$),$||!P&&v},W=function(M,O){if(F(M))return M.clone();var L=typeof O=="object"?O:{};return L.date=M,L.args=arguments,new at(L)},z=w;z.l=Y,z.i=F,z.w=function(M,O){return W(M,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var at=(function(){function M(L){this.$L=Y(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[E]=!0}var O=M.prototype;return O.parse=function(L){this.$d=(function(P){var $=P.date,H=P.utc;if($===null)return new Date(NaN);if(z.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(x);if(K){var dt=K[2]-1||0,pt=(K[7]||"0").substring(0,3);return H?new Date(Date.UTC(K[1],dt,K[3]||1,K[4]||0,K[5]||0,K[6]||0,pt)):new Date(K[1],dt,K[3]||1,K[4]||0,K[5]||0,K[6]||0,pt)}}return new Date($)})(L),this.init()},O.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},O.$utils=function(){return z},O.isValid=function(){return this.$d.toString()!==y},O.isSame=function(L,P){var $=W(L);return this.startOf(P)<=$&&$<=this.endOf(P)},O.isAfter=function(L,P){return W(L){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Ln=p(function(e="fatal"){let t=ur.fatal;typeof e=="string"?e.toLowerCase()in ur&&(t=ur[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=ur.fatal&&(q.fatal=console.error?console.error.bind(console,Re("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Re("FATAL"))),t<=ur.error&&(q.error=console.error?console.error.bind(console,Re("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Re("ERROR"))),t<=ur.warn&&(q.warn=console.warn?console.warn.bind(console,Re("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Re("WARN"))),t<=ur.info&&(q.info=console.info?console.info.bind(console,Re("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Re("INFO"))),t<=ur.debug&&(q.debug=console.debug?console.debug.bind(console,Re("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Re("DEBUG"))),t<=ur.trace&&(q.trace=console.debug?console.debug.bind(console,Re("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Re("TRACE")))},"setLogLevel"),Re=p(e=>`%c${sy().format("ss.SSS")} : ${e} : `,"format");const Zs={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Zs.hue2rgb(a,s,e+1/3)*255;case"g":return Zs.hue2rgb(a,s,e)*255;case"b":return Zs.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),n=(s+a)/2;if(i==="l")return n*100;if(s===a)return 0;const o=s-a,l=n>.5?o/(2-s-a):o/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/o+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},oy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},It={channel:Zs,lang:ay,unit:oy},Lr={};for(let e=0;e<=255;e++)Lr[e]=It.unit.dec2hex(e);const me={ALL:0,RGB:1,HSL:2};let ny=class{constructor(){this.type=me.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=me.ALL}is(t){return this.type===t}};class ly{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new ny}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=me.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=It.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=It.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=It.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=It.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=It.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=It.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(me.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(me.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(me.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(me.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(me.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(me.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ta=new ly({r:0,g:0,b:0,a:0},"transparent"),di={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(di.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,n=s>4,o=n?1:17,l=n?8:4,c=a?0:-1,h=n?255:15;return Ta.set({r:(i>>l*(c+3)&h)*o,g:(i>>l*(c+2)&h)*o,b:(i>>l*(c+1)&h)*o,a:a?(i&h)*o/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${Lr[Math.round(t)]}${Lr[Math.round(r)]}${Lr[Math.round(i)]}${Lr[Math.round(s*255)]}`:`#${Lr[Math.round(t)]}${Lr[Math.round(r)]}${Lr[Math.round(i)]}`}},Wr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Wr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return It.channel.clamp.h(parseFloat(r)*.9);case"rad":return It.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return It.channel.clamp.h(parseFloat(r)*360)}}return It.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Wr.re);if(!r)return;const[,i,s,a,n,o]=r;return Ta.set({h:Wr._hue2deg(i),s:It.channel.clamp.s(parseFloat(s)),l:It.channel.clamp.l(parseFloat(a)),a:n?It.channel.clamp.a(o?parseFloat(n)/100:parseFloat(n)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${It.lang.round(t)}, ${It.lang.round(r)}%, ${It.lang.round(i)}%, ${s})`:`hsl(${It.lang.round(t)}, ${It.lang.round(r)}%, ${It.lang.round(i)}%)`}},ls={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ls.colors[e];if(t)return di.parse(t)},stringify:e=>{const t=di.stringify(e);for(const r in ls.colors)if(ls.colors[r]===t)return r}},ts={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(ts.re);if(!r)return;const[,i,s,a,n,o,l,c,h]=r;return Ta.set({r:It.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:It.channel.clamp.g(n?parseFloat(a)*2.55:parseFloat(a)),b:It.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:c?It.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${It.lang.round(t)}, ${It.lang.round(r)}, ${It.lang.round(i)}, ${It.lang.round(s)})`:`rgb(${It.lang.round(t)}, ${It.lang.round(r)}, ${It.lang.round(i)})`}},sr={format:{keyword:ls,hex:di,rgb:ts,rgba:ts,hsl:Wr,hsla:Wr},parse:e=>{if(typeof e!="string")return e;const t=di.parse(e)||ts.parse(e)||Wr.parse(e)||ls.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(me.HSL)||e.data.r===void 0?Wr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?ts.stringify(e):di.stringify(e)},$d=(e,t)=>{const r=sr.parse(e);for(const i in t)r[i]=It.channel.clamp[i](t[i]);return sr.stringify(r)},Er=(e,t,r=0,i=1)=>{if(typeof e!="number")return $d(e,{a:t});const s=Ta.set({r:It.channel.clamp.r(e),g:It.channel.clamp.g(t),b:It.channel.clamp.b(r),a:It.channel.clamp.a(i)});return sr.stringify(s)},hy=e=>{const{r:t,g:r,b:i}=sr.parse(e),s=.2126*It.channel.toLinear(t)+.7152*It.channel.toLinear(r)+.0722*It.channel.toLinear(i);return It.lang.round(s)},cy=e=>hy(e)>=.5,Ge=e=>!cy(e),Dd=(e,t,r)=>{const i=sr.parse(e),s=i[t],a=It.channel.clamp[t](s+r);return s!==a&&(i[t]=a),sr.stringify(i)},U=(e,t)=>Dd(e,"l",t),G=(e,t)=>Dd(e,"l",-t),b=(e,t)=>{const r=sr.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return $d(e,i)},dy=(e,t,r=50)=>{const{r:i,g:s,b:a,a:n}=sr.parse(e),{r:o,g:l,b:c,a:h}=sr.parse(t),d=r/100,g=d*2-1,u=n-h,y=((g*u===-1?g:(g+u)/(1+g*u))+1)/2,x=1-y,C=i*y+o*x,k=s*y+l*x,S=a*y+c*x,w=n*d+h*(1-d);return Er(C,k,S,w)},A=(e,t=100)=>{const r=sr.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,dy(r,e,t)};/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function eh(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);ri.map(i=>d[i]); +var qm=Object.defineProperty;var Nm=(e,t,r)=>t in e?qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Vt=(e,t,r)=>Nm(e,typeof t!="symbol"?t+"":t,r);import{_ as Rt}from"./index-BR7Y881F.js";import{g as vn}from"./vendor-utils-VkF_O5b_.js";import{s as Pt}from"./vendor-flow-Ct2sLZk5.js";import{aw as bd,s as kd,ax as Wm,ay as zm,az as Hm,aA as jo,aB as Td,aC as Jl,aD as Za,w as Gs,aE as jm,aF as Sd,aG as wd,aH as Bd,aI as vd,aJ as Ld,aK as _d,aL as Ym,aM as Xs,aN as Fd,aO as Um,aP as Gm,aQ as Ed,aR as Xm,aS as Vm,aT as Zm,aU as Ad,aV as Md,aW as Km,aX as Qm,q as Yo,p as Jm}from"./vendor-charts-BkHP8M8k.js";var Od=Object.defineProperty,p=(e,t)=>Od(e,"name",{value:t,configurable:!0}),ty=(e,t)=>{for(var r in t)Od(e,r,{get:t[r],enumerable:!0})},Vs={exports:{}},ey=Vs.exports,th;function ry(){return th||(th=1,(function(e,t){(function(r,i){e.exports=i()})(ey,(function(){var r=1e3,i=6e4,s=36e5,a="millisecond",n="second",o="minute",l="hour",c="day",h="week",d="month",g="quarter",u="year",m="date",y="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var O=["th","st","nd","rd"],L=M%100;return"["+M+(O[(L-20)%10]||O[L]||O[0])+"]"}},S=function(M,O,L){var P=String(M);return!P||P.length>=O?M:""+Array(O+1-P.length).join(L)+M},w={s:S,z:function(M){var O=-M.utcOffset(),L=Math.abs(O),P=Math.floor(L/60),$=L%60;return(O<=0?"+":"-")+S(P,2,"0")+":"+S($,2,"0")},m:function M(O,L){if(O.date()1)return M(K[0])}else{var dt=O.name;_[dt]=O,$=dt}return!P&&$&&(v=$),$||!P&&v},W=function(M,O){if(F(M))return M.clone();var L=typeof O=="object"?O:{};return L.date=M,L.args=arguments,new at(L)},z=w;z.l=Y,z.i=F,z.w=function(M,O){return W(M,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var at=(function(){function M(L){this.$L=Y(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[E]=!0}var O=M.prototype;return O.parse=function(L){this.$d=(function(P){var $=P.date,H=P.utc;if($===null)return new Date(NaN);if(z.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var K=$.match(x);if(K){var dt=K[2]-1||0,pt=(K[7]||"0").substring(0,3);return H?new Date(Date.UTC(K[1],dt,K[3]||1,K[4]||0,K[5]||0,K[6]||0,pt)):new Date(K[1],dt,K[3]||1,K[4]||0,K[5]||0,K[6]||0,pt)}}return new Date($)})(L),this.init()},O.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},O.$utils=function(){return z},O.isValid=function(){return this.$d.toString()!==y},O.isSame=function(L,P){var $=W(L);return this.startOf(P)<=$&&$<=this.endOf(P)},O.isAfter=function(L,P){return W(L){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Ln=p(function(e="fatal"){let t=ur.fatal;typeof e=="string"?e.toLowerCase()in ur&&(t=ur[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=ur.fatal&&(q.fatal=console.error?console.error.bind(console,Re("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Re("FATAL"))),t<=ur.error&&(q.error=console.error?console.error.bind(console,Re("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Re("ERROR"))),t<=ur.warn&&(q.warn=console.warn?console.warn.bind(console,Re("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Re("WARN"))),t<=ur.info&&(q.info=console.info?console.info.bind(console,Re("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Re("INFO"))),t<=ur.debug&&(q.debug=console.debug?console.debug.bind(console,Re("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Re("DEBUG"))),t<=ur.trace&&(q.trace=console.debug?console.debug.bind(console,Re("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Re("TRACE")))},"setLogLevel"),Re=p(e=>`%c${sy().format("ss.SSS")} : ${e} : `,"format");const Zs={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const s=r<.5?r*(1+t):r+t-r*t,a=2*r-s;switch(i){case"r":return Zs.hue2rgb(a,s,e+1/3)*255;case"g":return Zs.hue2rgb(a,s,e)*255;case"b":return Zs.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const s=Math.max(e,t,r),a=Math.min(e,t,r),n=(s+a)/2;if(i==="l")return n*100;if(s===a)return 0;const o=s-a,l=n>.5?o/(2-s-a):o/(s+a);if(i==="s")return l*100;switch(s){case e:return((t-r)/o+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},oy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},It={channel:Zs,lang:ay,unit:oy},Lr={};for(let e=0;e<=255;e++)Lr[e]=It.unit.dec2hex(e);const me={ALL:0,RGB:1,HSL:2};let ny=class{constructor(){this.type=me.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=me.ALL}is(t){return this.type===t}};class ly{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new ny}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=me.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:s}=t;r===void 0&&(t.h=It.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=It.channel.rgb2hsl(t,"s")),s===void 0&&(t.l=It.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:s}=t;r===void 0&&(t.r=It.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=It.channel.hsl2rgb(t,"g")),s===void 0&&(t.b=It.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(me.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(me.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(me.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(me.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(me.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(me.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(me.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(me.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const Ta=new ly({r:0,g:0,b:0,a:0},"transparent"),di={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(di.re);if(!t)return;const r=t[1],i=parseInt(r,16),s=r.length,a=s%4===0,n=s>4,o=n?1:17,l=n?8:4,c=a?0:-1,h=n?255:15;return Ta.set({r:(i>>l*(c+3)&h)*o,g:(i>>l*(c+2)&h)*o,b:(i>>l*(c+1)&h)*o,a:a?(i&h)*o/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`#${Lr[Math.round(t)]}${Lr[Math.round(r)]}${Lr[Math.round(i)]}${Lr[Math.round(s*255)]}`:`#${Lr[Math.round(t)]}${Lr[Math.round(r)]}${Lr[Math.round(i)]}`}},Wr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Wr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return It.channel.clamp.h(parseFloat(r)*.9);case"rad":return It.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return It.channel.clamp.h(parseFloat(r)*360)}}return It.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Wr.re);if(!r)return;const[,i,s,a,n,o]=r;return Ta.set({h:Wr._hue2deg(i),s:It.channel.clamp.s(parseFloat(s)),l:It.channel.clamp.l(parseFloat(a)),a:n?It.channel.clamp.a(o?parseFloat(n)/100:parseFloat(n)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:s}=e;return s<1?`hsla(${It.lang.round(t)}, ${It.lang.round(r)}%, ${It.lang.round(i)}%, ${s})`:`hsl(${It.lang.round(t)}, ${It.lang.round(r)}%, ${It.lang.round(i)}%)`}},ls={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=ls.colors[e];if(t)return di.parse(t)},stringify:e=>{const t=di.stringify(e);for(const r in ls.colors)if(ls.colors[r]===t)return r}},ts={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(ts.re);if(!r)return;const[,i,s,a,n,o,l,c,h]=r;return Ta.set({r:It.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:It.channel.clamp.g(n?parseFloat(a)*2.55:parseFloat(a)),b:It.channel.clamp.b(l?parseFloat(o)*2.55:parseFloat(o)),a:c?It.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:s}=e;return s<1?`rgba(${It.lang.round(t)}, ${It.lang.round(r)}, ${It.lang.round(i)}, ${It.lang.round(s)})`:`rgb(${It.lang.round(t)}, ${It.lang.round(r)}, ${It.lang.round(i)})`}},sr={format:{keyword:ls,hex:di,rgb:ts,rgba:ts,hsl:Wr,hsla:Wr},parse:e=>{if(typeof e!="string")return e;const t=di.parse(e)||ts.parse(e)||Wr.parse(e)||ls.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(me.HSL)||e.data.r===void 0?Wr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?ts.stringify(e):di.stringify(e)},$d=(e,t)=>{const r=sr.parse(e);for(const i in t)r[i]=It.channel.clamp[i](t[i]);return sr.stringify(r)},Er=(e,t,r=0,i=1)=>{if(typeof e!="number")return $d(e,{a:t});const s=Ta.set({r:It.channel.clamp.r(e),g:It.channel.clamp.g(t),b:It.channel.clamp.b(r),a:It.channel.clamp.a(i)});return sr.stringify(s)},hy=e=>{const{r:t,g:r,b:i}=sr.parse(e),s=.2126*It.channel.toLinear(t)+.7152*It.channel.toLinear(r)+.0722*It.channel.toLinear(i);return It.lang.round(s)},cy=e=>hy(e)>=.5,Ge=e=>!cy(e),Dd=(e,t,r)=>{const i=sr.parse(e),s=i[t],a=It.channel.clamp[t](s+r);return s!==a&&(i[t]=a),sr.stringify(i)},U=(e,t)=>Dd(e,"l",t),G=(e,t)=>Dd(e,"l",-t),b=(e,t)=>{const r=sr.parse(e),i={};for(const s in t)t[s]&&(i[s]=r[s]+t[s]);return $d(e,i)},dy=(e,t,r=50)=>{const{r:i,g:s,b:a,a:n}=sr.parse(e),{r:o,g:l,b:c,a:h}=sr.parse(t),d=r/100,g=d*2-1,u=n-h,y=((g*u===-1?g:(g+u)/(1+g*u))+1)/2,x=1-y,C=i*y+o*x,k=s*y+l*x,S=a*y+c*x,w=n*d+h*(1-d);return Er(C,k,S,w)},A=(e,t=100)=>{const r=sr.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,dy(r,e,t)};/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function eh(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r2?i-2:0),a=2;a1?r-1:0),s=1;s"u"?null:ne(BigInt.prototype.toString),nh=typeof Symbol>"u"?null:ne(Symbol.prototype.toString),Ee=ne(Object.prototype.hasOwnProperty),Ui=ne(Object.prototype.toString),fe=ne(RegExp.prototype.test),Dr=By(TypeError);function ne(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:es;if(rh&&rh(e,null),!ui(t))return e;let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const a=r(s);a!==s&&(yy(t)||(t[i]=a),s=a)}e[s]=!0}return e}function vy(e){for(let t=0;t/g),Oy=de(/\${[\w\W]*/g),$y=de(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dy=de(/^aria-[\-\w]+$/),uh=de(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Iy=de(/^(?:\w+script|data):/i),Py=de(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ry=de(/^html$/i),qy=de(/^[a-z][.\w]*(-[.\w]+)+$/i),gh=de(/<[/\w!]/g),ph=de(/<[/\w]/g),Ny=de(/<\/no(script|embed|frames)/i),Wy=de(/\/>/i),$e={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Rd=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],zy=he(Yt({},Rd)),Hy=(function(){const e={};return qr(Rd,t=>{e[t]=de(new RegExp("])","i"))}),he(e)})(),jy=function(){return typeof window>"u"?null:window},Yy=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(i=r.getAttribute(s));const a="dompurify"+(i?"#"+i:"");try{return t.createPolicy(a,{createHTML(n){return n},createScriptURL(n){return n}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},fh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Br=function(t,r,i,s){return Ee(t,r)&&ui(t[r])?Yt(s.base?Ie(s.base):{},t[r],s.transform):i},ro=function(t,r,i){const s=Ee(t,r)?t[r]:void 0;return s&&typeof s=="object"?Ie(s):i()};function qd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jy();const t=ot=>qd(ot);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==$e.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const i=r,s=i.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,n=e.Node,o=e.Element,l=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,d=e.trustedTypes,g=o.prototype,u=He(g,"cloneNode"),m=He(g,"remove"),y=He(g,"nextSibling"),x=He(g,"childNodes"),C=He(g,"parentNode"),k=He(g,"shadowRoot"),S=He(g,"attributes"),w=n&&n.prototype?He(n.prototype,"nodeType"):null,v=n&&n.prototype?He(n.prototype,"nodeName"):null,_=n&&n.prototype?He(n.prototype,"ownerDocument"):null,E=function(B){return w?w(B):B.nodeType},F=function(B){return v?v(B):B.nodeName};if(typeof a=="function"){const ot=r.createElement("template");ot.content&&ot.content.ownerDocument&&(r=ot.content.ownerDocument)}let Y,W="",z,at=!1,j=0;const M=function(){if(j>0)throw Dr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},O=function(B){M(),j++;try{return Y.createHTML(B)}finally{j--}},L=function(B){M(),j++;try{return Y.createScriptURL(B)}finally{j--}},P=function(){return at||(z=Yy(d,s),at=!0),z},$=r,H=$.implementation,K=$.createNodeIterator,dt=$.createDocumentFragment,pt=$.getElementsByTagName,kt=i.importNode;let nt=fh();t.isSupported=typeof Id=="function"&&typeof C=="function"&&H&&H.createHTMLDocument!==void 0;const Tt=Ay,At=My,Et=Oy,Nt=$y,_t=Dy,lt=Iy,ft=Py,Mt=qy;let qt=uh,Ft=null;const N=Yt({},[...lh,...Qa,...Ja,...to,...hh]);let mt=null;const ke=Yt({},[...ch,...eo,...dh,...$s]);let re=Object.seal(ni(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ze=null,cr=null;const Te=Object.seal(ni(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Tr=!0,Se=!0,Sr=!1,dr=!0,we=!1,Oe=!0,f=!1,D=!1,V=null,Q=null,X=!1,st=!1,T=!1,R=!1,rt=!0,Z=!1;const J="user-content-";let it=!0,tt=!1,ut={},ct=null;const St=Yt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Lt=null;const Wt=Yt({},["audio","video","img","source","image","track"]);let Xt=null;const Wi=Yt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let ei=Ke,za=!1,Ha=null;const Sm=Yt({},[Ve,Ze,Ke],Ka),Rl=he(["mi","mo","mn","ms","mtext"]);let ja=Yt({},Rl);const ql=he(["annotation-xml"]);let Ya=Yt({},ql);const wm=Yt({},["title","style","font","a","script"]);let zi=null;const Bm=["application/xhtml+xml","text/html"],vm="text/html";let ie=null,ri=null;const Lm=r.createElement("form"),Nl=function(B){return B instanceof RegExp||B instanceof Function},Ua=function(){let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ri&&ri===B)return;(!B||typeof B!="object")&&(B={}),B=Ie(B),zi=Bm.indexOf(B.PARSER_MEDIA_TYPE)===-1?vm:B.PARSER_MEDIA_TYPE,ie=zi==="application/xhtml+xml"?Ka:es,Ft=Br(B,"ALLOWED_TAGS",N,{transform:ie}),mt=Br(B,"ALLOWED_ATTR",ke,{transform:ie}),Ha=Br(B,"ALLOWED_NAMESPACES",Sm,{transform:Ka}),Xt=Br(B,"ADD_URI_SAFE_ATTR",Wi,{transform:ie,base:Wi}),Lt=Br(B,"ADD_DATA_URI_TAGS",Wt,{transform:ie,base:Wt}),ct=Br(B,"FORBID_CONTENTS",St,{transform:ie}),ze=Br(B,"FORBID_TAGS",Ie({}),{transform:ie}),cr=Br(B,"FORBID_ATTR",Ie({}),{transform:ie}),ut=Ee(B,"USE_PROFILES")?B.USE_PROFILES&&typeof B.USE_PROFILES=="object"?Ie(B.USE_PROFILES):B.USE_PROFILES:!1,Tr=B.ALLOW_ARIA_ATTR!==!1,Se=B.ALLOW_DATA_ATTR!==!1,Sr=B.ALLOW_UNKNOWN_PROTOCOLS||!1,dr=B.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=B.SAFE_FOR_TEMPLATES||!1,Oe=B.SAFE_FOR_XML!==!1,f=B.WHOLE_DOCUMENT||!1,st=B.RETURN_DOM||!1,T=B.RETURN_DOM_FRAGMENT||!1,R=B.RETURN_TRUSTED_TYPE||!1,X=B.FORCE_BODY||!1,rt=B.SANITIZE_DOM!==!1,Z=B.SANITIZE_NAMED_PROPS||!1,it=B.KEEP_CONTENT!==!1,tt=B.IN_PLACE||!1,qt=_y(B.ALLOWED_URI_REGEXP)?B.ALLOWED_URI_REGEXP:uh,ei=typeof B.NAMESPACE=="string"?B.NAMESPACE:Ke,ja=ro(B,"MATHML_TEXT_INTEGRATION_POINTS",()=>Yt({},Rl)),Ya=ro(B,"HTML_INTEGRATION_POINTS",()=>Yt({},ql));const I=ro(B,"CUSTOM_ELEMENT_HANDLING",()=>ni(null));if(re=ni(null),Ee(I,"tagNameCheck")&&Nl(I.tagNameCheck)&&(re.tagNameCheck=I.tagNameCheck),Ee(I,"attributeNameCheck")&&Nl(I.attributeNameCheck)&&(re.attributeNameCheck=I.attributeNameCheck),Ee(I,"allowCustomizedBuiltInElements")&&typeof I.allowCustomizedBuiltInElements=="boolean"&&(re.allowCustomizedBuiltInElements=I.allowCustomizedBuiltInElements),de(re),we&&(Se=!1),T&&(st=!0),ut&&(Ft=Yt({},hh),mt=ni(null),ut.html===!0&&(Yt(Ft,lh),Yt(mt,ch)),ut.svg===!0&&(Yt(Ft,Qa),Yt(mt,eo),Yt(mt,$s)),ut.svgFilters===!0&&(Yt(Ft,Ja),Yt(mt,eo),Yt(mt,$s)),ut.mathMl===!0&&(Yt(Ft,to),Yt(mt,dh),Yt(mt,$s))),Te.tagCheck=null,Te.attributeCheck=null,Ee(B,"ADD_TAGS")&&(typeof B.ADD_TAGS=="function"?Te.tagCheck=B.ADD_TAGS:ui(B.ADD_TAGS)&&(Ft===N&&(Ft=Ie(Ft)),Yt(Ft,B.ADD_TAGS,ie))),Ee(B,"ADD_ATTR")&&(typeof B.ADD_ATTR=="function"?Te.attributeCheck=B.ADD_ATTR:ui(B.ADD_ATTR)&&(mt===ke&&(mt=Ie(mt)),Yt(mt,B.ADD_ATTR,ie))),Ee(B,"ADD_FORBID_CONTENTS")&&ui(B.ADD_FORBID_CONTENTS)&&(ct===St&&(ct=Ie(ct)),Yt(ct,B.ADD_FORBID_CONTENTS,ie)),it&&(Ft["#text"]=!0),f&&Yt(Ft,["html","head","body"]),Ft.table&&(Yt(Ft,["tbody"]),delete ze.tbody),B.TRUSTED_TYPES_POLICY){if(typeof B.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof B.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const et=Y;Y=B.TRUSTED_TYPES_POLICY;try{W=O("")}catch(Ct){throw Y=et,Ct}}else B.TRUSTED_TYPES_POLICY===null?(Y=void 0,W=""):(Y===void 0&&(Y=P()),Y&&typeof W=="string"&&(W=O("")));he&&he(B),ri=B},Wl=Yt({},[...Qa,...Ja,...Fy]),zl=Yt({},[...to,...Ey]),_m=function(B,I,et){return I.namespaceURI===Ke?B==="svg":I.namespaceURI===Ve?B==="svg"&&(et==="annotation-xml"||ja[et]):!!Wl[B]},Fm=function(B,I,et){return I.namespaceURI===Ke?B==="math":I.namespaceURI===Ze?B==="math"&&Ya[et]:!!zl[B]},Em=function(B,I,et){return I.namespaceURI===Ze&&!Ya[et]||I.namespaceURI===Ve&&!ja[et]?!1:!zl[B]&&(wm[B]||!Wl[B])},Am=function(B){let I=C(B);(!I||!I.tagName)&&(I={namespaceURI:ei,tagName:"template"});const et=es(B.tagName),Ct=es(I.tagName);return Ha[B.namespaceURI]?B.namespaceURI===Ze?_m(et,I,Ct):B.namespaceURI===Ve?Fm(et,I,Ct):B.namespaceURI===Ke?Em(et,I,Ct):!!(zi==="application/xhtml+xml"&&Ha[B.namespaceURI]):!1},wr=function(B){ji(t.removed,{element:B});try{C(B).removeChild(B)}catch{if(m(B),!C(B))throw Dr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Hl=function(B,I,et){try{B.removeAttributeNode(I)}catch{try{B.removeAttribute(et)}catch{}}},_s=function(B){Fs(B);const I=x(B);if(I){const Ct=[];qr(I,vt=>{ji(Ct,vt)}),qr(Ct,vt=>{try{m(vt)}catch{}})}const et=S(B);if(et)for(let Ct=et.length-1;Ct>=0;--Ct){const vt=et[Ct],Dt=vt&&vt.name;typeof Dt=="string"&&Hl(B,vt,Dt)}},$r=function(B,I,et){if(!et)try{et=I.getAttributeNode(B)}catch{et=null}ji(t.removed,{attribute:et||null,from:I});try{et?I.removeAttributeNode(et):I.removeAttribute(B)}catch{try{I.removeAttribute(B)}catch{}}if(B==="is")if(st||T)try{wr(I)}catch{}else try{I.setAttribute(B,"")}catch{}},Mm=function(B){const I=S(B);if(I)for(let et=I.length-1;et>=0;--et){const Ct=I[et],vt=Ct&&Ct.name;typeof vt!="string"||mt[ie(vt)]||Hl(B,Ct,vt)}},Fs=function(B){const I=[B];for(;I.length>0;){const et=I.pop();E(et)===$e.element&&Mm(et);const vt=x(et);if(vt)for(let Dt=vt.length-1;Dt>=0;--Dt)I.push(vt[Dt])}},jl=function(B,I){return Oe?B==="patchsrc"?!0:B==="for"&&I!=="label"&&I!=="output":!1},Om=function(B){if(!Oe)return;const I=[B];for(;I.length>0;){const et=I.pop(),Ct=E(et);if(Ct===$e.processingInstruction||Ct===$e.comment&&fe(ph,et.data)){try{m(et)}catch{}continue}if(Ct===$e.element){const Dt=et,Zt=ie(F(et));try{Dt.hasAttribute&&Dt.hasAttribute("patchsrc")&&Dt.removeAttribute("patchsrc"),Dt.hasAttribute&&Dt.hasAttribute("for")&&jl("for",Zt)&&Dt.removeAttribute("for")}catch{}}const vt=x(et);if(vt)for(let Dt=vt.length-1;Dt>=0;--Dt)I.push(vt[Dt])}},Yl=function(B){let I=null,et=null;if(X)B=""+B;else{const Dt=sh(B,/^[\r\n\t ]+/);et=Dt&&Dt[0]}zi==="application/xhtml+xml"&&ei===Ke&&(B=''+B+"");const Ct=Y?O(B):B;if(ei===Ke)try{I=new h().parseFromString(Ct,zi)}catch{}if(!I||!I.documentElement){I=H.createDocument(ei,"template",null);try{I.documentElement.innerHTML=za?W:Ct}catch{}}const vt=I.body||I.documentElement;return B&&et&&vt.insertBefore(r.createTextNode(et),vt.childNodes[0]||null),ei===Ke?pt.call(I,f?"html":"body")[0]:f?I.documentElement:vt},Ul=function(B){const I=_?_(B):B.ownerDocument;return K.call(I||B,B,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Es=function(B){return B=Yi(B,Tt," "),B=Yi(B,At," "),B=Yi(B,Et," "),B},Ga=function(B){var I;B.normalize();const et=_?_(B):B.ownerDocument,Ct=K.call(et||B,B,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let vt=Ct.nextNode();for(;vt;)vt.data=Es(vt.data),vt=Ct.nextNode();const Dt=(I=B.querySelectorAll)===null||I===void 0?void 0:I.call(B,"template");Dt&&qr(Dt,Zt=>{ii(Zt.content)&&Ga(Zt.content)})},As=function(B){const I=v?v(B):null;return typeof I!="string"||ie(I)!=="form"?!1:typeof B.nodeName!="string"||typeof B.textContent!="string"||typeof B.removeChild!="function"||B.attributes!==S(B)||typeof B.removeAttribute!="function"||typeof B.setAttribute!="function"||typeof B.namespaceURI!="string"||typeof B.insertBefore!="function"||typeof B.hasChildNodes!="function"||B.nodeType!==w(B)||B.childNodes!==x(B)},ii=function(B){if(!w||typeof B!="object"||B===null)return!1;try{return w(B)===$e.documentFragment}catch{return!1}},Hi=function(B){if(!w||typeof B!="object"||B===null)return!1;try{return typeof w(B)=="number"}catch{return!1}};function Qe(ot,B,I){ot.length!==0&&qr(ot,et=>{et.call(t,B,I,ri)})}const $m=function(B,I){return!!(Oe&&B.hasChildNodes()&&!Hi(B.firstElementChild)&&fe(gh,B.textContent)&&fe(gh,B.innerHTML)||Oe&&B.namespaceURI===Ke&&zy[I]&&(Hi(B.firstElementChild)||typeof B.textContent=="string"&&fe(Hy[I],B.textContent))||B.nodeType===$e.processingInstruction||Oe&&B.nodeType===$e.comment&&fe(ph,B.data))},Ms=function(B,I){if(B instanceof RegExp)return fe(B,I);if(B instanceof Function){for(var et=arguments.length,Ct=new Array(et>2?et-2:0),vt=2;vt=0;--Zt){const te=B===et?u(vt[Zt],!0):vt[Zt];Ct.insertBefore(te,y(B))}}}return wr(B),!0},Gl=function(B,I,et,Ct){return B.length===0?I:I===et||I===Ct?Ie(I):I},Xl=function(B,I){return B===I||C(B)!==null?!1:(tt&&Fs(B),!0)},Vl=function(B,I){if(Qe(nt.beforeSanitizeElements,B,null),Xl(B,I))return!0;if(As(B))return wr(B),!0;const et=ie(F(B));if(Ft=Gl(nt.uponSanitizeElement,Ft,N,V),Qe(nt.uponSanitizeElement,B,{tagName:et,allowedTags:Ft}),Xl(B,I))return!0;if($m(B,et))return wr(B),!0;if(ze[et]||!(Te.tagCheck instanceof Function&&Te.tagCheck(et))&&!Ft[et]){const vt=Dm(B,et,I);return vt===!1&&Qe(nt.afterSanitizeElements,B,null),vt}if(E(B)===$e.element&&!Am(B)||(et==="noscript"||et==="noembed"||et==="noframes")&&fe(Ny,B.innerHTML))return wr(B),!0;if(we&&B.nodeType===$e.text){const vt=Es(B.textContent);B.textContent!==vt&&(ji(t.removed,{element:B.cloneNode()}),B.textContent=vt)}return Qe(nt.afterSanitizeElements,B,null),!1},Zl=function(B,I,et){if(cr[I]||jl(I,B)||rt&&(I==="id"||I==="name")&&(et in r||et in Lm))return!1;const Ct=mt[I]||Te.attributeCheck instanceof Function&&Te.attributeCheck(I,B);return Se&&fe(Nt,I)||Tr&&fe(_t,I)?!0:Ct?Xt[I]||fe(qt,Yi(et,ft,""))||(I==="src"||I==="xlink:href"||I==="href")&&B!=="script"&&ah(et,"data:")===0&&Lt[B]||Sr&&!fe(lt,Yi(et,ft,""))?!0:!et:Kl(B)&&Ms(re.tagNameCheck,B)&&Ms(re.attributeNameCheck,I,B)||I==="is"&&re.allowCustomizedBuiltInElements&&Ms(re.tagNameCheck,et)},Im=Yt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Kl=function(B){return!Im[es(B)]&&fe(Mt,B)},Pm=function(B,I,et,Ct){if(Y&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!et)switch(d.getAttributeType(B,I)){case"TrustedHTML":return O(Ct);case"TrustedScriptURL":return L(Ct)}return Ct},Rm=function(B,I,et,Ct){try{et?B.setAttributeNS(et,I,Ct):B.setAttribute(I,Ct),As(B)?wr(B):ih(t.removed)}catch{$r(I,B)}},Ql=function(B){Qe(nt.beforeSanitizeAttributes,B,null);const I=B.attributes;if(!I||As(B))return;mt=Gl(nt.uponSanitizeAttribute,mt,ke,Q);const et={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:mt,forceKeepAttr:void 0};let Ct=I.length;const vt=ie(B.nodeName);for(;Ct--;){const Dt=I[Ct],Zt=Dt.name,te=Dt.namespaceURI,Le=Dt.value,_e=ie(Zt),Va=Le;let Be=Zt==="value"?Va:Ty(Va);if(et.attrName=_e,et.attrValue=Be,et.keepAttr=!0,et.forceKeepAttr=void 0,Qe(nt.uponSanitizeAttribute,B,et),Be=et.attrValue,Z&&(_e==="id"||_e==="name")&&ah(Be,J)!==0&&($r(Zt,B,Dt),Be=J+Be),Oe&&fe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){$r(Zt,B,Dt);continue}if(_e==="attributename"&&sh(Be,"href")){$r(Zt,B,Dt);continue}if(!et.forceKeepAttr){if(!et.keepAttr){$r(Zt,B,Dt);continue}if(!dr&&fe(Wy,Be)){$r(Zt,B,Dt);continue}if(we&&(Be=Es(Be)),!Zl(vt,_e,Be)){$r(Zt,B,Dt);continue}Be=Pm(vt,_e,te,Be),Be!==Va&&Rm(B,Zt,te,Be)}}Qe(nt.afterSanitizeAttributes,B,null)},Os=function(B){let I=null;const et=Ul(B);for(Qe(nt.beforeSanitizeShadowDOM,B,null);I=et.nextNode();)if(Qe(nt.uponSanitizeShadowNode,I,null),Vl(I,B),Ql(I),ii(I.content)&&Os(I.content),E(I)===$e.element){const Ct=k(I);ii(Ct)&&(Xa(Ct),Os(Ct))}Qe(nt.afterSanitizeShadowDOM,B,null)},Xa=function(B){const I=[{node:B,shadow:null}];for(;I.length>0;){const et=I.pop();if(et.shadow){Os(et.shadow);continue}const Ct=et.node,Dt=E(Ct)===$e.element,Zt=x(Ct);if(Zt)for(let te=Zt.length-1;te>=0;--te)I.push({node:Zt[te],shadow:null});if(Dt){const te=v?v(Ct):null;if(typeof te=="string"&&ie(te)==="template"){const Le=Ct.content;ii(Le)&&I.push({node:Le,shadow:null})}}if(Dt){const te=k(Ct);ii(te)&&I.push({node:null,shadow:te},{node:te,shadow:null})}}};return t.sanitize=function(ot){let B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,et=null,Ct=null,vt=null;if(za=!ot,za&&(ot=""),typeof ot!="string"&&!Hi(ot)&&(ot=Ly(ot),typeof ot!="string"))throw Dr("dirty is not a string, aborting");if(!t.isSupported)return ot;D?(Ft=V,mt=Q):Ua(B),(nt.uponSanitizeElement.length>0||nt.uponSanitizeAttribute.length>0)&&(Ft=Ie(Ft)),nt.uponSanitizeAttribute.length>0&&(mt=Ie(mt)),t.removed=[];const Dt=tt&&typeof ot!="string"&&Hi(ot);if(Dt){Om(ot);const Le=F(ot);if(typeof Le=="string"){const _e=ie(Le);if(!Ft[_e]||ze[_e])throw _s(ot),Dr("root node is forbidden and cannot be sanitized in-place")}if(As(ot))throw _s(ot),Dr("root node is clobbered and cannot be sanitized in-place");try{Xa(ot)}catch(_e){throw _s(ot),_e}}else if(Hi(ot))I=Yl(""),et=I.ownerDocument.importNode(ot,!0),et.nodeType===$e.element&&et.nodeName==="BODY"||et.nodeName==="HTML"?I=et:I.appendChild(et),Xa(et);else{if(!st&&!we&&!f&&ot.indexOf("<")===-1)return Y&&R?O(ot):ot;if(I=Yl(ot),!I)return st?null:R?W:""}I&&X&&wr(I.firstChild);const Zt=Dt?ot:I;try{const Le=Ul(Zt);for(;Ct=Le.nextNode();)Vl(Ct,Zt),Ql(Ct),ii(Ct.content)&&Os(Ct.content)}catch(Le){throw Dt&&(_s(ot),qr(t.removed,_e=>{_e.element&&Fs(_e.element)})),Le}if(Dt)return qr(t.removed,Le=>{Le.element&&Fs(Le.element)}),we&&Ga(ot),ot;if(st){if(we&&Ga(I),T)for(vt=dt.call(I.ownerDocument);I.firstChild;)vt.appendChild(I.firstChild);else vt=I;return(mt.shadowroot||mt.shadowrootmode)&&(vt=kt.call(i,vt,!0)),vt}let te=f?I.outerHTML:I.innerHTML;return f&&Ft["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&&fe(Ry,I.ownerDocument.doctype.name)&&(te=" `+te),we&&(te=Es(te)),Y&&R?O(te):te},t.setConfig=function(){let ot=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ua(ot),D=!0,V=Ft,Q=mt},t.clearConfig=function(){ri=null,D=!1,V=null,Q=null,Y=z,W=""},t.isValidAttribute=function(ot,B,I){ri||Ua({});const et=ie(ot),Ct=ie(B);return Zl(et,Ct,I)},t.addHook=function(ot,B){typeof B=="function"&&Ee(nt,ot)&&ji(nt[ot],B)},t.removeHook=function(ot,B){if(Ee(nt,ot)){if(B!==void 0){const I=by(nt[ot],B);return I===-1?void 0:ky(nt[ot],I,1)[0]}return ih(nt[ot])}},t.removeHooks=function(ot){Ee(nt,ot)&&(nt[ot]=[])},t.removeAllHooks=function(){nt=fh()},t}var Ei=qd(),Xo=p((e,t,{depth:r=2}={})=>{const i={depth:r};if(Array.isArray(t)&&!Array.isArray(e))return t.forEach(s=>Xo(e,s,i)),e;if(Array.isArray(t)&&Array.isArray(e))return t.forEach(s=>{e.includes(s)||e.push(s)}),e;if(e==null||r<=0)return e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t;if(t!=null&&typeof e=="object"&&typeof t=="object"){const s=e;Object.entries(t).forEach(([a,n])=>{if(typeof n=="object"){if(n===null)return;Object.hasOwn(e,a)||Object.defineProperty(e,a,{value:void 0,writable:!0,enumerable:!0,configurable:!0}),s[a]===void 0&&(s[a]=Array.isArray(n)?[]:{}),typeof s[a]=="object"&&(s[a]=Xo(s[a],n,{depth:r-1}))}else typeof s[a]!="object"&&(Object.hasOwn(e,a)?s[a]=n:Object.defineProperty(e,a,{value:n,writable:!0,enumerable:!0,configurable:!0}))})}return e},"assignWithDepth"),ce=Xo,or="#ffffff",nr="#f2f2f2",$t=p((e,t)=>t?b(e,{s:-40,l:10}):b(e,{s:-40,l:-10}),"mkBorder"),fi,Uy=(fi=class{constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var r,i,s,a,n,o,l,c,h,d,g,u,m,y,x,C,k,S,w,v,_,E,F,Y,W,z,at,j,M,O,L,P,$,H,K,dt,pt,kt,nt,Tt,At,Et,Nt,_t,lt,ft,Mt,qt,Ft,N;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||U(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||G(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||G(this.mainBkg,10)):(this.rowOdd=this.rowOdd||U(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||U(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let mt=0;mt{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(fi,"Theme"),fi),Gy=p(e=>{const t=new Uy;return t.calculate(e),t},"getThemeVariables"),mi,Xy=(mi=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=U(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=A(this.background),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.lineColor=A(this.background),this.textColor=A(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=U(A("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Er(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=G("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=G(this.sectionBkgColor,10),this.taskBorderColor=Er(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Er(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||U(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||G(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){var t,r,i,s,a,n,o,l,c,h,d,g,u,m,y,x,C,k,S,w,v,_,E,F,Y,W,z,at,j,M,O,L,P,$,H,K,dt,pt,kt,nt,Tt,At,Et,Nt,_t,lt,ft,Mt,qt,Ft;this.secondBkg=U(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=U(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=U(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=A(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=b(this.primaryColor,{h:64}),this.fillType3=b(this.secondaryColor,{h:64}),this.fillType4=b(this.primaryColor,{h:-64}),this.fillType5=b(this.secondaryColor,{h:-64}),this.fillType6=b(this.primaryColor,{h:128}),this.fillType7=b(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330});for(let N=0;N{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(mi,"Theme"),mi),Vy=p(e=>{const t=new Xy;return t.calculate(e),t},"getThemeVariables"),yi,Zy=(yi=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=b(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.lineColor=A(this.background),this.textColor=A(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=Er(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){var t,r,i,s,a,n,o,l,c,h,d,g,u,m,y,x,C,k,S,w,v,_,E,F,Y,W,z,at,j,M,O,L,P,$,H,K,dt,pt,kt,nt,Tt,At,Et,Nt,_t,lt,ft,Mt,qt,Ft;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||G(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||G(this.tertiaryColor,40);for(let N=0;N{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}const r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(yi,"Theme"),yi),Ky=p(e=>{const t=new Zy;return t.calculate(e),t},"getThemeVariables"),Ci,Qy=(Ci=class{constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=U("#cde498",10),this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.primaryColor),this.lineColor=A(this.background),this.textColor=A(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){var t,r,i,s,a,n,o,l,c,h,d,g,u,m,y,x,C,k,S,w,v,_,E,F,Y,W,z,at,j,M,O,L,P,$,H,K,dt,pt,kt,nt,Tt,At,Et,Nt,_t,lt,ft,Mt,qt,Ft;this.actorBorder=G(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||G(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||G(this.tertiaryColor,40);for(let N=0;N{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(Ci,"Theme"),Ci),Jy=p(e=>{const t=new Qy;return t.calculate(e),t},"getThemeVariables"),xi,tC=(xi=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=U(this.contrast,55),this.background="#ffffff",this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.lineColor=A(this.background),this.textColor=A(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||U(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){var t,r,i,s,a,n,o,l,c,h,d,g,u,m,y,x,C,k,S,w,v,_,E,F,Y,W,z,at,j,M,O,L,P,$,H,K,dt,pt,kt,nt,Tt,At,Et,Nt,_t,lt,ft,Mt,qt,Ft;this.secondBkg=U(this.contrast,55),this.border2=this.contrast,this.actorBorder=U(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let N=0;N{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(xi,"Theme"),xi),eC=p(e=>{const t=new tC;return t.calculate(e),t},"getThemeVariables"),bi,rC=(bi=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var a,n,o,l,c,h,d,g,u,m,y,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||U(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||b(t,{h:30}),this.cScale4=this.cScale4||b(t,{h:60}),this.cScale5=this.cScale5||b(t,{h:90}),this.cScale6=this.cScale6||b(t,{h:120}),this.cScale7=this.cScale7||b(t,{h:150}),this.cScale8=this.cScale8||b(t,{h:210,l:150}),this.cScale9=this.cScale9||b(t,{h:270}),this.cScale10=this.cScale10||b(t,{h:300}),this.cScale11=this.cScale11||b(t,{h:330}),this.darkMode)for(let C=0;C{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(bi,"Theme"),bi),iC=p(e=>{const t=new rC;return t.calculate(e),t},"getThemeVariables"),ki,sC=(ki=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=U(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=A(this.background),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=U(A("#323D47"),10),this.border1="#ccc",this.border2=Er(255,255,255,.25),this.arrowheadColor=A(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){var r,i,s,a,n,o,l,c,h,d,g,u;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||U(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let m=0;m{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(ki,"Theme"),ki),aC=p(e=>{const t=new sC;return t.calculate(e),t},"getThemeVariables"),Ti,oC=(Ti=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=$t("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){var a,n,o,l,c,h,d,g,u,m,y,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||U(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let C=0;C{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(Ti,"Theme"),Ti),nC=p(e=>{const t=new oC;return t.calculate(e),t},"getThemeVariables"),Si,lC=(Si=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=U(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=A(this.background),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=U(A("#323D47"),10),this.border1="#ccc",this.border2=Er(255,255,255,.25),this.arrowheadColor=A(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,n,o,l,c,h,d,g,u;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||U(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||b(this.primaryColor,{h:30}),this.cScale4=this.cScale4||b(this.primaryColor,{h:60}),this.cScale5=this.cScale5||b(this.primaryColor,{h:90}),this.cScale6=this.cScale6||b(this.primaryColor,{h:120}),this.cScale7=this.cScale7||b(this.primaryColor,{h:150}),this.cScale8=this.cScale8||b(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||b(this.primaryColor,{h:270}),this.cScale10=this.cScale10||b(this.primaryColor,{h:300}),this.cScale11=this.cScale11||b(this.primaryColor,{h:330}),this.darkMode)for(let m=0;m{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(Si,"Theme"),Si),hC=p(e=>{const t=new lC;return t.calculate(e),t},"getThemeVariables"),wi,cC=(wi=class{constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=$t(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){var a,n,o,l,c,h,d,g,u,m,y,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const t="#ECECFE",r="#E9E9F1",i=b(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||U(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let C=0;C{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(wi,"Theme"),wi),dC=p(e=>{const t=new cC;return t.calculate(e),t},"getThemeVariables"),Bi,uC=(Bi=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=U(this.primaryColor,16),this.tertiaryColor=b(this.primaryColor,{h:-160}),this.primaryBorderColor=A(this.background),this.secondaryBorderColor=$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=$t(this.tertiaryColor,this.darkMode),this.primaryTextColor=A(this.primaryColor),this.secondaryTextColor=A(this.secondaryColor),this.tertiaryTextColor=A(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=U(A("#323D47"),10),this.border1="#ccc",this.border2=Er(255,255,255,.25),this.arrowheadColor=A(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){var r,i,s,a,n,o,l,c,h,d,g,u;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||b(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||b(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||$t(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||$t(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||$t(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||$t(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||A(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||A(this.tertiaryColor),this.lineColor=this.lineColor||A(this.background),this.arrowheadColor=this.arrowheadColor||A(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?G(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||G(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||A(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||U(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let m=0;m{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},p(Bi,"Theme"),Bi),gC=p(e=>{const t=new uC;return t.calculate(e),t},"getThemeVariables"),mr={base:{getThemeVariables:Gy},dark:{getThemeVariables:Vy},default:{getThemeVariables:Ky},forest:{getThemeVariables:Jy},neutral:{getThemeVariables:eC},neo:{getThemeVariables:iC},"neo-dark":{getThemeVariables:aC},redux:{getThemeVariables:nC},"redux-dark":{getThemeVariables:hC},"redux-color":{getThemeVariables:dC},"redux-dark-color":{getThemeVariables:gC}},ue={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,showLegend:!0,legendFontSize:14,legendPadding:10,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Nd={...ue,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",nodePlacementAlignment:"NONE",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES",keepEntryNodeOnTop:!1},themeCSS:void 0,themeVariables:mr.default.getThemeVariables(),sequence:{...ue.sequence,messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:p(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:p(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{defaultRenderer:"dagre-wrapper",hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...ue.gantt,tickInterval:void 0,useWidth:void 0},c4:{...ue.c4,useWidth:void 0,personFont:p(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...ue.flowchart,inheritDir:!1},external_personFont:p(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:p(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:p(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:p(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:p(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:p(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:p(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:p(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:p(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:p(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:p(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:p(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:p(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:p(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:p(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:p(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:p(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:p(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:p(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:p(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...ue.pie,useWidth:984},xyChart:{...ue.xyChart,useWidth:void 0},requirement:{...ue.requirement,useWidth:void 0},packet:{...ue.packet},eventmodeling:{...ue.eventmodeling},treeView:{...ue.treeView,useWidth:void 0},radar:{...ue.radar},railroad:{...ue.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...ue.ishikawa},sankey:{...ue.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...ue.venn},cynefin:{...ue.cynefin}},Wd=p((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Wd(e[i],"")]:[...r,t+i],[]),"keyify"),pC=new Set(Wd(Nd,"")),zd=Nd,fC={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},mC=p((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(q.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),sa=p(e=>{if(q.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>sa(t));return}for(const t of Object.keys(e)){if(q.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!pC.has(t)||e[t]==null){q.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=fC[t];i?mC(e[t],i):(q.debug("sanitizing object",t),sa(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(q.debug("sanitizing css option",t),e[t]=Hd(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}q.debug("After sanitization",e)}},"sanitizeDirective"),Hd=p(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),Ae=ce({},Ai),aa,jr=[],hs=ce({},Ai),ks=p((e,t)=>{let r=ce({},e),i={};for(const s of t)Ud(s),i=ce(i,s);if(r=ce(r,i),i.theme&&i.theme in mr){const s=ce({},aa),a=ce(s.themeVariables||{},i.themeVariables);r.theme&&r.theme in mr&&(r.themeVariables=mr[r.theme].getThemeVariables(a))}return hs=r,TC(hs),hs},"updateCurrentConfig"),yC=p(e=>(Ae=ce({},Ai),Ae=ce(Ae,e),e.theme&&mr[e.theme]&&(Ae.themeVariables=mr[e.theme].getThemeVariables(e.themeVariables)),ks(Ae,jr),Ae),"setSiteConfig"),CC=p(e=>{aa=ce({},e)},"saveConfigFromInitialize"),xC=p(e=>(Ae=ce(Ae,e),ks(Ae,jr),Ae),"updateSiteConfig"),jd=p(()=>ce({},Ae),"getSiteConfig"),Yd=p(e=>(ks(hs,[e]),Jt()),"setConfig"),Jt=p(()=>ce({},hs),"getConfig"),Ud=p(e=>{e&&(["secure",...Ae.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(q.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Ud(e[t])}))},"sanitize"),bC=p(e=>{var t;sa(e),e.fontFamily&&!((t=e.themeVariables)!=null&&t.fontFamily)&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),jr.push(e),ks(Ae,jr)},"addDirective"),oa=p((e=Ae)=>{jr=[],ks(e,jr)},"reset"),kC={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},mh={},Gd=p(e=>{mh[e]||(q.warn(kC[e]),mh[e]=!0)},"issueWarning"),TC=p(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Gd("LAZY_LOAD_DEPRECATED")},"checkConfig"),xL=p(()=>{let e={};aa&&(e=ce(e,aa));for(const t of jr)e=ce(e,t);return e},"getUserDefinedConfig"),xe=p(e=>{var t,r;return((t=e.flowchart)==null?void 0:t.htmlLabels)!=null&&Gd("FLOWCHART_HTML_LABELS_DEPRECATED"),lr(e.htmlLabels??((r=e.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),Xd=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,cs=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,SC=/\s*%%.*\n/gm,vi,Vd=(vi=class extends Error{constructor(t){super(t),this.name="UnknownDiagramError"}},p(vi,"UnknownDiagramError"),vi),Yr={},_n=p(function(e,t){e=e.replace(Xd,"").replace(cs,"").replace(SC,` `);for(const[r,{detector:i}]of Object.entries(Yr))if(i(e,t))return r;throw new Vd(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),Vo=p((...e)=>{for(const{id:t,detector:r,loader:i}of e)Zd(t,r,i)},"registerLazyLoadedDiagrams"),Zd=p((e,t,r)=>{Yr[e]&&q.warn(`Detector with key ${e} already exists. Overwriting.`),Yr[e]={detector:t,loader:r},q.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),wC=p(e=>Yr[e].loader,"getDiagramLoader"),Ts=//gi,BC=p(e=>e?Jd(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),vC=(()=>{let e=!1;return()=>{e||(Kd(),e=!0)}})();function Kd(){const e="data-temp-href-target";Ei.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Ei.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}p(Kd,"setupDompurifyHooks");var Qd=p(e=>(vC(),Ei.sanitize(e)),"removeScript"),yh=p((e,t)=>{if(xe(t)){const r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Qd(e):r!=="loose"&&(e=Jd(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=EC(e))}return e},"sanitizeMore"),qe=p((e,t)=>e&&(t.dompurifyConfig?e=Ei.sanitize(yh(e,t),t.dompurifyConfig).toString():e=Ei.sanitize(yh(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),LC=p((e,t)=>typeof e=="string"?qe(e,t):e.flat().map(r=>qe(r,t)),"sanitizeTextOrArray"),_C=p(e=>Ts.test(e),"hasBreaks"),FC=p(e=>e.split(Ts),"splitBreaks"),EC=p(e=>e.replace(/#br#/g,"
"),"placeholderToBreak"),Jd=p(e=>e.replace(Ts,"#br#"),"breakToPlaceholder"),AC=p(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),MC=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),OC=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),Ch=p(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),$C=p((e,t)=>{const r=Zo(e,"~"),i=Zo(t,"~");return r===1&&i===1},"shouldCombineSets"),DC=p(e=>{const t=Zo(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let s=i.indexOf("~"),a=i.lastIndexOf("~");for(;s!==-1&&a!==-1&&s!==a;)i[s]="<",i[a]=">",s=i.indexOf("~"),a=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),xh=p(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Ko=/\$\$(.*?)\$\$/g,ps=p(e=>{var t;return(((t=e.match(Ko))==null?void 0:t.length)??0)>0},"hasKatex"),bL=p(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await tu(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0";const i=document.querySelector("body");i==null||i.insertAdjacentElement("beforeend",r);const s={width:r.clientWidth,height:r.clientHeight};return r.remove(),s},"calculateMathMLDimensions"),IC=p(async(e,t)=>{if(!ps(e))return e;if(!(xh()||t.legacyMathML||t.forceLegacyMathML))return e.replace(Ko,"MathML is unsupported in this environment.");{const{default:r}=await Rt(async()=>{const{default:s}=await import("./katex-C5jXJg4s.js");return{default:s}},[]),i=t.forceLegacyMathML||!xh()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(Ts).map(s=>ps(s)?`
${s}
`:`
${s}
`).join("").replace(Ko,(s,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),tu=p(async(e,t)=>qe(await IC(e,t),t),"renderKatexSanitized"),Ss={getRows:BC,sanitizeText:qe,sanitizeTextOrArray:LC,hasBreaks:_C,splitBreaks:FC,lineBreakRegex:Ts,removeScript:Qd,getUrl:AC,evaluate:lr,getMax:MC,getMin:OC},PC=p(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),RC=p(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),eu=p(function(e,t,r,i){const s=RC(t,r,i);PC(e,s)},"configureSvgSize"),qC=p(function(e,t,r,i){const s=t.node().getBBox(),a=s.width,n=s.height;q.info(`SVG bounds: ${a}x${n}`,s);let o=0,l=0;q.info(`Graph bounds: ${o}x${l}`,e),o=a+r*2,l=n+r*2,q.info(`Calculated bounds: ${o}x${l}`),eu(t,l,o,i);const c=`${s.x-r} ${s.y-r} ${s.width+2*r} ${s.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Ks={};function Qo(e){return[...e.cssRules].map(t=>t.cssText).join(` @@ -267,7 +267,7 @@ ${a.join(` L0,20`)},"requirement_arrow"),Lk=p((e,t,r)=>{const i=Jt(),{themeVariables:s}=i,{strokeWidth:a}=s;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),_k=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Fk=p((e,t,r)=>{const i=Jt(),{themeVariables:s}=i,{strokeWidth:a}=s,n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),n.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Ek={extension:lk,composition:hk,aggregation:ck,dependency:dk,lollipop:uk,point:gk,circle:pk,cross:fk,barb:mk,barbNeo:yk,only_one:Ck,zero_or_one:xk,one_or_more:bk,zero_or_more:kk,only_one_neo:Tk,zero_or_one_neo:Sk,one_or_more_neo:wk,zero_or_more_neo:Bk,requirement_arrow:vk,requirement_contains:_k,requirement_arrow_neo:Lk,requirement_contains_neo:Fk},Lp=nk,_p=typeof global=="object"&&global&&global.Object===Object&&global,Ak=typeof self=="object"&&self&&self.Object===Object&&self,xr=_p||Ak||Function("return this")(),ar=xr.Symbol,Fp=Object.prototype,Mk=Fp.hasOwnProperty,Ok=Fp.toString,Ji=ar?ar.toStringTag:void 0;function $k(e){var t=Mk.call(e,Ji),r=e[Ji];try{e[Ji]=void 0;var i=!0}catch{}var s=Ok.call(e);return i&&(t?e[Ji]=r:delete e[Ji]),s}var Dk=Object.prototype,Ik=Dk.toString;function Pk(e){return Ik.call(e)}var Rk="[object Null]",qk="[object Undefined]",pc=ar?ar.toStringTag:void 0;function Pi(e){return e==null?e===void 0?qk:Rk:pc&&pc in Object(e)?$k(e):Pk(e)}function Xr(e){return e!=null&&typeof e=="object"}var Nk="[object Symbol]";function al(e){return typeof e=="symbol"||Xr(e)&&Pi(e)==Nk}function Ep(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=a1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function os(e){return function(){return e}}var Cc=(function(){try{var e=ti(Object,"defineProperty");return e({},"",{}),e}catch{}})(),h1=Cc?function(e,t){return Cc(e,"toString",{configurable:!0,enumerable:!1,value:os(t),writable:!0})}:Aa,c1=l1(h1);function d1(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var y1=9007199254740991,C1=/^(?:0|[1-9]\d*)$/;function Mp(e,t){var r=typeof e;return t=t??y1,!!t&&(r=="number"||r!="symbol"&&C1.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=k1}function Ma(e){return e!=null&&nl(e.length)&&!Ca(e)}var T1=Object.prototype;function $p(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||T1;return e===r}function S1(e,t){for(var r=-1,i=Array(e);++r-1}function F2(e,t){var r=this.__data__,i=$a(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function br(e){var t=-1,r=e==null?0:e.length;for(this.clear();++to))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var d=-1,g=!0,u=r&fT?new ys:void 0;for(a.set(e,t),a.set(t,e);++d=pS){var c=gS(e);if(c)return dl(c);n=!1,s=Hp,l=new ys}else l=o;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Rr,this._children[t]={},this._children[Rr][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.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],Pr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),Pr(rr(this._in[t]),r),delete this._in[t],delete this._preds[t],Pr(rr(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ci(r))r=Rr;else{r+="";for(var i=r;!ci(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==Rr)return r}}children(t){if(ci(t)&&(t=Rr),this._isCompound){var r=this._children[t];if(r)return rr(r)}else{if(t===Rr)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return rr(r)}successors(t){var r=this._sucs[t];if(r)return rr(r)}neighbors(t){var r=this.predecessors(t);if(r)return mS(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;Pr(this._nodes,function(n,o){t(o)&&r.setNode(o,n)}),Pr(this._edgeObjs,function(n){r.hasNode(n.v)&&r.hasNode(n.w)&&r.setEdge(n,i.edge(n))});var s={};function a(n){var o=i.parent(n);return o===void 0||r.hasNode(o)?(s[n]=o,o):o in s?s[o]:a(o)}return this._isCompound&&Pr(r.nodes(),function(n){r.setParent(n,a(n))}),r}setDefaultEdgeLabel(t){return Ca(t)||(t=os(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Co(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return dS(t,function(a,n){return s.length>1?i.setEdge(a,n,r):i.setEdge(a,n),n}),this}setEdge(){var t,r,i,s,a=!1,n=arguments[0];typeof n=="object"&&n!==null&&"v"in n?(t=n.v,r=n.w,i=n.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=n,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,ci(i)||(i=""+i);var o=ns(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=s),this;if(!ci(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[o]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=CS(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,Nc(this._preds[r],t),Nc(this._sucs[t],r),this._in[r][o]=l,this._out[t][o]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Wc(this._preds[r],t),Wc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=Co(i);return r?Hs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=Co(i);return r?Hs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}Pa.prototype._nodeCount=0;Pa.prototype._edgeCount=0;function Nc(e,t){e[t]?e[t]++:e[t]=1}function Wc(e,t){--e[t]||delete e[t]}function ns(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var n=s;s=a,a=n}return s+qc+a+qc+(ci(i)?yS:i)}function CS(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var n=s;s=a,a=n}var o={v:s,w:a};return i&&(o.name=i),o}function xo(e,t){return ns(e,t.v,t.w,t.name)}function Xp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),n=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:n,rootGroups:r}}p(Xp,"createLayoutElementGroups");async function Vp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await wt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}p(Vp,"measureGroupLabel");async function Zp(e,t,r){var a;const i=await il(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}p(Zp,"insertMeasuredNode");async function Kp(e,t){const r=new Pa({multigraph:!0,compound:!0}),i=[...t.edges],s=zt(),a=Xp(e),{edgeLabels:n,nodes:o}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await Vp(o,h),r.setNode(h.id,{...h});else{if(c){const d=await Zp(o,h,{config:s,dir:h.dir});l.set(h.id,d)}r.setNode(h.id,{...h})}}));for(const h of i)c&&Tp(h)&&await sl(n,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(g=>g.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Rt(async()=>{const{captureNodeSizes:d}=await import("./sizeCapture-INFHLROL-DhKNPmyb.js");return{captureNodeSizes:d}},__vite__mapDeps([0,1,2,3,4,5]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}p(Kp,"createGraphWithElements");var Ht=new Map,zr=new Map,Qp=new Map,xS=p(()=>{zr.clear(),Qp.clear(),Ht.clear()},"clear"),Cs=p((e,t)=>{const r=zr.get(t)||[];return q.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),bS=p((e,t)=>{const r=zr.get(t)||[];return q.info("Descendants of ",t," is ",r),q.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||Cs(e.v,t)||Cs(e.w,t)||r.includes(e.w):(q.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Jp=p((e,t,r,i)=>{q.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),q.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Jp(a,t,r,i);else{const n=t.node(a);q.info("cp ",a," to ",i," with parent ",e),r.setNode(a,n),i!==t.parent(a)&&(q.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(q.debug("Setting parent",a,e),r.setParent(a,e)):(q.info("In copy ",e,"root",i,"data",t.node(e),i),q.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const o=t.edges(a);q.debug("Copying Edges",o),o.forEach(l=>{q.info("Edge",l);const c=t.edge(l.v,l.w,l.name);q.info("Edge data",c,i);try{bS(l,i)?(q.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),q.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):q.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){q.error(h)}})}q.debug("Removing node",a),t.removeNode(a)})},"copy"),tf=p((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)Qp.set(s,e),i=[...i,...tf(s,t)];return i},"extractDescendants"),kS=p((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),n=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>n.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ba=p((e,t,r)=>{const i=t.children(e);if(q.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const n=ba(a,t,r),o=kS(t,r,n);if(n)if(o.length>0)s=n;else return n}return s},"findNonClusterChild"),zc=p(e=>!Ht.has(e)||!Ht.get(e).externalConnections?e:Ht.has(e)?Ht.get(e).id:e,"getAnchorId"),EL=p((e,t)=>{var r;if(!e||t>10){q.debug("Opting out, no graph ");return}else q.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(q.debug("Cluster identified",i," Replacement id in edges: ",ba(i,e,i)),zr.set(i,tf(i,e)),Ht.set(i,{id:ba(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(q.debug("Cluster identified",i,zr),a.forEach(n=>{const o=Cs(n.v,i),l=Cs(n.w,i);o^l&&(q.debug("Edge: ",n," leaves cluster ",i),q.debug("Descendants of XXX ",i,": ",zr.get(i)),Ht.get(i).externalConnections=!0)})):q.debug("Not a cluster ",i,zr)});for(let i of Ht.keys()){const s=Ht.get(i).id,a=e.parent(s);a!==i&&Ht.has(a)&&!Ht.get(a).externalConnections&&(Ht.get(i).id=a);const n=e.edges().some(o=>o.v===i);if(s&&((r=Ht.get(i))!=null&&r.externalConnections)&&n&&sf(e,s,i)){const o=TS(e,i,e.parent(s));o&&(Ht.get(i).id=o)}}e.edges().forEach(function(i){const s=e.edge(i);q.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),q.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,n=i.w;if(q.debug("Fix XXX",Ht,"ids:",i.v,i.w,"Translating: ",Ht.get(i.v)," --- ",Ht.get(i.w)),Ht.get(i.v)||Ht.get(i.w)){if(q.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=zc(i.v),n=zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const o=e.parent(a);Ht.get(o).externalConnections=!0,s.fromCluster=i.v}if(n!==i.w){const o=e.parent(n);Ht.get(o).externalConnections=!0,s.toCluster=i.w}q.debug("Fix Replacing with XXX",a,n,i.name),e.setEdge(a,n,s,i.name)}}),ef(e,0),q.trace(Ht)},"adjustClustersAndEdges"),ef=p((e,t)=>{var s,a;if(t>10){q.error("Bailing out");return}let r=e.nodes(),i=!1;for(const n of r){const o=e.children(n);i=i||o.length>0}if(!i){q.debug("Done, no node has children",e.nodes());return}q.debug("Nodes = ",r,t);for(const n of r)if(q.debug("Extracting node",n,Ht,Ht.has(n)&&!Ht.get(n).externalConnections,!e.parent(n),e.node(n),e.children("D")," Depth ",t),!Ht.has(n))q.debug("Not a cluster",n,t);else if(!Ht.get(n).externalConnections&&e.children(n)&&e.children(n).length>0){q.debug("Cluster without external connections, without a parent and with children",n,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Ht.get(n))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Ht.get(n).clusterData.dir,q.debug("Fixing dir",Ht.get(n).clusterData.dir,l));const c=new Pa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Jp(n,e,c,n),e.setNode(n,{clusterNode:!0,id:n,clusterData:Ht.get(n).clusterData,label:Ht.get(n).label,graph:c})}else q.debug("Cluster ** ",n," **not meeting the criteria !externalConnections:",!Ht.get(n).externalConnections," no parent: ",!e.parent(n)," children ",e.children(n)&&e.children(n).length>0,e.children("D"),t),q.debug(Ht);r=e.nodes(),q.debug("New list of nodes",r);for(const n of r){const o=e.node(n);q.debug(" Now next level",n,o),o!=null&&o.clusterNode&&ef(o.graph,t+1)}},"extractor"),rf=p((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=rf(e,s);r=[...r,...a]}),r},"sorter"),AL=p(e=>rf(e,e.children()),"sortNodesByHierarchy"),sf=p((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Ht.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),TS=p((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||Cs(s,r))continue;const a=ba(s,e,t);if(a&&!sf(e,a,t))return a}return null},"findSafeAnchorNode");function af({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const n=t??fl;return p(async function(l,c,h,d){const g=c.select("g");((h==null?void 0:h.insertMarkers)??Lp)(g,l.markers,l.type,l.diagramId),pl();const u={element:g,helpers:h,options:d};u.preparedLayout=await(e==null?void 0:e(l,u));const m=await n(l,u),y=await r(l,u),x={...u,measure:m};i?await i(l,x,y):await ml(l,x,a),await(s==null?void 0:s(l,x,y))},"render")}p(af,"createCommonLayoutRenderer");function pl(){Nb(),tk(),Xb(),xS()}p(pl,"clearLayoutRenderState");async function fl(e,{element:t}){return await Kp(t,e)}p(fl,"defaultMeasureLayout");async function ml(e,t,r={}){var n,o;const{measure:i}=t,{groups:s}=i;for(const l of((n=r.getNodes)==null?void 0:n.call(r,e,t))??e.nodes)(o=r.skipNode)!=null&&o.call(r,l,t)||await of(s,l,t,r);const a=lf(e.nodes);for(const l of e.edges)hf(l,r)||await cf(s,l,a,e,r,t)}p(ml,"paintLayoutData");async function of(e,t,r,i){t.clusterNode?hc(t):nf(t,r,i)?await kp(e.clusters,t):hc(t)}p(of,"paintLayoutNode");function nf(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}p(nf,"shouldPaintAsCluster");function lf(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}p(lf,"buildNodeLookup");function hf(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}p(hf,"shouldSkipPaintEdge");async function cf(e,t,r,i,s,a){const n=wp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,xn(t.start,t,r,a,s),xn(t.end,t,r,a,s),i.diagramId,df(t,s));Tp(t)&&(Mi.has(t.id)||await sl(e.edgeLabels,t),uf(t,n))}p(cf,"paintLayoutEdge");function xn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}p(xn,"getRenderedNode");function df(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}p(df,"shouldSkipIntersect");function uf(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Jt(),{subGraphTitleTotalMargin:s}=Fa({flowchart:i.flowchart??{}});if(e.label){const a=Mi.get(e.id);let n=e.x,o=e.y;if(r){const l=Ce.calcLabelPosition(r);q.debug("Moving label "+e.label+" from (",n,",",o,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(n=l.x,o=l.y)}a.attr("transform",`translate(${n}, ${o+s/2})`)}if(e!=null&&e.startLabelLeft){const a=se.get(e.id).startLeft;let n=e==null?void 0:e.x,o=e==null?void 0:e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.startLabelRight){const a=se.get(e.id).startRight;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.endLabelLeft){const a=se.get(e.id).endLeft;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.endLabelRight){const a=se.get(e.id).endRight;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}}p(uf,"positionRenderedEdgeLabel");function gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}p(gf,"getDefaultExportFromCjs");var pe={},js={},vr={},Hc;function Ri(){if(Hc)return vr;Hc=1;function e(n){return typeof n>"u"||n===null}p(e,"isNothing");function t(n){return typeof n=="object"&&n!==null}p(t,"isObject");function r(n){return Array.isArray(n)?n:e(n)?[]:[n]}p(r,"toArray");function i(n,o){if(o){const l=Object.keys(o);for(let c=0,h=l.length;c{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Fk=p((e,t,r)=>{const i=Jt(),{themeVariables:s}=i,{strokeWidth:a}=s,n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),n.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Ek={extension:lk,composition:hk,aggregation:ck,dependency:dk,lollipop:uk,point:gk,circle:pk,cross:fk,barb:mk,barbNeo:yk,only_one:Ck,zero_or_one:xk,one_or_more:bk,zero_or_more:kk,only_one_neo:Tk,zero_or_one_neo:Sk,one_or_more_neo:wk,zero_or_more_neo:Bk,requirement_arrow:vk,requirement_contains:_k,requirement_arrow_neo:Lk,requirement_contains_neo:Fk},Lp=nk,_p=typeof global=="object"&&global&&global.Object===Object&&global,Ak=typeof self=="object"&&self&&self.Object===Object&&self,xr=_p||Ak||Function("return this")(),ar=xr.Symbol,Fp=Object.prototype,Mk=Fp.hasOwnProperty,Ok=Fp.toString,Ji=ar?ar.toStringTag:void 0;function $k(e){var t=Mk.call(e,Ji),r=e[Ji];try{e[Ji]=void 0;var i=!0}catch{}var s=Ok.call(e);return i&&(t?e[Ji]=r:delete e[Ji]),s}var Dk=Object.prototype,Ik=Dk.toString;function Pk(e){return Ik.call(e)}var Rk="[object Null]",qk="[object Undefined]",pc=ar?ar.toStringTag:void 0;function Pi(e){return e==null?e===void 0?qk:Rk:pc&&pc in Object(e)?$k(e):Pk(e)}function Xr(e){return e!=null&&typeof e=="object"}var Nk="[object Symbol]";function al(e){return typeof e=="symbol"||Xr(e)&&Pi(e)==Nk}function Ep(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r0){if(++t>=a1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function os(e){return function(){return e}}var Cc=(function(){try{var e=ti(Object,"defineProperty");return e({},"",{}),e}catch{}})(),h1=Cc?function(e,t){return Cc(e,"toString",{configurable:!0,enumerable:!1,value:os(t),writable:!0})}:Aa,c1=l1(h1);function d1(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}var y1=9007199254740991,C1=/^(?:0|[1-9]\d*)$/;function Mp(e,t){var r=typeof e;return t=t??y1,!!t&&(r=="number"||r!="symbol"&&C1.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=k1}function Ma(e){return e!=null&&nl(e.length)&&!Ca(e)}var T1=Object.prototype;function $p(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||T1;return e===r}function S1(e,t){for(var r=-1,i=Array(e);++r-1}function F2(e,t){var r=this.__data__,i=$a(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function br(e){var t=-1,r=e==null?0:e.length;for(this.clear();++to))return!1;var c=a.get(e),h=a.get(t);if(c&&h)return c==t&&h==e;var d=-1,g=!0,u=r&fT?new ys:void 0;for(a.set(e,t),a.set(t,e);++d=pS){var c=gS(e);if(c)return dl(c);n=!1,s=Hp,l=new ys}else l=o;t:for(;++i1?s.setNode(a,r):s.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Rr,this._children[t]={},this._children[Rr][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.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=i=>this.removeEdge(this._edgeObjs[i]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],Pr(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),Pr(rr(this._in[t]),r),delete this._in[t],delete this._preds[t],Pr(rr(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ci(r))r=Rr;else{r+="";for(var i=r;!ci(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==Rr)return r}}children(t){if(ci(t)&&(t=Rr),this._isCompound){var r=this._children[t];if(r)return rr(r)}else{if(t===Rr)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return rr(r)}successors(t){var r=this._sucs[t];if(r)return rr(r)}neighbors(t){var r=this.predecessors(t);if(r)return mS(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;Pr(this._nodes,function(n,o){t(o)&&r.setNode(o,n)}),Pr(this._edgeObjs,function(n){r.hasNode(n.v)&&r.hasNode(n.w)&&r.setEdge(n,i.edge(n))});var s={};function a(n){var o=i.parent(n);return o===void 0||r.hasNode(o)?(s[n]=o,o):o in s?s[o]:a(o)}return this._isCompound&&Pr(r.nodes(),function(n){r.setParent(n,a(n))}),r}setDefaultEdgeLabel(t){return Ca(t)||(t=os(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Co(this._edgeObjs)}setPath(t,r){var i=this,s=arguments;return dS(t,function(a,n){return s.length>1?i.setEdge(a,n,r):i.setEdge(a,n),n}),this}setEdge(){var t,r,i,s,a=!1,n=arguments[0];typeof n=="object"&&n!==null&&"v"in n?(t=n.v,r=n.w,i=n.name,arguments.length===2&&(s=arguments[1],a=!0)):(t=n,r=arguments[1],i=arguments[3],arguments.length>2&&(s=arguments[2],a=!0)),t=""+t,r=""+r,ci(i)||(i=""+i);var o=ns(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=s),this;if(!ci(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[o]=a?s:this._defaultEdgeLabelFn(t,r,i);var l=CS(this._isDirected,t,r,i);return t=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,Nc(this._preds[r],t),Nc(this._sucs[t],r),this._in[r][o]=l,this._out[t][o]=l,this._edgeCount++,this}edge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i);return this._edgeLabels[s]}hasEdge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,s)}removeEdge(t,r,i){var s=arguments.length===1?xo(this._isDirected,arguments[0]):ns(this._isDirected,t,r,i),a=this._edgeObjs[s];return a&&(t=a.v,r=a.w,delete this._edgeLabels[s],delete this._edgeObjs[s],Wc(this._preds[r],t),Wc(this._sucs[t],r),delete this._in[r][s],delete this._out[t][s],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var s=Co(i);return r?Hs(s,function(a){return a.v===r}):s}}outEdges(t,r){var i=this._out[t];if(i){var s=Co(i);return r?Hs(s,function(a){return a.w===r}):s}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}}Pa.prototype._nodeCount=0;Pa.prototype._edgeCount=0;function Nc(e,t){e[t]?e[t]++:e[t]=1}function Wc(e,t){--e[t]||delete e[t]}function ns(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var n=s;s=a,a=n}return s+qc+a+qc+(ci(i)?yS:i)}function CS(e,t,r,i){var s=""+t,a=""+r;if(!e&&s>a){var n=s;s=a,a=n}var o={v:s,w:a};return i&&(o.name=i),o}function xo(e,t){return ns(e,t.v,t.w,t.name)}function Xp(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),s=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),n=r.insert("g").attr("class","nodes");return{clusters:i,edgePaths:s,edgeLabels:a,nodes:n,rootGroups:r}}p(Xp,"createLayoutElementGroups");async function Vp(e,t){if(t.label){const{shapeSvg:r,bbox:i}=await wt(e,t);t.labelBBox={width:i.width,height:i.height},r.remove()}else t.labelBBox={width:0,height:0}}p(Vp,"measureGroupLabel");async function Zp(e,t,r){var a;const i=await il(e,t,r),s=((a=i.node())==null?void 0:a.getBBox())??{width:0,height:0};return t.width=s.width,t.height=s.height,i}p(Zp,"insertMeasuredNode");async function Kp(e,t){const r=new Pa({multigraph:!0,compound:!0}),i=[...t.edges],s=zt(),a=Xp(e),{edgeLabels:n,nodes:o}=a,l=new Map,c=e.node()!=null;await Promise.all(t.nodes.map(async h=>{if(h.isGroup)c&&await Vp(o,h),r.setNode(h.id,{...h});else{if(c){const d=await Zp(o,h,{config:s,dir:h.dir});l.set(h.id,d)}r.setNode(h.id,{...h})}}));for(const h of i)c&&Tp(h)&&await sl(n,h),r.setEdge(h.start,h.end,{...h},h.id),t.edges.some(g=>g.id===h.id)||t.edges.push(h);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:h}=await Rt(async()=>{const{captureNodeSizes:d}=await import("./sizeCapture-INFHLROL-DUGUyLSa.js");return{captureNodeSizes:d}},__vite__mapDeps([0,1,2,3,4,5]));h(e,t)}return{graph:r,groups:a,nodeElements:l}}p(Kp,"createGraphWithElements");var Ht=new Map,zr=new Map,Qp=new Map,xS=p(()=>{zr.clear(),Qp.clear(),Ht.clear()},"clear"),Cs=p((e,t)=>{const r=zr.get(t)||[];return q.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),bS=p((e,t)=>{const r=zr.get(t)||[];return q.info("Descendants of ",t," is ",r),q.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||Cs(e.v,t)||Cs(e.w,t)||r.includes(e.w):(q.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),Jp=p((e,t,r,i)=>{q.debug("Copying children of ",e,"root",i,"data",t.node(e),i);const s=t.children(e)||[];e!==i&&s.push(e),q.debug("Copying (nodes) clusterId",e,"nodes",s),s.forEach(a=>{if(t.children(a).length>0)Jp(a,t,r,i);else{const n=t.node(a);q.info("cp ",a," to ",i," with parent ",e),r.setNode(a,n),i!==t.parent(a)&&(q.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(q.debug("Setting parent",a,e),r.setParent(a,e)):(q.info("In copy ",e,"root",i,"data",t.node(e),i),q.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));const o=t.edges(a);q.debug("Copying Edges",o),o.forEach(l=>{q.info("Edge",l);const c=t.edge(l.v,l.w,l.name);q.info("Edge data",c,i);try{bS(l,i)?(q.info("Copying as ",l.v,l.w,c,l.name),r.setEdge(l.v,l.w,c,l.name),q.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):q.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",i," clusterId:",e)}catch(h){q.error(h)}})}q.debug("Removing node",a),t.removeNode(a)})},"copy"),tf=p((e,t)=>{const r=t.children(e);let i=[...r];for(const s of r)Qp.set(s,e),i=[...i,...tf(s,t)];return i},"extractDescendants"),kS=p((e,t,r)=>{const i=e.edges().filter(l=>l.v===t||l.w===t),s=e.edges().filter(l=>l.v===r||l.w===r),a=i.map(l=>({v:l.v===t?r:l.v,w:l.w===t?t:l.w})),n=s.map(l=>({v:l.v,w:l.w}));return a.filter(l=>n.some(c=>l.v===c.v&&l.w===c.w))},"findCommonEdges"),ba=p((e,t,r)=>{const i=t.children(e);if(q.trace("Searching children of id ",e,i),i.length<1)return e;let s;for(const a of i){const n=ba(a,t,r),o=kS(t,r,n);if(n)if(o.length>0)s=n;else return n}return s},"findNonClusterChild"),zc=p(e=>!Ht.has(e)||!Ht.get(e).externalConnections?e:Ht.has(e)?Ht.get(e).id:e,"getAnchorId"),EL=p((e,t)=>{var r;if(!e||t>10){q.debug("Opting out, no graph ");return}else q.debug("Opting in, graph ");e.nodes().forEach(function(i){e.children(i).length>0&&(q.debug("Cluster identified",i," Replacement id in edges: ",ba(i,e,i)),zr.set(i,tf(i,e)),Ht.set(i,{id:ba(i,e,i),clusterData:e.node(i)}))}),e.nodes().forEach(function(i){const s=e.children(i),a=e.edges();s.length>0?(q.debug("Cluster identified",i,zr),a.forEach(n=>{const o=Cs(n.v,i),l=Cs(n.w,i);o^l&&(q.debug("Edge: ",n," leaves cluster ",i),q.debug("Descendants of XXX ",i,": ",zr.get(i)),Ht.get(i).externalConnections=!0)})):q.debug("Not a cluster ",i,zr)});for(let i of Ht.keys()){const s=Ht.get(i).id,a=e.parent(s);a!==i&&Ht.has(a)&&!Ht.get(a).externalConnections&&(Ht.get(i).id=a);const n=e.edges().some(o=>o.v===i);if(s&&((r=Ht.get(i))!=null&&r.externalConnections)&&n&&sf(e,s,i)){const o=TS(e,i,e.parent(s));o&&(Ht.get(i).id=o)}}e.edges().forEach(function(i){const s=e.edge(i);q.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(i)),q.debug("Edge "+i.v+" -> "+i.w+": "+JSON.stringify(e.edge(i)));let a=i.v,n=i.w;if(q.debug("Fix XXX",Ht,"ids:",i.v,i.w,"Translating: ",Ht.get(i.v)," --- ",Ht.get(i.w)),Ht.get(i.v)||Ht.get(i.w)){if(q.debug("Fixing and trying - removing XXX",i.v,i.w,i.name),a=zc(i.v),n=zc(i.w),e.removeEdge(i.v,i.w,i.name),a!==i.v){const o=e.parent(a);Ht.get(o).externalConnections=!0,s.fromCluster=i.v}if(n!==i.w){const o=e.parent(n);Ht.get(o).externalConnections=!0,s.toCluster=i.w}q.debug("Fix Replacing with XXX",a,n,i.name),e.setEdge(a,n,s,i.name)}}),ef(e,0),q.trace(Ht)},"adjustClustersAndEdges"),ef=p((e,t)=>{var s,a;if(t>10){q.error("Bailing out");return}let r=e.nodes(),i=!1;for(const n of r){const o=e.children(n);i=i||o.length>0}if(!i){q.debug("Done, no node has children",e.nodes());return}q.debug("Nodes = ",r,t);for(const n of r)if(q.debug("Extracting node",n,Ht,Ht.has(n)&&!Ht.get(n).externalConnections,!e.parent(n),e.node(n),e.children("D")," Depth ",t),!Ht.has(n))q.debug("Not a cluster",n,t);else if(!Ht.get(n).externalConnections&&e.children(n)&&e.children(n).length>0){q.debug("Cluster without external connections, without a parent and with children",n,t);let l=e.graph().rankdir==="TB"?"LR":"TB";(a=(s=Ht.get(n))==null?void 0:s.clusterData)!=null&&a.dir&&(l=Ht.get(n).clusterData.dir,q.debug("Fixing dir",Ht.get(n).clusterData.dir,l));const c=new Pa({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Jp(n,e,c,n),e.setNode(n,{clusterNode:!0,id:n,clusterData:Ht.get(n).clusterData,label:Ht.get(n).label,graph:c})}else q.debug("Cluster ** ",n," **not meeting the criteria !externalConnections:",!Ht.get(n).externalConnections," no parent: ",!e.parent(n)," children ",e.children(n)&&e.children(n).length>0,e.children("D"),t),q.debug(Ht);r=e.nodes(),q.debug("New list of nodes",r);for(const n of r){const o=e.node(n);q.debug(" Now next level",n,o),o!=null&&o.clusterNode&&ef(o.graph,t+1)}},"extractor"),rf=p((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{const s=e.children(i),a=rf(e,s);r=[...r,...a]}),r},"sorter"),AL=p(e=>rf(e,e.children()),"sortNodesByHierarchy"),sf=p((e,t,r)=>{let i=e.parent(t);for(;i&&i!==r;){const s=Ht.get(i);if(s&&!s.externalConnections)return!0;i=e.parent(i)}return!1},"isNodeInExtractableCluster"),TS=p((e,t,r)=>{const i=e.children(t)??[];for(const s of i){if(s===r||Cs(s,r))continue;const a=ba(s,e,t);if(a&&!sf(e,a,t))return a}return null},"findSafeAnchorNode");function af({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:i,afterPaint:s,paintOptions:a}){const n=t??fl;return p(async function(l,c,h,d){const g=c.select("g");((h==null?void 0:h.insertMarkers)??Lp)(g,l.markers,l.type,l.diagramId),pl();const u={element:g,helpers:h,options:d};u.preparedLayout=await(e==null?void 0:e(l,u));const m=await n(l,u),y=await r(l,u),x={...u,measure:m};i?await i(l,x,y):await ml(l,x,a),await(s==null?void 0:s(l,x,y))},"render")}p(af,"createCommonLayoutRenderer");function pl(){Nb(),tk(),Xb(),xS()}p(pl,"clearLayoutRenderState");async function fl(e,{element:t}){return await Kp(t,e)}p(fl,"defaultMeasureLayout");async function ml(e,t,r={}){var n,o;const{measure:i}=t,{groups:s}=i;for(const l of((n=r.getNodes)==null?void 0:n.call(r,e,t))??e.nodes)(o=r.skipNode)!=null&&o.call(r,l,t)||await of(s,l,t,r);const a=lf(e.nodes);for(const l of e.edges)hf(l,r)||await cf(s,l,a,e,r,t)}p(ml,"paintLayoutData");async function of(e,t,r,i){t.clusterNode?hc(t):nf(t,r,i)?await kp(e.clusters,t):hc(t)}p(of,"paintLayoutNode");function nf(e,t,r){var i;return e.isGroup===!0&&(((i=r.isCluster)==null?void 0:i.call(r,e,t))??!0)}p(nf,"shouldPaintAsCluster");function lf(e){const t=new Map;for(const r of e)r!=null&&r.id&&t.set(r.id,r);return t}p(lf,"buildNodeLookup");function hf(e,t){var r;return e.isLayoutOnly||!!((r=t.skipEdge)!=null&&r.call(t,e))}p(hf,"shouldSkipPaintEdge");async function cf(e,t,r,i,s,a){const n=wp(e.edgePaths,{...t},s.clusterDb??new Map,i.type,xn(t.start,t,r,a,s),xn(t.end,t,r,a,s),i.diagramId,df(t,s));Tp(t)&&(Mi.has(t.id)||await sl(e.edgeLabels,t),uf(t,n))}p(cf,"paintLayoutEdge");function xn(e,t,r,i,s){var a;return((a=s.getEdgeNode)==null?void 0:a.call(s,e,t,i))??(e?r.get(e)??{}:{})}p(xn,"getRenderedNode");function df(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}p(df,"shouldSkipIntersect");function uf(e,t){const r=(t==null?void 0:t.updatedPath)??(t==null?void 0:t.originalPath),i=Jt(),{subGraphTitleTotalMargin:s}=Fa({flowchart:i.flowchart??{}});if(e.label){const a=Mi.get(e.id);let n=e.x,o=e.y;if(r){const l=Ce.calcLabelPosition(r);q.debug("Moving label "+e.label+" from (",n,",",o,") to (",l.x,",",l.y,") abc88"),t!=null&&t.updatedPath&&(n=l.x,o=l.y)}a.attr("transform",`translate(${n}, ${o+s/2})`)}if(e!=null&&e.startLabelLeft){const a=se.get(e.id).startLeft;let n=e==null?void 0:e.x,o=e==null?void 0:e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.startLabelRight){const a=se.get(e.id).startRight;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.endLabelLeft){const a=se.get(e.id).endLeft;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}if(e.endLabelRight){const a=se.get(e.id).endRight;let n=e.x,o=e.y;if(r){const l=Ce.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);n=l.x,o=l.y}a.attr("transform",`translate(${n}, ${o})`)}}p(uf,"positionRenderedEdgeLabel");function gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}p(gf,"getDefaultExportFromCjs");var pe={},js={},vr={},Hc;function Ri(){if(Hc)return vr;Hc=1;function e(n){return typeof n>"u"||n===null}p(e,"isNothing");function t(n){return typeof n=="object"&&n!==null}p(t,"isObject");function r(n){return Array.isArray(n)?n:e(n)?[]:[n]}p(r,"toArray");function i(n,o){if(o){const l=Object.keys(o);for(let c=0,h=l.length;cd&&(c=" ... ",a=o-d+c.length),n-o>d&&(h=" ...",n=o+d-h.length),{str:c+s.slice(a,n).replace(/\t/g,"β†’")+h,pos:o-a+c.length}}p(t,"getLine");function r(s,a){return e.repeat(" ",a-s.length)+s}p(r,"padStart");function i(s,a){if(a=Object.create(a||null),!s.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const n=/\r?\n|\r|\0/g,o=[0],l=[];let c,h=-1;for(;c=n.exec(s.buffer);)l.push(c.index),o.push(c.index+c[0].length),s.position<=c.index&&h<0&&(h=o.length-2);h<0&&(h=o.length-1);let d="";const g=Math.min(s.line+a.linesAfter,l.length).toString().length,u=a.maxLength-(a.indent+g+3);for(let y=1;y<=a.linesBefore&&!(h-y<0);y++){const x=t(s.buffer,o[h-y],l[h-y],s.position-(o[h]-o[h-y]),u);d=e.repeat(" ",a.indent)+r((s.line-y+1).toString(),g)+" | "+x.str+` `+d}const m=t(s.buffer,o[h],l[h],s.position,u);d+=e.repeat(" ",a.indent)+r((s.line+1).toString(),g)+" | "+m.str+` @@ -298,8 +298,8 @@ ${a.join(` `+T.slice(J,it),J=it+1),tt=ut;return ct+=` `,T.length-J>R&&tt>J?ct+=T.slice(J,tt)+` `+T.slice(tt+1):ct+=T.slice(J),ct.slice(1)}p(Se,"foldLine");function Sr(T){let R="",rt=0;for(let Z=0;Z=65536?Z+=2:Z++){rt=ft(T,Z);const J=M[rt];!J&&At(rt)?(R+=T[Z],rt>=65536&&(R+=T[Z+1])):R+=J||$(rt)}return R}p(Sr,"escapeString");function dr(T,R,rt){let Z="";const J=T.tag;for(let it=0,tt=rt.length;it"u"&&V(T,R,null,!1,!1))&&(Z!==""&&(Z+=","+(T.condenseFlow?"":" ")),Z+=T.dump)}T.tag=J,T.dump="["+Z+"]"}p(dr,"writeFlowSequence");function we(T,R,rt,Z){let J="";const it=T.tag;for(let tt=0,ut=rt.length;tt"u"&&V(T,R+1,null,!0,!0,!1,!0))&&((!Z||J!=="")&&(J+=kt(T,R)),T.dump&&o===T.dump.charCodeAt(0)?J+="-":J+="- ",J+=T.dump)}T.tag=it,T.dump=J||"[]"}p(we,"writeBlockSequence");function Oe(T,R,rt){let Z="";const J=T.tag,it=Object.keys(rt);for(let tt=0,ut=it.length;tt1024&&(ct+="? "),ct+=T.dump+(T.condenseFlow?'"':"")+":"+(T.condenseFlow?"":" "),V(T,R,Lt,!1,!1)&&(ct+=T.dump,Z+=ct))}T.tag=J,T.dump="{"+Z+"}"}p(Oe,"writeFlowMapping");function f(T,R,rt,Z){let J="";const it=T.tag,tt=Object.keys(rt);if(T.sortKeys===!0)tt.sort();else if(typeof T.sortKeys=="function")tt.sort(T.sortKeys);else if(T.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let ut=0,ct=tt.length;ut1024;Xt&&(T.dump&&o===T.dump.charCodeAt(0)?St+="?":St+="? "),St+=T.dump,Xt&&(St+=kt(T,R)),V(T,R+1,Wt,!0,Xt)&&(T.dump&&o===T.dump.charCodeAt(0)?St+=":":St+=": ",St+=T.dump,J+=St)}T.tag=it,T.dump=J||"{}"}p(f,"writeBlockMapping");function D(T,R,rt){const Z=rt?T.explicitTypes:T.implicitTypes;for(let J=0,it=Z.length;J tag resolver accepts not "'+ut+'" style');T.dump=ct}return!0}}return!1}p(D,"detectType");function V(T,R,rt,Z,J,it,tt){T.tag=null,T.dump=rt,D(T,rt,!1)||D(T,rt,!0);const ut=i.call(T.dump),ct=Z;Z&&(Z=T.flowLevel<0||T.flowLevel>R);const St=ut==="[object Object]"||ut==="[object Array]";let Lt,Wt;if(St&&(Lt=T.duplicates.indexOf(rt),Wt=Lt!==-1),(T.tag!==null&&T.tag!=="?"||Wt||T.indent!==2&&R>0)&&(J=!1),Wt&&T.usedDuplicates[Lt])T.dump="*ref_"+Lt;else{if(St&&Wt&&!T.usedDuplicates[Lt]&&(T.usedDuplicates[Lt]=!0),ut==="[object Object]")Z&&Object.keys(T.dump).length!==0?(f(T,R,T.dump,J),Wt&&(T.dump="&ref_"+Lt+T.dump)):(Oe(T,R,T.dump),Wt&&(T.dump="&ref_"+Lt+" "+T.dump));else if(ut==="[object Array]")Z&&T.dump.length!==0?(T.noArrayIndent&&!tt&&R>0?we(T,R-1,T.dump,J):we(T,R,T.dump,J),Wt&&(T.dump="&ref_"+Lt+T.dump)):(dr(T,R,T.dump),Wt&&(T.dump="&ref_"+Lt+" "+T.dump));else if(ut==="[object String]")T.tag!=="?"&&ze(T,T.dump,R,it,ct);else{if(ut==="[object Undefined]")return!1;if(T.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+ut)}if(T.tag!==null&&T.tag!=="?"){let Xt=encodeURI(T.tag[0]==="!"?T.tag.slice(1):T.tag).replace(/!/g,"%21");T.tag[0]==="!"?Xt="!"+Xt:Xt.slice(0,18)==="tag:yaml.org,2002:"?Xt="!!"+Xt.slice(18):Xt="!<"+Xt+">",T.dump=Xt+" "+T.dump}}return!0}p(V,"writeNode");function Q(T,R){const rt=[],Z=[];X(T,rt,Z);const J=Z.length;for(let it=0;it{for(const t of e)xs[t.name]=t},"registerLayoutLoaders"),_S=p(()=>{Cf([{name:"dagre",loader:p(async()=>await Rt(()=>import("./dagre-GXQ25YYZ-HI_1BsWY.js"),__vite__mapDeps([6,7,1,2,3,4,5])),"loader")},{name:"swimlane",loader:p(async()=>await Rt(()=>import("./swimlanes-42K2YHIH-Dd449bDi.js"),__vite__mapDeps([8,2,3,4,1,5])),"loader")},{name:"cose-bilkent",loader:p(async()=>await Rt(()=>import("./cose-bilkent-JH36ORCC-DSJwbOO-.js"),__vite__mapDeps([9,10,3,2,4,1,5])),"loader")}])},"registerDefaultLayoutLoaders");_S();var jL=p(async(e,t)=>{if(!(e.layoutAlgorithm in xs))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const d=h.domId||h.id;h.domId=`${e.diagramId}-${d}`}const r=xs[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:o,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),n){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",o).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,LS,{algorithm:r.algorithm})},"render"),YL=p((e="",{fallback:t="dagre"}={})=>{if(e in xs)return e;if(t in xs)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),$l="comm",xf="rule",bf="decl",FS="@media",ES="@import",AS="@supports",MS="@namespace",bn="@keyframes",kf="@layer",OS="@scope",$S=Math.abs,gs=String.fromCharCode;function Tf(e){return e.trim()}function kn(e,t,r){return e.replace(t,r)}function pi(e,t){return e.charCodeAt(t)|0}function Oi(e,t,r){return e.slice(t,r)}function er(e){return e.length}function Sf(e){return e.length}function Ys(e,t){return t.push(e),e}var qa=1,$i=1,wf=0,Ne=0,ae=0,Ni="";function Dl(e,t,r,i,s,a,n,o){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:qa,column:$i,length:n,return:"",siblings:o}}function DS(){return ae}function IS(){return ae=Ne>0?pi(Ni,--Ne):0,$i--,ae===10&&($i=1,qa--),ae}function Ue(){return ae=Ne2||bs(ae)>3?"":" "}function NS(e,t){for(;--t&&Ue()&&!(ae<48||ae>102||ae>57&&ae<65||ae>70&&ae<97););return Na(e,ra()+(t<6&&Fr()==32&&Ue()==32))}function Tn(e){for(;Ue();)switch(ae){case e:return Ne;case 34:case 39:e!==34&&e!==39&&Tn(ae);break;case 40:e===41&&Tn(e);break;case 92:Ue();break}return Ne}function WS(e,t){for(;Ue()&&e+ae!==57;)if(e+ae===84&&Fr()===47)break;return"/*"+Na(t,Ne-1)+"*"+gs(e===47?e:Ue())}function zS(e){for(;!bs(Fr());)Ue();return Na(e,Ne)}function HS(e){return RS(ia("",null,null,null,[""],e=PS(e),0,[0],e))}function ia(e,t,r,i,s,a,n,o,l){for(var c=0,h=0,d=n,g=0,u=0,m=0,y=1,x=1,C=1,k=0,S=0,w="",v=s,_=a,E=i,F=w;x;)switch(m=S,S=Ue()){case 40:m!=108&&pi(F,d-1)==58?(k++,F+="("):F+=zo(S);break;case 41:k--,F+=")";break;case 34:case 39:case 91:F+=zo(S);break;case 9:case 10:case 13:case 32:if(k>0){F+=gs(S);break}F+=qS(m);break;case 92:F+=NS(ra()-1,7);continue;case 47:switch(Fr()){case 42:case 47:Ys(jS(WS(Ue(),ra()),t,r,l),l),(bs(m||1)==5||bs(Fr()||1)==5)&&er(F)&&Oi(F,-1,void 0)!==" "&&(F+=" ");break;default:F+="/"}break;case 123*y:o[c++]=er(F)*C;case 125*y:case 59:case 0:if(k>0&&S){F+=gs(S);break}switch(S){case 0:case 125:x=0;case 59+h:C==-1&&(F=kn(F,/\f/g,"")),u>0&&(er(F)-d||y===0)&&Ys(u>32?fd(F+";",i,r,d-1,l):fd(kn(F," ","")+";",i,r,d-2,l),l);break;case 59:F+=";";default:if(Ys(E=pd(F,t,r,c,h,s,o,w,v=[],_=[],d,a),a),S===123)if(h===0)ia(F,t,E,E,v,a,d,o,_);else{switch(g){case 99:if(pi(F,3)===110)break;case 108:if(pi(F,2)===97)break;default:h=0;case 100:case 109:case 115:}h?ia(e,E,E,i&&Ys(pd(e,E,E,0,0,s,o,w,s,v=[],d,_),_),s,_,d,o,i?v:_):ia(F,E,E,E,[""],_,0,o,_)}}c=h=u=0,y=C=1,w=F="",d=n;break;case 58:d=1+er(F),u=m;default:if(y<1){if(S==123)--y;else if(S==125&&y++==0&&IS()==125)continue}switch(F+=gs(S),S*y){case 38:C=h>0?1:(F+="\f",-1);break;case 44:if(k>0)break;o[c++]=(er(F)-1)*C,C=1;break;case 64:Fr()===45&&(F+=zo(Ue())),g=Fr(),h=d=er(w=F+=zS(ra())),S++;break;case 45:m===45&&er(F)==2&&(y=0)}}return a}function pd(e,t,r,i,s,a,n,o,l,c,h,d){for(var g=s-1,u=s===0?a:[""],m=Sf(u),y=0,x=0,C=0;y0?u[k]+" "+S:kn(S,/&\f/g,u[k])))&&(l[C++]=w);return Dl(e,t,r,s===0?xf:o,l,c,h,d)}function jS(e,t,r,i){return Dl(e,t,r,$l,gs(DS()),Oi(e,2,-2),0,i)}function fd(e,t,r,i,s){return Dl(e,t,r,bf,Oi(e,0,i),Oi(e,i+1,-1),i,s)}function Sn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),XS=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-CrUbY5T3.js");return{diagram:t}},__vite__mapDeps([11,12,2,3,4,1,5]));return{id:Bf,diagram:e}},"loader"),VS={id:Bf,detector:GS,loader:XS},ZS=VS,vf="flowchart",KS=p((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),QS=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-CY2uKpa5.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:vf,diagram:e}},"loader"),JS={id:vf,detector:KS,loader:QS},tw=JS,Lf="flowchart-v2",ew=p((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),rw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-CY2uKpa5.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:Lf,diagram:e}},"loader"),iw={id:Lf,detector:ew,loader:rw},sw=iw,_f="swimlane",aw=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),ow=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,2,3,4,16,12,17,1,5]));return{id:_f,diagram:e}},"loader"),nw={id:_f,detector:aw,loader:ow},lw=nw,Ff="er",hw=p(e=>/^\s*erDiagram/.test(e),"detector"),cw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-DUTJfcik.js");return{diagram:t}},__vite__mapDeps([19,15,2,3,4,16,17,1,5]));return{id:Ff,diagram:e}},"loader"),dw={id:Ff,detector:hw,loader:cw},uw=dw,Ef="gitGraph",gw=p(e=>/^\s*gitGraph/.test(e),"detector"),pw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-B-cgQZ-J.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,1,2,3,4,5]));return{id:Ef,diagram:e}},"loader"),fw={id:Ef,detector:gw,loader:pw},mw=fw,Af="gantt",yw=p(e=>/^\s*gantt/.test(e),"detector"),Cw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-BPTKWvnP.js");return{diagram:t}},__vite__mapDeps([24,3,2,4,1,5]));return{id:Af,diagram:e}},"loader"),xw={id:Af,detector:yw,loader:Cw},bw=xw,Mf="info",kw=p(e=>/^\s*info/.test(e),"detector"),Tw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-BKR9ZU8X.js");return{diagram:t}},__vite__mapDeps([25,23,1,2,3,4,5]));return{id:Mf,diagram:e}},"loader"),Sw={id:Mf,detector:kw,loader:Tw},Of="pie",ww=p(e=>/^\s*pie/.test(e),"detector"),Bw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-B2e1MX98.js");return{diagram:t}},__vite__mapDeps([26,22,23,1,2,3,4,5]));return{id:Of,diagram:e}},"loader"),vw={id:Of,detector:ww,loader:Bw},$f="quadrantChart",Lw=p(e=>/^\s*quadrantChart/.test(e),"detector"),_w=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-B8cLCZlE.js");return{diagram:t}},__vite__mapDeps([27,2,3,4,1,5]));return{id:$f,diagram:e}},"loader"),Fw={id:$f,detector:Lw,loader:_w},Ew=Fw,Df="xychart",Aw=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Mw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-DvskLDdU.js");return{diagram:t}},__vite__mapDeps([28,2,3,4,1,5]));return{id:Df,diagram:e}},"loader"),Ow={id:Df,detector:Aw,loader:Mw},$w=Ow,If="requirement",Dw=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Iw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-B8LHaj5a.js");return{diagram:t}},__vite__mapDeps([29,15,2,3,4,16,1,5]));return{id:If,diagram:e}},"loader"),Pw={id:If,detector:Dw,loader:Iw},Rw=Pw,Pf="sequence",qw=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),Nw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-BKpy-f0A.js");return{diagram:t}},__vite__mapDeps([30,21,12,2,3,4,1,5]));return{id:Pf,diagram:e}},"loader"),Ww={id:Pf,detector:qw,loader:Nw},zw=Ww,Rf="class",Hw=p((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),jw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-B-odMm70.js");return{diagram:t}},__vite__mapDeps([31,32,14,15,2,3,4,16,12,1,5]));return{id:Rf,diagram:e}},"loader"),Yw={id:Rf,detector:Hw,loader:jw},Uw=Yw,qf="classDiagram",Gw=p((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Xw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-B-odMm70.js");return{diagram:t}},__vite__mapDeps([33,32,14,15,2,3,4,16,12,1,5]));return{id:qf,diagram:e}},"loader"),Vw={id:qf,detector:Gw,loader:Xw},Zw=Vw,Nf="state",Kw=p((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),Qw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-DsmaWosA.js");return{diagram:t}},__vite__mapDeps([34,35,15,2,3,4,16,12,7,1,5]));return{id:Nf,diagram:e}},"loader"),Jw={id:Nf,detector:Kw,loader:Qw},tB=Jw,Wf="stateDiagram",eB=p((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),rB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-D_3MdGaI.js");return{diagram:t}},__vite__mapDeps([36,35,15,2,3,4,16,12,1,5]));return{id:Wf,diagram:e}},"loader"),iB={id:Wf,detector:eB,loader:rB},sB=iB,zf="journey",aB=p(e=>/^\s*journey/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-5Eg3OQkk.js");return{diagram:t}},__vite__mapDeps([37,14,12,2,3,4,1,5]));return{id:zf,diagram:e}},"loader"),nB={id:zf,detector:aB,loader:oB},lB=nB,hB=p((e,t,r)=>{q.debug(`rendering svg for syntax error -`);const i=t0(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),eu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Hf={draw:hB},cB=Hf,dB={db:{},renderer:Hf,parser:{parse:p(()=>{},"parse")}},uB=dB,jf="flowchart-elk",gB=p((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),pB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-CY2uKpa5.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:jf,diagram:e}},"loader"),fB={id:jf,detector:gB,loader:pB},mB=fB,Yf="timeline",yB=p(e=>/^\s*timeline/.test(e),"detector"),CB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-CSbm3DNI.js");return{diagram:t}},__vite__mapDeps([38,2,3,4,1,5]));return{id:Yf,diagram:e}},"loader"),xB={id:Yf,detector:yB,loader:CB},bB=xB,Uf="mindmap",kB=p(e=>/^\s*mindmap/.test(e),"detector"),TB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-DQIC6o-x.js");return{diagram:t}},__vite__mapDeps([39,15,2,3,4,16,1,5]));return{id:Uf,diagram:e}},"loader"),SB={id:Uf,detector:kB,loader:TB},wB=SB,Gf="kanban",BB=p(e=>/^\s*kanban/.test(e),"detector"),vB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-DdgiJMlk.js");return{diagram:t}},__vite__mapDeps([40,14,1,2,3,4,5]));return{id:Gf,diagram:e}},"loader"),LB={id:Gf,detector:BB,loader:vB},_B=LB,Xf="sankey",FB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),EB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-BoZhgcxg.js");return{diagram:t}},__vite__mapDeps([41,2,3,4,1,5]));return{id:Xf,diagram:e}},"loader"),AB={id:Xf,detector:FB,loader:EB},MB=AB,Vf="packet",OB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),$B=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-DZNpeXsQ.js");return{diagram:t}},__vite__mapDeps([42,22,23,1,2,3,4,5]));return{id:Vf,diagram:e}},"loader"),DB={id:Vf,detector:OB,loader:$B},Zf="radar",IB=p(e=>/^\s*radar-beta/.test(e),"detector"),PB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-B7U-fTJX.js");return{diagram:t}},__vite__mapDeps([43,22,23,1,2,3,4,5]));return{id:Zf,diagram:e}},"loader"),RB={id:Zf,detector:IB,loader:PB},Kf="block",qB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),NB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-01ED4W8y.js");return{diagram:t}},__vite__mapDeps([44,14,4,3,2,17,1,5]));return{id:Kf,diagram:e}},"loader"),WB={id:Kf,detector:qB,loader:NB},zB=WB,Qf="treeView",HB=p(e=>/^\s*treeView-beta/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-zlxvjyBt.js");return{diagram:t}},__vite__mapDeps([45,21,22,23,1,2,3,4,5]));return{id:Qf,diagram:e}},"loader"),YB={id:Qf,detector:HB,loader:jB},UB=YB,Jf="architecture",GB=p(e=>/^\s*architecture/.test(e),"detector"),XB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-DR-sbxhh.js");return{diagram:t}},__vite__mapDeps([46,22,23,1,2,3,4,5,10]));return{id:Jf,diagram:e}},"loader"),VB={id:Jf,detector:GB,loader:XB},ZB=VB,tm="eventmodeling",KB=p(e=>/^\s*eventmodeling/.test(e),"detector"),QB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-XaHXd--c.js");return{diagram:t}},__vite__mapDeps([47,22,23,1,2,3,4,5]));return{id:tm,diagram:e}},"loader"),JB={id:tm,detector:KB,loader:QB},tv=JB,em="ishikawa",ev=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),rv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-CiUVSvQn.js");return{diagram:t}},__vite__mapDeps([48,1,2,3,4,5]));return{id:em,diagram:e}},"loader"),iv={id:em,detector:ev,loader:rv},rm="venn",sv=p(e=>/^\s*venn-beta/.test(e),"detector"),av=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-U8E6M_Pt.js");return{diagram:t}},__vite__mapDeps([49,2,3,4,1,5]));return{id:rm,diagram:e}},"loader"),ov={id:rm,detector:sv,loader:av},nv=ov,im="treemap",lv=p(e=>/^\s*treemap/.test(e),"detector"),hv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-NQCb8NMS.js");return{diagram:t}},__vite__mapDeps([50,22,16,23,1,2,3,4,5]));return{id:im,diagram:e}},"loader"),cv={id:im,detector:lv,loader:hv},sm="wardley",dv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),uv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-l1AdmyzU.js");return{diagram:t}},__vite__mapDeps([51,22,23,1,2,3,4,5]));return{id:sm,diagram:e}},"loader"),gv={id:sm,detector:dv,loader:uv},pv=gv,am="cynefin",fv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),mv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-DQF0zKIv.js");return{diagram:t}},__vite__mapDeps([52,22,23,1,2,3,4,5]));return{id:am,diagram:e}},"loader"),yv={id:am,detector:fv,loader:mv},om="railroad",Cv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),xv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-DqV6ivu7.js");return{diagram:t}},__vite__mapDeps([53,54,22,2,3,4,23,1,5]));return{id:om,diagram:e}},"loader"),bv={id:om,detector:Cv,loader:xv},nm="railroadEbnf",kv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Tv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-5A6xA75D.js");return{diagram:t}},__vite__mapDeps([55,54,22,2,3,4,23,1,5]));return{id:nm,diagram:e}},"loader"),Sv={id:nm,detector:kv,loader:Tv},lm="railroadAbnf",wv=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Bv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-Da14qxKB.js");return{diagram:t}},__vite__mapDeps([56,54,22,2,3,4,23,1,5]));return{id:lm,diagram:e}},"loader"),vv={id:lm,detector:wv,loader:Bv},hm="railroadPeg",Lv=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-BQQjq6hL.js");return{diagram:t}},__vite__mapDeps([57,54,22,2,3,4,23,1,5]));return{id:hm,diagram:e}},"loader"),Fv={id:hm,detector:Lv,loader:_v},md=!1,Wa=p(()=>{md||(md=!0,la("error",uB,e=>e.toLowerCase().trim()==="error"),la("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Vo(mB,wB,ZB),Vo(ZS,_B,Zw,Uw,uw,bw,Sw,vw,Rw,zw,lw,sw,tw,bB,mw,sB,tB,lB,Ew,MB,DB,$w,zB,tv,UB,RB,iv,cv,bv,Sv,vv,Fv,nv,pv,yv))},"addDiagrams"),Ev=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Yr).map(async([r,{detector:i,loader:s}])=>{if(s)try{Jo(r)}catch{try{const{diagram:a,id:n}=await s();la(n,a,i)}catch(a){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Yr[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Av="graphics-document document";function cm(e,t){e.attr("role",Av),t!==""&&e.attr("aria-roledescription",t)}p(cm,"setA11yDiagramInfo");function dm(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}p(dm,"addSVGa11yTitleDescription");var Hr,wn=(Hr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Jt(),s=_n(t,i);t=Q0(t)+` +`:""}return p(st,"dump2"),Wo.dump=st,Wo}p(mf,"requireDumper");var gd;function yf(){if(gd)return pe;gd=1;const e=ff(),t=mf();function r(i,s){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return p(r,"renamed"),pe.Type=be(),pe.Schema=yl(),pe.FAILSAFE_SCHEMA=kl(),pe.JSON_SCHEMA=vl(),pe.CORE_SCHEMA=Ll(),pe.DEFAULT_SCHEMA=Ra(),pe.load=e.load,pe.loadAll=e.loadAll,pe.dump=t.dump,pe.YAMLException=qi(),pe.types={binary:El(),float:Bl(),map:bl(),null:Tl(),pairs:Ml(),set:Ol(),timestamp:_l(),bool:Sl(),int:wl(),merge:Fl(),omap:Al(),seq:xl(),str:Cl()},pe.safeLoad=r("safeLoad","load"),pe.safeLoadAll=r("safeLoadAll","loadAll"),pe.safeDump=r("safeDump","dump"),pe}p(yf,"requireJsYaml");var SS=yf(),wS=gf(SS),{Type:ML,Schema:OL,FAILSAFE_SCHEMA:$L,JSON_SCHEMA:BS,CORE_SCHEMA:DL,DEFAULT_SCHEMA:IL,load:vS,loadAll:PL,dump:RL,YAMLException:qL,types:NL,safeLoad:WL,safeLoadAll:zL,safeDump:HL}=wS,LS={common:Ss,getConfig:Jt,insertCluster:kp,insertEdge:wp,insertEdgeLabel:sl,insertMarkers:Lp,insertNode:il,interpolateToCurve:$n,labelHelper:wt,log:q,positionEdgeLabel:ek},xs={},Cf=p(e=>{for(const t of e)xs[t.name]=t},"registerLayoutLoaders"),_S=p(()=>{Cf([{name:"dagre",loader:p(async()=>await Rt(()=>import("./dagre-GXQ25YYZ-B4MP3Plp.js"),__vite__mapDeps([6,7,1,2,3,4,5])),"loader")},{name:"swimlane",loader:p(async()=>await Rt(()=>import("./swimlanes-42K2YHIH-X3NDKqK8.js"),__vite__mapDeps([8,2,3,4,1,5])),"loader")},{name:"cose-bilkent",loader:p(async()=>await Rt(()=>import("./cose-bilkent-JH36ORCC-B9wHaWDG.js"),__vite__mapDeps([9,10,3,2,4,1,5])),"loader")}])},"registerDefaultLayoutLoaders");_S();var jL=p(async(e,t)=>{if(!(e.layoutAlgorithm in xs))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const h of e.nodes){const d=h.domId||h.id;h.domId=`${e.diagramId}-${d}`}const r=xs[e.layoutAlgorithm],i=await r.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:o,gradientStop:l}=a,c=t.attr("id");if(t.append("defs").append("filter").attr("id",`${c}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${c}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),n){const h=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");h.append("svg:stop").attr("offset","0%").attr("stop-color",o).attr("stop-opacity",1),h.append("svg:stop").attr("offset","100%").attr("stop-color",l).attr("stop-opacity",1)}return i.render(e,t,LS,{algorithm:r.algorithm})},"render"),YL=p((e="",{fallback:t="dagre"}={})=>{if(e in xs)return e;if(t in xs)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),$l="comm",xf="rule",bf="decl",FS="@media",ES="@import",AS="@supports",MS="@namespace",bn="@keyframes",kf="@layer",OS="@scope",$S=Math.abs,gs=String.fromCharCode;function Tf(e){return e.trim()}function kn(e,t,r){return e.replace(t,r)}function pi(e,t){return e.charCodeAt(t)|0}function Oi(e,t,r){return e.slice(t,r)}function er(e){return e.length}function Sf(e){return e.length}function Ys(e,t){return t.push(e),e}var qa=1,$i=1,wf=0,Ne=0,ae=0,Ni="";function Dl(e,t,r,i,s,a,n,o){return{value:e,root:t,parent:r,type:i,props:s,children:a,line:qa,column:$i,length:n,return:"",siblings:o}}function DS(){return ae}function IS(){return ae=Ne>0?pi(Ni,--Ne):0,$i--,ae===10&&($i=1,qa--),ae}function Ue(){return ae=Ne2||bs(ae)>3?"":" "}function NS(e,t){for(;--t&&Ue()&&!(ae<48||ae>102||ae>57&&ae<65||ae>70&&ae<97););return Na(e,ra()+(t<6&&Fr()==32&&Ue()==32))}function Tn(e){for(;Ue();)switch(ae){case e:return Ne;case 34:case 39:e!==34&&e!==39&&Tn(ae);break;case 40:e===41&&Tn(e);break;case 92:Ue();break}return Ne}function WS(e,t){for(;Ue()&&e+ae!==57;)if(e+ae===84&&Fr()===47)break;return"/*"+Na(t,Ne-1)+"*"+gs(e===47?e:Ue())}function zS(e){for(;!bs(Fr());)Ue();return Na(e,Ne)}function HS(e){return RS(ia("",null,null,null,[""],e=PS(e),0,[0],e))}function ia(e,t,r,i,s,a,n,o,l){for(var c=0,h=0,d=n,g=0,u=0,m=0,y=1,x=1,C=1,k=0,S=0,w="",v=s,_=a,E=i,F=w;x;)switch(m=S,S=Ue()){case 40:m!=108&&pi(F,d-1)==58?(k++,F+="("):F+=zo(S);break;case 41:k--,F+=")";break;case 34:case 39:case 91:F+=zo(S);break;case 9:case 10:case 13:case 32:if(k>0){F+=gs(S);break}F+=qS(m);break;case 92:F+=NS(ra()-1,7);continue;case 47:switch(Fr()){case 42:case 47:Ys(jS(WS(Ue(),ra()),t,r,l),l),(bs(m||1)==5||bs(Fr()||1)==5)&&er(F)&&Oi(F,-1,void 0)!==" "&&(F+=" ");break;default:F+="/"}break;case 123*y:o[c++]=er(F)*C;case 125*y:case 59:case 0:if(k>0&&S){F+=gs(S);break}switch(S){case 0:case 125:x=0;case 59+h:C==-1&&(F=kn(F,/\f/g,"")),u>0&&(er(F)-d||y===0)&&Ys(u>32?fd(F+";",i,r,d-1,l):fd(kn(F," ","")+";",i,r,d-2,l),l);break;case 59:F+=";";default:if(Ys(E=pd(F,t,r,c,h,s,o,w,v=[],_=[],d,a),a),S===123)if(h===0)ia(F,t,E,E,v,a,d,o,_);else{switch(g){case 99:if(pi(F,3)===110)break;case 108:if(pi(F,2)===97)break;default:h=0;case 100:case 109:case 115:}h?ia(e,E,E,i&&Ys(pd(e,E,E,0,0,s,o,w,s,v=[],d,_),_),s,_,d,o,i?v:_):ia(F,E,E,E,[""],_,0,o,_)}}c=h=u=0,y=C=1,w=F="",d=n;break;case 58:d=1+er(F),u=m;default:if(y<1){if(S==123)--y;else if(S==125&&y++==0&&IS()==125)continue}switch(F+=gs(S),S*y){case 38:C=h>0?1:(F+="\f",-1);break;case 44:if(k>0)break;o[c++]=(er(F)-1)*C,C=1;break;case 64:Fr()===45&&(F+=zo(Ue())),g=Fr(),h=d=er(w=F+=zS(ra())),S++;break;case 45:m===45&&er(F)==2&&(y=0)}}return a}function pd(e,t,r,i,s,a,n,o,l,c,h,d){for(var g=s-1,u=s===0?a:[""],m=Sf(u),y=0,x=0,C=0;y0?u[k]+" "+S:kn(S,/&\f/g,u[k])))&&(l[C++]=w);return Dl(e,t,r,s===0?xf:o,l,c,h,d)}function jS(e,t,r,i){return Dl(e,t,r,$l,gs(DS()),Oi(e,2,-2),0,i)}function fd(e,t,r,i,s){return Dl(e,t,r,bf,Oi(e,0,i),Oi(e,i+1,-1),i,s)}function Sn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),XS=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-9wb6NkWK.js");return{diagram:t}},__vite__mapDeps([11,12,2,3,4,1,5]));return{id:Bf,diagram:e}},"loader"),VS={id:Bf,detector:GS,loader:XS},ZS=VS,vf="flowchart",KS=p((e,t)=>{var r,i;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),QS=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B-fmyqOw.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:vf,diagram:e}},"loader"),JS={id:vf,detector:KS,loader:QS},tw=JS,Lf="flowchart-v2",ew=p((e,t)=>{var r,i,s;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((i=t==null?void 0:t.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((s=t==null?void 0:t.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),rw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B-fmyqOw.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:Lf,diagram:e}},"loader"),iw={id:Lf,detector:ew,loader:rw},sw=iw,_f="swimlane",aw=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),ow=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-9O47xpSI.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,2,3,4,16,12,17,1,5]));return{id:_f,diagram:e}},"loader"),nw={id:_f,detector:aw,loader:ow},lw=nw,Ff="er",hw=p(e=>/^\s*erDiagram/.test(e),"detector"),cw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-ClvuHycY.js");return{diagram:t}},__vite__mapDeps([19,15,2,3,4,16,17,1,5]));return{id:Ff,diagram:e}},"loader"),dw={id:Ff,detector:hw,loader:cw},uw=dw,Ef="gitGraph",gw=p(e=>/^\s*gitGraph/.test(e),"detector"),pw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,1,2,3,4,5]));return{id:Ef,diagram:e}},"loader"),fw={id:Ef,detector:gw,loader:pw},mw=fw,Af="gantt",yw=p(e=>/^\s*gantt/.test(e),"detector"),Cw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-C6gbssAY.js");return{diagram:t}},__vite__mapDeps([24,3,2,4,1,5]));return{id:Af,diagram:e}},"loader"),xw={id:Af,detector:yw,loader:Cw},bw=xw,Mf="info",kw=p(e=>/^\s*info/.test(e),"detector"),Tw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-BYbjxULf.js");return{diagram:t}},__vite__mapDeps([25,23,1,2,3,4,5]));return{id:Mf,diagram:e}},"loader"),Sw={id:Mf,detector:kw,loader:Tw},Of="pie",ww=p(e=>/^\s*pie/.test(e),"detector"),Bw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-I-cL6PKO.js");return{diagram:t}},__vite__mapDeps([26,22,23,1,2,3,4,5]));return{id:Of,diagram:e}},"loader"),vw={id:Of,detector:ww,loader:Bw},$f="quadrantChart",Lw=p(e=>/^\s*quadrantChart/.test(e),"detector"),_w=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-D5F7m3hQ.js");return{diagram:t}},__vite__mapDeps([27,2,3,4,1,5]));return{id:$f,diagram:e}},"loader"),Fw={id:$f,detector:Lw,loader:_w},Ew=Fw,Df="xychart",Aw=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Mw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-n6bmpw2W.js");return{diagram:t}},__vite__mapDeps([28,2,3,4,1,5]));return{id:Df,diagram:e}},"loader"),Ow={id:Df,detector:Aw,loader:Mw},$w=Ow,If="requirement",Dw=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),Iw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-zfL0JJ5z.js");return{diagram:t}},__vite__mapDeps([29,15,2,3,4,16,1,5]));return{id:If,diagram:e}},"loader"),Pw={id:If,detector:Dw,loader:Iw},Rw=Pw,Pf="sequence",qw=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),Nw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-BBJpGmE9.js");return{diagram:t}},__vite__mapDeps([30,21,12,2,3,4,1,5]));return{id:Pf,diagram:e}},"loader"),Ww={id:Pf,detector:qw,loader:Nw},zw=Ww,Rf="class",Hw=p((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),jw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-BL29_2U2.js");return{diagram:t}},__vite__mapDeps([31,32,14,15,2,3,4,16,12,1,5]));return{id:Rf,diagram:e}},"loader"),Yw={id:Rf,detector:Hw,loader:jw},Uw=Yw,qf="classDiagram",Gw=p((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),Xw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-BL29_2U2.js");return{diagram:t}},__vite__mapDeps([33,32,14,15,2,3,4,16,12,1,5]));return{id:qf,diagram:e}},"loader"),Vw={id:qf,detector:Gw,loader:Xw},Zw=Vw,Nf="state",Kw=p((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),Qw=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-BZRhMfUy.js");return{diagram:t}},__vite__mapDeps([34,35,15,2,3,4,16,12,7,1,5]));return{id:Nf,diagram:e}},"loader"),Jw={id:Nf,detector:Kw,loader:Qw},tB=Jw,Wf="stateDiagram",eB=p((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),rB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-CIeclGCR.js");return{diagram:t}},__vite__mapDeps([36,35,15,2,3,4,16,12,1,5]));return{id:Wf,diagram:e}},"loader"),iB={id:Wf,detector:eB,loader:rB},sB=iB,zf="journey",aB=p(e=>/^\s*journey/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-DLdfxAvt.js");return{diagram:t}},__vite__mapDeps([37,14,12,2,3,4,1,5]));return{id:zf,diagram:e}},"loader"),nB={id:zf,detector:aB,loader:oB},lB=nB,hB=p((e,t,r)=>{q.debug(`rendering svg for syntax error +`);const i=t0(t),s=i.append("g");i.attr("viewBox","0 0 2412 512"),eu(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Hf={draw:hB},cB=Hf,dB={db:{},renderer:Hf,parser:{parse:p(()=>{},"parse")}},uB=dB,jf="flowchart-elk",gB=p((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),pB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B-fmyqOw.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,2,3,4,16,12,17]));return{id:jf,diagram:e}},"loader"),fB={id:jf,detector:gB,loader:pB},mB=fB,Yf="timeline",yB=p(e=>/^\s*timeline/.test(e),"detector"),CB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-DKpgYUw-.js");return{diagram:t}},__vite__mapDeps([38,2,3,4,1,5]));return{id:Yf,diagram:e}},"loader"),xB={id:Yf,detector:yB,loader:CB},bB=xB,Uf="mindmap",kB=p(e=>/^\s*mindmap/.test(e),"detector"),TB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-q0jvfvMy.js");return{diagram:t}},__vite__mapDeps([39,15,2,3,4,16,1,5]));return{id:Uf,diagram:e}},"loader"),SB={id:Uf,detector:kB,loader:TB},wB=SB,Gf="kanban",BB=p(e=>/^\s*kanban/.test(e),"detector"),vB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-BOJnqoJE.js");return{diagram:t}},__vite__mapDeps([40,14,1,2,3,4,5]));return{id:Gf,diagram:e}},"loader"),LB={id:Gf,detector:BB,loader:vB},_B=LB,Xf="sankey",FB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),EB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-B-FZ_6j8.js");return{diagram:t}},__vite__mapDeps([41,2,3,4,1,5]));return{id:Xf,diagram:e}},"loader"),AB={id:Xf,detector:FB,loader:EB},MB=AB,Vf="packet",OB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),$B=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-Cqf74g10.js");return{diagram:t}},__vite__mapDeps([42,22,23,1,2,3,4,5]));return{id:Vf,diagram:e}},"loader"),DB={id:Vf,detector:OB,loader:$B},Zf="radar",IB=p(e=>/^\s*radar-beta/.test(e),"detector"),PB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-BnbQkIqG.js");return{diagram:t}},__vite__mapDeps([43,22,23,1,2,3,4,5]));return{id:Zf,diagram:e}},"loader"),RB={id:Zf,detector:IB,loader:PB},Kf="block",qB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),NB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-j0yjDlHD.js");return{diagram:t}},__vite__mapDeps([44,14,4,3,2,17,1,5]));return{id:Kf,diagram:e}},"loader"),WB={id:Kf,detector:qB,loader:NB},zB=WB,Qf="treeView",HB=p(e=>/^\s*treeView-beta/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-eE7ozkpX.js");return{diagram:t}},__vite__mapDeps([45,21,22,23,1,2,3,4,5]));return{id:Qf,diagram:e}},"loader"),YB={id:Qf,detector:HB,loader:jB},UB=YB,Jf="architecture",GB=p(e=>/^\s*architecture/.test(e),"detector"),XB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-BxKLzAsN.js");return{diagram:t}},__vite__mapDeps([46,22,23,1,2,3,4,5,10]));return{id:Jf,diagram:e}},"loader"),VB={id:Jf,detector:GB,loader:XB},ZB=VB,tm="eventmodeling",KB=p(e=>/^\s*eventmodeling/.test(e),"detector"),QB=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-Bf7G2Gse.js");return{diagram:t}},__vite__mapDeps([47,22,23,1,2,3,4,5]));return{id:tm,diagram:e}},"loader"),JB={id:tm,detector:KB,loader:QB},tv=JB,em="ishikawa",ev=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),rv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-C6U6iZ6u.js");return{diagram:t}},__vite__mapDeps([48,1,2,3,4,5]));return{id:em,diagram:e}},"loader"),iv={id:em,detector:ev,loader:rv},rm="venn",sv=p(e=>/^\s*venn-beta/.test(e),"detector"),av=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-DW_WRjKp.js");return{diagram:t}},__vite__mapDeps([49,2,3,4,1,5]));return{id:rm,diagram:e}},"loader"),ov={id:rm,detector:sv,loader:av},nv=ov,im="treemap",lv=p(e=>/^\s*treemap/.test(e),"detector"),hv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-CZnDwfvE.js");return{diagram:t}},__vite__mapDeps([50,22,16,23,1,2,3,4,5]));return{id:im,diagram:e}},"loader"),cv={id:im,detector:lv,loader:hv},sm="wardley",dv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),uv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-DdsuhfKh.js");return{diagram:t}},__vite__mapDeps([51,22,23,1,2,3,4,5]));return{id:sm,diagram:e}},"loader"),gv={id:sm,detector:dv,loader:uv},pv=gv,am="cynefin",fv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),mv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-CzFli75j.js");return{diagram:t}},__vite__mapDeps([52,22,23,1,2,3,4,5]));return{id:am,diagram:e}},"loader"),yv={id:am,detector:fv,loader:mv},om="railroad",Cv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),xv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-DB9mNuo5.js");return{diagram:t}},__vite__mapDeps([53,54,22,2,3,4,23,1,5]));return{id:om,diagram:e}},"loader"),bv={id:om,detector:Cv,loader:xv},nm="railroadEbnf",kv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Tv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-BrXqZ7JF.js");return{diagram:t}},__vite__mapDeps([55,54,22,2,3,4,23,1,5]));return{id:nm,diagram:e}},"loader"),Sv={id:nm,detector:kv,loader:Tv},lm="railroadAbnf",wv=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Bv=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-BA-XXAuE.js");return{diagram:t}},__vite__mapDeps([56,54,22,2,3,4,23,1,5]));return{id:lm,diagram:e}},"loader"),vv={id:lm,detector:wv,loader:Bv},hm="railroadPeg",Lv=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await Rt(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-DPT6U1TU.js");return{diagram:t}},__vite__mapDeps([57,54,22,2,3,4,23,1,5]));return{id:hm,diagram:e}},"loader"),Fv={id:hm,detector:Lv,loader:_v},md=!1,Wa=p(()=>{md||(md=!0,la("error",uB,e=>e.toLowerCase().trim()==="error"),la("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Vo(mB,wB,ZB),Vo(ZS,_B,Zw,Uw,uw,bw,Sw,vw,Rw,zw,lw,sw,tw,bB,mw,sB,tB,lB,Ew,MB,DB,$w,zB,tv,UB,RB,iv,cv,bv,Sv,vv,Fv,nv,pv,yv))},"addDiagrams"),Ev=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Yr).map(async([r,{detector:i,loader:s}])=>{if(s)try{Jo(r)}catch{try{const{diagram:a,id:n}=await s();la(n,a,i)}catch(a){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Yr[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Av="graphics-document document";function cm(e,t){e.attr("role",Av),t!==""&&e.attr("aria-roledescription",t)}p(cm,"setA11yDiagramInfo");function dm(e,t,r,i){if(e.insert!==void 0){if(r){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(r)}if(t){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(t)}}}p(dm,"addSVGa11yTitleDescription");var Hr,wn=(Hr=class{constructor(t,r,i,s,a){this.type=t,this.text=r,this.db=i,this.parser=s,this.renderer=a}static async fromText(t,r={}){var c,h;const i=Jt(),s=_n(t,i);t=Q0(t)+` `;try{Jo(s)}catch{const d=wC(s);if(!d)throw new Vd(`Diagram ${s} not found.`);const{id:g,diagram:u}=await d();la(g,u)}const{db:a,parser:n,renderer:o,init:l}=Jo(s);return n.parser&&(n.parser.yy=a),(c=a.clear)==null||c.call(a),l==null||l(i),r.title&&((h=a.setDiagramTitle)==null||h.call(a,r.title)),await n.parse(t),new Hr(s,t,a,n,o)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},p(Hr,"Diagram"),Hr),yd=[],Mv=p(()=>{yd.forEach(e=>{e()}),yd=[]},"attachFunctions"),Ov=p(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function um(e){const t=e.match(Xd);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(` `).map(n=>n.startsWith(r)?n.slice(r.length):n).join(` `):t[2];let s=vS(i,{schema:BS})??{};s=typeof s=="object"&&!Array.isArray(s)?s:{};const a={};return s.displayMode&&(a.displayMode=s.displayMode.toString()),s.title&&(a.title=s.title.toString()),s.config&&(a.config=s.config),{text:e.slice(t[0].length),metadata:a}}p(um,"extractFrontMatter");var $v=p(e=>e.replace(/\r\n?/g,` diff --git a/static/ml_canvas/assets/mindmap-definition-YA3MSWOX-DQIC6o-x.js b/static/ml_canvas/assets/mindmap-definition-YA3MSWOX-q0jvfvMy.js similarity index 98% rename from static/ml_canvas/assets/mindmap-definition-YA3MSWOX-DQIC6o-x.js rename to static/ml_canvas/assets/mindmap-definition-YA3MSWOX-q0jvfvMy.js index fddbd6855..3e36f3799 100644 --- a/static/ml_canvas/assets/mindmap-definition-YA3MSWOX-DQIC6o-x.js +++ b/static/ml_canvas/assets/mindmap-definition-YA3MSWOX-q0jvfvMy.js @@ -1,4 +1,4 @@ -import{g as ae}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as oe}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as l,l as w,t as ce,u as le,x as he,A as H,c as M,i as j,a0 as de,T as ge,U as ue,V as pe}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{v as fe}from"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var J=(function(){var i=l(function(T,s,n,a){for(n=n||{},a=T.length;a--;n[T[a]]=s);return n},"o"),e=[1,4],o=[1,13],d=[1,12],t=[1,15],h=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],D=[1,24],x=[1,25],_=[6,7,11],A=[1,6,13,15,16,19,22],f=[1,33],$=[1,34],B=[1,6,7,11,13,15,16,19,22],W={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,n,a,c,u,r,P){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},i(E,[2,3]),{1:[2,2]},i(E,[2,4]),i(E,[2,5]),{1:[2,6],6:o,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},{6:k,7:D,10:23,11:x},i(_,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),i(_,[2,18]),i(_,[2,19]),i(_,[2,20]),i(_,[2,21]),i(_,[2,23]),i(_,[2,24]),i(_,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:D,10:32,11:x},{1:[2,7],6:o,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},i(A,[2,14],{7:f,11:$}),i(B,[2,8]),i(B,[2,9]),i(B,[2,10]),i(_,[2,15]),i(_,[2,16]),i(_,[2,17]),{20:[1,35]},{21:[1,36]},i(A,[2,13],{7:f,11:$}),i(B,[2,11]),i(B,[2,12]),{21:[1,37]},i(_,[2,25]),i(_,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:l(function(s){var n=this,a=[0],c=[],u=[null],r=[],P=this.table,g="",V=0,K=0,ie=2,Q=1,ne=r.slice.call(arguments,1),m=Object.create(this.lexer),O={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(O.yy[z]=this.yy[z]);m.setInput(s,O.yy),O.yy.lexer=m,O.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var X=m.yylloc;r.push(X);var se=m.options&&m.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(S){a.length=a.length-2*S,u.length=u.length-S,r.length=r.length-S}l(re,"popStack");function Z(){var S;return S=c.pop()||m.lex()||Q,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=n.symbols_[S]||S),S}l(Z,"lex");for(var b,C,N,Y,I={},F,L,ee,G;;){if(C=a[a.length-1],this.defaultActions[C]?N=this.defaultActions[C]:((b===null||typeof b>"u")&&(b=Z()),N=P[C]&&P[C][b]),typeof N>"u"||!N.length||!N[0]){var q="";G=[];for(F in P[C])this.terminals_[F]&&F>ie&&G.push("'"+this.terminals_[F]+"'");m.showPosition?q="Parse error on line "+(V+1)+`: +import{g as ae}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as oe}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as l,l as w,t as ce,u as le,x as he,A as H,c as M,i as j,a0 as de,T as ge,U as ue,V as pe}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{v as fe}from"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var J=(function(){var i=l(function(T,s,n,a){for(n=n||{},a=T.length;a--;n[T[a]]=s);return n},"o"),e=[1,4],o=[1,13],d=[1,12],t=[1,15],h=[1,16],p=[1,20],y=[1,19],E=[6,7,8],k=[1,26],D=[1,24],x=[1,25],_=[6,7,11],A=[1,6,13,15,16,19,22],f=[1,33],$=[1,34],B=[1,6,7,11,13,15,16,19,22],W={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,n,a,c,u,r,P){var g=r.length-1;switch(u){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[g].id),c.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:c.getLogger().trace("Icon: ",r[g]),c.decorateNode({icon:r[g]});break;case 17:case 21:c.decorateNode({class:r[g]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[g].id),c.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:c.decorateNode({icon:r[g]});break;case 25:c.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:c.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:c.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:o,7:[1,10],9:9,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},i(E,[2,3]),{1:[2,2]},i(E,[2,4]),i(E,[2,5]),{1:[2,6],6:o,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},{6:o,9:22,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},{6:k,7:D,10:23,11:x},i(_,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:y}),i(_,[2,18]),i(_,[2,19]),i(_,[2,20]),i(_,[2,21]),i(_,[2,23]),i(_,[2,24]),i(_,[2,26],{19:[1,30]}),{20:[1,31]},{6:k,7:D,10:32,11:x},{1:[2,7],6:o,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:p,22:y},i(A,[2,14],{7:f,11:$}),i(B,[2,8]),i(B,[2,9]),i(B,[2,10]),i(_,[2,15]),i(_,[2,16]),i(_,[2,17]),{20:[1,35]},{21:[1,36]},i(A,[2,13],{7:f,11:$}),i(B,[2,11]),i(B,[2,12]),{21:[1,37]},i(_,[2,25]),i(_,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:l(function(s){var n=this,a=[0],c=[],u=[null],r=[],P=this.table,g="",V=0,K=0,ie=2,Q=1,ne=r.slice.call(arguments,1),m=Object.create(this.lexer),O={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(O.yy[z]=this.yy[z]);m.setInput(s,O.yy),O.yy.lexer=m,O.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var X=m.yylloc;r.push(X);var se=m.options&&m.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(S){a.length=a.length-2*S,u.length=u.length-S,r.length=r.length-S}l(re,"popStack");function Z(){var S;return S=c.pop()||m.lex()||Q,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=n.symbols_[S]||S),S}l(Z,"lex");for(var b,C,N,Y,I={},F,L,ee,G;;){if(C=a[a.length-1],this.defaultActions[C]?N=this.defaultActions[C]:((b===null||typeof b>"u")&&(b=Z()),N=P[C]&&P[C][b]),typeof N>"u"||!N.length||!N[0]){var q="";G=[];for(F in P[C])this.terminals_[F]&&F>ie&&G.push("'"+this.terminals_[F]+"'");m.showPosition?q="Parse error on line "+(V+1)+`: `+m.showPosition()+` Expecting `+G.join(", ")+", got '"+(this.terminals_[b]||b)+"'":q="Parse error on line "+(V+1)+": Unexpected "+(b==Q?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(q,{text:m.match,token:this.terminals_[b]||b,line:m.yylineno,loc:X,expected:G})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+b);switch(N[0]){case 1:a.push(b),u.push(m.yytext),r.push(m.yylloc),a.push(N[1]),b=null,K=m.yyleng,g=m.yytext,V=m.yylineno,X=m.yylloc;break;case 2:if(L=this.productions_[N[1]][1],I.$=u[u.length-L],I._$={first_line:r[r.length-(L||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(L||1)].first_column,last_column:r[r.length-1].last_column},se&&(I._$.range=[r[r.length-(L||1)].range[0],r[r.length-1].range[1]]),Y=this.performAction.apply(I,[g,K,V,O.yy,N[1],u,r].concat(ne)),typeof Y<"u")return Y;L&&(a=a.slice(0,-1*L*2),u=u.slice(0,-1*L),r=r.slice(0,-1*L)),a.push(this.productions_[N[1]][0]),u.push(I.$),r.push(I._$),ee=P[a[a.length-2]][a[a.length-1]],a.push(ee);break;case 3:return!0}}return!0},"parse")},te=(function(){var T={EOF:1,parseError:l(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:l(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===c.length?this.yylloc.first_column:0)+c[c.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/pegDiagram-XKGWAZYB-BQQjq6hL.js b/static/ml_canvas/assets/pegDiagram-XKGWAZYB-DPT6U1TU.js similarity index 84% rename from static/ml_canvas/assets/pegDiagram-XKGWAZYB-BQQjq6hL.js rename to static/ml_canvas/assets/pegDiagram-XKGWAZYB-DPT6U1TU.js index ef14fa7b3..016558bdb 100644 --- a/static/ml_canvas/assets/pegDiagram-XKGWAZYB-BQQjq6hL.js +++ b/static/ml_canvas/assets/pegDiagram-XKGWAZYB-DPT6U1TU.js @@ -1 +1 @@ -import{g as l,r as m,d as a}from"./chunk-SVP7TREG-rNd1SwBb.js";import{p}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as t,l as o}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},q={parser:b,db:a,renderer:m,styles:l};export{q as diagram}; +import{g as l,r as m,d as a}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as t,l as o}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,d as c}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},q={parser:b,db:a,renderer:m,styles:l};export{q as diagram}; diff --git a/static/ml_canvas/assets/pieDiagram-E7YTZNPT-B2e1MX98.js b/static/ml_canvas/assets/pieDiagram-E7YTZNPT-I-cL6PKO.js similarity index 96% rename from static/ml_canvas/assets/pieDiagram-E7YTZNPT-B2e1MX98.js rename to static/ml_canvas/assets/pieDiagram-E7YTZNPT-I-cL6PKO.js index 1fd13716d..6774238da 100644 --- a/static/ml_canvas/assets/pieDiagram-E7YTZNPT-B2e1MX98.js +++ b/static/ml_canvas/assets/pieDiagram-E7YTZNPT-I-cL6PKO.js @@ -1,4 +1,4 @@ -import{p as et}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{g as at,s as rt,a as it,b as nt,n as ot,m as st,_ as l,l as E,c as lt,z as ct,C as dt,D as gt,d as pt,o as ht,A as ft}from"./mermaid.core-DBa20IFF.js";import{p as ut}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./vendor-flow-Ct2sLZk5.js";import{k as U,o as mt,l as vt}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var St=ft.pie,R={sections:new Map,showData:!1},T=R.sections,L=R.showData,xt=structuredClone(St),wt=l(()=>structuredClone(xt),"getConfig"),Ct=l(()=>{T=new Map,L=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(t)||(T.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Dt=l(()=>T,"getSections"),yt=l(t=>{L=t},"setShowData"),Tt=l(()=>L,"getShowData"),V={getConfig:wt,clear:Ct,setDiagramTitle:st,getDiagramTitle:ot,setAccTitle:nt,getAccTitle:it,setAccDescription:rt,getAccDescription:at,addSection:$t,getSections:Dt,setShowData:yt,getShowData:Tt},bt=l((t,a)=>{et(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),At={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,V)},"parse")},kt=l(t=>` +import{p as et}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{g as at,s as rt,a as it,b as nt,n as ot,m as st,_ as l,l as E,c as lt,z as ct,C as dt,D as gt,d as pt,o as ht,A as ft}from"./mermaid.core-Bh6LVe7i.js";import{p as ut}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./vendor-flow-Ct2sLZk5.js";import{k as U,o as mt,l as vt}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var St=ft.pie,R={sections:new Map,showData:!1},T=R.sections,L=R.showData,xt=structuredClone(St),wt=l(()=>structuredClone(xt),"getConfig"),Ct=l(()=>{T=new Map,L=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(t)||(T.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Dt=l(()=>T,"getSections"),yt=l(t=>{L=t},"setShowData"),Tt=l(()=>L,"getShowData"),V={getConfig:wt,clear:Ct,setDiagramTitle:st,getDiagramTitle:ot,setAccTitle:nt,getAccTitle:it,setAccDescription:rt,getAccDescription:at,addSection:$t,getSections:Dt,setShowData:yt,getShowData:Tt},bt=l((t,a)=>{et(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),At={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,V)},"parse")},kt=l(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; diff --git a/static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-B8cLCZlE.js b/static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-D5F7m3hQ.js similarity index 99% rename from static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-B8cLCZlE.js rename to static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-D5F7m3hQ.js index b4baa4575..bab711641 100644 --- a/static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-B8cLCZlE.js +++ b/static/ml_canvas/assets/quadrantDiagram-AXDQQJYC-D5F7m3hQ.js @@ -1,4 +1,4 @@ -import{s as Ae,g as ke,n as ae,m as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,d as Ce,o as Le,A as z,i as Ee,E as De}from"./mermaid.core-DBa20IFF.js";import{s as zt}from"./vendor-flow-Ct2sLZk5.js";import{m as ie}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟢ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟢ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: +import{s as Ae,g as ke,n as ae,m as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,d as Ce,o as Le,A as z,i as Ee,E as De}from"./mermaid.core-Bh6LVe7i.js";import{s as zt}from"./vendor-flow-Ct2sLZk5.js";import{m as ie}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],m=[1,38],q=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Ut=[1,68],Qt=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟢ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟢ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:m,12:q,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:m,12:q,13:b,14:x,15:_,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Ut,7:Qt,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:m,12:q,13:b,14:x,15:_,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:m,12:q,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",qt=0,Jt=0,qe=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>qe&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(qt+1)+`: `+D.showPosition()+` Expecting `+St.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Dt="Parse error on line "+(qt+1)+": Unexpected "+(B==$t?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Dt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Lt,expected:St})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+B);switch(W[0]){case 1:g.push(B),A.push(D.yytext),e.push(D.yylloc),g.push(W[1]),B=null,Jt=D.yyleng,s=D.yytext,qt=D.yylineno,Lt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],lt.$=A[A.length-M],lt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},Se&&(lt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Et=this.performAction.apply(lt,[s,Jt,qt,K.yy,W[1],A,e].concat(be)),typeof Et<"u")return Et;M&&(g=g.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),g.push(this.productions_[W[1]][0]),A.push(lt.$),e.push(lt._$),ee=pt[g[g.length-2]][g[g.length-1]],g.push(ee);break;case 3:return!0}}return!0},"parse")},me=(function(){var j={EOF:1,parseError:o(function(l,g){if(this.yy.parser)this.yy.parser.parseError(l,g);else throw new Error(l)},"parseError"),setInput:o(function(r,l){return this.yy=l||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:o(function(r){var l=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===f.length?this.yylloc.first_column:0)+f[f.length-g.length].length-g[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(r){this.unput(this.match.slice(r))},"less"),pastInput:o(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DqV6ivu7.js b/static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DB9mNuo5.js similarity index 81% rename from static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DqV6ivu7.js rename to static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DB9mNuo5.js index 9d8e7b64d..af0d68238 100644 --- a/static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DqV6ivu7.js +++ b/static/ml_canvas/assets/railroadDiagram-O6MQD6OU-DB9mNuo5.js @@ -1 +1 @@ -import{g as s,r as l,d as t}from"./chunk-SVP7TREG-rNd1SwBb.js";import{p as m}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{_ as n,l as i}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},w={parser:y,db:t,renderer:l,styles:s};export{w as diagram}; +import{g as s,r as l,d as t}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p as m}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as n,l as i}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as p,c as u}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},w={parser:y,db:t,renderer:l,styles:s};export{w as diagram}; diff --git a/static/ml_canvas/assets/requirementDiagram-BXWQKSXE-B8LHaj5a.js b/static/ml_canvas/assets/requirementDiagram-BXWQKSXE-zfL0JJ5z.js similarity index 99% rename from static/ml_canvas/assets/requirementDiagram-BXWQKSXE-B8LHaj5a.js rename to static/ml_canvas/assets/requirementDiagram-BXWQKSXE-zfL0JJ5z.js index fafaf5378..25b2e21a4 100644 --- a/static/ml_canvas/assets/requirementDiagram-BXWQKSXE-B8LHaj5a.js +++ b/static/ml_canvas/assets/requirementDiagram-BXWQKSXE-zfL0JJ5z.js @@ -1,4 +1,4 @@ -import{g as ze}from"./chunk-XXDRQBXY-Bs02z9v-.js";import{s as Xe}from"./chunk-POPQ4Y6H-oeZXlwKE.js";import{_ as d,x as Be,b as Je,a as Ze,s as et,g as tt,m as st,n as it,c as Ne,l as qe,o as rt,q as nt,t as at,u as lt,v as ct}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],m=[1,27],f=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],me=[1,114],fe=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:me,59:fe},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:me,59:fe},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:me,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:me,59:fe},{5:he,40:ue,56:164,57:me,59:fe},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: +import{g as ze}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as Xe}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as d,x as Be,b as Je,a as Ze,s as et,g as tt,m as st,n as it,c as Ne,l as qe,o as rt,q as nt,t as at,u as lt,v as ct}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ce=(function(){var e=d(function($,i,n,l){for(n=n||{},l=$.length;l--;n[$[l]]=i);return n},"o"),r=[1,3],u=[1,4],h=[1,5],o=[1,6],c=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],E=[1,22],p=[2,7],y=[1,26],m=[1,27],f=[1,28],k=[1,29],C=[1,33],V=[1,34],A=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],_=[1,39],S=[1,40],g=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ve=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ee=[27,29],Ae=[1,70],ve=[1,71],Le=[1,72],xe=[1,73],Oe=[1,74],we=[1,75],De=[1,76],ee=[1,83],U=[1,80],te=[1,84],se=[1,85],ie=[1,86],re=[1,87],ne=[1,88],ae=[1,89],le=[1,90],ce=[1,91],oe=[1,92],pe=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],Me=[1,101],Fe=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],N=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],he=[1,116],ue=[1,117],me=[1,114],fe=[1,115],Se={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:d(function(i,n,l,s,R,t,de){var a=t.length-1;switch(R){case 4:this.$=t[a].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[a].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[a-3],t[a-4]);break;case 22:s.addRequirement(t[a-5],t[a-6]),s.setClass([t[a-5]],t[a-3]);break;case 23:s.setNewReqId(t[a-2]);break;case 24:s.setNewReqText(t[a-2]);break;case 25:s.setNewReqRisk(t[a-2]);break;case 26:s.setNewReqVerifyMethod(t[a-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[a-3]);break;case 43:s.addElement(t[a-5]),s.setClass([t[a-5]],t[a-3]);break;case 44:s.setNewElementType(t[a-2]);break;case 45:s.setNewElementDocRef(t[a-2]);break;case 48:s.addRelationship(t[a-2],t[a],t[a-4]);break;case 49:s.addRelationship(t[a-2],t[a-4],t[a]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[a-2],s.defineClass(t[a-1],t[a]);break;case 58:s.setClass(t[a-1],t[a]);break;case 59:s.setClass([t[a-2]],t[a]);break;case 60:case 62:this.$=[t[a]];break;case 61:case 63:this.$=t[a-2].concat([t[a]]);break;case 64:this.$=t[a-2],s.setCssStyle(t[a-1],t[a]);break;case 65:this.$=[t[a]];break;case 66:t[a-2].push(t[a]),this.$=t[a-2];break;case 68:this.$=t[a-1]+t[a];break}},"anonymous"),table:[{3:1,4:2,6:r,9:u,11:h,13:o},{1:[3]},{3:8,4:2,5:[1,7],6:r,9:u,11:h,13:o},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(c,[2,6]),{3:12,4:2,6:r,9:u,11:h,13:o},{1:[2,2]},{4:17,5:E,7:13,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},e(c,[2,4]),e(c,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:E,7:42,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:43,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:44,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:45,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:46,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:47,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:48,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:49,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{4:17,5:E,7:50,8:p,9:u,11:h,13:o,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:y,22:m,23:f,24:k,25:23,33:25,41:C,42:V,43:A,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:_,90:S},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(g,[2,17]),e(g,[2,18]),e(g,[2,19]),e(g,[2,20]),{30:60,33:62,75:P,89:_,90:S},{30:63,33:62,75:P,89:_,90:S},{30:64,33:62,75:P,89:_,90:S},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ve,[2,81]),e(Ve,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(Ee,[2,79]),e(Ee,[2,80]),{27:[1,67],29:[1,68]},e(Ee,[2,85]),e(Ee,[2,86]),{62:69,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{62:77,65:Ae,66:ve,67:Le,68:xe,69:Oe,70:we,71:De},{30:78,33:62,75:P,89:_,90:S},{73:79,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,60]),e(pe,[2,62]),{73:93,75:ee,76:U,78:81,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},{30:94,33:62,75:P,76:U,89:_,90:S},{5:[1,95]},{30:96,33:62,75:P,89:_,90:S},{5:[1,97]},{30:98,33:62,75:P,89:_,90:S},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(g,[2,59],{76:U}),e(g,[2,64],{76:Me}),{33:103,75:[1,102],89:_,90:S},e(Fe,[2,65],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),e(N,[2,67]),e(N,[2,69]),e(N,[2,70]),e(N,[2,71]),e(N,[2,72]),e(N,[2,73]),e(N,[2,74]),e(N,[2,75]),e(N,[2,76]),e(N,[2,77]),e(N,[2,78]),e(g,[2,57],{76:Me}),e(g,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:he,40:ue,56:113,57:me,59:fe},{27:[1,118],76:U},{33:119,89:_,90:S},{33:120,89:_,90:S},{75:ee,78:121,79:82,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe},e(pe,[2,61]),e(pe,[2,63]),e(N,[2,68]),e(g,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(g,[2,28]),{5:[1,127]},e(g,[2,42]),{32:[1,128]},{32:[1,129]},{5:he,40:ue,56:130,57:me,59:fe},e(g,[2,47]),{5:[1,131]},e(g,[2,48]),e(g,[2,49]),e(Fe,[2,66],{79:104,75:ee,80:te,81:se,82:ie,83:re,84:ne,85:ae,86:le,87:ce,88:oe}),{33:132,89:_,90:S},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(g,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(g,[2,46]),{5:he,40:ue,56:152,57:me,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(g,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(g,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:he,40:ue,56:163,57:me,59:fe},{5:he,40:ue,56:164,57:me,59:fe},e(g,[2,23]),e(g,[2,24]),e(g,[2,25]),e(g,[2,26]),e(g,[2,44]),e(g,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:d(function(i,n){if(n.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=n,l}},"parseError"),parse:d(function(i){var n=this,l=[0],s=[],R=[null],t=[],de=this.table,a="",ge=0,$e=0,Ke=2,Pe=1,We=t.slice.call(arguments,1),b=Object.create(this.lexer),G={yy:{}};for(var be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,be)&&(G.yy[be]=this.yy[be]);b.setInput(i,G.yy),G.yy.lexer=b,G.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Ie=b.yylloc;t.push(Ie);var je=b.options&&b.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ge(T){l.length=l.length-2*T,R.length=R.length-T,t.length=t.length-T}d(Ge,"popStack");function Ue(){var T;return T=s.pop()||b.lex()||Pe,typeof T!="number"&&(T instanceof Array&&(s=T,T=s.pop()),T=n.symbols_[T]||T),T}d(Ue,"lex");for(var I,z,q,Te,J={},ye,F,Ye,_e;;){if(z=l[l.length-1],this.defaultActions[z]?q=this.defaultActions[z]:((I===null||typeof I>"u")&&(I=Ue()),q=de[z]&&de[z][I]),typeof q>"u"||!q.length||!q[0]){var ke="";_e=[];for(ye in de[z])this.terminals_[ye]&&ye>Ke&&_e.push("'"+this.terminals_[ye]+"'");b.showPosition?ke="Parse error on line "+(ge+1)+`: `+b.showPosition()+` Expecting `+_e.join(", ")+", got '"+(this.terminals_[I]||I)+"'":ke="Parse error on line "+(ge+1)+": Unexpected "+(I==Pe?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(ke,{text:b.match,token:this.terminals_[I]||I,line:b.yylineno,loc:Ie,expected:_e})}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+I);switch(q[0]){case 1:l.push(I),R.push(b.yytext),t.push(b.yylloc),l.push(q[1]),I=null,$e=b.yyleng,a=b.yytext,ge=b.yylineno,Ie=b.yylloc;break;case 2:if(F=this.productions_[q[1]][1],J.$=R[R.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},je&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),Te=this.performAction.apply(J,[a,$e,ge,G.yy,q[1],R,t].concat(We)),typeof Te<"u")return Te;F&&(l=l.slice(0,-1*F*2),R=R.slice(0,-1*F),t=t.slice(0,-1*F)),l.push(this.productions_[q[1]][0]),R.push(J.$),t.push(J._$),Ye=de[l[l.length-2]][l[l.length-1]],l.push(Ye);break;case 3:return!0}}return!0},"parse")},He=(function(){var $={EOF:1,parseError:d(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:d(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:d(function(i){var n=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===s.length?this.yylloc.first_column:0)+s[s.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(i){this.unput(this.match.slice(i))},"less"),pastInput:d(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-BoZhgcxg.js b/static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-B-FZ_6j8.js similarity index 99% rename from static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-BoZhgcxg.js rename to static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-B-FZ_6j8.js index 553ba8e3d..8656f43d7 100644 --- a/static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-BoZhgcxg.js +++ b/static/ml_canvas/assets/sankeyDiagram-P5KCCOFB-B-FZ_6j8.js @@ -1,4 +1,4 @@ -import{m as xt,n as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,as as Lt,W as Et,o as At,j as Tt}from"./mermaid.core-DBa20IFF.js";import{s as X}from"./vendor-flow-Ct2sLZk5.js";import{o as Mt}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function mt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,k=jt,o=mt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(k=typeof i=="function"?i:q(i),v):k},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[k(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:m,target:b}=r;typeof m!="object"&&(m=r.source=ft(c,m)),typeof b!="object"&&(b=r.target=ft(c,b)),m.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const m of c){m.depth=r;for(const{target:b}of m.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const m of c){m.height=r;for(const{source:b}of m.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const m=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=m,r.x0=t+m*c,r.x1=r.x0+u,e[m]?e[m].push(r):e[m]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const m of r.sourceLinks)m.width=m.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&m.sort(Q),D(m,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const m=i[r];for(const b of m){let L=0,B=0;for(const{target:Y,value:et}of b.sourceLinks){let H=et*(Y.layer-b.layer);L+=E(b,Y)*H,B+=H}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&m.sort(Q),D(m,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=m,r.y1+=m),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],m=(r.y1-f)*e;m>1e-6&&(r.y0-=m,r.y1-=m),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function kt(){return new ot}ot.prototype=kt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,k=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*k-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=k*k+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*k)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),k=s*Math.sin(a),o=t+p,l=n+k,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Yt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var k,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=k=kt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return y=null,k+""||null}return p.source=function(k){return arguments.length?(n=k,p):n},p.target=function(k){return arguments.length?(s=k,p):s},p.x=function(k){return arguments.length?(a=typeof k=="function"?k:dt(+k),p):a},p.y=function(k){return arguments.length?(u=typeof k=="function"?k:dt(+k),p):u},p.context=function(k){return arguments.length?(y=k??null,p):y},p}function Ht(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Xt(){return Yt(Ht)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Xt().source(qt).target(Qt)}var at=(function(){var t=d(function(k,o,l,h){for(l=l||{},h=k.length;h--;l[k[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,m;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";m=[];for(c in v[P])this.terminals_[c]&&c>I&&m.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: +import{m as xt,n as _t,s as vt,g as bt,b as St,a as wt,_ as d,c as lt,as as Lt,W as Et,o as At,j as Tt}from"./mermaid.core-Bh6LVe7i.js";import{s as X}from"./vendor-flow-Ct2sLZk5.js";import{o as Mt}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";function Nt(t){for(var n=t.length/6|0,s=new Array(n),a=0;a=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s=u)&&(s=u)}return s}function pt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function nt(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Pt(t){return t.target.depth}function It(t){return t.depth}function Ot(t,n){return n-1-t.height}function mt(t,n){return t.sourceLinks.length?t.depth:n-1}function $t(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?pt(t.sourceLinks,Pt)-1:0}function q(t){return function(){return t}}function ut(t,n){return Q(t.source,n.source)||t.index-n.index}function ht(t,n){return Q(t.target,n.target)||t.index-n.index}function Q(t,n){return t.y0-n.y0}function it(t){return t.value}function jt(t){return t.index}function Dt(t){return t.nodes}function zt(t){return t.links}function ft(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function yt({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function Bt(){let t=0,n=0,s=1,a=1,u=24,y=8,p,k=jt,o=mt,l,h,x=Dt,_=zt,g=6;function v(){const i={nodes:x.apply(null,arguments),links:_.apply(null,arguments)};return T(i),A(i),M(i),I(i),S(i),yt(i),i}v.update=function(i){return yt(i),i},v.nodeId=function(i){return arguments.length?(k=typeof i=="function"?i:q(i),v):k},v.nodeAlign=function(i){return arguments.length?(o=typeof i=="function"?i:q(i),v):o},v.nodeSort=function(i){return arguments.length?(l=i,v):l},v.nodeWidth=function(i){return arguments.length?(u=+i,v):u},v.nodePadding=function(i){return arguments.length?(y=p=+i,v):y},v.nodes=function(i){return arguments.length?(x=typeof i=="function"?i:q(i),v):x},v.links=function(i){return arguments.length?(_=typeof i=="function"?i:q(i),v):_},v.linkSort=function(i){return arguments.length?(h=i,v):h},v.size=function(i){return arguments.length?(t=n=0,s=+i[0],a=+i[1],v):[s-t,a-n]},v.extent=function(i){return arguments.length?(t=+i[0][0],s=+i[1][0],n=+i[0][1],a=+i[1][1],v):[[t,n],[s,a]]},v.iterations=function(i){return arguments.length?(g=+i,v):g};function T({nodes:i,links:f}){for(const[e,r]of i.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(i.map((e,r)=>[k(e,r,i),e]));for(const[e,r]of f.entries()){r.index=e;let{source:m,target:b}=r;typeof m!="object"&&(m=r.source=ft(c,m)),typeof b!="object"&&(b=r.target=ft(c,b)),m.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of i)e.sort(h),r.sort(h)}function A({nodes:i}){for(const f of i)f.value=f.fixedValue===void 0?Math.max(nt(f.sourceLinks,it),nt(f.targetLinks,it)):f.fixedValue}function M({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const m of c){m.depth=r;for(const{target:b}of m.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:i}){const f=i.length;let c=new Set(i),e=new Set,r=0;for(;c.size;){for(const m of c){m.height=r;for(const{source:b}of m.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:i}){const f=ct(i,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of i){const m=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=m,r.x0=t+m*c,r.x1=r.x0+u,e[m]?e[m].push(r):e[m]=[r]}if(l)for(const r of e)r.sort(l);return e}function j(i){const f=pt(i,c=>(a-n-(c.length-1)*p)/nt(c,it));for(const c of i){let e=n;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+p;for(const m of r.sourceLinks)m.width=m.value*f}e=(a-e+p)/(c.length+1);for(let r=0;rc.length)-1)),j(f);for(let c=0;c0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&m.sort(Q),D(m,c)}}function R(i,f,c){for(let e=i.length,r=e-2;r>=0;--r){const m=i[r];for(const b of m){let L=0,B=0;for(const{target:Y,value:et}of b.sourceLinks){let H=et*(Y.layer-b.layer);L+=E(b,Y)*H,B+=H}if(!(B>0))continue;let U=(L/B-b.y0)*f;b.y0+=U,b.y1+=U,z(b)}l===void 0&&m.sort(Q),D(m,c)}}function D(i,f){const c=i.length>>1,e=i[c];O(i,e.y0-p,c-1,f),V(i,e.y1+p,c+1,f),O(i,a,i.length-1,f),V(i,n,0,f)}function V(i,f,c,e){for(;c1e-6&&(r.y0+=m,r.y1+=m),f=r.y1+p}}function O(i,f,c,e){for(;c>=0;--c){const r=i[c],m=(r.y1-f)*e;m>1e-6&&(r.y0-=m,r.y1-=m),f=r.y0-p}}function z({sourceLinks:i,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ht);for(const{target:{targetLinks:c}}of i)c.sort(ut)}}function w(i){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of i)f.sort(ht),c.sort(ut)}function P(i,f){let c=i.y0-(i.sourceLinks.length-1)*p/2;for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c+=r+p}for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c-=r}return c}function E(i,f){let c=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:e,width:r}of f.targetLinks){if(e===i)break;c+=r+p}for(const{target:e,width:r}of i.sourceLinks){if(e===f)break;c-=r}return c}return v}var rt=Math.PI,st=2*rt,F=1e-6,Ft=st-F;function ot(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function kt(){return new ot}ot.prototype=kt.prototype={constructor:ot,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,y){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+y)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var y=this._x1,p=this._y1,k=s-t,o=a-n,l=y-t,h=p-n,x=l*l+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(x>F)if(!(Math.abs(h*k-o*l)>F)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var _=s-y,g=a-p,v=k*k+o*o,T=_*_+g*g,A=Math.sqrt(v),M=Math.sqrt(x),I=u*Math.tan((rt-Math.acos((v+x-T)/(2*A*M)))/2),N=I/M,j=I/A;Math.abs(N-1)>F&&(this._+="L"+(t+N*l)+","+(n+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>l*g)+","+(this._x1=t+j*k)+","+(this._y1=n+j*o)}},arc:function(t,n,s,a,u,y){t=+t,n=+n,s=+s,y=!!y;var p=s*Math.cos(a),k=s*Math.sin(a),o=t+p,l=n+k,h=1^y,x=y?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+l:(Math.abs(this._x1-o)>F||Math.abs(this._y1-l)>F)&&(this._+="L"+o+","+l),s&&(x<0&&(x=x%st+st),x>Ft?this._+="A"+s+","+s+",0,1,"+h+","+(t-p)+","+(n-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=l):x>F&&(this._+="A"+s+","+s+",0,"+ +(x>=rt)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function dt(t){return function(){return t}}function Rt(t){return t[0]}function Vt(t){return t[1]}var Wt=Array.prototype.slice;function Gt(t){return t.source}function Ut(t){return t.target}function Yt(t){var n=Gt,s=Ut,a=Rt,u=Vt,y=null;function p(){var k,o=Wt.call(arguments),l=n.apply(this,o),h=s.apply(this,o);if(y||(y=k=kt()),t(y,+a.apply(this,(o[0]=l,o)),+u.apply(this,o),+a.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return y=null,k+""||null}return p.source=function(k){return arguments.length?(n=k,p):n},p.target=function(k){return arguments.length?(s=k,p):s},p.x=function(k){return arguments.length?(a=typeof k=="function"?k:dt(+k),p):a},p.y=function(k){return arguments.length?(u=typeof k=="function"?k:dt(+k),p):u},p.context=function(k){return arguments.length?(y=k??null,p):y},p}function Ht(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Xt(){return Yt(Ht)}function qt(t){return[t.source.x1,t.y0]}function Qt(t){return[t.target.x0,t.y1]}function Kt(){return Xt().source(qt).target(Qt)}var at=(function(){var t=d(function(k,o,l,h){for(l=l||{},h=k.length;h--;l[k[h]]=o);return l},"o"),n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:d(function(o,l,h,x,_,g,v){var T=g.length-1;switch(_){case 7:const A=x.findOrCreateNode(g[T-4].trim().replaceAll('""','"')),M=x.findOrCreateNode(g[T-2].trim().replaceAll('""','"')),I=parseFloat(g[T].trim());x.addLink(A,M,I);break;case 8:case 9:case 11:this.$=g[T];break;case 10:this.$=g[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:d(function(o,l){if(l.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=l,h}},"parseError"),parse:d(function(o){var l=this,h=[0],x=[],_=[null],g=[],v=this.table,T="",A=0,M=0,I=2,N=1,j=g.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var R in this.yy)Object.prototype.hasOwnProperty.call(this.yy,R)&&(C.yy[R]=this.yy[R]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;g.push(D);var V=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,g.length=g.length-L}d(O,"popStack");function z(){var L;return L=x.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(x=L,L=x.pop()),L=l.symbols_[L]||L),L}d(z,"lex");for(var w,P,E,i,f={},c,e,r,m;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=z()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";m=[];for(c in v[P])this.terminals_[c]&&c>I&&m.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: `+S.showPosition()+` Expecting `+m.join(", ")+", got '"+(this.terminals_[w]||w)+"'":b="Parse error on line "+(A+1)+": Unexpected "+(w==N?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(b,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:D,expected:m})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+w);switch(E[0]){case 1:h.push(w),_.push(S.yytext),g.push(S.yylloc),h.push(E[1]),w=null,M=S.yyleng,T=S.yytext,A=S.yylineno,D=S.yylloc;break;case 2:if(e=this.productions_[E[1]][1],f.$=_[_.length-e],f._$={first_line:g[g.length-(e||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(e||1)].first_column,last_column:g[g.length-1].last_column},V&&(f._$.range=[g[g.length-(e||1)].range[0],g[g.length-1].range[1]]),i=this.performAction.apply(f,[T,M,A,C.yy,E[1],_,g].concat(j)),typeof i<"u")return i;e&&(h=h.slice(0,-1*e*2),_=_.slice(0,-1*e),g=g.slice(0,-1*e)),h.push(this.productions_[E[1]][0]),_.push(f.$),g.push(f._$),r=v[h[h.length-2]][h[h.length-1]],h.push(r);break;case 3:return!0}}return!0},"parse")},y=(function(){var k={EOF:1,parseError:d(function(l,h){if(this.yy.parser)this.yy.parser.parseError(l,h);else throw new Error(l)},"parseError"),setInput:d(function(o,l){return this.yy=l||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:d(function(o){var l=o.length,h=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===x.length?this.yylloc.first_column:0)+x[x.length-h.length].length-h[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(o){this.unput(this.match.slice(o))},"less"),pastInput:d(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var o=this.pastInput(),l=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BKpy-f0A.js b/static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BBJpGmE9.js similarity index 99% rename from static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BKpy-f0A.js rename to static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BBJpGmE9.js index 342fa1616..1a94675d2 100644 --- a/static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BKpy-f0A.js +++ b/static/ml_canvas/assets/sequenceDiagram-WJ2MYXX4-BBJpGmE9.js @@ -1,4 +1,4 @@ -import{I as er}from"./chunk-2Q5K7J3B-BBHJD4OQ.js";import{_ as x,G as rr,c as j,l as it,H as Me,d as ar,e as sr,j as m,b as De,s as ir,m as nr,a as or,g as cr,n as lr,I as hr,J as dr,o as Tr,i as Yt,v as Z,K as Q,L as kt,D as Be,Z as pr,x as Ft,M as Er,N as Ve}from"./mermaid.core-DBa20IFF.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-B6ZPWwpd.js";import{s as Wt}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: +import{I as er}from"./chunk-2Q5K7J3B-bOW8kvkF.js";import{_ as x,G as rr,c as j,l as it,H as Me,d as ar,e as sr,j as m,b as De,s as ir,m as nr,a as or,g as cr,n as lr,I as hr,J as dr,o as Tr,i as Yt,v as Z,K as Q,L as kt,D as Be,Z as pr,x as Ft,M as Er,N as Ve}from"./mermaid.core-Bh6LVe7i.js";import{a as ur,g as se,b as dt,d as fr,c as ie,e as ne}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as Wt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var ee=(function(){var e=x(function(ut,N,v,k){for(v=v||{},k=ut.length;k--;v[ut[k]]=N);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],E=[1,14],h=[1,15],p=[1,17],_=[1,18],u=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],P=[1,32],S=[1,33],w=[1,34],M=[1,35],V=[1,36],Y=[1,37],z=[1,38],K=[1,39],X=[1,40],$=[1,42],tt=[1,43],U=[1,44],nt=[1,45],et=[1,46],W=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],wt=[1,74],Dt=[1,80],A=[1,81],D=[1,82],rt=[1,83],at=[1,84],F=[1,85],Ot=[1,86],oe=[1,87],ce=[1,88],le=[1,89],he=[1,90],de=[1,91],Te=[1,92],pe=[1,93],Ee=[1,94],ue=[1,95],fe=[1,96],_e=[1,97],ge=[1,98],xe=[1,99],Ie=[1,100],ye=[1,101],Re=[1,102],Oe=[1,103],Le=[1,104],be=[1,105],Ae=[2,78],Nt=[4,5,17,51,53,54],vt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Gt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],we=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Xt=[5,52],H=[70,71,72,73],ct=[1,151],Jt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(N,v,k,y,G,c,mt){var d=c.length-1;switch(G){case 3:return y.apply(c[d]),c[d];case 4:case 10:this.$=[];break;case 5:case 11:c[d-1].push(c[d]),this.$=c[d-1];break;case 6:case 7:case 12:case 13:this.$=c[d];break;case 8:case 9:case 14:this.$=[];break;case 16:c[d].type="createParticipant",this.$=c[d];break;case 17:c[d-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[d-2])}),c[d-1].push({type:"boxEnd",boxText:c[d-2]}),this.$=c[d-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-2]),sequenceIndexStep:Number(c[d-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-1].actor};break;case 30:y.setDiagramTitle(c[d].substring(6)),this.$=c[d].substring(6);break;case 31:y.setDiagramTitle(c[d].substring(7)),this.$=c[d].substring(7);break;case 32:this.$=c[d].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[d].trim(),y.setAccDescription(this.$);break;case 35:c[d-1].unshift({type:"loopStart",loopText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.LOOP_START}),c[d-1].push({type:"loopEnd",loopText:c[d-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[d-1];break;case 36:c[d-1].unshift({type:"rectStart",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_START}),c[d-1].push({type:"rectEnd",color:y.parseMessage(c[d-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[d-1];break;case 37:c[d-1].unshift({type:"optStart",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_START}),c[d-1].push({type:"optEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[d-1];break;case 38:c[d-1].unshift({type:"altStart",altText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.ALT_START}),c[d-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[d-1];break;case 39:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 40:c[d-1].unshift({type:"parStart",parText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[d-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[d-1];break;case 41:c[d-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.CRITICAL_START}),c[d-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[d-1];break;case 42:c[d-1].unshift({type:"breakStart",breakText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_START}),c[d-1].push({type:"breakEnd",optText:y.parseMessage(c[d-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[d-1];break;case 44:this.$=c[d-3].concat([{type:"option",optionText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[d]]);break;case 46:this.$=c[d-3].concat([{type:"and",parText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.PAR_AND},c[d]]);break;case 48:this.$=c[d-3].concat([{type:"else",altText:y.parseMessage(c[d-1]),signalType:y.LINETYPE.ALT_ELSE},c[d]]);break;case 49:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 50:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 51:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 52:case 57:c[d-1].draw="actor",c[d-1].type="addParticipant",this.$=c[d-1];break;case 53:c[d-1].type="destroyParticipant",this.$=c[d-1];break;case 54:c[d-3].draw="participant",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 55:c[d-1].draw="participant",c[d-1].type="addParticipant",this.$=c[d-1];break;case 56:c[d-3].draw="actor",c[d-3].type="addParticipant",c[d-3].description=y.parseMessage(c[d-1]),this.$=c[d-3];break;case 58:this.$=[c[d-1],{type:"addNote",placement:c[d-2],actor:c[d-1].actor,text:c[d]}];break;case 59:c[d-2]=[].concat(c[d-1],c[d-1]).slice(0,2),c[d-2][0]=c[d-2][0].actor,c[d-2][1]=c[d-2][1].actor,this.$=[c[d-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[d-2].slice(0,2),text:c[d]}];break;case 60:this.$=[c[d-1],{type:"addLinks",actor:c[d-1].actor,text:c[d]}];break;case 61:this.$=[c[d-1],{type:"addALink",actor:c[d-1].actor,text:c[d]}];break;case 62:this.$=[c[d-1],{type:"addProperties",actor:c[d-1].actor,text:c[d]}];break;case 63:this.$=[c[d-1],{type:"addDetails",actor:c[d-1].actor,text:c[d]}];break;case 66:this.$=[c[d-2],c[d]];break;case 67:this.$=c[d];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[d-1].actor}];break;case 71:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[d-4].actor}];break;case 72:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor}];break;case 73:this.$=[c[d-4],c[d-1],{type:"addMessage",from:c[d-4].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-4].actor}];break;case 74:this.$=[c[d-5],c[d-1],{type:"addMessage",from:c[d-5].actor,to:c[d-1].actor,signalType:c[d-3],msg:c[d],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[d-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[d-5].actor}];break;case 75:this.$=[c[d-3],c[d-1],{type:"addMessage",from:c[d-3].actor,to:c[d-1].actor,signalType:c[d-2],msg:c[d]}];break;case 76:this.$={type:"addParticipant",actor:c[d-1],config:c[d]};break;case 77:this.$=c[d-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[d]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[d].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,5]),{9:48,13:13,14:E,15:h,18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:z,53:K,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:W},{23:56,73:W},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:wt},{23:75,55:76,73:wt},{23:77,73:W},{69:78,72:[1,79],78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:W},{23:111,73:W},{23:112,73:W},{23:113,73:W},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],Ae),e(C,[2,6]),e(C,[2,16]),e(Nt,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(vt,i,{7:120}),e(vt,i,{7:121}),e(vt,i,{7:122}),e(Se,i,{41:123,7:124}),e(Gt,i,{43:125,7:126}),e(Gt,i,{7:126,43:127}),e(we,i,{46:128,7:129}),e(vt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Xt,Ae,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:W},{69:146,78:Dt,79:A,80:D,81:rt,82:at,83:F,84:Ot,85:oe,86:ce,87:le,88:he,89:de,90:Te,91:pe,92:Ee,93:ue,94:fe,95:_e,96:ge,97:xe,98:Ie,99:ye,100:Re,101:Oe,102:Le,103:be},e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),e(H,[2,85]),e(H,[2,86]),e(H,[2,87]),e(H,[2,88]),e(H,[2,89]),e(H,[2,90]),e(H,[2,91]),e(H,[2,92]),e(H,[2,93]),e(H,[2,94]),e(H,[2,95]),e(H,[2,96]),e(H,[2,97]),e(H,[2,98]),e(H,[2,99]),e(H,[2,100]),e(H,[2,101]),e(H,[2,102]),e(H,[2,103]),e(H,[2,104]),{23:147,73:W},{23:149,60:148,73:W},{73:[2,68]},{73:[2,69]},{58:150,104:ct},{58:152,104:ct},{58:153,104:ct},{58:154,104:ct},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:z,53:K,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,161],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,162],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,163],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,47],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,50:[1,165],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,45],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,49:[1,167],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[2,43],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,48:[1,170],51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{4:n,5:s,8:8,9:10,10:o,13:13,14:E,15:h,17:[1,171],18:16,19:p,22:_,23:41,24:u,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:P,40:S,42:w,44:M,45:V,47:Y,51:z,53:K,54:X,56:$,61:tt,62:U,63:nt,64:et,73:W},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Xt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:W},{23:178,73:W},{23:179,73:W},{58:180,104:ct},{23:181,72:[1,182],73:W},{58:183,104:ct},{58:184,104:ct},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(Nt,[2,11]),{13:186,51:z,53:K,54:X},e(Nt,[2,13]),e(Nt,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ct},{58:196,104:ct},{58:197,104:ct},{5:[2,75]},{58:198,104:ct},{23:199,73:W},{5:[2,58]},{5:[2,59]},{23:200,73:W},e(Nt,[2,12]),e(Se,i,{7:124,41:201}),e(Gt,i,{7:126,43:202}),e(we,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Xt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ct},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(N,v){if(v.recoverable)this.trace(N);else{var k=new Error(N);throw k.hash=v,k}},"parseError"),parse:x(function(N){var v=this,k=[0],y=[],G=[null],c=[],mt=this.table,d="",Mt=0,Ne=0,Qe=2,me=1,$e=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Zt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Zt)&&(gt.yy[Zt]=this.yy[Zt]);J.setInput(N,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Qt=J.yylloc;c.push(Qt);var je=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tr(ot){k.length=k.length-2*ot,G.length=G.length-ot,c.length=c.length-ot}x(tr,"popStack");function Pe(){var ot;return ot=y.pop()||J.lex()||me,typeof ot!="number"&&(ot instanceof Array&&(y=ot,ot=y.pop()),ot=v.symbols_[ot]||ot),ot}x(Pe,"lex");for(var st,xt,lt,$t,Lt={},Bt,Tt,ke,Vt;;){if(xt=k[k.length-1],this.defaultActions[xt]?lt=this.defaultActions[xt]:((st===null||typeof st>"u")&&(st=Pe()),lt=mt[xt]&&mt[xt][st]),typeof lt>"u"||!lt.length||!lt[0]){var jt="";Vt=[];for(Bt in mt[xt])this.terminals_[Bt]&&Bt>Qe&&Vt.push("'"+this.terminals_[Bt]+"'");J.showPosition?jt="Parse error on line "+(Mt+1)+`: `+J.showPosition()+` Expecting `+Vt.join(", ")+", got '"+(this.terminals_[st]||st)+"'":jt="Parse error on line "+(Mt+1)+": Unexpected "+(st==me?"end of input":"'"+(this.terminals_[st]||st)+"'"),this.parseError(jt,{text:J.match,token:this.terminals_[st]||st,line:J.yylineno,loc:Qt,expected:Vt})}if(lt[0]instanceof Array&<.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+st);switch(lt[0]){case 1:k.push(st),G.push(J.yytext),c.push(J.yylloc),k.push(lt[1]),st=null,Ne=J.yyleng,d=J.yytext,Mt=J.yylineno,Qt=J.yylloc;break;case 2:if(Tt=this.productions_[lt[1]][1],Lt.$=G[G.length-Tt],Lt._$={first_line:c[c.length-(Tt||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(Tt||1)].first_column,last_column:c[c.length-1].last_column},je&&(Lt._$.range=[c[c.length-(Tt||1)].range[0],c[c.length-1].range[1]]),$t=this.performAction.apply(Lt,[d,Ne,Mt,gt.yy,lt[1],G,c].concat($e)),typeof $t<"u")return $t;Tt&&(k=k.slice(0,-1*Tt*2),G=G.slice(0,-1*Tt),c=c.slice(0,-1*Tt)),k.push(this.productions_[lt[1]][0]),G.push(Lt.$),c.push(Lt._$),ke=mt[k[k.length-2]][k[k.length-1]],k.push(ke);break;case 3:return!0}}return!0},"parse")},Ze=(function(){var ut={EOF:1,parseError:x(function(v,k){if(this.yy.parser)this.yy.parser.parseError(v,k);else throw new Error(v)},"parseError"),setInput:x(function(N,v){return this.yy=v||this.yy||{},this._input=N,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:x(function(){var N=this._input[0];this.yytext+=N,this.yyleng++,this.offset++,this.match+=N,this.matched+=N;var v=N.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),N},"input"),unput:x(function(N){var v=N.length,k=N.split(/(?:\r\n?|\n)/g);this._input=N+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var G=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===y.length?this.yylloc.first_column:0)+y[y.length-k.length].length-k[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[G[0],G[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:x(function(){return this._more=!0,this},"more"),reject:x(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:x(function(N){this.unput(this.match.slice(N))},"less"),pastInput:x(function(){var N=this.matched.substr(0,this.matched.length-this.match.length);return(N.length>20?"...":"")+N.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:x(function(){var N=this.match;return N.length<20&&(N+=this._input.substr(0,20-N.length)),(N.substr(0,20)+(N.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:x(function(){var N=this.pastInput(),v=new Array(N.length+1).join("-");return N+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/sizeCapture-INFHLROL-DhKNPmyb.js b/static/ml_canvas/assets/sizeCapture-INFHLROL-DUGUyLSa.js similarity index 88% rename from static/ml_canvas/assets/sizeCapture-INFHLROL-DhKNPmyb.js rename to static/ml_canvas/assets/sizeCapture-INFHLROL-DUGUyLSa.js index d2102c885..f2a1be781 100644 --- a/static/ml_canvas/assets/sizeCapture-INFHLROL-DhKNPmyb.js +++ b/static/ml_canvas/assets/sizeCapture-INFHLROL-DUGUyLSa.js @@ -1 +1 @@ -import{_ as n}from"./mermaid.core-DBa20IFF.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; +import{_ as n}from"./mermaid.core-Bh6LVe7i.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=1;function a(){if(!(typeof globalThis>"u"))return globalThis}n(a,"getCaptureGlobal");function m(){var o;return!!((o=a())!=null&&o.mermaidCaptureSizes)}n(m,"shouldCaptureSizes");function d(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}n(d,"capturedFromLocation");function s(o,r){const e=a();if(!e)return;const t=r.node(),i=(t&&"ownerSVGElement"in t?t.ownerSVGElement:null)??t,p=(i==null?void 0:i.id)??"(unknown)";e.mermaidCapturedSizes??(e.mermaidCapturedSizes=[]);const u={svgId:p,sizes:o};e.mermaidCapturedSizes.push(u),e.mermaidLastCapturedSizes=u}n(s,"emitCapturedSizes");function l(o,r){const e=[];for(const t of r.nodes)t.isGroup||e.push({id:t.id,width:t.width??0,height:t.height??0});e.length!==0&&s({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:d()},nodes:e},o)}n(l,"captureNodeSizes");export{l as captureNodeSizes,m as shouldCaptureSizes}; diff --git a/static/ml_canvas/assets/stateDiagram-D77RDMKH-DsmaWosA.js b/static/ml_canvas/assets/stateDiagram-D77RDMKH-BZRhMfUy.js similarity index 96% rename from static/ml_canvas/assets/stateDiagram-D77RDMKH-DsmaWosA.js rename to static/ml_canvas/assets/stateDiagram-D77RDMKH-BZRhMfUy.js index 6079e5972..ac0367a35 100644 --- a/static/ml_canvas/assets/stateDiagram-D77RDMKH-DsmaWosA.js +++ b/static/ml_canvas/assets/stateDiagram-D77RDMKH-BZRhMfUy.js @@ -1 +1 @@ -import{s as R,a as W,S as N}from"./chunk-IMKFNOWR-D26YLBdf.js";import{_ as f,c as t,l as S,d as P,Q as _,j as z,M as U,v as C}from"./mermaid.core-DBa20IFF.js";import{s as H}from"./vendor-flow-Ct2sLZk5.js";import{l as F}from"./layout-D4UUaX_9.js";import{p as O,q as J}from"./vendor-charts-BkHP8M8k.js";import"./chunk-XXDRQBXY-Bs02z9v-.js";import"./chunk-POPQ4Y6H-oeZXlwKE.js";import"./chunk-F27PBJKO-B6ZPWwpd.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),j=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&j(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),A=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=O().x(function(s){return s.x}).y(function(s){return s.y}).curve(J),p=e.append("path").attr("d",l(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=U(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=C.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");G(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),G=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; +import{s as R,a as W,S as N}from"./chunk-IMKFNOWR-Te9v1FIK.js";import{_ as f,c as t,l as S,d as P,Q as _,j as z,M as U,v as C}from"./mermaid.core-Bh6LVe7i.js";import{s as H}from"./vendor-flow-Ct2sLZk5.js";import{l as F}from"./layout-s0gQ8r44.js";import{p as O,q as J}from"./vendor-charts-BkHP8M8k.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),j=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),Q=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
");p=p.replace(/\n/g,"
");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),Z=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=Q(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&j(n,i),i.type==="note"&&Z(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),A=0,K=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=O().x(function(s){return s.x}).y(function(s){return s.y}).curve(J),p=e.append("path").attr("d",l(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=U(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=C.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}A++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");G(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),G=f((e,i,d,c,n,l,p)=>{const a=new _({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),K(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; diff --git a/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-CIeclGCR.js b/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-CIeclGCR.js new file mode 100644 index 000000000..23b1956a7 --- /dev/null +++ b/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-CIeclGCR.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as i}from"./chunk-IMKFNOWR-Te9v1FIK.js";import{_ as s}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var f={parser:a,get db(){return new i(2)},renderer:e,styles:r,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-D_3MdGaI.js b/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-D_3MdGaI.js deleted file mode 100644 index ed748fc25..000000000 --- a/static/ml_canvas/assets/stateDiagram-v2-MP3YSRHH-D_3MdGaI.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,b as e,a,S as i}from"./chunk-IMKFNOWR-D26YLBdf.js";import{_ as s}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-XXDRQBXY-Bs02z9v-.js";import"./chunk-POPQ4Y6H-oeZXlwKE.js";import"./chunk-F27PBJKO-B6ZPWwpd.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var f={parser:a,get db(){return new i(2)},renderer:e,styles:r,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/static/ml_canvas/assets/swimlanes-42K2YHIH-Dd449bDi.js b/static/ml_canvas/assets/swimlanes-42K2YHIH-X3NDKqK8.js similarity index 99% rename from static/ml_canvas/assets/swimlanes-42K2YHIH-Dd449bDi.js rename to static/ml_canvas/assets/swimlanes-42K2YHIH-X3NDKqK8.js index 04e96e701..0a4d4744d 100644 --- a/static/ml_canvas/assets/swimlanes-42K2YHIH-Dd449bDi.js +++ b/static/ml_canvas/assets/swimlanes-42K2YHIH-X3NDKqK8.js @@ -1 +1 @@ -import{aa as Tr,l as Ln,_ as d,al as No}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var Vr=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{Vr as render}; +import{aa as Tr,l as Ln,_ as d,al as No}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Oo=5,ze=1e-5,Ve=1e-6;function Je(t){const e=[];for(let n=0;n=1-Ve||I<=Ve||I>=1-Ve?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:I}}d(Do,"segmentIntersection");function En(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(En,"isHorizontalSeg");function Ho(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Xo,"getArcSweepFlag");var Ar=.001;function Yo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&No[e.arrowTypeStart];if(o){const r=t[0],f=t[1],a=Math.atan2(f.y-r.y,f.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&No[e.arrowTypeEnd];if(s){const r=t.length,f=t[r-2],a=t[r-1],l=Math.atan2(a.y-f.y,a.x-f.x);n[r-1].x=a.x-s*Math.cos(l),n[r-1].y=a.y-s*Math.sin(l)}return n}d(Yo,"applyMarkerOffsets");function Go(t,e,n,o,s){const r=t.point.x,f=t.point.y,a={x:r-e*t.r,y:f-n*t.r},l={x:r+e*t.r,y:f+n*t.r},c=[`L${Oe(a)}`];return s==="arc"?c.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(l)}`):c.push(`M${Oe(l)}`),c}d(Go,"emitJump");function Tn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,r),c=Math.hypot(f,a);if(l0){const v=Tn(s[c-1],s[c],s[c+1]??s[c],Oo);v&&(i=v.cutLen)}let x=p,C=null;r&&cv.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-i,x-v.d);for(let v=0;vL){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r=2?o:null}catch{return null}}d(jo,"decodeDataPoints");function Uo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const c of e)s.set(c.id,c);const r=[],f=new Map;for(const c of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(c.id):c.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;f.set(c.id,p);const u=jo(p.getAttribute("data-points"))??c.points;r.push({...c,points:u})}const a=Ho(r);if(a.length===0)return;const l=new Map;for(const c of a){const g=l.get(c.jumpEdgeId)??[];g.push(c),l.set(c.jumpEdgeId,g)}for(const c of r){const g=l.get(c.id);if(!g||g.length===0)continue;const p=s.get(c.id),I=p==null?void 0:p.curve;if(I!==void 0&&!Vo(I))continue;const u=f.get(c.id);if(!u)continue;if(I===void 0){const v=u.getAttribute("d")??"";if(!zo(v))continue}const h=u.getAttribute("style")??"",i=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=i?Number.parseFloat(i[1]):null,C=i?Number.parseFloat(i[2]):null,b=$o(c,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,M=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",M)}}}d(Uo,"applyLineJumpsToSvg");function Wo(t,{measure:e}){var r,f;const n=(f=(r=t.config)==null?void 0:r.swimlane)==null?void 0:f.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(a=>Array.isArray(a.points)&&a.points.length>=2).map(a=>({id:a.id,points:a.points,curve:a.curve,arrowTypeStart:a.arrowTypeStart,arrowTypeEnd:a.arrowTypeEnd}));Uo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(Wo,"applySwimlaneLineJumps");var In="__swimlane_default__",wr=21,Po=20;function An(t){return Math.max(t.padding??Po,Po)}d(An,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const f=n-s/2,a=Math.min(r,n+s/2),l=Math.min(wr,Math.max(0,a-f)),c=f+l;if(c<=f){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:f,bottom:c}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=In}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const l of t.nodes??[])e.set(l.id,l);const n=[];for(const l of t.edges??[]){const c=typeof l.start=="string"?l.start:void 0,g=typeof l.end=="string"?l.end:void 0;!c||!g||l.labelNodeId||n.push({id:l.id,src:c,dst:g,ref:l})}const o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,f=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let l=0;for(const I of e.layers){let u=0;for(const h of I){const i=r.get(h);if(!i){u++;continue}i.layer=l,i.order=u;const x=n.x[h]??u*a,C=n.y[h]??l*f;i.x=x,i.y=C,u++}l++}const c=s.nodes??[],g=new Map,p=[];for(const I of c){if(!(I!=null&&I.isGroup))continue;I.parentId||p.push(I);const u=c.filter(b=>b.parentId===I.id);let h=1/0,i=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,M=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),i=Math.max(i,v+y/2),x=Math.min(x,L-M/2),C=Math.max(C,L+M/2))}if(h===1/0||x===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const b=I.padding??20,v=I.parentId?b:2*An(I),L=b,y=Math.max(0,i-h)+v,M=Math.max(0,C-x)+L,E=(h+i)/2,w=(x+C)/2;I.x=E,I.y=w,I.width=y,I.height=M,g.set(I.id,{minX:h,maxX:i,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let I=1/0,u=-1/0,h=0;for(const i of p){const x=i.padding??20;x>h&&(h=x);const C=g.get(i.id);C&&(I=Math.min(I,C.minY),u=Math.max(u,C.maxY))}if(I!==1/0&&u!==-1/0){const i=Math.max(0,u-I),C=Math.max(h,36),b=i+2*C,v=(I+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=I;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],M=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*An(B),H=(O.minX+O.maxX)/2;y.push(B.id),M.push(H),E.push(k)}const w=y.length;if(w>0){const B=new Map;if(w===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(ro,"measuredNodeRect");function io(t){if(t.isGroup)return;const e=ro(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(io,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function co(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(co,"classifyThreeSegmentRoute");function an(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),f=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&fe.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Ze(t,e){return t.lefte.left&&t.tope.top}d(Ze,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(wn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=ro(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Le,"portForRectSide");function lo(t,e,n,o,s,r=Yt){const f=e==="left"||e==="right",a=o==="left"||o==="right";if(f&&a){if(e==="right"&&o==="left"&&t.xn.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!f&&!a){if(e===o){if(gt(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(f&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const l=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return l&&c?[t,{x:t.x,y:n.y},n]:void 0}d(lo,"buildOrthogonalPortPath");function fo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(fo,"buildSameSideTrackPath");function ln(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=io(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(ln,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=io(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,f=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,f,a)})}return n}d(es,"collectLayoutNodeRects");function uo(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),f=e.get(s);if(!(!r||!f))return{srcId:o,dstId:s,srcInfo:r,dstInfo:f,collinearX:Math.abs(r.cx-f.cx)h||IC)return!1;const b=Math.abs(i-g.a.x)s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Qe(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const f of n){if(f===o||f.isLayoutOnly)continue;const a=f.points;if(!(!a||a.length<2))for(let l=0;lI+s&&hi+s&&po+Yt&&t=2?e[e.length-2]:void 0,l=(f?gt(f,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(tn,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Nr=.5,Bo=4;function go(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const f=rs(t[s],t[r],e);return n?[f,...t.slice(s)]:[...t.slice(0,s+1),f]}d(Nn,"clipEndpoint");function is(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Nn(s,o.srcRect,!0)),o.dstRect&&(s=Nn(s,o.dstRect,!1)),s=ue(tn(s)),s=mo(s,o.srcRect,o.dstRect),o.edge.points=ue(tn(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function On(t,e,n,o=!1){if(yt(t,e,it)){if(e.yn.bottom+it)return e;if(o){if(t.xn.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.xn.right+it)return e;if(o){if(t.yn.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(On,"snapEndpointToBoundary");function en(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?nn(t.top,t.bottom):nn(t.left,t.right)}d(Bn,"clearanceRangeForSide");function on(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function kn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const f=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,f));if(!(Math.abs(a-f)({...a}));for(let a=e;a>=0&&a=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)o.bottom+it;case"left":return yt(e,n,it)&&n.xo.right+it}}d(Dn,"leavesOutward");function Hn(t,e,n){if(t.length<3)return t;if(n){const r=_n(t[0],t[1],e);return r&&Dn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=_n(t[o-1],t[o],e);return s&&Dn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Hn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=en(o,0,1);if(r){const f=On(r,o[0],e);f!==o[0]&&(o=[f,...o.slice(1)])}o=Hn(o,e,!0)}if(n){const r=o.length-1,f=en(o,r,-1);if(f){const a=On(f,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Hn(o,n,!1)}const s=mo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Xn(t,e){for(const n of t){const o=go(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const f=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=f}}d(Xn,"prepareEdgeEndpointsForRenderer");function yo(t){return new Map(t.map(e=>[e.id,e]))}d(yo,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Yn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d(Yn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const f=r.x,a=r.y;if(typeof f!="number"||typeof a!="number")continue;const l=r.width??0,c=r.height??0;e=Math.min(e,f-l/2),n=Math.max(n,f+l/2),o=Math.min(o,a-c/2),s=Math.max(s,a+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=yo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Yn(s,e)-Yn(o,e));for(const o of n){const s=t.filter(f=>f.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function sn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);let r=1/0,f=-1/0;for(const l of s){const c=l[e];typeof c=="number"&&(r=Math.min(r,c),f=Math.max(f,c))}if(!Number.isFinite(r)||!Number.isFinite(f))return!1;const a=d(l=>r+f-l,"mirror");for(const l of n){const c=l[e];typeof c=="number"&&(l[e]=a(c));const g=l.groupTitleRect;g&&(l.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const l of o)for(const c of l.points??[])c[e]=a(c[e]);return!0}d(sn,"mirrorAxis");function ms(t){return(t.nodes??[]).some(n=>!n.isGroup)?sn(t,"y"):!0}d(ms,"applyBtDirectionTransform");function ys(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,f=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-f)*I+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-f)*I+a,Mt=j-r;G.x=ft,G.y=Mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&sn(t,"x"),!0;const h=yo(n),i=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,h);if(!G)continue;const j=i.get(G)??[];j.push(P),i.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=i.get(P.id)??[],j=po(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),M=L+2*y,E=a+M,O=(b+v)/2-M/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?C.bottom:C.top,H=I.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>I.cx?C.right:C.left,H=I.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const M=ce(v,L,ae),E=ce(L,y,ae);if(M&&E||!M&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const w=!M&&Qe(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&Qe(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(w||B)){M?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(ps,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<4)continue;const c=xt(l,.001);if(c.length<4)continue;const g=c.length-1,p=c[g],I=c[g-1],u=c[g-2],h=p.x-I.x,i=p.y-I.y,x=Math.hypot(h,i);if(x>=10||x<.001)continue;const C=I.x-u.x,b=I.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(I,p,.001),y=Ot(I,p,.001),M=Nt(u,I,.001),E=Ot(u,I,.001);if(!(L&&E||y&&M))continue;const w=a.end,B=a.start,O=w?e.get(w):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,w?[w]:[],-2)||Pt(G,j,f,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&ao(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St=0){const J=c[g-3],rt=[B,w].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const _t=[...c.slice(0,g-2),G,j];a.points=_t;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,At=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Jt=_t[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>At&&(At=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(xs,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Sn=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function bs(t,e){const s=d((u,h)=>{const i=u.x??0,x=u.y??0,C=h.x-i,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:i+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:i+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const i=xt(u.points??[]);if(i.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?i[0]:i[i.length-1],L=h?i[1]:i[i.length-2],y=s(C,v);let M=v;if(Sn(L,y)&&(M=L),gt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,M.y),max:Math.max(y.y,M.y),boundary:y,railEnd:M,rect:b};if(yt(y,M,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,M.x),max:Math.max(y.x,M.x),boundary:y,railEnd:M,rect:b}},"terminalLaneFor"),f=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&>(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),l=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:f(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),c=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const i=f(u,h);if(i2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const i=xt(u.edge.points??[]);if(i.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const M=i.length>1&&ce(i[1],u.railEnd,et),E=i.slice(M?2:1),w=E[0];return w&&!Sn(w,C)?void 0:[x,C,...E]}const v=i.length>1&&ce(i[i.length-2],u.railEnd,et),L=i.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Sn(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,i=xt(h.points??[]);if(i.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,M=v.x??0,E=v.y??0,[w,B]=i;return yt(w,B,et)&&Math.abs(y-E)<1&&Math.abs(L-M)>1||gt(w,B,et)&&Math.abs(L-M)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let i=!1;for(let x=0;x{const w=p(M),B=p(E);return w!==B?Number(w)-Number(B):+!E.atStart-+!M.atStart});for(const M of y){for(const E of I){const w=g(M,E);if(!w)continue;const B=r({...M.edge,points:w},M.atStart);if(!(!B||h.some(O=>O.edge!==M.edge&&(l(B,O)||L&&c(B,O))))){M.edge.points=w,i=!0;break}}if(i)break}}if(!i)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,l)=>{const c=a.start,g=a.end,p=at(l);if(p.length!==l.length-1)return!1;const I=[c,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,I,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const i of p)for(const x of at(xt(h)))if(de(i,x,.5)>=Xt||he(i.a,i.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),f=d((a,l)=>{if(l+4>=a.length)return;const c=a[l],g=a[l+1],p=a[l+2],I=a[l+3],u=a[l+4],h=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&>(c,I,et)&>(c,u,et)&>(g,p,et)&&(g.x-c.x)*(I.x-p.x)<0,i=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&yt(c,I,et)&&yt(c,u,et)&&yt(g,p,et)&&(g.y-c.y)*(I.y-p.y)<0;if(h||i)return xt([...a.slice(0,l+1),u,...a.slice(l+5)]);if(l+5>=a.length)return;const x=a[l+5],C=Ot(c,g)&&Nt(g,p)&&Ot(p,I)&&Nt(I,u)&&Ot(u,x)&>(c,u,et)&>(c,x,et)&>(p,I,et)&&(p.x-g.x)*(u.x-I.x)<0,b=Nt(c,g)&&Ot(g,p)&&Nt(p,I)&&Ot(I,u)&&Nt(u,x)&&yt(c,u,et)&&yt(c,x,et)&&yt(p,I,et)&&(p.y-g.y)*(u.y-I.y)<0;if(!(!C&&!b))return xt([...a.slice(0,l+1),x,...a.slice(l+6)])},"withoutDogleg");for(let a=0;a<8;a++){let l=!1;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(let p=0;p<=g.length-5;p++){const I=f(g,p);if(!(!I||!r(c,I))){c.points=I,l=!0;break}}if(l)break}if(!l)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Gn(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),l=d((h,i,x)=>xt(h===i?x??[]:h.points??[]),"pointsFor"),c=d((h,i)=>{let x=0;for(let C=0;C{const i=at(h);if(i.length!==3)return;const x=i[1];if(!(i[0].horizontal===x.horizontal||i[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),I=d((h,i,x)=>{const C=h.map(v=>({...v}));if(i.horizontal)C[i.index].y=x,C[i.index+1].y=x;else if(i.vertical)C[i.index].x=x,C[i.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,i,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(i);if(b.length!==i.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,f,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(l(v)))if(de(L,y,.5)>=Xt)return!1}return c(h,i)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const i=c();let x=!1;for(const C of a){const b=l(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(M=>M.rect.top))-20,Math.max(...L.map(M=>M.rect.bottom))+20]:[Math.min(...L.map(M=>M.rect.left))-20,Math.max(...L.map(M=>M.rect.right))+20];for(const M of y){const E=I(b,v.segment,M);if(!(!E||!u(C,E,i))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(Gn,"liftObstacleHuggingSameSideRails");function $n(t,e){const o=d(l=>{const c=l.groupTitleRect;if(!(!c||typeof c.left!="number"||typeof c.right!="number"||typeof c.top!="number"||typeof c.bottom!="number"||!Number.isFinite(c.left)||!Number.isFinite(c.right)||!Number.isFinite(c.top)||!Number.isFinite(c.bottom)||c.right<=c.left||c.bottom<=c.top))return{left:c.left,right:c.right,top:c.top,bottom:c.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId)return;const c=l.direction,g=typeof c=="string"?c.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(l),I=l.y,u=l.height;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h{if(!l.horizontal)return!1;const g=l.a.y;return g<=c.top+et||g>=c.bottom-et?!1:Wt(l.a.x,l.b.x,c.left,c.right)>=Xt},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(l=>!!l);if(f.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const c=xt(l.points??[]);for(const g of at(c))for(const p of f)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const l of f){const c=l.node.y,g=l.node.height;typeof c!="number"||typeof g!="number"||!Number.isFinite(c)||!Number.isFinite(g)||g<=0||(l.node.y=c-a/2,l.node.height=g+a,l.node.groupTitleRect={...l.rect,top:l.rect.top-a,bottom:l.rect.bottom-a})}}d($n,"liftTopLaneTitleBandsAboveRails");function zn(t,e){const o=d(c=>{const g=c.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId||c.direction!=="LR")return;const p=o(c),I=c.x,u=c.width;if(!p||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i{if(!c.vertical)return!1;const p=c.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(c.a.y,c.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),f=d((c,g)=>{if(!c.horizontal)return!1;const p=c.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(c.a.x,c.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(c=>!!c);if(a.length===0)return;let l=0;for(const c of t){if(c.isLayoutOnly)continue;const g=xt(c.points??[]);for(const p of at(g))for(const I of a)if(r(p,I.rect))l=Math.max(l,I.rect.right-p.a.x+4);else if(f(p,I.rect)){const u=Math.min(p.a.x,p.b.x);l=Math.max(l,I.rect.right-u+4)}}if(!(l<=et))for(const c of a){const g=c.node.x,p=c.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(c.node.x=g-l/2,c.node.width=p+l,c.node.groupTitleRect={...c.rect,left:c.rect.left-l,right:c.rect.right-l})}}d(zn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,i=new Map)=>xt(i.get(h)??h.points??[]),"replacementPointsFor"),f=d((h=new Map)=>{let i=0;for(let x=0;xs.reduce((i,x)=>i+oe(r(x,h)),0),"totalBends"),l=d(h=>{const i=r(h);if(i.length<4)return;const x=i[i.length-2],C=i[i.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),c=d((h,i)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))v={x:i.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,i.tailStart,i.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,i)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(i))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,i,x)=>{for(const C of s)if(C!==h){for(const b of at(i))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),I=d((h,i,x)=>!g(h,i)&&!p(h,i,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const i of s){const x=i.end;if(!x||!e.has(x)||r(i).length<4)continue;const b=h.get(x)??[];b.push(i),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=f();if(i===0)return;const x=a();let C,b=i,v=x;for(const L of u().values())for(let y=0;y=i||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:f}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),l=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),c=d((L=new Map)=>{let y=0;for(let M=0;Ma.reduce((y,M)=>y+oe(l(M,L)),0),"totalBends"),p=d(L=>{const y=L.start,M=L.end,E=y?e.get(y):void 0,w=M?e.get(M):void 0,B=E?te(E):void 0,O=w?te(w):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),I=d((L,y,M)=>{if(M.index<=0||M.index+1>=y.length-1)return;const E=p(L);if(E){if(M.vertical){const w=M.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=wO+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"vertical",side:k,coord:w,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const w=M.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=wO+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:M.index,axis:"horizontal",side:k,coord:w,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const M=l(y);for(const E of at(M)){const w=I(y,M,E);w&&L.push(w)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),i=d(L=>{const y=[],M=new Set;for(const E of L){if(M.has(E))continue;const w=[E],B=[];for(M.add(E);w.length>0;){const O=w.pop();B.push(O);for(const k of L)!M.has(k)&&h(O,k)&&(M.add(k),w.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const M of L)y.some(E=>Math.abs(E-M.coord){const y=L.map(w=>w.coord),M=x(L),E=[];if(L.length<=6){const w=new Array(M.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of M.entries())w[k]||(w[k]=!0,B.push(H),O(),B.pop(),w[k]=!1)},"visit");return O(),E}for(let w=0;w{const M=new Map;for(const[w,B]of L.entries()){const O=y[w],k=M.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),M.set(B.edge,k)}const E=new Map;for(const[w,B]of M){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(w,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,M]of L){const E=[y.start,y.end].filter(w=>!!w);for(const w of at(M))if(Pt(w.a,w.b,r,E,-2)||Pt(w.a,w.b,f,[],-2))return!1}for(let y=0;y=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=c();if(y===0)return;let M,E=y,w=g(),B=Number.POSITIVE_INFINITY;for(const O of i(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=c(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>w||G===w&&j>=B)||(M=H,E=P,w=G,B=j)}if(!M)return;for(const[O,k]of M)O.points=k}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),f=d((u,h,i)=>xt(u===h?i??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,i)=>{const x=i.a.x-i.b.x,C=i.a.y-i.b.y;return h+Math.hypot(x,C)},0),"pathLength"),l=d((u,h)=>{let i=0;for(let x=0;x{if(u.horizontal){const i=u.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const i=u.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),i=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const i=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(i,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(i,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-i.x)!==Math.sign(b.x-C.x):Math.sign(x.y-i.y)!==Math.sign(b.y-C.y)))return[];const M=gt(i,b,et)||yt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],E=M.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:M.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),w=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return w.has(O)?!1:(w.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,h,i)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>c(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(f(b)))if(de(v,L,.5)>=Xt)return!1}return l(u,h)<=i},"candidateIsSafe");for(let u=0;u<8;u++){const h=l();let i,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=f(L),M=oe(y,et),E=a(y);for(let w=0;w<=y.length-4;w++)for(const B of p(y,w)){const O=oe(B,et),k=a(B);if(!(OC||P===C&&(O>b||O===b&&k>=v)||(i=L,x=B,C=P,b=O,v=k)}}if(!i||!x)return;i.points=x}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const f=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&f.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(f.length===0)return;const a=new Map(f.map(R=>[R.id,R])),l=f.map(R=>({id:R.id,rect:R.rect})),c=["top","bottom","left","right"],g={top:Math.min(...f.map(R=>R.rect.top))-20,bottom:Math.max(...f.map(R=>R.rect.bottom))+20,left:Math.min(...f.map(R=>R.rect.left))-20,right:Math.max(...f.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),I=new Map(p.map((R,F)=>[R,F])),u=d(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(g[R]+F*20*V);return _},"outwardTracksForSide"),h=d((R,F=new Map)=>xt(F.get(R)??R.points??[]),"replacementPointsFor"),i=d((R,F)=>{let _=0;for(const V of R)for(const K of F)he(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),x=d((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y0&&(F+=T,_.push({first:q,second:A,count:T}),Z(q),Z(A))}}return K.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const Z of R.pairs)(_.has(Z.first)||_.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z{const F=new Map;for(const K of R.pairs){const Z=F.get(K.first)??new Set;Z.add(K.second),F.set(K.first,Z);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of F.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(I.get(q)??0)-(I.get(m)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),L=d(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),y=d(R=>{const F=[];for(const _ of v(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>L(Y))),Z=[..._];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(I.get(Y)??0)-(I.get(q)??0)),F.push(Z)}return F},"pairSearchGroups"),M=d((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),E=d(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),w=d(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((F,_)=>F+oe(h(_,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((F,_)=>F+w(h(_,R)),0),"totalLength"),k=d((R,F,_=new Map)=>{const V=at(F);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,_)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Pt(V.a,V.b,l,_,-2))return!0;return!1},"pathHitsNode"),P=d((R,F)=>{const _=ue(xt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=d((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,Z=[j(F,_,V),g[_]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,fo(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:Z,y:F.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,F,_,V,K)=>{for(const Z of u(_))for(const Y of u(K))P(R,[F,{x:F.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,F,_,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:Y,y:F.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=d((R,F,_,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(_))for(const q of u(K))for(const m of Z)P(R,[F,{x:F.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const F=new Set;return R.map(_=>xt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,F,_,V)=>{const K=[],Z=lo(R,F,_,V,20,et);Z&&P(K,Z),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?Mt(K,R,F,_,V):Y?Ht(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[F,_,{x:S,y:_.y},{x:S,y:q.y},q]);for(const A of m)P(R,[F,_,{x:S,y:_.y},{x:S,y:A},{x:q.x,y:A},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,F,_,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of c){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[F,_,{x:_.x,y:S},{x:q.x,y:S},q]);for(const A of m)P(R,[F,_,{x:_.x,y:S},{x:A,y:S},{x:A,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const F=R.start,_=R.end,V=_?a.get(_):void 0;if(!F||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const F=R.start,_=R.end,V=F?a.get(F):void 0,K=_?a.get(_):void 0;if(!V||!K)return[];const Z=[];for(const Y of c){const q=Le(V,Y);for(const m of c)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),At=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,F,_)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=_.get(K)??at(h(K));F.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=i(q,_.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:w(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,F,_,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===F||m.second===F||m.first===V||m.second===V)&&(Y+=m.count);let q=i(_.segments,K.segments);for(const m of p){if(m===F||m===V)continue;const S=Z.get(m)??at(h(m));q+=i(_.segments,S)+i(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,F)=>R.segments.some(_=>F.segments.some(V=>de(_,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Ee(F,V),"pairCandidatesAreCompatible"),Te=d((R,F,_,V,K)=>{const Z=Jt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),un=d((R,F)=>R.crossings{let K=V;for(const Z of F.candidates)for(const Y of _.candidates){if(!me(F,Z,_,Y))continue;const q=Te(R,F,Z,_,Y);q&&un(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),gn=d(R=>{const F=B(),_=O(),V=At(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,w(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:F,length:_};const A={current:R,currentBends:F,currentLength:_,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,Z=_,Y=Number.POSITIVE_INFINITY;for(const m of F.edges){const S=oe(h(m),et);for(const A of St(m)){const T=H(m,A),N=!T&&k(m,A),D=M(F,m,A),W=oe(A,et);T||N||!(D<_||D===_&&WZ||D===Z&&W>=Y||(V=m,K=A,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=gn(F);if(!q)return;for(const[m,S]of q)m.points=S}}d(vs,"resolveRenderedOrthogonalCrossings");var be=.001,Br=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=ln(e),s=["top","bottom","left","right"],r=20,f={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},a=d((i,x,C,b)=>{const v=[],L=lo(i,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(fo(i,x,C,f[x])),v},"buildOrthogonalPathCandidates"),l=d((i,x)=>{for(let C=0;C{let b=0;const v=Be(i,be),L=x.start,y=x.end;for(const M of t){if(M===x||M.isLayoutOnly)continue;const E=M.start,w=M.end;if(!C&&L&&y&&(E===L||E===y||w===L||w===y))continue;const B=M.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(ho(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Br&&b++}}return b},"pathConflictCount"),g=4,p=d((i,x)=>{const C=Math.abs(i.y-x.rect.top),b=Math.abs(i.y-x.rect.bottom),v=Math.abs(i.x-x.rect.left),L=Math.abs(i.x-x.rect.right);let y="top",M=C;return b{const b=I.get(i)??[];b.push({side:x,edgeId:C}),I.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points??[];if(x.length<1)continue;const C=i.id??"",b=i.start,v=i.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((i,x,C)=>{var b;return((b=I.get(i))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const x=i.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C0){const Mt=c(tt,i,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}c(tt,i)>w||ftG.edgeId!==M));const P=I.get(v);P&&I.set(v,P.filter(G=>G.edgeId!==M)),u(b,p(B[0],L),M),u(v,p(B[B.length-1],y),M)}}}d(Ls,"simplifyDetouredEdges");var Qt=.001,ko=10,Ue=7;function Vn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const f=r.x-s.x,a=r.y-s.y;if(!(Math.abs(f)+Math.abs(a)r&&Ze(t,Es(r)))}d(jn,"labelOverlapsOwnMarker");function Ke(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let x=0;x{const x=wn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&Ze(x,b))return!0;return!1},"labelOverlapsForeignNode"),c=d((h,i)=>{const x=wn(i,r);for(const C of n)if(C.edgeId!==h&&an(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,i,x)=>l(h,x)||c(i,x),"labelOverlapsAnything"),p=[],I=d(h=>{for(const{id:i,rect:x}of s)if(ts(x,h))return i},"findContainingLane"),u=d((h,i)=>p.some(x=>x.labelId!==h&&Ze(i,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const x=e.get(i);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx0?y:L,E=b>=v?"horizontal":"vertical",w=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,At=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==At?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=I(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+f,St=ut.rect.right-b/2-f,At=ut.rect.top+v/2+f,Kt=ut.rect.bottom-v/2-f;if(pt>St||At>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,At,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt{const J=w(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!jn(St.rect,C)&&!u(i,St.rect)&&!g(i,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=w(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const At=j(St);if(At&&!jn(At.rect,C)&&!u(i,At.rect)&&!l(i,At.rect)&&(rt||!c(h.id,At.rect)))return{laneId:At.laneId,anchor:At.anchor}}},"findLaneContainingFallback"),_t=Mt(M)??(M.lengthrt.labelId===i);J>=0?p[J]={labelId:i,rect:nt}:p.push({labelId:i,rect:nt})}}}d(Ke,"anchorLabelsToPolyline");var Cn=1e-6,kr=8,Fo=kr/2,Fr=3;function Un(t,e){return t{const g=Un(a,l);let p=0;const I=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const i=c==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");I(f.labelNodeId);for(const u of t){if(u===f||u.isLayoutOnly)continue;const h=u.start,i=u.end;!h||!i||Un(h,i)===g&&I(u.labelNodeId)}return p>0?p+Fr:0},"labelClearanceFor");for(const f of t){if(f.isLayoutOnly)continue;const a=f.points;if(!co(a,Cn))continue;const l=uo(f,n,Cn);if(!l)continue;const{srcId:c,dstId:g,srcInfo:p,dstInfo:I,collinearX:u,collinearY:h}=l;if(u===h)continue;let i,x;if(u){const y=I.cy>p.cy;i={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:I.cx,y:y?I.rect.top:I.rect.bottom}}else{const y=I.cx>p.cx;i={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?I.rect.left:I.rect.right,y:I.cy}}if(Pt(i,x,o,[c,g],1))continue;const b=r(f,c,g,u?"x":"y"),v=b>Fo?b:Fo,L=[0,v,-v];for(const y of L){const M={...i},E={...x};if(u){if(M.x+=y,E.x+=y,M.x<=p.rect.left||M.x>=p.rect.right||E.x<=I.rect.left||E.x>=I.rect.right)continue}else if(M.y+=y,E.y+=y,M.y<=p.rect.top||M.y>=p.rect.bottom||E.y<=I.rect.top||E.y>=I.rect.bottom)continue;if(!Pt(M,E,o,[c,g],1)&&!Qe(M,E,t,f,{epsilon:Cn})){f.points=[M,E];break}}}}d(Ts,"straightenCollinearSiblingDetours");function Wn(t,e){const{realNodeRects:l,labelNodeRects:c}=Me(e.values()),g=d((y,M)=>Be(M,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=M.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const M of t){if(M.isLayoutOnly)continue;const E=M.points;!E||E.length<2||y.push(...g(M,xt(E)))}return y},"allSegments"),I=d((y,M)=>y.horizontal&&M.horizontal?Wt(y.a.x,y.b.x,M.a.x,M.b.x)>=8&&Math.abs(y.a.y-M.a.y)<7:y.vertical&&M.vertical?Wt(y.a.y,y.b.y,M.a.y,M.b.y)>=8&&Math.abs(y.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,M)=>{const E=y.start,w=y.end,B=g(y,M);if(B.length!==M.length-1)return!1;const O=[E,w].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,l,O,-2)||Pt(H.a,H.b,c,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(I(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,M)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const w=E.map(B=>({...B}));if(y.horizontal)w[y.index].y+=M,w[y.index+1].y+=M;else if(y.vertical)w[y.index].x+=M,w[y.index+1].x+=M;else return;return g(y.edge,w).length===w.length-1?w:void 0},"shiftedCandidate"),i=d((y,M)=>({x:y.x??(M.left+M.right)/2,y:y.y??(M.top+M.bottom)/2}),"nodeCenter"),x=d(y=>{const M=y.edge,E=xt(M.points??[]);if(E.length!==4||y.index!==1)return;const w=M.start?e.get(M.start):void 0,B=M.end?e.get(M.end):void 0,O=w?te(w):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!w||!B||!O||!k||H.length===0))return{sourceCenter:i(w,O),targetCenter:i(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,M,E,w,B,O)=>{const k=w.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+M;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,M,E,w,B,O)=>{const k=w.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+M;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,M)=>{const E=x(y);if(E){if(y.vertical)return C(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,M,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const M=p();let E=!1;for(let w=0;wP.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(Wn,"nudgeSharedInteriorSubpaths");function As(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,f=o.x-n.x,a=o.y-n.y,l=s*a-r*f;if(Math.abs(l)<1e-10)return!1;const c=n.x-t.x,g=n.y-t.y,p=(c*a-g*f)/l,I=(c*r-g*s)/l,u=.01;return p>u&&p<1-u&&I>u&&I<1-u}d(As,"segmentsIntersect");function ws(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const l=a.points;if(!l||l.length<2)continue;const c=a.start,g=a.end,p=a.labelNodeId,I=a.id??`${c}->${g}`;for(const u of s)if(!(u.nodeId===c||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h0){const a=o.filter(c=>c.type==="edge-node-overlap").length,l=o.filter(c=>c.type==="edge-edge-crossing").length;Ln.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${l} edge crossing(s)`);for(const c of o)Ln.warn(`[SWIMLANE_VALIDATE] ${c.type}: ${c.detail}`)}return o}d(ws,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ys(t,e)||e==="BT"&&s.length>0&&!ms(t))return;for(const a of o){if(a.isLayoutOnly)continue;const l=a.points;!l||l.length<2||(a.points=ue(tn(l)))}Ls(o,n),Ts(o,n),ps(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Ke(o,r),is(o,r),xs(o,r),Wn(o,r),bs(o,r),Ms(o,r),Gn(o,r),Is(o,r);const f=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ke(o,r),Xn(o,r),Gn(o,r),Ke(o,r),Xn(o,r)},"finalizeRenderedEdges");f(),Wn(o,r),f(),$n(o,r),zn(o,r),$n(o,r),zn(o,r)}d(Rs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const f=`${r.id}:${r.src}->${r.dst}`;n.has(f)||(n.add(f),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function xo(t,e){return t.edges.filter(n=>n.dst===e)}d(xo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function bo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(bo,"buildSortedSuccessorMap");function Mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(Mo,"buildInDegreeMap");function Io(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Io,"sortedZeroInDegreeNodes");function fn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(fn,"buildPredecessorSuccessorMaps");function So(t,e,n,o){var f,a;let s=0;for(const l of t.nodes)o!=null&&o.skipGroups&&((f=t.nodeById.get(l))!=null&&f.isGroup)||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(l))!=null&&a.isGroup)||r[Math.max(0,n[l]??0)].push(l);return r}d(So,"buildLayersFromRanks");function _e(t){const e=Mo(t),n=Io(e),o=[],s=bo(t);for(;n.length;){const r=n.shift();o.push(r);for(const f of s.get(r)??[])if(e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0){let a=0;for(;a{if(s-o<=1)return 0;const r=o+s>>1;let f=n(o,r)+n(r,s),a=o,l=r,c=o;for(;a=s||ap.dst===I.dst?p.id.localeCompare(I.id):p.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const I=p.dst;o[I]===0?r(I):o[I]===1&&s.push(p)}o[g]=2},"dfs"),f=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of f)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),l=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function ge(t){const e=Ps(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function dn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(dn,"buildTopLaneOrder");function vo(t,e){const n=dn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const f of e)!o.has(f)||s.has(f)||(s.add(f),r.push(f));for(const f of n)s.has(f)||r.push(f);return r}d(vo,"resolveTopLaneOrder");var _r={EPSILON:1e-6},rn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},_o={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=fn(n);for(const y of r.values())y.sort((M,E)=>M.localeCompare(E));const f=_e(n)??[...n.nodes].sort((y,M)=>y.localeCompare(M)),a=new Map;for(const[y,M]of f.entries())a.set(M,y);const l=new Map,c=new Map;for(const y of n.nodes)c.set(y,[]);for(const y of f){const M=(r.get(y)??[]).filter(E=>l.has(E));if(M.length>0){const E=ks(y,M,{laneOf:o,rankHint:s,topoIndex:a});l.set(y,E),c.get(E).push(y)}else l.has(y)||l.set(y,null)}for(const y of n.nodes)l.has(y)||l.set(y,null);const g=new Set;for(const y of n.nodes)(l.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,M)=>{const E=a.get(y)??0,w=a.get(M)??0;return E===w?y.localeCompare(M):E-w}),I=Fs(n),u=new Map;for(const[y,M]of I.entries())u.set(y,[...M].sort((E,w)=>E.localeCompare(w)));const h=_s(u),i=Ds(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of i)for(const M of y.nodes){const E=x.get(M);E?E.push(y.id):x.set(M,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const M of c.get(y)??[])L(M);b.push(y)}},"walk");for(const y of p)L(y);for(const y of f)L(y);return{parent:l,children:c,roots:p,componentOf:h,blocks:i,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:f}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,f)=>{var i,x;const a=n.laneOf(r),l=n.laneOf(f),c=a!=null&&a===o,g=l!=null&&l===o;if(c!==g)return c?-1:1;const p=(i=n.rankHint)==null?void 0:i[r],I=(x=n.rankHint)==null?void 0:x[f];if(p!=null&&I!=null&&p!==I)return I-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(f)??0;return u!==h?u-h:r.localeCompare(f)})[0]}d(ks,"chooseParent");function Fs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Fs,"buildAdjacency");function _s(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const f of t.get(r)??[])e.has(f)||s.push(f)}}n++}return e}d(_s,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const f=d((a,l)=>{e.set(a,++r),n.set(a,r);for(const c of t.get(a)??[])c!==l&&(e.has(c)?(e.get(c)??0)<(e.get(a)??0)&&(o.push([a,c]),n.set(a,Math.min(n.get(a)??r,e.get(c)??r))):(o.push([a,c]),f(c,a),n.set(a,Math.min(n.get(a)??r,n.get(c)??r)),(n.get(c)??0)>=(e.get(a)??0)&&s.push(Hs(a,c,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||f(a,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const f=n.pop();if(s.push(f),r.add(f[0]),r.add(f[1]),f[0]===t&&f[1]===e||f[0]===e&&f[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,f=new Array(r).fill(-1),a=new Array(r).fill(0),l=[],c=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(f[L]=-1,a[L]=0,c.has(b)||(c.add(b),l.push(b)))}for(;l.length>0;){const b=l.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(c.has(y))continue;const M=s.get(y);M!=null&&(f[M]=v,a[M]=a[v]+1,c.add(y),l.push(y))}}for(const b of o){if(c.has(b))continue;const v=s.get(b);v!=null&&(f[v]=-1,a[v]=0,c.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b{if(b===-1||v===-1)return-1;a[b]>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const M=p[y][b],E=p[y][v];M===-1||E===-1||M!==E&&(b=M,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],M=e[L];if(y==null||M==null||(y>M&&([v,L]=[L,v],[y,M]=[M,y]),y==null||M==null||y===M))continue;const E=s.get(v),w=s.get(L);if(E==null||w==null)continue;const B=I(E,w);if(B===-1)continue;const O=u[B];for(let k=y;k{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,M=n.children.get(b)??[];for(const E of M){const w=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=w.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}i(y,w)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let f=n[r]??0;const a=[...e.get(r)??[]];a.sort(Lo(n));for(const l of a){s(l);const c=o.get(l);c!=null&&(f=Math.min(f,c))}o.set(r,f)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Lo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Lo,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const l of e){const c=n[l]??0;c>s&&(s=c)}const r=Array.from({length:s+1},()=>[]),f=new Set,a=d(l=>{if(f.has(l))return;f.add(l);const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l);for(const g of o(l))a(g)},"emit");for(const l of t)a(l);for(const l of e)if(!f.has(l)){const c=n[l]??0;r[c]||(r[c]=[]),r[c].push(l),f.add(l)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const f=e[s]??0,a=[],l=[],c=n.get(s);for(const g of r){const p=o.get(g)??f;p>f?a.push({child:g,min:p}):l.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),l.sort((g,p)=>{const I=(c==null?void 0:c.get(g))??0,u=(c==null?void 0:c.get(p))??0;if(I!==u)return I-u;const h=o.get(g)??f,i=o.get(p)??f;return h!==i?h-i:g.localeCompare(p)}),[...a.map(g=>g.child),...l]}}d(zs,"createChildOrderer");function cn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const f=Xs(t,e,o),a=[...r].sort(Lo(e)),l=Ys(a,s,e),c=zs(s,e,f,l);let g=Gs(a,t.nodes,e,c);return g=$s(g),g}d(cn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),f=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&f.push(r.get(a.dst));return Co(f)}d(Vs,"countCrossingsBetweenAdjacent");function Kn(t,e,n){const o=[];for(const r of e){const f=n[r.src],a=n[r.dst];if(f==null||a==null||f===a)continue;let l=r.src,c=r.dst,g=f,p=a;f>a&&(l=r.dst,c=r.src,g=a,p=f);for(let I=g;I(n[I]??0)-(n[p]??0));for(const p of g){const I=n[p]??0;if(I===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=I)continue;const h=I;n[p]=u;const i=cn(t,n,s),x=Kn(i,t.edges,n);x(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const f=t.edges.filter(i=>i.src===s);if(f.length===0)continue;let a=!1,l=0;for(const i of f){const x=n(i.dst);x==null||x===r?a=!0:l++}if(l===0||a)continue;let c=0,g=!1;for(const i of t.edges){if(i.dst!==s)continue;const x=n(i.src);x&&(x===r?g=!0:c++)}if(c>0||!g)continue;const p=e[s]??0,I=p+l;let u=0;for(const i of t.edges)i.dst===s&&(u=Math.max(u,(e[i.src]??0)+1));const h=Math.max(p,u,I);h!==p&&(e[s]=h)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=Ie(t),o=_e(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let f=Object.create(null);for(const l of o){const c=xo(n,l),g=e!=null&&e.ignoreCrossLaneEdges?c.filter(p=>{const I=r(p.src),u=r(l);return!I||!u?!0:I===u}):c;if(g.length===0)f[l]=0;else if(s&&g.length===1){const p=g[0].src,I=r(p),u=r(l);I!==u?f[l]=f[p]??0:f[l]=(f[p]??0)+1}else{let p=-1/0;for(const I of g)p=Math.max(p,(f[I.src]??0)+1);f[l]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(f=js(n,f)),e!=null&&e.ignoreCrossLaneEdges&&Us(n,f),{layers:cn(n,f,r),rankOf:f,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=Ie(t),s={...Ws(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:f,succs:a}=fn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(h.src),x=r(h.dst);if(i&&x&&i!==x)return!1}return!0}),l=_e(n)??[...n.nodes],c=[...l].reverse(),g=d((h,i)=>{let x=0;for(const v of f.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,i)),Math.min(Math.max(i,x),C)},"clampFeasible"),p=rn.GRAVITY_ITERATIONS,I=d(h=>{let i=!1;for(const x of h){const C=f.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,w)=>E+(s[w]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,w)=>E+(s[w]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),M=g(x,y);M!==s[x]&&(s[x]=M,i=!0)}return i},"relaxOrder");for(let h=0;h0){const x=Math.min(...i.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:So(n,l,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=Mo(t),n=bo(t);let o=Io(e);const s=[];for(;o.length>0;){const r=[];for(const f of o){s.push(f);for(const a of n.get(f)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((f,a)=>f.localeCompare(a))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?qs(n)??[...n.nodes].sort():_e(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),f=Object.create(null),a=new Map,l=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const I=xo(n,g);let u=0;if(I.length>0)for(const C of I){const b=C.src,v=f[b]??0;u=Math.max(u,v+l(b,g))}const h=r(g),i=a.get(h)??0,x=Math.max(u,i);f[g]=x,a.set(h,x+1)}return{layers:So(n,o,f,{skipGroups:!0}),rankOf:f,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let f=0;const a=new Map(n.nodeById),l=d(u=>{const h=`placeholder-${f++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,i),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),c=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of c){const h=o[u.src]??0,i=o[u.dst]??0;if(i-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function qn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(qn,"median");function Jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Jn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function Zn(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),f=ke(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push({u:r.get(c.src),v:f.get(c.dst)});a.sort((c,g)=>c.u===g.u?c.v-g.v:c.u-g.u);const l=a.map(c=>c.v);return Co(l)}d(Zn,"countCrossingsBetweenAdjacent");function qe(t,e,n){return[...t].sort((o,s)=>{const r=qn(e.get(o)??[]),f=qn(e.get(s)??[]);return r===f?tr(o,s,n):isFinite(r)?isFinite(f)?r-f:-1:1})}d(qe,"sortByHeuristic");function Qn(t,e,n,o,s,r){const f=ke(t),a=ke(e),l=Qs(e,f,n,o);if(!s||!r||r.length===0)return qe(e,l,a);const c=new Map;for(const I of e){const u=s(I),h=c.get(u)??[];h.push(I),c.set(u,h)}const g=[];for(const I of r){const u=c.get(I);if(!u||u.length===0)continue;const h=qe(u,l,a);g.push(...h)}const p=c.get(null);if(p&&p.length>0){const I=qe(p,l,a);for(const u of I){const h=Jn(l.get(u)??[]);let i=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Jn(l.get(C)??[]);if(hf.has(i.src)&&a.has(i.dst)),g=l?n.filter(i=>a.has(i.src)&&l.has(i.dst)):void 0,p=d(i=>{let x=Zn(t,i,c);return g&&o&&(x+=Zn(i,o,g)),x},"crossingScore"),I=s?new Map:null;if(s&&I)for(const i of e)I.set(i,s(i));let u=!0,h=p(r);for(;u;){u=!1;for(let i=0;i+1[...a]),s=e.edges,r=ge(e),f=vo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let l=1;l=0;l--)o[l]=Qn(o[l+1],o[l],s,"up",r,f),o[l]=to(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=(n==null?void 0:n.layerGap)??_o.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??_o.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,f=(n==null?void 0:n.direction)??"TB",a=f==="LR"||f==="RL",l=t.layers,c=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),i=vo(e,n==null?void 0:n.laneOrder),x=l.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1Math.max(Mt,I(Ht)),0),H=l[O+1].reduce((Mt,Ht)=>Math.max(Mt,I(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of l)for(const k of O)b.add(h(k));const v=b.has(null),L=i.filter(O=>b.has(O)),y=[...v?[null]:[],...L],M=Object.create(null);for(const O of L)M[O]=0;v&&(M.null=0);for(const O of l){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+I(ft),0)+s*Math.max(0,G.length-1);M[P]=Math.max(M[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);M.null=Math.max(M.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?M.null:M[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;PI(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let _t=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];c[J]=_t+rt/2,g[J]=w+H/2,_t+=rt+s}}}const G=C[O]??0;w+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((c[H]??0)+(c[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(c[tt]=G)}}return{x:c,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function eo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:f}of e){const a=n.get(s),l=n.get(r);a==null||l==null||(o+=f*Math.abs(a-l))}return o}d(eo,"laneArrangementCost");function ar(t){const e=dn(t);if(e.length<2)return[];const n=new Map(e.map((r,f)=>[r,f])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const f=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!f||!a||!t.nodeById.has(f)||!t.nodeById.has(a))continue;const l=o(f),c=o(a);if(!l||!c||l===c)continue;const g=n.get(l),p=n.get(c);if(g==null||p==null)continue;const[I,u]=g<=p?[l,c]:[c,l],h=`${I}\0${u}`,i=s.get(h);i?i.weight++:s.set(h,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function no(t,e,n){const o=[...t];let s=eo(o,e),r=!0,f=0;const a=Math.max(1,o.length);for(;r&&fs.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:f})=>`${s}:${r}:${f}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=dn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((a,l)=>[a,l]));let r=no(n,o,s);const f=Math.max(0,e.restarts??or);for(let a=0;alt&&l*3>=a?f>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(oo,"chooseOrthogonalSide");function so(t,e){return Math.abs(t.to-e.from)m.isGroup&&!m.parentId);for(const m of c){const S={id:m.id},A=d(T=>{f.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(A)},"assignLane");A(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,A=m.height??10,T=m.x??0,N=m.y??0,D=Dr;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-A/2-D,maxY:N+A/2+D,visualXHalfExtent:l?A/2+D:S/2+D}}),p=d((m,S,A,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:A,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,A),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),I=d((m,S)=>{const A=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-A/2,y:D};case"right":return{x:N+A/2,y:D}}},"portForSide"),u=d((m,S,A)=>I(m,oo(m,S,A?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],x=new Set,C=1e3,b=d((m,S,A)=>{if(h.length===0)return 0;const T=Math.abs(S.y-A.y)U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,A.y)-lt,U=Math.max(S.y,A.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coordU||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const A=r.get(m.start),T=r.get(m.end),N=f.get(m.start),D=f.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=A&&T?Math.abs((T.x??0)-(A.x??0)):0,U=A&&T?Math.abs((T.y??0)-(A.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const A=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(A-T)>1?A-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,A,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>A&&z.nodeId===A||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minYm.y&&z.maxX>N&&z.minXm.x&&z.maxY>W&&z.minYoo(m,S,"bottom"),"determineSide"),w=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const N=(T.x??0)-(A.x??0),D=(T.y??0)-(A.y??0);w.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(A,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:A.x??0,y:A.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of w.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of w.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,A)=>{const T=B(S),N=B(A);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-A.edgeIdx});for(let S=1;S=N||(H.set(P(A.srcId,A.srcSide),N-1),H.set(P(A.srcId,T),D+1),A.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of w.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of w.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const A=O(m);if(S.has(A)||(H.get(P(m.srcId,A))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,A),1),m.srcSide=A}for(const m of w.values()){const{edgeIdx:S,srcId:A,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(A),ot=r.get(T),U=`${A}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((wt,Gt)=>wt.oppositeCoord-Gt.oppositeCoord);const A=m.split(":"),T=A.slice(0,-2).join(":"),N=A[A.length-2],D=A[A.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[wt,Gt]of S.entries()){const ee=Bt+wt*st,mn=`${Gt.edgeIdx}:${D}`;tt.set(mn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:A})=>Mt(A))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:A})=>Mt(A)):!1,"faceHasLabelNode"),_t=d((m,S,A)=>S==="top"||S==="bottom"?{x:m.x+A,y:m.y}:{x:m.x,y:m.y+A},"applyPortOffset"),nt=d((m,S,A)=>{const T=w.get(m),N={x:A.x??0,y:A.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(A,D);let U=T?I(S,T.srcSide):u(S,N,!0),z=T?I(A,T.dstSide):u(A,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&(z=_t(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(i[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const A=r.get(S.start),T=r.get(S.end);if(!A||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,A,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(A.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(A.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.xQ.minY&&X.y{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],wt=ct(U,Bt);if(wt.inside&&wt.obstacle){const X=wt.obstacle;if(bt){const $=st(N,A,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,A,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,A,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,A,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)1||Ct>1,kt=M.get(S.start??"")??0,mt=M.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const mn=p("vertical",U.x,U.y,U.y);U.x=mn.coord;const pr=p("vertical",z.x,z.y,z.y);z.x=pr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,Ae=Math.min(U.y,z.y)-50,we=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX$&&X.minYht&&(ye=Math.min(ye,X.minX-We),pe=Math.max(pe,X.maxX+We),Ae=Math.min(Ae,X.minY-We),we=Math.max(we,X.maxY+We))}for(const X of g){if(X.maxXpe||X.maxYwe)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,Ae,we),p("vertical",X.maxX+Q,Ae,we)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const xr=a.filter(X=>X.orientation==="horizontal"&&X.coord>=Ae&&X.coord<=we),br=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),De=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),He=De(U.x,U.y),Eo=De(z.x,z.y),Xe=new Map,yn=new Map,pn=new Map,Ye=new Set,Se=[];Xe.set(He,0),pn.set(He,"n"),Se.push({key:He,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ye.add(He);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),xn={x:z.x,y:U.y},Mr=xe(U,xn),Ir=xe(xn,z),Sr=Mr||Ir,bn={x:U.x,y:z.y},Cr=xe(U,bn),vr=xe(bn,z);if(Sr?Cr||vr||(Math.abs(U.x-z.x)0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ye.delete(X.key),X.key===Eo){let mt=Eo,Vt=z;for($t=[Vt];yn.has(mt);){const re=yn.get(mt);$t.unshift(re),Vt=re,mt=De(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=br.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=xr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rtne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minYQ&&ne.maxX>Vt&&ne.minX$&&ne.maxY>Dt&&ne.minY10&&Mn<-5||Re<-10&&Mn>5)&&(Et=Math.abs(Mn)*100),(Zt>10&&Ge<-5||Zt<-10&&Ge>5)&&(Et+=Math.abs(Ge)*50);let To=0;const Ao=pn.get(X.key)??"n",wo=Math.abs(Ge)>lt?"h":"v";Ao!=="n"&&Ao!==wo&&(To=50);const Lr=Ut+Lt+Et+To,$e=(Xe.get(X.key)??1/0)+Lr,Ro=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if($e<(Xe.get(vt)??1/0))if(yn.set(vt,X.pt),Xe.set(vt,$e),pn.set(vt,wo),!Ye.has(vt))Se.push({key:vt,f:$e+Ro,pt:mt}),Ye.add(vt);else{const ne=Se.findIndex(Er=>Er.key===vt);ne!==-1&&(Se[ne].f=$e+Ro)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=QLt.minXjt&&Lt.minYFt);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(Ft=>Ft.minXMath.min(X.y,$.y));if(jt.length>0){let Ft=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=d(Dt=>{const jt=$.y>X.y,Ft=g.filter(Lt=>{const Et=Math.min(X.x,$.x)Lt.minX,Zt=Math.min(X.y,$.y)Lt.minY;return Et&&Zt});let vt=Ft;if(l&&Ft.length>0){const Lt=Ft.filter(Et=>Et.minXDt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),Ft={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,Ft),Et=xe(Ft,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;Xm.from{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!A.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=A.index,A.segments=[...A.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const A=m.pipe.tracks[m.trackIndex];A.segments=A.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const A=i[m.edgeIndex];for(const T of A){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),At=d(m=>{const S=i[m.edgeIndex],A=S.indexOf(h.indexOf(m)),T=[];return A>0&&T.push(h[S[A-1]]),A{if(m.orientation===S.orientation)return!1;const A=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>A.from&&T.pipe.coordT.from&&A.pipe.coord{for(const A of m.tracks)if(!A.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return A.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const A=At(m),T=At(S);return A.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,A)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);A(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let A=0;A{if(me.has(m))return me.get(m);const S=i[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;otMath.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),un=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())i[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const A=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=A(D),bt=A(W);if(Math.abs(z-bt)>1)return bt-z;const dt=i[D].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[D][0],It=i[W][0];if(h[st]&&h[It]){const Bt=h[st],wt=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(wt.to-wt.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[i[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),hn=d(()=>{let m=0;const S=new Map;for(const[A,T]of s.entries())i[A].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(A));for(const A of S.values()){A.sort((N,D)=>{const W=d(z=>{const bt=i[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=A.map(N=>h[i[N][i[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),gn=d(()=>{let m=0;for(const S of a){const A=[];for(const T of S.tracks)for(const N of T.segments){const D=i[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const A=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;DN.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const wt=x.has(Bt.edgeIndex)?m.coord:It;_.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,wt)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*vn);if(U.length===0&&N.size>0){const st=[...N].sort((wt,Gt)=>Math.abs(D.get(wt)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*vn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*vn)}}for(const[m,S]of s.entries()){const A=i[m]??[];if(A.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=A.map(dt=>{const ct=h[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dtlt&&T.push(ve(ct,It)),Gt&&wt.orient===ct.orient)if(Math.abs(ct.coord-wt.coord)>lt){const ee=ct.orient==="vertical"?(It+wt.from)/2:so(ct,wt);T.push(ve(ct,ee),ve(wt,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,so(ct,wt)));else if(Gt)T.push(ve(ct,wt.coord));else{const ee=Math.abs(ct.from-It)lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dtlt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const A=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=A-N/2,ot=A+N/2,U=T-D/2,z=T+D/2;if(m.xot||m.yz)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const A=m.start,T=m.end,N=A?r.get(A):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function mr(t){var g,p,I,u,h;const e=Jo(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((I=t.config.swimlane)==null?void 0:I.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,f=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=gr(t),{ordered:l,coordinates:c}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:f,direction:a});Zo(e,l,c,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;hr(t,a);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return Rs(t,a),ws(t),a}d(mr,"runSwimlaneLayoutCore");function yr(t){qo(t);const e=Qo(t);t.nodes=e.nodes,t.edges=e.edges}d(yr,"prepareSwimlaneLayout");var Vr=Tr({prepareLayout:yr,runLayoutCore:mr,afterPaint:Wo});export{Vr as render}; diff --git a/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-9O47xpSI.js b/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-9O47xpSI.js new file mode 100644 index 000000000..e3ef05966 --- /dev/null +++ b/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-9O47xpSI.js @@ -0,0 +1,8 @@ +import{c as r,s as e}from"./flowDiagram-HODETNUW-B-fmyqOw.js";import{_ as a}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-C6GC8vvo.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./channel-D4R-Rc0m.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var o=a(t=>`${e(t)} + .swimlane.cluster rect { + stroke: ${t.clusterBorder} !important; + } + [data-look="neo"].cluster rect { + filter: none; + } +`,"getStyles"),m=o,g=r({defaultLayout:"swimlane",styles:m});export{g as diagram}; diff --git a/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js b/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js deleted file mode 100644 index 1984ba2a7..000000000 --- a/static/ml_canvas/assets/swimlanesDiagram-VR7AAH4N-BHrb8Z_U.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as r,s as e}from"./flowDiagram-HODETNUW-CY2uKpa5.js";import{_ as a}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-vgh9rKCo.js";import"./chunk-XXDRQBXY-Bs02z9v-.js";import"./chunk-POPQ4Y6H-oeZXlwKE.js";import"./chunk-F27PBJKO-B6ZPWwpd.js";import"./channel-DIwzyvS1.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var o=a(t=>`${e(t)} - .swimlane.cluster rect { - stroke: ${t.clusterBorder} !important; - } - [data-look="neo"].cluster rect { - filter: none; - } -`,"getStyles"),m=o,g=r({defaultLayout:"swimlane",styles:m});export{g as diagram}; diff --git a/static/ml_canvas/assets/timeline-definition-24CTP7MA-CSbm3DNI.js b/static/ml_canvas/assets/timeline-definition-24CTP7MA-DKpgYUw-.js similarity index 99% rename from static/ml_canvas/assets/timeline-definition-24CTP7MA-CSbm3DNI.js rename to static/ml_canvas/assets/timeline-definition-24CTP7MA-DKpgYUw-.js index e5844dd36..d31df1b91 100644 --- a/static/ml_canvas/assets/timeline-definition-24CTP7MA-CSbm3DNI.js +++ b/static/ml_canvas/assets/timeline-definition-24CTP7MA-DKpgYUw-.js @@ -1,4 +1,4 @@ -import{_ as l,x as pt,T as Wt,U as Pt,V as Bt,c as gt,l as S,C as Vt,D as Ft,W as ft,q as zt,X as Gt,o as Ot}from"./mermaid.core-DBa20IFF.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{k as ot}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,R=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);_.setInput(s,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var Z=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: +import{_ as l,x as pt,T as Wt,U as Pt,V as Bt,c as gt,l as S,C as Vt,D as Ft,W as ft,q as zt,X as Gt,o as Ot}from"./mermaid.core-Bh6LVe7i.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{k as ot}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,R=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);_.setInput(s,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var Z=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`: `+_.showPosition()+` Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":X="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,R=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},Z&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,R,M,C.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/vennDiagram-4TSXK5OY-U8E6M_Pt.js b/static/ml_canvas/assets/vennDiagram-4TSXK5OY-DW_WRjKp.js similarity index 99% rename from static/ml_canvas/assets/vennDiagram-4TSXK5OY-U8E6M_Pt.js rename to static/ml_canvas/assets/vennDiagram-4TSXK5OY-DW_WRjKp.js index 59250bcfa..eefeedf01 100644 --- a/static/ml_canvas/assets/vennDiagram-4TSXK5OY-U8E6M_Pt.js +++ b/static/ml_canvas/assets/vennDiagram-4TSXK5OY-DW_WRjKp.js @@ -1,4 +1,4 @@ -import{ao as Wt,s as Kt,g as Ht,n as Yt,m as Xt,a as Zt,b as Jt,_ as S,x as St,C as Qt,a7 as $t,T as te,U as ee,V as ne,d as se,o as ie,z as re,A as oe}from"./mermaid.core-DBa20IFF.js";import{s as rt}from"./vendor-flow-Ct2sLZk5.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(D=>O.has(D)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const V=x.select("svg");n?V.attr("viewBox",`0 0 ${s} ${e}`):V.attr("width",s).attr("height",e);const B={};let z=!1;V.selectAll(".venn-area path").each(function(I){const D=this.getAttribute("d");I.sets.length==1&&D&&!m&&(z=!0,B[I.sets[0]]=Me(D))});function U(I){return D=>{const G=I.sets.map(J=>{let W=B[J],X=k[J];return W||(W={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:W.x*(1-D)+X.x*D,y:W.y*(1-D)+X.y*D,radius:W.radius*(1-D)+X.radius*D}});return wt(G,y)}}const A=V.selectAll(".venn-area").data(f,I=>I.sets),F=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=F.append("path"),L=F.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(D=>k[D])),y);const C=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in C?C.on("end",ot(k,q)):C.each("end",ot(k,q)):C.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),C.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:F,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` +import{ao as Wt,s as Kt,g as Ht,n as Yt,m as Xt,a as Zt,b as Jt,_ as S,x as St,C as Qt,a7 as $t,T as te,U as ee,V as ne,d as se,o as ie,z as re,A as oe}from"./mermaid.core-Bh6LVe7i.js";import{s as rt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let h=e[e.length-1];for(let u=0;uy.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(h)ct(n))}function tt(t,n){let s=0;for(let e=0;ev.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx=1)break;for(let f=1;fl+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a{const p={};for(let d=0;dxt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;ul===h?0:lr.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;dp.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;mt[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(D=>O.has(D)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function q(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const V=x.select("svg");n?V.attr("viewBox",`0 0 ${s} ${e}`):V.attr("width",s).attr("height",e);const B={};let z=!1;V.selectAll(".venn-area path").each(function(I){const D=this.getAttribute("d");I.sets.length==1&&D&&!m&&(z=!0,B[I.sets[0]]=Me(D))});function U(I){return D=>{const G=I.sets.map(J=>{let W=B[J],X=k[J];return W||(W={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:W.x*(1-D)+X.x*D,y:W.y*(1-D)+X.y*D,radius:W.radius*(1-D)+X.radius*D}});return wt(G,y)}}const A=V.selectAll(".venn-area").data(f,I=>I.sets),F=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=F.append("path"),L=F.append("text").attr("class","label").text(I=>q(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",U)):_.selectAll("path").attr("d",I=>wt(I.sets.map(D=>k[D])),y);const C=_.selectAll("text").filter(I=>I.sets in R).text(I=>q(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in C?C.on("end",ot(k,q)):C.each("end",ot(k,q)):C.each(ot(k,q)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",U);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),C.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:F,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` M`,t,n),e.push(` m`,-s,0),e.push(` a`,s,s,0,1,0,s*2,0),e.push(` diff --git a/static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-l1AdmyzU.js b/static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-DdsuhfKh.js similarity index 99% rename from static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-l1AdmyzU.js rename to static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-DdsuhfKh.js index 4cb35d8d9..e219f7a46 100644 --- a/static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-l1AdmyzU.js +++ b/static/ml_canvas/assets/wardleyDiagram-VM6X3IG4-DdsuhfKh.js @@ -1,4 +1,4 @@ -import{p as zt}from"./chunk-JWPE2WC7-D_VUnfvZ.js";import{s as Lt,g as Tt,n as At,m as Xt,a as Et,b as Yt,_ as y,E as It,x as Bt,z as Q,l as et,C as Ft,d as Rt,o as Ot,c as V}from"./mermaid.core-DBa20IFF.js";import{p as Wt}from"./cynefin-OW5HDTMX-DvaIaB7v.js";import"./index-_bluKNvP.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function xt(a,o){b.setSize(a,o)}y(xt,"setSize");function ht(a){b.startPipeline(a)}y(ht,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:xt,startPipeline:ht,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map +import{p as zt}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{s as Lt,g as Tt,n as At,m as Xt,a as Et,b as Yt,_ as y,E as It,x as Bt,z as Q,l as et,C as Ft,d as Rt,o as Ot,c as V}from"./mermaid.core-Bh6LVe7i.js";import{p as Wt}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function xt(a,o){b.setSize(a,o)}y(xt,"setSize");function ht(a){b.startPipeline(a)}y(ht,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:xt,startPipeline:ht,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map `+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Rt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(x=>{s.push({start:i,end:x}),i=x})}else{const i=1/R.length;R.forEach((x,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,x)=>{const l=s[x],h=r.padding+l.start*B,f=r.padding+l.end*B,u=(h+f)/2;x>0&&t.append("line").attr("x1",h).attr("x2",h).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f{const u=c.get(f);u&&(x=Math.min(x,u.x),l=Math.max(l,u.x),h=u.y)}),x!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=h-u/2,S=c.get(s.nodeId);if(S){const z=(x+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",x-15).attr("y",w).attr("width",l-x+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h);return n.x+l/f*x}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h);return n.y+h/f*x}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,h=n.y-s.y,f=Math.sqrt(l*l+h*h);return s.x+l/f*x}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),x=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,h=n.y-s.y,f=Math.sqrt(l*l+h*h);return s.y+h/f*x}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,x=s.y-n.y,l=s.x-n.x,h=Math.sqrt(l*l+x*x),f=8,u=x/h;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,x=s.x-n.x,l=s.y-n.y,h=Math.sqrt(x*x+l*l),f=8,u=-x/h;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,x=(n.y+s.y)/2,l=s.x-n.x,h=s.y-n.y,f=Math.sqrt(l*l+h*h),u=8,w=h/f,S=-l/f,z=i+w*u,W=x+S*u;let Y=Math.atan2(h,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),x=s-n.x,l=i-n.y,h=Math.sqrt(x*x+l*l),f=r.nodeRadius+2,u=h>f?s-x/h*f:s,w=h>f?i-l/h*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i{const x=t.append("g").attr("class","wardley-annotation");x.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),x.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,x=16,l=11,h=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=h.append("text").attr("x",n+i).attr("y",s+i+(S+1)*x).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*x+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*x)}),h.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),x=60,l=30,h=20,f=` M ${s} ${i-l/2} L ${s+x-h} ${i-l/2} diff --git a/static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-DvskLDdU.js b/static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-n6bmpw2W.js similarity index 99% rename from static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-DvskLDdU.js rename to static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-n6bmpw2W.js index 5fc55455d..6503d4447 100644 --- a/static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-DvskLDdU.js +++ b/static/ml_canvas/assets/xychartDiagram-S5SC5T6Z-n6bmpw2W.js @@ -1,4 +1,4 @@ -import{s as fi,g as mi,n as $t,m as yi,a as bi,b as Ai,_ as n,l as Ut,C as wi,d as Ci,o as Si,x as Tt,i as Ri,z as Gt,A as _i,E as ki,F as Ti}from"./mermaid.core-DBa20IFF.js";import"./vendor-flow-Ct2sLZk5.js";import{n as Wt,m as Xt,p as Nt}from"./vendor-charts-BkHP8M8k.js";import"./index-_bluKNvP.js";import"./vendor-utils-VkF_O5b_.js";var St=(function(){var e=n(function(V,r,g,u){for(g=g||{},u=V.length;u--;g[V[u]]=r);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],a=[1,5],h=[1,6],l=[1,7],y=[1,5,10,12,14,16,18,19,21,23,36,37,38],d=[1,25],f=[1,26],_=[1,28],k=[1,29],P=[1,30],F=[1,31],W=[1,32],v=[1,33],B=[1,34],b=[1,35],T=[1,36],c=[1,37],I=[1,43],O=[1,42],X=[1,47],N=[1,50],S=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],w=[1,65],M=[26,28],R={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:n(function(r,g,u,x,C,o,lt){var p=o.length-1;switch(C){case 5:x.setOrientation(o[p]);break;case 9:x.setDiagramTitle(o[p].text.trim());break;case 12:x.setLineData({text:"",type:"text"},o[p]);break;case 13:x.setLineData(o[p-1],o[p]);break;case 14:x.setBarData({text:"",type:"text"},o[p]);break;case 15:x.setBarData(o[p-1],o[p]);break;case 16:this.$=o[p].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=o[p].trim(),x.setAccDescription(this.$);break;case 19:this.$=o[p-1];break;case 20:case 30:this.$=[o[p-2],...o[p]];break;case 21:case 31:this.$=[o[p]];break;case 22:this.$={value:Number(o[p-1]),label:o[p]};break;case 23:this.$={value:Number(o[p]),label:""};break;case 24:x.setXAxisTitle(o[p]);break;case 25:x.setXAxisTitle(o[p-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(o[p]);break;case 28:x.setXAxisRangeData(Number(o[p-2]),Number(o[p]));break;case 29:this.$=o[p-1];break;case 32:x.setYAxisTitle(o[p]);break;case 33:x.setYAxisTitle(o[p-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(o[p-2]),Number(o[p]));break;case 39:this.$={text:o[p],type:"text"};break;case 40:this.$={text:o[p],type:"text"};break;case 41:this.$={text:o[p],type:"markdown"};break;case 42:this.$=o[p];break;case 43:this.$=o[p-1]+""+o[p];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:a,37:h,38:l}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:a,37:h,38:l}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:h,38:l}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(y,[2,36]),e(y,[2,37]),e(y,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:a,37:h,38:l}),{1:[2,3]},e(y,[2,5]),e(t,[2,7],{4:22,36:a,37:h,38:l}),{11:23,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:39,13:38,24:I,29:O,30:d,31:40,32:41,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:45,15:44,29:X,30:d,35:46,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:49,17:48,24:N,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:52,17:51,24:N,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(H,[2,39],{41:55,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(S,[2,10]),e(S,[2,24],{32:41,31:56,24:I,29:O}),e(S,[2,26]),e(S,[2,27]),{33:[1,57]},{11:59,30:d,34:58,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},e(S,[2,11]),e(S,[2,32],{35:60,29:X}),e(S,[2,34]),{33:[1,61]},e(S,[2,12]),{17:62,24:N},{25:63,27:64,29:w},e(S,[2,14]),{17:66,24:N},e(S,[2,16]),e(S,[2,17]),e(A,[2,43]),e(S,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(S,[2,33]),{29:[1,70]},e(S,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(M,[2,23],{30:[1,73]}),e(S,[2,15]),e(S,[2,28]),e(S,[2,29]),{11:59,30:d,34:74,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},e(S,[2,35]),e(S,[2,19]),{25:75,27:64,29:w},e(M,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:n(function(r,g){if(g.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=g,u}},"parseError"),parse:n(function(r){var g=this,u=[0],x=[],C=[null],o=[],lt=this.table,p="",xt=0,Bt=0,ui=2,Ot=1,xi=o.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);D.setInput(r,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var At=D.yylloc;o.push(At);var di=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pi(E){u.length=u.length-2*E,C.length=C.length-E,o.length=o.length-E}n(pi,"popStack");function Vt(){var E;return E=x.pop()||D.lex()||Ot,typeof E!="number"&&(E instanceof Array&&(x=E,E=x.pop()),E=g.symbols_[E]||E),E}n(Vt,"lex");for(var L,U,z,wt,j={},dt,Y,Ft,pt;;){if(U=u[u.length-1],this.defaultActions[U]?z=this.defaultActions[U]:((L===null||typeof L>"u")&&(L=Vt()),z=lt[U]&<[U][L]),typeof z>"u"||!z.length||!z[0]){var Ct="";pt=[];for(dt in lt[U])this.terminals_[dt]&&dt>ui&&pt.push("'"+this.terminals_[dt]+"'");D.showPosition?Ct="Parse error on line "+(xt+1)+`: +import{s as fi,g as mi,n as $t,m as yi,a as bi,b as Ai,_ as n,l as Ut,C as wi,d as Ci,o as Si,x as Tt,i as Ri,z as Gt,A as _i,E as ki,F as Ti}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{n as Wt,m as Xt,p as Nt}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";var St=(function(){var e=n(function(V,r,g,u){for(g=g||{},u=V.length;u--;g[V[u]]=r);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],a=[1,5],h=[1,6],l=[1,7],y=[1,5,10,12,14,16,18,19,21,23,36,37,38],d=[1,25],f=[1,26],_=[1,28],k=[1,29],P=[1,30],F=[1,31],W=[1,32],v=[1,33],B=[1,34],b=[1,35],T=[1,36],c=[1,37],I=[1,43],O=[1,42],X=[1,47],N=[1,50],S=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],w=[1,65],M=[26,28],R={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:n(function(r,g,u,x,C,o,lt){var p=o.length-1;switch(C){case 5:x.setOrientation(o[p]);break;case 9:x.setDiagramTitle(o[p].text.trim());break;case 12:x.setLineData({text:"",type:"text"},o[p]);break;case 13:x.setLineData(o[p-1],o[p]);break;case 14:x.setBarData({text:"",type:"text"},o[p]);break;case 15:x.setBarData(o[p-1],o[p]);break;case 16:this.$=o[p].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=o[p].trim(),x.setAccDescription(this.$);break;case 19:this.$=o[p-1];break;case 20:case 30:this.$=[o[p-2],...o[p]];break;case 21:case 31:this.$=[o[p]];break;case 22:this.$={value:Number(o[p-1]),label:o[p]};break;case 23:this.$={value:Number(o[p]),label:""};break;case 24:x.setXAxisTitle(o[p]);break;case 25:x.setXAxisTitle(o[p-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(o[p]);break;case 28:x.setXAxisRangeData(Number(o[p-2]),Number(o[p]));break;case 29:this.$=o[p-1];break;case 32:x.setYAxisTitle(o[p]);break;case 33:x.setYAxisTitle(o[p-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(o[p-2]),Number(o[p]));break;case 39:this.$={text:o[p],type:"text"};break;case 40:this.$={text:o[p],type:"text"};break;case 41:this.$={text:o[p],type:"markdown"};break;case 42:this.$=o[p];break;case 43:this.$=o[p-1]+""+o[p];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:a,37:h,38:l}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:a,37:h,38:l}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:h,38:l}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(y,[2,36]),e(y,[2,37]),e(y,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:a,37:h,38:l}),{1:[2,3]},e(y,[2,5]),e(t,[2,7],{4:22,36:a,37:h,38:l}),{11:23,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:39,13:38,24:I,29:O,30:d,31:40,32:41,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:45,15:44,29:X,30:d,35:46,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:49,17:48,24:N,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{11:52,17:51,24:N,30:d,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(H,[2,39],{41:55,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(S,[2,10]),e(S,[2,24],{32:41,31:56,24:I,29:O}),e(S,[2,26]),e(S,[2,27]),{33:[1,57]},{11:59,30:d,34:58,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},e(S,[2,11]),e(S,[2,32],{35:60,29:X}),e(S,[2,34]),{33:[1,61]},e(S,[2,12]),{17:62,24:N},{25:63,27:64,29:w},e(S,[2,14]),{17:66,24:N},e(S,[2,16]),e(S,[2,17]),e(A,[2,43]),e(S,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(S,[2,33]),{29:[1,70]},e(S,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(M,[2,23],{30:[1,73]}),e(S,[2,15]),e(S,[2,28]),e(S,[2,29]),{11:59,30:d,34:74,39:24,40:f,41:27,42:_,43:k,44:P,45:F,46:W,47:v,48:B,49:b,50:T,51:c},e(S,[2,35]),e(S,[2,19]),{25:75,27:64,29:w},e(M,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:n(function(r,g){if(g.recoverable)this.trace(r);else{var u=new Error(r);throw u.hash=g,u}},"parseError"),parse:n(function(r){var g=this,u=[0],x=[],C=[null],o=[],lt=this.table,p="",xt=0,Bt=0,ui=2,Ot=1,xi=o.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);D.setInput(r,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var At=D.yylloc;o.push(At);var di=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pi(E){u.length=u.length-2*E,C.length=C.length-E,o.length=o.length-E}n(pi,"popStack");function Vt(){var E;return E=x.pop()||D.lex()||Ot,typeof E!="number"&&(E instanceof Array&&(x=E,E=x.pop()),E=g.symbols_[E]||E),E}n(Vt,"lex");for(var L,U,z,wt,j={},dt,Y,Ft,pt;;){if(U=u[u.length-1],this.defaultActions[U]?z=this.defaultActions[U]:((L===null||typeof L>"u")&&(L=Vt()),z=lt[U]&<[U][L]),typeof z>"u"||!z.length||!z[0]){var Ct="";pt=[];for(dt in lt[U])this.terminals_[dt]&&dt>ui&&pt.push("'"+this.terminals_[dt]+"'");D.showPosition?Ct="Parse error on line "+(xt+1)+`: `+D.showPosition()+` Expecting `+pt.join(", ")+", got '"+(this.terminals_[L]||L)+"'":Ct="Parse error on line "+(xt+1)+": Unexpected "+(L==Ot?"end of input":"'"+(this.terminals_[L]||L)+"'"),this.parseError(Ct,{text:D.match,token:this.terminals_[L]||L,line:D.yylineno,loc:At,expected:pt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+L);switch(z[0]){case 1:u.push(L),C.push(D.yytext),o.push(D.yylloc),u.push(z[1]),L=null,Bt=D.yyleng,p=D.yytext,xt=D.yylineno,At=D.yylloc;break;case 2:if(Y=this.productions_[z[1]][1],j.$=C[C.length-Y],j._$={first_line:o[o.length-(Y||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(Y||1)].first_column,last_column:o[o.length-1].last_column},di&&(j._$.range=[o[o.length-(Y||1)].range[0],o[o.length-1].range[1]]),wt=this.performAction.apply(j,[p,Bt,xt,$.yy,z[1],C,o].concat(xi)),typeof wt<"u")return wt;Y&&(u=u.slice(0,-1*Y*2),C=C.slice(0,-1*Y),o=o.slice(0,-1*Y)),u.push(this.productions_[z[1]][0]),C.push(j.$),o.push(j._$),Ft=lt[u[u.length-2]][u[u.length-1]],u.push(Ft);break;case 3:return!0}}return!0},"parse")},rt=(function(){var V={EOF:1,parseError:n(function(g,u){if(this.yy.parser)this.yy.parser.parseError(g,u);else throw new Error(g)},"parseError"),setInput:n(function(r,g){return this.yy=g||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var g=r.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:n(function(r){var g=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===x.length?this.yylloc.first_column:0)+x[x.length-u.length].length-u[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(r){this.unput(this.match.slice(r))},"less"),pastInput:n(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var r=this.pastInput(),g=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/static/ml_canvas/index.html b/static/ml_canvas/index.html index bd4a683ce..4d07a9801 100644 --- a/static/ml_canvas/index.html +++ b/static/ml_canvas/index.html @@ -22,7 +22,7 @@ html.dark { background: #16181b; color-scheme: dark; } html, body { margin: 0; } - + diff --git a/tests/integration/test_eda_decomposition_missing.py b/tests/integration/test_eda_decomposition_missing.py new file mode 100644 index 000000000..53027b5d1 --- /dev/null +++ b/tests/integration/test_eda_decomposition_missing.py @@ -0,0 +1,58 @@ +"""HTTP decomposition round trips preserve missing and literal category identities.""" + +from types import SimpleNamespace +from unittest.mock import AsyncMock + +import polars as pl +from fastapi import FastAPI +from fastapi.testclient import TestClient + +from backend.dependencies import get_db +from backend.eda.router import router + + +def test_decomposition_http_drill_down_keeps_missing_rows_separate(monkeypatch) -> None: + """Request validation and JSON serialization must retain null-valued bucket filters.""" + frame = pl.DataFrame( + { + "group": ["a", None, "Unknown", None], + "detail": ["normal", "missing_a", "literal", "missing_b"], + "value": [1, 2, 3, 4], + } + ) + monkeypatch.setattr( + "backend.eda.router._prepare_decomposition_dataframe", AsyncMock(return_value=frame) + ) + monkeypatch.setattr("backend.eda.router.limiter.enabled", False) + session = SimpleNamespace(get=AsyncMock(return_value=SimpleNamespace(id=192))) + app = FastAPI() + app.include_router(router) + app.dependency_overrides[get_db] = lambda: session + body = {"measure_col": "value", "measure_agg": "sum", "split_col": "group", "filters": []} + + with TestClient(app) as client: + response = client.post("/eda/192/decomposition", json=body) + assert response.status_code == 200 + rows = response.json() + assert {row["filter_value"]: row["value"] for row in rows} == { + "a": 1, + None: 6, + "Unknown": 3, + } + for selected, expected in [ + (None, {"missing_a": 2, "missing_b": 4}), + ("Unknown", {"literal": 3}), + ]: + bucket = next(row for row in rows if row["filter_value"] == selected) + response = client.post( + "/eda/192/decomposition", + json={ + **body, + "split_col": "detail", + "filters": [ + {"column": "group", "operator": "==", "value": bucket["filter_value"]} + ], + }, + ) + assert response.status_code == 200 + assert {row["name"]: row["value"] for row in response.json()} == expected From f0468f21cb1381c173fdfe1f0966ccfe48992ce4 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 20:12:48 +0300 Subject: [PATCH 09/17] ideas --- initiatives/analysis/some_ideas.md | 116 +++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 initiatives/analysis/some_ideas.md diff --git a/initiatives/analysis/some_ideas.md b/initiatives/analysis/some_ideas.md new file mode 100644 index 000000000..40de21edf --- /dev/null +++ b/initiatives/analysis/some_ideas.md @@ -0,0 +1,116 @@ + A. ML yetenek boşluklarΔ± (skyulf-core) + + 1. Konformal tahmin / belirsizlik aralΔ±klarΔ± β€” conformal|prediction_interval|uncertainty iΓ§in core+backend'de sΔ±fΔ±r eşleşme var. Oysa ΓΌrΓΌnΓΌn sloganΔ± "Stop trusting + your pipeline. Verify it." β€” eksik parΓ§a tam olarak "ne zaman gΓΌvenmeyeceğini de sΓΆyle". Split-conformal sklearn-native (yeni ağır bağımlΔ±lΔ±k yok), mevcut + calibrated_classifier + thresholds.py hikΓ’yesinin doğal devamΔ±. Γ‡Δ±ktΔ±: regresyonda aralΔ±k, sΔ±nΔ±flandΔ±rmada risk kontrollΓΌ tahmin kΓΌmesi; /deployment/predict yanΔ±tΔ±na + lower/upper alanΔ±, Experiments'a "Uncertainty" sekmesi (kapsam eğrisi). Efor: M. Değer: Γ§ok yΓΌksek, farklΔ±laştΔ±rΔ±cΔ±. + + 2. Adillik / bias denetimi β€” fairlearn|disparate|demographic_parity|equalized_odds: sΔ±fΔ±r eşleşme. Korunan bir kolon ΓΌzerinde y_true/y_pred/proba'dan saf numpy ile + hesaplanΔ±r: demografik parite, equalized odds, grup-bazlΔ± kalibrasyon, disparate impact. WOEEncoder + calibrated_classifier + threshold tuning zaten var β†’ kredi + skorlama kitlesi aΓ§Δ±kΓ§a hedeflenmiş, o kitlede bu metrikler yasal zorunluluk. Efor: S–M. Değer: yΓΌksek (regΓΌle sektΓΆr satışı). + + 3. Anomaly detection'Δ± modelleme düğümΓΌ yapmak β€” IsolationForest şu an sadece EDA profiler iΓ§inde (_analyzer/multivariate.py), EllipticEnvelope sadece outlier silme + preprocessing'i. Yani tespit var ama servis yolu yok. metrics.py:462 zaten -1 noise etiketlerini yΓΆnetiyor; DBSCAN/HDBSCAN/OneClassSVM/LOF düğümleri + deployment'ta + skorlama β†’ dolandΔ±rΔ±cΔ±lΔ±k, kestirimci bakΔ±m, izleme gibi baştan aşağı yeni bir kullanΔ±m alanΔ± mevcut canvas ile aΓ§Δ±lΔ±r. Efor: M. Değer: yΓΌksek. + + 4. Boyut indirgeme düğümleri (PCA / TruncatedSVD / UMAP) β€” preprocessing/ altΔ±nda hiΓ§ yok; PCA yalnΔ±zca EDA'da. Pratik sonuΓ§: klasik TF-IDF β†’ TruncatedSVD β†’ + sΔ±nΔ±flandΔ±rΔ±cΔ± metin hattΔ± bugΓΌn kurulamΔ±yor. AyrΔ±ca yΓΌksek boyutta tuning maliyetini düşürΓΌr. Mevcut _artifacts.py TypedDict kalΔ±bΔ±na birebir oturur. Efor: S. Değer: + orta-yΓΌksek, Γ§ok ucuz. + + 5. SHAP'sΔ±z aΓ§Δ±klanabilirlik: permutation importance + PDP/ICE β€” permutation_importance|partial_dependence: sΔ±fΔ±r eşleşme, tek explainer SHAP ve o opsiyonel extra + (skyulf-core/setup.py:78). Yani shap kurulu değilse kullanΔ±cΔ± hiΓ§bir aΓ§Δ±klama gΓΆremiyor. SklearnBridge.to_sklearn + StatefulEstimator zaten var, sklearn.inspection + doğrudan Γ§alışır. PDP/ICE ayrΔ±ca "bu müşteri iΓ§in ne değişmeli" sorusunu cevaplar β€” threshold tuning'in doğal eşi. Efor: S–M. Değer: yΓΌksek. + + 6. Hiperparametre ΓΆnem analizi (mevcut trial verisinden) β€” En ucuz/yΓΌksek getirili fikir bu olabilir: her tuning job'Δ± tΓΌm trial'larΔ± zaten saklΔ±yor (strategies.py:255 + β†’ job.results, /jobs/{id}/trials, 128 job Γ— 2000 trial LRU buffer). Üzerinde analiz yapΔ±lmΔ±yor, sadece Γ§iziliyor. Optuna'nΔ±n kendi fANOVA/importance API'si veya + trial'lara uydurulmuş bir surrogate ile "hangi düğüm gerΓ§ekten ΓΆnemliydi, hangisine hiΓ§ dokunmasan da olurdu" paneli. SΔ±fΔ±r yeni altyapΔ±, mevcut veri β†’ iΓ§gΓΆrΓΌ. Efor: + S. Değer: yΓΌksek. + + 7. Quantile / Tweedie / Poisson / Huber regresΓΆrler + pinball loss β€” regression.py'de 14 model var ama hiΓ§biri bunlar değil. Sigorta fiyatlama, talep tahmini, Γ§arpΔ±k + hedefler iΓ§in standart aileler; hepsi sklearn estimator'ΓΌ, sadece hyperparameters/_registry.py'ye search space + _evaluation/metrics.py'ye pinball loss eklemek + gerekiyor. Efor: S. Değer: orta. + + 8. Multi-label / multi-output desteği β€” hiΓ§ yok (LabelBinarizer/MultiOutput yok). ÜrΓΌn segmentasyonu, Γ§oklu churn, etiketleme gibi gerΓ§ek bir problem sΔ±nΔ±fΔ± kapalΔ±. + task_type Γ§Δ±karsamasΔ± (_analyzer/target.py), metrikler ve canvas'Δ± birlikte etkiler. Efor: L. Değer: yΓΌksek ama geniş yΓΌzey. + + B. Üretim / platform boşluklarΔ± (backend) + + 9. Sunucu tarafΔ± prediction log β€” şu an hiΓ§ yok. grep prediction_log|log_prediction β†’ sΔ±fΔ±r. POST /api/deployment/predict session alΔ±yor ama sadece active deployment'Δ± + okuyor; ne tahmin edildiğine dair sunucuda hiΓ§bir kayΔ±t yok. Tahmin geΓ§mişi tarayΔ±cΔ±nΔ±n localStorage'Δ±nda duruyor. Bu tek başına bir ΓΆzellik değil, ΓΌΓ§ ΓΆzelliğin ΓΆn + koşulu: inference denetimi, prediction drift, canlΔ± performans ΓΆlΓ§ΓΌmΓΌ. Bir prediction_logs tablosu (deployment_id, model_version, hash'lenmiş feature vektΓΆrΓΌ, skor, + eşik, latency) bunu aΓ§ar. Efor: M. Değer: kritik β€” bu olmadan "production MLOps" iddiasΔ± eksik. + + 10. GerΓ§ek sonuΓ§ (actuals) geri beslemesi β†’ canlΔ± performans & konsept drift β€” #9'un ΓΌzerine: POST /deployment/feedback ile gΓΆzlenen gerΓ§ekleri loglanmış tahminlere + bağla. BΓΆylece feature drift değil, model performansΔ± drift'i ΓΆlΓ§ΓΌlΓΌr (bugΓΌn core'da yalnΔ±zca KS/PSI/Wasserstein feature+schema drift var; roadmap'teki DRIFT-01 de + hΓ’lΓ’ feature temsilini tartışıyor, bu farklΔ± bir eksen). Γ‡Δ±ktΔ±: "modelin gerΓ§ek dΓΌnyadaki AUC'u son 30 gΓΌnde 0.84 β†’ 0.79" + otomatik yeniden eğitim tetikleyicisi. + Efor: M. Değer: Γ§ok yΓΌksek. + + 11. Toplu (batch) skorlama job'Δ± β€” predict 10.000 satΔ±rla sΔ±nΔ±rlΔ± ve interaktif; security.py dokΓΌmanΔ± bulk scoring'i aΓ§Δ±kΓ§a "pipeline execution'a bΔ±rakΔ±lmış" diye + geΓ§iştiriyor. Yani platform eğitip deploy edebiliyor ama ΓΆlΓ§ekli skorlayamΔ±yor. Celery task: DataSource oku β†’ deployed artifact'i uygula β†’ sonucu yeni DataSource + olarak yaz. Mevcut ArtifactStore, SmartCatalog ve job altyapΔ±sΔ± yeter. Efor: M. Değer: Γ§ok yΓΌksek β€” en sΔ±k gerΓ§ek ΓΌretim senaryosu. + + 12. Alembic migration altyapΔ±sΔ± β€” alembic.ini yok, migrations/ yok; şema aΓ§Δ±lışta create_tables() (metadata create-all) ile kuruluyor. SonuΓ§: self-hosted bir kurulumu + sΓΌrΓΌm yΓΌkseltirken şema değişimi veri kaybΔ± veya hata demek. Roadmap R10 hedefi "v1.0 self-hostable & authenticated" β€” migration olmadan bu hedef tutmaz. 12 tablo, + bilinen ve sΔ±nΔ±rlΔ± bir iş. Efor: M. Değer: yΓΌksek (gΓΆrΓΌnmez ama bloklayΔ±cΔ±). + + 13. UyarΔ± teslim kanallarΔ± (webhook β†’ Slack β†’ e-posta) β€” slack|webhook|smtp|send_email|notification grep'i backend'de sadece UI-toast yorumlarΔ±nΔ± buluyor. Drift + alert'lerinin tam bir yaşam dΓΆngΓΌsΓΌ var (severity/acknowledge/resolve/owner/disposition_history) ama kimseye haber vermiyor β€” yani birinin sΓΌrekli ekrana bakmasΔ± + gerekiyor. KΓΌΓ§ΓΌk bir Notifier soyutlamasΔ± + ΓΆnce webhook (SMTP karmaşasΔ± yok), hem drift hem job-failure iΓ§in. Celery beat zaten kurulu. Efor: S. Değer: yΓΌksek, Γ§ok + düşük maliyet. + + 14. Prometheus /metrics + OpenTelemetry β€” prometheus|/metrics sΔ±fΔ±r eşleşme; sadece opsiyonel Sentry var. Platform yavaş düğümleri ve hatalarΔ± kendi iΓ§inde takip + ediyor (slow-nodes, error_events) ama gerΓ§ek bir altyapΔ±ya dışarΔ±dan bakΔ±lamΔ±yor. prometheus-fastapi-instrumentator + Celery exporter ile başlanΔ±r; mevcut + execution_time ve peak_memory_bytes metrikleri doğrudan expose edilir. Efor: S–M. Değer: orta-yΓΌksek (kurumsal benimseme ΓΆn koşulu). + + 15. Kaynak ve enerji muhasebesi β€” peak_memory_bytes zaten toplanΔ±yor (preprocessing/base.py:221, _pipeline.py:92), execution_time da job metrics'inde. Eksik olan + sadece birleştirip sunmak: job başına CPU-saniye, tepe bellek, tahmini enerji/COβ‚‚ ve bunlarΔ±n Dashboard + SlowNodes'ta gΓΆsterimi. "Polars-first performance" + pazarlamasΔ± yapan bir ΓΌrΓΌnΓΌn kendi maliyetini ΓΆlΓ§ebilmesi hem FinOps hem yeşil-BT raporlamasΔ± iΓ§in somut bir fark. Efor: S. Değer: orta, veri %80 hazΔ±r. + + C. Canvas / UX + + 16. Graph JSON iΓ§e/dışa aktarma β€” export sadece PNG/SVG/notebook. Canvas grafiği /pipeline/save ile zaten JSON olarak gidip geliyor, yani dosyaya yazmak/okumak Γ§ok + ucuz. KazanΔ±mΔ± bΓΌyΓΌk: kurulumlar arasΔ± taşınabilirlik, PR/issue'ya pipeline ekleyebilmek, yedekleme ve topluluk şablonu paylaşımΔ± (mevcut 5 şablonun ΓΆtesine geΓ§menin + ΓΆn koşulu). Not: roadmap'te değil. Efor: S. Değer: yΓΌksek/oran Γ§ok iyi. + + 17. Canvas minimap + grup/Γ§erΓ§eve/annotation β€” MiniMap grep'i frontend'de sΔ±fΔ±r render; React Flow'da tek satΔ±r. Gruplama/alt-akış/Γ§erΓ§eve/yorum da hiΓ§ yok. BΓΌyΓΌk + pipeline'larda gezinme ve pipeline'Δ± başkasΔ±na anlatma (Γ§erΓ§eve + not) bugΓΌn mΓΌmkΓΌn değil; review kΓΌltΓΌrΓΌ olan ekipler iΓ§in doğrudan engel. Efor: minimap S, + grup/Γ§erΓ§eve M. Değer: orta-yΓΌksek. + + 18. Versiyon yΓΌklemeden ΓΆnce diff gΓΆster β€” graphDiff.ts ve PipelineDiffView.tsx zaten yazΔ±lmış ama yalnΔ±zca iki tamamlanmış job arasΔ±nda kullanΔ±lΔ±yor. Bir + PipelineVersion'Δ± geri yΓΌklerken kullanΔ±cΔ± sadece bir onay diyaloğu gΓΆrΓΌyor β†’ mevcut iş sessizce ezilebilir. Var olan kodu ikinci bir yere bağlamak. Efor: S. Değer: + orta (veri kaybΔ± ΓΆnleme). + + 19. Global arama (Ctrl+K her sayfada) β€” CommandPalette yalnΔ±zca canvas düğümΓΌ arΔ±yor. Job/dataset/model/drift-alert/error adΔ±na gΓΆre atlama yok; 11 sayfalΔ±k bir + uygulamada bu hissedilir bir sΓΌrtΓΌnme. Efor: S–M. Değer: orta. + + 20. Düğümden dokΓΌmantasyona derin bağ + inline parametre yardΔ±mΔ± β€” docs/user_guide/ 21 sayfa, ama node ayarlarΔ±nda sadece tek satΔ±r aΓ§Δ±klama ve 2 sekmelik + HelpGuideModal var. DokΓΌman zaten yazΔ±lmış; eksik olan ihtiyaΓ§ anΔ±na bağlamak (parametre alanΔ±nΔ±n yanΔ±ndaki ? β†’ ilgili kΔ±lavuz bΓΆlΓΌmΓΌ). Efor: S. Değer: orta, + activation'a doğrudan katkΔ±. + + D. MΓΌhendislik kalitesi + + 21. Engine-parity otomatik fark denetleyicisi β€” initiatives/dual-engine-correctness/ iΓ§inde 49 bulgu ve 0 uygulanmış dΓΌzeltme var. Tek tek dΓΌzeltmek yerine: + registry'deki her düğümΓΌ ΓΌretilmiş (Hypothesis) frame'ler ΓΌzerinde iki motorda da Γ§alıştΔ±rΔ±p sonuΓ§larΔ± toleransla karşılaştΔ±ran bir harness. 49 bulguyu tek tek bulmak + yerine sΔ±nΔ±fΔ±n tamamΔ±nΔ± ortaya Γ§Δ±karΔ±r ve OC-64/OC-65 gibi kalanlara da doğrudan cevap verir. Mevcut test_registry_contract.py bunun iskeleti. Efor: M. Değer: Γ§ok + yΓΌksek (bu repo'nun gerΓ§ek ağrΔ± noktasΔ±). + + 22. Metamorfik düğüm sΓΆzleşmeleri β€” Repo'nun kendi kaydΔ±: OC-12/163/165/166'nΔ±n hepsi aynΔ± desenden Γ§Δ±ktΔ± (X satΔ±r kaybetti, y korudu, model yanlış etiketle sessizce + eğitildi). Bu bir tesadΓΌf değil, test stratejisi boşluğu. Property tabanlΔ± invariant'lar: "satΔ±r-filtreleyen düğüm değilse len(apply(X)) == len(X)", "y her zaman + select_rows_by_position'dan geΓ§ti", "stateless transform'ta fitβ†’apply idempotent". F841'in ortaya Γ§Δ±kardığı "3 test hiΓ§ assertion'sΔ±z geΓ§miş" vakasΔ± da aynΔ± ailenin + ΓΌyesi. Efor: M. Değer: Γ§ok yΓΌksek β€” tekrarlayan hata sΔ±nΔ±fΔ±nΔ± kapatΔ±r. + + 23. Entry-point tabanlΔ± node plugin API'si β€” NodeRegistry.register import yan etkisiyle Γ§alışıyor, yani ΓΌΓ§ΓΌncΓΌ taraf bir düğüm paketi fork etmeden eklenemiyor. + importlib.metadata.entry_points("skyulf.nodes") keşfi + Apache-2.0 core ΓΌzerinden topluluk düğüm paketleri. AΓ§Δ±k-Γ§ekirdek iş modeline ve landing page'de yΔ±ldΔ±z/indirme + sayacΔ± gΓΆsteren bir bΓΌyΓΌme stratejisine doğrudan hizmet eder. (Roadmap R5'teki "schema-driven renderer" bunun frontend ΓΆn koşulu β€” Γ§akışma değil, tamamlayΔ±cΔ±.) Efor: + M. Değer: orta-yΓΌksek, ekosistem bahsi. + + E. ÜrΓΌn / pozisyonlama + + 24. Pipeline Verification Report β€” ParΓ§alarΔ±n hepsi var ama hiΓ§bir yerde birleşmiyor: leakage doğrulamasΔ±, fingerprint() (semantik mΓΌhΓΌr), export_model_card(), + per-fold preprocessing refit, şema doğrulama, node summary'leri, mermaid diyagram. BunlarΔ± tek bir pass/fail skor kartΔ± (HTML/PDF) halinde toplayan bir Γ§Δ±ktΔ±, markanΔ±n + somut teslim edilebilir nesnesi olur: bir data scientist bunu reviewer/denetΓ§iye gΓΆtΓΌrebilir. Yeni yetenek değil, montaj. (Not: frontend-consumer-design'daki "report + export" maddesiyle kΔ±smi Γ§akışma β€” orada EDA raporu kastediliyor, burada doğrulama/denetim raporu.) Efor: S–M. Değer: yΓΌksek, konumlandΔ±rma aΓ§Δ±sΔ±ndan en gΓΌΓ§lΓΌsΓΌ. + + 25. Kredi riski / skor kartΔ± dikey paketi β€” WOE + Information Value (encoding/woe.py:180), kalibrasyon, threshold tuning, calibration/gains eğrileri zaten mevcut. + Eksik olanlar az ve ucuz: ayrıştΔ±rma iΓ§in KS istatistiği, Gini (2Β·AUCβˆ’1), skor bantlarΔ±nda SOM/PSI, skor kartΔ± tarzΔ± katsayΔ± tablosu, ve #2'deki adillik kontrolΓΌ. + Bunlar bir araya gelince "gΓΆrsel bir araΓ§la regΓΌle skor kartΔ± ΓΌret" diye satΔ±n alΔ±nan bir dikey oluşur. Efor: M. Değer: yΓΌksek (gelir yolu). From d470b871696ddc782b77d90e477d43ea9b9ee343 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 20:30:59 +0300 Subject: [PATCH 10/17] fix(core): align validation targets and preserve class and group identity Repair threshold preprocessing, sparse-class ROC and PR-AUC, decomposition output-name collisions, and dataframe wrapper restoration. Add regression coverage and update user docs, changelog and audit records. Signed-off-by: flyingriverhorse --- changelog/0.8.x.md | 13 ++ docs/guides/backend_api.md | 4 + docs/reference/modeling_nodes.md | 11 + docs/user_guide/serialization.md | 7 + docs/user_guide/threshold_tuning.md | 9 +- .../analysis/opus_core_analysis-open_queue.md | 27 ++- .../analysis/opus_core_analysis-tracker.md | 205 ++++++++++++++++++ skyulf-core/skyulf/engines/pandas_engine.py | 4 +- skyulf-core/skyulf/engines/polars_engine.py | 4 +- .../modeling/_evaluation/classification.py | 18 +- .../skyulf/modeling/_tuning/metrics.py | 24 +- skyulf-core/skyulf/pipeline/_pipeline.py | 17 +- .../profiling/_analyzer/decomposition.py | 17 +- .../integration/test_evaluation_class_axis.py | 32 +++ .../test_profiling_decomposition_names.py | 66 ++++++ .../integration/test_tuning_class_axis.py | 69 ++++++ .../unit/test_engine_wrapper_serialization.py | 100 +++++++++ .../unit/test_patch_coverage_core_round5.py | 17 +- .../unit/test_pipeline_threshold_alignment.py | 155 +++++++++++++ .../test_eda_decomposition_missing.py | 14 +- 20 files changed, 755 insertions(+), 58 deletions(-) create mode 100644 skyulf-core/tests/integration/test_evaluation_class_axis.py create mode 100644 skyulf-core/tests/integration/test_profiling_decomposition_names.py create mode 100644 skyulf-core/tests/integration/test_tuning_class_axis.py create mode 100644 skyulf-core/tests/unit/test_engine_wrapper_serialization.py create mode 100644 skyulf-core/tests/unit/test_pipeline_threshold_alignment.py diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index 54c9c2643..cc8c0d8d3 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,19 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **Threshold validation alignment (OC-249):** carry labels through the same + sorting and filtering as validation features before choosing decision + thresholds; reject mismatched raw row counts. Rerun threshold optimization + if an affected pipeline previously saved a cutoff. +- **Single-class evaluation (OC-35):** omit undefined binary ROC curves and + ROC AUC when a holdout contains one class, while retaining finite PR output. +- **PR-AUC tuning (OC-252):** align probability columns with the fitted model's + classes when validation omits a class, including the binary positive class. +- **Decomposition column names (OC-258):** preserve groups named `value` or + `ratio` through aggregation and drill-down; allow a numeric grouping column + to serve as its own measure. +- **Dataframe wrapper restoration (OC-262):** load pickled/joblib pandas and + Polars wrappers without recursion, preserving their data and native methods. - **LightGBM row sampling (OC-187):** make `subsample` effective for GBDT/DART in basic training, all tuning strategies and final refitting. Preserve GOSS sampling, explicit frequency overrides and existing fitted models; retrain diff --git a/docs/guides/backend_api.md b/docs/guides/backend_api.md index 16afd0dbe..35a9cb6a5 100644 --- a/docs/guides/backend_api.md +++ b/docs/guides/backend_api.md @@ -315,6 +315,10 @@ values in `group`: {"column": "group", "operator": "==", "value": null} ``` +Input columns can be named `value`, `ratio`, `name` or `filter_value`; those +names do not conflict with response fields. A numeric column can also be used +as both the grouping column and the measure. + Use `"!="` with `null` to select non-missing rows. The UI labels the missing bucket `Unknown (missing)` and keeps literal `Unknown` separate. Older response rows without `filter_value` fall back to their display name; the legacy string diff --git a/docs/reference/modeling_nodes.md b/docs/reference/modeling_nodes.md index 28aff20bb..9f68b2266 100644 --- a/docs/reference/modeling_nodes.md +++ b/docs/reference/modeling_nodes.md @@ -62,6 +62,10 @@ Seed** in each node's Cross Validation section. Full precedence rules: ## Classification +Binary evaluation omits the ROC curve and ROC AUC when the held-out partition +contains only one trained class, since ROC requires both classes. Finite +precision-recall output and the other available metrics remain in the report. + ### LightGBM row sampling The `lgbm_classifier` and `lgbm_regressor` nodes apply `subsample` during basic @@ -440,6 +444,13 @@ Learned params: - a tuple `(best_model, tuning_result)` where `best_model` is a fitted estimator. +`pr_auc_weighted` matches probability columns to the fitted model's classes, +even when a validation partition omits a trained class. Multiclass `pr_auc` +also resolves to this scorer. Multiclass scores use support-weighted average +precision; binary `pr_auc_weighted` uses the model's second class as positive. +A binary holdout without positive examples therefore scores 0, rather than +changing which class is positive. + ## Cross-validation `StatefulEstimator.cross_validate()` can perform CV on the train split and returns aggregated fold metrics. diff --git a/docs/user_guide/serialization.md b/docs/user_guide/serialization.md index 61f3f44bc..169f84a85 100644 --- a/docs/user_guide/serialization.md +++ b/docs/user_guide/serialization.md @@ -15,6 +15,13 @@ That includes: - Some preprocessing nodes store sklearn objects inside `params` (e.g., KNN/Iterative imputers, OneHotEncoder). Those are not JSON-serializable and require pickling. +Dataframe wrappers returned by `EngineRegistry.wrap()` can be restored through +Python `pickle` and Core's `JoblibModelSerializer`, including inside nested +artifact containers. Restoration preserves the native dataframe, its dtypes, +missing values and pandas index, along with normal wrapper method delegation. +Previously saved wrappers that failed to load with `RecursionError` can be +loaded with the corrected code; no artifact rewrite is required. + ## Load and use ```python diff --git a/docs/user_guide/threshold_tuning.md b/docs/user_guide/threshold_tuning.md index aa0003dcf..5899eea28 100644 --- a/docs/user_guide/threshold_tuning.md +++ b/docs/user_guide/threshold_tuning.md @@ -79,9 +79,12 @@ tuned_predictions = pipeline.predict(new_customers, use_tuned_thresholds=True) ``` `optimize_thresholds()` runs the pipeline's already-fitted preprocessing on -`X_val` internally β€” exactly once, the same single pass `predict()` makes β€” -then calls the model's `predict_proba`, searches thresholds, and stores the -result on the pipeline. That one pass is why `X_val` has to be raw: it is what +`(X_val, y_val)` internally β€” exactly once, the same single pass `predict()` +makes on the features β€” then calls the model's `predict_proba`, searches +thresholds, and stores the result on the pipeline. Labels follow any row sorting +or filtering, so each probability is scored against its matching target. Raw +features and labels must have equal lengths and correspond positionally. +That one pass is why `X_val` has to be raw: it is what makes the probabilities the cutoffs are fitted against the same probabilities `predict(use_tuned_thresholds=True)` later reproduces. `predict(use_tuned_thresholds=True)` then applies those stored thresholds; it diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 14384aa18..1dd9fe3b6 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -15,7 +15,7 @@ file deliberately carries no history. per-area report files `00`–`18`). **Baseline:** commit `93d7719e` (master), audit run 2026-08-31 β†’ 09-01 by 15 parallel read-only agents (Claude Opus 5). 116 findings: 5 πŸ”΄ / 45 🟠 / 44 🟑 / -22 βšͺ, plus OC-160–263 filed by later reviews. OC-100 was retracted as a false +22 βšͺ, plus OC-160–270 filed by later reviews. OC-100 was retracted as a false positive and is not counted; the corrections pass stays in the archive. **Status key:** ⬜ open Β· 🟨 in progress Β· βœ… done Β· ⏭️ parked @@ -27,10 +27,11 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 40 open / 4 parked.** The Core review adds -OC-248–263, reopens OC-35/46 and extends OC-47's reproduction evidence. -OC-90/187/192 remain fixed; filing and verification details are in the -[archive Log](opus_core_analysis-tracker.md#log). +**Current status (2026-09-12): 42 open / 4 parked.** OC-35/249/252/258/262 +are fixed; the latest Core review's OC-264–270 additions remain open. +OC-248/250 remain the next training priorities; OC-46 remains reopened. +Filing, reproduction and verification +details are in the [archive Log](opus_core_analysis-tracker.md#log). Ordered by the master report's suggested fix order: **Now** (silent wrongness reaching users), **Next** (wrong results in realistic configs), **Then** (decide @@ -38,7 +39,7 @@ deployment model), **Ongoing** (remove the hiding conditions). Remaining finding follow, grouped by domain. The **Now** tier contains the newly reproduced training/threshold defects; -**Next** contains the remaining evaluation and payload paths of OC-35/46. +**Next** contains the remaining PCA payload path of OC-46. The **Ongoing** tier has no open findings left; its completed rows are in the archive. The earlier fixes remain recorded there and are not undone by reopening these narrower cases. @@ -48,14 +49,12 @@ these narrower cases. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-248 | 🟠 | Merged fold preprocessing joins different observations: `LagFeatures`/`RollingAggregate` can sort a branch, and `LagFeatures(drop_na=True)`/`ManualBounds` can filter it, but the merge resets indexes, combines columns positionally and takes the first branch's target (`preprocessing/fold_adapter.py:28-34,52-54,181`) | medium | ⬜ open β€” runtime reproduction leaves times `[3,1,2]` with targets `[100,200,300]`; filtering also produces 3 feature rows / 2 targets despite `changes_row_count=False`. | -| OC-249 | 🟠 | Public threshold optimization transforms only `X_val`, leaving `y_val` in its original order when preprocessing sorts or filters rows (`pipeline/_pipeline.py:543-549`) | small | ⬜ open β€” RollingAggregate sorting selects threshold `0.4118` instead of aligned `0.5`, changing eight initially correct predictions into one constant class. | | OC-250 | 🟠 | Tuning bypasses the calculator's nonnative `class_weight` to `sample_weight` conversion while reporting `class_weight="balanced"` in the selected parameters (`modeling/_tuning/grid_random.py:150-154`, `refit.py:77`, `params.py:60`) | medium | ⬜ open β€” GradientBoosting and XGBoost tuned probabilities exactly match unweighted fits; maximum differences from the corresponding balanced fits are `0.575548` and `0.631411`. | ### Next β€” wrong results in realistic configs | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-35 | 🟠 | Binary evaluation still builds a ROC curve when the held-out partition contains only one class, publishing NaN coordinates (`modeling/_evaluation/classification.py:88-94`) | small | ⬜ reopened 2026-09-12 β€” reproduced points `[(0.0, NaN), (0.3333, NaN), (1.0, NaN)]`; the previously fixed multiclass missing-class path remains fixed. | | OC-46 | 🟑 | Constant numeric features still publish non-finite PCA explained-variance ratios in the public profile (`profiling/_analyzer/multivariate.py:161`, `profiling/schemas.py:PCAComponent`) | small | ⬜ reopened 2026-09-12 β€” ten identical rows with two constant features produce `[NaN, NaN]`; `json.dumps(profile.model_dump(mode="json"), allow_nan=False)` raises ValueError. | ### Then β€” decide deployment model first @@ -100,17 +99,19 @@ these narrower cases. | OC-10 | βšͺ | 4 dead `infer_output_schema` overrides that only `return None` (`vectorization/*`) | mechanical | ⬜ open β€” **re-measured 2026-09-06: five, not four** (`count_vectorizer.py:147`, `hashing_vectorizer.py:135`, `tfidf_vectorizer.py:141`, `tokenizer.py:179`, `sentence_embedder.py:204`). `BaseCalculator.infer_output_schema` already ends in `return None` (`preprocessing/base.py:129`), so all five are behaviourally identical to inheriting. **Recommend folding into OC-03 rather than deleting standalone:** each override carries the per-node *reason* the schema is unknowable (learned vocabulary, model-loaded embedding width, data-dependent column survival), which is exactly the documentation OC-03's parametrized "predicted == actual for every node" test needs beside it, and OC-03 will touch these same five files | | OC-11 | βšͺ | Mega smoke test silently skips nodes with empty params (`tests/unit/test_all_nodes_smoke.py`) | small | ⬜ open | -### Remaining β€” encoding / cleaning / imputation / scaling / drop +### Remaining β€” encoding / cleaning / imputation / scaling / drop / resampling | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-254 | 🟑 | LabelEncoder fits supported NumPy/list targets but assumes native Series methods during apply (`preprocessing/encoding/label.py:69,113-115`) | small | ⬜ open β€” NumPy targets raise missing `.map` on pandas and missing `.clone` on Polars; lists fail on `.astype`/`.clone`, and Polars fails even for feature-only encoding. | +| OC-267 | 🟑 | SMOTE+Tomek stores but ignores the configured `k_neighbors`, leaving its inner SMOTE at the default five neighbors (`preprocessing/resampling.py:221-222,292`) | small | ⬜ open β€” with two minority observations and `k_neighbors=1`, ordinary SMOTE and a correctly configured SMOTETomek balance both classes to five rows, while Core's combined sampler raises `n_neighbors=6 > n_samples_fit=2`. | ### Remaining β€” feature generation / selection / vectorization / transformations | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-256 | 🟑 | Feature-selection task inference treats pandas StringDtype/Categorical targets with more than ten classes as regression (`preprocessing/feature_selection/_common.py:54-69`) | small | ⬜ open β€” 11 labels repeated four times work as object dtype but make UnivariateSelection and ModelBasedSelection fail as string/category; explicit classification is a workaround. | +| OC-264 | 🟑 | GeneralTransformation fits each power rule against the original input although apply executes same-column rules sequentially (`preprocessing/transformations/general.py:225-228`) | small | ⬜ open β€” a log rule followed by standardized Yeo-Johnson yields mean `-0.995375`; equivalent sequential nodes yield approximately zero on both engines, so later rules learn the wrong intermediate distribution. | ### Remaining β€” profiling (outside the OC-39–46 cluster) @@ -119,7 +120,6 @@ these narrower cases. | OC-47 | 🟑 | Common-column dtype drift can silently disappear or be erased by a successful lossy cast to the reference dtype (`profiling/drift.py:192`) | small | ⬜ open β€” besides the original uncastable-to-null case, integer reference `[0]*50+[1]*50` against fractional current `[0.9]*50+[1.9]*50 reports all distances zero; a Float64 reference control detects drift with normalized Wasserstein `1.8`. | | OC-50 | 🟑 | Binary targets miss class-balance advice or flip to regression by sample size (`recommendations.py:147-152`) | small | ⬜ open | | OC-257 | 🟑 | Native Enum columns bypass categorical drift dispatch and disappear from the report (`profiling/drift.py:154-162`) | small | ⬜ open β€” identical Enum dtypes with 100 `a` values replaced by 100 `b` values return zero drift and no column metrics; String controls detect PSI `10.54365`. | -| OC-258 | 🟑 | Decomposition grouping columns named `value` or `ratio` collide with generated aggregation fields (`profiling/_analyzer/decomposition.py:140-148`) | small | ⬜ open β€” `value` raises DuplicateError; `ratio` replaces category names and drill-down filter values with `0.5`; reproduced after the separate OC-192 missing-group repair. | | OC-259 | 🟑 | Decimal columns are classified as Text and abort the entire EDA profile when batched string aggregates run (`profiling/_analyzer/_utils.py:64`, `profiling/analyzer.py:278`) | small | ⬜ open β€” a two-row Decimal amount column raises SchemaError from `str.len_bytes()`; Time/List columns hit the same unsupported-dtype fallback, while Float64 succeeds. | | OC-260 | 🟑 | Time-series plotting builds unequal timestamp/value arrays when metrics have different missingness (`profiling/visualizer.py:823-827,846`) | small | ⬜ open β€” a native profile with 1000 timestamps and only 500 observed values for one metric makes public `EDAVisualizer.plot()` raise an x/y dimension mismatch. | @@ -131,7 +131,6 @@ these narrower cases. | OC-64 | 🟠 | **F-14 only partially fixed** β€” engine registry global still an unlocked race (`engines/registry.py:60,86-91`) | small | ⬜ open | | OC-65 | 🟑 | polars `to_numpy()` zero-width "parity fix" does not achieve parity (`engines/polars_engine.py`) | small | ⬜ open | | OC-261 | 🟑 | Pipeline fingerprints omit stored decision thresholds, allowing identical fingerprints for different predictions under the same `use_tuned_thresholds=True` call (`pipeline/_pipeline.py:695-701`) | small | ⬜ open β€” two copies of one fitted classifier learn positive thresholds `0.480392` and `0.519608`, disagree on four of eight predictions, and retain equal fingerprints. | -| OC-262 | 🟑 | Both dataframe wrappers recurse through missing `_df` during pickle/joblib restoration (`engines/pandas_engine.py:100-102`, `engines/polars_engine.py:121-123`) | small | ⬜ open β€” Core's JoblibModelSerializer can dump either wrapper but loading it raises RecursionError; direct pickle round trips fail identically. | ### Remaining β€” outliers / casting / binning / timeseries / geo @@ -139,14 +138,18 @@ these narrower cases. |---|---|---|---|---| | OC-255 | 🟑 | DateFeatures uses local offsets on pandas and UTC on Polars; mixed DST offsets make the pandas `.dt` access fail (`preprocessing/time_series/date_features.py:64-66,106-109`) | small | ⬜ open β€” identical `+02:00` strings produce different days/hours; mixed `+02:00`/`+03:00` strings raise AttributeError on pandas, so choose and enforce one timezone contract. | | OC-263 | 🟑 | Haversine roundoff can put the intermediate outside `[0,1]`, producing NaN for valid antipodal coordinates on both engines (`preprocessing/geo/distance.py:53-54,108-109`) | small | ⬜ open β€” `(-89.91000888888888,0)` to `(89.91000888888888,180)` returns NaN instead of approximately `20015.114442 km`. | +| OC-265 | 🟑 | Polars string-to-datetime casting uses a generic cast without parsing and silently replaces valid ISO dates with nulls under default coercion (`preprocessing/casting.py:221`) | small | ⬜ open β€” `2024-01-01` and `2024-06-15` become two nulls while the same Casting node on pandas preserves both dates; separate from DateFeatures timezone handling in OC-255. | +| OC-266 | 🟑 | Polars categorical-to-boolean casting invokes string methods on categorical expressions; Enum inputs fall through to an unsupported generic cast (`preprocessing/casting.py:109,177-179,221`) | small | ⬜ open β€” categorical and Enum `true`/`false` inputs raise SchemaError and ComputeError respectively, while plain Polars strings and pandas categorical values convert successfully. | ### Remaining β€” modeling / tuning | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-251 | 🟑 | Fold-aware Halving/Optuna scoring keeps original validation labels after preprocessing filters prediction rows (`modeling/_tuning/fold_pipeline.py:168-171`) | medium | ⬜ open β€” IQR yields 120 held-out labels / 110 predictions; actual halving_grid and Optuna searches fail all trials while grid scores the same chain at R2 `0.999998`. | -| OC-252 | 🟑 | Weighted PR-AUC tuning derives its class axis from the holdout instead of the trained model (`modeling/_tuning/metrics.py:84-90`) | small | ⬜ open β€” a three-class model and two-class holdout produce a 40-by-3 probability/target mismatch and fail all trials; model-class-aligned average precision succeeds at `1.0`. | | OC-253 | 🟑 | F1 tuning and evaluation/threshold tuning disagree on the positive class for labels `{1,2}` (`modeling/_tuning/metrics.py:235`, `modeling/_evaluation/classification.py:84`) | decision + small | ⬜ open β€” the same predictions score `0.909091` for class 1 in tuning and `0.8` for class 2 in evaluation; reconcile the documented stock-scorer exception with a shared positive-class contract. | +| OC-268 | 🟑 | Calibrated ensemble fitting applies nested calibration-estimator parameters before creating the calibration wrapper, losing selected base-model settings during subsequent fit/CV (`modeling/ensemble.py:299-300,468-473`) | small | ⬜ open β€” tuning selects `logistic_regression__estimator__C=0.01`, but fitting the returned best parameters restores `C=1.0`, with a maximum probability difference of `0.410206`. | +| OC-269 | 🟑 | Optuna constructs the selected pruner but never enables pruning on OptunaSearchCV (`modeling/_tuning/strategies/optuna.py:240-252`) | medium | ⬜ open β€” Hyperband with incremental-fit-capable SGD still has `enable_pruning=False` and no intermediate trial values; respect estimator capabilities when implementing the advertised early stopping. | +| OC-270 | 🟑 | Tuning's hardcoded missing-value allowlist rejects tree estimators that natively accept NaN in the installed sklearn version (`modeling/_tuning/engine.py:318,404-416`) | small | ⬜ open β€” RandomForest, ExtraTrees and DecisionTree fit the same missing-value data directly but fail before tuning with an imputer-required ValueError despite `allow_nan=True`. | ### Remaining β€” frontend diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index e9e64a18a..e6c85e611 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -90,6 +90,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-249 | 🟠 | Public threshold optimization transforms only `X_val`, leaving `y_val` in its original order when preprocessing sorts or filters rows (`pipeline/_pipeline.py:543-549`) | small | βœ… fixed 2026-09-12 β€” validate raw row counts and carry labels through fitted preprocessing sorting/filtering before threshold scoring; both engines and failure-state preservation are covered. | | OC-75 | πŸ”΄ | Dev polars 1.40.1 below declared floor β‰₯1.43.2 β€” 10 tests, every notebook, a benchmark broken; prerequisite for trusting any polars result | 1 line | βœ… done | | OC-12 | πŸ”΄ | Row-dropping desyncs `X` and `y` on non-unique pandas indexes (`drop_rows.py:60-67`, `deduplicate.py:44-47`); polars path already correct | small | βœ… fixed 2026-09-03 | | OC-58 | πŸ”΄ | Numericβ†’boolean cast on polars treats any nonzero as `True` (`casting.py:143-178`) | small | βœ… fixed 2026-09-03 | @@ -99,6 +100,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-35 | 🟠 | Binary evaluation still builds a ROC curve when the held-out partition contains only one class, publishing NaN coordinates (`modeling/_evaluation/classification.py:88-94`) | small | βœ… fixed 2026-09-12 β€” omit undefined binary ROC curves for single-class holdouts while preserving finite PR output and the earlier multiclass guard. | | OC-207 | 🟠 | `optimize_thresholds()` transforms its `X_val` internally (`pipeline/_pipeline.py:325`), but `docs/user_guide/threshold_tuning.md:32`, `skyulf-core/README.md:205` and the method's own docstring (`:280`) all tell callers to feed it `get_fitted_split()` output β€” which is **already** preprocessed. The documented workflow therefore tunes thresholds on double-transformed probabilities, and `predict(use_tuned_thresholds=True)` then applies them to singly-transformed ones (`:365`), so the cutoffs are fitted against a distribution inference never reproduces. Needs a contract decision (fix the three docs, or accept pre-transformed input) before code | decision + small | βœ… fixed 2026-09-07 β€” the contract decision was "keep the code, fix the prose": `optimize_thresholds` and `predict` already both took raw input and transformed exactly once, so the three narrative sites that pointed callers at `get_fitted_split()` were the defect. See the log entry | | OC-177 | 🟠 | Pandas `DummyEncoder` changes a known category's encoding with batch composition: after fitting `[1.0,2.0]`, `1.0` encodes as known alone but all-zero when accompanied by `2.5` (`preprocessing/encoding/dummy.py:60-64`) | small | βœ… fixed 2026-09-06 β€” **broader than filed**: the two engines also learned different category *strings* from the same float data (`["1","2"]` vs `["1.0","2.0"]`), so they emitted differently named indicator columns; both symptoms were one batch-dependent renderer, replaced by a per-value rule shared by the engines. See the log entry | | OC-164 | 🟠 | `get_fitted_split()` on new data replaces a trained pipeline's preprocessing while retaining its old model β€” the same input's prediction changed from 50 to βˆ’950 (`pipeline/_pipeline.py:234`) | small | βœ… fixed 2026-09-06 β€” isolation, not invalidation: a throwaway `FeatureEngineer` over the same steps leaves the pipeline's fitted state alone, so predictions are identical before and after. See the log entry | @@ -248,6 +250,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-258 | 🟑 | Decomposition grouping columns named `value` or `ratio` collide with generated aggregation fields (`profiling/_analyzer/decomposition.py:140-148`) | small | βœ… fixed 2026-09-12 β€” separate group labels from aggregation output fields and retain native numeric measures, including when grouping and measuring the same column. | | OC-192 | 🟑 | Decomposition's categorical null bucket loses rows when drilled into (`profiling/_analyzer/decomposition.py`) | small | βœ… fixed 2026-09-12 β€” preserve nullable group identity through response/filter payloads and tree navigation, keeping actual `Unknown` categories separate. | | OC-48 | 🟑 | Expectations pass vacuously on empty frames (`profiling/expect.py`) | small | βœ… fixed 2026-09-12 β€” require at least one row by default in null/range/uniqueness checks, with explicit `allow_empty=True`, preserved schema validation and safe all-null range checks. | | OC-51 | 🟑 | Transform advice can be mathematically invalid and contradict the clean-dataset message | small | βœ… fixed 2026-09-12 β€” use domain/skew-aware transform advice and evaluate all preparation recommendations, including target resampling, before emitting a limited clean-dataset message. | @@ -276,6 +279,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-262 | 🟑 | Both dataframe wrappers recurse through missing `_df` during pickle/joblib restoration (`engines/pandas_engine.py:100-102`, `engines/polars_engine.py:121-123`) | small | βœ… fixed 2026-09-12 β€” resolve wrapper state without recursive delegation during restoration; pickle/joblib round trips preserve both native frames and their methods. | | OC-74 | 🟑 | `NodeRegistry.list_models()` hides all 4 Ensemble models; `category` arg dead (`registry.py:101-108`) | small | βœ… fixed 2026-09-11 - include Modeling and Ensemble in model discovery and exclude both from transformer discovery; preserve exact category filters and registration order. | | OC-167 | 🟑 | Ambiguous string boundaries in artifact serialization give different fitted label encoders identical pipeline fingerprints, despite encoding the same input as 0 vs βˆ’1 (`pipeline/seal.py:52,64`) β€” distinct from OC-62's pointer instability | small | βœ… fixed 2026-09-09 - typed length framing and canonical unordered entries distinguish different fitted values deterministically. | | OC-63 | 🟠 | `artifact_digest` raises `RecursionError` instead of the documented `TypeError` on cyclic graphs (`pipeline/seal.py`) | small | βœ… fixed 2026-09-09 - active-path cycle detection raises TypeError and still accepts shared acyclic state. | @@ -302,6 +306,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-252 | 🟑 | Weighted PR-AUC tuning derives its class axis from the holdout instead of the trained model (`modeling/_tuning/metrics.py:84-90`) | small | βœ… fixed 2026-09-12 β€” derive the probability class axis from the fitted estimator across all five search strategies, preserving the trained binary positive class. | | OC-187 | 🟑 | LightGBM's subsample control and search dimension have no effect with default frequency zero | small | βœ… fixed 2026-09-12 β€” resolve automatic bagging after candidate parameters, enabling ordinary row sampling while preserving GOSS, explicit frequencies, native aliases and existing artifacts. | | OC-218 | 🟑 | Connected model CV seed `0` is replaced by the existing ensemble seed during frontend settings synchronization | small | βœ… fixed 2026-09-09 - explicit zero now survives synchronization and both fixed/tuned request conversion; missing seeds retain the ensemble default. | | OC-206 | βšͺ | Ensemble configuration resolution shallow-copies nested base-model parameters, so fitting mutates the caller's configuration (`modeling/ensemble.py:473,484`) | small | βœ… fixed 2026-09-09 - inner base-model parameter maps are copied before temporary overrides, preserving caller settings and later refits. | @@ -413,6 +418,206 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-35/249/252/258/262: validation alignment, metrics, grouping and restoration + +Committed the preceding OC-90/187/192 batch as DCO-signed `f479e196` after +fresh Core/frontend/HTTP regressions, strict docs and all commit hooks passed. +Continued with five independent findings using three implementation agents +and root-owned decomposition work, followed by cross-reviews. Concurrent +audit additions OC-264–270 remain recorded and open; they were not overwritten +by this repair batch. + +- **OC-249:** reproduced the reversed RollingAggregate validation case: raw + labels scored against sorted probabilities selected `0.4117647`, turning + eight correct predictions into a constant class. Threshold optimization now + passes both features and labels through the fitted preprocessing and uses + the transformed labels; the same case selects `0.5` and predicts four zeros + then four ones. Raw length mismatches are rejected before sorting can hide + them. **Fourteen cases failed and four passed before repair.** Cross-review + then caught a compatibility regression for pandas labels with Polars + features and the reverse. Two added cases failed before normalizing labels + to NumPy at the paired transform boundary; all **20 cases now pass**. + Sorting, LagFeatures/ManualBounds filtering, series/list/NumPy targets, + positional pandas indexes and preserving saved thresholds on failure are + covered. Independent controls also exercised native/wrapped inputs, fitted + splitters and feature-target separation. Existing saved cutoffs are not + changed automatically; rerun optimization for an affected pipeline. +- **OC-35:** binary single-class holdouts emitted non-finite ROC coordinates + despite the earlier multiclass guard. Omit the undefined ROC curve while + retaining finite PR output; scalar ROC AUC was already sanitized away. + **Four regressions failed before repair and pass afterward**, covering + positive-only/negative-only holdouts with numeric and string labels. Rerun + evaluation to refresh previously stored reports. +- **OC-252:** weighted PR-AUC inferred its probability class axis from the + holdout, so a three-class estimator and a two-class validation partition + failed every trial. The scorer now receives the estimator and aligns + targets to its trained classes; all five search strategies and the + multiclass `pr_auc` alias score the reproduced case at **1.0**. A binary + negative-only holdout now scores **0.0**, keeping the trained positive class + instead of relabeling the remaining class as positive. **Seventeen failed + and six passed before repair; all 23 pass afterward.** Missing first, + middle, last and multiple classes are covered. Independent grid/halving/ + Optuna controls with fold-fitted StandardScaler passed both inner CV and + explicit sparse holdouts. OC-251 filtering and OC-253's stock F1 policy + remain separate open findings. +- **OC-258:** grouping by `value` raised DuplicateError and grouping by + `ratio` replaced category identities with aggregate fractions. A label + expression now uses a separate name in the grouped result without casting + the source measure. Numeric grouping columns can also be their own measure. + **Fifteen regressions failed before repair; all 30 now pass**, covering all + aggregate modes, reserved/control names, null filters, ratios and unchanged + source data. Three real HTTP cases preserve null and literal `Unknown` + drill-down for `group`, `value` and `ratio`. Independent review passed an + additional 25-case split/measure-name cross-product. OC-192 remains intact; + the response shape and Canvas contract are unchanged. +- **OC-262:** pickle and Core JoblibModelSerializer dumped wrappers but hit + RecursionError during restoration because `__getattr__` recursively looked + up absent `_df`. Direct object lookup now terminates those pre-state probes + with AttributeError and retains native delegation once state exists. + **All 20 regressions failed before repair and pass afterward**, including + both engines, pickle protocols 4/5, nested containers, schema/null/index + fidelity, native methods and shallow copies. Four artifacts created before + repair loaded afterward without rewriting. Delegated deep-copy behavior is + unchanged. Independent review found no remaining issue. + +The latest audit also identified an old recommendation test fixture missing +the NumericStats fields required after OC-51. Reproduced its AttributeError +and replaced the incomplete SimpleNamespace with real ColumnProfile/ +NumericStats values, retaining both threshold branches and asserting the +domain-valid suggestion. This is test maintenance, not a sixth product fix. + +Focused verification passed **227 pipeline/threshold tests**, **442 evaluation/ +tuning tests**, **146 engine/serialization tests**, **73 decomposition/fixture +tests**, and **132 separate backend tests**. These selections overlap; they +are not an additive total. User docs, method docstrings, changelog and both +audit files are updated. The frontend implementation and response shape do +not change in this batch. + +Final verification after the mixed-label compatibility repair: full Core +pytest passed **7,972 tests / 80 skips**, with **three snapshots passing** +and 491 dependency/degenerate-metric/legacy-alias warnings. The earlier failing +recommendation fixture now passes in the full suite. Full-repository Ruff, +configured backend/Core ty, formatting for all 13 changed Python files, strict +MkDocs and diff whitespace checks passed. Independent review confirmed the +mixed-label blocker resolved and found no remaining actionable blockers. +No network model downloads were needed (`HF_HUB_OFFLINE=1` and +`TRANSFORMERS_OFFLINE=1`). The user subsequently authorized committing this +batch after reviewing concrete output examples; its 97 regression cases +passed again before staging. + +The queue has **42 open / 4 parked**: the concurrent review grew it from 40 to +47, then this batch closed five. OC-71/72/73/185 remain parked. + +### 2026-09-12 β€” OC-264–270 filed: seven more reproduced Core defects + +The continuation adds seven P2 findings to the +[live queue](opus_core_analysis-open_queue.md), bringing its recorded status to +**47 open / 4 parked**. Existing parked decisions and prior fixes are unchanged. +All seven symptoms were executed against current source and independently +reproduced by the main reviewer. Paths below are relative to `skyulf-core/skyulf/`. + +- **OC-264 β€” sequential transformation fitting:** use + `GeneralTransformationCalculator` and its applier on + `x=[1.,2.,4.,8.,16.,32.]`, with rules + `{'column':'x','method':'log'}` then + `{'column':'x','method':'yeo-johnson','standardize':True}`. + Fitting/applying both rules together yields mean `-0.9953748450991124`; + fitting the second rule on the first rule's applied output yields + `4.070817756958907e-16`. Both pandas and Polars reproduce. + `preprocessing/transformations/general.py:225-228` fits the power rule on + original `X`, although apply receives the intermediate logged values. + Preserve sequential fitting semantics for overlapping rules; test equivalence + to separate nodes. OC-27's standardization-setting repair remains valid. +- **OC-265 β€” datetime cast loses valid dates:** fit/apply `CastingCalculator` + and `CastingApplier` with `columns=['x'], target_type='datetime'` on + `x=['2024-01-01','2024-06-15']`. Pandas produces both expected timestamps; + Polars produces `[None,None]` under default coercion. + `preprocessing/casting.py:221` uses a generic String-to-Datetime cast instead + of parsing. Cover valid strings and invalid-value coercion/strict behavior; + these ordinary timezone-free inputs are separate from OC-255. +- **OC-266 β€” categorical boolean cast fails:** apply Casting with + `columns=['x'], target_type='boolean'` to a Polars Series containing + `['true','false']`. String succeeds with `[True,False]`, Categorical raises + `SchemaError: expected String, got cat`, and + `pl.Enum(['true','false'])` raises a categorical-to-Boolean `ComputeError`. + Pandas categorical input succeeds. The explicit categorical branch at + `preprocessing/casting.py:177-179` calls string operations at line 109 without + first converting the expression to String; Enum misses that branch entirely. + Preserve the existing text-to-boolean vocabulary and coercion contract while + covering both categorical representations. OC-58's numeric boolean repair + concerns a different input family. +- **OC-267 β€” combined SMOTE ignores neighbor count:** fit/apply + `OversamplingCalculator` and its applier to + `X.x=[0.,1.,2.,3.,4.,10.,11.]`, `y=[0,0,0,0,0,1,1]`, with + `k_neighbors=1, random_state=42`. Method `smote` produces ten rows and + `{0:5,1:5}`; method `smote_tomek` raises + `Expected n_neighbors <= n_samples_fit, but n_neighbors = 6, + n_samples_fit = 2, n_samples = 2`. + The control `SMOTETomek(smote=SMOTE(k_neighbors=1,random_state=42), + random_state=42)` succeeds with the same balanced counts. + `preprocessing/resampling.py:221-222` omits the configured inner SMOTE, + although the calculator stores the setting at line 292. +- **OC-268 β€” calibrated ensemble loses tuned parameters on replay:** build + pandas inputs from `make_classification(n_samples=100,n_features=4, + random_state=7)`. Prepare `VotingClassifierCalculator` with + `base_estimators=['logistic_regression'], calibrate_base_models=True, + calibration_cv=2, voting='soft', n_jobs=1`. Run `TuningCalculator.fit` with + `strategy='grid', cv_folds=2` and the single-value search space + `{'logistic_regression__estimator__C':[0.01]}`. The returned tuned estimator + has `C=0.01`; `calc.fit(X,y,{'params':result.best_params})` restores `C=1.0`. + Predictions differ by up to `0.4102064767291098` in probability. + The invalid `estimator` parameter warning arises because + `modeling/ensemble.py:299-300,468-473` routes nested parameters to the bare + base estimator before wrapping it for calibration. Preserve the selected + configuration across tuning, subsequent fit and CV; this is separate from + OC-206's shared-configuration mutation. +- **OC-269 β€” pruning is never activated:** build the Optuna searcher with + `TuningConfig(strategy='optuna', n_trials=2, search_space={'alpha':[0.001]}, + strategy_params={'pruner':'hyperband'})`, `SGDClassifier(random_state=7)`, + `KFold(2)` and scoring `accuracy`. Fit the same 100-row classification input + used for OC-268. The study uses `HyperbandPruner`, but + `search.enable_pruning` is `False`, and trial intermediate values are + `[{},{}]`. `modeling/_tuning/strategies/optuna.py:240-252` omits the enabling + flag. SGD supports `partial_fit`, so this also fails for a compatible model. + Implement capability-aware pruning; universally enabling it would break + estimators without incremental fitting. +- **OC-270 β€” tuning rejects natively supported NaN:** use + `X.x=[0.,1.,NaN,3.,4.,5.,6.,7.,8.,9.,10.,11.]`, + `X.z=[0.,0.,0.,0.,1.,1.,1.,1.,0.,0.,1.,1.]`, and + `y=[0,0,0,0,1,1,1,1,0,0,1,1]`. A direct + `RandomForestClassifierCalculator.fit` with + `params={'max_depth':2,'n_estimators':5,'n_jobs':1}` succeeds and predicts + all twelve labels correctly. A two-fold grid search over single-value lists + of those same parameters raises an imputer-required ValueError before + dispatch, despite the estimator's `input_tags.allow_nan=True`. + ExtraTrees and DecisionTree reproduce with their supported parameters. + `modeling/_tuning/engine.py:318,404-416` relies on a class-name allowlist + that omits these supported estimators; validate estimator capabilities while + retaining rejection for models that cannot accept missing values. + +Verification: inline reproductions above plus the following existing focused +tests, **263 passed, 1 warning**: + +```powershell +.venv\Scripts\python.exe -m pytest ` + skyulf-core/tests/integration/test_transformations_general.py ` + skyulf-core/tests/integration/test_casting.py ` + skyulf-core/tests/unit/test_resampling.py ` + skyulf-core/tests/integration/test_sentence_embedder.py ` + skyulf-core/tests/unit/test_modeling_ensemble_gaps.py ` + skyulf-core/tests/unit/test_tuning_engine_failure_branches.py ` + -q --tb=short -p no:cacheprovider ` + --basetemp="$env:TEMP\skyulf-core-audit-followup-20260912" +``` + +This continuation sampled transformations, casting, resampling, scaling, +outliers, splitting, calibrated ensembles, nested CV, Optuna and vectorization. +It is not proof that all remaining behavior is correct. A reproduced empty-batch +SentenceEmbedder failure was not filed because its expected empty-input contract +was not established. H3 was unavailable locally and was not execution-verified. +This entry records findings and evidence; it does not claim implementation fixes +or another full-suite run. + ### 2026-09-12 β€” OC-248–263 filed; OC-35/46 reopened and OC-47 extended At the user's request, recorded the preceding read-only Core review in the diff --git a/skyulf-core/skyulf/engines/pandas_engine.py b/skyulf-core/skyulf/engines/pandas_engine.py index b3b8eb0e1..7b4e5e00f 100644 --- a/skyulf-core/skyulf/engines/pandas_engine.py +++ b/skyulf-core/skyulf/engines/pandas_engine.py @@ -99,7 +99,9 @@ def __len__(self) -> int: # but this breaks the protocol abstraction if used. def __getattr__(self, name): """Delegate unknown attribute access to the underlying ``pandas.DataFrame``.""" - return getattr(self._df, name) + # Restoration probes attributes before _df exists; bypass this fallback + # so missing state raises AttributeError instead of recursing. + return getattr(object.__getattribute__(self, "_df"), name) class PandasEngine(BaseEngine): diff --git a/skyulf-core/skyulf/engines/polars_engine.py b/skyulf-core/skyulf/engines/polars_engine.py index 099dd7436..fd0e85c58 100644 --- a/skyulf-core/skyulf/engines/polars_engine.py +++ b/skyulf-core/skyulf/engines/polars_engine.py @@ -120,7 +120,9 @@ def __len__(self) -> int: def __getattr__(self, name): """Delegate unknown attribute access to the underlying ``polars.DataFrame``.""" - return getattr(self._df, name) + # Restoration probes attributes before _df exists; bypass this fallback + # so missing state raises AttributeError instead of recursing. + return getattr(object.__getattribute__(self, "_df"), name) class PolarsEngine(BaseEngine): diff --git a/skyulf-core/skyulf/modeling/_evaluation/classification.py b/skyulf-core/skyulf/modeling/_evaluation/classification.py index c90dbe7b5..066a446ed 100644 --- a/skyulf-core/skyulf/modeling/_evaluation/classification.py +++ b/skyulf-core/skyulf/modeling/_evaluation/classification.py @@ -84,15 +84,17 @@ def evaluate_classification_model( pos_label = classes[1] pos_probs = y_prob[:, 1] - # ROC - fpr, tpr, _ = roc_curve(y_test_np, pos_probs, pos_label=pos_label) - roc_curves.append( - CurveData( - name=f"ROC (Class {class_names[1]})", - points=downsample_curve(fpr, tpr), - auc=metrics.get("roc_auc"), + # ROC requires both classes; a single-class holdout has an + # undefined axis. PR remains finite and is retained below. + if np.unique(y_test_np).size > 1: + fpr, tpr, _ = roc_curve(y_test_np, pos_probs, pos_label=pos_label) + roc_curves.append( + CurveData( + name=f"ROC (Class {class_names[1]})", + points=downsample_curve(fpr, tpr), + auc=metrics.get("roc_auc"), + ) ) - ) # PR precision, recall, _ = precision_recall_curve(y_test_np, pos_probs, pos_label=pos_label) diff --git a/skyulf-core/skyulf/modeling/_tuning/metrics.py b/skyulf-core/skyulf/modeling/_tuning/metrics.py index 590f17840..8e448b27b 100644 --- a/skyulf-core/skyulf/modeling/_tuning/metrics.py +++ b/skyulf-core/skyulf/modeling/_tuning/metrics.py @@ -73,26 +73,26 @@ ) -def _weighted_pr_auc(y_true: Any, proba: Any) -> float: - """Weighted PR-AUC over probabilities, as the evaluation node reports it. +def _weighted_pr_auc(estimator: Any, X: Any, y_true: Any) -> float: + """Score weighted PR-AUC against the estimator's probability class axis. - A binary target arrives as a single column β€” sklearn hands a ``predict_proba`` - scorer only the positive class β€” so it is scored directly instead of being - binarized, and the positive class is named because ``average_precision_score`` - defaults to ``pos_label=1``, which a string label space does not contain. + Holdouts may omit trained classes, so their observed labels cannot define + the probability columns. Binary models score only the trained positive + class, including when that class is absent from the holdout. """ - classes = np.unique(np.asarray(y_true)) - proba = np.asarray(proba) - if proba.ndim == 1: - return average_precision_score(y_true, proba, pos_label=classes[-1]) + classes = estimator.classes_ + proba = np.asarray(estimator.predict_proba(X)) + if len(classes) == 2: + pos_probs = proba if proba.ndim == 1 else proba[:, 1] + return average_precision_score(y_true, pos_probs, pos_label=classes[1]) return average_precision_score( label_binarize(y_true, classes=classes), proba, average="weighted" ) def _pr_auc_weighted_scorer() -> Any: - """Builds the weighted PR-AUC scorer, read off ``predict_proba``.""" - return make_scorer(_weighted_pr_auc, response_method="predict_proba") + """Return an estimator-aware scorer so absent holdout classes stay aligned.""" + return _weighted_pr_auc _G_SCORE_NEEDS_IMBLEARN = ( diff --git a/skyulf-core/skyulf/pipeline/_pipeline.py b/skyulf-core/skyulf/pipeline/_pipeline.py index 1ccb00c3a..9e59a763d 100644 --- a/skyulf-core/skyulf/pipeline/_pipeline.py +++ b/skyulf-core/skyulf/pipeline/_pipeline.py @@ -501,6 +501,8 @@ def optimize_thresholds( ``X_val`` must be raw. This method runs the pipeline's fitted preprocessing on it exactly once, which is what makes the probabilities it tunes against the ones ``predict()`` later reproduces. + Validation labels follow the same row sorting and filtering as the + features, so the metric scores matching observations. ``get_fitted_split()`` is therefore *not* a source for it: that helper returns already-preprocessed frames, so passing them here transforms the holdout a second time and fits the cutoffs against a distribution @@ -509,7 +511,7 @@ def optimize_thresholds( Args: X_val: Validation features, *not* yet transformed (this method runs the pipeline's fitted preprocessing on it internally). - y_val: Validation true labels. + y_val: Validation true labels, paired positionally with ``X_val``. metric: Callable ``(y_true, y_pred) -> float`` to maximize. strategy: ``"grid"`` or ``"nelder-mead"``. If ``None``, auto-selects based on the number of classes (see @@ -524,7 +526,8 @@ def optimize_thresholds( Raises: ValueError: If the pipeline isn't fitted, or the underlying - model doesn't support ``predict_proba``. + model doesn't support ``predict_proba``, or the raw validation + features and labels have different row counts. """ if self.model_estimator is None or self.model_estimator.model is None: raise ValueError( @@ -540,13 +543,19 @@ def optimize_thresholds( "threshold tuning requires a classifier." ) - transformed_val = self.feature_engineer.transform(X_val) + if len(X_val) != len(y_val): + raise ValueError( + "X_val and y_val must contain the same number of rows before preprocessing." + ) + + # Array-like labels may come from a different engine than the features. + transformed_val, transformed_y = self.feature_engineer.transform((X_val, np.asarray(y_val))) proba_df = self._predict_proba_transformed(transformed_val) classes = np.asarray(model_classes) y_proba = np.asarray(proba_df)[:, : len(classes)] thresholds = optimize_thresholds( - y_val, + transformed_y, y_proba, metric=metric, classes=classes, diff --git a/skyulf-core/skyulf/profiling/_analyzer/decomposition.py b/skyulf-core/skyulf/profiling/_analyzer/decomposition.py index ac570dd3f..1bee4b111 100644 --- a/skyulf-core/skyulf/profiling/_analyzer/decomposition.py +++ b/skyulf-core/skyulf/profiling/_analyzer/decomposition.py @@ -123,9 +123,10 @@ def _compute_global_split( def _aggregate_grouped( self, temp_df: pl.DataFrame, split_col: str, measure_col: str | None, measure_agg: str ) -> pl.DataFrame | None: - """Group ``temp_df`` by ``split_col`` and aggregate ``measure_col`` (or count rows).""" + """Aggregate with a separate label expression so source names remain available.""" + group_expr = pl.col(split_col).cast(pl.Utf8).alias("name") if not measure_col: - return temp_df.group_by(split_col).agg(pl.len().alias("value")) + return temp_df.group_by(group_expr).agg(pl.len().alias("value")) if measure_col not in temp_df.columns: return None @@ -137,7 +138,7 @@ def _aggregate_grouped( "max": pl.col(measure_col).max(), } value_expr = agg_exprs.get(measure_agg, pl.len()) - return temp_df.group_by(split_col).agg(value_expr.alias("value")) + return temp_df.group_by(group_expr).agg(value_expr.alias("value")) def _rows_to_split_result(self, agg_df: pl.DataFrame, split_col: str) -> list[dict[str, Any]]: """Format labels and ratios while retaining nullable group values for filtering.""" @@ -170,14 +171,12 @@ def _compute_grouped_split( if split_col not in filtered_df.columns: return [] - # Keep nulls distinct from a real "Unknown" category until display formatting. - temp_df = filtered_df.with_columns(pl.col(split_col).cast(pl.Utf8)) - - agg_df = self._aggregate_grouped(temp_df, split_col, measure_col, measure_agg) + # The grouped label is named separately from the generated value/ratio fields. + agg_df = self._aggregate_grouped(filtered_df, split_col, measure_col, measure_agg) if agg_df is None: return [] - return self._rows_to_split_result(agg_df, split_col) + return self._rows_to_split_result(agg_df, "name") def get_decomposition_split( self, @@ -192,6 +191,8 @@ def get_decomposition_split( Use ``filter_value`` for subsequent equality filters: null selects missing rows, while the string "Unknown" selects that literal category. Numeric columns also accept the legacy "Unknown" missing-value filter. + Output field names do not reserve input column names; a numeric column + may serve as both the split column and the measure. """ # 1. Apply filters (with numeric-vs-string coercion since FE serializes everything as strings). filtered_df = self._apply_decomposition_filters(filters) diff --git a/skyulf-core/tests/integration/test_evaluation_class_axis.py b/skyulf-core/tests/integration/test_evaluation_class_axis.py new file mode 100644 index 000000000..2aaa56fcc --- /dev/null +++ b/skyulf-core/tests/integration/test_evaluation_class_axis.py @@ -0,0 +1,32 @@ +"""Classification reports must respect the trained class axis on sparse holdouts.""" + +import math + +import numpy as np +import pandas as pd +import pytest +from sklearn.linear_model import LogisticRegression + +from skyulf.modeling._evaluation.classification import evaluate_classification_model + + +@pytest.mark.parametrize("labels", [[1, 2], ["no", "yes"]]) +@pytest.mark.parametrize("class_index", [0, 1]) +def test_single_class_binary_holdout_omits_roc_and_preserves_pr(labels, class_index): + """A missing ROC axis must not publish NaN coordinates or discard finite PR data.""" + X = pd.DataFrame({"x": np.arange(40, dtype=float)}) + y = pd.Series(np.repeat(labels, 20)) + model = LogisticRegression().fit(X, y) + held_out = y == labels[class_index] + + report = evaluate_classification_model(model, X[held_out], y[held_out]) + + assert "roc_auc" not in report.metrics + assert report.classification is not None + assert report.classification.roc_curves == [] + assert report.metrics["pr_auc"] == pytest.approx(float(class_index)) + assert len(report.classification.pr_curves) == 1 + curve = report.classification.pr_curves[0] + assert curve.auc == pytest.approx(float(class_index)) + assert curve.points + assert all(math.isfinite(point.x) and math.isfinite(point.y) for point in curve.points) diff --git a/skyulf-core/tests/integration/test_profiling_decomposition_names.py b/skyulf-core/tests/integration/test_profiling_decomposition_names.py new file mode 100644 index 000000000..e3c406148 --- /dev/null +++ b/skyulf-core/tests/integration/test_profiling_decomposition_names.py @@ -0,0 +1,66 @@ +"""Decomposition output fields must not reserve names in the user's dataset.""" + +import json + +import polars as pl +import pytest + +from skyulf.profiling.analyzer import EDAAnalyzer + + +@pytest.mark.parametrize("split_col", ["value", "ratio", "name", "filter_value", "group"]) +@pytest.mark.parametrize( + "measure_agg, expected", + [ + ("sum", {"a": 4, "b": 8, None: 4}), + ("mean", {"a": 2, "b": 8, None: 4}), + ("min", {"a": 1, "b": 8, None: 4}), + ("max", {"a": 3, "b": 8, None: 4}), + ("count", {"a": 2, "b": 1, None: 1}), + ], +) +def test_output_field_names_preserve_group_identity_and_drill_down( + split_col: str, measure_agg: str, expected: dict[str | None, int] +) -> None: + """Names, aggregates and filters must still refer to the same observations.""" + source = pl.DataFrame({split_col: ["a", "a", "b", None], "amount": [1, 3, 8, 4]}) + analyzer = EDAAnalyzer(source) + measure_col = None if measure_agg == "count" else "amount" + rows = json.loads( + json.dumps(analyzer.get_decomposition_split(measure_col, measure_agg, split_col, [])) + ) + assert {row["filter_value"]: row["value"] for row in rows} == expected + assert [row["value"] for row in rows] == sorted(expected.values(), reverse=True) + for row in rows: + assert row["name"] == (row["filter_value"] or "Unknown") + assert row["ratio"] == pytest.approx(row["value"] / sum(expected.values())) + selected = analyzer.get_decomposition_split( + measure_col, + measure_agg, + None, + [{"column": split_col, "operator": "==", "value": row["filter_value"]}], + ) + assert selected == [{"name": "Total", "value": row["value"], "ratio": 1.0}] + assert source.equals(analyzer.df) + + +@pytest.mark.parametrize("column", ["value", "ratio", "name"]) +def test_numeric_group_column_can_also_be_the_measure(column: str) -> None: + """Formatting group labels must not turn a numeric measure into strings.""" + analyzer = EDAAnalyzer(pl.DataFrame({column: [1, 1, 3]})) + rows = analyzer.get_decomposition_split(column, "sum", column, []) + assert {row["filter_value"]: row["value"] for row in rows} == {"1": 2, "3": 3} + assert {row["filter_value"]: row["ratio"] for row in rows} == pytest.approx( + {"1": 0.4, "3": 0.6} + ) + + +@pytest.mark.parametrize("split_col, measure_col", [("value", "name"), ("ratio", "value")]) +def test_measure_names_and_zero_totals_do_not_replace_group_names( + split_col: str, measure_col: str +) -> None: + """Aggregating a reserved measure name must preserve labels even with zero totals.""" + analyzer = EDAAnalyzer(pl.DataFrame({split_col: ["a", "b"], measure_col: [0, 0]})) + rows = analyzer.get_decomposition_split(measure_col, "sum", split_col, []) + assert {row["filter_value"] for row in rows} == {"a", "b"} + assert all(row["ratio"] == 0 and row["value"] == 0 for row in rows) diff --git a/skyulf-core/tests/integration/test_tuning_class_axis.py b/skyulf-core/tests/integration/test_tuning_class_axis.py new file mode 100644 index 000000000..cc0b34cf3 --- /dev/null +++ b/skyulf-core/tests/integration/test_tuning_class_axis.py @@ -0,0 +1,69 @@ +"""Probability scorers retain the trained label axis across holdout subsets.""" + +import numpy as np +import pandas as pd +import pytest +from sklearn.linear_model import LogisticRegression + +from skyulf.modeling._tuning.engine import TuningCalculator +from skyulf.modeling._tuning.metrics import resolve_scorer +from skyulf.modeling._tuning.schemas import TuningConfig +from skyulf.modeling.classification import LogisticRegressionCalculator + + +@pytest.mark.parametrize("strategy", ["grid", "random", "halving_grid", "halving_random", "optuna"]) +@pytest.mark.parametrize("metric", ["pr_auc_weighted", "pr_auc"]) +def test_weighted_pr_tuning_accepts_holdout_missing_a_trained_class(strategy, metric): + """Every tuning path must score a three-column model against a two-class holdout.""" + if strategy == "optuna": + pytest.importorskip("optuna") + X = pd.DataFrame({"x": np.arange(60, dtype=float)}) + y = pd.Series(np.repeat(["a", "b", "c"], 20)) + config = TuningConfig( + strategy=strategy, + metric=metric, + search_space={"C": [1.0]}, + n_trials=1, + cv_folds=2, + ) + + model, result = TuningCalculator(LogisticRegressionCalculator()).fit( + X, y, config=config, validation_data=(X.iloc[:40], y.iloc[:40]) + ) + + assert model.classes_.tolist() == ["a", "b", "c"] + assert result.best_score == pytest.approx(1.0) + assert result.scoring_metric == "pr_auc_weighted" + assert len(result.trials) == 1 + assert result.trials[0]["score"] == pytest.approx(1.0) + + +@pytest.mark.parametrize("held_out_classes", [["a", "b"], ["a", "c"], ["b", "c"], ["b"]]) +def test_weighted_pr_scorer_aligns_missing_first_middle_last_classes(held_out_classes): + """Absent classes keep their probability columns and zero support in weighted AP.""" + X = pd.DataFrame({"x": np.arange(60, dtype=float)}) + y = pd.Series(np.repeat(["a", "b", "c"], 20)) + model = LogisticRegression().fit(X, y) + held_out = y.isin(held_out_classes) + scorer = resolve_scorer("pr_auc_weighted", y[held_out], "classification") + + score = scorer(model, X[held_out], y[held_out]) + + assert score == pytest.approx(1.0) + + +@pytest.mark.parametrize("labels", [[0, 1], [1, 2], ["no", "yes"]]) +@pytest.mark.parametrize("held_out_class", [None, 0, 1]) +def test_weighted_pr_binary_scorer_uses_trained_positive_class(labels, held_out_class): + """Binary probability columns must keep their meaning when the positive class is absent.""" + X = pd.DataFrame({"x": np.arange(40, dtype=float)}) + y = pd.Series(np.repeat(labels, 20)) + model = LogisticRegression().fit(X, y) + held_out = ( + np.ones(len(y), dtype=bool) if held_out_class is None else y == labels[held_out_class] + ) + scorer = resolve_scorer("pr_auc_weighted", y[held_out], "classification") + + score = scorer(model, X[held_out], y[held_out]) + + assert score == pytest.approx(0.0 if held_out_class == 0 else 1.0) diff --git a/skyulf-core/tests/unit/test_engine_wrapper_serialization.py b/skyulf-core/tests/unit/test_engine_wrapper_serialization.py new file mode 100644 index 000000000..082c5f134 --- /dev/null +++ b/skyulf-core/tests/unit/test_engine_wrapper_serialization.py @@ -0,0 +1,100 @@ +"""Regression coverage for dataframe wrapper restoration before its state exists.""" + +import copy +import pickle + +import pandas as pd +import polars as pl +import pytest +from polars.testing import assert_frame_equal as assert_polars_frame_equal + +from skyulf.core.serialization import JoblibModelSerializer +from skyulf.engines.registry import EngineRegistry + + +@pytest.fixture(params=["pandas", "polars"]) +def native_frame(request): + """Include nullable and typed values plus a non-default pandas index.""" + frame = pd.DataFrame( + { + "count": pd.array([1, None, 3], dtype="Int64"), + "label": pd.array(["first", None, "last"], dtype="string"), + "enabled": pd.array([True, None, False], dtype="boolean"), + "category": pd.Categorical(["low", None, "high"]), + "amount": [1.5, float("nan"), -2.5], + "observed": pd.to_datetime(["2026-01-01", "NaT", "2026-01-03"], utc=True), + }, + index=pd.Index([7, 2, 9], name="row_id"), + ) + if request.param == "polars": + return pl.from_pandas(frame, nan_to_null=False) + return frame + + +def assert_native_frame_equal(actual, expected): + """Check native schema, row order, nulls, values, and pandas index fidelity.""" + assert type(actual) is type(expected) + if isinstance(expected, pd.DataFrame): + pd.testing.assert_frame_equal(actual, expected, check_exact=True) + else: + assert_polars_frame_equal(actual, expected, check_exact=True) + + +@pytest.mark.parametrize("nested", [False, True], ids=["direct", "nested"]) +@pytest.mark.parametrize("protocol", [4, 5]) +def test_pickle_restores_wrapper_and_native_delegation(native_frame, nested, protocol): + """Pickle must restore usable wrappers, including inside model state containers.""" + wrapped = EngineRegistry.wrap(native_frame) + payload = {"frames": [(wrapped,)]} if nested else wrapped + + loaded = pickle.loads(pickle.dumps(payload, protocol=protocol)) + restored = loaded["frames"][0][0] if nested else loaded + + assert type(restored) is type(wrapped) + assert restored is not wrapped + assert_native_frame_equal(restored.to_native(), native_frame) + assert_native_frame_equal(restored.head(2), native_frame.head(2)) + assert restored.columns == list(native_frame.columns) + + +@pytest.mark.parametrize("nested", [False, True], ids=["direct", "nested"]) +def test_joblib_serializer_restores_wrapper(native_frame, nested, tmp_path): + """Core's serializer must load dataframe wrappers it successfully persisted.""" + wrapped = EngineRegistry.wrap(native_frame) + payload = {"frames": [(wrapped,)]} if nested else wrapped + serializer = JoblibModelSerializer() + path = tmp_path / "wrapper.joblib" + + serializer.dump(payload, path) + assert path.is_file() + loaded = serializer.load(path) + restored = loaded["frames"][0][0] if nested else loaded + + assert type(restored) is type(wrapped) + assert_native_frame_equal(restored.to_native(), native_frame) + assert_native_frame_equal(restored.head(2), native_frame.head(2)) + with pytest.raises(AttributeError): + _ = restored.missing_wrapper_attribute + + +@pytest.mark.parametrize("name", ["_df", "__setstate__", "head"]) +def test_uninitialized_wrapper_attribute_lookup_raises_attribute_error(native_frame, name): + """State probes during restoration must terminate normally before _df exists.""" + wrapper_type = type(EngineRegistry.wrap(native_frame)) + uninitialized = object.__new__(wrapper_type) + + with pytest.raises(AttributeError): + getattr(uninitialized, name) + assert not hasattr(uninitialized, name) + + +def test_shallow_copy_restores_wrapper(native_frame): + """The copy protocol must reconstruct a wrapper while sharing its native frame.""" + wrapped = EngineRegistry.wrap(native_frame) + + cloned = copy.copy(wrapped) + + assert type(cloned) is type(wrapped) + assert cloned is not wrapped + assert cloned.to_native() is native_frame + assert cloned.columns == list(native_frame.columns) diff --git a/skyulf-core/tests/unit/test_patch_coverage_core_round5.py b/skyulf-core/tests/unit/test_patch_coverage_core_round5.py index 2af626ae9..fc2f35810 100644 --- a/skyulf-core/tests/unit/test_patch_coverage_core_round5.py +++ b/skyulf-core/tests/unit/test_patch_coverage_core_round5.py @@ -22,6 +22,7 @@ from skyulf.modeling._tuning.schemas import TuningConfig, TuningResult from skyulf.profiling._analyzer.recommendations import RecommendationsMixin from skyulf.profiling.drift import DriftCalculator +from skyulf.profiling.schemas import ColumnProfile, NumericStats def _raiser(exc: Exception): @@ -127,11 +128,19 @@ def test_balanced_imbalanced_and_neutral_ratios(self): assert mixin._build_balance_recommendation("target", 0.5) == [] def test_skewness_threshold_both_directions(self): + """Transform advice must use real profile fields for both skewness branches.""" mixin = object.__new__(RecommendationsMixin) - skewed = SimpleNamespace(numeric_stats=SimpleNamespace(skewness=2.0)) - mild = SimpleNamespace(numeric_stats=SimpleNamespace(skewness=0.5)) + skewed = ColumnProfile( + name="col", + dtype="Numeric", + missing_count=0, + missing_percentage=0, + numeric_stats=NumericStats(skewness=2.0, min=1.0), + ) + mild = skewed.model_copy(update={"numeric_stats": NumericStats(skewness=0.5)}) - recs = mixin._skewness_recommendations("col", cast("Any", skewed)) + recs = mixin._skewness_recommendations("col", skewed) assert len(recs) == 1 + assert "Log or Box-Cox" in recs[0].suggestion - assert mixin._skewness_recommendations("col", cast("Any", mild)) == [] + assert mixin._skewness_recommendations("col", mild) == [] diff --git a/skyulf-core/tests/unit/test_pipeline_threshold_alignment.py b/skyulf-core/tests/unit/test_pipeline_threshold_alignment.py new file mode 100644 index 000000000..d6164e531 --- /dev/null +++ b/skyulf-core/tests/unit/test_pipeline_threshold_alignment.py @@ -0,0 +1,155 @@ +"""Threshold tuning must score labels from the same transformed validation rows.""" + +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest +from sklearn.metrics import accuracy_score + +from skyulf.pipeline import SkyulfPipeline + + +@pytest.fixture(params=["pandas", "polars"]) +def engine(request, monkeypatch): + """Select the engine explicitly so environment defaults cannot change a case.""" + monkeypatch.setenv("SKYULF_ENGINE", request.param) + return request.param + + +def _frame(engine: str, data: dict[str, list]) -> Any: + """Build raw input on the engine exercised by the current case.""" + return pl.DataFrame(data) if engine == "polars" else pd.DataFrame(data) + + +def _pipeline(engine: str, steps: list[dict[str, Any]]) -> SkyulfPipeline: + """Fit a weak linear classifier whose validation decisions expose misalignment.""" + pipeline = SkyulfPipeline( + { + "preprocessing": steps, + "modeling": {"type": "logistic_regression", "params": {"C": 0.001}}, + } + ) + pipeline.fit( + _frame( + engine, + {"time": list(range(20)), "value": list(range(20)), "target": [0] * 10 + [1] * 10}, + ), + target_column="target", + ) + return pipeline + + +def _rolling_step() -> dict[str, Any]: + """Use sorting with a finite rolling value on every validation row.""" + return { + "name": "rolling", + "transformer": "RollingAggregate", + "params": {"columns": ["value"], "window": 2, "min_periods": 1, "sort_by": "time"}, + } + + +@pytest.mark.parametrize("target_shape", ["series", "other_engine_series", "numpy", "list"]) +def test_threshold_tuning_aligns_labels_after_sorting(engine, target_shape): + """Reversing raw rows must not turn correct predictions into one constant class.""" + pipeline = _pipeline(engine, [_rolling_step()]) + X_val = _frame(engine, {"time": list(range(13, 5, -1)), "value": list(range(13, 5, -1))}) + labels = [1] * 4 + [0] * 4 + if target_shape == "series": + y_val = pl.Series("target", labels) if engine == "polars" else pd.Series(labels) + elif target_shape == "other_engine_series": + y_val = pd.Series(labels) if engine == "polars" else pl.Series("target", labels) + else: + y_val = np.asarray(labels) if target_shape == "numpy" else labels + if engine == "pandas": + # Pairing is positional even when caller indexes differ or repeat. + X_val.index = [4, 4, 2, 2, 9, 9, 1, 1] + if isinstance(y_val, pd.Series): + y_val.index = list(range(30, 38)) + + thresholds = pipeline.optimize_thresholds(X_val, y_val, metric=accuracy_score) + + assert thresholds == {0: 0.5, 1: 0.5} + np.testing.assert_array_equal( + pipeline.predict(X_val, use_tuned_thresholds=True), [0] * 4 + [1] * 4 + ) + + +@pytest.mark.parametrize("filter_kind", ["lag", "bounds"]) +def test_threshold_tuning_filters_labels_with_validation_rows(engine, filter_kind): + """Rows removed by preprocessing must also leave the labels scored by the metric.""" + if filter_kind == "lag": + steps = [ + { + "name": "lag", + "transformer": "LagFeatures", + "params": {"columns": ["value"], "lags": [1], "sort_by": "time", "drop_na": True}, + } + ] + expected = [0] * 3 + [1] * 4 + else: + steps = [ + _rolling_step(), + { + "name": "bounds", + "transformer": "ManualBounds", + "params": {"bounds": {"time": {"lower": 7, "upper": 12}}}, + }, + ] + expected = [0] * 3 + [1] * 3 + pipeline = _pipeline(engine, steps) + X_val = _frame(engine, {"time": list(range(13, 5, -1)), "value": list(range(13, 5, -1))}) + seen_labels = [] + + def metric(y_true, y_pred): + """Observe the real optimizer's labels while computing its accuracy.""" + seen_labels.append(np.asarray(y_true).tolist()) + return accuracy_score(y_true, y_pred) + + pipeline.optimize_thresholds(X_val, [1] * 4 + [0] * 4, metric=metric) + + assert seen_labels and all(labels == expected for labels in seen_labels) + np.testing.assert_array_equal(pipeline.predict(X_val, use_tuned_thresholds=True), expected) + + +def test_threshold_tuning_without_preprocessing_preserves_input_order(engine): + """An unchanged validation row set must keep the caller's label order.""" + pipeline = _pipeline(engine, []) + X_val = _frame(engine, {"time": list(range(13, 5, -1)), "value": list(range(13, 5, -1))}) + + thresholds = pipeline.optimize_thresholds(X_val, [1] * 4 + [0] * 4, metric=accuracy_score) + + assert thresholds == {0: 0.5, 1: 0.5} + np.testing.assert_array_equal( + pipeline.predict(X_val, use_tuned_thresholds=True), [1] * 4 + [0] * 4 + ) + + +@pytest.mark.parametrize("labels", [[1] * 4 + [0] * 3, [1] * 4 + [0] * 5]) +def test_threshold_tuning_rejects_mismatched_raw_lengths(engine, labels): + """Sorting must not hide extra labels or fail through accidental positional indexing.""" + pipeline = _pipeline(engine, [_rolling_step()]) + X_val = _frame(engine, {"time": list(range(13, 5, -1)), "value": list(range(13, 5, -1))}) + + with pytest.raises(ValueError, match="inconsistent numbers of samples|same number of rows"): + pipeline.optimize_thresholds(X_val, labels, metric=lambda y_true, y_pred: 1.0) + + assert pipeline._tuned_thresholds is None + + +def test_threshold_tuning_propagates_metric_failure_without_replacing_thresholds(engine): + """An unsuccessful search must leave previously usable decision thresholds intact.""" + pipeline = _pipeline(engine, [_rolling_step()]) + X_val = _frame(engine, {"time": list(range(13, 5, -1)), "value": list(range(13, 5, -1))}) + y_val = [1] * 4 + [0] * 4 + previous = pipeline.optimize_thresholds(X_val, y_val, metric=accuracy_score) + + def fail_metric(y_true, y_pred): + """Make the caller's scoring failure visible through the public API.""" + raise RuntimeError("scoring failed") + + with pytest.raises(RuntimeError, match="scoring failed"): + pipeline.optimize_thresholds(X_val, y_val, metric=fail_metric) + + assert pipeline._tuned_thresholds == previous diff --git a/tests/integration/test_eda_decomposition_missing.py b/tests/integration/test_eda_decomposition_missing.py index 53027b5d1..0d1d4c1ea 100644 --- a/tests/integration/test_eda_decomposition_missing.py +++ b/tests/integration/test_eda_decomposition_missing.py @@ -4,6 +4,7 @@ from unittest.mock import AsyncMock import polars as pl +import pytest from fastapi import FastAPI from fastapi.testclient import TestClient @@ -11,13 +12,16 @@ from backend.eda.router import router -def test_decomposition_http_drill_down_keeps_missing_rows_separate(monkeypatch) -> None: +@pytest.mark.parametrize("split_col", ["group", "value", "ratio"]) +def test_decomposition_http_drill_down_keeps_missing_rows_separate( + monkeypatch, split_col: str +) -> None: """Request validation and JSON serialization must retain null-valued bucket filters.""" frame = pl.DataFrame( { - "group": ["a", None, "Unknown", None], + split_col: ["a", None, "Unknown", None], "detail": ["normal", "missing_a", "literal", "missing_b"], - "value": [1, 2, 3, 4], + "amount": [1, 2, 3, 4], } ) monkeypatch.setattr( @@ -28,7 +32,7 @@ def test_decomposition_http_drill_down_keeps_missing_rows_separate(monkeypatch) app = FastAPI() app.include_router(router) app.dependency_overrides[get_db] = lambda: session - body = {"measure_col": "value", "measure_agg": "sum", "split_col": "group", "filters": []} + body = {"measure_col": "amount", "measure_agg": "sum", "split_col": split_col, "filters": []} with TestClient(app) as client: response = client.post("/eda/192/decomposition", json=body) @@ -50,7 +54,7 @@ def test_decomposition_http_drill_down_keeps_missing_rows_separate(monkeypatch) **body, "split_col": "detail", "filters": [ - {"column": "group", "operator": "==", "value": bucket["filter_value"]} + {"column": split_col, "operator": "==", "value": bucket["filter_value"]} ], }, ) From 61d6272693b974c15f3c1d9d3a1ebd199f803e38 Mon Sep 17 00:00:00 2001 From: flyingriverhorse Date: Sat, 12 Sep 2026 20:58:04 +0300 Subject: [PATCH 11/17] fix(core): repair fold alignment, tuning weights and preprocessing edges Resolve OC-46, OC-248, OC-250, OC-254 and OC-263 with regression coverage and updated audit records. Signed-off-by: flyingriverhorse --- .../_execution/engine/_feature_eng.py | 7 +- changelog/0.8.x.md | 13 ++ docs/guides/profiling_comparison.md | 6 + docs/reference/modeling_nodes.md | 10 + docs/reference/preprocessing_nodes.md | 11 ++ docs/user_guide/leakage_core_backend.md | 10 + .../analysis/opus_core_analysis-open_queue.md | 19 +- .../analysis/opus_core_analysis-tracker.md | 89 +++++++++ skyulf-core/skyulf/modeling/_class_weights.py | 42 +++++ skyulf-core/skyulf/modeling/_tuning/engine.py | 34 +++- .../skyulf/modeling/_tuning/fold_pipeline.py | 21 ++- .../skyulf/modeling/_tuning/grid_random.py | 8 +- skyulf-core/skyulf/modeling/_tuning/refit.py | 8 +- .../skyulf/modeling/sklearn_wrapper.py | 49 +---- .../skyulf/preprocessing/encoding/label.py | 18 +- .../skyulf/preprocessing/fold_adapter.py | 65 +++++-- .../skyulf/preprocessing/geo/distance.py | 3 + .../profiling/_analyzer/multivariate.py | 5 +- .../tests/integration/test_geo_nodes.py | 45 +++++ .../test_profiling_multivariate.py | 38 ++++ .../integration/test_tuning_class_weights.py | 177 ++++++++++++++++++ .../unit/test_fold_merged_row_contract.py | 132 +++++++++++++ ...l_target_containers_regression_20260912.py | 137 ++++++++++++++ .../test_leakage_graph_semantics.py | 45 +++++ 24 files changed, 896 insertions(+), 96 deletions(-) create mode 100644 skyulf-core/skyulf/modeling/_class_weights.py create mode 100644 skyulf-core/tests/integration/test_tuning_class_weights.py create mode 100644 skyulf-core/tests/unit/test_fold_merged_row_contract.py create mode 100644 skyulf-core/tests/unit/test_label_target_containers_regression_20260912.py diff --git a/backend/ml_pipeline/_execution/engine/_feature_eng.py b/backend/ml_pipeline/_execution/engine/_feature_eng.py index 52078c993..4bfce9c0b 100644 --- a/backend/ml_pipeline/_execution/engine/_feature_eng.py +++ b/backend/ml_pipeline/_execution/engine/_feature_eng.py @@ -18,9 +18,9 @@ from skyulf.modeling.base import extract_xy from skyulf.preprocessing.fold_adapter import ( SPLITTER_STEP_TYPES, - UNSAFE_BRANCH_STEP_TYPES, FeatureEngineerFoldAdapter, MergedBranchFoldAdapter, + merged_branch_step_unsafe_reason, ) from skyulf.preprocessing.pipeline import FeatureEngineer @@ -556,10 +556,11 @@ def _try_fork_join_refit( ) for step in branch_steps: transformer = step.get("transformer") - if transformer in UNSAFE_BRANCH_STEP_TYPES: + reason = merged_branch_step_unsafe_reason(step) + if reason is not None: return ( None, - (f"branch step '{transformer}' splits data or changes row counts"), + (f"branch step '{transformer}' {reason}"), "row_changing_branch_step", ) branch_lists.append(branch_steps) diff --git a/changelog/0.8.x.md b/changelog/0.8.x.md index cc8c0d8d3..2047c38e5 100644 --- a/changelog/0.8.x.md +++ b/changelog/0.8.x.md @@ -5,6 +5,19 @@ For the version index, see root [CHANGELOG.md](../CHANGELOG.md). --- ## v0.8.21 +- **Merged-fold row alignment (OC-248):** reject branch configurations that + sort or filter observations before a positional merge. Core and backend use + the same admission checks; runtime row-count checks guard branch outputs. +- **Tuned class weights (OC-250):** apply nonnative class weights during all + search strategies and final refitting using each fold's transformed training + labels. Retrain affected tuned models to apply previously ignored weights. +- **Constant-feature PCA (OC-46):** report PCA as unavailable when prepared + features have no variation, preventing NaN variance ratios in public JSON. +- **LabelEncoder target containers (OC-254):** apply target encoding to lists + and NumPy arrays on either engine, preserving native Series metadata and + leaving feature-only targets unchanged. +- **Antipodal distances (OC-263):** prevent floating-point roundoff from + producing NaN Haversine distances for valid opposite points on Earth. - **Threshold validation alignment (OC-249):** carry labels through the same sorting and filtering as validation features before choosing decision thresholds; reject mismatched raw row counts. Rerun threshold optimization diff --git a/docs/guides/profiling_comparison.md b/docs/guides/profiling_comparison.md index b6faf716b..e76a4f366 100644 --- a/docs/guides/profiling_comparison.md +++ b/docs/guides/profiling_comparison.md @@ -96,6 +96,12 @@ descriptive statistics. Its profile can include: - **PCA Projection:** Skyulf computes 2D/3D PCA projections colored by target class, helping you visually assess class separability before training a model. + If all prepared numeric features are constant, including after missing-value + imputation, PCA has no variance to explain. The profile returns + `pca_data=null` and `pca_components=null`, and the UI shows its existing + unavailable state. A varying feature alongside a constant feature still + produces PCA output. + - **Target Interactions with ANOVA (p-values):** For categorical targets, Skyulf can compute ANOVA p-values for numeric features (when SciPy is available) and rank associations accordingly. This helps you quickly find features that differ meaningfully across target classes. **3. Specialized Domain Analysis** diff --git a/docs/reference/modeling_nodes.md b/docs/reference/modeling_nodes.md index 9f68b2266..ebc414ab2 100644 --- a/docs/reference/modeling_nodes.md +++ b/docs/reference/modeling_nodes.md @@ -66,6 +66,16 @@ Binary evaluation omits the ROC curve and ROC AUC when the held-out partition contains only one trained class, since ROC requires both classes. Finite precision-recall output and the other available metrics remain in the report. +`class_weight` is applied consistently in direct training, every tuning +strategy and final refitting. Models such as GradientBoosting and XGBoost that +do not accept it natively receive equivalent per-row training weights. +`"balanced"` weights are computed from each fold's training labels after +preprocessing; validation labels do not influence them. Explicit weight +dictionaries use the labels passed to model fitting. Estimators that support +neither class weights nor sample weights reject an active weighting request. +Previously affected tuned models must be retrained to apply these weights; +existing saved models retain their predictions. + ### LightGBM row sampling The `lgbm_classifier` and `lgbm_regressor` nodes apply `subsample` during basic diff --git a/docs/reference/preprocessing_nodes.md b/docs/reference/preprocessing_nodes.md index 3832fc259..48bc7fe10 100644 --- a/docs/reference/preprocessing_nodes.md +++ b/docs/reference/preprocessing_nodes.md @@ -359,6 +359,13 @@ Learned params: - `encoders`: dict[col or "__target__" -> sklearn LabelEncoder] - `classes_count` +Targets may be lists, NumPy arrays or a Series from the feature dataframe's +engine. Encoded targets become native integer Series; existing Series names +and pandas indexes are preserved. For example, fitting on +`["yes", "no", "yes"]` produces `[1, 0, 1]`. Feature-only encoding leaves +the target container and values unchanged. Unknown target labels still use +the configured `missing_code`. + ### TargetEncoder Requires a target series (`y`). @@ -743,6 +750,10 @@ between two lat/lon coordinate pairs and appends it as a new numeric column. Pure math β€” no optional geospatial dependency required, and runs natively on both the pandas and polars engines. +Haversine calculations remain finite for valid antipodal points: opposite +points on Earth yield approximately `20015.114442 km`. Missing coordinates +remain missing rather than becoming a valid distance. + Config: - `lat1_col`: str diff --git a/docs/user_guide/leakage_core_backend.md b/docs/user_guide/leakage_core_backend.md index 5e5b5e9b1..da8b1c3c8 100644 --- a/docs/user_guide/leakage_core_backend.md +++ b/docs/user_guide/leakage_core_backend.md @@ -293,6 +293,16 @@ Requirements include: - Trunk preprocessing before the splitter is genuinely safe. - Branch column selection and merge order preserve the intended features. +The positional merge rejects `ManualBounds`, `LagFeatures(drop_na=True)` and +`LagFeatures`/`RollingAggregate` with a configured `sort_by`. These settings +can filter or reorder observations in one branch independently of the others. +Lag and rolling features with sorting and filtering disabled remain supported. +The same check runs in the Core merged-fold adapter and backend reconstruction +path; CV/tuning is blocked by default for an unsupported learned graph. +An explicit `on_leakage="warn"` or `"ignore"` retains the documented legacy +fallback and records `fold_refit_fallback="row_changing_branch_step"`. +Single-branch adapters retain their existing sorting/filtering behavior. + Overlapping columns can be replaced according to merge order. Prefer disjoint feature outputs where appropriate; topology support alone does not establish correct merge semantics. diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 1dd9fe3b6..4c88e1b31 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -27,10 +27,9 @@ detail lives in the archive's `## Log` section. ## Live β€” fix queue -**Current status (2026-09-12): 42 open / 4 parked.** OC-35/249/252/258/262 -are fixed; the latest Core review's OC-264–270 additions remain open. -OC-248/250 remain the next training priorities; OC-46 remains reopened. -Filing, reproduction and verification +**Current status (2026-09-12): 37 open / 4 parked.** OC-46/248/250/254/263 +are fixed in the latest batch. The Now and Next tiers have no open rows; +the remaining findings continue below by domain. Reproduction and verification details are in the [archive Log](opus_core_analysis-tracker.md#log). Ordered by the master report's suggested fix order: **Now** (silent wrongness @@ -38,24 +37,18 @@ reaching users), **Next** (wrong results in realistic configs), **Then** (decide deployment model), **Ongoing** (remove the hiding conditions). Remaining findings follow, grouped by domain. -The **Now** tier contains the newly reproduced training/threshold defects; -**Next** contains the remaining PCA payload path of OC-46. -The **Ongoing** tier has no open findings left; its completed rows are in the -archive. The earlier fixes remain recorded there and are not undone by reopening -these narrower cases. +The **Now**, **Next** and **Ongoing** tiers currently have no open findings; +their completed rows and verification history are retained in the archive. ### Now β€” silent wrongness reaching users | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-248 | 🟠 | Merged fold preprocessing joins different observations: `LagFeatures`/`RollingAggregate` can sort a branch, and `LagFeatures(drop_na=True)`/`ManualBounds` can filter it, but the merge resets indexes, combines columns positionally and takes the first branch's target (`preprocessing/fold_adapter.py:28-34,52-54,181`) | medium | ⬜ open β€” runtime reproduction leaves times `[3,1,2]` with targets `[100,200,300]`; filtering also produces 3 feature rows / 2 targets despite `changes_row_count=False`. | -| OC-250 | 🟠 | Tuning bypasses the calculator's nonnative `class_weight` to `sample_weight` conversion while reporting `class_weight="balanced"` in the selected parameters (`modeling/_tuning/grid_random.py:150-154`, `refit.py:77`, `params.py:60`) | medium | ⬜ open β€” GradientBoosting and XGBoost tuned probabilities exactly match unweighted fits; maximum differences from the corresponding balanced fits are `0.575548` and `0.631411`. | ### Next β€” wrong results in realistic configs | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-46 | 🟑 | Constant numeric features still publish non-finite PCA explained-variance ratios in the public profile (`profiling/_analyzer/multivariate.py:161`, `profiling/schemas.py:PCAComponent`) | small | ⬜ reopened 2026-09-12 β€” ten identical rows with two constant features produce `[NaN, NaN]`; `json.dumps(profile.model_dump(mode="json"), allow_nan=False)` raises ValueError. | ### Then β€” decide deployment model first @@ -103,7 +96,6 @@ these narrower cases. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| -| OC-254 | 🟑 | LabelEncoder fits supported NumPy/list targets but assumes native Series methods during apply (`preprocessing/encoding/label.py:69,113-115`) | small | ⬜ open β€” NumPy targets raise missing `.map` on pandas and missing `.clone` on Polars; lists fail on `.astype`/`.clone`, and Polars fails even for feature-only encoding. | | OC-267 | 🟑 | SMOTE+Tomek stores but ignores the configured `k_neighbors`, leaving its inner SMOTE at the default five neighbors (`preprocessing/resampling.py:221-222,292`) | small | ⬜ open β€” with two minority observations and `k_neighbors=1`, ordinary SMOTE and a correctly configured SMOTETomek balance both classes to five rows, while Core's combined sampler raises `n_neighbors=6 > n_samples_fit=2`. | ### Remaining β€” feature generation / selection / vectorization / transformations @@ -137,7 +129,6 @@ these narrower cases. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-255 | 🟑 | DateFeatures uses local offsets on pandas and UTC on Polars; mixed DST offsets make the pandas `.dt` access fail (`preprocessing/time_series/date_features.py:64-66,106-109`) | small | ⬜ open β€” identical `+02:00` strings produce different days/hours; mixed `+02:00`/`+03:00` strings raise AttributeError on pandas, so choose and enforce one timezone contract. | -| OC-263 | 🟑 | Haversine roundoff can put the intermediate outside `[0,1]`, producing NaN for valid antipodal coordinates on both engines (`preprocessing/geo/distance.py:53-54,108-109`) | small | ⬜ open β€” `(-89.91000888888888,0)` to `(89.91000888888888,180)` returns NaN instead of approximately `20015.114442 km`. | | OC-265 | 🟑 | Polars string-to-datetime casting uses a generic cast without parsing and silently replaces valid ISO dates with nulls under default coercion (`preprocessing/casting.py:221`) | small | ⬜ open β€” `2024-01-01` and `2024-06-15` become two nulls while the same Casting node on pandas preserves both dates; separate from DateFeatures timezone handling in OC-255. | | OC-266 | 🟑 | Polars categorical-to-boolean casting invokes string methods on categorical expressions; Enum inputs fall through to an unsupported generic cast (`preprocessing/casting.py:109,177-179,221`) | small | ⬜ open β€” categorical and Enum `true`/`false` inputs raise SchemaError and ComputeError respectively, while plain Polars strings and pandas categorical values convert successfully. | diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index e6c85e611..03f9639c3 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -90,6 +90,8 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-250 | 🟠 | Tuning bypasses the calculator's nonnative `class_weight` to `sample_weight` conversion while reporting `class_weight="balanced"` in the selected parameters (`modeling/_tuning/grid_random.py:150-154`, `refit.py:77`, `params.py:60`) | medium | βœ… fixed 2026-09-12 β€” share direct-fit weighting policy across all five tuning strategies and final refit, computing nonnative sample weights only from each fit's transformed training labels. | +| OC-248 | 🟠 | Merged fold preprocessing joins different observations: `LagFeatures`/`RollingAggregate` can sort a branch, and `LagFeatures(drop_na=True)`/`ManualBounds` can filter it, but the merge resets indexes, combines columns positionally and takes the first branch's target (`preprocessing/fold_adapter.py:28-34,52-54,181`) | medium | βœ… fixed 2026-09-12 β€” enforce the existing row-preserving positional merge contract for configured sorting/filtering in Core and backend, isolate validated configs and reject runtime row-count violations. | | OC-249 | 🟠 | Public threshold optimization transforms only `X_val`, leaving `y_val` in its original order when preprocessing sorts or filters rows (`pipeline/_pipeline.py:543-549`) | small | βœ… fixed 2026-09-12 β€” validate raw row counts and carry labels through fitted preprocessing sorting/filtering before threshold scoring; both engines and failure-state preservation are covered. | | OC-75 | πŸ”΄ | Dev polars 1.40.1 below declared floor β‰₯1.43.2 β€” 10 tests, every notebook, a benchmark broken; prerequisite for trusting any polars result | 1 line | βœ… done | | OC-12 | πŸ”΄ | Row-dropping desyncs `X` and `y` on non-unique pandas indexes (`drop_rows.py:60-67`, `deduplicate.py:44-47`); polars path already correct | small | βœ… fixed 2026-09-03 | @@ -100,6 +102,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-46 | 🟑 | Constant numeric features still publish non-finite PCA explained-variance ratios in the public profile (`profiling/_analyzer/multivariate.py:161`, `profiling/schemas.py:PCAComponent`) | small | βœ… fixed 2026-09-12 β€” return the existing unavailable PCA state for constant prepared features, keeping strict JSON finite while retaining PCA for varying inputs. | | OC-35 | 🟠 | Binary evaluation still builds a ROC curve when the held-out partition contains only one class, publishing NaN coordinates (`modeling/_evaluation/classification.py:88-94`) | small | βœ… fixed 2026-09-12 β€” omit undefined binary ROC curves for single-class holdouts while preserving finite PR output and the earlier multiclass guard. | | OC-207 | 🟠 | `optimize_thresholds()` transforms its `X_val` internally (`pipeline/_pipeline.py:325`), but `docs/user_guide/threshold_tuning.md:32`, `skyulf-core/README.md:205` and the method's own docstring (`:280`) all tell callers to feed it `get_fitted_split()` output β€” which is **already** preprocessed. The documented workflow therefore tunes thresholds on double-transformed probabilities, and `predict(use_tuned_thresholds=True)` then applies them to singly-transformed ones (`:365`), so the cutoffs are fitted against a distribution inference never reproduces. Needs a contract decision (fix the three docs, or accept pre-transformed input) before code | decision + small | βœ… fixed 2026-09-07 β€” the contract decision was "keep the code, fix the prose": `optimize_thresholds` and `predict` already both took raw input and transformed exactly once, so the three narrative sites that pointed callers at `get_fitted_split()` were the defect. See the log entry | | OC-177 | 🟠 | Pandas `DummyEncoder` changes a known category's encoding with batch composition: after fitting `[1.0,2.0]`, `1.0` encodes as known alone but all-zero when accompanied by `2.5` (`preprocessing/encoding/dummy.py:60-64`) | small | βœ… fixed 2026-09-06 β€” **broader than filed**: the two engines also learned different category *strings* from the same float data (`["1","2"]` vs `["1.0","2.0"]`), so they emitted differently named indicator columns; both symptoms were one batch-dependent renderer, replaced by a per-value rule shared by the engines. See the log entry | @@ -215,6 +218,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-254 | 🟑 | LabelEncoder fits supported NumPy/list targets but assumes native Series methods during apply (`preprocessing/encoding/label.py:69,113-115`) | small | βœ… fixed 2026-09-12 β€” normalize encoded list/NumPy targets with the fitted string-label policy, preserve native Series metadata and pass feature-only targets through unchanged. | | OC-18 | 🟑 | One-hot/dummy generated names can collide with existing columns (`encoding/one_hot.py`, `dummy.py`) | small | βœ… fixed 2026-09-12 β€” reject conflicting generated names in one-hot, dummy, missing-indicator and multiclass target encoding at fit/apply, while preserving legitimate reuse of dropped source names. | | OC-21 | 🟑 | WOE additive smoothing not normalized over categories (`encoding/woe.py`) | small | βœ… fixed 2026-09-11 β€” normalize class totals by all observed-category pseudocounts in full fits and training complements, correcting WOE/IV without rewriting saved mappings. | | OC-172 | 🟑 | `StandardScaler` crashes on mixed pandas nullable numeric columns containing `pd.NA`; native sklearn and equivalent Polars input succeed (`preprocessing/scaling/standard.py:144,154`, `engines/sklearn_bridge.py:52`) | small | βœ… fixed 2026-09-09 - nullable numeric missing sentinels become NumPy NaN without rounding observed integers; StandardScaler applies numeric arithmetic safely. | @@ -293,6 +297,7 @@ uses, so a fixed finding stays where it was filed. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| +| OC-263 | 🟑 | Haversine roundoff can put the intermediate outside `[0,1]`, producing NaN for valid antipodal coordinates on both engines (`preprocessing/geo/distance.py:53-54,108-109`) | small | βœ… fixed 2026-09-12 β€” clamp the Haversine intermediary to its valid range on both engines, preserving missingness and finite antipodal distances. | | OC-59 | 🟠 | DatasetProfile selects different numeric-column sets on pandas and Polars (`preprocessing/inspection.py`) | small | βœ… fixed 2026-09-12 β€” use shared dtype-based selection, include supported small/unsigned integers and binary/constant/empty numeric columns, and exclude temporal columns on both engines. | | OC-60 | 🟠 | GeneralBinning ignores missing_strategy=label on Polars (`preprocessing/bucketing.py`) | small | βœ… fixed 2026-09-12 β€” fill missing and out-of-range bins with the configured label; labeled Polars outputs use a stable String dtype and the default keep strategy is preserved. | | OC-176 | 🟑 | Polars `LagFeatures(drop_na=True)` removes nulls but retains float NaN in source/lag columns; equivalent pandas input drops those rows (`preprocessing/time_series/lag.py:54-59`) β€” independent of OC-165's y desynchronization | small | βœ… fixed 2026-09-09 - Polars lag filtering removes both null and floating NaN rows with one positional selection shared by X and y. | @@ -418,6 +423,90 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-46/248/250/254/263: merged folds, class weights and numeric/container edge cases + +At the user's request, verified concrete outputs from the previous five-fix +batch again (**97 regressions passed**) and committed it with DCO sign-off as +`d470b871`; all commit hooks passed. Continued with five more findings using +three implementation agents and root-owned merged-fold work, then independent +cross-reviews. The user reviewed these fixes and requested a signed commit. + +- **OC-248:** re-executed the merged LagFeatures/StandardScaler example and + observed times `[3,1,2]` paired with targets `[100,200,300]` instead of + `[300,100,200]`. The adapter's existing contract rejects branches that cannot + preserve positional observations; its static list missed configured sorting, + LagFeatures `drop_na=True` and ManualBounds filtering. A shared configured + admission check now rejects these cases in Core and backend reconstruction. + Safe unsorted/unfiltered lag and rolling branches remain usable. Validated + configs are copied in full so caller edits cannot introduce unsafe sorting; + runtime row-count checks reject malformed inputs/branch outputs before + publishing a merge or replacing the last successful fitted state. Single + branch adapters still allow sorting/filtering and now flag conditional row + changes accurately. **21 Core cases and all 12 real backend graph cases + failed before repair**; five existing-behavior controls passed. Final Core + coverage includes four further branch-output/state regressions, for **30 + cases**, and all 12 backend cases pass on both engines. Default learned-graph + scoring fails explicitly; existing `on_leakage='warn'/'ignore'` legacy + fallback retains its diagnostic code. This enforces the existing merged-fold + scope; it does not add row-identity joins or change global merge semantics. +- **OC-250:** direct fits already converted nonnative class weights into + sample weights, but tuning trials and final refits bypassed that policy. + The shared policy now covers grid, random, both halving variants and Optuna, + computing weights only from the current fit's post-preprocessing training + labels. Native class weights remain on their estimator; the serving artifact + remains the native fitted model. **25 tests failed and five native controls + passed before repair**; all **65 new cases** pass, including resampling, + holdout isolation, dictionaries, None sentinels, defaults and unsupported + estimators. Tuned probabilities match direct balanced training exactly: + maximum difference **0.0** for GradientBoosting and XGBoost. Differences from + current unweighted controls are **0.5755483623828201** and **0.66135305**; + the older audit's XGBoost number used earlier defaults. XGBoost still streams + ten final-refit callbacks and detaches them afterward. Independent LightGBM + and calibrated-classifier controls across all five strategies also match + direct fits exactly, retain native estimator types and unprefixed parameters. + No explicit sample-weight API was added. Existing models need retraining to + apply weights previously ignored during tuning. +- **OC-46:** constant numeric features, including constants after imputation, + published `[NaN, NaN]` PCA ratios and failed strict stdlib JSON serialization. + The prepared-matrix variance guard now returns the existing unavailable + contract, `pca_data=None` and `pca_components=None`. The current PCA tab + already handles that state; no schema or frontend change is needed. A varying + feature alongside a constant companion still returns ratios `[1.0, 0.0]`. + **Two public analyzer/strict-JSON cases failed before repair**, then passed + alongside the varying-input control and existing multivariate tests. +- **OC-254:** LabelEncoder accepted list/NumPy targets at fit but applied + pandas `.map` or Polars `.clone` methods to those containers. Reuse the + existing fitted string-label conversion and return native integer Series + only when encoding the target. `['yes','no','yes']` becomes `[1,0,1]` on both + engines; native names and pandas indexes survive. Feature-only targets pass + through unchanged, and missing/unknown semantics plus the mixed-native-engine + guard remain intact. **14 cases failed and ten controls passed before repair**; + all **30 final regressions** pass. Independent nullable/datetime/categorical + target and metadata controls found no remaining issue. +- **OC-263:** the valid antipodal pair from the audit produced Haversine + intermediary `1.0000000000000002`, causing `sqrt(1-a)` to return NaN. + Clamp that intermediary to `[0,1]` in both native engines. The reproduced + distance is now **20015.114442035923 km / 12436.8155228673 mi**. **Four cases + failed before repair and pass afterward**, covering both units and engines; + reverse antipodes, quarter-circumference, zero distance, missing inputs and + source immutability are checked within those cases. + +Final validation: full Core pytest passed **8,104 tests / 80 skips**, with +**three snapshots passing** and 499 dependency/degenerate-data/legacy warnings. +Separate backend fold-refit, execution replay and submission/leakage suites +passed **894 tests** (121 warnings). Focused selections passed 267 modeling/ +tuning tests, 637 encoding/dispatcher/pipeline tests and 179 profiling/geo tests +(nine optional H3 skips); these selections overlap and are not additive totals. +Full-repository Ruff, configured backend/Core ty, formatting of the 17 changed +Python files, strict MkDocs and diff whitespace checks passed. No model +downloads were needed; offline Hugging Face flags were set for the Core suite. +Independent reviews found no remaining blocking issue. User docs, method +docstrings, changelog and both audit files record the resulting behavior. + +The queue decreases from **42 to 37 open**, with **four parked** findings +unchanged (OC-71/72/73/185). The Now and Next tiers are empty again; all seven +OC-264–270 additions remain open. No push was requested or performed. + ### 2026-09-12 β€” OC-35/249/252/258/262: validation alignment, metrics, grouping and restoration Committed the preceding OC-90/187/192 batch as DCO-signed `f479e196` after diff --git a/skyulf-core/skyulf/modeling/_class_weights.py b/skyulf-core/skyulf/modeling/_class_weights.py new file mode 100644 index 000000000..c9371a77f --- /dev/null +++ b/skyulf-core/skyulf/modeling/_class_weights.py @@ -0,0 +1,42 @@ +"""Shared class-weight policy for direct fits and tuning folds.""" + +import inspect +from typing import Any + +from sklearn.utils.class_weight import compute_sample_weight + + +def constructor_accepts_class_weight(model_class: Any) -> bool: + """Require a named parameter; arbitrary kwargs can silently ignore weighting.""" + return "class_weight" in inspect.signature(model_class).parameters + + +def split_class_weight_params( + model_class: Any, params: dict[str, Any] +) -> tuple[dict[str, Any], Any]: + """Keep native class weights in constructor params and extract fit-time weights. + + UI no-weight strings normalize to ``None``. Estimators such as XGBoost + accept arbitrary kwargs but ignore class weights, so only an explicitly + named constructor parameter counts as native support. + """ + constructor_params = params.copy() + if constructor_params.get("class_weight") in ("None", "none", ""): + constructor_params["class_weight"] = None + class_weight = None + if "class_weight" in constructor_params and not constructor_accepts_class_weight(model_class): + class_weight = constructor_params.pop("class_weight") + return constructor_params, class_weight + + +def sample_weight_for_fit(model: Any, class_weight: Any, y: Any) -> Any: + """Compute weights from this fit's labels, rejecting unsupported estimators.""" + if class_weight in (None, "None", "none", ""): + return None + if "sample_weight" not in inspect.signature(model.fit).parameters: + raise ValueError( + f"{type(model).__name__} does not support 'class_weight' natively " + "and its fit() method does not accept 'sample_weight' either, so " + "class weighting cannot be applied to this model." + ) + return compute_sample_weight(class_weight, y) diff --git a/skyulf-core/skyulf/modeling/_tuning/engine.py b/skyulf-core/skyulf/modeling/_tuning/engine.py index 259df05b7..6d849bf8e 100644 --- a/skyulf-core/skyulf/modeling/_tuning/engine.py +++ b/skyulf-core/skyulf/modeling/_tuning/engine.py @@ -25,6 +25,7 @@ from ..._validation import raise_invalid_choice from ...engines import SkyulfDataFrame from ...engines.sklearn_bridge import SklearnBridge +from .._class_weights import constructor_accepts_class_weight, split_class_weight_params from .._evaluation.thresholds import apply_thresholds from ..base import BaseModelApplier, BaseModelCalculator from ..cross_validation import _sort_by_time @@ -542,9 +543,10 @@ def tune( # ``default_params`` may carry structural args (e.g. an ensemble's # resolved ``estimators``); the instantiator filters/routes them safely. - base_estimator = instantiate_model( + constructor_params, class_weight = split_class_weight_params( model_class, {**self.model_calculator.default_params, **seed_params(config)} ) + base_estimator = instantiate_model(model_class, constructor_params) # halving/optuna searchers run their CV internally, where the engine's # per-fold hook cannot reach; wrap preprocessing + model in one @@ -553,6 +555,16 @@ def tune( # fold's training rows, so chains that resample rows or re-encode # the target are safe here too. searcher_strategy = config.strategy in ("halving_grid", "halving_random", "optuna") + # Nonnative class weights also need a fit-time step, even without + # preprocessing: each clone must derive weights from its train fold. + weighted = ( + searcher_strategy + and not constructor_accepts_class_weight(model_class) + and ( + "class_weight" in self.model_calculator.default_params + or "class_weight" in config.search_space + ) + ) wrapped = preprocessing is not None and searcher_strategy if wrapped and preprocessing_frames is None: # Numpy-only SDK call: the preprocessor needs named frames to @@ -580,8 +592,8 @@ def tune( ) estimator: Any = base_estimator search_config = config - if wrapped and preprocessing_frames is not None: - frame_x = preprocessing_frames[0] + if wrapped or weighted: + frame_x = preprocessing_frames[0] if preprocessing_frames is not None else None feature_names = ( tuple(map(str, frame_x.columns)) if hasattr(frame_x, "columns") else None ) @@ -591,22 +603,28 @@ def tune( "model", FoldAwareModelStep( estimator=base_estimator, - preprocessor=preprocessing, + preprocessor=preprocessing if wrapped else None, feature_names=feature_names, + class_weight=class_weight, ), ) ] ) - if log_callback: + if wrapped and log_callback: log_callback( "Per-fold preprocessing refit runs inside the searcher via " "the fold-aware estimator." ) - # Search-space keys must route through the pipeline to the base estimator. + # Nonnative weights belong to the fit-time step; constructor + # parameters still route to the underlying estimator. search_config = replace( config, search_space={ - f"model__estimator__{key}": values + ( + "model__class_weight" + if weighted and key == "class_weight" + else f"model__estimator__{key}" + ): values for key, values in (config.search_space or {}).items() }, ) @@ -700,7 +718,7 @@ def tune( # Collect trials trials = _runner.collect_trials(searcher, config) - if wrapped: + if wrapped or weighted: best_params = _runner.strip_model_prefix(best_params) trials = [ {**trial, "params": _runner.strip_model_prefix(trial["params"])} for trial in trials diff --git a/skyulf-core/skyulf/modeling/_tuning/fold_pipeline.py b/skyulf-core/skyulf/modeling/_tuning/fold_pipeline.py index f2346bc92..a8a012dd7 100644 --- a/skyulf-core/skyulf/modeling/_tuning/fold_pipeline.py +++ b/skyulf-core/skyulf/modeling/_tuning/fold_pipeline.py @@ -25,6 +25,8 @@ from sklearn.base import BaseEstimator, is_classifier from sklearn.utils.metaestimators import available_if +from .._class_weights import sample_weight_for_fit + def _fitted_model_has(attr: str) -> Callable[[Any], bool]: """Build the ``available_if`` predicate for one response method of the wrapped model. @@ -55,6 +57,11 @@ class FoldAwareModelStep(BaseEstimator): integers), predictions and ``classes_`` are mapped back to the original label space so scorers compare against the untouched ``y`` the searcher holds; ``predict_proba`` columns stay aligned with ``classes_``. + + ``class_weight`` carries nonnative weighting separately from estimator + parameters. It is converted after preprocessing, using only the labels + passed to this fold's fit. The preprocessor may be absent when only + class-weight conversion is needed. """ def __init__( @@ -62,6 +69,7 @@ def __init__( estimator: Any = None, preprocessor: Any = None, feature_names: tuple[str, ...] | None = None, + class_weight: Any = None, ) -> None: """Store the wrap targets verbatim; nothing is copied or fitted here. @@ -70,10 +78,12 @@ def __init__( deferred to ``fit`` so every searcher clone gets its own fitted state. ``feature_names`` records the column contract used to rebuild named frames when the searcher hands back plain arrays. + ``class_weight`` is kept cloneable and evaluated only inside fit. """ self.estimator = estimator self.preprocessor = preprocessor self.feature_names = feature_names + self.class_weight = class_weight def _ensure_frames(self, X: Any, y: Any) -> tuple[Any, Any]: """Rebuild named pandas frames when slicing hands non-pandas input. @@ -155,17 +165,22 @@ def fit(self, X: Any, y: Any = None) -> "FoldAwareModelStep": chains leakage-free inside the searcher's own CV. A label map is built when the chain re-encoded ``y``, for ``predict`` to invert. """ - X, y = self._ensure_frames(X, y) + if self.preprocessor is not None: + X, y = self._ensure_frames(X, y) worker = copy.deepcopy(self.preprocessor) model = copy.deepcopy(self.estimator) - X_t, y_t = worker.fit_transform(X, y) - model.fit(X_t, y_t) + X_t, y_t = worker.fit_transform(X, y) if worker is not None else (X, y) + sample_weight = sample_weight_for_fit(model, self.class_weight, y_t) + fit_kwargs = {"sample_weight": sample_weight} if sample_weight is not None else {} + model.fit(X_t, y_t, **fit_kwargs) self.preprocessor_ = worker self.model_ = model self.label_map_ = self._build_label_map(y, y_t, model) return self def _transform_x(self, X: Any) -> Any: + if self.preprocessor_ is None: + return X X, _y = self._ensure_frames(X, None) X_t, _y_t = self.preprocessor_.transform(X, None) return X_t diff --git a/skyulf-core/skyulf/modeling/_tuning/grid_random.py b/skyulf-core/skyulf/modeling/_tuning/grid_random.py index 98b51e454..60a8b03fc 100644 --- a/skyulf-core/skyulf/modeling/_tuning/grid_random.py +++ b/skyulf-core/skyulf/modeling/_tuning/grid_random.py @@ -13,6 +13,7 @@ import numpy as np from sklearn.model_selection import ParameterGrid, ParameterSampler +from .._class_weights import sample_weight_for_fit, split_class_weight_params from ..base import BaseModelCalculator from .metrics import resolve_scorer from .params import clean_search_space, instantiate_model, seed_params @@ -143,11 +144,14 @@ def fit_and_score_candidate_fold( X_train_fold, y_train_fold = preprocessing.fit_transform(X_train_fold, y_train_fold) X_val_fold, y_val_fold = preprocessing.transform(X_val_fold, y_val_fold) - model = instantiate_model( + constructor_params, class_weight = split_class_weight_params( model_class, {**model_calculator.default_params, **(seed_params_overlay or {}), **params}, ) - model.fit(X_train_fold, y_train_fold) + model = instantiate_model(model_class, constructor_params) + sample_weight = sample_weight_for_fit(model, class_weight, y_train_fold) + fit_kwargs = {"sample_weight": sample_weight} if sample_weight is not None else {} + model.fit(X_train_fold, y_train_fold, **fit_kwargs) # Score β€” resolved against the fold's (post-transform) labels so # binary scorers get a valid pos_label even for string targets. diff --git a/skyulf-core/skyulf/modeling/_tuning/refit.py b/skyulf-core/skyulf/modeling/_tuning/refit.py index 189252a17..cfd208436 100644 --- a/skyulf-core/skyulf/modeling/_tuning/refit.py +++ b/skyulf-core/skyulf/modeling/_tuning/refit.py @@ -22,6 +22,7 @@ ) from ...engines.sklearn_bridge import SklearnBridge +from .._class_weights import sample_weight_for_fit, split_class_weight_params from .._evaluation.thresholds import optimize_thresholds from ..base import BaseModelCalculator from .params import instantiate_model @@ -61,7 +62,10 @@ def refit_best_model( # to the signature (when there is no **kwargs) and routes nested # ``a__b`` keys β€” e.g. an ensemble's tuned base-model params β€” through # ``set_params`` so they are not silently dropped. - model = instantiate_model(model_cls, final_params) + constructor_params, class_weight = split_class_weight_params(model_cls, final_params) + model = instantiate_model(model_cls, constructor_params) + sample_weight = sample_weight_for_fit(model, class_weight, y_np) + weight_kwargs = {"sample_weight": sample_weight} if sample_weight is not None else {} # Boosting base calculators (XGBoost/LightGBM) attach an eval set + # iteration callback here so the final refit streams per-round # progress like any other boosting fit; every other model keeps a @@ -74,7 +78,7 @@ def refit_best_model( with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") warnings.filterwarnings("ignore", message=".*valid feature names.*") - model.fit(X_np, y_np, **extra_fit_kwargs) + model.fit(X_np, y_np, **weight_kwargs, **extra_fit_kwargs) if detach_callbacks: model.callbacks = None for w in caught: diff --git a/skyulf-core/skyulf/modeling/sklearn_wrapper.py b/skyulf-core/skyulf/modeling/sklearn_wrapper.py index 460be5490..12cfa0c14 100644 --- a/skyulf-core/skyulf/modeling/sklearn_wrapper.py +++ b/skyulf-core/skyulf/modeling/sklearn_wrapper.py @@ -8,11 +8,14 @@ import pandas as pd from sklearn.base import BaseEstimator from sklearn.exceptions import ConvergenceWarning -from sklearn.utils.class_weight import compute_sample_weight from ..engines import SkyulfDataFrame from ..engines.sklearn_bridge import SklearnBridge from ..types import DEFAULT_RANDOM_STATE +from ._class_weights import ( + sample_weight_for_fit, + split_class_weight_params, +) from .base import BaseModelApplier, BaseModelCalculator logger = logging.getLogger(__name__) @@ -61,27 +64,9 @@ def fit( # 1. Merge Config with Defaults params = self._resolve_fit_params(config) - # A generic ",r=document.createElement("div");return r.innerHTML=s,r.firstChild},_addItem:function(e){var t=document.createElement("label"),s=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=s):r=this._createRadioElement("leaflet-base-layers_"+g(this),s),this._layerControlInputs.push(r),r.layerId=g(e.layer),$(r,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+e.name;var c=document.createElement("span");t.appendChild(c),c.appendChild(r),c.appendChild(o);var f=e.overlay?this._overlaysList:this._baseLayersList;return f.appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,s,r=[],o=[];this._handlingClick=!0;for(var c=e.length-1;c>=0;c--)t=e[c],s=this._getLayer(t.layerId).layer,t.checked?r.push(s):t.checked||o.push(s);for(c=0;c=0;o--)t=e[o],s=this._getLayer(t.layerId).layer,t.disabled=s.options.minZoom!==void 0&&rs.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,$(e,"click",xe),this.expand();var t=this;setTimeout(function(){ae(e,"click",xe),t._preventClick=!1})}}),_a=function(e,t,s){return new nn(e,t,s)},Ui=Se.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",s=X("div",t+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+"-in",s,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+"-out",s,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),s},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,s,r,o){var c=X("a",s,r);return c.innerHTML=e,c.href="#",c.title=t,c.setAttribute("role","button"),c.setAttribute("aria-label",t),Mt(c),$(c,"click",it),$(c,"click",o,this),$(c,"click",this._refocusOnMap,this),c},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";he(this._zoomInButton,t),he(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(W(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(W(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});Y.mergeOptions({zoomControl:!0}),Y.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ui,this.addControl(this.zoomControl))});var ya=function(e){return new Ui(e)},rn=Se.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",s=X("div",t),r=this.options;return this._addScales(r,t+"-line",s),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),s},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,s){e.metric&&(this._mScale=X("div",t,s)),e.imperial&&(this._iScale=X("div",t,s))},_update:function(){var e=this._map,t=e.getSize().y/2,s=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(s)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),s=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,s,t/e)},_updateImperial:function(e){var t=e*3.2808399,s,r,o;t>5280?(s=t/5280,r=this._getRoundNum(s),this._updateScale(this._iScale,r+" mi",r/s)):(o=this._getRoundNum(t),this._updateScale(this._iScale,o+" ft",o/t))},_updateScale:function(e,t,s){e.style.width=Math.round(this.options.maxWidth*s)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),s=e/t;return s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:1,t*s}}),va=function(e){return new rn(e)},ba='',Ki=Se.extend({options:{position:"bottomright",prefix:''+(R.inlineSvg?ba+" ":"")+"Leaflet"},initialize:function(e){j(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=X("div","leaflet-control-attribution"),Mt(this._container);for(var t in e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var s=[];this.options.prefix&&s.push(this.options.prefix),e.length&&s.push(e.join(", ")),this._container.innerHTML=s.join(' ')}}});Y.mergeOptions({attributionControl:!0}),Y.addInitHook(function(){this.options.attributionControl&&new Ki().addTo(this)});var wa=function(e){return new Ki(e)};Se.Layers=nn,Se.Zoom=Ui,Se.Scale=rn,Se.Attribution=Ki,At.layers=_a,At.zoom=ya,At.scale=va,At.attribution=wa;var Ie=Z.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ie.addTo=function(e,t){return e.addHandler(t,this),this};var ja={Events:Q},an=R.touch?"touchstart mousedown":"mousedown",Ke=ge.extend({options:{clickTolerance:3},initialize:function(e,t,s,r){j(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=s},enable:function(){this._enabled||($(this._dragStartTarget,an,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ke._dragging===this&&this.finishDrag(!0),ae(this._dragStartTarget,an,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!zi(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){Ke._dragging===this&&this.finishDrag();return}if(!(Ke._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Ke._dragging=this,this._preventOutline&&Bi(this._element),Di(),St(),!this._moving)){this.fire("down");var t=e.touches?e.touches[0]:e,s=Xs(this._element);this._startPoint=new O(t.clientX,t.clientY),this._startPos=et(this._element),this._parentScale=Zi(s);var r=e.type==="mousedown";$(document,r?"mousemove":"touchmove",this._onMove,this),$(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,s=new O(t.clientX,t.clientY)._subtract(this._startPoint);!s.x&&!s.y||Math.abs(s.x)+Math.abs(s.y)c&&(f=_,c=v);c>s&&(t[f]=1,Yi(e,t,s,r,f),Yi(e,t,s,f,o))}function La(e,t){for(var s=[e[0]],r=1,o=0,c=e.length;rt&&(s.push(e[r]),o=r);return ot.max.x&&(s|=2),e.yt.max.y&&(s|=8),s}function Pa(e,t){var s=t.x-e.x,r=t.y-e.y;return s*s+r*r}function zt(e,t,s,r){var o=t.x,c=t.y,f=s.x-o,_=s.y-c,v=f*f+_*_,C;return v>0&&(C=((e.x-o)*f+(e.y-c)*_)/v,C>1?(o=s.x,c=s.y):C>0&&(o+=f*C,c+=_*C)),f=e.x-o,_=e.y-c,r?f*f+_*_:new O(o,c)}function Ce(e){return!G(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function mn(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ce(e)}function fn(e,t){var s,r,o,c,f,_,v,C;if(!e||e.length===0)throw new Error("latlngs not passed");Ce(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var T=K([0,0]),F=se(e),U=F.getNorthWest().distanceTo(F.getSouthWest())*F.getNorthEast().distanceTo(F.getNorthWest());U<1700&&(T=Gi(e));var ve=e.length,pe=[];for(s=0;sr){v=(c-r)/o,C=[_.x-v*(_.x-f.x),_.y-v*(_.y-f.y)];break}var je=t.unproject(z(C));return K([je.lat+T.lat,je.lng+T.lng])}var Sa={__proto__:null,simplify:dn,pointToSegmentDistance:cn,closestPointOnSegment:Na,clipSegment:un,_getEdgeIntersection:ri,_getBitCode:st,_sqClosestPointOnSegment:zt,isFlat:Ce,_flat:mn,polylineCenter:fn},Xi={project:function(e){return new O(e.lng,e.lat)},unproject:function(e){return new J(e.y,e.x)},bounds:new q([-180,-90],[180,90])},Qi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var t=Math.PI/180,s=this.R,r=e.lat*t,o=this.R_MINOR/s,c=Math.sqrt(1-o*o),f=c*Math.sin(r),_=Math.tan(Math.PI/4-r/2)/Math.pow((1-f)/(1+f),c/2);return r=-s*Math.log(Math.max(_,1e-10)),new O(e.lng*t*s,r)},unproject:function(e){for(var t=180/Math.PI,s=this.R,r=this.R_MINOR/s,o=Math.sqrt(1-r*r),c=Math.exp(-e.y/s),f=Math.PI/2-2*Math.atan(c),_=0,v=.1,C;_<15&&Math.abs(v)>1e-7;_++)C=o*Math.sin(f),C=Math.pow((1-C)/(1+C),o/2),v=Math.PI/2-2*Math.atan(c*C)-f,f+=v;return new J(f*t,e.x*t/s)}},Ta={__proto__:null,LonLat:Xi,Mercator:Qi,SphericalMercator:kt},Ea=h({},Me,{code:"EPSG:3395",projection:Qi,transformation:(function(){var e=.5/(Math.PI*Qi.R);return E(e,.5,-e,.5)})()}),gn=h({},Me,{code:"EPSG:4326",projection:Xi,transformation:E(1/180,1,-1/180,.5)}),Ma=h({},Pe,{projection:Xi,transformation:E(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var s=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(s*s+r*r)},infinite:!0});Pe.Earth=Me,Pe.EPSG3395=Ea,Pe.EPSG3857=ye,Pe.EPSG900913=Ue,Pe.EPSG4326=gn,Pe.Simple=Ma;var Te=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[g(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[g(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var s=this.getEvents();t.on(s,this),this.once("remove",function(){t.off(s,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});Y.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=g(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=g(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return g(e)in this._layers},eachLayer:function(e,t){for(var s in this._layers)e.call(t,this._layers[s]);return this},_addLayers:function(e){e=e?G(e)?e:[e]:[];for(var t=0,s=e.length;tthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&t[0]instanceof J&&t[0].equals(t[s-1])&&t.pop(),t},_setLatLngs:function(e){Be.prototype._setLatLngs.call(this,e),Ce(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ce(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,s=new O(t,t);if(e=new q(e.min.subtract(s),e.max.add(s)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,o=this._rings.length,c;re.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(t=!t);return t||Be.prototype._containsPoint.call(this,e,!0)}});function Ba(e,t){return new ut(e,t)}var Ze=Fe.extend({initialize:function(e,t){j(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=G(e)?e:e.features,s,r,o;if(t){for(s=0,r=t.length;s0&&o.push(o[0].slice()),o}function mt(e,t){return e.feature?h({},e.feature,{geometry:t}):hi(t)}function hi(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var is={toGeoJSON:function(e){return mt(this,{type:"Point",coordinates:ts(this.getLatLng(),e)})}};ai.include(is),Ji.include(is),oi.include(is),Be.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=ci(this._latlngs,t?1:0,!1,e);return mt(this,{type:(t?"Multi":"")+"LineString",coordinates:s})}}),ut.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=t&&!Ce(this._latlngs[0]),r=ci(this._latlngs,s?2:t?1:0,!0,e);return t||(r=[r]),mt(this,{type:(s?"Multi":"")+"Polygon",coordinates:r})}}),ct.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(s){t.push(s.toGeoJSON(e).geometry.coordinates)}),mt(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t==="MultiPoint")return this.toMultiPoint(e);var s=t==="GeometryCollection",r=[];return this.eachLayer(function(o){if(o.toGeoJSON){var c=o.toGeoJSON(e);if(s)r.push(c.geometry);else{var f=hi(c);f.type==="FeatureCollection"?r.push.apply(r,f.features):r.push(f)}}}),s?mt(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function _n(e,t){return new Ze(e,t)}var Za=_n,ui=Te.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,s){this._url=e,this._bounds=se(t),j(this,s)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(W(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){de(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&<(this._image),this},bringToBack:function(){return this._map&&dt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=se(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",t=this._image=e?this._url:X("img");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onload=m(this.fire,this,"load"),t.onerror=m(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(t.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),s=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Je(this._image,s,t)},_reset:function(){var e=this._image,t=new q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),s=t.getSize();ue(e,t.min),e.style.width=s.x+"px",e.style.height=s.y+"px"},_updateOpacity:function(){Ne(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),$a=function(e,t,s){return new ui(e,t,s)},yn=ui.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",t=this._image=e?this._url:X("video");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onloadeddata=m(this.fire,this,"load"),e){for(var s=t.getElementsByTagName("source"),r=[],o=0;o0?r:[t.src];return}G(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var c=0;co?(t.height=o+"px",W(e,c)):he(e,c),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),s=this._getAnchor();ue(this._container,t.add(s))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(Pt(this._container,"marginBottom"),10)||0,s=this._container.offsetHeight+t,r=this._containerWidth,o=new O(this._containerLeft,-s-this._containerBottom);o._add(et(this._container));var c=e.layerPointToContainerPoint(o),f=z(this.options.autoPanPadding),_=z(this.options.autoPanPaddingTopLeft||f),v=z(this.options.autoPanPaddingBottomRight||f),C=e.getSize(),T=0,F=0;c.x+r+v.x>C.x&&(T=c.x+r-C.x+v.x),c.x-T-_.x<0&&(T=c.x-_.x),c.y+s+v.y>C.y&&(F=c.y+s-C.y+v.y),c.y-F-_.y<0&&(F=c.y-_.y),(T||F)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([T,F]))}},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Va=function(e,t){return new mi(e,t)};Y.mergeOptions({closePopupOnClick:!0}),Y.include({openPopup:function(e,t,s){return this._initOverlay(mi,e,t,s).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Te.include({bindPopup:function(e,t){return this._popup=this._initOverlay(mi,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Fe||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){it(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof Ge)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var fi=Oe.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Oe.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Oe.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Oe.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",t=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=X("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,s,r=this._map,o=this._container,c=r.latLngToContainerPoint(r.getCenter()),f=r.layerPointToContainerPoint(e),_=this.options.direction,v=o.offsetWidth,C=o.offsetHeight,T=z(this.options.offset),F=this._getAnchor();_==="top"?(t=v/2,s=C):_==="bottom"?(t=v/2,s=0):_==="center"?(t=v/2,s=C/2):_==="right"?(t=0,s=C/2):_==="left"?(t=v,s=C/2):f.xthis.options.maxZoom||sr?this._retainParent(o,c,f,r):!1)},_retainChildren:function(e,t,s,r){for(var o=2*e;o<2*e+2;o++)for(var c=2*t;c<2*t+2;c++){var f=new O(o,c);f.z=s+1;var _=this._tileCoordsToKey(f),v=this._tiles[_];if(v&&v.active){v.retain=!0;continue}else v&&v.loaded&&(v.retain=!0);s+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(e,s);return}for(var F=o.min.y;F<=o.max.y;F++)for(var U=o.min.x;U<=o.max.x;U++){var ve=new O(U,F);if(ve.z=this._tileZoom,!!this._isValidTile(ve)){var pe=this._tiles[this._tileCoordsToKey(ve)];pe?pe.current=!0:f.push(ve)}}if(f.sort(function(je,gt){return je.distanceTo(c)-gt.distanceTo(c)}),f.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Le=document.createDocumentFragment();for(U=0;Us.max.x)||!t.wrapLat&&(e.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return se(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,s=this.getTileSize(),r=e.scaleBy(s),o=r.add(s),c=t.unproject(r,e.z),f=t.unproject(o,e.z);return[c,f]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),s=new oe(t[0],t[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),s=new O(+t[0],+t[1]);return s.z=+t[2],s},_removeTile:function(e){var t=this._tiles[e];t&&(de(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){W(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=b,e.onmousemove=b,R.ielt9&&this.options.opacity<1&&Ne(e,this.options.opacity)},_addTile:function(e,t){var s=this._getTilePos(e),r=this._tileCoordsToKey(e),o=this.createTile(this._wrapCoords(e),m(this._tileReady,this,e));this._initTile(o),this.createTile.length<2&&B(m(this._tileReady,this,e,null,o)),ue(o,s),this._tiles[r]={el:o,coords:e,current:!0},t.appendChild(o),this.fire("tileloadstart",{tile:o,coords:e})},_tileReady:function(e,t,s){t&&this.fire("tileerror",{error:t,tile:s,coords:e});var r=this._tileCoordsToKey(e);s=this._tiles[r],s&&(s.loaded=+new Date,this._map._fadeAnimated?(Ne(s.el,0),H(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(s.active=!0,this._pruneTiles()),t||(W(s.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:s.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),R.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(m(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new O(this._wrapX?y(e.x,this._wrapX):e.x,this._wrapY?y(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new q(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Ka(e){return new Ot(e)}var ft=Ot.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=j(this,t),t.detectRetina&&R.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains=="string"&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var s=document.createElement("img");return $(s,"load",m(this._tileOnLoad,this,t,s)),$(s,"error",m(this._tileOnError,this,t,s)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(s.referrerPolicy=this.options.referrerPolicy),s.alt="",s.src=this.getTileUrl(e),s},getTileUrl:function(e){var t={r:R.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var s=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=s),t["-y"]=s}return S(this._url,h(t,this.options))},_tileOnLoad:function(e,t){R.ielt9?setTimeout(m(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,s){var r=this.options.errorTileUrl;r&&t.getAttribute("src")!==r&&(t.src=r),e(s,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,s=this.options.zoomReverse,r=this.options.zoomOffset;return s&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=b,t.onerror=b,!t.complete)){t.src=le;var s=this._tiles[e].coords;de(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:s})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",le),Ot.prototype._removeTile.call(this,e)},_tileReady:function(e,t,s){if(!(!this._map||s&&s.getAttribute("src")===le))return Ot.prototype._tileReady.call(this,e,t,s)}});function wn(e,t){return new ft(e,t)}var jn=ft.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var s=h({},this.defaultWmsParams);for(var r in t)r in this.options||(s[r]=t[r]);t=j(this,t);var o=t.detectRetina&&R.retina?2:1,c=this.getTileSize();s.width=c.x*o,s.height=c.y*o,this.wmsParams=s},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,ft.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),s=this._crs,r=ee(s.project(t[0]),s.project(t[1])),o=r.min,c=r.max,f=(this._wmsVersion>=1.3&&this._crs===gn?[o.y,o.x,c.y,c.x]:[o.x,o.y,c.x,c.y]).join(","),_=ft.prototype.getTileUrl.call(this,e);return _+M(this.wmsParams,_,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+f},setParams:function(e,t){return h(this.wmsParams,e),t||this.redraw(),this}});function Ga(e,t){return new jn(e,t)}ft.WMS=jn,wn.wms=Ga;var $e=Te.extend({options:{padding:.1},initialize:function(e){j(this,e),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),W(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var s=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,t),c=r.multiplyBy(-s).add(o).subtract(this._map._getNewPixelOrigin(e,t));R.any3d?Je(this._container,c,s):ue(this._container,c)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),s=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new q(s,s.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),kn=$e.extend({options:{tolerance:0},getEvents:function(){var e=$e.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$e.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");$(e,"mousemove",this._onMouseMove,this),$(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){H(this._redrawRequest),delete this._ctx,de(this._container),ae(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var t in this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=this._container,s=e.getSize(),r=R.retina?2:1;ue(t,e.min),t.width=r*s.x,t.height=r*s.y,t.style.width=s.x+"px",t.style.height=s.y+"px",R.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){$e.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[g(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,s=t.next,r=t.prev;s?s.prev=r:this._drawLast=r,r?r.next=s:this._drawFirst=s,delete e._order,delete this._layers[g(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var t=e.options.dashArray.split(/[, ]+/),s=[],r,o;for(o=0;o')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Ya={_initContainer:function(){this._container=X("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($e.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=Dt("shape");W(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=Dt("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;de(t),e.removeInteractiveTarget(t),delete this._layers[g(e)]},_updateStyle:function(e){var t=e._stroke,s=e._fill,r=e.options,o=e._container;o.stroked=!!r.stroke,o.filled=!!r.fill,r.stroke?(t||(t=e._stroke=Dt("stroke")),o.appendChild(t),t.weight=r.weight+"px",t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=G(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=r.lineCap.replace("butt","flat"),t.joinstyle=r.lineJoin):t&&(o.removeChild(t),e._stroke=null),r.fill?(s||(s=e._fill=Dt("fill")),o.appendChild(s),s.color=r.fillColor||r.color,s.opacity=r.fillOpacity):s&&(o.removeChild(s),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),s=Math.round(e._radius),r=Math.round(e._radiusY||s);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+s+","+r+" 0,"+65535*360)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){lt(e._container)},_bringToBack:function(e){dt(e._container)}},gi=R.vml?Dt:Re,Rt=$e.extend({_initContainer:function(){this._container=gi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=gi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){de(this._container),ae(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=e.getSize(),s=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,s.setAttribute("width",t.x),s.setAttribute("height",t.y)),ue(s,e.min),s.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=gi("path");e.options.className&&W(t,e.options.className),e.options.interactive&&W(t,"leaflet-interactive"),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){de(e._path),e.removeInteractiveTarget(e._path),delete this._layers[g(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,s=e.options;t&&(s.stroke?(t.setAttribute("stroke",s.color),t.setAttribute("stroke-opacity",s.opacity),t.setAttribute("stroke-width",s.weight),t.setAttribute("stroke-linecap",s.lineCap),t.setAttribute("stroke-linejoin",s.lineJoin),s.dashArray?t.setAttribute("stroke-dasharray",s.dashArray):t.removeAttribute("stroke-dasharray"),s.dashOffset?t.setAttribute("stroke-dashoffset",s.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),s.fill?(t.setAttribute("fill",s.fillColor||s.color),t.setAttribute("fill-opacity",s.fillOpacity),t.setAttribute("fill-rule",s.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,Xt(e._parts,t))},_updateCircle:function(e){var t=e._point,s=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||s,o="a"+s+","+r+" 0 1,0 ",c=e._empty()?"M0 0":"M"+(t.x-s)+","+t.y+o+s*2+",0 "+o+-s*2+",0 ";this._setPath(e,c)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){lt(e._path)},_bringToBack:function(e){dt(e._path)}});R.vml&&Rt.include(Ya);function Cn(e){return R.svg||R.vml?new Rt(e):null}Y.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Nn(e)||Cn(e)}});var Ln=ut.extend({initialize:function(e,t){ut.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=se(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function Xa(e,t){return new Ln(e,t)}Rt.create=gi,Rt.pointsToPath=Xt,Ze.geometryToLayer=li,Ze.coordsToLatLng=es,Ze.coordsToLatLngs=di,Ze.latLngToCoords=ts,Ze.latLngsToCoords=ci,Ze.getFeature=mt,Ze.asFeature=hi,Y.mergeOptions({boxZoom:!0});var Pn=Ie.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){$(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ae(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){de(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),St(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),$(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=X("div","leaflet-zoom-box",this._container),W(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new q(this._point,this._startPoint),s=t.getSize();ue(this._box,t.min),this._box.style.width=s.x+"px",this._box.style.height=s.y+"px"},_finish:function(){this._moved&&(de(this._box),he(this._container,"leaflet-crosshair")),Tt(),Ri(),ae(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(m(this._resetState,this),0);var t=new oe(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Y.addInitHook("addHandler","boxZoom",Pn),Y.mergeOptions({doubleClickZoom:!0});var Sn=Ie.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,s=t.getZoom(),r=t.options.zoomDelta,o=e.originalEvent.shiftKey?s-r:s+r;t.options.doubleClickZoom==="center"?t.setZoom(o):t.setZoomAround(e.containerPoint,o)}});Y.addInitHook("addHandler","doubleClickZoom",Sn),Y.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Tn=Ie.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Ke(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}W(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){he(this._map._container,"leaflet-grab"),he(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=se(this._map.options.maxBounds);this._offsetLimit=ee(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,s=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(s),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.xt.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),s=this._initialWorldOffset,r=this._draggable._newPos.x,o=(r-t+s)%e+t-s,c=(r+t+s)%e-t-s,f=Math.abs(o+s)0?c:-c))-t;this._delta=0,this._startTime=null,f&&(e.options.scrollWheelZoom==="center"?e.setZoom(t+f):e.setZoomAround(this._lastMousePos,t+f))}});Y.addInitHook("addHandler","scrollWheelZoom",Mn);var Qa=600;Y.mergeOptions({tapHold:R.touchNative&&R.safari&&R.mobile,tapTolerance:15});var An=Ie.extend({addHooks:function(){$(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ae(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new O(t.clientX,t.clientY),this._holdTimeout=setTimeout(m(function(){this._cancel(),this._isTapValid()&&($(document,"touchend",xe),$(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),Qa),$(document,"touchend touchcancel contextmenu",this._cancel,this),$(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){ae(document,"touchend",xe),ae(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),ae(document,"touchend touchcancel contextmenu",this._cancel,this),ae(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new O(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var s=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});s._simulated=!0,t.target.dispatchEvent(s)}});Y.addInitHook("addHandler","tapHold",An),Y.mergeOptions({touchZoom:R.touch,bounceAtZoomLimits:!0});var zn=Ie.extend({addHooks:function(){W(this._map._container,"leaflet-touch-zoom"),$(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){he(this._map._container,"leaflet-touch-zoom"),ae(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!=="center"&&(this._pinchStartLatLng=t.containerPointToLatLng(s.add(r)._divideBy(2))),this._startDist=s.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),$(document,"touchmove",this._onTouchMove,this),$(document,"touchend touchcancel",this._onTouchEnd,this),xe(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),o=s.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(o,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoomt.getMaxZoom()&&o>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var c=s._add(r)._divideBy(2)._subtract(this._centerPoint);if(o===1&&c.x===0&&c.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(c),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),H(this._animRequest);var f=m(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(f,this,!0),xe(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,H(this._animRequest),ae(document,"touchmove",this._onTouchMove,this),ae(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Y.addInitHook("addHandler","touchZoom",zn),Y.BoxZoom=Pn,Y.DoubleClickZoom=Sn,Y.Drag=Tn,Y.Keyboard=En,Y.ScrollWheelZoom=Mn,Y.TapHold=An,Y.TouchZoom=zn,a.Bounds=q,a.Browser=R,a.CRS=Pe,a.Canvas=kn,a.Circle=Ji,a.CircleMarker=oi,a.Class=Z,a.Control=Se,a.DivIcon=bn,a.DivOverlay=Oe,a.DomEvent=pa,a.DomUtil=fa,a.Draggable=Ke,a.Evented=ge,a.FeatureGroup=Fe,a.GeoJSON=Ze,a.GridLayer=Ot,a.Handler=Ie,a.Icon=ht,a.ImageOverlay=ui,a.LatLng=J,a.LatLngBounds=oe,a.Layer=Te,a.LayerGroup=ct,a.LineUtil=Sa,a.Map=Y,a.Marker=ai,a.Mixin=ja,a.Path=Ge,a.Point=O,a.PolyUtil=ka,a.Polygon=ut,a.Polyline=Be,a.Popup=mi,a.PosAnimation=sn,a.Projection=Ta,a.Rectangle=Ln,a.Renderer=$e,a.SVG=Rt,a.SVGOverlay=vn,a.TileLayer=ft,a.Tooltip=fi,a.Transformation=Nt,a.Util=re,a.VideoOverlay=yn,a.bind=m,a.bounds=ee,a.canvas=Nn,a.circle=Ra,a.circleMarker=Da,a.control=At,a.divIcon=Ua,a.extend=h,a.featureGroup=za,a.geoJSON=_n,a.geoJson=Za,a.gridLayer=Ka,a.icon=Ia,a.imageOverlay=$a,a.latLng=K,a.latLngBounds=se,a.layerGroup=Aa,a.map=xa,a.marker=Oa,a.point=z,a.polygon=Ba,a.polyline=Fa,a.popup=Va,a.rectangle=Xa,a.setOptions=j,a.stamp=g,a.svg=Cn,a.svgOverlay=Wa,a.tileLayer=wn,a.tooltip=qa,a.transformation=E,a.version=d,a.videoOverlay=Ha;var Ja=window.L;a.noConflict=function(){return window.L=Ja,this},window.L=a}))})(Bt,Bt.exports)),Bt.exports}var Ci=xd();function Ps(n,l,a){return Object.freeze({instance:n,context:l,container:a})}function Ss(n,l){return l==null?function(d,h){const u=k.useRef();return u.current||(u.current=n(d,h)),u}:function(d,h){const u=k.useRef();u.current||(u.current=n(d,h));const m=k.useRef(d),{instance:p}=u.current;return k.useEffect(function(){m.current!==d&&(l(p,d,m.current),m.current=d)},[p,d,h]),u}}function zr(n,l){k.useEffect(function(){return(l.layerContainer??l.map).addLayer(n.instance),function(){var u;(u=l.layerContainer)==null||u.removeLayer(n.instance),l.map.removeLayer(n.instance)}},[l,n])}function _d(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Er(d.map,a.attribution),Ls(h.current,a.eventHandlers),zr(h.current,d),h}}function yd(n,l){const a=k.useRef();k.useEffect(function(){if(l.pathOptions!==a.current){const h=l.pathOptions??{};n.instance.setStyle(h),a.current=h}},[n,l])}function vd(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Ls(h.current,a.eventHandlers),zr(h.current,d),yd(h.current,a),h}}function bd(n,l){const a=Ss(n),d=gd(a,l);return md(d)}function wd(n,l){const a=Ss(n,l),d=vd(a);return ud(d)}function jd(n,l){const a=Ss(n,l),d=_d(a);return fd(d)}function kd(n,l,a){const{opacity:d,zIndex:h}=l;d!=null&&d!==a.opacity&&n.setOpacity(d),h!=null&&h!==a.zIndex&&n.setZIndex(h)}const Nd=wd(function({center:l,children:a,...d},h){const u=new Ci.CircleMarker(l,d);return Ps(u,hd(h,{overlayContainer:u}))},ld);function gs(){return gs=Object.assign||function(n){for(var l=1;l(N==null?void 0:N.map)??null,[N]);const j=k.useCallback(D=>{if(D!==null&&N===null){const S=new Ci.Map(D,y);a!=null&&w!=null?S.setView(a,w):n!=null&&S.fitBounds(n,l),g!=null&&S.whenReady(g),P(cd(S))}},[]);k.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const M=N?$t.createElement(Ar,{value:N},d):m??null;return $t.createElement("div",gs({},x,{ref:j}),M)}const Ld=k.forwardRef(Cd),Pd=bd(function(l,a){const d=new Ci.Popup(l,a.overlayContainer);return Ps(d,a)},function(l,a,{position:d},h){k.useEffect(function(){const{instance:m}=l;function p(w){w.popup===m&&(m.update(),h(!0))}function g(w){w.popup===m&&h(!1)}return a.map.on({popupopen:p,popupclose:g}),a.overlayContainer==null?(d!=null&&m.setLatLng(d),m.openOn(a.map)):a.overlayContainer.bindPopup(m),function(){var y;a.map.off({popupopen:p,popupclose:g}),(y=a.overlayContainer)==null||y.unbindPopup(),a.map.removeLayer(m)}},[l,a,h,d])}),Sd=jd(function({url:l,...a},d){const h=new Ci.TileLayer(l,Ni(a,d));return Ps(h,d)},function(l,a,d){kd(l,a,d);const{url:h}=a;h!=null&&h!==d.url&&l.setUrl(h)}),Td=({profile:n})=>{var m,p,g,w;if(!((p=(m=n==null?void 0:n.geospatial)==null?void 0:m.sample_points)!=null&&p.length))return i.jsx(Kt,{icon:i.jsx(cs,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Geospatial Data",description:"No latitude/longitude columns were detected in the dataset."});const l=n.geospatial,a=!!n.target_col,d=Gt(l.sample_points??[],a?"label":void 0),h=d.map(({label:y,color:b})=>({label:y,color:b,shape:"circle"})),u=[[l.min_lat,l.min_lon],[l.max_lat,l.max_lon]];return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(cs,{className:"w-5 h-5 mr-2 text-blue-500"}),"Geospatial Analysis",i.jsx(_e,{text:"Visualizes data points on a map based on detected Latitude/Longitude columns. Colors indicate target values."})]}),i.jsxs("div",{className:"text-sm text-gray-500",children:["Detected columns: ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lat_col}),", ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lon_col})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2 min-w-0",children:[i.jsx("div",{className:"h-96 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 relative z-0",children:i.jsxs(Ld,{bounds:u,style:{height:"100%",width:"100%"},scrollWheelZoom:!0,children:[i.jsx(Sd,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'Β© OpenStreetMap contributors'}),d.flatMap(y=>y.points.map((b,x)=>i.jsx(Nd,{center:[b.lat,b.lon],radius:5,pathOptions:{color:a?y.color:"#3b82f6",fillColor:a?y.color:"#3b82f6",fillOpacity:.7,weight:1},children:i.jsx(Pd,{children:i.jsxs("div",{className:"text-xs",children:[i.jsx("strong",{children:"Lat:"})," ",b.lat.toFixed(4),i.jsx("br",{}),i.jsx("strong",{children:"Lon:"})," ",b.lon.toFixed(4),i.jsx("br",{}),a&&i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[n.target_col,":"]})," ",y.label]})]})})},JSON.stringify([y.value,x]))))]},`${l.lat_col??""}-${l.lon_col??""}-${u.flat().join(",")}`)}),a&&i.jsx(Ns,{entries:h})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Spatial Bounds"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Latitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lat.toFixed(4)," to ",n.geospatial.max_lat.toFixed(4)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Longitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lon.toFixed(4)," to ",n.geospatial.max_lon.toFixed(4)]})]})]})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Centroid"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsxs("span",{className:"font-mono text-sm",children:[((g=n.geospatial.centroid_lat)==null?void 0:g.toFixed(4))??"β€”",", ",((w=n.geospatial.centroid_lon)==null?void 0:w.toFixed(4))??"β€”"]})]})]}),i.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:i.jsxs("p",{children:["This scatter plot shows the spatial distribution of your data.",!!n.target_col&&" Points are colored by the target variable."]})})]})]})]})]})},Ed=({profile:n,downloadChart:l,history:a,loading:d,loadSpecificReport:h,report:u})=>{var b;const[m,p]=k.useState("idle"),g=at(),w=k.useCallback(()=>{p("done"),setTimeout(()=>p("idle"),1200)},[]),y=async()=>{if(n!=null&&n.target_interactions){p("downloading");try{const x=wr(),N=n.target_interactions,P=400,j=800,M=40,D=2,S=Math.ceil(N.length/D),G=D*j+(D+1)*M,fe=S*(P+M)+100,le=document.createElement("canvas");le.width=G,le.height=fe;const ne=le.getContext("2d");if(!ne)return;ne.fillStyle=x.bgColor,ne.fillRect(0,0,le.width,le.height),ne.fillStyle=x.textColor,ne.font="bold 24px sans-serif",ne.textAlign="center",ne.fillText("Detailed Interactions (Box Plots)",G/2,50);for(let A=0;A{ce.onload=()=>{ne.drawImage(ce,ie,Q+30,j,P-50),URL.revokeObjectURL(q),ee()},ce.onerror=()=>{URL.revokeObjectURL(q),ee()},ce.src=q})}const we=document.createElement("a");we.download="all-interactions.png",we.href=le.toDataURL("image/png"),we.click()}finally{w()}}};return i.jsxs("div",{className:"mt-4 grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Target Analysis: ",i.jsx("span",{className:"ml-2 text-blue-600",children:n.target_col}),i.jsx(_e,{text:"Analyzes relationships between the target variable and other features. Shows top correlations and key drivers."})]}),i.jsx("button",{onClick:()=>l("target-analysis-chart","target-analysis",`Target Analysis: ${n.target_col}`,"Top Associated Features"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-4",children:"Top Associated Features"}),i.jsx("div",{className:"h-64 w-full",id:"target-analysis-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:Object.entries(n.target_correlations).slice(0,10).map(([x,N])=>({name:x,value:N})),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!1,stroke:g.gridColor}),i.jsx(Xe,{type:"number",domain:[0,1],tick:{fontSize:12,fill:g.axisColor}}),i.jsx(Qe,{type:"category",dataKey:"name",width:120,tick:{fontSize:12,fill:g.axisColor}}),i.jsx(He,{contentStyle:g.tooltipContentStyle,itemStyle:g.tooltipItemStyle,labelStyle:g.tooltipLabelStyle,formatter:x=>[x.toFixed(3),"Association"]}),i.jsx(Nr,{x:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"value",fill:"#3b82f6",radius:[0,4,4,0],barSize:20})]})})})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-2",children:"Key Insights"}),i.jsxs("ul",{className:"space-y-2 text-sm",children:[i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Target is ",i.jsx("strong",{children:(b=n.columns[n.target_col])==null?void 0:b.dtype})]})]}),i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Strongest predictor: ",i.jsx("strong",{children:Object.keys(n.target_correlations)[0]||"None"}),Object.values(n.target_correlations)[0]!==void 0&&i.jsxs(i.Fragment,{children:[" (",Object.values(n.target_correlations)[0].toFixed(2),")"]})]})]})]})]})]})]}),n.target_interactions&&n.target_interactions.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Detailed Interactions (Box Plots)",i.jsx(_e,{text:"Shows distribution of values across categories. The box represents the middle 50% of data (Q1 to Q3). The line inside is the median."})]}),i.jsx("button",{onClick:y,disabled:m!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download All Charts","aria-label":"Download All Charts",children:m==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):m==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:[i.jsx("span",{className:"font-semibold",children:"ANOVA Analysis:"})," A p-value < 0.05 (highlighted in green) indicates that the feature varies significantly across the target categories, making it a strong predictor."]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:n.target_interactions.map((x,N)=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 relative group",children:[i.jsx("div",{className:"absolute top-2 right-2 opacity-100",children:i.jsx("button",{onClick:()=>l(`interaction-chart-${N}`,`interaction-${x.feature}`,`${x.feature} vs ${n.target_col}`,x.p_value!==void 0?`ANOVA p: ${Number(x.p_value).toExponential(2)}`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"text-center mb-2",children:[i.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[x.feature," vs ",n.target_col]}),x.p_value!==void 0&&x.p_value!==null&&i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full inline-block mt-1 ${x.p_value<.05?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:["ANOVA p: ",Number(x.p_value).toExponential(2)]})]}),i.jsx("div",{className:"h-64 w-full",id:`interaction-chart-${N}`,children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Uo,{data:x.data.map(P=>({...P,boxBottom:P.stats.q1,boxHeight:P.stats.q3-P.stats.q1})),margin:{top:20,right:30,left:20,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:g.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:g.axisColor}}),i.jsx(Qe,{domain:["auto","auto"],tick:{fontSize:11,fill:g.axisColor}}),i.jsx(He,{cursor:{fill:"transparent"},content:({active:P,payload:j})=>{if(P&&j&&j.length){const M=j[0].payload;return i.jsxs("div",{style:g.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg z-50",children:[i.jsx("p",{className:"font-semibold mb-1",children:M.name}),i.jsxs("p",{children:["Max: ",M.stats.max.toFixed(2)]}),i.jsxs("p",{children:["Q3: ",M.stats.q3.toFixed(2)]}),i.jsxs("p",{children:["Median: ",M.stats.median.toFixed(2)]}),i.jsxs("p",{children:["Q1: ",M.stats.q1.toFixed(2)]}),i.jsxs("p",{children:["Min: ",M.stats.min.toFixed(2)]})]})}return null}}),i.jsx(Ve,{dataKey:"boxBottom",stackId:"a",fill:"transparent",legendType:"none"}),i.jsx(Ve,{dataKey:"boxHeight",stackId:"a",fill:"#8884d8",fillOpacity:.6,name:"IQR (Q1-Q3)"}),i.jsx(rs,{name:"Median",dataKey:"stats.median",fill:"#ff7300",shape:"square"}),i.jsx(rs,{name:"Max",dataKey:"stats.max",fill:"#82ca9d",shape:"cross"}),i.jsx(rs,{name:"Min",dataKey:"stats.min",fill:"#82ca9d",shape:"cross"})]})})}),i.jsx("p",{className:"text-xs text-center text-gray-400 mt-2",children:"* Box: Q1-Q3. Orange square: Median. Green crosses: Min/Max."})]},N))})]})]}),i.jsx("div",{className:"lg:col-span-1",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm h-fit sticky top-4",children:[i.jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ls,{className:"w-4 h-4 mr-2"}),"Analysis History"]}),d&&i.jsx(be,{className:"w-3 h-3 animate-spin text-blue-500"})]}),i.jsx("div",{className:"space-y-2 max-h-[500px] overflow-y-auto",children:a.length===0?i.jsx("p",{className:"text-xs text-gray-500 italic",children:"No previous analyses found."}):a.slice(0,10).map(x=>i.jsxs("button",{onClick:()=>!d&&h(x.id),disabled:d,className:`w-full text-left p-3 rounded-md text-sm border transition-colors ${u&&u.id===x.id?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-gray-50 border-gray-100 text-gray-600 hover:bg-gray-100 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800"} ${d?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("div",{className:"font-medium truncate",children:x.target_col?`Target: ${x.target_col}`:"General Analysis"}),i.jsx("div",{className:"text-xs opacity-70 mt-1",children:new Date(x.created_at).toLocaleString()}),i.jsx("div",{className:"mt-1",children:i.jsx(br,{status:x.status})})]},x.id))})]})})]})},Md=({profile:n,downloadChart:l})=>{var d,h;const a=at();return i.jsxs("div",{className:"mt-4 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ys,{className:"w-5 h-5 mr-2 text-blue-500"}),"Trend Analysis (",n.timeseries.date_col,")",i.jsx(_e,{text:"Shows how values change over time. Look for long-term trends (up/down) or sudden shifts."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[n.timeseries.stationarity_test&&i.jsxs("div",{className:`text-xs px-3 py-1 rounded-full border flex items-center gap-1 ${n.timeseries.stationarity_test.is_stationary?"bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300":"bg-yellow-50 border-yellow-200 text-yellow-700 dark:bg-yellow-900/20 dark:border-yellow-800 dark:text-yellow-300"}`,children:[i.jsx(_e,{text:"Augmented Dickey-Fuller Test. Stationary (p<0.05) means the data has constant mean/variance over time. Non-Stationary (p>=0.05) means it has a trend or seasonality."}),i.jsx("span",{className:"font-semibold",children:"ADF Test:"})," ",n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary",i.jsxs("span",{className:"opacity-75 ml-1",children:["(p=",n.timeseries.stationarity_test.p_value.toFixed(3),")"]})]}),i.jsx("button",{onClick:()=>l("trend-chart","trend-analysis","Trend Analysis",`Date Column: ${n.timeseries.date_col}`,n.timeseries.stationarity_test?`ADF Test: ${n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary"} (p=${n.timeseries.stationarity_test.p_value.toFixed(3)})`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx("div",{className:"h-80 w-full",id:"trend-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Ko,{data:n.timeseries.trend,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"date",tick:{fontSize:12,fill:a.axisColor},minTickGap:30}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle}),i.jsx(kr,{}),Object.keys(((d=n.timeseries.trend[0])==null?void 0:d.values)||{}).map((u,m)=>i.jsx(Fn,{type:"monotone",dataKey:`values.${u}`,name:u,stroke:We[m%We.length],dot:!1,strokeWidth:2},u)),(!((h=n.timeseries.trend[0])!=null&&h.values)||Object.keys(n.timeseries.trend[0].values).length===0)&&i.jsx(Fn,{type:"monotone",dataKey:"count",stroke:"#3b82f6",dot:!1})]})})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("day-seasonality-chart","day-seasonality","Day of Week Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Day of Week Seasonality"}),i.jsx(_e,{text:"Average values for each day. Helps identify weekly patterns (e.g., lower on weekends)."})]}),i.jsx("div",{className:"h-64 w-full",id:"day-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.day_of_week,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"day",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#8884d8",radius:[4,4,0,0]})]})})})]})}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("month-seasonality-chart","month-seasonality","Monthly Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Monthly Seasonality"}),i.jsx(_e,{text:"Average values for each month. Helps identify yearly patterns or seasonal effects."})]}),i.jsx("div",{className:"h-64 w-full",id:"month-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.month_of_year,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"month",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#82ca9d",radius:[4,4,0,0]})]})})})]}),n.timeseries.autocorrelation&&n.timeseries.autocorrelation.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Autocorrelation (Lag Analysis)"}),i.jsxs("div",{className:"group relative ml-2",children:[i.jsx(jt,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none text-center",children:["Shows how much the current value depends on past values (lags). High bars indicate repeating patterns or seasonality.",i.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-800"})]})]})]}),i.jsx("button",{onClick:()=>l("autocorrelation-chart","autocorrelation","Autocorrelation (Lag Analysis)"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})]}),i.jsx("div",{className:"h-80 w-full pb-6",id:"autocorrelation-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.autocorrelation,margin:{bottom:20},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"lag",tick:{fontSize:12,fill:a.axisColor},label:{value:"Lag (Days)",position:"insideBottom",offset:-15,fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{domain:[-1,1],tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"},formatter:u=>[u.toFixed(3),"Correlation"]}),i.jsx(Nr,{y:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"corr",fill:"#f59e0b",radius:[2,2,0,0]})]})})})]})]})},Ad=({profile:n,onBarClick:l})=>{const a=at(),{data:d,typeMatched:h}=k.useMemo(()=>{var p;if(!n)return{data:[],typeMatched:!1};const m=n.dtype;return m==="Numeric"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(2)}`,fullName:`${Number(g.start).toFixed(2)} - ${Number(g.end).toFixed(2)}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Text"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(0)}`,fullName:`${Number(g.start).toFixed(0)} - ${Number(g.end).toFixed(0)} chars`,count:g.count,rawBin:g})),typeMatched:!0}:m==="DateTime"&&n.histogram?{data:n.histogram.map(g=>({name:new Date(g.start).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),fullName:`${new Date(g.start).toLocaleDateString()} - ${new Date(g.end).toLocaleDateString()}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Categorical"&&((p=n.categorical_stats)!=null&&p.top_k)?{data:n.categorical_stats.top_k.map(g=>({name:String(g.value).substring(0,15)+(String(g.value).length>15?"...":""),fullName:String(g.value),count:g.count,value:g.value})),typeMatched:!0}:{data:[],typeMatched:!1}},[n]);if(!n)return null;if(!h)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No distribution data available for this type"});if(d.length===0)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No data points"});const u=n.dtype;return i.jsxs("div",{className:"w-full h-full flex flex-col",children:[i.jsxs("div",{className:"flex-1 w-full min-h-[250px] relative",children:[n.normality_test&&i.jsxs("div",{className:"absolute top-0 right-0 bg-white/90 dark:bg-gray-800/90 p-2 rounded border border-gray-200 dark:border-gray-700 text-xs z-10 shadow-sm",children:[i.jsxs("div",{className:"font-semibold text-gray-700 dark:text-gray-300 mb-1 flex items-center",children:["Normality Test (",n.normality_test.test_name,")",i.jsx(_e,{text:"Normality tests are performed on a sample of up to 5,000 rows. Shapiro-Wilk is used for smaller datasets (<5,000), and Kolmogorov-Smirnov for larger ones. For very large datasets, rely on Skewness and Kurtosis.",align:"right"})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"p-value:"}),i.jsx("span",{className:`font-mono ${n.normality_test.is_normal?"text-green-600":"text-red-500"}`,children:n.normality_test.p_value.toExponential(2)})]}),i.jsx("div",{className:"mt-1 text-[10px] text-gray-400",children:n.normality_test.is_normal?"Likely Normal Distribution":"Likely Not Normal"})]}),i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:d,margin:{top:5,right:30,left:20,bottom:30},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:a.axisColor},interval:"preserveStartEnd",angle:-45,textAnchor:"end"}),i.jsx(Qe,{tick:{fontSize:11,fill:a.axisColor}}),i.jsx(He,{content:({active:m,payload:p})=>{if(m&&p&&p.length){const g=p[0].payload;return i.jsxs("div",{style:a.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg",children:[i.jsx("p",{className:"font-semibold mb-1",children:g.fullName}),i.jsxs("p",{children:["Count: ",g.count]}),l&&i.jsx("p",{className:"text-blue-300 mt-1 italic",children:"Click to filter"})]})}return null}}),i.jsx(Ve,{dataKey:"count",radius:[4,4,0,0],onClick:m=>l&&l(m),className:l?"cursor-pointer hover:opacity-80":"",children:d.map((m,p)=>i.jsx(js,{fill:u==="Numeric"?"#3b82f6":"#8b5cf6"},`cell-${p}`))})]})})]}),i.jsx(ki,{caption:`Distribution data table for ${n.name}`,filename:`${n.name}-distribution`,columns:[{key:"fullName",label:"Bin / Value"},{key:"count",label:"Count"}],rows:d.map(m=>({fullName:m.fullName,count:m.count}))})]})};var zd=Symbol.for("react.lazy"),vi=wo[" use ".trim().toString()];function Id(n){return typeof n=="object"&&n!==null&&"then"in n}function Ir(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===zd&&"_payload"in n&&Id(n._payload)}function Od(n){const l=Rd(n),a=k.forwardRef((d,h)=>{let{children:u,...m}=d;Ir(u)&&typeof vi=="function"&&(u=vi(u._payload));const p=k.Children.toArray(u),g=p.find(Bd);if(g){const w=g.props.children,y=p.map(b=>b===g?k.Children.count(w)>1?k.Children.only(null):k.isValidElement(w)?w.props.children:null:b);return i.jsx(l,{...m,ref:h,children:k.isValidElement(w)?k.cloneElement(w,void 0,y):null})}return i.jsx(l,{...m,ref:h,children:u})});return a.displayName=`${n}.Slot`,a}var Dd=Od("Slot");function Rd(n){const l=k.forwardRef((a,d)=>{let{children:h,...u}=a;if(Ir(h)&&typeof vi=="function"&&(h=vi(h._payload)),k.isValidElement(h)){const m=$d(h),p=Zd(u,h.props);return h.type!==k.Fragment&&(p.ref=d?Eo(d,m):m),k.cloneElement(h,p)}return k.Children.count(h)>1?k.Children.only(null):null});return l.displayName=`${n}.SlotClone`,l}var Fd=Symbol("radix.slottable");function Bd(n){return k.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Fd}function Zd(n,l){const a={...l};for(const d in l){const h=n[d],u=l[d];/^on[A-Z]/.test(d)?h&&u?a[d]=(...p)=>{const g=u(...p);return h(...p),g}:h&&(a[d]=h):d==="style"?a[d]={...h,...u}:d==="className"&&(a[d]=[h,u].filter(Boolean).join(" "))}return{...n,...a}}function $d(n){var d,h;let l=(d=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:d.get,a=l&&"isReactWarning"in l&&l.isReactWarning;return a?n.ref:(l=(h=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:h.get,a=l&&"isReactWarning"in l&&l.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}const qn=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Un=Cr,Or=(n,l)=>a=>{var d;if((l==null?void 0:l.variants)==null)return Un(n,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:h,defaultVariants:u}=l,m=Object.keys(h).map(w=>{const y=a==null?void 0:a[w],b=u==null?void 0:u[w];if(y===null)return null;const x=qn(y)||qn(b);return h[w][x]}),p=a&&Object.entries(a).reduce((w,y)=>{let[b,x]=y;return x===void 0||(w[b]=x),w},{}),g=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((w,y)=>{let{class:b,className:x,...N}=y;return Object.entries(N).every(P=>{let[j,M]=P;return Array.isArray(M)?M.includes({...u,...p}[j]):{...u,...p}[j]===M})?[...w,b,x]:w},[]);return Un(n,m,g,a==null?void 0:a.class,a==null?void 0:a.className)},Hd=Or("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"action-primary",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"action-secondary",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Vt=k.forwardRef(({className:n,variant:l,size:a,asChild:d=!1,...h},u)=>{const m=d?Dd:"button";return i.jsx(m,{className:Hd({variant:l,size:a,className:n}),ref:u,...h})});Vt.displayName="Button";function Dr(...n){return Mo(Cr(n))}const Wd=Or("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rt({className:n,variant:l,...a}){return i.jsx("div",{className:Dr(Wd({variant:l}),n),...a})}function Vd({profile:n}){var a;let l=[];return n.histogram?l=n.histogram.map(d=>({name:String(d.start),count:d.count})):(a=n.categorical_stats)!=null&&a.top_k&&(l=n.categorical_stats.top_k.slice(0,10).map(d=>({name:String(d.value),count:d.count}))),i.jsxs("div",{className:"flex items-center justify-between w-full pr-4",children:[i.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground mr-auto",children:[i.jsx(qd,{profile:n}),i.jsx(Ud,{profile:n})]}),l.length>0&&i.jsx("div",{className:"h-8 w-24 hidden sm:block opacity-70",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsx(nt,{data:l,children:i.jsx(Ve,{dataKey:"count",fill:n.dtype==="Numeric"?"#3b82f6":n.dtype==="Categorical"?"#8b5cf6":"#10b981",radius:[1,1,0,0]})})})})]})}function qd({profile:n}){var l,a,d,h,u;return i.jsx(i.Fragment,{children:n.numeric_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Mean: ",i.jsx("span",{className:"font-mono text-foreground",children:(l=n.numeric_stats.mean)==null?void 0:l.toFixed(2)})]}),i.jsxs("span",{children:["Std: ",i.jsx("span",{className:"font-mono text-foreground",children:(a=n.numeric_stats.std)==null?void 0:a.toFixed(2)})]}),i.jsxs("span",{children:["Min: ",i.jsx("span",{className:"font-mono text-foreground",children:(d=n.numeric_stats.min)==null?void 0:d.toFixed(2)})]}),i.jsxs("span",{children:["Max: ",i.jsx("span",{className:"font-mono text-foreground",children:(h=n.numeric_stats.max)==null?void 0:h.toFixed(2)})]})]}):n.categorical_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Unique: ",i.jsx("span",{className:"font-mono text-foreground",children:n.categorical_stats.unique_count})]}),((u=n.categorical_stats.top_k)==null?void 0:u[0])&&i.jsxs("span",{children:["Top: ",i.jsx("span",{className:"font-mono text-foreground",children:String(n.categorical_stats.top_k[0].value).slice(0,20)})]})]}):null})}function Ud({profile:n}){return i.jsxs(i.Fragment,{children:[n.normality_test&&n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20",children:"Normal Dist"}),n.normality_test&&!n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20",children:"Not Normal"})]})}function Kd({profile:n}){return i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"font-medium text-sm truncate",children:n.name}),i.jsx(rt,{variant:"outline",className:`text-[10px] h-5 px-1 ${_l(n.dtype)}`,children:n.dtype}),n.is_unique&&i.jsx(rt,{variant:"secondary",className:"text-[10px] h-5",children:"ID"}),n.is_constant&&i.jsx(rt,{variant:"destructive",className:"text-[10px] h-5",children:"Constant"})]})}function Gd({profile:n,isExcluded:l,onToggleExclude:a}){return i.jsxs("div",{className:"flex items-center gap-4 px-2",children:[i.jsxs("div",{className:"flex flex-col items-end w-24",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.missing_percentage>0?`${n.missing_percentage.toFixed(1)}% Missing`:"100% Present"}),i.jsx(_e,{text:"Green bar indicates the percentage of valid (non-null) data. Full green means no missing values.",align:"end",size:"sm"})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-100 dark:bg-gray-800 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${n.missing_percentage>0?"bg-amber-400":"bg-green-500"}`,style:{width:`${Math.max(100-n.missing_percentage,0)}%`}})})]}),i.jsx("div",{className:"h-8 w-[1px] bg-border mx-2"}),i.jsx(Vt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:d=>{d.stopPropagation(),a(n.name,!l)},title:l?"Include in analysis":"Exclude from analysis","aria-label":l?"Include in analysis":"Exclude from analysis",children:l?i.jsx(Ut,{size:16}):i.jsx(pr,{size:16})})]})}function Yd({profile:n}){return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Statistics"}),i.jsxs("div",{className:"bg-background rounded-md border p-3 text-sm space-y-2 font-mono",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Missing"}),i.jsxs("span",{children:[n.missing_count," (",n.missing_percentage.toFixed(2),"%)"]})]}),n.numeric_stats&&i.jsx(Xd,{stats:n.numeric_stats,vif:n.vif}),n.text_stats&&i.jsx(ec,{stats:n.text_stats}),n.categorical_stats&&i.jsx(tc,{stats:n.categorical_stats})]})]})}function Xd({stats:n,vif:l}){var a,d,h,u,m,p,g,w;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mean"}),i.jsx("span",{children:(a=n.mean)==null?void 0:a.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Std Dev"}),i.jsx("span",{children:(d=n.std)==null?void 0:d.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Variance"}),i.jsx("span",{children:((h=n.variance)==null?void 0:h.toFixed(4))||Math.pow(n.std||0,2).toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min"}),i.jsx("span",{children:(u=n.min)==null?void 0:u.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"25% (Q1)"}),i.jsx("span",{children:(m=n.q25)==null?void 0:m.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Median"}),i.jsx("span",{children:(p=n.median)==null?void 0:p.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"75% (Q3)"}),i.jsx("span",{children:(g=n.q75)==null?void 0:g.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max"}),i.jsx("span",{children:(w=n.max)==null?void 0:w.toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Qd,{stats:n}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Jd,{stats:n,vif:l})]})}function Qd({stats:n}){var l,a;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Skewness"}),i.jsx("span",{children:(l=n.skewness)==null?void 0:l.toFixed(4)})]}),n.skewness!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.skewness)<.5?"↳ Symmetric":Math.abs(n.skewness)<1?"↳ Moderately Skewed":"↳ Highly Skewed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Kurtosis"}),i.jsx("span",{children:(a=n.kurtosis)==null?void 0:a.toFixed(4)})]}),n.kurtosis!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.kurtosis)<.5?"↳ Mesokurtic (Normal-like)":n.kurtosis>0?"↳ Leptokurtic (Heavy Tails)":"↳ Platykurtic (Light Tails)"})]})}function Jd({stats:n,vif:l}){return i.jsxs(i.Fragment,{children:[n.zeros_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Zeros"}),i.jsx("span",{children:n.zeros_count})]}),n.negatives_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Negatives"}),i.jsx("span",{children:n.negatives_count})]}),l!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:["VIF",i.jsx(_e,{text:"Variance Inflation Factor. VIF > 5 = high multicollinearity, VIF > 10 = severe.",size:"sm"})]}),i.jsx("span",{className:l>5?"text-red-500 font-semibold":l>2?"text-amber-500":"text-green-500",children:l.toFixed(2)})]})]})}function ec({stats:n}){var l;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Avg Length"}),i.jsxs("span",{children:[(l=n.avg_length)==null?void 0:l.toFixed(1)," chars"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min Length"}),i.jsx("span",{children:n.min_length})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max Length"}),i.jsx("span",{children:n.max_length})]}),n.sentiment_distribution&&i.jsx(ic,{distribution:n.sentiment_distribution}),n.common_words&&n.common_words.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Common Words"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.common_words.slice(0,10).map((a,d)=>i.jsxs(rt,{variant:"secondary",className:"text-[10px] h-4",children:[a.word??a.value," (",a.count,")"]},d))})]})]})}function tc({stats:n}){var l,a,d,h;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Unique"}),i.jsx("span",{children:n.unique_count})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mode"}),i.jsx("span",{className:"truncate max-w-[100px]",title:String((a=(l=n.top_k)==null?void 0:l[0])==null?void 0:a.value),children:String(((h=(d=n.top_k)==null?void 0:d[0])==null?void 0:h.value)||"-")})]}),n.rare_labels_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Rare Labels"}),i.jsx("span",{children:n.rare_labels_count})]}),n.top_k&&n.top_k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Top Categories"}),i.jsx("div",{className:"space-y-1",children:n.top_k.slice(0,5).map((u,m)=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"truncate max-w-[120px]",title:String(u.value),children:String(u.value)}),i.jsx("span",{className:"text-muted-foreground",children:u.count})]},m))})]})]})}function ic({distribution:n}){const l=n.positive||0,a=n.neutral||0,d=n.negative||0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Sentiment"}),i.jsxs("div",{className:"flex h-3 rounded-full overflow-hidden w-full bg-secondary",children:[i.jsx("div",{className:"bg-green-500 h-full",style:{width:`${l*100}%`},title:`Positive: ${(l*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-gray-400 h-full",style:{width:`${a*100}%`},title:`Neutral: ${(a*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-red-500 h-full",style:{width:`${d*100}%`},title:`Negative: ${(d*100).toFixed(1)}%`})]}),i.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1 px-1",children:[i.jsxs("span",{children:["Pos: ",(l*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neu: ",(a*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neg: ",(d*100).toFixed(0),"%"]})]})]})}const Kn=({profile:n,isExpanded:l,onToggleExpand:a,onToggleExclude:d,isExcluded:h,handleAddFilter:u})=>{const m=k.useRef(null),[p,g]=k.useState("idle"),w=async()=>{if(m.current){g("downloading");try{const b=document.documentElement.classList.contains("dark"),x=await ws(m.current,{backgroundColor:b?"#1f2937":"#ffffff",pixelRatio:2}),N=document.createElement("a");N.href=x,N.download=`${n.name}_distribution.png`,N.click()}catch(b){console.error("Failed to download chart",b),Wt.error("Chart download failed",String(b))}finally{g("done"),setTimeout(()=>g("idle"),1200)}}},y=b=>{if(n.dtype==="Categorical"||n.dtype==="Boolean"){const x=b.value!==void 0?b.value:b.name;u(n.name,x,"==")}else n.dtype==="Numeric"&&b.rawBin&&u(n.name,b.rawBin.start,">=")};return i.jsxs("div",{className:`border rounded-lg mb-2 transition-all ${l?"border-primary/50 shadow-md bg-card/50":"border-border bg-card"}`,children:[i.jsxs("div",{className:"flex items-center p-3 hover:bg-accent/50 cursor-pointer rounded-t-lg",...ji(a),children:[i.jsx("div",{className:"mr-2 text-muted-foreground",children:l?i.jsx(wi,{size:18}):i.jsx(gr,{size:18})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Kd,{profile:n}),!l&&i.jsx(Vd,{profile:n})]}),i.jsx(Gd,{profile:n,isExcluded:h,onToggleExclude:d})]}),l&&i.jsx("div",{className:"p-4 border-t border-border bg-card/30 animate-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch",children:[i.jsx(Yd,{profile:n}),i.jsxs("div",{className:"md:col-span-2 flex flex-col min-h-[300px]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Distribution"}),i.jsx(Vt,{size:"icon",variant:"outline",className:"h-8 w-8",title:"Download Chart",onClick:w,disabled:p!=="idle",children:p==="downloading"?i.jsx(be,{size:16,className:"animate-spin"}):p==="done"?i.jsx(Ht,{size:16,className:"text-green-500"}):i.jsx(ke,{size:16})})]}),i.jsx("div",{className:"flex-1 bg-background rounded-md border p-4 min-h-0",ref:m,children:i.jsx(Ad,{profile:n,onBarClick:y})})]})]})})]})},Rr=k.forwardRef(({className:n,type:l,...a},d)=>i.jsx("input",{type:l,className:Dr("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:d,...a}));Rr.displayName="Input";const sc=({profile:n,handleToggleExclude:l,handleAddFilter:a})=>{const[d,h]=k.useState(""),[u,m]=k.useState(new Set);Ao(()=>m(new Set),u.size>0);const p=x=>{const N=new Set(u);N.has(x)?N.delete(x):N.add(x),m(N)},g=()=>{m(new Set(Object.keys(n.columns)))},w=()=>{m(new Set)},y=Object.values(n.columns).filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),b=(n.excluded_columns??[]).filter(x=>x.toLowerCase().includes(d.toLowerCase()));return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4 bg-card p-2 rounded-lg border",children:[i.jsxs("div",{className:"relative flex-1 max-w-sm",children:[i.jsx(jo,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),i.jsx(Rr,{placeholder:"Search variables...",className:"pl-8 h-9",value:d,onChange:x=>h(x.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Vt,{variant:"outline",size:"sm",onClick:g,className:"h-9 text-xs",children:"Expand All"}),i.jsx(Vt,{variant:"outline",size:"sm",onClick:w,className:"h-9 text-xs",children:"Collapse All"})]}),i.jsxs("div",{className:"ml-auto text-sm text-muted-foreground px-2",children:["Showing ",y.length," of ",Object.keys(n.columns).length," variables"]})]}),i.jsxs("div",{className:"space-y-2",children:[y.map(x=>i.jsx(Kn,{profile:x,isExpanded:u.has(x.name),onToggleExpand:()=>p(x.name),onToggleExclude:l,isExcluded:!1,handleAddFilter:a},x.name)),b.length>0&&i.jsxs("div",{className:"mt-8",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2 text-muted-foreground",children:["Excluded Variables ",i.jsx(rt,{variant:"secondary",children:b.length})]}),b.map(x=>i.jsx(Kn,{profile:{name:x,dtype:"Excluded",missing_count:0,missing_percentage:0},isExpanded:u.has(x),onToggleExpand:()=>p(x),onToggleExclude:l,isExcluded:!0,handleAddFilter:a},x))]})]})]})};function nc({profile:n,scatterX:l,scatterY:a,scatterZ:d,scatterColor:h,is3D:u}){return i.jsx(i.Fragment,{children:l&&a?u&&d?i.jsx(Sr,{data:n.sample_data??[],xKey:l,yKey:a,zKey:d,labelKey:h||void 0,xLabel:l,yLabel:a,zLabel:d}):i.jsx(Tr,{data:n.sample_data??[],xKey:l,yKey:a,labelKey:h||void 0,xLabel:l,yLabel:a}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm",children:"Select X and Y variables to generate scatter plot."})})}const rc=({profile:n,downloadChart:l,scatterX:a,setScatterX:d,scatterY:h,setScatterY:u,scatterZ:m,setScatterZ:p,scatterColor:g,setScatterColor:w,is3D:y,setIs3D:b})=>{const x=k.useMemo(()=>(n==null?void 0:n.sample_data)??[],[n==null?void 0:n.sample_data]),N=k.useMemo(()=>Pr(Gt(x,g||void 0)),[x,g]),P=k.useMemo(()=>{const S=[{key:a,label:a||"X"},{key:h,label:h||"Y"}];return y&&m&&S.push({key:m,label:m}),g&&S.push({key:g,label:g}),S},[a,h,m,g,y]),j=k.useMemo(()=>x.map(S=>S),[x]);if(!(n!=null&&n.columns)||!(n!=null&&n.sample_data))return i.jsx(Kt,{icon:i.jsx(Zt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Data Available",description:"Sample data is required for bivariate analysis."});const M=!!(a&&h&&n.sample_data.length>0),D=M?"Download Chart":"Select X and Y variables to enable download";return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Bivariate Analysis (Scatter Plot)",i.jsx(_e,{text:"Visualize the relationship between two numeric variables."})]}),i.jsx("button",{disabled:!M,onClick:()=>l("bivariate-chart","bivariate-analysis","Bivariate Analysis",`${a} vs ${h}`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:D,"aria-label":D,children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-6 items-end",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"X Axis"}),i.jsxs("select",{value:a,onChange:S=>d(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Y Axis"}),i.jsxs("select",{value:h,onChange:S=>u(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),y&&i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Z Axis"}),i.jsxs("select",{value:m,onChange:S=>p(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Color By"}),i.jsxs("select",{value:g,onChange:S=>w(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"None"}),Object.values(n.columns).map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsx("button",{onClick:()=>b(!y),className:`p-2 rounded-md border transition-colors ${y?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,title:"Toggle 3D View","aria-label":"Toggle 3D View",children:i.jsx(_r,{className:"w-5 h-5"})})]}),i.jsx("div",{id:"bivariate-chart",children:i.jsx(nc,{profile:n,scatterX:a,scatterY:h,scatterZ:m,scatterColor:g,is3D:y})}),g&&N.length>0&&i.jsx(Ns,{entries:N}),i.jsx(ki,{caption:"Bivariate scatter plot data",filename:"bivariate-analysis",columns:P,rows:j})]})},ac=({profile:n})=>{var l,a;return(a=(l=n==null?void 0:n.outliers)==null?void 0:l.top_outliers)!=null&&a.length?i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-red-500"}),"Outlier Analysis (",n.outliers.method,")",i.jsx(_e,{text:"Detects anomalous rows using Isolation Forest. Lower scores indicate higher anomaly."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Total Outliers"}),i.jsx("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:n.outliers.total_outliers})]}),i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Percentage"}),i.jsxs("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:[n.outliers.outlier_percentage.toFixed(2),"%"]})]})]}),i.jsx("h4",{className:"text-md font-medium text-gray-900 dark:text-white mb-3",children:"Top Anomalous Rows"}),i.jsx("div",{className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Row Index"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Anomaly Score"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Why is this an outlier?"}),n.outliers.top_outliers[0]&&Object.keys(n.outliers.top_outliers[0].values??{}).slice(0,5).map(d=>i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:d},d))]})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.outliers.top_outliers.map(d=>{var h;return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-gray-500",children:d.index}),i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-red-600",children:((h=d.score)==null?void 0:h.toFixed(4))??"β€”"}),i.jsx("td",{className:"px-4 py-3 text-sm",children:d.explanation?i.jsx("div",{className:"space-y-1",children:d.explanation.map((u,m)=>i.jsxs("div",{className:"text-xs",children:[i.jsxs("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:[u.feature,":"]})," ",i.jsx("span",{className:"text-red-600 dark:text-red-400",children:u.value.toFixed(2)})," ",i.jsxs("span",{className:"text-gray-400",children:["(Median: ",u.median.toFixed(2),", Diff: ",u.diff_pct.toFixed(0),"%)"]})]},m))}):i.jsx("span",{className:"text-gray-400 text-xs",children:"No explanation available"})}),Object.entries(d.values??{}).slice(0,5).map(([u,m])=>i.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-300",children:typeof m=="number"?m.toFixed(2):String(m)},u))]},d.index)})})]})})]}):i.jsx(Kt,{icon:i.jsx(_i,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Outlier Data",description:"Outlier analysis did not return any results."})},oc=n=>{if(n===null||Number.isNaN(n))return"rgba(243, 244, 246, 1)";const l=Math.max(.4,Math.abs(n));return n>0?`rgba(239, 68, 68, ${l})`:`rgba(59, 130, 246, ${l})`},lc=()=>i.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",role:"img","aria-label":"Correlation color scale from negative one (blue) through zero (white) to positive one (red)",children:[i.jsx("span",{children:"βˆ’1"}),i.jsx("div",{className:"h-3 w-40 rounded-sm border border-gray-200 dark:border-gray-700",style:{background:"linear-gradient(to right, rgba(59,130,246,1), rgba(59,130,246,0.4), rgba(243,244,246,1), rgba(239,68,68,0.4), rgba(239,68,68,1))"},"aria-hidden":"true"}),i.jsx("span",{children:"0"}),i.jsx("span",{className:"w-6"}),i.jsx("span",{children:"+1"}),i.jsx("span",{className:"ml-2 italic text-gray-500 dark:text-gray-400",children:"Negative (blue) Β· Positive (red)"})]}),Gn=({data:n})=>{const a=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(0,20),[n]),d=k.useMemo(()=>((n==null?void 0:n.values)??[]).slice(0,20).map(p=>p.slice(0,20)),[n]),h=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(20),[n]),u=k.useMemo(()=>n!=null&&n.columns?n.columns.map((p,g)=>{const w={variable:p};return n.columns.forEach((y,b)=>{var x;w[y]=((x=n.values[g])==null?void 0:x[b])??null}),w}):[],[n]);if(!n||!n.columns)return i.jsx("div",{children:"No correlation data available"});const m=n.columns.length>20;return i.jsxs("div",{className:"overflow-x-auto p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx(lc,{}),m&&i.jsxs("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-200 text-sm rounded-md",children:["Showing the first ",20," of ",n.columns.length," columns (",h.length," omitted: ",h.slice(0,5).join(", "),h.length>5?", …":"","). Use the data table below for the full matrix."]}),i.jsx("div",{className:"inline-block min-w-full",children:i.jsxs("div",{className:"grid gap-1",style:{gridTemplateColumns:`100px repeat(${a.length}, minmax(50px, 1fr))`,paddingTop:"4.5rem"},children:[i.jsx("div",{className:"p-2"}),a.map((p,g)=>i.jsx("div",{className:"relative p-2 text-xs font-medium text-gray-700 dark:text-gray-300",title:p,children:i.jsx("span",{className:"absolute bottom-1 left-1/2 whitespace-nowrap origin-bottom-left",style:{transform:"rotate(-45deg)"},children:p})},g)),a.map((p,g)=>i.jsxs($t.Fragment,{children:[i.jsx("div",{className:"p-2 text-xs font-medium truncate text-right pr-4 text-gray-700 dark:text-gray-300",title:p,children:p}),(d[g]??[]).map((w,y)=>i.jsx("div",{className:"h-10 w-full flex items-center justify-center text-[10px] text-gray-900 dark:text-gray-100 rounded-sm cursor-help transition-opacity hover:opacity-80",style:{backgroundColor:oc(w)},title:`${p} vs ${a[y]}: ${w!==null?w.toFixed(3):"N/A"}`,children:w!==null?w.toFixed(2):""},y))]},g))]})}),i.jsx(ki,{caption:"Full correlation matrix data table",filename:"correlation-matrix",columns:[{key:"variable",label:"Variable"},...n.columns.map(p=>({key:p,label:p}))],rows:u})]})};function ps({target:n,reason:l}){if(!n||!l)return null;const a={categorical:`The selected target β€œ${n}” is treated as categorical and is omitted from numeric-only causal discovery and Pearson correlations. Use Target Analysis for categorical associations.`,excluded:`The selected target β€œ${n}” is excluded from this report's analysis.`,unsupported:`The selected target β€œ${n}” is not supported by numeric-only causal discovery or Pearson correlations.`};return i.jsx("p",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:a[l]})}const dc=({profile:n})=>{const[l,a]=k.useState(null),[d,h]=k.useState(null);if(!(n!=null&&n.correlations))return i.jsxs(i.Fragment,{children:[i.jsx(ps,{target:n==null?void 0:n.target_col,reason:n==null?void 0:n.causal_target_exclusion_reason}),i.jsx(Kt,{icon:i.jsx(yt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Correlation Data",description:"Not enough numeric columns to compute correlations."})]});const u=async(m,p,g)=>{if(m){a(g);try{const w=wr(),y=20,b=m.columns.slice(0,y),x=m.values.slice(0,y).map(A=>A.slice(0,y)),N=60,P=document.createElement("canvas"),j=P.getContext("2d");if(!j)return;j.font="12px sans-serif";let M=0;b.forEach(A=>{const I=j.measureText(A).width;I>M&&(M=I)});const D=M+40,S=M*.7+60,G=60,fe=D+b.length*N+50,le=S+b.length*N+G+50;P.width=fe,P.height=le,j.fillStyle=w.bgColor,j.fillRect(0,0,fe,le),j.fillStyle=w.textColor,j.font="bold 24px sans-serif",j.textAlign="center",j.fillText(p,fe/2,40);const ne=A=>{if(A===null)return w.bgColor==="#ffffff"?"#f3f4f6":"#374151";const I=Math.max(.2,Math.abs(A));return A>0?`rgba(239, 68, 68, ${I})`:`rgba(59, 130, 246, ${I})`};j.font="12px sans-serif",j.textBaseline="middle",x.forEach((A,I)=>{j.fillStyle=w.textColor,j.textAlign="right",j.fillText(b[I],D-10,S+G+I*N+N/2),A.forEach((V,B)=>{const H=D+B*N,re=S+G+I*N;j.fillStyle=ne(V),j.fillRect(H,re,N-2,N-2),V!==null&&(j.fillStyle=Math.abs(V)>.5?"#ffffff":w.textColor,j.textAlign="center",j.fillText(V.toFixed(2),H+N/2,re+N/2))})}),j.save(),b.forEach((A,I)=>{const V=D+I*N+N/2,B=S+G-10;j.translate(V,B),j.rotate(-Math.PI/4),j.fillStyle=w.textColor,j.textAlign="left",j.fillText(A,0,0),j.rotate(Math.PI/4),j.translate(-V,-B)}),j.restore();const we=document.createElement("a");we.download=g,we.href=P.toDataURL("image/png"),we.click()}finally{a(null),h(g),setTimeout(()=>h(null),1200)}}};return i.jsxs("div",{className:"space-y-8",children:[i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Feature Correlations (Multicollinearity)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation between features only. Use this to detect redundant variables (multicollinearity)."}),i.jsx("button",{onClick:()=>u(n.correlations,"Feature Correlations","feature-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="feature-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="feature-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations})]}),n.correlations_with_target&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-green-500"}),"Target Correlations (Feature Selection)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation including the target variable. Use this to identify the most predictive features."}),i.jsx("button",{onClick:()=>u(n.correlations_with_target,"Target Correlations","target-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="target-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="target-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations_with_target})]})]})},cc=({profile:n,excludedCols:l,handleToggleExclude:a})=>{var h;if(!((h=n==null?void 0:n.sample_data)!=null&&h.length))return i.jsx(Kt,{icon:i.jsx(mr,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Sample Data",description:"No sample rows available for this dataset."});const d=Object.keys(n.sample_data[0]||{}).filter(u=>!l.includes(u)&&!u.endsWith("_encoded"));return i.jsxs("div",{className:"mt-4 overflow-x-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsx("tr",{children:d.map(u=>i.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider group",children:i.jsxs("div",{className:"flex items-center gap-2",children:[u,i.jsx("button",{onClick:m=>{m.stopPropagation(),a(u,!0)},className:"p-1 rounded transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 hover:bg-red-100 text-gray-400 hover:text-red-500 dark:hover:bg-red-900/30",title:"Exclude from analysis","aria-label":"Exclude from analysis",children:i.jsx(Ut,{className:"w-3 h-3"})})]})},u))})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.sample_data.slice(0,50).map((u,m)=>i.jsx("tr",{children:d.map((p,g)=>i.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:u[p]!==null?String(u[p]):i.jsx("span",{className:"italic text-gray-400",children:"null"})},g))},m))})]}),n.sample_data.length>50&&i.jsxs("div",{className:"p-4 text-center text-sm text-gray-500 border-t border-gray-200 dark:border-gray-700",children:["Showing first 50 rows of ",n.sample_data.length," sample rows."]})]})},xs=150,Yn=40,hc=()=>{const n=document.documentElement.classList.contains("dark");return{borderRadius:"5px",padding:"10px",width:xs,textAlign:"center",borderWidth:"1px",borderStyle:"solid",backgroundColor:n?"#222529":"#ffffff",color:n?"#f3f4f6":"#17102b",borderColor:n?"#666d77":"#b9b3c8"}},uc=n=>{const l=document.documentElement.classList.contains("dark");return n==="directed"?l?"#9acbfa":"#3b4bc4":l?"#abafb7":"#6b6485"},mc=(n,l)=>{const a={type:os.ArrowClosed,color:l};return n==="bidirected"?{markerStart:a,markerEnd:a}:n==="directed"?{markerEnd:a}:{}},fc=({graph:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),[p,g]=k.useState(0);k.useEffect(()=>{const y=new MutationObserver(()=>{g(b=>b+1)});return y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>y.disconnect()},[]);const w=k.useCallback((y,b)=>{try{const x=new yi.graphlib.Graph;return x.setDefaultEdgeLabel(()=>({})),x.setGraph({rankdir:"LR",nodesep:80,ranksep:200}),y.forEach(P=>{x.setNode(P.id,{width:xs,height:Yn})}),b.forEach(P=>{x.setEdge(P.source,P.target)}),yi.layout(x),{nodes:y.map(P=>{const j=x.node(P.id);return j?{...P,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:j.x-xs/2,y:j.y-Yn/2}}:{...P,position:{x:Math.random()*500,y:Math.random()*500}}}),edges:b}}catch(x){return console.error("Dagre layout failed:",x),{nodes:y.map((P,j)=>({...P,position:{x:j%3*250,y:Math.floor(j/3)*100}})),edges:b}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0){a([]),u([]);return}const y=new Map(n.nodes.map((P,j)=>[P.id,`causal-node-${j}`])),b=n.nodes.map((P,j)=>({id:`causal-node-${j}`,data:{label:P.label},position:{x:0,y:0},style:hc()})),x=n.edges.flatMap((P,j)=>{const M=y.get(P.source),D=y.get(P.target);if(M===void 0||D===void 0)return[];const S=uc(P.type);return[{id:`e${j}`,source:M,target:D,animated:!0,type:"default",label:P.type==="directed"?"causes":P.type==="bidirected"?"confounded":"related",labelStyle:{fill:"hsl(var(--foreground))",fontSize:12},labelBgStyle:{fill:"hsl(var(--card))"},style:{stroke:S,strokeDasharray:P.type==="directed"?"0":"5 5"},...mc(P.type,S)}]}),N=w(b,x);a(N.nodes),u(N.edges)},[n,w,a,u,p]),i.jsx("div",{className:"space-y-2",children:i.jsx("div",{style:{width:"100%",height:"500px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900"}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})})})};function gc(n){switch(n){case"all":return"This graph includes all eligible numeric variables; no feature cap was needed.";case"target_correlation":return"This graph includes the selected numeric target and up to 14 numeric features with the strongest absolute Pearson correlations to it.";case"variance":return"This graph includes up to 15 of the highest-variance numeric variables; no eligible numeric target was used for selection.";default:return"Causal discovery is limited to up to 15 numeric variables. Selection details were not recorded for this report."}}const pc=({profile:n})=>{var m;const l=n.causal_graph,[a,d]=k.useState("idle"),h=k.useCallback(()=>{const p=document.querySelector("#causal-chart .react-flow__viewport");if(!p)return;d("downloading");const w=document.documentElement.classList.contains("dark")?"#111827":"#f9fafb";ws(p,{backgroundColor:w,pixelRatio:2,filter:y=>{const b=y==null?void 0:y.classList;return b?!b.contains("react-flow__controls")&&!b.contains("react-flow__minimap"):!0}}).then(y=>{const b=document.createElement("a");b.download="causal-discovery.png",b.href=y,b.click()}).catch(y=>{console.error("Causal graph download failed",y),Wt.error("Causal graph download failed",String(y))}).finally(()=>{d("done"),setTimeout(()=>d("idle"),1200)})},[]),u=i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason});return(m=l==null?void 0:l.nodes)!=null&&m.length?i.jsx("div",{className:"space-y-6 mt-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Causal Discovery (PC Algorithm)",i.jsx(_e,{text:"Inferred causal structure using the Peter-Clark algorithm. Arrows (A->B) suggest A causes B. Lines (A-B) suggest correlation without clear direction. Bidirected arrows (A<->B) suggest a hidden common cause."})]}),i.jsx("button",{onClick:h,disabled:a!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download Chart",children:a==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):a==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:[i.jsx("strong",{children:"Disclaimer:"})," This graph is inferred purely from observational data. Correlation does not imply causation. Use this as a hypothesis generation tool, not absolute truth."]}),u,i.jsx("div",{id:"causal-chart",children:i.jsx(fc,{graph:l})}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:gc(l.selection_method)})]})}):i.jsxs("div",{className:"p-8 text-center text-gray-500",children:[i.jsx(wt,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"No causal graph available. This might be because there are fewer than 2 numeric columns or the analysis failed."}),u]})},Xn=220,Qn=100;function xc(n,l){if(n.feature===void 0||n.threshold===void 0)return"";const a=l==null?void 0:l[n.feature];if(a){const d=a.filter((h,u)=>u<=n.threshold);return`${n.feature} in [${d.join(", ")}]`}return`${n.feature} <= ${n.threshold.toFixed(2)}`}const _c=({data:n})=>{const l=n.is_leaf,a=n.value.reduce((u,m)=>u+m,0),d=n.value.length>0?Math.max(...n.value):0,h=a>0?d/a*100:0;return i.jsxs("div",{className:`px-4 py-3 shadow-md rounded-md border-2 ${l?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-blue-500 bg-white dark:bg-gray-800"} min-w-[200px]`,children:[i.jsx(Rn,{type:"target",position:vt.Left,className:"w-3 h-3 !bg-gray-400"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("div",{className:"font-bold text-sm text-gray-900 dark:text-white border-b pb-1 mb-1",children:l?i.jsxs("span",{className:"flex items-center gap-2 text-green-700 dark:text-green-400",children:[i.jsx(lr,{className:"w-4 h-4"}),"Prediction: ",n.class_name]}):i.jsxs("span",{className:"flex items-center gap-2 text-blue-700 dark:text-blue-400",children:[i.jsx(ko,{className:"w-4 h-4"}),xc(n,n.categories)]})}),i.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[i.jsxs(jr,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Samples:"})}),i.jsx(ms,{children:i.jsx("p",{children:"The number of data points that fall into this rule bucket."})})]}),i.jsx("span",{className:"font-mono",children:n.samples})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Purity:"})}),i.jsx(ms,{children:i.jsx("p",{className:"max-w-xs",children:"The percentage of samples in this node that belong to the majority class. Higher purity means a clearer separation."})})]}),i.jsxs("span",{className:`font-mono ${h>80?"text-green-600 font-bold":""}`,children:[h.toFixed(1),"%"]})]})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full mt-1 overflow-hidden flex",children:n.value.map((u,m)=>i.jsx("div",{style:{width:`${a>0?u/a*100:0}%`,backgroundColor:`hsl(${m*137.5}, 70%, 50%)`},title:`Class ${m}: ${u}`},m))})]})]}),i.jsx(Rn,{type:"source",position:vt.Right,className:"w-3 h-3 !bg-gray-400"})]})},yc={decision:_c},vc=({tree:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),p=k.useCallback((g,w)=>{try{const y=new yi.graphlib.Graph;return y.setDefaultEdgeLabel(()=>({})),y.setGraph({rankdir:"LR",nodesep:50,ranksep:150}),g.forEach(x=>{y.setNode(x.id,{width:Xn,height:Qn})}),w.forEach(x=>{y.setEdge(x.source,x.target)}),yi.layout(y),{nodes:g.map(x=>{const N=y.node(x.id);return{...x,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:N?N.x-Xn/2:0,y:N?N.y-Qn/2:0}}}),edges:w}}catch(y){return console.error("Dagre layout failed:",y),{nodes:g,edges:w}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0)return;const g=n.nodes.map(b=>({id:b.id.toString(),type:"decision",data:{...b,categories:n.categories},position:{x:0,y:0}})),w=[];n.nodes.forEach(b=>{b.children&&b.children.length>0&&(b.children[0]!==void 0&&w.push({id:`e${b.id}-${b.children[0]}`,source:b.id.toString(),target:b.children[0].toString(),label:"True",type:"smoothstep",style:{stroke:"#22c55e",strokeWidth:2},labelStyle:{fill:"#22c55e",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#22c55e"}}),b.children[1]!==void 0&&w.push({id:`e${b.id}-${b.children[1]}`,source:b.id.toString(),target:b.children[1].toString(),label:"False",type:"smoothstep",style:{stroke:"#ef4444",strokeWidth:2},labelStyle:{fill:"#ef4444",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#ef4444"}}))});const y=p(g,w);a(y.nodes),u(y.edges)},[n,p,a,u]),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{style:{width:"100%",height:"600px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,nodeTypes:yc,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900",gap:16,size:1}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic flex items-center gap-1",children:[i.jsx(jt,{className:"w-3 h-3"}),"This tree is a ",i.jsx("strong",{children:"surrogate (explanatory) model"})," trained on your data to surface readable rules. Do not treat it as a production-grade predictor. Green paths mean the condition is met (True); red paths mean it is not (False)."]})]})},bc=({profile:n})=>{const l=n==null?void 0:n.rule_tree,a=at();return l?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[i.jsx(ds,{className:"w-5 h-5 text-blue-600"}),"Decision Tree Analysis"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["This is a ",i.jsx("strong",{children:"surrogate model"}),": a simple decision tree trained on your dataset to approximate the relationship between features and the target. Use it for interpretation (human-readable rules), not as a causal claim or a production model."]})]}),l.accuracy&&i.jsx(jr,{children:i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsxs("div",{className:"text-sm bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 px-3 py-1 rounded-full border border-blue-200 dark:border-blue-800 cursor-help",children:["Tree Fidelity: ",i.jsxs("strong",{children:[(l.accuracy*100).toFixed(1),"%"]})]})}),i.jsx(ms,{children:i.jsxs("p",{className:"max-w-xs",children:[i.jsx("strong",{children:"Tree Fidelity:"})," How closely this surrogate tree matches the patterns in your data (higher is better). If fidelity is low, treat extracted rules as exploratory."]})})]})})]}),i.jsx(vc,{tree:l})]}),l.feature_importances&&l.feature_importances.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[i.jsx(No,{className:"w-5 h-5 text-blue-600"}),"Feature Importance (Surrogate Model)"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:["Importances reflect what the ",i.jsx("strong",{children:"surrogate tree"})," used to split the data. They may differ from a more complex model’s importances."]}),i.jsx("div",{className:"h-80 w-full",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:l.feature_importances.slice(0,10),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!0,vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{type:"number",domain:[0,"auto"],hide:!0}),i.jsx(Qe,{dataKey:"feature",type:"category",width:150,tick:{fontSize:12,fill:a.axisColor},interval:0}),i.jsx(He,{formatter:d=>[(d*100).toFixed(1)+"%","Importance"],contentStyle:a.tooltipContentStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"importance",radius:[0,4,4,0],barSize:20,children:l.feature_importances.slice(0,10).map((d,h)=>i.jsx(js,{fill:`hsl(217, 91%, ${60-h*3}%)`},`cell-${h}`))})]})})}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 text-center",children:"Showing top 10 features driving the decision rules."})]}),l.rules&&l.rules.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4",children:"Segmentation-Decision Tree (Surrogate Model)"}),i.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:l.rules.map((d,h)=>i.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-900 rounded border border-gray-100 dark:border-gray-700 text-sm font-mono text-gray-700 dark:text-gray-300",children:d},h))})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8",children:[i.jsx(ds,{className:"w-12 h-12 mb-4 text-gray-300 dark:text-gray-600"}),i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Decision Tree Not Available"}),i.jsx("p",{className:"text-center max-w-md mb-4",children:"No tree was generated. This usually happens if the dataset is too small, or if a target column was not selected for analysis."}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 dark:bg-amber-900/20 dark:text-amber-400 px-4 py-2 rounded-md",children:[i.jsx(bt,{className:"w-4 h-4"}),i.jsxs("span",{children:["Ensure you have selected a ",i.jsx("strong",{children:"Target Column"})," and re-run the analysis."]})]})]})},wc=20,_t=new Map;function _s(n){return n.filter_value===void 0?n.name:n.filter_value}function Ft(n){return JSON.stringify([_s(n)])}function jc(n,l){if(_t.delete(n),_t.set(n,l),_t.size>wc){const a=_t.keys().next().value;a!==void 0&&_t.delete(a)}}const kc=({datasetId:n,measureCol:l,measureAgg:a,columns:d,initialFilters:h})=>{const[u,m]=k.useState([]),[p,g]=k.useState(!1),[w,y]=k.useState(null),[b,x]=k.useState([null]),N=k.useRef(null),P=k.useRef(null),j=k.useRef(0),[M,D]=k.useState([]);k.useEffect(()=>{N.current&&N.current.scrollTo({left:N.current.scrollWidth,behavior:"smooth"})},[u.length]);const S=()=>{if(!P.current)return;const A=[],I=P.current.getBoundingClientRect();u.forEach((V,B)=>{if(B>=u.length-1)return;const H=V.items.findIndex(ie=>Ft(ie)===V.selectedItemKey);if(H<0)return;const re=`node-${B}-${H}`,Z=document.getElementById(re);if(Z){const ie=Z.getBoundingClientRect(),Q=ie.right-I.left,ge=ie.top+ie.height/2-I.top;let O,ce;const z=u[B+1];if(!z)return;if(z.selectedItemKey){const q=z.items.findIndex(se=>Ft(se)===z.selectedItemKey),ee=`node-${B+1}-${q}`,oe=document.getElementById(ee);if(oe){const se=oe.getBoundingClientRect();O=se.left-I.left,ce=se.top+se.height/2-I.top}else return}else{const q=`list-${B+1}`,ee=document.getElementById(q);if(ee){const oe=ee.getBoundingClientRect();O=oe.left-I.left,ce=oe.top+oe.height/2-I.top}else return}if(O!==void 0&&ce!==void 0){const q=(Q+O)/2,ee=`M ${Q} ${ge} C ${q} ${ge}, ${q} ${ce}, ${O} ${ce}`;A.push({d:ee})}}}),D(A)};$t.useLayoutEffect(()=>{S()},[u,w]),k.useEffect(()=>{if(u.length>0){const A=`${n}-${l}-${a}`;jc(A,{levels:u,splitPath:b})}},[u,b,n,l,a]),k.useEffect(()=>{const A=`${n}-${l}-${a}`,I=_t.get(A);I?(m(I.levels),x(I.splitPath)):G()},[n,l,a]);const G=async()=>{const A=++j.current;g(!0);try{const I=await qe.getDecomposition(n,l==="count"?null:l,a,"",h);if(A!==j.current)return;m([{id:"root",splitColumn:null,items:I,selectedItemKey:null,filters:h}]),x([null])}catch(I){A===j.current&&console.error(I)}finally{A===j.current&&g(!1)}},fe=(A,I)=>{var Z,ie,Q,ge,O;const V=u[A];if(!V||!V.selectedItemKey)return;const B=V.items.find(ce=>Ft(ce)===V.selectedItemKey);if(!B)return;const H=I.currentTarget.getBoundingClientRect(),re=(Z=N.current)==null?void 0:Z.getBoundingClientRect();if(re){let ce=H.right-re.left+10,z=H.top-re.top;const q=((Q=(ie=N.current)==null?void 0:ie.parentElement)==null?void 0:Q.clientWidth)||window.innerWidth;ce+260>q&&(ce=H.left-re.left-270);const ee=((O=(ge=N.current)==null?void 0:ge.parentElement)==null?void 0:O.clientHeight)||window.innerHeight;z+300>ee&&(z=ee-310),y({levelIndex:A,item:B,x:ce,y:z})}},le=async(A,I)=>{const V=u[A];if(!V)return;const B={...V,selectedItemKey:Ft(I)},H=u.map((Z,ie)=>ie===A?B:Z),re=b[A+1];if(re){const Z=++j.current;g(!0);try{const ie=[...B.filters];B.splitColumn&&ie.push({column:B.splitColumn,operator:"==",value:_s(I)});const Q=await qe.getDecomposition(n,l==="count"?null:l,a,re,ie);if(Z!==j.current)return;const ge={id:`level-${A+1}`,splitColumn:re,items:Q,selectedItemKey:null,filters:ie},O=[...H.slice(0,A+1),ge];m(O),x(b.slice(0,A+2))}catch(ie){Z===j.current&&console.error(ie)}finally{Z===j.current&&g(!1)}}else m(H)},ne=async A=>{if(!w)return;const{levelIndex:I,item:V}=w;y(null);const B=++j.current;g(!0);try{const H=u[I];if(!H)return;const re=[...H.filters];H.splitColumn&&re.push({column:H.splitColumn,operator:"==",value:_s(V)});const Z=await qe.getDecomposition(n,l==="count"?null:l,a,A,re);if(B!==j.current)return;const ie={id:`level-${I+1}`,splitColumn:A,items:Z,selectedItemKey:null,filters:re},Q=[...u.slice(0,I+1),ie];m(Q);const ge=[...b.slice(0,I+1),A];x(ge)}catch(H){B===j.current&&console.error(H)}finally{B===j.current&&g(!1)}},we=A=>{m(u.slice(0,A)),x(b.slice(0,A))};return i.jsxs("div",{className:"relative w-full h-[600px] bg-slate-50 dark:bg-slate-900 overflow-hidden flex flex-col",children:[p&&i.jsx("div",{className:"absolute top-2 right-2 z-50",children:i.jsx(be,{className:"w-5 h-5 animate-spin text-blue-500"})}),i.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",ref:N,children:i.jsxs("div",{className:"flex h-full p-8 min-w-max gap-12 relative",ref:P,children:[u.map((A,I)=>i.jsxs("div",{className:"flex flex-col w-[200px] h-full relative z-10",children:[i.jsxs("div",{id:`header-${I}`,className:"flex items-center justify-between mb-4 bg-white dark:bg-slate-800 p-2 rounded shadow-sm border border-slate-200 dark:border-slate-700",children:[i.jsx("span",{className:"font-semibold text-sm text-slate-700 dark:text-slate-200",children:A.splitColumn||"Total"}),i.jsxs("div",{className:"flex items-center gap-1",children:[I===u.length-1&&i.jsx("button",{onClick:V=>fe(I,V),className:` diff --git a/static/ml_canvas/assets/InferencePage-BvDNVaSU.js b/static/ml_canvas/assets/InferencePage-fhCsGe-z.js similarity index 99% rename from static/ml_canvas/assets/InferencePage-BvDNVaSU.js rename to static/ml_canvas/assets/InferencePage-fhCsGe-z.js index aec9f7d44..62e60dbc1 100644 --- a/static/ml_canvas/assets/InferencePage-BvDNVaSU.js +++ b/static/ml_canvas/assets/InferencePage-fhCsGe-z.js @@ -1,4 +1,4 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as ge,B as Ie,P as kt,f as X,v as me,X as $e,w as Ae,x as Pe,y as he,W as Nt,z as pe,D as _e,l as Le,h as Je,E as vt,I as St,J as Ct,K as Rt,N as It,t as Ot}from"./vendor-utils-VkF_O5b_.js";import{d as be,D as Oe,t as O,n as Ft,o as Mt,a as Et,q as Tt,b as Dt,E as $t}from"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";const re=`[ +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as ge,B as Ie,P as kt,f as X,v as me,X as $e,w as Ae,x as Pe,y as he,W as Nt,z as pe,D as _e,l as Le,h as Je,E as vt,I as St,J as Ct,K as Rt,N as It,t as Ot}from"./vendor-utils-VkF_O5b_.js";import{d as be,D as Oe,t as O,n as Ft,o as Mt,a as Et,q as Tt,b as Dt,E as $t}from"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";const re=`[ { "feature1": 0.5, "feature2": 1.2 diff --git a/static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js b/static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js similarity index 99% rename from static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js rename to static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js index c7a6a8247..1721c454d 100644 --- a/static/ml_canvas/assets/ModelRegistry-Bw2YKOFO.js +++ b/static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; diff --git a/static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js b/static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js similarity index 99% rename from static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js rename to static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js index 8bb7a705c..287917648 100644 --- a/static/ml_canvas/assets/SlowNodesPage-DjArPNLO.js +++ b/static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-BR7Y881F.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-C87GWrUj.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; diff --git a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js similarity index 83% rename from static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js rename to static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js index f2c7cc220..7a451d730 100644 --- a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-BA-XXAuE.js +++ b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p as f}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as n,l as o}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; +import{g as p,r as u,d as a}from"./chunk-SVP7TREG-DpJhy_Kq.js";import{p as f}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as n,l as o}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; diff --git a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js similarity index 99% rename from static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js rename to static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js index 97dfe349a..fb758c689 100644 --- a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BxKLzAsN.js +++ b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js @@ -1,4 +1,4 @@ -import{p as qe}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-Bh6LVe7i.js";import{p as cr}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` +import{p as qe}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-CiBTFoht.js";import{p as cr}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; diff --git a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js similarity index 99% rename from static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js rename to static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js index 022599d07..8adc31f81 100644 --- a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-j0yjDlHD.js +++ b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js @@ -1,4 +1,4 @@ -import{g as Pe}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-Bh6LVe7i.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-D4R-Rc0m.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: +import{g as Pe}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-CiBTFoht.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-YEV_Sjpu.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: `+b.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":se="Parse error on line "+(f+1)+": Unexpected "+(B==M?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(se,{text:b.match,token:this.terminals_[B]||B,line:b.yylineno,loc:H,expected:q})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(P[0]){case 1:o.push(B),L.push(b.yytext),t.push(b.yylloc),o.push(P[1]),B=null,w=b.yyleng,n=b.yytext,f=b.yylineno,H=b.yylloc;break;case 2:if(W=this.productions_[P[1]][1],U.$=L[L.length-W],U._$={first_line:t[t.length-(W||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(W||1)].first_column,last_column:t[t.length-1].last_column},ee&&(U._$.range=[t[t.length-(W||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(U,[n,w,f,R.yy,P[1],L,t].concat(K)),typeof te<"u")return te;W&&(o=o.slice(0,-1*W*2),L=L.slice(0,-1*W),t=t.slice(0,-1*W)),o.push(this.productions_[P[1]][0]),L.push(U.$),t.push(U._$),fe=O[o[o.length-2]][o[o.length-1]],o.push(fe);break;case 3:return!0}}return!0},"parse")},D=(function(){var T={EOF:1,parseError:g(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:g(function(h,i){return this.yy=i||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var i=h.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:g(function(h){var i=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var L=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===u.length?this.yylloc.first_column:0)+u[u.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[L[0],L[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(h){this.unput(this.match.slice(h))},"less"),pastInput:g(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var h=this.pastInput(),i=new Array(h.length+1).join("-");return h+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js similarity index 99% rename from static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js rename to static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js index dc8f11196..90a5ff479 100644 --- a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-9wb6NkWK.js +++ b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js @@ -1,4 +1,4 @@ -import{d as Le}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-Bh6LVe7i.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: +import{d as Le}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-CiBTFoht.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: `+A.showPosition()+` Expecting `+Yt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":Gt="Parse error on line "+(xt+1)+": Unexpected "+(M==le?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[M]||M,line:A.yylineno,loc:Qt,expected:Yt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Et+", token: "+M);switch(V[0]){case 1:E.push(M),D.push(A.yytext),i.push(A.yylloc),E.push(V[1]),M=null,oe=A.yyleng,p=A.yytext,xt=A.yylineno,Qt=A.yylloc;break;case 2:if(j=this.productions_[V[1]][1],Tt.$=D[D.length-j],Tt._$={first_line:i[i.length-(j||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(j||1)].first_column,last_column:i[i.length-1].last_column},Ne&&(Tt._$.range=[i[i.length-(j||1)].range[0],i[i.length-1].range[1]]),Kt=this.performAction.apply(Tt,[p,oe,xt,vt.yy,V[1],D,i].concat(De)),typeof Kt<"u")return Kt;j&&(E=E.slice(0,-1*j*2),D=D.slice(0,-1*j),i=i.slice(0,-1*j)),E.push(this.productions_[V[1]][0]),D.push(Tt.$),i.push(Tt._$),ue=Pt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Oe=(function(){var yt={EOF:1,parseError:d(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),setInput:d(function(b,x){return this.yy=x||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var x=b.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},"input"),unput:d(function(b){var x=b.length,E=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(b){this.unput(this.match.slice(b))},"less"),pastInput:d(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var b=this.pastInput(),x=new Array(b.length+1).join("-");return b+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/channel-D4R-Rc0m.js b/static/ml_canvas/assets/channel-D4R-Rc0m.js deleted file mode 100644 index da2c50bcc..000000000 --- a/static/ml_canvas/assets/channel-D4R-Rc0m.js +++ /dev/null @@ -1 +0,0 @@ -import{Y as a,$ as n}from"./mermaid.core-Bh6LVe7i.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/channel-YEV_Sjpu.js b/static/ml_canvas/assets/channel-YEV_Sjpu.js new file mode 100644 index 000000000..c42c8b2c6 --- /dev/null +++ b/static/ml_canvas/assets/channel-YEV_Sjpu.js @@ -0,0 +1 @@ +import{Y as a,$ as n}from"./mermaid.core-CiBTFoht.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js b/static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js similarity index 66% rename from static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js rename to static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js index cd7254285..e347e243e 100644 --- a/static/ml_canvas/assets/chunk-2Q5K7J3B-bOW8kvkF.js +++ b/static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-Bh6LVe7i.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; +import{_ as s}from"./mermaid.core-CiBTFoht.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; diff --git a/static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js b/static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js similarity index 83% rename from static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js rename to static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js index b54492b29..5026f1d36 100644 --- a/static/ml_canvas/assets/chunk-5VM5RSS4-C6GC8vvo.js +++ b/static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-Bh6LVe7i.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-CiBTFoht.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js b/static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js similarity index 96% rename from static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js rename to static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js index b6d51b2a1..43e400a98 100644 --- a/static/ml_canvas/assets/chunk-F27PBJKO-CzX57j4f.js +++ b/static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js @@ -1 +1 @@ -import{_ as i,S as d,H as o}from"./mermaid.core-Bh6LVe7i.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; +import{_ as i,S as d,H as o}from"./mermaid.core-CiBTFoht.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; diff --git a/static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js b/static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js similarity index 99% rename from static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js rename to static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js index 775653ced..a13a79dac 100644 --- a/static/ml_canvas/assets/chunk-IMKFNOWR-Te9v1FIK.js +++ b/static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js @@ -1,4 +1,4 @@ -import{g as ee}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as se}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-Bh6LVe7i.js";import{f as pe}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: +import{g as ee}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as se}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-CiBTFoht.js";import{f as pe}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: `+D.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[w]||w)+"'":bt="Parse error on line "+(G+1)+": Unexpected "+(w==et?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(bt,{text:D.match,token:this.terminals_[w]||w,line:D.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(N[0]){case 1:n.push(w),_.push(D.yytext),r.push(D.yylloc),n.push(N[1]),w=null,q=D.yyleng,c=D.yytext,G=D.yylineno,_t=D.yylloc;break;case 2:if(M=this.productions_[N[1]][1],Q.$=_[_.length-M],Q._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},Zt&&(Q._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(Q,[c,q,G,H.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;M&&(n=n.slice(0,-1*M*2),_=_.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[N[1]][0]),_.push(Q.$),r.push(Q._$),Ot=Y[n[n.length-2]][n[n.length-1]],n.push(Ot);break;case 3:return!0}}return!0},"parse")},Qt=(function(){var U={EOF:1,parseError:S(function(u,n){if(this.yy.parser)this.yy.parser.parseError(u,n);else throw new Error(u)},"parseError"),setInput:S(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:S(function(l){var u=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(l){this.unput(this.match.slice(l))},"less"),pastInput:S(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js b/static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js similarity index 78% rename from static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js rename to static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js index a2cd551fa..80ead696c 100644 --- a/static/ml_canvas/assets/chunk-JWPE2WC7-B0RMgOJt.js +++ b/static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js @@ -1 +1 @@ -import{_ as l}from"./mermaid.core-Bh6LVe7i.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; +import{_ as l}from"./mermaid.core-CiBTFoht.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; diff --git a/static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js b/static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js similarity index 87% rename from static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js rename to static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js index cb6575a45..26fd3b6b6 100644 --- a/static/ml_canvas/assets/chunk-POPQ4Y6H-CGqTimen.js +++ b/static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js @@ -1 +1 @@ -import{_ as a,d as w,l as x}from"./mermaid.core-Bh6LVe7i.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; +import{_ as a,d as w,l as x}from"./mermaid.core-CiBTFoht.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; diff --git a/static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js b/static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js similarity index 99% rename from static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js rename to static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js index e0f6bc03b..b05c1be90 100644 --- a/static/ml_canvas/assets/chunk-SVP7TREG-BbXYbc8x.js +++ b/static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js @@ -1,4 +1,4 @@ -import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-Bh6LVe7i.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` +import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-CiBTFoht.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` `),C.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ie=p(()=>O,"getAccDescription"),ne=Y,ae=P,oe={clear:J,setTitle:Y,getTitle:P,addRule:Q,getRules:Z,getRule:V,setAccTitle:ee,getAccTitle:te,setAccDescription:re,getAccDescription:ie,setDiagramTitle:ne,getDiagramTitle:ae},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},le=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,se=/^[\w "',.-]+$/,de=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=p(e=>e?Object.keys(e).every(i=>i==="railroad"||de.has(i)):!1,"isRailroadStyleOptions"),ce=p(e=>e?"railroad"in e&&e.railroad?e.railroad:L(e)?e:{}:{},"extractRailroadOverrides"),me=p(e=>{if(!e||L(e))return{};const{railroad:i,svgId:a,theme:n,look:t,...r}=e;return r},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return le.test(a)?a:i},"sanitizeColorValue"),I=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return se.test(a)?a:i},"sanitizeFontFamilyValue"),F=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),he=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),pe=p(e=>{const i=I(e.fontFamily,f.fontFamily),a=he(e.fontSize)??f.fontSize;return{...f,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:m(e.lineColor,f.lineColor),markerFill:m(e.lineColor,f.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),E=p(e=>{const i=B(),a={...G(),...i.themeVariables??{},...me(e)},n=pe(a),t={...i.railroad??{},...ce(e)};return{compactMode:t.compactMode??n.compactMode,padding:F(t.padding,n.padding),verticalSeparation:F(t.verticalSeparation,n.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,n.horizontalSeparation),arcRadius:F(t.arcRadius,n.arcRadius),fontSize:F(t.fontSize,n.fontSize),fontFamily:I(t.fontFamily,n.fontFamily),terminalFill:m(t.terminalFill,n.terminalFill),terminalStroke:m(t.terminalStroke,n.terminalStroke),terminalTextColor:m(t.terminalTextColor,n.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:m(t.lineColor,n.lineColor),strokeWidth:F(t.strokeWidth,n.strokeWidth),markerFill:m(t.markerFill,n.markerFill),commentFill:m(t.commentFill,n.commentFill),commentStroke:m(t.commentStroke,n.commentStroke),commentTextColor:m(t.commentTextColor,n.commentTextColor),specialFill:m(t.specialFill,n.specialFill),specialStroke:m(t.specialStroke,n.specialStroke),ruleNameColor:m(t.ruleNameColor,n.ruleNameColor),showMarkers:t.showMarkers??n.showMarkers,markerRadius:F(t.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),Te=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:n,terminalStroke:t,terminalTextColor:r,nonTerminalFill:o,nonTerminalStroke:g,nonTerminalTextColor:l,lineColor:s,strokeWidth:h,markerFill:u,commentFill:c,commentStroke:w,commentTextColor:d,specialFill:T,specialStroke:z,ruleNameColor:S}=E(e);return` .railroad-diagram { font-family: ${i}; diff --git a/static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js b/static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js similarity index 99% rename from static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js rename to static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js index b19850b11..27bacaae3 100644 --- a/static/ml_canvas/assets/chunk-TICWLB2K-C_ND7Y6C.js +++ b/static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js @@ -1,4 +1,4 @@ -import{g as st}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{g as it}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as at}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-Bh6LVe7i.js";import{f as mt}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: +import{g as st}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{g as it}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as at}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-CiBTFoht.js";import{f as mt}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: `+D.showPosition()+` Expecting `+Ae.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Oe="Parse error on line "+(de+1)+": Unexpected "+(_==We?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Oe,{text:D.match,token:this.terminals_[_]||_,line:D.yylineno,loc:ve,expected:Ae})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(L[0]){case 1:p.push(_),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),_=null,Ke=D.yyleng,t=D.yytext,de=D.yylineno,ve=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],U.$=C[C.length-v],U._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},et&&(U._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),Ie=this.performAction.apply(U,[t,Ke,de,V.yy,L[1],C,e].concat($e)),typeof Ie<"u")return Ie;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(U.$),e.push(U._$),je=ee[p[p.length-2]][p[p.length-1]],p.push(je);break;case 3:return!0}}return!0},"parse")},Je=(function(){var O={EOF:1,parseError:g(function(d,p){if(this.yy.parser)this.yy.parser.parseError(d,p);else throw new Error(d)},"parseError"),setInput:g(function(o,d){return this.yy=d||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var d=o.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:g(function(o){var d=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(o){this.unput(this.match.slice(o))},"less"),pastInput:g(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var o=this.pastInput(),d=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js b/static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js similarity index 76% rename from static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js rename to static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js index 3170453d9..1f68d904c 100644 --- a/static/ml_canvas/assets/chunk-XXDRQBXY-BLKLIunJ.js +++ b/static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-Bh6LVe7i.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; +import{_ as s}from"./mermaid.core-CiBTFoht.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js deleted file mode 100644 index a3bf4eb30..000000000 --- a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BL29_2U2.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-C_ND7Y6C.js";import{_ as i}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-C6GC8vvo.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js new file mode 100644 index 000000000..0e0e3e57c --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DbX59BGa.js";import{_ as i}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-BK7j-D0z.js";import"./chunk-XXDRQBXY-B1omEyzC.js";import"./chunk-POPQ4Y6H-CVdo-unt.js";import"./chunk-F27PBJKO-DEK_ZtH8.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js deleted file mode 100644 index a3bf4eb30..000000000 --- a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BL29_2U2.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-C_ND7Y6C.js";import{_ as i}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-C6GC8vvo.js";import"./chunk-XXDRQBXY-BLKLIunJ.js";import"./chunk-POPQ4Y6H-CGqTimen.js";import"./chunk-F27PBJKO-CzX57j4f.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js new file mode 100644 index 000000000..0e0e3e57c --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DbX59BGa.js";import{_ as i}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-BK7j-D0z.js";import"./chunk-XXDRQBXY-B1omEyzC.js";import"./chunk-POPQ4Y6H-CVdo-unt.js";import"./chunk-F27PBJKO-DEK_ZtH8.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js similarity index 99% rename from static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js rename to static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js index 00b374f9c..735ec9c88 100644 --- a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B9wHaWDG.js +++ b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js @@ -1 +1 @@ -import{_ as V,l as k}from"./mermaid.core-Bh6LVe7i.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; +import{_ as V,l as k}from"./mermaid.core-CiBTFoht.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; diff --git a/static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js b/static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js similarity index 99% rename from static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js rename to static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js index 2e8c4a254..0c352cf2a 100644 --- a/static/ml_canvas/assets/cynefin-OW5HDTMX-B9uzoGfR.js +++ b/static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js @@ -1,4 +1,4 @@ -var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-BR7Y881F.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` +var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-C87GWrUj.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` `,`\r `,"\r"],(function(a){function i(c,f,d,p){return new iv(c,f,d,p)}s(i,"create"),a.create=i;function o(c){let f=c;return!!(C.defined(f)&&C.string(f.uri)&&(C.undefined(f.languageId)||C.string(f.languageId))&&C.uinteger(f.lineCount)&&C.func(f.getText)&&C.func(f.positionAt)&&C.func(f.offsetAt))}s(o,"is"),a.is=o;function u(c,f){let d=c.getText(),p=l(f,(y,v)=>{let E=y.range.start.line-v.range.start.line;return E===0?y.range.start.character-v.range.start.character:E}),h=d.length;for(let y=p.length-1;y>=0;y--){let v=p[y],E=c.offsetAt(v.range.start),T=c.offsetAt(v.range.end);if(T<=h)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");h=E}return d}s(u,"applyEdits"),a.applyEdits=u;function l(c,f){if(c.length<=1)return c;const d=c.length/2|0,p=c.slice(0,d),h=c.slice(d);l(p,f),l(h,f);let y=0,v=0,E=0;for(;y({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` +import{p as ht}from"./chunk-JWPE2WC7-CSEprKif.js";import{s as gt,g as $t,n as bt,m as Ct,a as wt,b as vt,_ as i,l as O,C as Dt,d as kt,o as At,z as U,x as Q,A as Tt,E as ot}from"./mermaid.core-CiBTFoht.js";import{p as Bt}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var rt=i(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` .cynefinDomain { stroke: none; } diff --git a/static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js b/static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js similarity index 98% rename from static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js rename to static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js index 7fee45170..de5f37e99 100644 --- a/static/ml_canvas/assets/dagre-GXQ25YYZ-B4MP3Plp.js +++ b/static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js @@ -1,4 +1,4 @@ -import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-Bh6LVe7i.js";import{l as U}from"./layout-s0gQ8r44.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX +import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-CiBTFoht.js";import{l as U}from"./layout-DWasCRDD.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX Node.id = `,f,` data=`,u.height,` Parent cluster`,s.height),e.setNode(s.id,u),e.parent(f)||(p.trace("Setting parent",f,s.id),e.setParent(f,s.id,u))}if(p.info("(Insert) Node XXX"+f+": "+JSON.stringify(e.node(f))),n!=null&&n.clusterNode){p.info("Cluster identified XBX",f,n.width,e.node(f));const{ranksep:u,nodesep:b}=e.graph();n.graph.setGraph({...n.graph.graph(),ranksep:u+25,nodesep:b});const x=await ne({element:l,graph:n.graph,diagramType:d,id:g,parentCluster:e.node(f),siteConfig:h}),S=x.elem;T(n,S),n.diff=x.diff||0,p.info("New compound node after recursive render XAX",f,"width",n.width,"height",n.height),z(S,n)}else e.children(f).length>0?(p.trace("Cluster - the non recursive path XBX",f,n.id,n,n.width,"Graph:",e),p.trace(R(n.id,e)),w.set(n.id,{id:R(n.id,e),node:n})):(p.trace("Node - the non recursive path XAX",f,l,e.node(f),L),await F(l,e.node(f),{config:h,dir:L}))})),await m(async()=>{const f=e.edges().map(async function(n){var b,x,S,X;const u=e.edge(n.v,n.w,n.name);if(p.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),p.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(e.edge(n))),p.info("Fix",w,"ids:",n.v,n.w,"Translating: ",w.get(n.v),w.get(n.w)),a&&u.selfLoop){if(u.selfLoop.order!==1)return;const N={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:((b=u.originalEdge)==null?void 0:b.startLabelLeft)??u.startLabelLeft,startLabelRight:((x=u.originalEdge)==null?void 0:x.startLabelRight)??u.startLabelRight,endLabelLeft:((S=u.originalEdge)==null?void 0:S.endLabelLeft)??u.endLabelLeft,endLabelRight:((X=u.originalEdge)==null?void 0:X.endLabelRight)??u.endLabelRight};await C(o,N),u.width=N.width,u.height=N.height,u.labelStyle=N.labelStyle;return}await C(o,u)});await Promise.all(f)},"processEdges")();const{subGraphTitleTotalMargin:y}=j(h);return{elem:r,graph:e,groups:{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r},diagramType:d,id:g,mergeSelfLoops:a,subGraphTitleTotalMargin:y}},"measureDagreGraph"),G=m(t=>{p.info("############################################# XXX"),p.info("### Layout ### XXX"),p.info("############################################# XXX"),U(t)},"runDagreGraphLayout"),te=m((t,e,d)=>{const g=t.node(e);if(!g)return;const s={...g};return g!=null&&g.clusterNode?s.y=(g.y??0)+d:t.children(e).length>0?s.height=(g.height??0)+d:s.y=(g.y??0)+d/2,s},"normalizeDagreNode"),I=m((t,e)=>{V.forEach(d=>{e[d]!==void 0&&(t[d]=e[d])})},"applyDagreNodeLayout"),re=m((t,e,d,g)=>({...t,start:t.start??e,end:t.end??d,points:(t.points??[]).map(s=>({...s,y:typeof s.y=="number"?s.y+g:s.y}))}),"normalizeDagreEdge"),ae=m((t,e)=>{const{graph:d,mergeSelfLoops:g,subGraphTitleTotalMargin:s=0}=e,h=new Map(t.nodes.map(c=>[c.id,c]));D(d).forEach(c=>{const i=te(d,c,s);if(!i)return;I(d.node(c),i);const o=h.get(c);o&&I(o,i)});const L=s/2;return t.edges=M(d,L,{mergeSelfLoops:g}).map(({edge:c,start:i,end:o})=>re(c,i,o,L)),t},"applyDagreLayoutResult"),oe=m(async({elem:t,graph:e,groups:{clusters:d,edgePaths:g},diagramType:s,id:h,mergeSelfLoops:L,subGraphTitleTotalMargin:c})=>{let i=0;await Promise.all(D(e).map(async function(r){var E;const a=e.node(r);if(p.info("Position XBX => "+r+": ("+a.x,","+a.y,") width: ",a.width," height: ",a.height),a!=null&&a.clusterNode)a.y+=c,p.info("A tainted cluster node XBX1",r,a.id,a.width,a.height,a.x,a.y,e.parent(r)),w.get(a.id).node=a,P(a);else if(e.children(r).length>0){p.info("A pure cluster node XBX1",r,a.id,a.x,a.y,a.width,a.height,e.parent(r)),a.height+=c,e.node(a.parentId);const y=(a==null?void 0:a.padding)/2||0,f=((E=a==null?void 0:a.labelBBox)==null?void 0:E.height)||0,n=f-y||0;p.debug("OffsetY",n,"labelHeight",f,"halfPadding",y),await W(d,a),w.get(a.id).node=a}else{const y=e.node(a.parentId);a.y+=c/2,p.info("A regular node XBX1 - using the padding",a.id,"parent",a.parentId,a.width,a.height,a.x,a.y,"offsetY",a.offsetY,"parent",y,y==null?void 0:y.offsetY,a),P(a)}}));const o=c/2;return M(e,o,{mergeSelfLoops:L}).forEach(function({edge:r,start:a,end:E}){p.info("Edge "+a+" -> "+E+": "+JSON.stringify(r),r),r.points.forEach(u=>u.y+=o);const y=e.node(a),f=e.node(E),n=q(g,r,w,s,y,f,h);Q(r,n)}),e.nodes().forEach(function(r){const a=e.node(r);p.info(r,a.type,a.diff),a.isGroup&&(i=a.diff)}),p.warn("Returning from recursive render XAX",t,i),{elem:t,diff:i}},"paintDagreLayoutCore"),ne=m(async t=>{const e=await k(t);return G(e.graph),await oe(e)},"renderDagreSubgraph"),O=m(t=>{var d,g,s,h,L,c;const e=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((d=t.config)==null?void 0:d.nodeSpacing)||t.nodeSpacing||((s=(g=t.config)==null?void 0:g.flowchart)==null?void 0:s.nodeSpacing),ranksep:((h=t.config)==null?void 0:h.rankSpacing)||t.rankSpacing||((c=(L=t.config)==null?void 0:L.flowchart)==null?void 0:c.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(i=>{e.setNode(i.id,{...i}),i.parentId&&e.setParent(i.id,i.parentId)}),p.debug("Edges:",t.edges),t.edges.forEach(i=>{if(i.start===i.end){const o=i.start,l=o+"---"+o+"---1",r=o+"---"+o+"---2",a=e.node(o);e.setNode(l,{domId:l,id:l,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(l,a.parentId),e.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(r,a.parentId);const E=structuredClone(i),y=structuredClone(i),f=structuredClone(i),n=structuredClone(i);y.originalEdge=E,y.selfLoop={id:E.id,order:0},f.originalEdge=E,f.selfLoop={id:E.id,order:1},n.originalEdge=E,n.selfLoop={id:E.id,order:2},y.label="",y.arrowTypeEnd="none",y.endLabelLeft="",y.endLabelRight="",y.startLabelLeft="",y.id=o+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=o+"-cyclic-special-mid",n.label="",n.startLabelRight="",n.startLabelLeft="",n.arrowTypeStart="none",a.isGroup&&(y.fromCluster=o,n.toCluster=o),n.id=o+"-cyclic-special-2",n.arrowTypeStart="none",e.setEdge(o,l,y,o+"-cyclic-special-0"),e.setEdge(l,r,f,o+"-cyclic-special-1"),e.setEdge(r,o,n,o+"-cyclic-special-2")}else e.setEdge(i.start,i.end,{...i},i.id)}),_(e),{graph:e}},"prepareLayoutForDagre"),se=m(async(t,{element:e,preparedLayout:d})=>{const g=d??O(t),s=A(),h=await k({element:e,graph:g.graph,diagramType:t.type,id:t.diagramId,parentCluster:void 0,siteConfig:s});return g.measuredLayout=h,h},"measureDagreLayout"),ie=m((t,e)=>{var g;const d=(g=e.preparedLayout)==null?void 0:g.measuredLayout;if(!d)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return G(d.graph),ae(t,d),d},"runDagreLayoutCore"),de=m((t,{measure:e})=>D(e.graph).map(d=>e.graph.node(d)).filter(Boolean),"getDagrePaintNodes"),le=m((t,e,{measure:d})=>t?d.graph.node(t):void 0,"getDagreEdgeNode"),ye=H({prepareLayout:O,measureLayout:se,runLayoutCore:ie,paintOptions:{clusterDb:w,getNodes:de,getEdgeNode:le,skipNode:m((t,{measure:e})=>!e.graph.hasNode(t.id),"skipNode"),isCluster:m((t,{measure:e})=>e.graph.hasNode(t.id)&&(e.graph.children(t.id)??[]).length>0,"isCluster")}});export{ae as applyDagreLayoutResult,M as getEdgesToRender,se as measureDagreLayout,O as prepareLayoutForDagre,ye as render,ie as runDagreLayoutCore}; diff --git a/static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js b/static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js similarity index 96% rename from static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js rename to static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js index 78838bea7..2758351af 100644 --- a/static/ml_canvas/assets/diagram-S7CK7UJ4-eE7ozkpX.js +++ b/static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js @@ -1,4 +1,4 @@ -import{I as W}from"./chunk-2Q5K7J3B-bOW8kvkF.js";import{p as X}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-Bh6LVe7i.js";import{p as te}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` +import{I as W}from"./chunk-2Q5K7J3B-CmWhNyCT.js";import{p as X}from"./chunk-JWPE2WC7-CSEprKif.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-CiBTFoht.js";import{p as te}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,L().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{X(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,L()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function z(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(z,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function T(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=z(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g(T,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=T(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),me=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=T(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),w=p+s.paddingY*2,m=r+s.paddingX+(u?d:0);a.attr("x",m),a.attr("y",t+w/2);const f=m+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:w},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",w-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+w/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),we=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,w)=>{const m=w*(h.rowIndent+h.paddingX),f=me(m,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,m-h.rowIndent,s+v/2,m,s+v/2,h.lineThickness),o=Math.max(o,m+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:w,height:m}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,w+m,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const m=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+m.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=q(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=we(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),U(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return` diff --git a/static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js b/static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js similarity index 95% rename from static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js rename to static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js index c74d8c854..658027611 100644 --- a/static/ml_canvas/assets/diagram-UQ7AKVKN-BnbQkIqG.js +++ b/static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js @@ -1,4 +1,4 @@ -import{p as I}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{s as _,g as E,n as F,m as D,a as z,b as P,_ as c,C as G,o as B,z as C,x as w,A as W,l as b,E as V,d as H}from"./mermaid.core-Bh6LVe7i.js";import{p as j}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>C({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rC({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as oe}from"./chunk-JWPE2WC7-CSEprKif.js";import{n as se,m as de,s as le,g as ce,a as me,b as ue,_ as o,l as g,c as T,y as xe,o as fe,z as ge,x as E,A as he,i as P,w as S,a6 as pe}from"./mermaid.core-CiBTFoht.js";import{p as be,i as ve}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{s as we}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),fe()},"clear");function O(){A={}}o(O,"reset");var ke=he.eventmodeling,Me=o(()=>ge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function G(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(G,"decidePositionFrame");function j(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(j,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=V(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=j(a,d,r),m=c+l.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(ve(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:G,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:le,setDiagramTitle:de,getDiagramTitle:se,setAst:I,getDiagramProps:R,getState:W},Ae={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Re=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ie(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=T(),l=we(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(l,m.maxR,c,r)),m.boxes.forEach(ne(l,c)),m.relations.forEach(ae(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,(d==null?void 0:d.padding)??30,d==null?void 0:d.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,Ve={parser:Ae,db:F,renderer:Te,styles:Ne};export{Ve as diagram}; diff --git a/static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js b/static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js similarity index 97% rename from static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js rename to static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js index 40e050130..7208d84d7 100644 --- a/static/ml_canvas/assets/diagram-VX7I27RA-CZnDwfvE.js +++ b/static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js @@ -1,4 +1,4 @@ -import{p as ge}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-Bh6LVe7i.js";import{s as Ne}from"./chunk-POPQ4Y6H-CGqTimen.js";import{p as Me}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` +import{p as ge}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-CiBTFoht.js";import{s as Ne}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{p as Me}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js b/static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js similarity index 95% rename from static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js rename to static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js index 721d0d097..e1523d01c 100644 --- a/static/ml_canvas/assets/diagram-Z3DM3KII-Cqf74g10.js +++ b/static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js @@ -1,4 +1,4 @@ -import{p as B}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-Bh6LVe7i.js";import{p as N}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` +import{p as B}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-CiBTFoht.js";import{p as N}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` .packetByte { font-size: ${t.byteFontSize}; } diff --git a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js similarity index 84% rename from static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js rename to static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js index c4d947767..35c46b5b3 100644 --- a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-BrXqZ7JF.js +++ b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js @@ -1 +1 @@ -import{g as m,r as l,d as n}from"./chunk-SVP7TREG-BbXYbc8x.js";import{p}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{_ as t,l as o}from"./mermaid.core-Bh6LVe7i.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; +import{g as m,r as l,d as n}from"./chunk-SVP7TREG-DpJhy_Kq.js";import{p}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as t,l as o}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; diff --git a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js similarity index 98% rename from static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js rename to static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js index 0e9a4db7e..c1432c0eb 100644 --- a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-ClvuHycY.js +++ b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js @@ -1,4 +1,4 @@ -import{g as Ut}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as Kt}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-Bh6LVe7i.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-D4R-Rc0m.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: +import{g as Ut}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as Kt}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-CiBTFoht.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-YEV_Sjpu.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: `+m.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Tt="Parse error on line "+(lt+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Tt,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Et,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,lt=m.yylineno,Et=m.yylloc;break;case 2:if(A=this.productions_[O[1]][1],U.$=_[_.length-A],U._$={first_line:t[t.length-(A||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(A||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(A||1)].range[0],t[t.length-1].range[1]]),St=this.performAction.apply(U,[e,Dt,lt,Y.yy,O[1],_,t].concat(Yt)),typeof St<"u")return St;A&&(d=d.slice(0,-1*A*2),_=_.slice(0,-1*A),t=t.slice(0,-1*A)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(a,h){return this.yy=h||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var h=a.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var h=a.length,d=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),h=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js b/static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js similarity index 99% rename from static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js rename to static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js index 8993a088e..f25c040c4 100644 --- a/static/ml_canvas/assets/flowDiagram-HODETNUW-B-fmyqOw.js +++ b/static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js @@ -1,4 +1,4 @@ -import{g as Xt}from"./chunk-5VM5RSS4-C6GC8vvo.js";import{g as Qt}from"./chunk-XXDRQBXY-BLKLIunJ.js";import{s as Jt}from"./chunk-POPQ4Y6H-CGqTimen.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-Bh6LVe7i.js";import{f as g1}from"./chunk-F27PBJKO-CzX57j4f.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-D4R-Rc0m.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` +import{g as Xt}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{g as Qt}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as Jt}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-CiBTFoht.js";import{f as g1}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-YEV_Sjpu.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` `)?d=m+` `:d=`{ `+m+` diff --git a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js similarity index 99% rename from static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js rename to static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js index aa67d5fcd..1c7361c7b 100644 --- a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-C6gbssAY.js +++ b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js @@ -1,4 +1,4 @@ -import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-Bh6LVe7i.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-BR7Y881F.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: +import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-CiBTFoht.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-C87GWrUj.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: `+F.showPosition()+` Expecting `+pt.join(", ")+", got '"+(this.terminals_[X]||X)+"'":Yt="Parse error on line "+(q+1)+": Unexpected "+(X==A?"end of input":"'"+(this.terminals_[X]||X)+"'"),this.parseError(Yt,{text:F.match,token:this.terminals_[X]||X,line:F.yylineno,loc:st,expected:pt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+K+", token: "+X);switch(Z[0]){case 1:m.push(X),S.push(F.yytext),i.push(F.yylloc),m.push(Z[1]),X=null,c=F.yyleng,o=F.yytext,q=F.yylineno,st=F.yylloc;break;case 2:if(tt=this.productions_[Z[1]][1],J.$=S[S.length-tt],J._$={first_line:i[i.length-(tt||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(tt||1)].first_column,last_column:i[i.length-1].last_column},nt&&(J._$.range=[i[i.length-(tt||1)].range[0],i[i.length-1].range[1]]),at=this.performAction.apply(J,[o,c,q,B.yy,Z[1],S,i].concat(R)),typeof at<"u")return at;tt&&(m=m.slice(0,-1*tt*2),S=S.slice(0,-1*tt),i=i.slice(0,-1*tt)),m.push(this.productions_[Z[1]][0]),S.push(J.$),i.push(J._$),Ut=Y[m[m.length-2]][m[m.length-1]],m.push(Ut);break;case 3:return!0}}return!0},"parse")},T=(function(){var p={EOF:1,parseError:l(function(d,m){if(this.yy.parser)this.yy.parser.parseError(d,m);else throw new Error(d)},"parseError"),setInput:l(function(a,d){return this.yy=d||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:l(function(a){var d=a.length,m=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===u.length?this.yylloc.first_column:0)+u[u.length-m.length].length-m[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(a){this.unput(this.match.slice(a))},"less"),pastInput:l(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js similarity index 99% rename from static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js rename to static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js index 8d279eaef..47776c6ce 100644 --- a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-Cwa8qaWs.js +++ b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js @@ -1,4 +1,4 @@ -import{I as he}from"./chunk-2Q5K7J3B-bOW8kvkF.js";import{p as $e}from"./chunk-JWPE2WC7-B0RMgOJt.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-Bh6LVe7i.js";import{p as Be}from"./cynefin-OW5HDTMX-B9uzoGfR.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-BR7Y881F.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` +import{I as he}from"./chunk-2Q5K7J3B-CmWhNyCT.js";import{p as $e}from"./chunk-JWPE2WC7-CSEprKif.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-CiBTFoht.js";import{p as Be}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` ${o-n/2-M/2},${u+I} ${o-n/2-M/2},${u-I} ${t.posWithOffset-n/2-M},${u-x-I} diff --git a/static/ml_canvas/assets/index-BR7Y881F.js b/static/ml_canvas/assets/index-C87GWrUj.js similarity index 73% rename from static/ml_canvas/assets/index-BR7Y881F.js rename to static/ml_canvas/assets/index-C87GWrUj.js index 1082870d0..5c35d739f 100644 --- a/static/ml_canvas/assets/index-BR7Y881F.js +++ b/static/ml_canvas/assets/index-C87GWrUj.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Bh6LVe7i.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-BvDNVaSU.js","assets/EDAPage-BkzWx__1.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-DBBkKEof.js","assets/ModelRegistry-Bw2YKOFO.js","assets/DeploymentsPage-DlnI46US.js","assets/SlowNodesPage-DjArPNLO.js","assets/AuditLogPage-DPVze77q.js"])))=>i.map(i=>d[i]); -var f0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var b0=(e,s,r)=>s in e?f0(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Pt=(e,s,r)=>b0(e,typeof s!="symbol"?s+"":s,r),zi=(e,s,r)=>s.has(e)||zd("Cannot "+r);var C=(e,s,r)=>(zi(e,s,"read from private field"),r?r.call(e):s.get(e)),ne=(e,s,r)=>s.has(e)?zd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,r),Q=(e,s,r,a)=>(zi(e,s,"write to private field"),a?a.call(e,r):s.set(e,r),r),he=(e,s,r)=>(zi(e,s,"access private method"),r);var lo=(e,s,r,a)=>({set _(n){Q(e,s,n,r)},get _(){return C(e,s,a)}});import{j as t,c as wp,b as Bi,d as y0,e as v0,f as Np,g as An,H as wl,P as as,h as j0,k as w0,l as kp,m as N0,E as k0,R as _p,i as Sp,B as Cp,C as Ep,n as Kt,M as _0}from"./vendor-flow-Ct2sLZk5.js";import{g as Rp,a as p,b as ae,af as Tp,aC as S0,X as Ee,Q as $n,f as $t,j as Te,a6 as Qe,aD as vc,aE as C0,ar as Mp,a7 as at,a5 as Fn,T as jc,aw as ds,a9 as Ct,A as E0,d as Pa,aF as ri,i as R0,u as T0,aG as M0,aH as P0,D as ge,c as us,aI as I0,C as _t,an as Nl,z as ir,e as Ut,x as Pp,aa as Ie,J as Dn,a0 as Ip,a1 as Ap,q as Es,l as ms,aJ as wc,L as Ln,w as A0,N as $0,o as Dr,aK as F0,ab as D0,m as L0,p as Ce,k as tt,aL as kl,aM as ai,aN as hn,aO as O0,_ as Ia,aP as $p,s as Nc,y as gt,ai as _l,S as lr,Y as On,az as Fp,K as Ae,ap as z0,aq as B0,R as Dp,aB as kc,aQ as xn,aR as V0,aS as _c,aT as Sc,v as tr,aU as U0,aV as Aa,aA as Lp,aW as H0,ak as gn,aX as Op,aY as zp,aZ as W0,a_ as G0,a$ as q0,b0 as Sl,b1 as K0,W as ni,t as oi,ac as Cc,b2 as Bp,b3 as J0,b4 as zn,b5 as Y0,as as Vp,b6 as Zt,ax as Ec,b7 as Q0,V as X0,am as Z0,b8 as eb,b9 as tb,ba as sb,bb as Up,bc as Hp,bd as rb,be as ab,bf as nb,bg as ob,bh as ib,Z as Cl,bi as Rc,bj as Tc,ag as Wp,bk as ii,bl as lb,bm as cb,bn as db,bo as Gp,bp as ub,bq as mb,a4 as qp,br as pb,bs as hb,h as Mc,bt as xb,bu as gb,bv as fb,bw as bb,bx as yb,H as Kp,by as Jp,bz as Yp,bA as Pc,bB as vb,bC as Bd,bD as jb,bE as wb,bF as Nb,bG as kb}from"./vendor-utils-VkF_O5b_.js";import{aY as _b,u as Sb,r as Bn,R as $e,B as Jt,C as Ue,X as Oe,Y as ze,T as Fe,h as lt,aj as Cb,ak as Eb,j as wa,ah as Lr,aZ as Rb,ag as Tb,ai as ht,av as Mb,a_ as pr,a$ as Pb,as as ct,au as hr,at as Zr,b0 as Vi,b1 as Vd}from"./vendor-charts-BkHP8M8k.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var co={},Ud;function Ib(){if(Ud)return co;Ud=1;var e=_b();return co.createRoot=e.createRoot,co.hydrateRoot=e.hydrateRoot,co}var Ab=Ib();const $b=Rp(Ab);var $a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},br,Hs,ca,up,Fb=(up=class extends $a{constructor(){super();ne(this,br);ne(this,Hs);ne(this,ca);Q(this,ca,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Hs)||this.setEventListener(C(this,ca))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Hs))==null||s.call(this),Q(this,Hs,void 0))}setEventListener(s){var r;Q(this,ca,s),(r=C(this,Hs))==null||r.call(this),Q(this,Hs,s(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(s){C(this,br)!==s&&(Q(this,br,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof C(this,br)=="boolean"?C(this,br):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},br=new WeakMap,Hs=new WeakMap,ca=new WeakMap,up),Ic=new Fb,Db={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},Ws,yc,mp,Lb=(mp=class{constructor(){ne(this,Ws,Db);ne(this,yc,!1)}setTimeoutProvider(e){Q(this,Ws,e)}setTimeout(e,s){return C(this,Ws).setTimeout(e,s)}clearTimeout(e){C(this,Ws).clearTimeout(e)}setInterval(e,s){return C(this,Ws).setInterval(e,s)}clearInterval(e){C(this,Ws).clearInterval(e)}},Ws=new WeakMap,yc=new WeakMap,mp),gr=new Lb;function Ob(e){setTimeout(e,0)}var zb=typeof window>"u"||"Deno"in globalThis;function xt(){}function Bb(e,s){return typeof e=="function"?e(s):e}function El(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qp(e,s){return Math.max(e+(s||0)-Date.now(),0)}function Zs(e,s){return typeof e=="function"?e(s):e}function wt(e,s){return typeof e=="function"?e(s):e}function Hd(e,s){const{type:r="all",exact:a,fetchStatus:n,predicate:o,queryKey:i,stale:l}=e;if(i){if(a){if(s.queryHash!==Ac(i,s.options))return!1}else if(!fn(s.queryKey,i))return!1}if(r!=="all"){const c=s.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&s.isStale()!==l||n&&n!==s.state.fetchStatus||o&&!o(s))}function Wd(e,s){const{exact:r,status:a,predicate:n,mutationKey:o}=e;if(o){if(!s.options.mutationKey)return!1;if(r){if(Mr(s.options.mutationKey)!==Mr(o))return!1}else if(!fn(s.options.mutationKey,o))return!1}return!(a&&s.state.status!==a||n&&!n(s))}function Ac(e,s){return((s==null?void 0:s.queryKeyHashFn)||Mr)(e)}function Mr(e){return JSON.stringify(e,(s,r)=>Rl(r)?Object.keys(r).sort().reduce((a,n)=>(a[n]=r[n],a),{}):r)}function fn(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(r=>fn(e[r],s[r])):!1}var Vb=Object.prototype.hasOwnProperty;function Xp(e,s,r=0){if(e===s)return e;if(r>500)return s;const a=Gd(e)&&Gd(s);if(!a&&!(Rl(e)&&Rl(s)))return s;const o=(a?e:Object.keys(e)).length,i=a?s:Object.keys(s),l=i.length,c=a?new Array(l):{};let d=0;for(let u=0;u{gr.setTimeout(s,e)})}function Tl(e,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,s):r.structuralSharing!==!1?Xp(e,s):s}function Hb(e,s,r=0){const a=[...e,s];return r&&a.length>r?a.slice(1):a}function Wb(e,s,r=0){const a=[s,...e];return r&&a.length>r?a.slice(0,-1):a}var $c=Symbol();function Zp(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===$c?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fc(e,s){return typeof e=="function"?e(...s):!!e}function Gb(e,s,r){let a=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=s()),a||(a=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var bn=(()=>{let e=()=>zb;return{isServer(){return e()},setIsServer(s){e=s}}})();function Ml(){let e,s;const r=new Promise((n,o)=>{e=n,s=o});r.status="pending",r.catch(()=>{});function a(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{a({status:"fulfilled",value:n}),e(n)},r.reject=n=>{a({status:"rejected",reason:n}),s(n)},r}var qb=Ob;function Kb(){let e=[],s=0,r=l=>{l()},a=l=>{l()},n=qb;const o=l=>{s?e.push(l):n(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&n(()=>{a(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;s++;try{c=l()}finally{s--,s||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{a=l},setScheduler:l=>{n=l}}}var et=Kb(),da,Gs,ua,pp,Jb=(pp=class extends $a{constructor(){super();ne(this,da,!0);ne(this,Gs);ne(this,ua);Q(this,ua,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),a=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){C(this,Gs)||this.setEventListener(C(this,ua))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Gs))==null||s.call(this),Q(this,Gs,void 0))}setEventListener(s){var r;Q(this,ua,s),(r=C(this,Gs))==null||r.call(this),Q(this,Gs,s(this.setOnline.bind(this)))}setOnline(s){C(this,da)!==s&&(Q(this,da,s),this.listeners.forEach(a=>{a(s)}))}isOnline(){return C(this,da)}},da=new WeakMap,Gs=new WeakMap,ua=new WeakMap,pp),zo=new Jb;function Yb(e){return Math.min(1e3*2**e,3e4)}function eh(e){return(e??"online")==="online"?zo.isOnline():!0}var Pl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function th(e){let s=!1,r=0,a;const n=Ml(),o=()=>n.status!=="pending",i=g=>{var b;if(!o()){const y=new Pl(g);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{s=!0},c=()=>{s=!1},d=()=>Ic.isFocused()&&(e.networkMode==="always"||zo.isOnline())&&e.canRun(),u=()=>eh(e.networkMode)&&e.canRun(),m=g=>{o()||(a==null||a(),n.resolve(g))},h=g=>{o()||(a==null||a(),n.reject(g))},x=()=>new Promise(g=>{var b;a=y=>{(o()||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;a=void 0,o()||(g=e.onContinue)==null||g.call(e)}),f=()=>{if(o())return;let g;const b=r===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(m).catch(y=>{var k;if(o())return;const v=e.retry??(bn.isServer()?0:3),j=e.retryDelay??Yb,w=typeof j=="function"?j(r,y):j,N=v===!0||typeof v=="number"&&rd()?void 0:x()).then(()=>{s?h(y):f()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(a==null||a(),n),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?f():x().then(f),n)}}var yr,hp,sh=(hp=class{constructor(){ne(this,yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),El(this.gcTime)&&Q(this,yr,gr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,yr)!==void 0&&(gr.clearTimeout(C(this,yr)),Q(this,yr,void 0))}},yr=new WeakMap,hp);function Qb(e){return{onFetch:(s,r)=>{var u,m,h,x,f;const a=s.options,n=(h=(m=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,o=((x=s.state.data)==null?void 0:x.pages)||[],i=((f=s.state.data)==null?void 0:f.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=j=>{Gb(j,()=>s.signal,()=>g=!0)},y=Zp(s.options,s.fetchOptions),v=async(j,w,N)=>{if(g)return Promise.reject(s.signal.reason);if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const T={client:s.client,queryKey:s.queryKey,pageParam:w,direction:N?"backward":"forward",meta:s.options.meta};return b(T),T})(),R=await y(_),{maxPages:M}=s.options,E=N?Wb:Hb;return{pages:E(j.pages,R,M),pageParams:E(j.pageParams,w,M)}};if(n&&o.length){const j=n==="backward",w=j?rh:Il,N={pages:o,pageParams:i},k=w(a,N);l=await v(N,k,j)}else{const j=e??o.length;do{const w=c===0?i[0]??a.initialPageParam:Il(a,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c{var g,b;return(b=(g=s.options).persister)==null?void 0:b.call(g,d,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=d}}}function Il(e,{pages:s,pageParams:r}){const a=s.length-1;return s.length>0?e.getNextPageParam(s[a],s,r[a],r):void 0}function rh(e,{pages:s,pageParams:r}){var a;return s.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,s[0],s,r[0],r):void 0}function p6(e,s){return s?Il(e,s)!=null:!1}function h6(e,s){return!s||!e.getPreviousPageParam?!1:rh(e,s)!=null}var ma,vr,pa,At,jr,rt,Rn,wr,jt,ah,ys,xp,Xb=(xp=class extends sh{constructor(s){super();ne(this,jt);ne(this,ma);ne(this,vr);ne(this,pa);ne(this,At);ne(this,jr);ne(this,rt);ne(this,Rn);ne(this,wr);Q(this,wr,!1),Q(this,Rn,s.defaultOptions),this.setOptions(s.options),this.observers=[],Q(this,jr,s.client),Q(this,At,C(this,jr).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Q(this,vr,Jd(this.options)),this.state=s.state??C(this,vr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ma)}get promise(){var s;return(s=C(this,rt))==null?void 0:s.promise}setOptions(s){if(this.options={...C(this,Rn),...s},s!=null&&s._type&&Q(this,ma,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Jd(this.options);r.data!==void 0&&(this.setState(Kd(r.data,r.dataUpdatedAt)),Q(this,vr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,At).remove(this)}setData(s,r){const a=Tl(this.state.data,s,this.options);return he(this,jt,ys).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(s){he(this,jt,ys).call(this,{type:"setState",state:s})}cancel(s){var a,n;const r=(a=C(this,rt))==null?void 0:a.promise;return(n=C(this,rt))==null||n.cancel(s),r?r.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,vr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>wt(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$c||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>Zs(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Qp(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(a=>a.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}onOnline(){var r;const s=this.observers.find(a=>a.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),C(this,At).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(C(this,rt)&&(C(this,wr)||he(this,jt,ah).call(this)?C(this,rt).cancel({revert:!0}):C(this,rt).cancelRetry()),this.scheduleGc()),C(this,At).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,ys).call(this,{type:"invalidate"})}async fetch(s,r){var d,u,m,h,x,f,g,b,y,v,j;if(this.state.fetchStatus!=="idle"&&((d=C(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,rt))return C(this,rt).continueRetry(),C(this,rt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const a=new AbortController,n=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Q(this,wr,!0),a.signal)})},o=()=>{const w=Zp(this.options,r),k=(()=>{const _={client:C(this,jr),queryKey:this.queryKey,meta:this.meta};return n(_),_})();return Q(this,wr,!1),this.options.persister?this.options.persister(w,k,this):w(k)},l=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,jr),state:this.state,fetchFn:o};return n(w),w})(),c=C(this,ma)==="infinite"?Qb(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Q(this,pa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&he(this,jt,ys).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Q(this,rt,th({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Pl&&w.revert&&this.setState({...C(this,pa),fetchStatus:"idle"}),a.abort()},onFail:(w,N)=>{he(this,jt,ys).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{he(this,jt,ys).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,ys).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await C(this,rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=C(this,At).config).onSuccess)==null||x.call(h,w,this),(g=(f=C(this,At).config).onSettled)==null||g.call(f,w,this.state.error,this),w}catch(w){if(w instanceof Pl){if(w.silent)return C(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,jt,ys).call(this,{type:"error",error:w}),(y=(b=C(this,At).config).onError)==null||y.call(b,w,this),(j=(v=C(this,At).config).onSettled)==null||j.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},ma=new WeakMap,vr=new WeakMap,pa=new WeakMap,At=new WeakMap,jr=new WeakMap,rt=new WeakMap,Rn=new WeakMap,wr=new WeakMap,jt=new WeakSet,ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ys=function(s){const r=a=>{switch(s.type){case"failed":return{...a,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...nh(a.data,this.options),fetchMeta:s.meta??null};case"success":const n={...a,...Kd(s.data,s.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,pa,s.manual?n:void 0),n;case"error":const o=s.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...s.state}}};this.state=r(this.state),et.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),C(this,At).notify({query:this,type:"updated",action:s})})},xp);function nh(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eh(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kd(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jd(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,r=s!==void 0,a=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ft,ye,Tn,mt,Nr,ha,vs,qs,Mn,xa,ga,kr,_r,Ks,fa,ke,cn,Al,$l,Fl,Dl,Ll,Ol,zl,oh,gp,Zb=(gp=class extends $a{constructor(s,r){super();ne(this,ke);ne(this,ft);ne(this,ye);ne(this,Tn);ne(this,mt);ne(this,Nr);ne(this,ha);ne(this,vs);ne(this,qs);ne(this,Mn);ne(this,xa);ne(this,ga);ne(this,kr);ne(this,_r);ne(this,Ks);ne(this,fa,new Set);this.options=r,Q(this,ft,s),Q(this,qs,null),Q(this,vs,Ml()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Yd(C(this,ye),this.options)?he(this,ke,cn).call(this):this.updateResult(),he(this,ke,Dl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bl(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bl(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,ke,Ll).call(this),he(this,ke,Ol).call(this),C(this,ye).removeObserver(this)}setOptions(s){const r=this.options,a=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,ke,zl).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Oo(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const n=this.hasListeners();n&&Qd(C(this,ye),a,this.options,r)&&he(this,ke,cn).call(this),this.updateResult(),n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||Zs(this.options.staleTime,C(this,ye))!==Zs(r.staleTime,C(this,ye)))&&he(this,ke,Al).call(this);const o=he(this,ke,$l).call(this);n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||o!==C(this,Ks))&&he(this,ke,Fl).call(this,o)}getOptimisticResult(s){const r=C(this,ft).getQueryCache().build(C(this,ft),s),a=this.createResult(r,s);return ty(this,a)&&(Q(this,mt,a),Q(this,ha,this.options),Q(this,Nr,C(this,ye).state)),a}getCurrentResult(){return C(this,mt)}trackResult(s,r){return new Proxy(s,{get:(a,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,vs).status==="pending"&&C(this,vs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,n))})}trackProp(s){C(this,fa).add(s)}getCurrentQuery(){return C(this,ye)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=C(this,ft).defaultQueryOptions(s),a=C(this,ft).getQueryCache().build(C(this,ft),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(s){return he(this,ke,cn).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,mt)))}createResult(s,r){var M;const a=C(this,ye),n=this.options,o=C(this,mt),i=C(this,Nr),l=C(this,ha),d=s!==a?s.state:C(this,Tn),{state:u}=s;let m={...u},h=!1,x;if(r._optimisticResults){const E=this.hasListeners(),T=!E&&Yd(s,r),S=E&&Qd(s,a,r,n);(T||S)&&(m={...m,...nh(u.data,s.options)}),r._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:b}=m;x=m.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let E;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,y=!0):E=typeof r.placeholderData=="function"?r.placeholderData((M=C(this,ga))==null?void 0:M.state.data,C(this,ga)):r.placeholderData,E!==void 0&&(b="success",x=Tl(o==null?void 0:o.data,E,r),h=!0)}if(r.select&&x!==void 0&&!y)if(o&&x===(i==null?void 0:i.data)&&r.select===C(this,Mn))x=C(this,xa);else try{Q(this,Mn,r.select),x=r.select(x),x=Tl(o==null?void 0:o.data,x,r),Q(this,xa,x),Q(this,qs,null)}catch(E){Q(this,qs,E)}C(this,qs)&&(f=C(this,qs),x=C(this,xa),g=Date.now(),b="error");const v=m.fetchStatus==="fetching",j=b==="pending",w=b==="error",N=j&&v,k=x!==void 0,R={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!j,isLoadingError:w&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&k,isStale:Dc(s,r),refetch:this.refetch,promise:C(this,vs),isEnabled:wt(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const E=R.data!==void 0,T=R.status==="error"&&!E,S=A=>{T?A.reject(R.error):E&&A.resolve(R.data)},P=()=>{const A=Q(this,vs,R.promise=Ml());S(A)},I=C(this,vs);switch(I.status){case"pending":s.queryHash===a.queryHash&&S(I);break;case"fulfilled":(T||R.data!==I.value)&&P();break;case"rejected":(!T||R.error!==I.reason)&&P();break}}return R}updateResult(){const s=C(this,mt),r=this.createResult(C(this,ye),this.options);if(Q(this,Nr,C(this,ye).state),Q(this,ha,this.options),C(this,Nr).data!==void 0&&Q(this,ga,C(this,ye)),Oo(r,s))return;Q(this,mt,r);const a=()=>{if(!s)return!0;const{notifyOnChangeProps:n}=this.options,o=typeof n=="function"?n():n;if(o==="all"||!o&&!C(this,fa).size)return!0;const i=new Set(o??C(this,fa));return this.options.throwOnError&&i.add("error"),Object.keys(C(this,mt)).some(l=>{const c=l;return C(this,mt)[c]!==s[c]&&i.has(c)})};he(this,ke,oh).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,ke,Dl).call(this)}},ft=new WeakMap,ye=new WeakMap,Tn=new WeakMap,mt=new WeakMap,Nr=new WeakMap,ha=new WeakMap,vs=new WeakMap,qs=new WeakMap,Mn=new WeakMap,xa=new WeakMap,ga=new WeakMap,kr=new WeakMap,_r=new WeakMap,Ks=new WeakMap,fa=new WeakMap,ke=new WeakSet,cn=function(s){he(this,ke,zl).call(this);let r=C(this,ye).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(xt)),r},Al=function(){he(this,ke,Ll).call(this);const s=Zs(this.options.staleTime,C(this,ye));if(bn.isServer()||C(this,mt).isStale||!El(s))return;const a=Qp(C(this,mt).dataUpdatedAt,s)+1;Q(this,kr,gr.setTimeout(()=>{C(this,mt).isStale||this.updateResult()},a))},$l=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Fl=function(s){he(this,ke,Ol).call(this),Q(this,Ks,s),!(bn.isServer()||wt(this.options.enabled,C(this,ye))===!1||!El(C(this,Ks))||C(this,Ks)===0)&&Q(this,_r,gr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ic.isFocused())&&he(this,ke,cn).call(this)},C(this,Ks)))},Dl=function(){he(this,ke,Al).call(this),he(this,ke,Fl).call(this,he(this,ke,$l).call(this))},Ll=function(){C(this,kr)!==void 0&&(gr.clearTimeout(C(this,kr)),Q(this,kr,void 0))},Ol=function(){C(this,_r)!==void 0&&(gr.clearInterval(C(this,_r)),Q(this,_r,void 0))},zl=function(){const s=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(s===C(this,ye))return;const r=C(this,ye);Q(this,ye,s),Q(this,Tn,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},oh=function(s){et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(C(this,mt))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},gp);function ey(e,s){return wt(s.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&wt(s.retryOnMount,e)===!1)}function Yd(e,s){return ey(e,s)||e.state.data!==void 0&&Bl(e,s,s.refetchOnMount)}function Bl(e,s,r){if(wt(s.enabled,e)!==!1&&Zs(s.staleTime,e)!=="static"){const a=typeof r=="function"?r(e):r;return a==="always"||a!==!1&&Dc(e,s)}return!1}function Qd(e,s,r,a){return(e!==s||wt(a.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Dc(e,r)}function Dc(e,s){return wt(s.enabled,e)!==!1&&e.isStaleByTime(Zs(s.staleTime,e))}function ty(e,s){return!Oo(e.getCurrentResult(),s)}var Pn,es,it,Sr,ts,Bs,fp,sy=(fp=class extends sh{constructor(s){super();ne(this,ts);ne(this,Pn);ne(this,es);ne(this,it);ne(this,Sr);Q(this,Pn,s.client),this.mutationId=s.mutationId,Q(this,it,s.mutationCache),Q(this,es,[]),this.state=s.state||ih(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){C(this,es).includes(s)||(C(this,es).push(s),this.clearGcTimeout(),C(this,it).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Q(this,es,C(this,es).filter(r=>r!==s)),this.scheduleGc(),C(this,it).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){C(this,es).length||(this.state.status==="pending"?this.scheduleGc():C(this,it).remove(this))}continue(){var s;return((s=C(this,Sr))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,l,c,d,u,m,h,x,f,g,b,y,v,j,w,N,k,_;const r=()=>{he(this,ts,Bs).call(this,{type:"continue"})},a={client:C(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Sr,th({fn:()=>this.options.mutationFn?this.options.mutationFn(s,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{he(this,ts,Bs).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{he(this,ts,Bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,it).canRun(this)}));const n=this.state.status==="pending",o=!C(this,Sr).canStart();try{if(n)r();else{he(this,ts,Bs).call(this,{type:"pending",variables:s,isPaused:o}),C(this,it).config.onMutate&&await C(this,it).config.onMutate(s,this,a);const M=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,s,a));M!==this.state.context&&he(this,ts,Bs).call(this,{type:"pending",context:M,variables:s,isPaused:o})}const R=await C(this,Sr).start();return await((d=(c=C(this,it).config).onSuccess)==null?void 0:d.call(c,R,s,this.state.context,this,a)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,R,s,this.state.context,a)),await((x=(h=C(this,it).config).onSettled)==null?void 0:x.call(h,R,null,this.state.variables,this.state.context,this,a)),await((g=(f=this.options).onSettled)==null?void 0:g.call(f,R,null,s,this.state.context,a)),he(this,ts,Bs).call(this,{type:"success",data:R}),R}catch(R){try{await((y=(b=C(this,it).config).onError)==null?void 0:y.call(b,R,s,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((j=(v=this.options).onError)==null?void 0:j.call(v,R,s,this.state.context,a))}catch(M){Promise.reject(M)}try{await((N=(w=C(this,it).config).onSettled)==null?void 0:N.call(w,void 0,R,this.state.variables,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,R,s,this.state.context,a))}catch(M){Promise.reject(M)}throw he(this,ts,Bs).call(this,{type:"error",error:R}),R}finally{C(this,it).runNext(this)}}},Pn=new WeakMap,es=new WeakMap,it=new WeakMap,Sr=new WeakMap,ts=new WeakSet,Bs=function(s){const r=a=>{switch(s.type){case"failed":return{...a,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...a,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:s.error,failureCount:a.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),et.batch(()=>{C(this,es).forEach(a=>{a.onMutationUpdate(s)}),C(this,it).notify({mutation:this,type:"updated",action:s})})},fp);function ih(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js,Lt,In,bp,ry=(bp=class extends $a{constructor(s={}){super();ne(this,js);ne(this,Lt);ne(this,In);this.config=s,Q(this,js,new Set),Q(this,Lt,new Map),Q(this,In,0)}build(s,r,a){const n=new sy({client:s,mutationCache:this,mutationId:++lo(this,In)._,options:s.defaultMutationOptions(r),state:a});return this.add(n),n}add(s){C(this,js).add(s);const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);a?a.push(s):C(this,Lt).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(C(this,js).delete(s)){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);if(a)if(a.length>1){const n=a.indexOf(s);n!==-1&&a.splice(n,1)}else a[0]===s&&C(this,Lt).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r),n=a==null?void 0:a.find(o=>o.state.status==="pending");return!n||n===s}else return!0}runNext(s){var a;const r=uo(s);if(typeof r=="string"){const n=(a=C(this,Lt).get(r))==null?void 0:a.find(o=>o!==s&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{C(this,js).forEach(s=>{this.notify({type:"removed",mutation:s})}),C(this,js).clear(),C(this,Lt).clear()})}getAll(){return Array.from(C(this,js))}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Wd(r,a))}findAll(s={}){return this.getAll().filter(r=>Wd(s,r))}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(s.map(r=>r.continue().catch(xt))))}},js=new WeakMap,Lt=new WeakMap,In=new WeakMap,bp);function uo(e){var s;return(s=e.options.scope)==null?void 0:s.id}var ws,Js,bt,Ns,ks,To,Vl,yp,ay=(yp=class extends $a{constructor(r,a){super();ne(this,ks);ne(this,ws);ne(this,Js);ne(this,bt);ne(this,Ns);Q(this,ws,r),this.setOptions(a),this.bindMethods(),he(this,ks,To).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const a=this.options;this.options=C(this,ws).defaultMutationOptions(r),Oo(this.options,a)||C(this,ws).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,bt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Mr(a.mutationKey)!==Mr(this.options.mutationKey)?this.reset():((n=C(this,bt))==null?void 0:n.state.status)==="pending"&&C(this,bt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,bt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,ks,To).call(this),he(this,ks,Vl).call(this,r)}getCurrentResult(){return C(this,Js)}reset(){var r;(r=C(this,bt))==null||r.removeObserver(this),Q(this,bt,void 0),he(this,ks,To).call(this),he(this,ks,Vl).call(this)}mutate(r,a){var n;return Q(this,Ns,a),(n=C(this,bt))==null||n.removeObserver(this),Q(this,bt,C(this,ws).getMutationCache().build(C(this,ws),this.options)),C(this,bt).addObserver(this),C(this,bt).execute(r)}},ws=new WeakMap,Js=new WeakMap,bt=new WeakMap,Ns=new WeakMap,ks=new WeakSet,To=function(){var a;const r=((a=C(this,bt))==null?void 0:a.state)??ih();Q(this,Js,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(r){et.batch(()=>{var a,n,o,i,l,c,d,u;if(C(this,Ns)&&this.hasListeners()){const m=C(this,Js).variables,h=C(this,Js).context,x={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(a=C(this,Ns)).onSuccess)==null||n.call(a,r.data,m,h,x)}catch(f){Promise.reject(f)}try{(i=(o=C(this,Ns)).onSettled)==null||i.call(o,r.data,null,m,h,x)}catch(f){Promise.reject(f)}}else if((r==null?void 0:r.type)==="error"){try{(c=(l=C(this,Ns)).onError)==null||c.call(l,r.error,m,h,x)}catch(f){Promise.reject(f)}try{(u=(d=C(this,Ns)).onSettled)==null||u.call(d,void 0,r.error,m,h,x)}catch(f){Promise.reject(f)}}}this.listeners.forEach(m=>{m(C(this,Js))})})},yp),ss,vp,ny=(vp=class extends $a{constructor(s={}){super();ne(this,ss);this.config=s,Q(this,ss,new Map)}build(s,r,a){const n=r.queryKey,o=r.queryHash??Ac(n,r);let i=this.get(o);return i||(i=new Xb({client:s,queryKey:n,queryHash:o,options:s.defaultQueryOptions(r),state:a,defaultOptions:s.getQueryDefaults(n)}),this.add(i)),i}add(s){C(this,ss).has(s.queryHash)||(C(this,ss).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=C(this,ss).get(s.queryHash);r&&(s.destroy(),r===s&&C(this,ss).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return C(this,ss).get(s)}getAll(){return[...C(this,ss).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Hd(r,a))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(a=>Hd(s,a)):r}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},ss=new WeakMap,vp),Ge,Ys,Qs,ba,ya,Xs,va,ja,jp,oy=(jp=class{constructor(e={}){ne(this,Ge);ne(this,Ys);ne(this,Qs);ne(this,ba);ne(this,ya);ne(this,Xs);ne(this,va);ne(this,ja);Q(this,Ge,e.queryCache||new ny),Q(this,Ys,e.mutationCache||new ry),Q(this,Qs,e.defaultOptions||{}),Q(this,ba,new Map),Q(this,ya,new Map),Q(this,Xs,0)}mount(){lo(this,Xs)._++,C(this,Xs)===1&&(Q(this,va,Ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onFocus())})),Q(this,ja,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onOnline())})))}unmount(){var e,s;lo(this,Xs)._--,C(this,Xs)===0&&((e=C(this,va))==null||e.call(this),Q(this,va,void 0),(s=C(this,ja))==null||s.call(this),Q(this,ja,void 0))}isFetching(e){return C(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),r=C(this,Ge).build(this,s),a=r.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zs(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(a))}getQueriesData(e){return C(this,Ge).findAll(e).map(({queryKey:s,state:r})=>{const a=r.data;return[s,a]})}setQueryData(e,s,r){const a=this.defaultQueryOptions({queryKey:e}),n=C(this,Ge).get(a.queryHash),o=n==null?void 0:n.state.data,i=Bb(s,o);if(i!==void 0)return C(this,Ge).build(this,a).setData(i,{...r,manual:!0})}setQueriesData(e,s,r){return et.batch(()=>C(this,Ge).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,s,r)]))}getQueryState(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state}removeQueries(e){const s=C(this,Ge);et.batch(()=>{s.findAll(e).forEach(r=>{s.remove(r)})})}resetQueries(e,s){const r=C(this,Ge);return et.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const r={revert:!0,...s},a=et.batch(()=>C(this,Ge).findAll(e).map(n=>n.cancel(r)));return Promise.all(a).then(xt).catch(xt)}invalidateQueries(e,s={}){return et.batch(()=>(C(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},s)))}refetchQueries(e,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},a=et.batch(()=>C(this,Ge).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,r);return r.throwOnError||(o=o.catch(xt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(xt)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const r=C(this,Ge).build(this,s);return r.isStaleByTime(Zs(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zo.isOnline()?C(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Ge)}getMutationCache(){return C(this,Ys)}getDefaultOptions(){return C(this,Qs)}setDefaultOptions(e){Q(this,Qs,e)}setQueryDefaults(e,s){C(this,ba).set(Mr(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...C(this,ba).values()],r={};return s.forEach(a=>{fn(e,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(e,s){C(this,ya).set(Mr(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...C(this,ya).values()],r={};return s.forEach(a=>{fn(e,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const s={...C(this,Qs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Ac(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===$c&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Ge).clear(),C(this,Ys).clear()}},Ge=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,ba=new WeakMap,ya=new WeakMap,Xs=new WeakMap,va=new WeakMap,ja=new WeakMap,jp),lh=p.createContext(void 0),Fa=e=>{const s=p.useContext(lh);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},iy=({client:e,children:s})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(lh.Provider,{value:e,children:s})),ch=p.createContext(!1),ly=()=>p.useContext(ch);ch.Provider;function cy(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dy=p.createContext(cy()),uy=()=>p.useContext(dy),my=(e,s,r)=>{const a=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Fc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(s.isReset()||(e.retryOnMount=!1))},py=e=>{p.useEffect(()=>{e.clearReset()},[e])},hy=({result:e,errorResetBoundary:s,throwOnError:r,query:a,suspense:n})=>e.isError&&!s.isReset()&&!e.isFetching&&a&&(n&&e.data===void 0||Fc(r,[e.error,a])),xy=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...n)=>r(a(...n)):r(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},gy=(e,s)=>e.isLoading&&e.isFetching&&!s,fy=(e,s)=>(e==null?void 0:e.suspense)&&s.isPending,Xd=(e,s,r)=>s.fetchOptimistic(e).catch(()=>{r.clearReset()});function by(e,s,r){var x,f,g,b;const a=ly(),n=uy(),o=Fa(),i=o.defaultQueryOptions(e);(f=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||f.call(x,i);const l=o.getQueryCache().get(i.queryHash),c=e.subscribed!==!1;i._optimisticResults=a?"isRestoring":c?"optimistic":void 0,xy(i),my(i,n,l),py(n);const d=!o.getQueryCache().get(i.queryHash),[u]=p.useState(()=>new s(o,i)),m=u.getOptimisticResult(i),h=!a&&c;if(p.useSyncExternalStore(p.useCallback(y=>{const v=h?u.subscribe(et.batchCalls(y)):xt;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),p.useEffect(()=>{u.setOptions(i)},[i,u]),fy(i,m))throw Xd(i,u,n);if(hy({result:m,errorResetBoundary:n,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw m.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,i,m),i.experimental_prefetchInRender&&!bn.isServer()&&gy(m,a)){const y=d?Xd(i,u,n):l==null?void 0:l.promise;y==null||y.catch(xt).finally(()=>{u.updateResult()})}return i.notifyOnChangeProps?m:u.trackResult(m)}function li(e,s){return by(e,Zb)}function ci(e,s){const r=Fa(),[a]=p.useState(()=>new ay(r,e));p.useEffect(()=>{a.setOptions(e)},[a,e]);const n=p.useSyncExternalStore(p.useCallback(i=>a.subscribe(et.batchCalls(i)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=p.useCallback((i,l)=>{a.mutate(i,l).catch(xt)},[a]);if(n.error&&Fc(a.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const yy="modulepreload",vy=function(e){return"/"+e},Zd={},cr=function(s,r,a){let n=Promise.resolve();if(r&&r.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(r.map(d=>{if(d=vy(d),d in Zd)return;Zd[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":yy,u||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((x,f)=>{h.addEventListener("load",x),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CiBTFoht.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-fhCsGe-z.js","assets/EDAPage-BcPZlmKw.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-CPfpybeF.js","assets/ModelRegistry-BUrr8Bvp.js","assets/DeploymentsPage-CZDjMu-I.js","assets/SlowNodesPage-BSLoobH9.js","assets/AuditLogPage-No5dzqER.js"])))=>i.map(i=>d[i]); +var b0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var y0=(e,s,r)=>s in e?b0(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Pt=(e,s,r)=>y0(e,typeof s!="symbol"?s+"":s,r),zi=(e,s,r)=>s.has(e)||zd("Cannot "+r);var C=(e,s,r)=>(zi(e,s,"read from private field"),r?r.call(e):s.get(e)),ne=(e,s,r)=>s.has(e)?zd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,r),Q=(e,s,r,a)=>(zi(e,s,"write to private field"),a?a.call(e,r):s.set(e,r),r),he=(e,s,r)=>(zi(e,s,"access private method"),r);var lo=(e,s,r,a)=>({set _(n){Q(e,s,n,r)},get _(){return C(e,s,a)}});import{j as t,c as wp,b as Bi,d as v0,e as j0,f as Np,g as An,H as wl,P as as,h as w0,k as N0,l as kp,m as k0,E as _0,R as _p,i as Sp,B as Cp,C as Ep,n as Kt,M as S0}from"./vendor-flow-Ct2sLZk5.js";import{g as Rp,a as p,b as ae,af as Tp,aC as C0,X as Ee,Q as $n,f as $t,j as Te,a6 as Qe,aD as vc,aE as E0,ar as Mp,a7 as at,a5 as Fn,T as jc,aw as ds,a9 as Ct,A as R0,d as Pa,aF as ri,i as T0,u as M0,aG as P0,aH as I0,D as ge,c as us,aI as A0,C as _t,an as Nl,z as ir,e as Ut,x as Pp,aa as Ie,J as Dn,a0 as Ip,a1 as Ap,q as Es,l as ms,aJ as wc,L as Ln,w as $0,N as F0,o as Dr,aK as D0,ab as L0,m as O0,p as Ce,k as tt,aL as kl,aM as ai,aN as hn,aO as z0,_ as Ia,aP as $p,s as Nc,y as gt,ai as _l,S as lr,Y as On,az as Fp,K as Ae,ap as B0,aq as V0,R as Dp,aB as kc,aQ as xn,aR as U0,aS as _c,aT as Sc,v as tr,aU as H0,aV as Aa,aA as Lp,aW as W0,ak as gn,aX as Op,aY as zp,aZ as G0,a_ as q0,a$ as K0,b0 as Sl,b1 as J0,W as ni,t as oi,ac as Cc,b2 as Bp,b3 as Y0,b4 as zn,b5 as Q0,as as Vp,b6 as Zt,ax as Ec,b7 as X0,V as Z0,am as eb,b8 as tb,b9 as sb,ba as rb,bb as Up,bc as Hp,bd as ab,be as nb,bf as ob,bg as ib,bh as lb,Z as Cl,bi as Rc,bj as Tc,ag as Wp,bk as ii,bl as cb,bm as db,bn as ub,bo as Gp,bp as mb,bq as pb,a4 as qp,br as hb,bs as xb,h as Mc,bt as gb,bu as fb,bv as bb,bw as yb,bx as vb,H as Kp,by as Jp,bz as Yp,bA as Pc,bB as jb,bC as Bd,bD as wb,bE as Nb,bF as kb,bG as _b}from"./vendor-utils-VkF_O5b_.js";import{aY as Sb,u as Cb,r as Bn,R as $e,B as Jt,C as Ue,X as Oe,Y as ze,T as Fe,h as lt,aj as Eb,ak as Rb,j as wa,ah as Lr,aZ as Tb,ag as Mb,ai as ht,av as Pb,a_ as pr,a$ as Ib,as as ct,au as hr,at as Zr,b0 as Vi,b1 as Vd}from"./vendor-charts-BkHP8M8k.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var co={},Ud;function Ab(){if(Ud)return co;Ud=1;var e=Sb();return co.createRoot=e.createRoot,co.hydrateRoot=e.hydrateRoot,co}var $b=Ab();const Fb=Rp($b);var $a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},br,Hs,ca,up,Db=(up=class extends $a{constructor(){super();ne(this,br);ne(this,Hs);ne(this,ca);Q(this,ca,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Hs)||this.setEventListener(C(this,ca))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Hs))==null||s.call(this),Q(this,Hs,void 0))}setEventListener(s){var r;Q(this,ca,s),(r=C(this,Hs))==null||r.call(this),Q(this,Hs,s(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(s){C(this,br)!==s&&(Q(this,br,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof C(this,br)=="boolean"?C(this,br):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},br=new WeakMap,Hs=new WeakMap,ca=new WeakMap,up),Ic=new Db,Lb={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},Ws,yc,mp,Ob=(mp=class{constructor(){ne(this,Ws,Lb);ne(this,yc,!1)}setTimeoutProvider(e){Q(this,Ws,e)}setTimeout(e,s){return C(this,Ws).setTimeout(e,s)}clearTimeout(e){C(this,Ws).clearTimeout(e)}setInterval(e,s){return C(this,Ws).setInterval(e,s)}clearInterval(e){C(this,Ws).clearInterval(e)}},Ws=new WeakMap,yc=new WeakMap,mp),gr=new Ob;function zb(e){setTimeout(e,0)}var Bb=typeof window>"u"||"Deno"in globalThis;function xt(){}function Vb(e,s){return typeof e=="function"?e(s):e}function El(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qp(e,s){return Math.max(e+(s||0)-Date.now(),0)}function Zs(e,s){return typeof e=="function"?e(s):e}function wt(e,s){return typeof e=="function"?e(s):e}function Hd(e,s){const{type:r="all",exact:a,fetchStatus:n,predicate:o,queryKey:i,stale:l}=e;if(i){if(a){if(s.queryHash!==Ac(i,s.options))return!1}else if(!fn(s.queryKey,i))return!1}if(r!=="all"){const c=s.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&s.isStale()!==l||n&&n!==s.state.fetchStatus||o&&!o(s))}function Wd(e,s){const{exact:r,status:a,predicate:n,mutationKey:o}=e;if(o){if(!s.options.mutationKey)return!1;if(r){if(Mr(s.options.mutationKey)!==Mr(o))return!1}else if(!fn(s.options.mutationKey,o))return!1}return!(a&&s.state.status!==a||n&&!n(s))}function Ac(e,s){return((s==null?void 0:s.queryKeyHashFn)||Mr)(e)}function Mr(e){return JSON.stringify(e,(s,r)=>Rl(r)?Object.keys(r).sort().reduce((a,n)=>(a[n]=r[n],a),{}):r)}function fn(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(r=>fn(e[r],s[r])):!1}var Ub=Object.prototype.hasOwnProperty;function Xp(e,s,r=0){if(e===s)return e;if(r>500)return s;const a=Gd(e)&&Gd(s);if(!a&&!(Rl(e)&&Rl(s)))return s;const o=(a?e:Object.keys(e)).length,i=a?s:Object.keys(s),l=i.length,c=a?new Array(l):{};let d=0;for(let u=0;u{gr.setTimeout(s,e)})}function Tl(e,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,s):r.structuralSharing!==!1?Xp(e,s):s}function Wb(e,s,r=0){const a=[...e,s];return r&&a.length>r?a.slice(1):a}function Gb(e,s,r=0){const a=[s,...e];return r&&a.length>r?a.slice(0,-1):a}var $c=Symbol();function Zp(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===$c?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fc(e,s){return typeof e=="function"?e(...s):!!e}function qb(e,s,r){let a=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=s()),a||(a=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var bn=(()=>{let e=()=>Bb;return{isServer(){return e()},setIsServer(s){e=s}}})();function Ml(){let e,s;const r=new Promise((n,o)=>{e=n,s=o});r.status="pending",r.catch(()=>{});function a(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{a({status:"fulfilled",value:n}),e(n)},r.reject=n=>{a({status:"rejected",reason:n}),s(n)},r}var Kb=zb;function Jb(){let e=[],s=0,r=l=>{l()},a=l=>{l()},n=Kb;const o=l=>{s?e.push(l):n(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&n(()=>{a(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;s++;try{c=l()}finally{s--,s||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{a=l},setScheduler:l=>{n=l}}}var et=Jb(),da,Gs,ua,pp,Yb=(pp=class extends $a{constructor(){super();ne(this,da,!0);ne(this,Gs);ne(this,ua);Q(this,ua,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),a=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){C(this,Gs)||this.setEventListener(C(this,ua))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Gs))==null||s.call(this),Q(this,Gs,void 0))}setEventListener(s){var r;Q(this,ua,s),(r=C(this,Gs))==null||r.call(this),Q(this,Gs,s(this.setOnline.bind(this)))}setOnline(s){C(this,da)!==s&&(Q(this,da,s),this.listeners.forEach(a=>{a(s)}))}isOnline(){return C(this,da)}},da=new WeakMap,Gs=new WeakMap,ua=new WeakMap,pp),zo=new Yb;function Qb(e){return Math.min(1e3*2**e,3e4)}function eh(e){return(e??"online")==="online"?zo.isOnline():!0}var Pl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function th(e){let s=!1,r=0,a;const n=Ml(),o=()=>n.status!=="pending",i=g=>{var b;if(!o()){const y=new Pl(g);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{s=!0},c=()=>{s=!1},d=()=>Ic.isFocused()&&(e.networkMode==="always"||zo.isOnline())&&e.canRun(),u=()=>eh(e.networkMode)&&e.canRun(),m=g=>{o()||(a==null||a(),n.resolve(g))},h=g=>{o()||(a==null||a(),n.reject(g))},x=()=>new Promise(g=>{var b;a=y=>{(o()||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;a=void 0,o()||(g=e.onContinue)==null||g.call(e)}),f=()=>{if(o())return;let g;const b=r===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(m).catch(y=>{var k;if(o())return;const v=e.retry??(bn.isServer()?0:3),j=e.retryDelay??Qb,w=typeof j=="function"?j(r,y):j,N=v===!0||typeof v=="number"&&rd()?void 0:x()).then(()=>{s?h(y):f()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(a==null||a(),n),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?f():x().then(f),n)}}var yr,hp,sh=(hp=class{constructor(){ne(this,yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),El(this.gcTime)&&Q(this,yr,gr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,yr)!==void 0&&(gr.clearTimeout(C(this,yr)),Q(this,yr,void 0))}},yr=new WeakMap,hp);function Xb(e){return{onFetch:(s,r)=>{var u,m,h,x,f;const a=s.options,n=(h=(m=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,o=((x=s.state.data)==null?void 0:x.pages)||[],i=((f=s.state.data)==null?void 0:f.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=j=>{qb(j,()=>s.signal,()=>g=!0)},y=Zp(s.options,s.fetchOptions),v=async(j,w,N)=>{if(g)return Promise.reject(s.signal.reason);if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const T={client:s.client,queryKey:s.queryKey,pageParam:w,direction:N?"backward":"forward",meta:s.options.meta};return b(T),T})(),R=await y(_),{maxPages:M}=s.options,E=N?Gb:Wb;return{pages:E(j.pages,R,M),pageParams:E(j.pageParams,w,M)}};if(n&&o.length){const j=n==="backward",w=j?rh:Il,N={pages:o,pageParams:i},k=w(a,N);l=await v(N,k,j)}else{const j=e??o.length;do{const w=c===0?i[0]??a.initialPageParam:Il(a,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c{var g,b;return(b=(g=s.options).persister)==null?void 0:b.call(g,d,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=d}}}function Il(e,{pages:s,pageParams:r}){const a=s.length-1;return s.length>0?e.getNextPageParam(s[a],s,r[a],r):void 0}function rh(e,{pages:s,pageParams:r}){var a;return s.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,s[0],s,r[0],r):void 0}function h6(e,s){return s?Il(e,s)!=null:!1}function x6(e,s){return!s||!e.getPreviousPageParam?!1:rh(e,s)!=null}var ma,vr,pa,At,jr,rt,Rn,wr,jt,ah,ys,xp,Zb=(xp=class extends sh{constructor(s){super();ne(this,jt);ne(this,ma);ne(this,vr);ne(this,pa);ne(this,At);ne(this,jr);ne(this,rt);ne(this,Rn);ne(this,wr);Q(this,wr,!1),Q(this,Rn,s.defaultOptions),this.setOptions(s.options),this.observers=[],Q(this,jr,s.client),Q(this,At,C(this,jr).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Q(this,vr,Jd(this.options)),this.state=s.state??C(this,vr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ma)}get promise(){var s;return(s=C(this,rt))==null?void 0:s.promise}setOptions(s){if(this.options={...C(this,Rn),...s},s!=null&&s._type&&Q(this,ma,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Jd(this.options);r.data!==void 0&&(this.setState(Kd(r.data,r.dataUpdatedAt)),Q(this,vr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,At).remove(this)}setData(s,r){const a=Tl(this.state.data,s,this.options);return he(this,jt,ys).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(s){he(this,jt,ys).call(this,{type:"setState",state:s})}cancel(s){var a,n;const r=(a=C(this,rt))==null?void 0:a.promise;return(n=C(this,rt))==null||n.cancel(s),r?r.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,vr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>wt(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$c||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>Zs(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Qp(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(a=>a.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}onOnline(){var r;const s=this.observers.find(a=>a.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),C(this,At).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(C(this,rt)&&(C(this,wr)||he(this,jt,ah).call(this)?C(this,rt).cancel({revert:!0}):C(this,rt).cancelRetry()),this.scheduleGc()),C(this,At).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,ys).call(this,{type:"invalidate"})}async fetch(s,r){var d,u,m,h,x,f,g,b,y,v,j;if(this.state.fetchStatus!=="idle"&&((d=C(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,rt))return C(this,rt).continueRetry(),C(this,rt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const a=new AbortController,n=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Q(this,wr,!0),a.signal)})},o=()=>{const w=Zp(this.options,r),k=(()=>{const _={client:C(this,jr),queryKey:this.queryKey,meta:this.meta};return n(_),_})();return Q(this,wr,!1),this.options.persister?this.options.persister(w,k,this):w(k)},l=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,jr),state:this.state,fetchFn:o};return n(w),w})(),c=C(this,ma)==="infinite"?Xb(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Q(this,pa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&he(this,jt,ys).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Q(this,rt,th({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Pl&&w.revert&&this.setState({...C(this,pa),fetchStatus:"idle"}),a.abort()},onFail:(w,N)=>{he(this,jt,ys).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{he(this,jt,ys).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,ys).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await C(this,rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=C(this,At).config).onSuccess)==null||x.call(h,w,this),(g=(f=C(this,At).config).onSettled)==null||g.call(f,w,this.state.error,this),w}catch(w){if(w instanceof Pl){if(w.silent)return C(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,jt,ys).call(this,{type:"error",error:w}),(y=(b=C(this,At).config).onError)==null||y.call(b,w,this),(j=(v=C(this,At).config).onSettled)==null||j.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},ma=new WeakMap,vr=new WeakMap,pa=new WeakMap,At=new WeakMap,jr=new WeakMap,rt=new WeakMap,Rn=new WeakMap,wr=new WeakMap,jt=new WeakSet,ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ys=function(s){const r=a=>{switch(s.type){case"failed":return{...a,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...nh(a.data,this.options),fetchMeta:s.meta??null};case"success":const n={...a,...Kd(s.data,s.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,pa,s.manual?n:void 0),n;case"error":const o=s.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...s.state}}};this.state=r(this.state),et.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),C(this,At).notify({query:this,type:"updated",action:s})})},xp);function nh(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eh(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kd(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jd(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,r=s!==void 0,a=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ft,ye,Tn,mt,Nr,ha,vs,qs,Mn,xa,ga,kr,_r,Ks,fa,ke,cn,Al,$l,Fl,Dl,Ll,Ol,zl,oh,gp,ey=(gp=class extends $a{constructor(s,r){super();ne(this,ke);ne(this,ft);ne(this,ye);ne(this,Tn);ne(this,mt);ne(this,Nr);ne(this,ha);ne(this,vs);ne(this,qs);ne(this,Mn);ne(this,xa);ne(this,ga);ne(this,kr);ne(this,_r);ne(this,Ks);ne(this,fa,new Set);this.options=r,Q(this,ft,s),Q(this,qs,null),Q(this,vs,Ml()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Yd(C(this,ye),this.options)?he(this,ke,cn).call(this):this.updateResult(),he(this,ke,Dl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bl(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bl(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,ke,Ll).call(this),he(this,ke,Ol).call(this),C(this,ye).removeObserver(this)}setOptions(s){const r=this.options,a=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,ke,zl).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Oo(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const n=this.hasListeners();n&&Qd(C(this,ye),a,this.options,r)&&he(this,ke,cn).call(this),this.updateResult(),n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||Zs(this.options.staleTime,C(this,ye))!==Zs(r.staleTime,C(this,ye)))&&he(this,ke,Al).call(this);const o=he(this,ke,$l).call(this);n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||o!==C(this,Ks))&&he(this,ke,Fl).call(this,o)}getOptimisticResult(s){const r=C(this,ft).getQueryCache().build(C(this,ft),s),a=this.createResult(r,s);return sy(this,a)&&(Q(this,mt,a),Q(this,ha,this.options),Q(this,Nr,C(this,ye).state)),a}getCurrentResult(){return C(this,mt)}trackResult(s,r){return new Proxy(s,{get:(a,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,vs).status==="pending"&&C(this,vs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,n))})}trackProp(s){C(this,fa).add(s)}getCurrentQuery(){return C(this,ye)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=C(this,ft).defaultQueryOptions(s),a=C(this,ft).getQueryCache().build(C(this,ft),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(s){return he(this,ke,cn).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,mt)))}createResult(s,r){var M;const a=C(this,ye),n=this.options,o=C(this,mt),i=C(this,Nr),l=C(this,ha),d=s!==a?s.state:C(this,Tn),{state:u}=s;let m={...u},h=!1,x;if(r._optimisticResults){const E=this.hasListeners(),T=!E&&Yd(s,r),S=E&&Qd(s,a,r,n);(T||S)&&(m={...m,...nh(u.data,s.options)}),r._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:b}=m;x=m.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let E;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,y=!0):E=typeof r.placeholderData=="function"?r.placeholderData((M=C(this,ga))==null?void 0:M.state.data,C(this,ga)):r.placeholderData,E!==void 0&&(b="success",x=Tl(o==null?void 0:o.data,E,r),h=!0)}if(r.select&&x!==void 0&&!y)if(o&&x===(i==null?void 0:i.data)&&r.select===C(this,Mn))x=C(this,xa);else try{Q(this,Mn,r.select),x=r.select(x),x=Tl(o==null?void 0:o.data,x,r),Q(this,xa,x),Q(this,qs,null)}catch(E){Q(this,qs,E)}C(this,qs)&&(f=C(this,qs),x=C(this,xa),g=Date.now(),b="error");const v=m.fetchStatus==="fetching",j=b==="pending",w=b==="error",N=j&&v,k=x!==void 0,R={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!j,isLoadingError:w&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&k,isStale:Dc(s,r),refetch:this.refetch,promise:C(this,vs),isEnabled:wt(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const E=R.data!==void 0,T=R.status==="error"&&!E,S=A=>{T?A.reject(R.error):E&&A.resolve(R.data)},P=()=>{const A=Q(this,vs,R.promise=Ml());S(A)},I=C(this,vs);switch(I.status){case"pending":s.queryHash===a.queryHash&&S(I);break;case"fulfilled":(T||R.data!==I.value)&&P();break;case"rejected":(!T||R.error!==I.reason)&&P();break}}return R}updateResult(){const s=C(this,mt),r=this.createResult(C(this,ye),this.options);if(Q(this,Nr,C(this,ye).state),Q(this,ha,this.options),C(this,Nr).data!==void 0&&Q(this,ga,C(this,ye)),Oo(r,s))return;Q(this,mt,r);const a=()=>{if(!s)return!0;const{notifyOnChangeProps:n}=this.options,o=typeof n=="function"?n():n;if(o==="all"||!o&&!C(this,fa).size)return!0;const i=new Set(o??C(this,fa));return this.options.throwOnError&&i.add("error"),Object.keys(C(this,mt)).some(l=>{const c=l;return C(this,mt)[c]!==s[c]&&i.has(c)})};he(this,ke,oh).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,ke,Dl).call(this)}},ft=new WeakMap,ye=new WeakMap,Tn=new WeakMap,mt=new WeakMap,Nr=new WeakMap,ha=new WeakMap,vs=new WeakMap,qs=new WeakMap,Mn=new WeakMap,xa=new WeakMap,ga=new WeakMap,kr=new WeakMap,_r=new WeakMap,Ks=new WeakMap,fa=new WeakMap,ke=new WeakSet,cn=function(s){he(this,ke,zl).call(this);let r=C(this,ye).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(xt)),r},Al=function(){he(this,ke,Ll).call(this);const s=Zs(this.options.staleTime,C(this,ye));if(bn.isServer()||C(this,mt).isStale||!El(s))return;const a=Qp(C(this,mt).dataUpdatedAt,s)+1;Q(this,kr,gr.setTimeout(()=>{C(this,mt).isStale||this.updateResult()},a))},$l=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Fl=function(s){he(this,ke,Ol).call(this),Q(this,Ks,s),!(bn.isServer()||wt(this.options.enabled,C(this,ye))===!1||!El(C(this,Ks))||C(this,Ks)===0)&&Q(this,_r,gr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ic.isFocused())&&he(this,ke,cn).call(this)},C(this,Ks)))},Dl=function(){he(this,ke,Al).call(this),he(this,ke,Fl).call(this,he(this,ke,$l).call(this))},Ll=function(){C(this,kr)!==void 0&&(gr.clearTimeout(C(this,kr)),Q(this,kr,void 0))},Ol=function(){C(this,_r)!==void 0&&(gr.clearInterval(C(this,_r)),Q(this,_r,void 0))},zl=function(){const s=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(s===C(this,ye))return;const r=C(this,ye);Q(this,ye,s),Q(this,Tn,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},oh=function(s){et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(C(this,mt))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},gp);function ty(e,s){return wt(s.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&wt(s.retryOnMount,e)===!1)}function Yd(e,s){return ty(e,s)||e.state.data!==void 0&&Bl(e,s,s.refetchOnMount)}function Bl(e,s,r){if(wt(s.enabled,e)!==!1&&Zs(s.staleTime,e)!=="static"){const a=typeof r=="function"?r(e):r;return a==="always"||a!==!1&&Dc(e,s)}return!1}function Qd(e,s,r,a){return(e!==s||wt(a.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Dc(e,r)}function Dc(e,s){return wt(s.enabled,e)!==!1&&e.isStaleByTime(Zs(s.staleTime,e))}function sy(e,s){return!Oo(e.getCurrentResult(),s)}var Pn,es,it,Sr,ts,Bs,fp,ry=(fp=class extends sh{constructor(s){super();ne(this,ts);ne(this,Pn);ne(this,es);ne(this,it);ne(this,Sr);Q(this,Pn,s.client),this.mutationId=s.mutationId,Q(this,it,s.mutationCache),Q(this,es,[]),this.state=s.state||ih(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){C(this,es).includes(s)||(C(this,es).push(s),this.clearGcTimeout(),C(this,it).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Q(this,es,C(this,es).filter(r=>r!==s)),this.scheduleGc(),C(this,it).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){C(this,es).length||(this.state.status==="pending"?this.scheduleGc():C(this,it).remove(this))}continue(){var s;return((s=C(this,Sr))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,l,c,d,u,m,h,x,f,g,b,y,v,j,w,N,k,_;const r=()=>{he(this,ts,Bs).call(this,{type:"continue"})},a={client:C(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Sr,th({fn:()=>this.options.mutationFn?this.options.mutationFn(s,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{he(this,ts,Bs).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{he(this,ts,Bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,it).canRun(this)}));const n=this.state.status==="pending",o=!C(this,Sr).canStart();try{if(n)r();else{he(this,ts,Bs).call(this,{type:"pending",variables:s,isPaused:o}),C(this,it).config.onMutate&&await C(this,it).config.onMutate(s,this,a);const M=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,s,a));M!==this.state.context&&he(this,ts,Bs).call(this,{type:"pending",context:M,variables:s,isPaused:o})}const R=await C(this,Sr).start();return await((d=(c=C(this,it).config).onSuccess)==null?void 0:d.call(c,R,s,this.state.context,this,a)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,R,s,this.state.context,a)),await((x=(h=C(this,it).config).onSettled)==null?void 0:x.call(h,R,null,this.state.variables,this.state.context,this,a)),await((g=(f=this.options).onSettled)==null?void 0:g.call(f,R,null,s,this.state.context,a)),he(this,ts,Bs).call(this,{type:"success",data:R}),R}catch(R){try{await((y=(b=C(this,it).config).onError)==null?void 0:y.call(b,R,s,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((j=(v=this.options).onError)==null?void 0:j.call(v,R,s,this.state.context,a))}catch(M){Promise.reject(M)}try{await((N=(w=C(this,it).config).onSettled)==null?void 0:N.call(w,void 0,R,this.state.variables,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,R,s,this.state.context,a))}catch(M){Promise.reject(M)}throw he(this,ts,Bs).call(this,{type:"error",error:R}),R}finally{C(this,it).runNext(this)}}},Pn=new WeakMap,es=new WeakMap,it=new WeakMap,Sr=new WeakMap,ts=new WeakSet,Bs=function(s){const r=a=>{switch(s.type){case"failed":return{...a,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...a,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:s.error,failureCount:a.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),et.batch(()=>{C(this,es).forEach(a=>{a.onMutationUpdate(s)}),C(this,it).notify({mutation:this,type:"updated",action:s})})},fp);function ih(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js,Lt,In,bp,ay=(bp=class extends $a{constructor(s={}){super();ne(this,js);ne(this,Lt);ne(this,In);this.config=s,Q(this,js,new Set),Q(this,Lt,new Map),Q(this,In,0)}build(s,r,a){const n=new ry({client:s,mutationCache:this,mutationId:++lo(this,In)._,options:s.defaultMutationOptions(r),state:a});return this.add(n),n}add(s){C(this,js).add(s);const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);a?a.push(s):C(this,Lt).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(C(this,js).delete(s)){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);if(a)if(a.length>1){const n=a.indexOf(s);n!==-1&&a.splice(n,1)}else a[0]===s&&C(this,Lt).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r),n=a==null?void 0:a.find(o=>o.state.status==="pending");return!n||n===s}else return!0}runNext(s){var a;const r=uo(s);if(typeof r=="string"){const n=(a=C(this,Lt).get(r))==null?void 0:a.find(o=>o!==s&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{C(this,js).forEach(s=>{this.notify({type:"removed",mutation:s})}),C(this,js).clear(),C(this,Lt).clear()})}getAll(){return Array.from(C(this,js))}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Wd(r,a))}findAll(s={}){return this.getAll().filter(r=>Wd(s,r))}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(s.map(r=>r.continue().catch(xt))))}},js=new WeakMap,Lt=new WeakMap,In=new WeakMap,bp);function uo(e){var s;return(s=e.options.scope)==null?void 0:s.id}var ws,Js,bt,Ns,ks,To,Vl,yp,ny=(yp=class extends $a{constructor(r,a){super();ne(this,ks);ne(this,ws);ne(this,Js);ne(this,bt);ne(this,Ns);Q(this,ws,r),this.setOptions(a),this.bindMethods(),he(this,ks,To).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const a=this.options;this.options=C(this,ws).defaultMutationOptions(r),Oo(this.options,a)||C(this,ws).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,bt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Mr(a.mutationKey)!==Mr(this.options.mutationKey)?this.reset():((n=C(this,bt))==null?void 0:n.state.status)==="pending"&&C(this,bt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,bt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,ks,To).call(this),he(this,ks,Vl).call(this,r)}getCurrentResult(){return C(this,Js)}reset(){var r;(r=C(this,bt))==null||r.removeObserver(this),Q(this,bt,void 0),he(this,ks,To).call(this),he(this,ks,Vl).call(this)}mutate(r,a){var n;return Q(this,Ns,a),(n=C(this,bt))==null||n.removeObserver(this),Q(this,bt,C(this,ws).getMutationCache().build(C(this,ws),this.options)),C(this,bt).addObserver(this),C(this,bt).execute(r)}},ws=new WeakMap,Js=new WeakMap,bt=new WeakMap,Ns=new WeakMap,ks=new WeakSet,To=function(){var a;const r=((a=C(this,bt))==null?void 0:a.state)??ih();Q(this,Js,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(r){et.batch(()=>{var a,n,o,i,l,c,d,u;if(C(this,Ns)&&this.hasListeners()){const m=C(this,Js).variables,h=C(this,Js).context,x={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(a=C(this,Ns)).onSuccess)==null||n.call(a,r.data,m,h,x)}catch(f){Promise.reject(f)}try{(i=(o=C(this,Ns)).onSettled)==null||i.call(o,r.data,null,m,h,x)}catch(f){Promise.reject(f)}}else if((r==null?void 0:r.type)==="error"){try{(c=(l=C(this,Ns)).onError)==null||c.call(l,r.error,m,h,x)}catch(f){Promise.reject(f)}try{(u=(d=C(this,Ns)).onSettled)==null||u.call(d,void 0,r.error,m,h,x)}catch(f){Promise.reject(f)}}}this.listeners.forEach(m=>{m(C(this,Js))})})},yp),ss,vp,oy=(vp=class extends $a{constructor(s={}){super();ne(this,ss);this.config=s,Q(this,ss,new Map)}build(s,r,a){const n=r.queryKey,o=r.queryHash??Ac(n,r);let i=this.get(o);return i||(i=new Zb({client:s,queryKey:n,queryHash:o,options:s.defaultQueryOptions(r),state:a,defaultOptions:s.getQueryDefaults(n)}),this.add(i)),i}add(s){C(this,ss).has(s.queryHash)||(C(this,ss).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=C(this,ss).get(s.queryHash);r&&(s.destroy(),r===s&&C(this,ss).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return C(this,ss).get(s)}getAll(){return[...C(this,ss).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Hd(r,a))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(a=>Hd(s,a)):r}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},ss=new WeakMap,vp),Ge,Ys,Qs,ba,ya,Xs,va,ja,jp,iy=(jp=class{constructor(e={}){ne(this,Ge);ne(this,Ys);ne(this,Qs);ne(this,ba);ne(this,ya);ne(this,Xs);ne(this,va);ne(this,ja);Q(this,Ge,e.queryCache||new oy),Q(this,Ys,e.mutationCache||new ay),Q(this,Qs,e.defaultOptions||{}),Q(this,ba,new Map),Q(this,ya,new Map),Q(this,Xs,0)}mount(){lo(this,Xs)._++,C(this,Xs)===1&&(Q(this,va,Ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onFocus())})),Q(this,ja,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onOnline())})))}unmount(){var e,s;lo(this,Xs)._--,C(this,Xs)===0&&((e=C(this,va))==null||e.call(this),Q(this,va,void 0),(s=C(this,ja))==null||s.call(this),Q(this,ja,void 0))}isFetching(e){return C(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),r=C(this,Ge).build(this,s),a=r.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zs(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(a))}getQueriesData(e){return C(this,Ge).findAll(e).map(({queryKey:s,state:r})=>{const a=r.data;return[s,a]})}setQueryData(e,s,r){const a=this.defaultQueryOptions({queryKey:e}),n=C(this,Ge).get(a.queryHash),o=n==null?void 0:n.state.data,i=Vb(s,o);if(i!==void 0)return C(this,Ge).build(this,a).setData(i,{...r,manual:!0})}setQueriesData(e,s,r){return et.batch(()=>C(this,Ge).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,s,r)]))}getQueryState(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state}removeQueries(e){const s=C(this,Ge);et.batch(()=>{s.findAll(e).forEach(r=>{s.remove(r)})})}resetQueries(e,s){const r=C(this,Ge);return et.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const r={revert:!0,...s},a=et.batch(()=>C(this,Ge).findAll(e).map(n=>n.cancel(r)));return Promise.all(a).then(xt).catch(xt)}invalidateQueries(e,s={}){return et.batch(()=>(C(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},s)))}refetchQueries(e,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},a=et.batch(()=>C(this,Ge).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,r);return r.throwOnError||(o=o.catch(xt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(xt)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const r=C(this,Ge).build(this,s);return r.isStaleByTime(Zs(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zo.isOnline()?C(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Ge)}getMutationCache(){return C(this,Ys)}getDefaultOptions(){return C(this,Qs)}setDefaultOptions(e){Q(this,Qs,e)}setQueryDefaults(e,s){C(this,ba).set(Mr(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...C(this,ba).values()],r={};return s.forEach(a=>{fn(e,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(e,s){C(this,ya).set(Mr(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...C(this,ya).values()],r={};return s.forEach(a=>{fn(e,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const s={...C(this,Qs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Ac(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===$c&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Ge).clear(),C(this,Ys).clear()}},Ge=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,ba=new WeakMap,ya=new WeakMap,Xs=new WeakMap,va=new WeakMap,ja=new WeakMap,jp),lh=p.createContext(void 0),Fa=e=>{const s=p.useContext(lh);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},ly=({client:e,children:s})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(lh.Provider,{value:e,children:s})),ch=p.createContext(!1),cy=()=>p.useContext(ch);ch.Provider;function dy(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var uy=p.createContext(dy()),my=()=>p.useContext(uy),py=(e,s,r)=>{const a=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Fc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(s.isReset()||(e.retryOnMount=!1))},hy=e=>{p.useEffect(()=>{e.clearReset()},[e])},xy=({result:e,errorResetBoundary:s,throwOnError:r,query:a,suspense:n})=>e.isError&&!s.isReset()&&!e.isFetching&&a&&(n&&e.data===void 0||Fc(r,[e.error,a])),gy=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...n)=>r(a(...n)):r(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},fy=(e,s)=>e.isLoading&&e.isFetching&&!s,by=(e,s)=>(e==null?void 0:e.suspense)&&s.isPending,Xd=(e,s,r)=>s.fetchOptimistic(e).catch(()=>{r.clearReset()});function yy(e,s,r){var x,f,g,b;const a=cy(),n=my(),o=Fa(),i=o.defaultQueryOptions(e);(f=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||f.call(x,i);const l=o.getQueryCache().get(i.queryHash),c=e.subscribed!==!1;i._optimisticResults=a?"isRestoring":c?"optimistic":void 0,gy(i),py(i,n,l),hy(n);const d=!o.getQueryCache().get(i.queryHash),[u]=p.useState(()=>new s(o,i)),m=u.getOptimisticResult(i),h=!a&&c;if(p.useSyncExternalStore(p.useCallback(y=>{const v=h?u.subscribe(et.batchCalls(y)):xt;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),p.useEffect(()=>{u.setOptions(i)},[i,u]),by(i,m))throw Xd(i,u,n);if(xy({result:m,errorResetBoundary:n,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw m.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,i,m),i.experimental_prefetchInRender&&!bn.isServer()&&fy(m,a)){const y=d?Xd(i,u,n):l==null?void 0:l.promise;y==null||y.catch(xt).finally(()=>{u.updateResult()})}return i.notifyOnChangeProps?m:u.trackResult(m)}function li(e,s){return yy(e,ey)}function ci(e,s){const r=Fa(),[a]=p.useState(()=>new ny(r,e));p.useEffect(()=>{a.setOptions(e)},[a,e]);const n=p.useSyncExternalStore(p.useCallback(i=>a.subscribe(et.batchCalls(i)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=p.useCallback((i,l)=>{a.mutate(i,l).catch(xt)},[a]);if(n.error&&Fc(a.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const vy="modulepreload",jy=function(e){return"/"+e},Zd={},cr=function(s,r,a){let n=Promise.resolve();if(r&&r.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(r.map(d=>{if(d=jy(d),d in Zd)return;Zd[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":vy,u||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((x,f)=>{h.addEventListener("load",x),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};/** * react-router v7.18.2 * * Copyright (c) Remix Software Inc. @@ -8,28 +8,28 @@ var f0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var b0=(e,s,r)=>s in * LICENSE.md file in the root directory of this source tree. * * @license MIT - */var Lc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,dh=/^[\\/]{2}/;function jy(e,s){return s+e.replace(/\\/g,"/")}var eu="popstate";function tu(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function wy(e={}){function s(a,n){var d;let o=(d=n.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||a.location;return Ul("",{pathname:i,search:l,hash:c},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:yn(n)}return ky(s,r,null,e)}function We(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function Ht(e,s){if(!e){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function Ny(){return Math.random().toString(36).substring(2,10)}function su(e,s){return{usr:e.state,key:e.key,idx:s,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ul(e,s,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof s=="string"?Da(s):s,state:r,key:s&&s.key||a||Ny(),mask:n}}function yn({pathname:e="/",search:s="",hash:r=""}){return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Da(e){let s={};if(e){let r=e.indexOf("#");r>=0&&(s.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(s.search=e.substring(a),e=e.substring(0,a)),e&&(s.pathname=e)}return s}function ky(e,s,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let b=u(),y=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:y})}function h(b,y){l="PUSH";let v=tu(b)?b:Ul(g.location,b,y);d=u()+1;let j=su(v,d),w=g.createHref(v.mask||v);try{i.pushState(j,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;n.location.assign(w)}o&&c&&c({action:l,location:g.location,delta:1})}function x(b,y){l="REPLACE";let v=tu(b)?b:Ul(g.location,b,y);d=u();let j=su(v,d),w=g.createHref(v.mask||v);i.replaceState(j,"",w),o&&c&&c({action:l,location:g.location,delta:0})}function f(b){return _y(n,b)}let g={get action(){return l},get location(){return e(n,i)},listen(b){if(c)throw new Error("A history only accepts one active listener");return n.addEventListener(eu,m),c=b,()=>{n.removeEventListener(eu,m),c=null}},createHref(b){return s(n,b)},createURL:f,encodeLocation(b){let y=f(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:x,go(b){return i.go(b)}};return g}function _y(e,s,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),We(a,"No window.location.(origin|href) available to create URL");let n=typeof s=="string"?s:yn(s);return n=n.replace(/ $/,"%20"),!r&&dh.test(n)&&(n=a+n),new URL(n,a)}function uh(e,s,r="/"){return Sy(e,s,r,!1)}function Sy(e,s,r,a,n){let o=typeof s=="string"?Da(s):s,i=_s(o.pathname||"/",r);if(i==null)return null;let l=Cy(e),c=null,d=Ly(i);for(let u=0;c==null&&u{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&c)return;We(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let m=zt([a,u.relativePath]),h=r.concat(u);i.children&&i.children.length>0&&(We(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),mh(i.children,s,h,m,c)),!(i.path==null&&!i.index)&&s.push({path:m,score:$y(m,i.index),routesMeta:h.map((x,f)=>{let[g,b]=xh(x.relativePath,x.caseSensitive,f===h.length-1);return{...x,matcher:g,compiledParams:b}})})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of ph(i.path))o(i,l,!0,d)}),s}function ph(e){let s=e.split("/");if(s.length===0)return[];let[r,...a]=s,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=ph(a.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),n&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Ey(e){e.sort((s,r)=>s.score!==r.score?r.score-s.score:Fy(s.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Ry=/^:[\w-]+$/,Ty=3,My=2,Py=1,Iy=10,Ay=-2,ru=e=>e==="*";function $y(e,s){let r=e.split("/"),a=r.length;return r.some(ru)&&(a+=Ay),s&&(a+=My),r.filter(n=>!ru(n)).reduce((n,o)=>n+(Ry.test(o)?Ty:o===""?Py:Iy),a)}function Fy(e,s){return e.length===s.length&&e.slice(0,-1).every((a,n)=>a===s[n])?e[e.length-1]-s[s.length-1]:0}function Dy(e,s,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l{if(u==="*"){let f=l[h]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const x=l[h];return m&&!x?d[u]=void 0:d[u]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function xh(e,s=!1,r=!0){Ht(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,u)=>{if(a.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,s?void 0:"i"),a]}function Ly(e){try{return e.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ht(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),e}}function _s(e,s){if(s==="/")return e;if(!e.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Oy(e,s="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Da(e):e,o;return r?(r=fh(r),r.startsWith("/")?o=au(r.substring(1),"/"):o=au(r,s)):o=s,{pathname:o,search:Vy(a),hash:Uy(n)}}function au(e,s){let r=Vo(s).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Ui(e,s,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${s}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function zy(e){return e.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function gh(e){let s=zy(e);return s.map((r,a)=>a===s.length-1?r.pathname:r.pathnameBase)}function Oc(e,s,r,a=!1){let n;typeof e=="string"?n=Da(e):(n={...e},We(!n.pathname||!n.pathname.includes("?"),Ui("?","pathname","search",n)),We(!n.pathname||!n.pathname.includes("#"),Ui("#","pathname","hash",n)),We(!n.search||!n.search.includes("#"),Ui("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let m=s.length-1;if(!a&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),m-=1;n.pathname=h.join("/")}l=m>=0?s[m]:"/"}let c=Oy(n,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var fh=e=>e.replace(/[\\/]{2,}/g,"/"),zt=e=>fh(e.join("/")),Vo=e=>e.replace(/\/+$/,""),By=e=>Vo(e).replace(/^\/*/,"/"),Vy=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Uy=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Hy=class{constructor(e,s,r,a=!1){this.status=e,this.statusText=s||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Wy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Gy(e){let s=e.map(r=>r.route.path).filter(Boolean);return zt(s)||"/"}var bh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yh(e,s){let r=e;if(typeof r!="string"||!Lc.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(bh)try{let o=new URL(window.location.href),i=dh.test(r)?new URL(jy(r,o.protocol)):new URL(r),l=_s(i.pathname,s);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{Ht(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vh=["POST","PUT","PATCH","DELETE"];new Set(vh);var qy=["GET",...vh];new Set(qy);var Ky=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Jy(e){try{return Ky.includes(new URL(e).protocol)}catch{return!1}}var La=p.createContext(null);La.displayName="DataRouter";var di=p.createContext(null);di.displayName="DataRouterState";var jh=p.createContext(!1);function Yy(){return p.useContext(jh)}var wh=p.createContext({isTransitioning:!1});wh.displayName="ViewTransition";var Qy=p.createContext(new Map);Qy.displayName="Fetchers";var Xy=p.createContext(null);Xy.displayName="Await";var Ft=p.createContext(null);Ft.displayName="Navigation";var Vn=p.createContext(null);Vn.displayName="Location";var ps=p.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var zc=p.createContext(null);zc.displayName="RouteError";var Nh="REACT_ROUTER_ERROR",Zy="REDIRECT",ev="ROUTE_ERROR_RESPONSE";function tv(e){if(e.startsWith(`${Nh}:${Zy}:{`))try{let s=JSON.parse(e.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function sv(e){if(e.startsWith(`${Nh}:${ev}:{`))try{let s=JSON.parse(e.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Hy(s.status,s.statusText,s.data)}catch{}}function rv(e,{relative:s}={}){We(Un(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:a}=p.useContext(Ft),{hash:n,pathname:o,search:i}=Hn(e,{relative:s}),l=o;return r!=="/"&&(l=o==="/"?r:zt([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Un(){return p.useContext(Vn)!=null}function Rt(){return We(Un(),"useLocation() may be used only in the context of a component."),p.useContext(Vn).location}var kh="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _h(e){p.useContext(Ft).static||p.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=p.useContext(ps);return e?bv():av()}function av(){We(Un(),"useNavigate() may be used only in the context of a component.");let e=p.useContext(La),{basename:s,navigator:r}=p.useContext(Ft),{matches:a}=p.useContext(ps),{pathname:n}=Rt(),o=JSON.stringify(gh(a)),i=p.useRef(!1);return _h(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(Ht(i.current,kh),!i.current)return;if(typeof c=="number"){r.go(c);return}let u=Oc(c,JSON.parse(o),n,d.relative==="path");e==null&&s!=="/"&&(u.pathname=u.pathname==="/"?s:zt([s,u.pathname])),(d.replace?r.replace:r.push)(u,d.state,d)},[s,r,o,n,e])}var nv=p.createContext(null);function ov(e){let s=p.useContext(ps).outlet;return p.useMemo(()=>s&&p.createElement(nv.Provider,{value:e},s),[s,e])}function Hn(e,{relative:s}={}){let{matches:r}=p.useContext(ps),{pathname:a}=Rt(),n=JSON.stringify(gh(r));return p.useMemo(()=>Oc(e,JSON.parse(n),a,s==="path"),[e,n,a,s])}function iv(e,s){return Sh(e,s)}function Sh(e,s,r){var b;We(Un(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=p.useContext(Ft),{matches:n}=p.useContext(ps),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let y=d&&d.path||"";Eh(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${l}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + */var Lc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,dh=/^[\\/]{2}/;function wy(e,s){return s+e.replace(/\\/g,"/")}var eu="popstate";function tu(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ny(e={}){function s(a,n){var d;let o=(d=n.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||a.location;return Ul("",{pathname:i,search:l,hash:c},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:yn(n)}return _y(s,r,null,e)}function We(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function Ht(e,s){if(!e){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function ky(){return Math.random().toString(36).substring(2,10)}function su(e,s){return{usr:e.state,key:e.key,idx:s,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ul(e,s,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof s=="string"?Da(s):s,state:r,key:s&&s.key||a||ky(),mask:n}}function yn({pathname:e="/",search:s="",hash:r=""}){return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Da(e){let s={};if(e){let r=e.indexOf("#");r>=0&&(s.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(s.search=e.substring(a),e=e.substring(0,a)),e&&(s.pathname=e)}return s}function _y(e,s,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let b=u(),y=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:y})}function h(b,y){l="PUSH";let v=tu(b)?b:Ul(g.location,b,y);d=u()+1;let j=su(v,d),w=g.createHref(v.mask||v);try{i.pushState(j,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;n.location.assign(w)}o&&c&&c({action:l,location:g.location,delta:1})}function x(b,y){l="REPLACE";let v=tu(b)?b:Ul(g.location,b,y);d=u();let j=su(v,d),w=g.createHref(v.mask||v);i.replaceState(j,"",w),o&&c&&c({action:l,location:g.location,delta:0})}function f(b){return Sy(n,b)}let g={get action(){return l},get location(){return e(n,i)},listen(b){if(c)throw new Error("A history only accepts one active listener");return n.addEventListener(eu,m),c=b,()=>{n.removeEventListener(eu,m),c=null}},createHref(b){return s(n,b)},createURL:f,encodeLocation(b){let y=f(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:x,go(b){return i.go(b)}};return g}function Sy(e,s,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),We(a,"No window.location.(origin|href) available to create URL");let n=typeof s=="string"?s:yn(s);return n=n.replace(/ $/,"%20"),!r&&dh.test(n)&&(n=a+n),new URL(n,a)}function uh(e,s,r="/"){return Cy(e,s,r,!1)}function Cy(e,s,r,a,n){let o=typeof s=="string"?Da(s):s,i=_s(o.pathname||"/",r);if(i==null)return null;let l=Ey(e),c=null,d=Oy(i);for(let u=0;c==null&&u{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&c)return;We(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let m=zt([a,u.relativePath]),h=r.concat(u);i.children&&i.children.length>0&&(We(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),mh(i.children,s,h,m,c)),!(i.path==null&&!i.index)&&s.push({path:m,score:Fy(m,i.index),routesMeta:h.map((x,f)=>{let[g,b]=xh(x.relativePath,x.caseSensitive,f===h.length-1);return{...x,matcher:g,compiledParams:b}})})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of ph(i.path))o(i,l,!0,d)}),s}function ph(e){let s=e.split("/");if(s.length===0)return[];let[r,...a]=s,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=ph(a.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),n&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Ry(e){e.sort((s,r)=>s.score!==r.score?r.score-s.score:Dy(s.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Ty=/^:[\w-]+$/,My=3,Py=2,Iy=1,Ay=10,$y=-2,ru=e=>e==="*";function Fy(e,s){let r=e.split("/"),a=r.length;return r.some(ru)&&(a+=$y),s&&(a+=Py),r.filter(n=>!ru(n)).reduce((n,o)=>n+(Ty.test(o)?My:o===""?Iy:Ay),a)}function Dy(e,s){return e.length===s.length&&e.slice(0,-1).every((a,n)=>a===s[n])?e[e.length-1]-s[s.length-1]:0}function Ly(e,s,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l{if(u==="*"){let f=l[h]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const x=l[h];return m&&!x?d[u]=void 0:d[u]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function xh(e,s=!1,r=!0){Ht(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,u)=>{if(a.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,s?void 0:"i"),a]}function Oy(e){try{return e.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ht(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),e}}function _s(e,s){if(s==="/")return e;if(!e.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function zy(e,s="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Da(e):e,o;return r?(r=fh(r),r.startsWith("/")?o=au(r.substring(1),"/"):o=au(r,s)):o=s,{pathname:o,search:Uy(a),hash:Hy(n)}}function au(e,s){let r=Vo(s).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Ui(e,s,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${s}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function By(e){return e.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function gh(e){let s=By(e);return s.map((r,a)=>a===s.length-1?r.pathname:r.pathnameBase)}function Oc(e,s,r,a=!1){let n;typeof e=="string"?n=Da(e):(n={...e},We(!n.pathname||!n.pathname.includes("?"),Ui("?","pathname","search",n)),We(!n.pathname||!n.pathname.includes("#"),Ui("#","pathname","hash",n)),We(!n.search||!n.search.includes("#"),Ui("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let m=s.length-1;if(!a&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),m-=1;n.pathname=h.join("/")}l=m>=0?s[m]:"/"}let c=zy(n,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var fh=e=>e.replace(/[\\/]{2,}/g,"/"),zt=e=>fh(e.join("/")),Vo=e=>e.replace(/\/+$/,""),Vy=e=>Vo(e).replace(/^\/*/,"/"),Uy=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hy=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Wy=class{constructor(e,s,r,a=!1){this.status=e,this.statusText=s||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Gy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qy(e){let s=e.map(r=>r.route.path).filter(Boolean);return zt(s)||"/"}var bh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yh(e,s){let r=e;if(typeof r!="string"||!Lc.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(bh)try{let o=new URL(window.location.href),i=dh.test(r)?new URL(wy(r,o.protocol)):new URL(r),l=_s(i.pathname,s);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{Ht(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vh=["POST","PUT","PATCH","DELETE"];new Set(vh);var Ky=["GET",...vh];new Set(Ky);var Jy=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Yy(e){try{return Jy.includes(new URL(e).protocol)}catch{return!1}}var La=p.createContext(null);La.displayName="DataRouter";var di=p.createContext(null);di.displayName="DataRouterState";var jh=p.createContext(!1);function Qy(){return p.useContext(jh)}var wh=p.createContext({isTransitioning:!1});wh.displayName="ViewTransition";var Xy=p.createContext(new Map);Xy.displayName="Fetchers";var Zy=p.createContext(null);Zy.displayName="Await";var Ft=p.createContext(null);Ft.displayName="Navigation";var Vn=p.createContext(null);Vn.displayName="Location";var ps=p.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var zc=p.createContext(null);zc.displayName="RouteError";var Nh="REACT_ROUTER_ERROR",ev="REDIRECT",tv="ROUTE_ERROR_RESPONSE";function sv(e){if(e.startsWith(`${Nh}:${ev}:{`))try{let s=JSON.parse(e.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function rv(e){if(e.startsWith(`${Nh}:${tv}:{`))try{let s=JSON.parse(e.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Wy(s.status,s.statusText,s.data)}catch{}}function av(e,{relative:s}={}){We(Un(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:a}=p.useContext(Ft),{hash:n,pathname:o,search:i}=Hn(e,{relative:s}),l=o;return r!=="/"&&(l=o==="/"?r:zt([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Un(){return p.useContext(Vn)!=null}function Rt(){return We(Un(),"useLocation() may be used only in the context of a component."),p.useContext(Vn).location}var kh="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _h(e){p.useContext(Ft).static||p.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=p.useContext(ps);return e?yv():nv()}function nv(){We(Un(),"useNavigate() may be used only in the context of a component.");let e=p.useContext(La),{basename:s,navigator:r}=p.useContext(Ft),{matches:a}=p.useContext(ps),{pathname:n}=Rt(),o=JSON.stringify(gh(a)),i=p.useRef(!1);return _h(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(Ht(i.current,kh),!i.current)return;if(typeof c=="number"){r.go(c);return}let u=Oc(c,JSON.parse(o),n,d.relative==="path");e==null&&s!=="/"&&(u.pathname=u.pathname==="/"?s:zt([s,u.pathname])),(d.replace?r.replace:r.push)(u,d.state,d)},[s,r,o,n,e])}var ov=p.createContext(null);function iv(e){let s=p.useContext(ps).outlet;return p.useMemo(()=>s&&p.createElement(ov.Provider,{value:e},s),[s,e])}function Hn(e,{relative:s}={}){let{matches:r}=p.useContext(ps),{pathname:a}=Rt(),n=JSON.stringify(gh(r));return p.useMemo(()=>Oc(e,JSON.parse(n),a,s==="path"),[e,n,a,s])}function lv(e,s){return Sh(e,s)}function Sh(e,s,r){var b;We(Un(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=p.useContext(Ft),{matches:n}=p.useContext(ps),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let y=d&&d.path||"";Eh(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${l}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let u=Rt(),m;if(s){let y=typeof s=="string"?Da(s):s;We(c==="/"||((b=y.pathname)==null?void 0:b.startsWith(c)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${y.pathname}" was given in the \`location\` prop.`),m=y}else m=u;let h=m.pathname||"/",x=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");x="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let f=r&&r.state.matches.length?r.state.matches.map(y=>Object.assign(y,{route:r.manifest[y.route.id]||y.route})):uh(e,{pathname:x});Ht(d||f!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ht(f==null||f[f.length-1].route.element!==void 0||f[f.length-1].route.Component!==void 0||f[f.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let g=mv(f&&f.map(y=>Object.assign({},y,{params:Object.assign({},i,y.params),pathname:zt([c,a.encodeLocation?a.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:zt([c,a.encodeLocation?a.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),n,r);return s&&g?p.createElement(Vn.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},g):g}function lv(){let e=fv(),s=Wy(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=p.createElement(p.Fragment,null,p.createElement("p",null,"πŸ’Ώ Hey developer πŸ‘‹"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:o},"ErrorBoundary")," or"," ",p.createElement("code",{style:o},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},s),r?p.createElement("pre",{style:n},r):null,i)}var cv=p.createElement(lv,null),Ch=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,s){return s.location!==e.location||s.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:s.error,location:s.location,revalidation:e.revalidation||s.revalidation}}componentDidCatch(e,s){this.props.onError?this.props.onError(e,s):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=sv(e.digest);r&&(e=r)}let s=e!==void 0?p.createElement(ps.Provider,{value:this.props.routeContext},p.createElement(zc.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(dv,{error:e},s):s}};Ch.contextType=jh;var Hi=new WeakMap;function dv({children:e,error:s}){let{basename:r}=p.useContext(Ft);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let a=tv(s.digest);if(a){let n=Hi.get(s);if(n)throw n;let o=yh(a.location,r),i=o.absoluteURL||o.to;if(Jy(i))throw new Error("Invalid redirect location");if(bh&&!Hi.get(s))if(o.isExternal||a.reloadDocument)window.location.href=i;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Hi.set(s,l),l}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i}`})}}return e}function uv({routeContext:e,match:s,children:r}){let a=p.useContext(La);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),p.createElement(ps.Provider,{value:e},r)}function mv(e,s=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(s.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a==null?void 0:a.errors;if(o!=null){let u=n.findIndex(m=>m.route.id&&(o==null?void 0:o[m.route.id])!==void 0);We(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,u+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let u=0;u=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let c=r==null?void 0:r.onError,d=a&&c?(u,m)=>{var h,x;c(u,{location:a.location,params:((x=(h=a.matches)==null?void 0:h[0])==null?void 0:x.params)??{},pattern:Gy(a.matches),errorInfo:m})}:void 0;return n.reduceRight((u,m,h)=>{let x,f=!1,g=null,b=null;a&&(x=o&&m.route.id?o[m.route.id]:void 0,g=m.route.errorElement||cv,i&&(l<0&&h===0?(Eh("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,b=null):l===h&&(f=!0,b=m.route.hydrateFallbackElement||null)));let y=s.concat(n.slice(0,h+1)),v=()=>{let j;return x?j=g:f?j=b:m.route.Component?j=p.createElement(m.route.Component,null):m.route.element?j=m.route.element:j=u,p.createElement(uv,{match:m,routeContext:{outlet:u,matches:y,isDataRoute:a!=null},children:j})};return a&&(m.route.ErrorBoundary||m.route.errorElement||h===0)?p.createElement(Ch,{location:a.location,revalidation:a.revalidation,component:g,error:x,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):v()},null)}function Bc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pv(e){let s=p.useContext(La);return We(s,Bc(e)),s}function hv(e){let s=p.useContext(di);return We(s,Bc(e)),s}function xv(e){let s=p.useContext(ps);return We(s,Bc(e)),s}function Vc(e){let s=xv(e),r=s.matches[s.matches.length-1];return We(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function gv(){return Vc("useRouteId")}function fv(){var a;let e=p.useContext(zc),s=hv("useRouteError"),r=Vc("useRouteError");return e!==void 0?e:(a=s.errors)==null?void 0:a[r]}function bv(){let{router:e}=pv("useNavigate"),s=Vc("useNavigate"),r=p.useRef(!1);return _h(()=>{r.current=!0}),p.useCallback(async(n,o={})=>{Ht(r.current,kh),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:s,...o}))},[e,s])}var nu={};function Eh(e,s,r){!s&&!nu[e]&&(nu[e]=!0,Ht(!1,r))}p.memo(yv);function yv({routes:e,manifest:s,future:r,state:a,isStatic:n,onError:o}){return Sh(e,void 0,{manifest:s,state:a,isStatic:n,onError:o})}function vv(e){return ov(e.context)}function vt(e){We(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function jv({basename:e="/",children:s=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){We(!Un(),"You cannot render a inside another . You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=p.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=Da(r));let{pathname:d="/",search:u="",hash:m="",state:h=null,key:x="default",mask:f}=r,g=p.useMemo(()=>{let b=_s(d,l);return b==null?null:{location:{pathname:b,search:u,hash:m,state:h,key:x,mask:f},navigationType:a}},[l,d,u,m,h,x,a,f]);return Ht(g!=null,` is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the won't render anything.`),g==null?null:p.createElement(Ft.Provider,{value:c},p.createElement(Vn.Provider,{children:s,value:g}))}function wv({children:e,location:s}){return iv(Hl(e),s)}function Hl(e,s=[]){let r=[];return p.Children.forEach(e,(a,n)=>{if(!p.isValidElement(a))return;let o=[...s,n];if(a.type===p.Fragment){r.push.apply(r,Hl(a.props.children,o));return}We(a.type===vt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a component. All component children of must be a or `),We(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=Hl(a.props.children,o)),r.push(i)}),r}var Mo="get",Po="application/x-www-form-urlencoded";function ui(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Nv(e){return ui(e)&&e.tagName.toLowerCase()==="button"}function kv(e){return ui(e)&&e.tagName.toLowerCase()==="form"}function _v(e){return ui(e)&&e.tagName.toLowerCase()==="input"}function Sv(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Cv(e,s){return e.button===0&&(!s||s==="_self")&&!Sv(e)}function Wl(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((s,r)=>{let a=e[r];return s.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Ev(e,s){let r=Wl(e);return s&&s.forEach((a,n)=>{r.has(n)||s.getAll(n).forEach(o=>{r.append(n,o)})}),r}var mo=null;function Rv(){if(mo===null)try{new FormData(document.createElement("form"),0),mo=!1}catch{mo=!0}return mo}var Tv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wi(e){return e!=null&&!Tv.has(e)?(Ht(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Po}"`),null):e}function Mv(e,s){let r,a,n,o,i;if(kv(e)){let l=e.getAttribute("action");a=l?_s(l,s):null,r=e.getAttribute("method")||Mo,n=Wi(e.getAttribute("enctype"))||Po,o=new FormData(e)}else if(Nv(e)||_v(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a
@@ -85,7 +91,7 @@ export const SummaryCards: React.FC = ({ report }) => {
{mostDrifted?.column ?? 'β€”'}
-
PSI: {mostDriftedPsi.toFixed(4)}
+
PSI: {mostDrifted?.psi.toFixed(4) ?? 'β€”'}
); diff --git a/initiatives/analysis/opus_core_analysis-open_queue.md b/initiatives/analysis/opus_core_analysis-open_queue.md index 2ebb5aeeb..e72fefc4e 100644 --- a/initiatives/analysis/opus_core_analysis-open_queue.md +++ b/initiatives/analysis/opus_core_analysis-open_queue.md @@ -29,9 +29,9 @@ archive Log. ## Live β€” fix queue -**Current status (2026-09-12): 70 open / 4 parked.** -OC-271/273/276/283/284/297/299/305 are fixed in the latest eight-finding -Core batch; their rows and verification are in the archive. +**Current status (2026-09-12): 63 open / 4 parked.** +OC-257/290/291/293/296/300/317 are fixed in the latest seven-finding +batch; their rows and verification are in the archive. The verified Qwen follow-up added **48 findings, OC-271–318**, grouped below by priority and domain. Qwen #1/#50/#57 reuse OC-253/65/64; #13 is already fixed as OC-268. #18/#41 share OC-286, which requires both @@ -53,9 +53,6 @@ remaining findings are grouped by domain. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-281 | 🟠 | **Prediction-time row filtering loses the input-to-prediction contract** (`skyulf-core/skyulf/preprocessing/pipeline.py:44,327`) β€” Qwen #12. Define and enforce inference row retention or explicit row provenance through Core and deployment serialization; keep fold-scoring OC-251 separate. | medium | ⬜ open β€” An IQR pipeline returns two predictions for [2,1000,4]; pandas retains indices [0,2], Polars returns [0,1], and serving serializes values without indices; Winsorize preserves all three rows. | -| OC-290 | 🟠 | **Tokenizer and vectorizer outputs collide with existing columns** (`skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py:63,98`) β€” Qwen #23. Apply collision-safe output handling to Tokenizer and the shared Count/TF-IDF/Hashing append path. | medium | ⬜ open β€” Tokenizer overwrites an existing token column on pandas and raises DuplicateError on Polars; CountVectorizer creates duplicate pandas column names and fails on Polars, with TF-IDF/Hashing sharing the helper. | -| OC-293 | 🟠 | **Inference CSV pairs saved predictions with subsequently edited input** (`frontend/ml-canvas/src/components/pages/inference/useInferenceController.tsx:429-447`) β€” Qwen #26. Export the input snapshot belonging to the completed inference result and handle edits or reruns without mixing generations. | small | ⬜ open β€” Predictions 10/20 for input a=1/2 are exported after editing a=9/8/7 as 9,10 then 8,20 then 7,undefined through the actual download hook. | -| OC-317 | 🟠 | **Drift summary cards ignore available categorical PSI metrics** (`frontend/ml-canvas/src/pages/drift/SummaryCards.tsx:16-27`) β€” Qwen #54. Include the appropriate categorical metric when calculating overall drift and selecting the most-drifted feature. | small | ⬜ open β€” With numeric PSI 0.01 and categorical PSI 5, the real cards show Avg 0.0100, Stable and the numeric feature as Most Drifted; OC-257 instead concerns missing Enum metrics in backend dispatch. | ### Next β€” wrong results in realistic configs @@ -69,7 +66,6 @@ remaining findings are grouped by domain. | OC-280 | 🟑 | **Configured default rate limits are not applied to undecorated routes** (`backend/middleware/rate_limiter.py:10-19`) β€” Qwen #11. Wire default limiting into the actual app and retain explicit per-route limits; authentication decisions remain separately parked. | medium | ⬜ open β€” An undecorated mutation route accepts 230/230 requests while an explicit-limit control returns 429 after 60; the current inventory has 34 mutation routes, eight decorated and 26 without default enforcement. | | OC-286 | 🟠 | **Non-finite profile and preview metrics cross JSON persistence boundaries** (`skyulf-core/skyulf/profiling/schemas.py:259-273`; `backend/ml_pipeline/_execution/strategies.py:130-163`) β€” Qwen #18 / #41. Enforce a consistent finite-or-null JSON contract for both EDA profile persistence and background preview/job metrics; closure requires coverage of both write paths. | medium | ⬜ open β€” Qwen #18 typed profile fields retain inf/NaN and #41 actual preview success persists Infinity to SQLite; PostgreSQL/MySQL JSON binders emit non-standard JSON, but live server rejection was not tested and orjson/model_dump_json controls sanitize it. | | OC-289 | 🟑 | **User-controlled identifiers can inject new lines into logs** (`backend/ml_pipeline/model_registry/api.py:43-51`) β€” Qwen #22. Sanitize identifiers and exception text at the affected logging boundaries while retaining prior credential redaction. | small | ⬜ open β€” A real missing-job request containing percent-encoded LF returns 404 but writes a raw newline into the registry log; this demonstrates log-integrity loss, not code execution. | -| OC-291 | 🟑 | **Out-of-order polling responses restore stale non-terminal job state** (`frontend/ml-canvas/src/core/hooks/useJobPolling.ts:161-197`) β€” Qwen #24. Scope response writes to the active polling generation and keep terminal state consistent with scheduling. | small | ⬜ open β€” Resolving a second request as completed and then the first as running leaves the real hook at running with isPolling=false and no further requests; OC-229 protects a different inspector hook. | | OC-292 | 🟑 | **Canvas accepts Segmentation-to-Ensemble connections that convert to invalid data inputs** (`frontend/ml-canvas/src/core/utils/pipelineConversion/ensemble.ts:11-16`) β€” Qwen #25. Align connection validation, ensemble conversion and backend input expectations for unsupported model families. | medium | ⬜ open β€” Registered port validation accepts the connection and the actual converter lists the segmentation training node as Ensemble data input; the backend rejects its Model artifact where Dataset is required. | | OC-318 | 🟑 | **Empty scaling range fields pass validation and become null bounds** (`frontend/ml-canvas/src/modules/nodes/processing/scaling/ScalingControls.tsx:64,91`) β€” Qwen #55. Validate finite MinMax/Robust range inputs in the UI and reject invalid serialized bounds at the Core boundary. | small | ⬜ open β€” Clearing the real controls produces NaN, valid=true and JSON [null,1] or [null,75]; actual Core fitting fails with a None comparison TypeError. | @@ -130,7 +126,6 @@ remaining findings are grouped by domain. | OC-285 | 🟑 | **DropMissingRows accepts invalid how values with different semantics** (`skyulf-core/skyulf/preprocessing/drop_and_missing/drop_rows.py:56,94,158`) β€” Qwen #17. Reject unsupported how values at the public configuration boundary before engine dispatch. | small | ⬜ open β€” how=bad or None retains three rows on pandas and one on Polars; valid any/all controls agree, so the defect is invalid-config handling rather than the normal UI options. | | OC-294 | 🟑 | **Numeric imputation handles explicitly selected text columns inconsistently** (`skyulf-core/skyulf/preprocessing/imputation/simple.py:169,187`) β€” Qwen #27. Validate or consistently filter incompatible explicit column selections before mean/median calculation. | small | ⬜ open β€” Selecting num and txt makes pandas fill only num while Polars raises on string reduction; numeric-only selections work, and the older numeric-constant fix is a different case. | | OC-295 | 🟑 | **Automatic text cleaning converts pandas Decimal values into strings** (`skyulf-core/skyulf/preprocessing/_helpers.py:283`) β€” Qwen #28. Exclude semantic numeric Decimal columns from automatic text selection while retaining legitimate string cleaning. | small | ⬜ open β€” Decimal values 12.34 and 56.78 become strings on pandas but stay Decimal on Polars; the numeric selector and profiling OC-259 use different call sites. | -| OC-296 | 🟑 | **MissingIndicator schema predicts output columns that execution will not create** (`skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py:103,117,157`) β€” Qwen #29. Make inferred output schema match missing-column handling and validate downstream references against the actual result. | small | ⬜ open β€” Input x with configured ghost predicts ghost_missing, but execution only returns x; the backend still flags the original ghost reference and misses the downstream phantom-output reference. | | OC-298 | 🟑 | **Boolean alias conversion changes unmatched numeric values to strings on Polars** (`skyulf-core/skyulf/preprocessing/cleaning/alias.py:55,65,103,110`) β€” Qwen #31. Define consistent handling for explicitly selected non-text columns and preserve unmatched values under the supported alias contract. | small | ⬜ open β€” Explicit numeric input 2,3,4 remains integer on pandas but becomes strings on Polars; ordinary automatic text selection does not demonstrate this defect. | | OC-301 | 🟑 | **Advanced resampler settings are saved but not forwarded to sampler construction** (`skyulf-core/skyulf/preprocessing/resampling.py:205,213,298,303`) β€” Qwen #34. Pass supported SVC/KMeans/n_jobs settings to the appropriate sampler with capability-aware validation. | small | ⬜ open β€” Actual SVMSMOTE receives svm_estimator=None and KMeansSMOTE receives kmeans_estimator=None/n_jobs=None despite configured artifacts; plain SMOTE in this installation does not accept n_jobs. | @@ -140,7 +135,6 @@ remaining findings are grouped by domain. | ID | Sev | Item | Effort | Status | |---|---|---|---|---| | OC-264 | 🟑 | GeneralTransformation fits each power rule against the original input although apply executes same-column rules sequentially (`preprocessing/transformations/general.py:225-228`) | small | ⬜ open β€” a log rule followed by standardized Yeo-Johnson yields mean `-0.995375`; equivalent sequential nodes yield approximately zero on both engines, so later rules learn the wrong intermediate distribution. | -| OC-300 | 🟑 | **Polars arithmetic feature fillna leaves floating-point NaN untouched** (`skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py:30`) β€” Qwen #33. Apply the configured missing-value policy to both null and NaN before arithmetic operations. | small | ⬜ open β€” For [1,NaN,3], add 2 and fillna 10, pandas returns [3,12,5] while Polars returns [3,NaN,5]; the older ratio fix does not cover this arithmetic path. | | OC-313 | 🟑 | **SentenceEmbedder model caching permits duplicate concurrent loads** (`skyulf-core/skyulf/preprocessing/vectorization/sentence_embedder.py:33,41,53,159,209`) β€” Qwen #49. Coordinate same-key model construction within a process and handle loading failures without leaving waiters stuck. | medium | ⬜ open β€” Four threads using one model name create four model objects through a synchronized fake constructor but leave one cache entry; real model download, GPU OOM and cross-process cache sharing were not tested. | @@ -150,7 +144,6 @@ remaining findings are grouped by domain. |---|---|---|---|---| | OC-47 | 🟑 | Common-column dtype drift can silently disappear or be erased by a successful lossy cast to the reference dtype (`profiling/drift.py:192`) | small | ⬜ open β€” besides the original uncastable-to-null case, integer reference `[0]*50+[1]*50` against fractional current `[0.9]*50+[1.9]*50 reports all distances zero; a Float64 reference control detects drift with normalized Wasserstein `1.8`. | | OC-50 | 🟑 | Binary targets miss class-balance advice or flip to regression by sample size (`recommendations.py:147-152`) | small | ⬜ open | -| OC-257 | 🟑 | Native Enum columns bypass categorical drift dispatch and disappear from the report (`profiling/drift.py:154-162`) | small | ⬜ open β€” identical Enum dtypes with 100 `a` values replaced by 100 `b` values return zero drift and no column metrics; String controls detect PSI `10.54365`. | | OC-259 | 🟑 | Decimal columns are classified as Text and abort the entire EDA profile when batched string aggregates run (`profiling/_analyzer/_utils.py:64`, `profiling/analyzer.py:278`) | small | ⬜ open β€” a two-row Decimal amount column raises SchemaError from `str.len_bytes()`; Time/List columns hit the same unsupported-dtype fallback, while Float64 succeeds. | | OC-260 | 🟑 | Time-series plotting builds unequal timestamp/value arrays when metrics have different missingness (`profiling/visualizer.py:823-827,846`) | small | ⬜ open β€” a native profile with 1000 timestamps and only 500 observed values for one metric makes public `EDAVisualizer.plot()` raise an x/y dimension mismatch. | | OC-274 | 🟑 | **Causal feature selection spends its cap on constant columns** (`skyulf-core/skyulf/profiling/_analyzer/causal.py:25-30`) β€” Qwen #5. Handle non-finite ranking values deterministically and retain eligible variable features before applying the cap. | small | ⬜ open β€” Moving five constant columns from the start to the end of the schema changes selected variable features from 9 to 14; the reported 20/70 edge counts were not reproduced. | diff --git a/initiatives/analysis/opus_core_analysis-tracker.md b/initiatives/analysis/opus_core_analysis-tracker.md index 7d6d0b3bf..cd44e6eb9 100644 --- a/initiatives/analysis/opus_core_analysis-tracker.md +++ b/initiatives/analysis/opus_core_analysis-tracker.md @@ -16,8 +16,8 @@ and is not counted. **Qwen follow-up (2026-09-12):** the verified findings filed 48 additional records, OC-271–318, after deduplication and scope -correction. Eight have since closed. The live queue now has -**70 open / 4 parked**; details +correction. Fourteen have since closed. The live queue now has +**63 open / 4 parked**; details and exclusions are in the latest Log entry. Historical baseline counts below are unchanged. @@ -109,6 +109,9 @@ uses, so a fixed finding stays where it was filed. | OC-276 | 🟠 | **Binning interval labels differ between training and replay engines** (`skyulf-core/skyulf/preprocessing/bucketing.py:55,67,170,179`) β€” Qwen #7. Canonicalize integral bin-edge labels across engines and verify an actual downstream DummyEncoder replay. | medium | βœ… fixed β€” 2026-09-12: New range artifacts persist identical labels for both engines, using exact edge text when rounding merges names; serialized binning-to-Dummy replay preserves all four indicators, with legacy formatting retained until coordinated refit. | | OC-283 | 🟠 | **Binning can overwrite an existing output column or delete its source** (`skyulf-core/skyulf/preprocessing/bucketing.py:98,138,266,279`) β€” Qwen #15. Validate generated-name collisions and define safe same-name output/drop behavior before mutating either engine. | small | βœ… fixed β€” 2026-09-12: Fit and inference reject retained-name collisions and build outputs from original source values, so empty-suffix replacement preserves its binned output and other dropped source names can be reused safely. | | OC-297 | 🟠 | **Replacing infinity can silently round large Polars integers** (`skyulf-core/skyulf/preprocessing/cleaning/invalid_value.py:67,182,213`) β€” Qwen #30. Preserve exact integer values and avoid widening integer columns merely to inspect or replace floating-point infinities. | small | βœ… fixed β€” 2026-09-12: Infinity-only cleanup skips impossible integer matches, preserving exact signed/unsigned values and dtypes at fit/apply boundaries while configured numeric rules and float replacements remain effective. | +| OC-290 | 🟠 | **Tokenizer and vectorizer outputs collide with existing columns** (`skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py:63,98`) β€” Qwen #23. Apply collision-safe output handling to Tokenizer and the shared Count/TF-IDF/Hashing append path. | medium | βœ… fixed β€” 2026-09-12: Tokenizer and all four vectorizer consumers validate retained-column collisions at fit/apply; Tokenizer computes from original sources before dropping them, preserving safe name reuse and engine/wrapper/index behavior. | +| OC-293 | 🟠 | **Inference CSV pairs saved predictions with subsequently edited input** (`frontend/ml-canvas/src/components/pages/inference/useInferenceController.tsx:429-447`) β€” Qwen #26. Export the input snapshot belonging to the completed inference result and handle edits or reruns without mixing generations. | small | βœ… fixed β€” 2026-09-12: The results table and CSV use the displayed completed run's saved input through edits, reruns and history restoration; clearing or retiring a request blocks late success/error/finally writes. | +| OC-317 | 🟠 | **Drift summary cards ignore available categorical PSI metrics** (`frontend/ml-canvas/src/pages/drift/SummaryCards.tsx:16-27`) β€” Qwen #54. Include the appropriate categorical metric when calculating overall drift and selecting the most-drifted feature. | small | βœ… fixed β€” 2026-09-12: Summary cards include finite numeric and categorical PSI once per column; the 0.01/5 example shows average 2.5050 and category as most drifted, while unavailable PSI remains distinct from measured zero. | ### Next β€” wrong results in realistic configs @@ -140,6 +143,7 @@ uses, so a fixed finding stays where it was filed. | OC-43 | 🟠 | Correlation drops valid columns/rows instead of the defined missing-data policy (`correlations.py:41-44,100-110`) | small | βœ… fixed 2026-09-05 | | OC-44 | 🟠 | Wasserstein drift thresholds normalized value but reports raw one (`drift.py:181-195`) | small | βœ… fixed 2026-09-05 | | OC-45 | 🟠 | Schema drift computed but never counted or rendered as drift (`drift.py:76-98`) | small | βœ… fixed 2026-09-05 | +| OC-291 | 🟑 | **Out-of-order polling responses restore stale non-terminal job state** (`frontend/ml-canvas/src/core/hooks/useJobPolling.ts:161-197`) β€” Qwen #24. Scope response writes to the active polling generation and keep terminal state consistent with scheduling. | small | βœ… fixed β€” 2026-09-12: Polling ignores responses older than its newest applied snapshot and stops queued/socket refreshes after terminal results; slow APIs still publish progress and stale failures cannot corrupt retry accounting. | ### Ongoing β€” remove the hiding conditions @@ -244,6 +248,7 @@ uses, so a fixed finding stays where it was filed. | OC-182 | 🟑 | Encoder auto-detection ignores pandas `StringDtype` columns: Dummy/Hash encoding silently leaves strings untouched unless columns are selected explicitly (`preprocessing/encoding/_common.py:140`) | small | Γ’ΒœΒ… fixed 2026-09-08 | | OC-22 | βšͺ | `TargetEncoder.infer_output_schema` checks an impossible `regression` value (`encoding/target.py:340-360`) | 1 line | βœ… fixed 2026-09-06 β€” the `("binary", "regression")` passthrough was pinned by a test asserting a prediction for a config sklearn 1.8 rejects outright; changed to `"continuous"` and confirmed it really encodes rather than merely being reachable. See the log entry | | OC-299 | 🟑 | **Automatic encoder selection skips native Enum columns** (`skyulf-core/skyulf/preprocessing/encoding/_common.py:131,146`) β€” Qwen #32. Include supported categorical Enum types in the common selector used by all six encoders. | small | βœ… fixed β€” 2026-09-12: The shared categorical selector now includes native Enum for all six encoder consumers; auto-selection matches explicit encoding and persisted held-out replay, with pipeline refit needed for previously skipped columns. | +| OC-296 | 🟑 | **MissingIndicator schema predicts output columns that execution will not create** (`skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py:103,117,157`) β€” Qwen #29. Make inferred output schema match missing-column handling and validate downstream references against the actual result. | small | βœ… fixed β€” 2026-09-12: MissingIndicator predicts flags only for sources present in its original input schema; real schema-graph propagation now exposes downstream phantom references and matches both engines' runtime columns. | ### Remaining β€” feature generation / selection / vectorization / transformations @@ -266,6 +271,7 @@ uses, so a fixed finding stays where it was filed. | OC-34 | 🟑 | Count/TF-IDF vectorizers crash on empty or stop-word-only corpora (`vectorization/count_vectorizer.py`, `tfidf_vectorizer.py`) | small | βœ… fixed 2026-09-11 β€” warn and return an empty artifact for an empty vocabulary; preserve source data and replay, while other settings/pruning errors still raise. | | OC-27 | 🟠 | `GeneralTransformation` ignores the UI `standardize` toggle (`transformations/general.py`) | small | βœ… fixed 2026-09-11 β€” retain each power rule's standardization choice through fitting and replay; older artifacts keep their previous default. | | OC-28 | 🟠 | Box-Cox transform failures silently return untransformed data (`transformations/power.py:97-104`) | small | βœ… fixed 2026-09-06 β€” the silent path was the `valid_cols` filter, not the `except` (which has logged since the node was created); both engines now share `_fitted_columns_present`, which names the fitted columns the frame lacks, and fail-open is kept by decision. See the log entry | +| OC-300 | 🟑 | **Polars arithmetic feature fillna leaves floating-point NaN untouched** (`skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py:30`) β€” Qwen #33. Apply the configured missing-value policy to both null and NaN before arithmetic operations. | small | βœ… fixed β€” 2026-09-12: Polars arithmetic fills both NaN and null using the configured replacement before add/subtract/multiply/divide, preserving source values and integer/null-only controls. | ### Remaining β€” profiling (outside the OC-39–46 cluster) @@ -296,6 +302,7 @@ uses, so a fixed finding stays where it was filed. | OC-189 | 🟑 | Classification rule text reports `Samples: 1` for leaves containing multiple rows: it sums sklearn's normalized class proportions instead of using the leaf sample count (`profiling/_analyzer/rules.py:299-301`) | small | βœ… fixed 2026-09-09 - classification rule support uses the fitted tree row count while confidence retains class proportions. | | OC-188 | 🟠 | Rule discovery decodes sklearn class positions against Polars' shared category dictionary, publishing labels absent from the target while reporting perfect accuracy (`profiling/_analyzer/rules.py:169-170,196-198,295-298`) | small | βœ… fixed 2026-09-09 - target-local codes map every rule prediction to the actual observed class label. | | OC-305 | 🟑 | **All-null temporal profile bounds serialize as the string None** (`skyulf-core/skyulf/profiling/_analyzer/dates.py:164-171`) β€” Qwen #40. Return actual nullable bounds in the profile schema instead of stringifying absent temporal extrema. | small | βœ… fixed β€” 2026-09-12: Missing Date/Datetime extrema remain actual nulls in profile dictionaries and JSON while native units, timezones and nonmissing bounds retain their existing behavior. | +| OC-257 | 🟑 | Native Enum columns bypass categorical drift dispatch and disappear from the report (`profiling/drift.py:154-162`) | small | βœ… fixed β€” 2026-09-12: Native Enum uses categorical drift dispatch; the 100 a to 100 b shift yields PSI 10.543651559430593 and one drifted column, matching String/Categorical controls. | ### Remaining β€” core / engines / pipeline @@ -449,6 +456,74 @@ respective fix logs; OC-167 closed with canonical artifact framing on 2026-09-09 ## Log +### 2026-09-12 β€” OC-257/290/291/293/296/300/317: seven verified fixes + +Committed the preceding eight-finding Core batch as `8053a84c` with DCO +sign-off after fresh regression tests and passing commit hooks. Continued +with seven unparked findings using three agents and independent diff reviews. +This new batch remains uncommitted for review; no push was requested or made. + +- **OC-257:** native Enum columns now enter categorical drift calculation. + Replacing 100 `a` values with 100 `b` values produces categorical PSI + `10.543651559430593` and one drifted column, matching String/Categorical + controls. Stable data, unused Enum labels and custom thresholds are covered. + The separate lossy dtype-cast finding OC-47 remains open. +- **OC-290:** Tokenizer, Count, TF-IDF, Hashing and Sentence Embedder validate + generated names against the full retained input schema at fit and replay. + Retained-name collisions now raise `ValueError` on both engines. Tokenizer + computes all outputs from original source values before dropping/concatenating, + so names of dropped sources can be reused without corrupting later inputs. + Tests cover pipeline replay, native/wrapped engines, labels, indices, missing + sources and vocabulary controls. Sentence Embedder's external model loader + is stubbed; no model download or real embedding quality claim is involved. +- **OC-291:** effect-local polling generations protect status and failure + counters from out-of-order completions. Terminal results stop pending timer + and socket refreshes. Review reproduced starvation in an initial guard when + every request exceeded the polling interval; the final guard compares against + the newest applied request, allowing slow progress while newer work is pending. +- **OC-293:** result-table rows and downloaded CSV use the displayed completed + run's saved input, including persisted history and results kept during a rerun. + Predictions `10/20` for input `1/2` still export `1,10` and `2,20` after the + editor changes to `9/8/7` or invalid JSON. Clear, undeploy, deployment changes + and unmount retire obsolete requests; stale success/error/finally handlers + cannot overwrite newer state. Unmount retains interrupted-run provenance. +- **OC-296:** schema prediction checks MissingIndicator sources against the + original input schema, matching runtime filtering. Input `x` with selected + `ghost` no longer invents `ghost_missing`. Actual backend schema propagation + and reference validation detect both the original missing source and the + downstream phantom flag; mixed selections, custom suffixes and cascading + flag names are covered on both engines. Automatic selection stays unknown. +- **OC-300:** Polars arithmetic replaces both NaN and null before all four + arithmetic operations, using the configured `fillna` or default zero. The + `[1, NaN, 3] + 2` example with replacement `10` now gives `[3, 12, 5]`. + Primary/secondary operands, source preservation and integer/null-only + controls agree with pandas; the separate ratio behavior is unchanged. +- **OC-317:** the real summary cards use finite `psi` and `psi_categorical` + measurements once per column. Numeric `0.01` plus categorical `5` now shows + average `2.5050`, Significant drift, and category as Most Drifted. Missing or + non-finite PSI is unavailable, while measured zero remains valid. Scope is + the summary cards; compact history summaries and CSV metric selection were + not changed by this item. + +Verification: failing regressions were captured before production changes. +The final affected Core suites passed **703 tests** (365 feature/schema/missing +tests plus 338 vectorization/drift tests), and the separate backend schema +graph/preview/reference suites passed **28 tests**. Full frontend Vitest passed +**2,522 tests in 195 files**. Four Playwright cases passed at desktop 1440px +and mobile 390px using the real pages with mocked API boundaries; inference +checks inspect actual downloaded CSV contents, and drift screenshots were +visually checked. The CSV test's ambiguous upload/download selector was fixed +before its successful rerun. Scoped Ruff/format, global `ty check`, full ESLint, +CCN, explicit E2E lint, TypeScript/Vite production build and bundle size gates +passed. Generated `static/ml_canvas` assets were rebuilt. + +Updated preprocessing, text-NLP and drift user documentation plus the v0.8.21 +changelog. Existing conflicting text inputs must be renamed; rerun affected +transformations from original data and refit downstream models where needed. +Regenerate old Enum drift checks to recover omitted metrics. The seven rows +are archived with their evidence: **63 open / 4 parked** remain. The user's +deleted standalone Qwen reports and unrelated `tmp_eda_shots/` stay untouched. + ### 2026-09-12 β€” OC-271/273/276/283/284/297/299/305: eight Core fixes Continued the user-approved queue with three implementation agents owning diff --git a/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py b/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py index 5def1b607..f0a20cfd8 100644 --- a/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py +++ b/skyulf-core/skyulf/preprocessing/drop_and_missing/missing_indicator.py @@ -147,8 +147,9 @@ def infer_output_schema( """Predict the added flag columns, or ``None`` when the set is data-dependent. With an explicit list the output is the input plus one ``int64`` - ```` column each; otherwise which columns hold - missing values decides, and callers must introspect at runtime. + ```` column for each source present in the input; + otherwise which columns hold missing values decides, and callers + must introspect at runtime. """ # Adds one int64 (0/1) column "" per indicator # column. Only predictable when the user supplied an explicit column @@ -160,7 +161,8 @@ def infer_output_schema( suffix = config.get("flag_suffix") or _DEFAULT_FLAG_SUFFIX new_schema = input_schema for col in explicit: - new_schema = new_schema.add(f"{col}{suffix}", "int64") + if col in input_schema: + new_schema = new_schema.add(f"{col}{suffix}", "int64") return new_schema def fit(self, df: Any, config: dict[str, Any]) -> MissingIndicatorArtifact: diff --git a/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py b/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py index 645a7067f..408870c87 100644 --- a/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py +++ b/skyulf-core/skyulf/preprocessing/feature_generation/_polars_ops.py @@ -23,11 +23,12 @@ def _polars_arith_terms(op: dict[str, Any], existing: list[str]) -> tuple[list[Any], list[float]]: + """Build numeric operands with the same null and NaN replacement as pandas.""" valid = [ c for c in op.get("input_columns", []) + op.get("secondary_columns", []) if c in existing ] fill_val = op.get("fillna") if op.get("fillna") is not None else 0 - col_exprs = [pl.col(c).cast(pl.Float64).fill_null(fill_val) for c in valid] + col_exprs = [pl.col(c).cast(pl.Float64).fill_nan(fill_val).fill_null(fill_val) for c in valid] const_vals = [float(c) for c in op.get("constants", [])] return col_exprs, const_vals diff --git a/skyulf-core/skyulf/preprocessing/vectorization/_common.py b/skyulf-core/skyulf/preprocessing/vectorization/_common.py index 67d8fd01f..4068f962c 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/_common.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/_common.py @@ -13,7 +13,7 @@ """ import logging -from collections.abc import Callable +from collections.abc import Callable, Mapping from typing import Any import numpy as np @@ -23,6 +23,7 @@ from ...engines.polars_engine import SkyulfPolarsWrapper from ...utils import pack_pipeline_output, unpack_pipeline_input from .._helpers import resolve_valid_columns +from .._output_names import validate_generated_column_names logger = logging.getLogger(__name__) @@ -164,6 +165,16 @@ def _text_series(series: pd.Series) -> pd.Series: return series.astype(object).where(series.notna(), "").astype(str) +def validate_text_output_names(X: Any, params: Mapping[str, Any], valid_cols: list[str]) -> None: + """Check emitted text features against the full retained input schema.""" + validate_generated_column_names( + X.columns, + params.get("output_columns", []), + dropped_columns=valid_cols if params.get("drop_original", False) else (), + node_name=params.get("type", "Text vectorizer"), + ) + + def _join_text_columns(X: pd.DataFrame, cols: list) -> pd.Series: """Concatenate one or more text columns into a single string series.""" series = _text_series(X[cols[0]]) @@ -216,7 +227,13 @@ def _vectorizer_transform_to_frame( def _drop_and_concat( X: pd.DataFrame, encoded_df: pd.DataFrame, valid_cols: list[str], drop_original: bool ) -> pd.DataFrame: - """Optionally drop source columns from *X*, then concat the encoded frame.""" + """Validate generated names, optionally drop sources, then attach their encoded values.""" + validate_generated_column_names( + X.columns, + encoded_df.columns, + dropped_columns=valid_cols if drop_original else (), + node_name="Text vectorizer", + ) X_out = X.copy() if drop_original: X_out = X_out.drop(columns=valid_cols) @@ -252,6 +269,12 @@ def _drop_and_concat_polars( X: Any, encoded_frame: Any, valid_cols: list[str], drop_original: bool ) -> Any: """Native-Polars equivalent of :func:`_drop_and_concat`.""" + validate_generated_column_names( + X.columns, + encoded_frame.columns, + dropped_columns=valid_cols if drop_original else (), + node_name="Text vectorizer", + ) X_out = X.drop(valid_cols) if drop_original else X return X_out.hstack(encoded_frame) @@ -276,6 +299,7 @@ def _sklearn_vectorizer_apply_polars(X: Any, params: dict[str, Any]) -> Any: if not valid_cols: return X + validate_text_output_names(X, params, valid_cols) text = _join_text_columns_polars(X, valid_cols) if text is None: return None diff --git a/skyulf-core/skyulf/preprocessing/vectorization/count_vectorizer.py b/skyulf-core/skyulf/preprocessing/vectorization/count_vectorizer.py index 13a34781e..96c380ef0 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/count_vectorizer.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/count_vectorizer.py @@ -26,6 +26,7 @@ _warn_large_output, apply_text_dual_engine, resolve_fit_text_columns, + validate_text_output_names, ) logger = logging.getLogger(__name__) @@ -169,6 +170,8 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> CountVectorizerArtifac resolved = resolve_fit_text_columns(X, config, _y) if resolved is None: return {} - X, valid_cols = resolved + text_frame, valid_cols = resolved - return _build_count_artifact(config, X, valid_cols) + artifact = _build_count_artifact(config, text_frame, valid_cols) + validate_text_output_names(X, artifact, valid_cols) + return artifact diff --git a/skyulf-core/skyulf/preprocessing/vectorization/hashing_vectorizer.py b/skyulf-core/skyulf/preprocessing/vectorization/hashing_vectorizer.py index cd04dd52c..56af2101f 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/hashing_vectorizer.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/hashing_vectorizer.py @@ -25,6 +25,7 @@ _warn_large_output, apply_text_dual_engine, resolve_fit_text_valid_columns, + validate_text_output_names, ) logger = logging.getLogger(__name__) @@ -155,4 +156,6 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> HashingVectorizerArtif if valid_cols is None: return {} - return _build_hashing_artifact(config, valid_cols) + artifact = _build_hashing_artifact(config, valid_cols) + validate_text_output_names(X, artifact, valid_cols) + return artifact diff --git a/skyulf-core/skyulf/preprocessing/vectorization/sentence_embedder.py b/skyulf-core/skyulf/preprocessing/vectorization/sentence_embedder.py index 8704ed8a9..fcaf2462e 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/sentence_embedder.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/sentence_embedder.py @@ -21,11 +21,13 @@ from .._artifacts import SentenceEmbedderArtifact from ..base import BaseApplier, BaseCalculator, apply_method, fit_method from ._common import ( + _drop_and_concat, _drop_and_concat_polars, _join_text_columns, _join_text_columns_polars, apply_text_dual_engine, resolve_fit_text_valid_columns, + validate_text_output_names, ) logger = logging.getLogger(__name__) @@ -73,6 +75,7 @@ def _embedding_dimension(model: Any) -> int: def _embed_apply_pandas( X: pd.DataFrame, y: Any, params: dict[str, Any] ) -> tuple[pd.DataFrame, Any]: + """Encode the original text and attach embeddings without aliasing retained columns.""" cols: list[str] = params.get("columns", []) output_columns: list[str] = params.get("output_columns", []) model_name: str = params.get("model_name", "all-MiniLM-L6-v2") @@ -93,10 +96,7 @@ def _embed_apply_pandas( index=X.index, ) - X_out = X.copy() - if drop_original: - X_out = X_out.drop(columns=valid_cols) - return pd.concat([X_out, emb_df], axis=1), y + return _drop_and_concat(X, emb_df, valid_cols, drop_original), y def _embed_apply_polars(X: Any, params: dict[str, Any]) -> Any: @@ -115,6 +115,7 @@ def _embed_apply_polars(X: Any, params: dict[str, Any]) -> Any: if not valid_cols or not output_columns: return X + validate_text_output_names(X, params, valid_cols) text = _join_text_columns_polars(X, valid_cols) if text is None: return None @@ -218,4 +219,6 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> SentenceEmbedderArtifa if valid_cols is None: return {} - return _build_sentence_embedder_artifact(config, valid_cols) + artifact = _build_sentence_embedder_artifact(config, valid_cols) + validate_text_output_names(X, artifact, valid_cols) + return artifact diff --git a/skyulf-core/skyulf/preprocessing/vectorization/tfidf_vectorizer.py b/skyulf-core/skyulf/preprocessing/vectorization/tfidf_vectorizer.py index d6bdbe546..9728c8162 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/tfidf_vectorizer.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/tfidf_vectorizer.py @@ -22,6 +22,7 @@ _warn_large_output, apply_text_dual_engine, resolve_fit_text_columns, + validate_text_output_names, ) logger = logging.getLogger(__name__) @@ -162,6 +163,8 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> TfidfVectorizerArtifac resolved = resolve_fit_text_columns(X, config, _y) if resolved is None: return {} - X, valid_cols = resolved + text_frame, valid_cols = resolved - return _build_tfidf_artifact(config, X, valid_cols) + artifact = _build_tfidf_artifact(config, text_frame, valid_cols) + validate_text_output_names(X, artifact, valid_cols) + return artifact diff --git a/skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py b/skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py index 3fab7ab8e..920a9f7fd 100644 --- a/skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py +++ b/skyulf-core/skyulf/preprocessing/vectorization/tokenizer.py @@ -19,7 +19,14 @@ from ...registry import NodeRegistry from .._artifacts import TokenizerArtifact from ..base import BaseApplier, BaseCalculator, apply_method, fit_method -from ._common import _text_series, apply_text_dual_engine, resolve_fit_text_valid_columns +from ._common import ( + _drop_and_concat, + _drop_and_concat_polars, + _text_series, + apply_text_dual_engine, + resolve_fit_text_valid_columns, + validate_text_output_names, +) logger = logging.getLogger(__name__) @@ -46,6 +53,7 @@ def _build_analyzer(params: dict[str, Any]): def _tokenizer_apply_pandas( X: pd.DataFrame, y: Any, params: dict[str, Any] ) -> tuple[pd.DataFrame, Any]: + """Tokenize original sources before dropping them and attaching validated outputs.""" cols: list[str] = params.get("columns", []) drop_original: bool = params.get("drop_original", False) add_token_count: bool = params.get("add_token_count", False) @@ -55,18 +63,16 @@ def _tokenizer_apply_pandas( return X, y analyze = _build_analyzer(params) - X_out = X.copy() + outputs = pd.DataFrame(index=X.index) for col in valid_cols: - text = _text_series(X_out[col]) + text = _text_series(X[col]) tokens = text.map(analyze) - X_out[f"{col}__tokens"] = tokens.map(" ".join) # ty: ignore[no-matching-overload] + outputs[f"{col}__tokens"] = tokens.map(" ".join) # ty: ignore[no-matching-overload] if add_token_count: - X_out[f"{col}__token_count"] = tokens.map(len) + outputs[f"{col}__token_count"] = tokens.map(len) - if drop_original: - X_out = X_out.drop(columns=valid_cols) - return X_out, y + return _drop_and_concat(X, outputs, valid_cols, drop_original), y def _tokenizer_apply_polars(X: Any, params: dict[str, Any]) -> Any: @@ -94,8 +100,7 @@ def _tokenizer_apply_polars(X: Any, params: dict[str, Any]) -> Any: if add_token_count: new_cols.append(pl.Series(f"{col}__token_count", [len(toks) for toks in tokens])) - X_out = X.drop(valid_cols) if drop_original else X - return X_out.hstack(new_cols) + return _drop_and_concat_polars(X, pl.DataFrame(new_cols), valid_cols, drop_original) class TokenizerApplier(BaseApplier): @@ -193,4 +198,6 @@ def fit(self, X: Any, _y: Any, config: dict[str, Any]) -> TokenizerArtifact: # if valid_cols is None: return {} - return _build_tokenizer_artifact(config, valid_cols) + artifact = _build_tokenizer_artifact(config, valid_cols) + validate_text_output_names(X, artifact, valid_cols) + return artifact diff --git a/skyulf-core/skyulf/profiling/drift.py b/skyulf-core/skyulf/profiling/drift.py index 204660d3f..e6483e630 100644 --- a/skyulf-core/skyulf/profiling/drift.py +++ b/skyulf-core/skyulf/profiling/drift.py @@ -151,7 +151,7 @@ def calculate_drift(self, thresholds: dict[str, float] | None = None) -> DriftRe def _calculate_column_drift(self, col: str, thresholds: dict[str, float]) -> ColumnDrift | None: """Dispatch drift calculation for a single column based on its dtype.""" dtype = self.reference_df[col].dtype - is_categorical = dtype in [pl.Utf8, pl.String, pl.Categorical, pl.Boolean] + is_categorical = dtype in [pl.Utf8, pl.String, pl.Categorical, pl.Enum, pl.Boolean] if is_categorical: return self._calculate_categorical_drift(col, thresholds) diff --git a/skyulf-core/tests/integration/test_arithmetic_missing_values.py b/skyulf-core/tests/integration/test_arithmetic_missing_values.py new file mode 100644 index 000000000..2938bea8a --- /dev/null +++ b/skyulf-core/tests/integration/test_arithmetic_missing_values.py @@ -0,0 +1,83 @@ +"""Arithmetic features must fill native nulls and NaNs consistently.""" + +import pandas as pd +import polars as pl +import pytest + +from skyulf.preprocessing.feature_generation import ( + FeatureGenerationApplier, + FeatureGenerationCalculator, +) + + +@pytest.mark.parametrize("engine", ["pandas", "polars"]) +@pytest.mark.parametrize("fillna", [None, 0, 10]) +@pytest.mark.parametrize("method", ["add", "subtract", "multiply", "divide"]) +def test_arithmetic_fills_missing_primary_and_secondary_operands( + engine: str, fillna: int | None, method: str, monkeypatch: pytest.MonkeyPatch +) -> None: + """Missing values in either operand must use the configured replacement on replay.""" + monkeypatch.setenv("SKYULF_ENGINE", engine) + data = { + "a": [1.0, float("nan"), None, 6.0, 6.0], + "b": [2.0, 2.0, 2.0, float("nan"), None], + } + # Direct construction preserves the distinction between Polars NaN and null. + frame = pd.DataFrame(data) if engine == "pandas" else pl.DataFrame(data) + operation = { + "operation_type": "arithmetic", + "method": method, + "input_columns": ["a"], + "secondary_columns": ["b"], + "constants": [2], + "output_column": "result", + } + if fillna is not None: + operation["fillna"] = fillna + params = FeatureGenerationCalculator().fit(frame, {"operations": [operation]}) + + result = FeatureGenerationApplier().apply(frame, params) + + replacement = fillna or 0 + expected = { + "add": [5, replacement + 4, replacement + 4, 8 + replacement, 8 + replacement], + "subtract": [-3, replacement - 4, replacement - 4, 4 - replacement, 4 - replacement], + "multiply": [4, replacement * 4, replacement * 4, 12 * replacement, 12 * replacement], + "divide": [ + 0.25, + replacement / 4, + replacement / 4, + 3 / max(replacement, 1e-9), + 3 / max(replacement, 1e-9), + ], + } + assert result[["a", "b"]].equals(frame) + assert result["result"].to_list() == pytest.approx(expected[method]) + + +@pytest.mark.parametrize("engine", ["pandas", "polars"]) +@pytest.mark.parametrize("values,expected", [([1, 3], [3, 5]), ([None, None], [12, 12])]) +def test_arithmetic_fill_preserves_integer_and_null_only_inputs( + engine: str, values: list, expected: list, monkeypatch: pytest.MonkeyPatch +) -> None: + """NaN normalization must also support integer and untyped null-only columns.""" + monkeypatch.setenv("SKYULF_ENGINE", engine) + data = {"a": values} + frame = pd.DataFrame(data) if engine == "pandas" else pl.DataFrame(data) + config = { + "operations": [ + { + "operation_type": "arithmetic", + "method": "add", + "input_columns": ["a"], + "constants": [2], + "fillna": 10, + "output_column": "result", + } + ] + } + params = FeatureGenerationCalculator().fit(frame, config) + + result = FeatureGenerationApplier().apply(frame, params) + + assert result["result"].to_list() == pytest.approx(expected) diff --git a/skyulf-core/tests/integration/test_profiling_drift.py b/skyulf-core/tests/integration/test_profiling_drift.py index 71b887601..d9778bdc9 100644 --- a/skyulf-core/tests/integration/test_profiling_drift.py +++ b/skyulf-core/tests/integration/test_profiling_drift.py @@ -259,6 +259,54 @@ def test_calculate_drift_detects_categorical_distribution_shift() -> None: assert report.drifted_columns_count == 1 +@pytest.mark.parametrize( + "dtype", + [ + pl.String, + pl.Categorical, + pl.Enum(["a", "b"]), + pl.Enum(["a", "b", *[f"unused_{i}" for i in range(60)]]), + ], + ids=["string", "categorical", "enum", "enum-unused-labels"], +) +@pytest.mark.parametrize("shifted", [False, True], ids=["stable", "shifted"]) +def test_categorical_dtypes_report_the_same_psi(dtype, shifted: bool) -> None: + """Enum labels must receive the same measured PSI as string and categorical labels.""" + reference_values = ["a"] * 100 if shifted else ["a", "b"] * 50 + current_values = ["b"] * 100 if shifted else reference_values + reference = pl.DataFrame({"category": pl.Series(reference_values, dtype=dtype)}) + current = pl.DataFrame({"category": pl.Series(current_values, dtype=dtype)}) + + report = DriftCalculator(reference, current).calculate_drift() + + assert "category" in report.column_drifts + drift = report.column_drifts["category"] + assert len(drift.metrics) == 1 + psi = drift.metrics[0] + assert psi.metric == "psi_categorical" + assert psi.value == pytest.approx(10.543651559430593 if shifted else 0.0) + assert psi.threshold == 0.2 + assert psi.has_drift is shifted + assert drift.drift_detected is shifted + assert report.drifted_columns_count == int(shifted) + + +def test_enum_drift_respects_custom_psi_threshold() -> None: + """Enum dispatch must preserve the existing categorical threshold override contract.""" + dtype = pl.Enum(["a", "b"]) + reference = pl.DataFrame({"category": pl.Series(["a"] * 100, dtype=dtype)}) + current = pl.DataFrame({"category": pl.Series(["b"] * 100, dtype=dtype)}) + + report = DriftCalculator(reference, current).calculate_drift(thresholds={"psi": 11.0}) + + assert "category" in report.column_drifts + psi = report.column_drifts["category"].metrics[0] + assert psi.value == pytest.approx(10.543651559430593) + assert psi.threshold == 11.0 + assert psi.has_drift is False + assert report.drifted_columns_count == 0 + + def test_calculate_drift_skips_high_cardinality_categorical_column() -> None: """A near-unique-per-row string column (free text / IDs) must be skipped rather than blowing up the PSI computation on effectively-unique values. diff --git a/skyulf-core/tests/unit/test_vectorization_output_names_regression_20260912.py b/skyulf-core/tests/unit/test_vectorization_output_names_regression_20260912.py new file mode 100644 index 000000000..3d62347dc --- /dev/null +++ b/skyulf-core/tests/unit/test_vectorization_output_names_regression_20260912.py @@ -0,0 +1,235 @@ +"""Text features must never overwrite retained inputs or emit ambiguous columns.""" + +from typing import Any + +import numpy as np +import pandas as pd +import polars as pl +import pytest + +from skyulf.engines.registry import EngineRegistry +from skyulf.preprocessing.pipeline import FeatureEngineer +from skyulf.preprocessing.vectorization import sentence_embedder +from skyulf.registry import NodeRegistry + + +class _EmbeddingModel: + """Replace only the external model boundary with a two-dimensional encoder.""" + + def get_embedding_dimension(self): + """Provide a fixed output width without downloading pretrained weights.""" + return 2 + + def encode(self, texts, **kwargs): + """Produce finite per-row values so real frame attachment remains exercised.""" + return np.asarray([[len(text), len(text.split())] for text in texts], dtype=float) + + +@pytest.fixture( + params=[ + ("tokenizer", "text__tokens", {"add_token_count": True}), + ("count_vectorizer", "text__count__apple", {}), + ("tfidf_vectorizer", "text__tfidf__apple", {}), + ("hashing_vectorizer", "text__hash__0", {"n_features": 2}), + ("sentence_embedder", "text__emb__0", {}), + ], + ids=["tokenizer", "count", "tfidf", "hashing", "embedding"], +) +def text_node(request, monkeypatch): + """Run the same public schema contract through every text-feature consumer.""" + node, collision, config = request.param + if node == "sentence_embedder": + monkeypatch.setattr(sentence_embedder, "_load_model", lambda name: _EmbeddingModel()) + return node, collision, {"columns": ["text"], **config} + + +@pytest.fixture(params=["pandas", "polars", "polars_wrapped"]) +def frame_kind(request): + """Cover both engines and the public native-Polars wrapper contract.""" + return request.param + + +def _frame(data: dict[str, list[Any]], frame_kind: str) -> Any: + """Keep a non-default pandas index to detect misaligned generated features.""" + frame = pd.DataFrame(data, index=pd.Index(range(31, 31 + len(next(iter(data.values())))))) + if frame_kind == "pandas": + return frame + native = pl.from_pandas(frame) + return EngineRegistry.wrap(native) if frame_kind == "polars_wrapped" else native + + +def _pandas(frame: Any) -> pd.DataFrame: + """Expose values for the same assertions regardless of the execution engine.""" + return frame.to_pandas() if hasattr(frame, "to_pandas") else frame + + +@pytest.mark.parametrize("drop_original", [False, True]) +def test_fit_rejects_retained_output_name_collision(text_node, frame_kind, drop_original): + """Full input schemas must be validated even when vocabulary fitting narrows text columns.""" + node, collision, config = text_node + frame = _frame({"text": ["apple pear", "pear"], collision: [91, 92]}, frame_kind) + original = _pandas(frame).copy(deep=True) + + with pytest.raises(ValueError, match=f"collid.*{collision}"): + NodeRegistry.get_calculator(node)().fit(frame, {**config, "drop_original": drop_original}) + + pd.testing.assert_frame_equal(_pandas(frame), original) + + +@pytest.mark.parametrize("drop_original", [False, True]) +def test_apply_rejects_new_inference_column_collision(text_node, frame_kind, drop_original): + """Previously unseen retained columns cannot overwrite or alias fitted output names.""" + node, collision, config = text_node + artifact = NodeRegistry.get_calculator(node)().fit( + _frame({"text": ["apple pear", "pear"]}, frame_kind), + {**config, "drop_original": drop_original}, + ) + frame = _frame({"text": ["pear"], collision: [91]}, frame_kind) + original = _pandas(frame).copy(deep=True) + + with pytest.raises(ValueError, match=f"collid.*{collision}"): + NodeRegistry.get_applier(node)().apply(frame, artifact) + + pd.testing.assert_frame_equal(_pandas(frame), original) + + +@pytest.mark.parametrize("stage", ["fit", "apply"]) +def test_token_count_column_is_also_protected(frame_kind, stage): + """Enabling token counts must not silently overwrite an existing count column.""" + calculator = NodeRegistry.get_calculator("tokenizer")() + config = {"columns": ["text"], "add_token_count": True} + frame = _frame({"text": ["apple pear"], "text__token_count": [91]}, frame_kind) + artifact = calculator.fit(_frame({"text": ["apple pear"]}, frame_kind), config) + + with pytest.raises(ValueError, match="collid.*text__token_count"): + if stage == "fit": + calculator.fit(frame, config) + else: + NodeRegistry.get_applier("tokenizer")().apply(frame, artifact) + + assert _pandas(frame)["text__token_count"].tolist() == [91] + + +def test_tokenizer_reuses_dropped_source_names_without_reading_generated_values(frame_kind): + """Every selected source must be tokenized from its original values before originals drop.""" + frame = _frame( + {"text": ["APPLE!", "PEAR!"], "text__tokens": ["BANANA melon", "CHERRY!"], "keep": [9, 8]}, + frame_kind, + ) + artifact = NodeRegistry.get_calculator("tokenizer")().fit( + frame, + {"columns": ["text", "text__tokens"], "drop_original": True, "add_token_count": True}, + ) + result = NodeRegistry.get_applier("tokenizer")().apply(frame, artifact) + values = _pandas(result) + + assert type(result) is type(frame) + assert values.to_dict("list") == { + "keep": [9, 8], + "text__tokens": ["apple", "pear"], + "text__token_count": [1, 1], + "text__tokens__tokens": ["banana melon", "cherry"], + "text__tokens__token_count": [2, 1], + } + if frame_kind == "pandas": + pd.testing.assert_index_equal(values.index, frame.index) + assert _pandas(frame)["text__tokens"].tolist() == ["BANANA melon", "CHERRY!"] + + +def test_tokenizer_keep_original_rejects_selected_source_collision(frame_kind): + """A selected source name is reserved when the caller keeps its original values.""" + frame = _frame({"text": ["APPLE!"], "text__tokens": ["BANANA!"]}, frame_kind) + + with pytest.raises(ValueError, match="collid.*text__tokens"): + NodeRegistry.get_calculator("tokenizer")().fit( + frame, {"columns": ["text", "text__tokens"], "drop_original": False} + ) + + +def test_pipeline_rejects_inference_collision(text_node, frame_kind): + """Fitted pipeline replay must enforce the same protection as direct applier calls.""" + node, collision, config = text_node + pipeline = FeatureEngineer([{"name": "text features", "transformer": node, "params": config}]) + pipeline.fit_transform(_frame({"text": ["apple pear", "pear"]}, frame_kind)) + frame = _frame({"text": ["apple"], collision: [91]}, frame_kind) + + with pytest.raises(ValueError, match=f"collid.*{collision}"): + pipeline.transform(frame) + + assert _pandas(frame)[collision].tolist() == [91] + + +def test_multi_source_fit_validates_joined_output_prefix(text_node, frame_kind): + """Names derived from all selected columns must be checked against retained inputs.""" + node, collision, config = text_node + prefix = "body" if node == "tokenizer" else "text_body" + collision = collision.replace("text", prefix, 1) + frame = _frame({"text": ["apple"], "body": ["pear apple"], collision: [91]}, frame_kind) + + with pytest.raises(ValueError, match=f"collid.*{collision}"): + NodeRegistry.get_calculator(node)().fit(frame, {**config, "columns": ["text", "body"]}) + + +def test_missing_sources_do_not_reserve_unemitted_output_names(text_node, frame_kind): + """A missing source is a no-op even when an unrelated input resembles its output name.""" + node, collision, config = text_node + artifact = NodeRegistry.get_calculator(node)().fit( + _frame({"text": ["apple pear"]}, frame_kind), config + ) + frame = _frame({collision: [91]}, frame_kind) + result = NodeRegistry.get_applier(node)().apply(frame, artifact) + + assert type(result) is type(frame) + pd.testing.assert_frame_equal(_pandas(result), _pandas(frame)) + + +@pytest.mark.parametrize( + "node, suffix", [("count_vectorizer", "count"), ("tfidf_vectorizer", "tfidf")] +) +def test_unseen_vocabulary_does_not_reserve_new_feature_names(node, suffix, frame_kind): + """New inference words cannot change the fitted schema or collide with retained data.""" + artifact = NodeRegistry.get_calculator(node)().fit( + _frame({"text": ["apple pear"]}, frame_kind), {"columns": ["text"], "drop_original": True} + ) + frame = _frame({"text": ["cherry"], f"text__{suffix}__cherry": [91]}, frame_kind) + result = _pandas(NodeRegistry.get_applier(node)().apply(frame, artifact)) + + assert result.to_dict("list") == { + f"text__{suffix}__cherry": [91], + f"text__{suffix}__apple": [0], + f"text__{suffix}__pear": [0], + } + + +def test_ordinary_output_preserves_engine_tuple_index_and_retained_values(text_node, frame_kind): + """Schema validation must keep the normal transform's row and wrapper contracts intact.""" + node, collision, config = text_node + frame = _frame({"text": ["apple apple", "pear"], "keep": [91, 92]}, frame_kind) + labels = pd.Series([1, 0], name="label") + if frame_kind != "pandas": + labels = pl.from_pandas(labels) + artifact = NodeRegistry.get_calculator(node)().fit((frame, labels), config) + result, result_labels = NodeRegistry.get_applier(node)().apply((frame, labels), artifact) + values = _pandas(result) + + assert result_labels is labels + assert type(result) is type(frame) + assert values.columns.is_unique + assert values["keep"].tolist() == [91, 92] + assert values["text"].tolist() == ["apple apple", "pear"] + if node == "tokenizer": + assert values[collision].tolist() == ["apple apple", "pear"] + assert values["text__token_count"].tolist() == [2, 1] + elif node == "count_vectorizer": + assert values[collision].tolist() == [2, 0] + elif node == "tfidf_vectorizer": + assert values[collision].tolist() == [1, 0] + elif node == "sentence_embedder": + assert values[["text__emb__0", "text__emb__1"]].values.tolist() == [[11, 2], [4, 1]] + else: + np.testing.assert_allclose( + np.linalg.norm(values[["text__hash__0", "text__hash__1"]].to_numpy(), axis=1), [1, 1] + ) + if frame_kind == "pandas": + pd.testing.assert_index_equal(values.index, frame.index) + assert collision in values.columns diff --git a/static/ml_canvas/assets/AuditLogPage-No5dzqER.js b/static/ml_canvas/assets/AuditLogPage-DIZX5m-b.js similarity index 99% rename from static/ml_canvas/assets/AuditLogPage-No5dzqER.js rename to static/ml_canvas/assets/AuditLogPage-DIZX5m-b.js index 782a20c25..aaf40ca68 100644 --- a/static/ml_canvas/assets/AuditLogPage-No5dzqER.js +++ b/static/ml_canvas/assets/AuditLogPage-DIZX5m-b.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{A as H,k as O,l as U,t as q}from"./index-C87GWrUj.js";import{a as l,p as G,k as K,H as B,C as V,U as $,G as Y,q as C,M as z,s as I,t as J,u as Q,c as W,f as X}from"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const S=t=>String(t.id);function Z({actorFilter:t,kindFilter:r,fromTime:s,toTime:i}){return{...t!=="all"?{actor:t}:{},...r!=="all"?{kind:r}:{},...s?{createdAfter:s}:{},...i?{createdBefore:i}:{}}}function ee(t){if(!t)return null;const r=t.entries,s=new Set(r.map(o=>o.user_id!==null?`u${o.user_id}`:"anon"));let i=0,d=0,n=0;for(const o of r)i+=o.diff.nodes_added.length,d+=o.diff.nodes_removed.length,n+=o.diff.nodes_modified.length;return{saves:r.length,users:s.size,added:i,removed:d,modified:n}}function te(t,r,s,i){const{actorFilter:d,kindFilter:n,fromTime:o,toTime:x}=i,m=(t==null?void 0:t.entries)??[],y=d!=="all"||n!=="all"||o!==""||x!=="",h=(t==null?void 0:t.total)??0,u=(t==null?void 0:t.total_unfiltered)??0,g=m.length,p=`${s}`,a=t?y?`Showing ${g} of ${h} matching saves for ${r}. History total ${u}.`:`Showing ${g} of ${u} saves for ${r}.`:null,j=t?`Page limit ${p}. Newest first. Retention is not reported by the API. Filters are applied across the full history, not just this page.`:null,k=se(t,g,u,r,p);return{filteredEntries:m,historyScopeText:a,historyMetaText:j,emptyStateText:k}}function se(t,r,s,i,d){return t&&r===0?s===0?`No saves recorded for ${i} yet. The audit API shows the newest ${d} saves first, but this dataset currently has no history. Retention is not reported by the API.`:`No audit records match the current filters for ${i}. Filters were applied across all ${s} saves, so widening them is the only way to see more. Retention is not reported by the API.`:null}const re=[25,50,100,200],ae=({state:t})=>{const{actorFilter:r,setActorFilter:s,kindFilter:i,setKindFilter:d,fromTime:n,setFromTime:o,toTime:x,setToTime:m,limit:y,setLimit:h,data:u,actorOptions:g,kindOptions:p}=t;return e.jsxs("div",{className:"flex flex-wrap items-end gap-4 mb-4",children:[e.jsx(de,{state:t}),e.jsxs("div",{className:"min-w-[220px]",children:[e.jsx("label",{htmlFor:"audit-actor",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Actor"}),e.jsxs("select",{id:"audit-actor",value:r,onChange:a=>s(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All actors"}),g.userIds.map(a=>e.jsxs("option",{value:a,children:["user #",a]},a)),g.hasAnonymous&&e.jsx("option",{value:H,children:"anonymous"})]})]}),e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{htmlFor:"audit-kind",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Action kind"}),e.jsxs("select",{id:"audit-kind",value:i,onChange:a=>d(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All kinds"}),p.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-from",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"From time"}),e.jsx("input",{id:"audit-from",type:"datetime-local",value:n,onChange:a=>o(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-to",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"To time"}),e.jsx("input",{id:"audit-to",type:"datetime-local",value:x,onChange:a=>m(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Limit"}),e.jsx("div",{className:"inline-flex rounded border border-gray-300 dark:border-gray-600 overflow-hidden",children:re.map(a=>e.jsx("button",{type:"button",onClick:()=>h(a),className:`px-3 py-2 text-xs font-medium ${y===a?"bg-violet-500 text-white":"bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:a},a))})]})]})},de=({state:t})=>{const{datasets:r,datasetsLoading:s,datasetId:i,setDatasetId:d}=t;return e.jsxs("div",{className:"flex-1 min-w-[240px]",children:[e.jsx("label",{htmlFor:"audit-dataset",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Dataset"}),e.jsx("select",{id:"audit-dataset",value:i,onChange:n=>d(n.target.value),disabled:s||!r||r.length===0,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:!r||r.length===0?e.jsx("option",{value:"",children:s?"Loading…":"No datasets"}):r.map(n=>{const o=S(n),x=o.length>8?o.slice(0,8):o;return e.jsxs("option",{value:o,children:[n.name," (",x,")"]},o)})})]})},ie=t=>{try{return new Date(t).toLocaleString()}catch{return t}},w=({icon:t,label:r,count:s,tone:i})=>{if(s===0)return null;const d=i==="add"?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-900/20 dark:text-emerald-300 dark:border-emerald-800":i==="remove"?"bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-900/20 dark:text-rose-300 dark:border-rose-800":"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-900/20 dark:text-amber-300 dark:border-amber-800";return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border text-[11px] font-medium ${d}`,title:`${s} ${r}`,children:[t,s," ",r]})},A=({title:t,items:r,tone:s})=>{if(r.length===0)return null;const i=s==="add"?"text-emerald-600 dark:text-emerald-400":s==="remove"?"text-rose-600 dark:text-rose-400":"text-amber-600 dark:text-amber-400";return e.jsxs("div",{children:[e.jsxs("div",{className:`text-[11px] font-semibold uppercase tracking-wide mb-1 ${i}`,children:[t," (",r.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(d=>e.jsx("code",{className:"text-[11px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-mono",children:d},d))})]})},oe=({entry:t,isFirst:r})=>{const[s,i]=l.useState(!1),{diff:d}=t,n=d.nodes_added.length+d.nodes_removed.length+d.nodes_modified.length,o=r&&d.nodes_removed.length===0&&d.nodes_modified.length===0;return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>i(x=>!x),className:"w-full flex items-start gap-3 p-3 text-left hover:bg-gray-50 dark:hover:bg-slate-800/50 transition-colors",children:[e.jsx("div",{className:"pt-0.5 text-gray-400",children:s?e.jsx(G,{size:16}):e.jsx(K,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-mono text-gray-500 dark:text-gray-400",children:[e.jsx(B,{size:11}),"v",t.version_int]}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100 truncate",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold ${t.kind==="auto"?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-slate-700 dark:text-gray-300"}`,children:t.kind}),o&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300",children:"initial"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(V,{size:11}),ie(t.created_at)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{size:11}),t.user_id!==null?`user #${t.user_id}`:"anonymous"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Y,{size:11}),t.node_count," nodes / ",t.edge_count," edges"]})]}),t.note&&e.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300 italic truncate",children:["β€œ",t.note,"”"]}),!o&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[e.jsx(w,{icon:e.jsx(C,{size:10}),label:"added",count:d.nodes_added.length,tone:"add"}),e.jsx(w,{icon:e.jsx(z,{size:10}),label:"removed",count:d.nodes_removed.length,tone:"remove"}),e.jsx(w,{icon:e.jsx(I,{size:10}),label:"modified",count:d.nodes_modified.length,tone:"modify"}),n===0&&e.jsx("span",{className:"text-[11px] text-gray-400 italic",children:"no node-level changes"})]})]})]}),e.jsx(ne,{expanded:s,diff:d,totalChanged:n})]})},ne=({expanded:t,diff:r,totalChanged:s})=>e.jsx(e.Fragment,{children:t&&s>0&&e.jsxs("div",{className:"px-10 pb-3 pt-1 space-y-2 bg-gray-50/60 dark:bg-slate-900/40",children:[e.jsx(A,{title:"Added",items:r.nodes_added,tone:"add"}),e.jsx(A,{title:"Removed",items:r.nodes_removed,tone:"remove"}),e.jsx(A,{title:"Modified",items:r.nodes_modified,tone:"modify"})]})}),le=({state:t})=>{const{isLoading:r,datasetId:s,data:i,emptyStateText:d,filteredEntries:n}=t;return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading audit trail…"}):s?!i||i.entries.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):n.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):e.jsx("div",{children:n.map((o,x)=>e.jsx(oe,{entry:o,isFirst:x===n.length-1},o.id))}):e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Pick a dataset to view its save history."})})},ce=({summary:t})=>e.jsx(e.Fragment,{children:t&&t.saves>0&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3 mb-4",children:[e.jsx(f,{label:"Saves",value:t.saves,icon:e.jsx(J,{size:14})}),e.jsx(f,{label:"Users",value:t.users,icon:e.jsx($,{size:14})}),e.jsx(f,{label:"Nodes added",value:t.added,icon:e.jsx(C,{size:14}),tone:"add"}),e.jsx(f,{label:"Nodes removed",value:t.removed,icon:e.jsx(z,{size:14}),tone:"remove"}),e.jsx(f,{label:"Nodes modified",value:t.modified,icon:e.jsx(I,{size:14}),tone:"modify"})]})}),f=({label:t,value:r,icon:s,tone:i})=>{const d=i==="add"?"text-emerald-600 dark:text-emerald-400":i==="remove"?"text-rose-600 dark:text-rose-400":i==="modify"?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-200";return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400 font-medium",children:[s,t]}),e.jsx("div",{className:`mt-1 text-xl font-semibold ${d}`,children:r})]})};function xe(){const{data:t,isLoading:r}=O(),[s,i]=l.useState(""),[d,n]=l.useState(50),[o,x]=l.useState("all"),[m,y]=l.useState("all"),[h,u]=l.useState(""),[g,p]=l.useState(""),[a,j]=l.useState(null),[k,_]=l.useState(!1),[L,T]=l.useState(null);l.useEffect(()=>{if(!s&&t&&t.length>0){const c=t[0];c&&i(S(c))}},[t,s]);const v=l.useRef(0),N=l.useCallback(async()=>{if(!s)return;const c=++v.current;_(!0),T(null);try{const b=await U.audit(s,d,Z({actorFilter:o,kindFilter:m,fromTime:h,toTime:g}));if(c!==v.current)return;j(b)}catch(b){if(c!==v.current)return;const F=b.message||"Failed to load audit trail";T(F),q.error(F)}finally{c===v.current&&_(!1)}},[s,d,o,m,h,g]);l.useEffect(()=>{N()},[N]);const R=l.useMemo(()=>ee(a),[a]),P=l.useMemo(()=>{var c,b;return{hasAnonymous:((c=a==null?void 0:a.facets)==null?void 0:c.has_anonymous_actor)??!1,userIds:((b=a==null?void 0:a.facets)==null?void 0:b.actors)??[]}},[a]),D=l.useMemo(()=>{var c;return((c=a==null?void 0:a.facets)==null?void 0:c.kinds)??[]},[a]),M=l.useMemo(()=>{const c=t==null?void 0:t.find(b=>S(b)===s);return(c==null?void 0:c.name)??"this dataset"},[t,s]),E=te(a,M,d,{actorFilter:o,kindFilter:m,fromTime:h,toTime:g});return{datasets:t,datasetsLoading:r,datasetId:s,setDatasetId:i,limit:d,setLimit:n,actorFilter:o,setActorFilter:x,kindFilter:m,setKindFilter:y,fromTime:h,setFromTime:u,toTime:g,setToTime:p,data:a,isLoading:k,error:L,load:N,summary:R,actorOptions:P,kindOptions:D,...E}}const be=()=>{const t=xe(),{load:r,isLoading:s,datasetId:i,data:d,error:n,summary:o,historyScopeText:x,historyMetaText:m}=t;return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Q,{className:"w-6 h-6 text-violet-500"}),"Pipeline Audit Log"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Chronological history of canvas saves. Each entry shows who, when, and which nodes changed vs. the previous save."})]}),e.jsxs("button",{type:"button",onClick:()=>void r(),disabled:s||!i,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 disabled:opacity-50",children:[e.jsx(W,{className:`w-4 h-4 ${s?"animate-spin":""}`}),"Refresh"]})]}),e.jsx(ae,{state:t}),d&&e.jsx("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"Actor, action kind and time filters apply across the full history before the page limit."}),n&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(X,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:n})]}),e.jsx(ce,{summary:o}),e.jsx(le,{state:t}),x&&e.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400 text-center",children:[x," ",m]})]})};export{be as AuditLogPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{A as H,k as O,l as U,t as q}from"./index-C2dSXwG1.js";import{a as l,p as G,k as K,H as B,C as V,U as $,G as Y,q as C,M as z,s as I,t as J,u as Q,c as W,f as X}from"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";const S=t=>String(t.id);function Z({actorFilter:t,kindFilter:r,fromTime:s,toTime:i}){return{...t!=="all"?{actor:t}:{},...r!=="all"?{kind:r}:{},...s?{createdAfter:s}:{},...i?{createdBefore:i}:{}}}function ee(t){if(!t)return null;const r=t.entries,s=new Set(r.map(o=>o.user_id!==null?`u${o.user_id}`:"anon"));let i=0,d=0,n=0;for(const o of r)i+=o.diff.nodes_added.length,d+=o.diff.nodes_removed.length,n+=o.diff.nodes_modified.length;return{saves:r.length,users:s.size,added:i,removed:d,modified:n}}function te(t,r,s,i){const{actorFilter:d,kindFilter:n,fromTime:o,toTime:x}=i,m=(t==null?void 0:t.entries)??[],y=d!=="all"||n!=="all"||o!==""||x!=="",h=(t==null?void 0:t.total)??0,u=(t==null?void 0:t.total_unfiltered)??0,g=m.length,p=`${s}`,a=t?y?`Showing ${g} of ${h} matching saves for ${r}. History total ${u}.`:`Showing ${g} of ${u} saves for ${r}.`:null,j=t?`Page limit ${p}. Newest first. Retention is not reported by the API. Filters are applied across the full history, not just this page.`:null,k=se(t,g,u,r,p);return{filteredEntries:m,historyScopeText:a,historyMetaText:j,emptyStateText:k}}function se(t,r,s,i,d){return t&&r===0?s===0?`No saves recorded for ${i} yet. The audit API shows the newest ${d} saves first, but this dataset currently has no history. Retention is not reported by the API.`:`No audit records match the current filters for ${i}. Filters were applied across all ${s} saves, so widening them is the only way to see more. Retention is not reported by the API.`:null}const re=[25,50,100,200],ae=({state:t})=>{const{actorFilter:r,setActorFilter:s,kindFilter:i,setKindFilter:d,fromTime:n,setFromTime:o,toTime:x,setToTime:m,limit:y,setLimit:h,data:u,actorOptions:g,kindOptions:p}=t;return e.jsxs("div",{className:"flex flex-wrap items-end gap-4 mb-4",children:[e.jsx(de,{state:t}),e.jsxs("div",{className:"min-w-[220px]",children:[e.jsx("label",{htmlFor:"audit-actor",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Actor"}),e.jsxs("select",{id:"audit-actor",value:r,onChange:a=>s(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All actors"}),g.userIds.map(a=>e.jsxs("option",{value:a,children:["user #",a]},a)),g.hasAnonymous&&e.jsx("option",{value:H,children:"anonymous"})]})]}),e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{htmlFor:"audit-kind",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Action kind"}),e.jsxs("select",{id:"audit-kind",value:i,onChange:a=>d(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:[e.jsx("option",{value:"all",children:"All kinds"}),p.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-from",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"From time"}),e.jsx("input",{id:"audit-from",type:"datetime-local",value:n,onChange:a=>o(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{className:"min-w-[190px]",children:[e.jsx("label",{htmlFor:"audit-to",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"To time"}),e.jsx("input",{id:"audit-to",type:"datetime-local",value:x,onChange:a=>m(a.target.value),disabled:!u,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Limit"}),e.jsx("div",{className:"inline-flex rounded border border-gray-300 dark:border-gray-600 overflow-hidden",children:re.map(a=>e.jsx("button",{type:"button",onClick:()=>h(a),className:`px-3 py-2 text-xs font-medium ${y===a?"bg-violet-500 text-white":"bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:a},a))})]})]})},de=({state:t})=>{const{datasets:r,datasetsLoading:s,datasetId:i,setDatasetId:d}=t;return e.jsxs("div",{className:"flex-1 min-w-[240px]",children:[e.jsx("label",{htmlFor:"audit-dataset",className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Dataset"}),e.jsx("select",{id:"audit-dataset",value:i,onChange:n=>d(n.target.value),disabled:s||!r||r.length===0,className:"w-full px-3 py-2 text-sm rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-gray-900 dark:text-gray-100 disabled:opacity-50",children:!r||r.length===0?e.jsx("option",{value:"",children:s?"Loading…":"No datasets"}):r.map(n=>{const o=S(n),x=o.length>8?o.slice(0,8):o;return e.jsxs("option",{value:o,children:[n.name," (",x,")"]},o)})})]})},ie=t=>{try{return new Date(t).toLocaleString()}catch{return t}},w=({icon:t,label:r,count:s,tone:i})=>{if(s===0)return null;const d=i==="add"?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-900/20 dark:text-emerald-300 dark:border-emerald-800":i==="remove"?"bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-900/20 dark:text-rose-300 dark:border-rose-800":"bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-900/20 dark:text-amber-300 dark:border-amber-800";return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded border text-[11px] font-medium ${d}`,title:`${s} ${r}`,children:[t,s," ",r]})},A=({title:t,items:r,tone:s})=>{if(r.length===0)return null;const i=s==="add"?"text-emerald-600 dark:text-emerald-400":s==="remove"?"text-rose-600 dark:text-rose-400":"text-amber-600 dark:text-amber-400";return e.jsxs("div",{children:[e.jsxs("div",{className:`text-[11px] font-semibold uppercase tracking-wide mb-1 ${i}`,children:[t," (",r.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(d=>e.jsx("code",{className:"text-[11px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 font-mono",children:d},d))})]})},oe=({entry:t,isFirst:r})=>{const[s,i]=l.useState(!1),{diff:d}=t,n=d.nodes_added.length+d.nodes_removed.length+d.nodes_modified.length,o=r&&d.nodes_removed.length===0&&d.nodes_modified.length===0;return e.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>i(x=>!x),className:"w-full flex items-start gap-3 p-3 text-left hover:bg-gray-50 dark:hover:bg-slate-800/50 transition-colors",children:[e.jsx("div",{className:"pt-0.5 text-gray-400",children:s?e.jsx(G,{size:16}):e.jsx(K,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-mono text-gray-500 dark:text-gray-400",children:[e.jsx(B,{size:11}),"v",t.version_int]}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-100 truncate",children:t.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold ${t.kind==="auto"?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"bg-gray-100 text-gray-700 dark:bg-slate-700 dark:text-gray-300"}`,children:t.kind}),o&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-semibold bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300",children:"initial"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-500 dark:text-gray-400",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(V,{size:11}),ie(t.created_at)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($,{size:11}),t.user_id!==null?`user #${t.user_id}`:"anonymous"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Y,{size:11}),t.node_count," nodes / ",t.edge_count," edges"]})]}),t.note&&e.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300 italic truncate",children:["β€œ",t.note,"”"]}),!o&&e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[e.jsx(w,{icon:e.jsx(C,{size:10}),label:"added",count:d.nodes_added.length,tone:"add"}),e.jsx(w,{icon:e.jsx(z,{size:10}),label:"removed",count:d.nodes_removed.length,tone:"remove"}),e.jsx(w,{icon:e.jsx(I,{size:10}),label:"modified",count:d.nodes_modified.length,tone:"modify"}),n===0&&e.jsx("span",{className:"text-[11px] text-gray-400 italic",children:"no node-level changes"})]})]})]}),e.jsx(ne,{expanded:s,diff:d,totalChanged:n})]})},ne=({expanded:t,diff:r,totalChanged:s})=>e.jsx(e.Fragment,{children:t&&s>0&&e.jsxs("div",{className:"px-10 pb-3 pt-1 space-y-2 bg-gray-50/60 dark:bg-slate-900/40",children:[e.jsx(A,{title:"Added",items:r.nodes_added,tone:"add"}),e.jsx(A,{title:"Removed",items:r.nodes_removed,tone:"remove"}),e.jsx(A,{title:"Modified",items:r.nodes_modified,tone:"modify"})]})}),le=({state:t})=>{const{isLoading:r,datasetId:s,data:i,emptyStateText:d,filteredEntries:n}=t;return e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading audit trail…"}):s?!i||i.entries.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):n.length===0?e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:d}):e.jsx("div",{children:n.map((o,x)=>e.jsx(oe,{entry:o,isFirst:x===n.length-1},o.id))}):e.jsx("div",{className:"p-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Pick a dataset to view its save history."})})},ce=({summary:t})=>e.jsx(e.Fragment,{children:t&&t.saves>0&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-3 mb-4",children:[e.jsx(f,{label:"Saves",value:t.saves,icon:e.jsx(J,{size:14})}),e.jsx(f,{label:"Users",value:t.users,icon:e.jsx($,{size:14})}),e.jsx(f,{label:"Nodes added",value:t.added,icon:e.jsx(C,{size:14}),tone:"add"}),e.jsx(f,{label:"Nodes removed",value:t.removed,icon:e.jsx(z,{size:14}),tone:"remove"}),e.jsx(f,{label:"Nodes modified",value:t.modified,icon:e.jsx(I,{size:14}),tone:"modify"})]})}),f=({label:t,value:r,icon:s,tone:i})=>{const d=i==="add"?"text-emerald-600 dark:text-emerald-400":i==="remove"?"text-rose-600 dark:text-rose-400":i==="modify"?"text-amber-600 dark:text-amber-400":"text-gray-700 dark:text-gray-200";return e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-gray-500 dark:text-gray-400 font-medium",children:[s,t]}),e.jsx("div",{className:`mt-1 text-xl font-semibold ${d}`,children:r})]})};function xe(){const{data:t,isLoading:r}=O(),[s,i]=l.useState(""),[d,n]=l.useState(50),[o,x]=l.useState("all"),[m,y]=l.useState("all"),[h,u]=l.useState(""),[g,p]=l.useState(""),[a,j]=l.useState(null),[k,_]=l.useState(!1),[L,T]=l.useState(null);l.useEffect(()=>{if(!s&&t&&t.length>0){const c=t[0];c&&i(S(c))}},[t,s]);const v=l.useRef(0),N=l.useCallback(async()=>{if(!s)return;const c=++v.current;_(!0),T(null);try{const b=await U.audit(s,d,Z({actorFilter:o,kindFilter:m,fromTime:h,toTime:g}));if(c!==v.current)return;j(b)}catch(b){if(c!==v.current)return;const F=b.message||"Failed to load audit trail";T(F),q.error(F)}finally{c===v.current&&_(!1)}},[s,d,o,m,h,g]);l.useEffect(()=>{N()},[N]);const R=l.useMemo(()=>ee(a),[a]),P=l.useMemo(()=>{var c,b;return{hasAnonymous:((c=a==null?void 0:a.facets)==null?void 0:c.has_anonymous_actor)??!1,userIds:((b=a==null?void 0:a.facets)==null?void 0:b.actors)??[]}},[a]),D=l.useMemo(()=>{var c;return((c=a==null?void 0:a.facets)==null?void 0:c.kinds)??[]},[a]),M=l.useMemo(()=>{const c=t==null?void 0:t.find(b=>S(b)===s);return(c==null?void 0:c.name)??"this dataset"},[t,s]),E=te(a,M,d,{actorFilter:o,kindFilter:m,fromTime:h,toTime:g});return{datasets:t,datasetsLoading:r,datasetId:s,setDatasetId:i,limit:d,setLimit:n,actorFilter:o,setActorFilter:x,kindFilter:m,setKindFilter:y,fromTime:h,setFromTime:u,toTime:g,setToTime:p,data:a,isLoading:k,error:L,load:N,summary:R,actorOptions:P,kindOptions:D,...E}}const be=()=>{const t=xe(),{load:r,isLoading:s,datasetId:i,data:d,error:n,summary:o,historyScopeText:x,historyMetaText:m}=t;return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white flex items-center gap-2",children:[e.jsx(Q,{className:"w-6 h-6 text-violet-500"}),"Pipeline Audit Log"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Chronological history of canvas saves. Each entry shows who, when, and which nodes changed vs. the previous save."})]}),e.jsxs("button",{type:"button",onClick:()=>void r(),disabled:s||!i,className:"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 disabled:opacity-50",children:[e.jsx(W,{className:`w-4 h-4 ${s?"animate-spin":""}`}),"Refresh"]})]}),e.jsx(ae,{state:t}),d&&e.jsx("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"Actor, action kind and time filters apply across the full history before the page limit."}),n&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(X,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:n})]}),e.jsx(ce,{summary:o}),e.jsx(le,{state:t}),x&&e.jsxs("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400 text-center",children:[x," ",m]})]})};export{be as AuditLogPage}; diff --git a/static/ml_canvas/assets/DataDriftPage-CPfpybeF.js b/static/ml_canvas/assets/DataDriftPage-C5Xkdsih.js similarity index 66% rename from static/ml_canvas/assets/DataDriftPage-CPfpybeF.js rename to static/ml_canvas/assets/DataDriftPage-C5Xkdsih.js index 4bac55ac5..ceaf0cfc2 100644 --- a/static/ml_canvas/assets/DataDriftPage-CPfpybeF.js +++ b/static/ml_canvas/assets/DataDriftPage-C5Xkdsih.js @@ -1,2 +1,2 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{O as he,j as L,Q as ge,f as H,t as be,U as fe,C as ke,V as je,a as x,T,S as X,Y as ye,X as E,K as ve,b as I,e as F,z as Ne,_ as we,p as R,$ as _e,a0 as Se,a1 as Ce,a2 as B,a3 as De,a4 as ze,a5 as J,a6 as _,a7 as Re,a8 as Le,w as Ee,a9 as Ae,aa as Te,s as Fe,ab as $e,ac as Pe,ad as Me,D as Oe,c as Ke,ae as Ue}from"./vendor-utils-VkF_O5b_.js";import{R as A,b as He,C as Ie,M as Be,L as Ye,E as G,m as S,u as Ve}from"./index-C87GWrUj.js";import{R as Q,ag as We,C as Z,X as ee,Y as te,T as se,ah as re,ai as Y,B as qe,h as V}from"./vendor-charts-BkHP8M8k.js";import{F as W}from"./FormField-BaO1-ftW.js";const Xe={none:{label:"No drift",classes:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800"},warning:{label:"Warning",classes:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-800"},critical:{label:"Critical",classes:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800"}},ae=({severity:t})=>{const s=Xe[t],r=t==="critical"?he:t==="warning"?L:ge;return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:[e.jsx(r,{size:12,"aria-hidden":"true"}),s.label]})},Je={new:{label:"New",classes:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800"},acknowledged:{label:"Acknowledged",classes:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400 border-purple-200 dark:border-purple-800"},resolved:{label:"Resolved",classes:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700"},reopened:{label:"Reopened",classes:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400 border-orange-200 dark:border-orange-800"}},$=({status:t})=>{const s=Je[t];return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:s.label})};function Ge({detail:t,filters:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ae,{severity:t.severity}),e.jsx($,{status:t.status}),t.evaluation_status!=="completed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t.evaluation_status==="no_baseline"?"No baseline":"Evaluation failed"]})]}),t.evaluation_status!=="completed"&&t.error_message&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(H,{size:16,className:"shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:t.error_message})]}),e.jsx(Qe,{detail:t}),e.jsx(Ze,{detail:t,filters:s})]})}function Qe({detail:t}){var s;return e.jsxs("dl",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Detected"}),e.jsx("dd",{className:"font-medium",children:((s=t.created_at)==null?void 0:s.replace("T"," ").slice(0,16))??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Threshold version"}),e.jsxs("dd",{className:"font-medium",children:[t.threshold_version!=null?`v${t.threshold_version}`:"β€”",t.threshold_version!=null&&e.jsxs("span",{className:"block text-[11px] font-normal text-gray-400",children:["PSI ",t.threshold_psi," Β· KS ",t.threshold_ks," Β· Wasserstein"," ",t.threshold_wasserstein," Β· KL ",t.threshold_kl]})]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Drifted features"}),e.jsx("dd",{className:"font-medium",children:t.drifted_columns_count!=null&&t.total_columns!=null?`${t.drifted_columns_count} / ${t.total_columns}`:"β€”"})]})]})}function Ze({detail:t,filters:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsx(A,{recordRef:{kind:"job",jobId:t.job_id},origin:"/drift",filters:s}),t.model_version&&e.jsx(A,{recordRef:{kind:"modelVersion",jobId:t.job_id,version:t.model_version},origin:"/drift",filters:s}),t.deployment_id!=null&&e.jsx(A,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},origin:"/drift",filters:s})]})}function et({alertId:t,evaluationStatus:s,evidenceRows:r}){return s!=="completed"?null:e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Feature evidence"}),r.length===0?e.jsx(He,{title:"No evidence recorded",description:"This alert has no retained per-feature drift evidence."}):e.jsx(Ie,{caption:`Per-feature drift evidence for alert #${t??""}`,filename:`drift-alert-${t??"unknown"}-evidence`,columns:[{key:"column",label:"Feature"},{key:"drifted",label:"Drifted"},{key:"psi",label:"PSI"},{key:"wasserstein",label:"Wasserstein"},{key:"ks_statistic",label:"KS statistic"},{key:"ks_p_value",label:"KS p-value"}],rows:r,defaultOpen:!0})]})}function tt({entries:t}){return e.jsxs(e.Fragment,{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(be,{size:12})," History"]}),t.length===0?e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No disposition changes recorded yet."}):e.jsx("ul",{className:"space-y-1.5",children:t.map((s,r)=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx($,{status:s.status}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{size:11})," ",s.actor]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(ke,{size:11})," ",s.at.replace("T"," ").slice(0,16)]}),s.note&&e.jsxs("span",{className:"italic",children:['"',s.note,'"']})]},r))})]})}const q={new:["acknowledge"],acknowledged:["resolve","reopen"],resolved:["reopen"],reopened:["acknowledge"]},st={acknowledge:"Acknowledge",resolve:"Resolve",reopen:"Reopen"};function rt({detail:t,actor:s,note:r,actionError:a,error:n,actionPending:l,setActor:i,setNote:u,handleAction:m}){return e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(je,{size:13})," Disposition"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:t.owner?e.jsxs(e.Fragment,{children:["Currently ",e.jsx("strong",{children:t.status})," by ",e.jsx("strong",{children:t.owner}),"."]}):e.jsx(e.Fragment,{children:"No disposition recorded yet β€” acknowledge to claim this alert."})}),(q[t.status]??[]).length>0&&e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e.jsx(W,{label:"Your name",required:!0,children:p=>e.jsx("input",{...p,type:"text",value:s,onChange:h=>i(h.target.value),placeholder:"e.g. alice",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})}),e.jsx(W,{label:"Note",hint:"Optional context for the audit trail",children:p=>e.jsx("input",{...p,type:"text",value:r,onChange:h=>u(h.target.value),placeholder:"Optional",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})})]}),a&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:a}),n&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:n}),e.jsx("div",{className:"flex gap-2",children:(q[t.status]??[]).map(p=>e.jsx("button",{type:"button",disabled:l,onClick:()=>void m(p),className:"px-3 py-1.5 text-sm font-medium rounded-md action-primary disabled:opacity-50 disabled:cursor-not-allowed",children:st[p]},p))})]}),e.jsx(tt,{entries:t.disposition_history})]})}function at(t){return t!=null&&t.column_drifts?Object.entries(t.column_drifts).map(([s,r])=>{const a=Object.fromEntries(r.metrics.map(n=>[n.metric,n.value]));return{column:s,drifted:r.drift_detected?"Yes":"No",psi:a.psi!=null?Number(a.psi.toFixed(4)):null,wasserstein:a.wasserstein_distance!=null?Number(a.wasserstein_distance.toFixed(4)):null,ks_statistic:a.ks_statistic!=null?Number(a.ks_statistic.toFixed(4)):null,ks_p_value:a.ks_test_p_value!=null?Number(a.ks_test_p_value.toFixed(4)):null}}):[]}const nt=({alertId:t,detail:s,loading:r,error:a,actionPending:n,onApplyDisposition:l,onRetry:i,onClose:u,filters:m})=>{const[p,h]=x.useState(""),[g,b]=x.useState(""),[k,c]=x.useState(null),d=async f=>{if(!p.trim()){c("Enter your name so the disposition records who made it.");return}c(null),await l(f,p.trim(),g.trim()||void 0)&&b("")},o=at(s);return e.jsxs(Be,{isOpen:t!==null,onClose:u,title:t!==null?`Drift alert #${t}`:void 0,size:"3xl",children:[r&&e.jsx(Ye,{message:"Loading drift alert…"}),!r&&a&&!s&&e.jsx(G,{error:a,onRetry:i}),!r&&s&&e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsx(Ge,{detail:s,filters:m}),e.jsx(et,{alertId:t,evaluationStatus:s.evaluation_status,evidenceRows:o}),e.jsx(rt,{detail:s,actor:p,note:g,actionError:k,error:a,actionPending:n,setActor:h,setNote:b,handleAction:d})]})]})},lt=({history:t,onInvestigate:s})=>t.length===0?null:e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(T,{size:18})," Alert History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-slate-700",children:[e.jsx("th",{className:"px-4 py-2 font-medium",children:"Detected"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Severity"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Evaluation"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Threshold"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Owner"}),e.jsx("th",{className:"px-4 py-2 font-medium sr-only",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(r=>{var a;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-slate-700/60 last:border-0",children:[e.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:((a=r.created_at)==null?void 0:a.replace("T"," ").slice(0,16))??"Unknown"}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(ae,{severity:r.severity})}),e.jsx("td",{className:"px-4 py-2",children:e.jsx($,{status:r.status})}),e.jsx("td",{className:"px-4 py-2 capitalize",children:r.evaluation_status.replace("_"," ")}),e.jsx("td",{className:"px-4 py-2",children:r.threshold_version!=null?`v${r.threshold_version}`:"β€”"}),e.jsx("td",{className:"px-4 py-2",children:r.owner??"β€”"}),e.jsx("td",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>s(r.id),className:"inline-flex items-center gap-1 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 text-xs font-medium",children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Investigate"]})})]},r.id)})})]})})]}),it=({showOnlyDrifted:t,onToggleDrifted:s,sortConfig:r,onClearSort:a,onExport:n})=>e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:s,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors border ${t?"bg-red-50 dark:bg-red-900/30 border-red-200 dark:border-red-700 text-red-700 dark:text-red-300":"border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:[e.jsx(ye,{size:12}),t?"Showing drifted only":"Show only drifted"]}),r&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-xs text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:[e.jsx(E,{size:11})," Clear sort"]}),e.jsx("div",{className:"ml-auto",children:e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium border border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors",title:"Download drift report as CSV",children:[e.jsx(ve,{size:12})," Export CSV"]})})]}),ot=({history:t})=>{if(t.length<=1)return null;const s=[...t].reverse().map(r=>{var l;const a=r.summary?Object.values(r.summary):null,n=a?a.filter(i=>i.drifted).length:null;return{date:((l=r.created_at)==null?void 0:l.split("T")[0])??"",drifted:n,pct:a!=null&&a.length?Math.round((n??0)/a.length*100):null}});return e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(T,{size:18})," Drift History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]}),e.jsx("div",{className:"h-[280px]",children:e.jsx(Q,{width:"100%",height:"100%",children:e.jsxs(We,{data:s,margin:{top:5,right:30,left:0,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:"date",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:!1}),e.jsx(se,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(r,a)=>a==="Drifted Features"?[r,a]:a==="Drift %"?[`${r}%`,a]:[r,a]}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(Y,{type:"monotone",dataKey:"drifted",name:"Drifted Features",stroke:"#ef4444",strokeWidth:2,dot:{r:3,fill:"#ef4444"}}),e.jsx(Y,{type:"monotone",dataKey:"pct",name:"Drift %",stroke:"#f59e0b",strokeWidth:2,dot:{r:3,fill:"#f59e0b"},strokeDasharray:"5 5"})]})})})]})},D=({label:t,tooltip:s,icon:r})=>e.jsxs("div",{className:"group relative flex items-center gap-1 cursor-help",children:[e.jsx("span",{className:"border-b border-dotted border-gray-400",children:t}),r&&e.jsx("span",{className:"text-gray-400",children:r}),e.jsxs("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 w-64 p-2 bg-slate-900 text-white text-xs rounded shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 text-center pointer-events-none",children:[s,e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 -mb-1 border-4 border-transparent border-b-slate-900"})]})]}),dt=({values:t,width:s=64,height:r=20})=>{if(t.length<2)return e.jsx("span",{className:"text-[10px] text-gray-400",children:"β€”"});const a=Math.min(...t),l=Math.max(...t)-a||1,i=t.map((h,g)=>{const b=g/(t.length-1)*s,k=r-(h-a)/l*(r-4)-2;return`${b},${k}`}).join(" "),u=t[t.length-1]??0,m=u>.2?"#ef4444":u>.1?"#f59e0b":"#22c55e",p=r-(u-a)/l*(r-4)-2;return e.jsxs("svg",{width:s,height:r,className:"inline-block",children:[e.jsx("polyline",{points:i,fill:"none",stroke:m,strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("circle",{cx:s,cy:p,r:"2",fill:m})]})},ct={wasserstein:"wasserstein_distance",psi:"psi",kl:"kl_divergence",ks:"ks_statistic"},xt=(t,s,r)=>{const a=(n,l)=>{var i;return((i=n.metrics.find(u=>u.metric===l||l==="psi"&&u.metric==="psi_categorical"))==null?void 0:i.value)??0};return[...t].sort((n,l)=>{let i=0;switch(s.key){case"column":i=n.column.localeCompare(l.column);break;case"status":i=(n.drift_detected?1:0)-(l.drift_detected?1:0);break;case"risk":i=((r==null?void 0:r[n.column])??0)-((r==null?void 0:r[l.column])??0);break;default:{const u=ct[s.key];u&&(i=a(n,u)-a(l,u))}}return s.dir==="asc"?i:-i})};function ut(t,s,r){let a=Object.values(t.column_drifts);return s&&(a=a.filter(n=>n.drift_detected)),r&&(a=xt(a,r,t.feature_importances)),a}const mt=({active:t,dir:s})=>t?s==="asc"?e.jsx(Se,{size:11}):e.jsx(Ce,{size:11}):e.jsx(_e,{size:11,className:"opacity-30"}),pt=({distribution:t})=>e.jsxs("div",{className:"h-[350px] w-full bg-white dark:bg-slate-800 p-6 rounded border dark:border-slate-700 shadow-sm",children:[e.jsxs("h4",{className:"text-sm font-semibold mb-6 flex items-center gap-2 text-slate-700 dark:text-slate-300",children:[e.jsx(J,{size:16})," Distribution Comparison"]}),e.jsx(Q,{width:"100%",height:"85%",children:e.jsxs(qe,{data:t.bins,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:s=>`${s.bin_start.toFixed(2)}`,className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:!1}),e.jsx(se,{cursor:{fill:"rgba(0,0,0,0.05)"},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))",marginBottom:"0.5rem"}}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(V,{dataKey:"reference_count",name:"Reference (Training)",fill:"#94a3b8",radius:[4,4,0,0],barSize:30}),e.jsx(V,{dataKey:"current_count",name:"Current (Production)",fill:"#3b82f6",radius:[4,4,0,0],barSize:30})]})})]}),ht=({importance:t,rank:s,drifted:r,maxImportance:a})=>{if(t==null)return e.jsx("span",{className:"text-xs text-gray-400",children:"β€”"});const n=r&&s!=null&&s<=5,l=r&&s!=null&&s<=15&&!n;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[n?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300",children:[e.jsx(B,{size:12})," High"]}):l?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300",children:[e.jsx(B,{size:12})," Medium"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:[e.jsx(De,{size:12})," Low"]}),e.jsx("div",{className:"w-12 h-1.5 bg-gray-200 dark:bg-slate-700 rounded-full overflow-hidden",title:`Importance: ${(t*100/a).toFixed(0)}%`,children:e.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${a>0?t/a*100:0}%`}})})]})};function z({metric:t,showRawDistance:s=!1}){var a;const r=s&&(t==null?void 0:t.raw_value)!=null?`Raw earth-mover distance: ${t.raw_value.toFixed(4)} in column units`:void 0;return e.jsx("td",{className:`px-6 py-4 whitespace-nowrap tabular-nums ${t!=null&&t.has_drift?"text-red-600 dark:text-red-400 font-bold":""}`,title:r,children:((a=t==null?void 0:t.value)==null?void 0:a.toFixed(4))??"β€”"})}function gt({col:t,ks:s,ksPValue:r}){return e.jsxs("div",{className:"flex flex-col gap-4",children:[s&&e.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400",children:["KS statistic"," ",e.jsx("span",{className:"font-semibold tabular-nums",children:s.value.toFixed(4)})," ","vs threshold ",s.threshold.toFixed(2),r&&e.jsxs(e.Fragment,{children:[" ","Β· p-value"," ",e.jsx("span",{className:"tabular-nums",children:r.value<.001?"< 0.001":r.value.toFixed(3)})," ","(diagnostic only β€” drift is decided on the statistic)"]})]}),t.suggestions&&t.suggestions.length>0&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ze,{size:16,className:"mt-0.5 shrink-0 text-yellow-600 dark:text-yellow-400"}),e.jsx("ul",{className:"list-disc list-inside text-sm text-yellow-800 dark:text-yellow-200",children:t.suggestions.map((a,n)=>e.jsx("li",{children:a},n))})]})}),t.distribution&&e.jsx(pt,{distribution:t.distribution})]})}function bt({col:t,fi:s,isExpanded:r,maxImportance:a,toggleRow:n,hasSparklines:l,columnSparklines:i,colSpan:u}){const m=t.metrics.find(d=>d.metric==="wasserstein_distance"),p=t.metrics.find(d=>d.metric==="psi"||d.metric==="psi_categorical"),h=t.metrics.find(d=>d.metric==="kl_divergence"),g=t.metrics.find(d=>d.metric==="ks_statistic"),b=t.metrics.find(d=>d.metric==="ks_test_p_value"),k=s==null?void 0:s[t.column],c=s?Object.values(s).filter(d=>d>(k??0)).length+1:null;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:t.drift_detected?"bg-red-50 dark:bg-red-900/10":"",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap font-medium",children:t.column}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.drift_detected?e.jsxs("span",{className:"text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(Ne,{size:16})," Drifted"]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(F,{size:16})," Stable"]})}),e.jsx(z,{metric:m,showRawDistance:!0}),e.jsx(z,{metric:p}),e.jsx(z,{metric:h}),e.jsx(z,{metric:g}),s&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(ht,{importance:k,rank:c,drifted:t.drift_detected,maxImportance:a})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("button",{onClick:()=>n(t.column),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 flex items-center gap-1 text-sm",children:[r?e.jsx(we,{size:16}):e.jsx(R,{size:16}),r?"Hide":"Details"]})}),l&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(dt,{values:i[t.column]??[]})})]}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:u,className:"px-6 py-4 bg-gray-50 dark:bg-slate-900/50",children:e.jsx(gt,{col:t,ks:g,ksPValue:b})})})]})}const ft=({report:t,showOnlyDrifted:s,sortConfig:r,onSort:a,columnSparklines:n})=>{const[l,i]=x.useState({});I.useEffect(()=>{i({})},[t]),I.useEffect(()=>{const d=o=>{o.key==="Escape"&&i({})};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const u=d=>i(o=>({...o,[d]:!o[d]})),m=t.feature_importances,p=m?Math.max(...Object.values(m)):0,h=Object.keys(n).length>0,g=ut(t,s,r),b=(m?8:7)+(h?1:0),k=t.missing_columns.length>0||t.new_columns.length>0,c=(d,o)=>e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer select-none hover:text-gray-700 dark:hover:text-slate-300",onClick:()=>a(d),children:e.jsxs("span",{className:"flex items-center gap-1",children:[o,e.jsx(mt,{active:(r==null?void 0:r.key)===d,dir:r==null?void 0:r.dir})]})});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-slate-900",children:e.jsxs("tr",{children:[c("column","Column"),c("status","Status"),c("wasserstein",e.jsx(D,{label:"Wasserstein",tooltip:"Measures distance between distributions, normalized by the reference column's standard deviation so the threshold is scale-free. Lower is better. < 0.1 usually means stable.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("psi",e.jsx(D,{label:"PSI",tooltip:"Population Stability Index. < 0.1: Stable, < 0.2: Minor Drift, > 0.2: Significant Drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("kl",e.jsx(D,{label:"KL Div",tooltip:"Kullback-Leibler Divergence. Measures how one probability distribution diverts from a second.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c("ks",e.jsx(D,{label:"KS Stat",tooltip:"Kolmogorov-Smirnov statistic β€” maximum distance between the two cumulative distributions (0–1). Unlike the p-value it does not shrink with sample size; values above the threshold (default 0.1) indicate drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),m&&c("risk",e.jsx(D,{label:"Risk",tooltip:"Combines drift status with feature importance. High = drifted + important feature. Helps prioritize which drifts to investigate.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"}),h&&e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{size:11})," Trend"]})})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-gray-200 dark:divide-slate-700",children:g.length===0&&s?e.jsx("tr",{children:e.jsxs("td",{colSpan:b,className:"px-6 py-8 text-center text-gray-500 dark:text-slate-400 text-sm",children:[e.jsx(F,{size:20,className:"inline mr-2 text-green-500"}),k?"No distribution drift among shared columns β€” see the schema drift above.":"No drifted columns found β€” all features are stable."]})}):g.map(d=>e.jsx(bt,{col:d,fi:m,isExpanded:l[d.column],maxImportance:p,toggleRow:u,hasSparklines:h,columnSparklines:n,colSpan:b},d.column))})]})})},kt=()=>e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-gray-500 dark:text-slate-400",children:[e.jsx(Re,{size:48,strokeWidth:1.2}),e.jsx("h2",{className:"text-lg font-medium text-gray-500 dark:text-slate-400",children:"No Drift Report Yet"}),e.jsxs("p",{className:"text-sm max-w-md",children:["Select a reference model from the dropdown above, upload current production data (CSV or Parquet), and click ",e.jsx("strong",{children:"Run Analysis"})," to compare distributions."]})]})}),jt=({file:t,onFileChange:s,invalid:r})=>{const a=x.useRef(null),n=l=>{l.target.files&&l.target.files[0]&&s(l.target.files[0])};return e.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("input",{ref:a,type:"file",className:"hidden",onChange:n,accept:".csv,.parquet","aria-label":"Upload current data file (CSV or Parquet)"}),t?e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2.5 border border-gray-200 dark:border-slate-600 rounded-md text-sm bg-gray-50 dark:bg-slate-900",children:[e.jsx(Le,{size:14,className:"text-green-500 shrink-0"}),e.jsx("span",{className:"text-slate-700 dark:text-slate-300 truncate max-w-[180px]",children:t.name}),e.jsx("button",{type:"button",onClick:()=>s(null),"aria-label":`Remove ${t.name}`,className:"text-gray-400 hover:text-red-500 transition-colors ml-1",children:e.jsx(E,{size:14})})]}):e.jsxs("button",{type:"button",onClick:()=>{var l;return(l=a.current)==null?void 0:l.click()},"aria-describedby":r?"file-uploader-error":void 0,className:`flex items-center gap-2 px-3 py-2.5 border border-dashed rounded-md text-sm transition-colors ${r?"border-red-400 dark:border-red-500 text-red-600 dark:text-red-400 hover:border-red-500":"border-gray-300 dark:border-slate-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-500 dark:hover:border-blue-500"}`,children:[e.jsx(Ee,{size:15}),"Upload CSV / Parquet"]})]}),r&&!t&&e.jsx("span",{id:"file-uploader-error",className:"text-[11px] text-red-600 dark:text-red-400",children:"Current data file is required."})]})};function yt({triggerRef:t,open:s,listboxId:r,invalid:a,selectedJob:n,selectedJobData:l,onSelect:i,onToggle:u}){return e.jsxs("button",{ref:t,type:"button","aria-haspopup":"listbox","aria-expanded":s,"aria-controls":r,onClick:()=>{u()},className:`w-full flex items-center gap-2 px-3 py-2.5 border rounded-md text-sm transition-colors ${a?"border-red-400 dark:border-red-500 hover:border-red-500":n?"border-blue-300 dark:border-blue-700 bg-blue-50/50 dark:bg-blue-900/20":"border-gray-200 dark:border-slate-600 hover:border-gray-300 dark:hover:border-slate-500"}`,"aria-describedby":a?"job-selector-error":void 0,children:[e.jsx(Ae,{size:15,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:`truncate ${n?"text-slate-800 dark:text-slate-200":"text-gray-400"}`,children:l?`${l.dataset_name} (${l.job_id.slice(0,8)})`:"Select reference model..."}),n&&e.jsx("span",{role:"button",tabIndex:0,"aria-label":"Clear selected reference model",title:"Clear selection",onClick:m=>{m.stopPropagation(),i("")},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.stopPropagation(),m.preventDefault(),i(""))},className:"ml-auto shrink-0 p-0.5 rounded hover:bg-black/5 dark:hover:bg-white/10 text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:e.jsx(E,{size:13})}),e.jsx(R,{size:14,className:`${n?"":"ml-auto"} shrink-0 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})}const vt=({jobs:t,selectedJob:s,onSelect:r,invalid:a})=>{const[n,l]=x.useState(!1),[i,u]=x.useState(""),m=x.useRef(null),p=x.useRef(null),h="job-selector-listbox";x.useEffect(()=>{const c=d=>{m.current&&!m.current.contains(d.target)&&l(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),x.useEffect(()=>{if(!n)return;const c=d=>{var o;d.key==="Escape"&&(l(!1),(o=p.current)==null||o.focus())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[n]);const g=x.useMemo(()=>{if(!i)return t;const c=i.toLowerCase();return t.filter(d=>{var o,f,y;return d.dataset_name.toLowerCase().includes(c)||d.job_id.toLowerCase().includes(c)||((o=d.description)==null?void 0:o.toLowerCase().includes(c))||((f=d.model_type)==null?void 0:f.toLowerCase().includes(c))||((y=d.target_column)==null?void 0:y.toLowerCase().includes(c))})},[i,t]),b=x.useMemo(()=>{var d;const c={};for(const o of g){const f=((d=o.created_at)==null?void 0:d.split(" ")[0])||"Unknown";c[f]||(c[f]=[]),c[f].push(o)}return Object.entries(c).sort(([o],[f])=>f.localeCompare(o))},[g]),k=x.useMemo(()=>t.find(c=>c.job_id===s),[t,s]);return e.jsxs("div",{ref:m,className:"relative flex-1 min-w-0",children:[e.jsx(yt,{triggerRef:p,open:n,listboxId:h,invalid:a,selectedJob:s,selectedJobData:k,onSelect:r,onToggle:()=>{l(!n),u("")}}),a&&!s&&e.jsx("span",{id:"job-selector-error",className:"block mt-1 text-[11px] text-red-600 dark:text-red-400",children:"Reference job is required."}),n&&e.jsxs("div",{id:h,role:"listbox","aria-label":"Reference model jobs",className:"absolute z-50 left-0 right-0 mt-1 bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-600 rounded-md shadow-lg overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-slate-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none z-10",size:14}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Search jobs...",value:i,onChange:c=>u(c.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-200 dark:border-slate-600 rounded bg-gray-50 dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:g.length===0?e.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"No jobs found"}):b.map(([c,d])=>e.jsxs("div",{children:[e.jsx("div",{className:"sticky top-0 px-3 py-1.5 text-[11px] font-semibold text-gray-500 dark:text-slate-400 bg-gray-50 dark:bg-slate-900/80 uppercase tracking-wider border-b border-gray-100 dark:border-slate-700",children:c}),d.map(o=>e.jsxs("button",{type:"button",role:"option","aria-selected":s===o.job_id,onClick:()=>{r(o.job_id),l(!1)},className:`w-full text-left px-3 py-2.5 text-sm transition-colors ${s===o.job_id?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-slate-700/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:o.dataset_name}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono shrink-0",children:o.job_id.slice(0,8)}),o.model_type&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-300 shrink-0",children:o.model_type}),o.best_metric&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-300 shrink-0 ml-auto tabular-nums truncate max-w-[140px]",title:o.best_metric,children:o.best_metric.split(" | ")[0]})]}),(o.target_column||o.description)&&e.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-[11px] text-gray-500 dark:text-slate-400",children:[o.target_column&&e.jsxs("span",{children:["target: ",o.target_column]}),o.description&&e.jsxs("span",{className:"truncate italic",children:["β€” ",o.description]})]})]},o.job_id))]},c))})]})]})},Nt=({missingColumns:t,newColumns:s})=>{const r=t.filter(n=>n.trim()!==""),a=s.filter(n=>n.trim()!=="");return r.length===0&&a.length===0?null:e.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.length>0&&e.jsxs("details",{className:"group bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[e.jsxs("summary",{className:"font-semibold text-red-800 dark:text-red-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(L,{size:16,className:"shrink-0"})," Missing Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-red-200 dark:bg-red-800 px-2 py-0.5 rounded-full",children:r.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-red-600/70 dark:text-red-300/60 mb-2",children:"Columns present in reference (training) data but missing from your uploaded file."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:r.map(n=>e.jsx("li",{children:n},n))})]})]}),a.length>0&&e.jsxs("details",{className:"group bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800",children:[e.jsxs("summary",{className:"font-semibold text-blue-800 dark:text-blue-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(_,{size:16,className:"shrink-0"})," Extra Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-blue-200 dark:bg-blue-800 px-2 py-0.5 rounded-full",children:a.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-blue-600/70 dark:text-blue-300/60 mb-2",children:"Columns in your uploaded file that were not in the training reference. These are excluded from distribution metrics but reported as schema changes. The model target is excluded from both checks."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-blue-700 dark:text-blue-300",children:a.map(n=>e.jsx("li",{children:n},n))})]})]})]})},wt=({job:t,onUpdateDescription:s})=>{const[r,a]=x.useState(!1),[n,l]=x.useState("");x.useEffect(()=>{a(!1)},[t.job_id]);const i=async()=>{await s(n),a(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-3 text-xs text-gray-500 dark:text-slate-400",children:[t.model_type&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-indigo-50 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-300 font-medium",children:t.model_type}),t.target_column&&e.jsxs("span",{children:["Target:"," ",e.jsx("span",{className:"font-medium text-slate-600 dark:text-slate-300",children:t.target_column})]}),t.n_features!=null&&e.jsxs("span",{children:[t.n_features," features"]}),t.n_rows!=null&&e.jsxs("span",{children:[t.n_rows.toLocaleString()," rows"]}),t.best_metric&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-green-50 dark:bg-green-900/30 text-green-600 dark:text-green-300 font-medium tabular-nums",children:t.best_metric}),e.jsx("span",{className:"border-l border-gray-200 dark:border-slate-700 h-3"}),r?e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[e.jsx("input",{autoFocus:!0,value:n,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&a(!1)},placeholder:"Add a description...",className:"flex-1 min-w-0 px-2 py-0.5 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>void i(),className:"text-green-500 hover:text-green-600",children:e.jsx(Te,{size:13})}),e.jsx("button",{onClick:()=>a(!1),className:"text-gray-400 hover:text-red-500",children:e.jsx(E,{size:13})})]}):e.jsxs("button",{onClick:()=>{l(t.description||""),a(!0)},className:"flex items-center gap-1 hover:text-blue-500 transition-colors group",children:[e.jsx(Fe,{size:11,className:"opacity-50 group-hover:opacity-100"}),e.jsx("span",{className:t.description?"":"italic text-gray-400",children:t.description||"Add description..."})]})]})};function _t(t){var p;const s=Object.values(t.column_drifts),r=s.length,a=s.filter(h=>h.drift_detected).length,n=s.map(h=>{var g;return(g=h.metrics.find(b=>b.metric==="psi"))==null?void 0:g.value}).filter(h=>h!=null),l=n.length>0?n.reduce((h,g)=>h+g,0)/n.length:0,i=[...s].sort((h,g)=>{var c,d;const b=((c=h.metrics.find(o=>o.metric==="psi"))==null?void 0:c.value)??0;return(((d=g.metrics.find(o=>o.metric==="psi"))==null?void 0:d.value)??0)-b})[0],u=r>0?Math.round(a/r*100):0,m=((p=i==null?void 0:i.metrics.find(h=>h.metric==="psi"))==null?void 0:p.value)??0;return{totalCols:r,driftedCount:a,avgPsi:l,mostDrifted:i,driftedPct:u,mostDriftedPsi:m}}const St=({report:t})=>{const{totalCols:s,driftedCount:r,avgPsi:a,mostDrifted:n,driftedPct:l,mostDriftedPsi:i}=_t(t);return e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx($e,{size:13})," Total Columns"]}),e.jsx("div",{className:"text-2xl font-bold tabular-nums",children:s}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["Ref: ",t.reference_rows.toLocaleString()," rows | Cur: ",t.current_rows.toLocaleString()," rows"]})]}),e.jsxs("div",{className:`rounded-lg p-4 border ${r>0?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[r>0?e.jsx(L,{size:13}):e.jsx(F,{size:13})," Drifted"]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums",children:[r," ",e.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["/ ",s]})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[l,"% of features"]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Pe,{size:13})," Avg PSI"]}),e.jsx("div",{className:`text-2xl font-bold tabular-nums ${a>.2?"text-red-600 dark:text-red-400":a>.1?"text-amber-600 dark:text-amber-400":""}`,children:a.toFixed(4)}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:a<.1?"Stable":a<.2?"Minor drift":"Significant drift"})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Me,{size:13})," Most Drifted"]}),e.jsx("div",{className:"text-lg font-bold truncate",title:n==null?void 0:n.column,children:(n==null?void 0:n.column)??"β€”"}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["PSI: ",i.toFixed(4)]})]})]})},Ct=[{key:"psi",label:"PSI",step:.05,min:.01,max:1},{key:"ks",label:"KS statistic",step:.01,min:.01,max:.5},{key:"wasserstein",label:"Wasserstein",step:.05,min:.01,max:1},{key:"kl",label:"KL Div",step:.05,min:.01,max:1}],Dt={psi:.2,ks:.1,wasserstein:.1,kl:.1},zt=({thresholds:t,onChange:s})=>e.jsxs("div",{className:"px-4 pb-3 flex flex-wrap items-center gap-4 border-t border-gray-100 dark:border-slate-700 pt-3",children:[e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-slate-400",children:"Thresholds:"}),Ct.map(({key:r,label:a,step:n,min:l,max:i})=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-slate-400",children:[e.jsx("span",{className:"font-medium",children:a}),e.jsx("input",{type:"number",value:t[r]??"",onChange:u=>s({...t,[r]:Number.parseFloat(u.target.value)||void 0}),step:n,min:l,max:i,className:"w-20 px-2 py-1 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500 tabular-nums"})]},r)),e.jsx("button",{onClick:()=>s(Dt),className:"text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:"Reset defaults"})]});function Rt(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(!1),p=x.useCallback(async()=>{if(t==null){r(null);return}n(!0),i(null);try{const g=await S.getDriftAlert(t);r(g)}catch{i("Failed to load drift alert detail.")}finally{n(!1)}},[t]);x.useEffect(()=>{p()},[p]);const h=x.useCallback(async(g,b,k)=>{var c,d;if(t==null)return null;m(!0),i(null);try{const o=await S.updateDriftAlertDisposition(t,g,b,k);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?(d=(c=o.response)==null?void 0:c.data)==null?void 0:d.detail:void 0;return i(f||`Failed to ${g} the drift alert.`),null}finally{m(!1)}},[t]);return{detail:s,loading:a,error:l,actionPending:u,refresh:p,applyDisposition:h}}function Lt(t){const[s,r]=x.useState([]),a=x.useCallback(()=>{if(!t){r([]);return}S.getDriftHistory(t).then(r).catch(()=>r([]))},[t]);x.useEffect(()=>{a()},[a]);const n=x.useMemo(()=>{if(s.length<2)return{};const l=[...s].reverse(),i={};for(const u of l)if(u.summary)for(const[m,p]of Object.entries(u.summary))i[m]||(i[m]=[]),i[m].push(p.psi??0);return i},[s]);return{driftHistory:s,columnSparklines:n,refreshHistory:a}}function Et(){const[t,s]=x.useState([]),[r,a]=x.useState(!1),n=x.useCallback(async()=>{a(!0);try{const i=await S.getJobs();s(i)}catch(i){console.error("Failed to fetch jobs",i)}finally{a(!1)}},[]);x.useEffect(()=>{n()},[n]);const l=x.useCallback(async(i,u)=>{try{await S.updateJobDescription(i,u),s(m=>m.map(p=>p.job_id===i?{...p,description:u}:p))}catch(m){console.error("Failed to save description",m)}},[]);return{jobs:t,refreshing:r,refresh:n,updateJobDescription:l}}function At(t,s){switch(t){case"psi":case"psi_categorical":return s.psi;case"ks_statistic":return s.ks;case"wasserstein_distance":return s.wasserstein;case"kl_divergence":return s.kl;default:return}}function Tt(t,s,r){let a=t.has_drift;const n=At(t.metric,r);if(n!=null&&(a=t.value>n),t.metric==="ks_test_p_value"){const l=s.metrics.find(i=>i.metric==="ks_statistic");l!=null&&(a=l.value>(r.ks??l.threshold))}return{...t,has_drift:a}}function Ft(t){const[s,r]=x.useState(null),[a,n]=x.useState(!1),[l,i]=x.useState(null),[u,m]=x.useState(null),p=x.useCallback(async({selectedJob:g,file:b,job:k,thresholds:c})=>{var d;n(!0),i(null),m(null);try{const o=await S.calculateDrift(g,b,k==null?void 0:k.dataset_name,c);return r(o),o}catch(o){const f=o&&typeof o=="object"&&"response"in o?o.response:void 0,y=(d=f==null?void 0:f.data)==null?void 0:d.detail;return i(y||"Failed to calculate drift."),m((f==null?void 0:f.status)===404?"no_baseline":"failed"),null}finally{n(!1)}},[]),h=x.useMemo(()=>{if(!s)return null;const g=t,b={};let k=0;for(const[d,o]of Object.entries(s.column_drifts)){const f=o.metrics.map(C=>Tt(C,o,g)),y=f.some(C=>C.has_drift);y&&k++,b[d]={...o,metrics:f,drift_detected:y}}const c=s.missing_columns.length+s.new_columns.length;return{...s,column_drifts:b,drifted_columns_count:k+c}},[s,t]);return{report:s,evaluatedReport:h,loading:a,error:l,errorKind:u,setError:i,calculate:p}}function $t(){const[t,s]=x.useState(null),r=x.useCallback(n=>{s(l=>(l==null?void 0:l.key)===n?l.dir==="asc"?{key:n,dir:"desc"}:null:{key:n,dir:"asc"})},[]),a=x.useCallback(()=>s(null),[]);return{sortConfig:t,handleSort:r,clearSort:a}}function Pt(t,s){const r=t.feature_importances,a=["Column","Status","Wasserstein","PSI","KL Divergence","KS Statistic","KS P-Value",...r?["Importance","Risk"]:[]],n=Object.values(t.column_drifts).map(p=>{const h=c=>{var d,o;return((o=(d=p.metrics.find(f=>f.metric===c))==null?void 0:d.value)==null?void 0:o.toFixed(6))??""},g=r==null?void 0:r[p.column],b=r?Object.values(r).filter(c=>c>(g??0)).length+1:null,k=p.drift_detected&&b!=null?b<=5?"High":b<=15?"Medium":"Low":r?"Low":"";return[p.column,p.drift_detected?"Drifted":"Stable",h("wasserstein_distance"),h("psi"),h("kl_divergence"),h("ks_statistic"),h("ks_test_p_value"),...r?[(g==null?void 0:g.toFixed(6))??"",k]:[]]}),l=[a,...n].map(p=>p.map(h=>`"${h}"`).join(",")).join(` -`),i=new Blob([l],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(i),m=document.createElement("a");m.href=u,m.download=`drift_report_${s??"export"}_${new Date().toISOString().slice(0,10)}.csv`,m.click(),URL.revokeObjectURL(u)}const Mt={psi:.2,ks:.1,wasserstein:.1,kl:.1};function Ot({jobs:t,selectedJob:s,setSelectedJob:r,file:a,setFile:n,submitAttempted:l,loading:i,refreshing:u,showThresholds:m,onCalculate:p,onRefresh:h,onToggleThresholds:g}){return e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3 p-4",children:[e.jsx(vt,{jobs:t,selectedJob:s,onSelect:r,invalid:l&&!s}),e.jsx(jt,{file:a,onFileChange:n,invalid:l&&!a}),e.jsxs("button",{onClick:p,disabled:i||!s||!a,className:"flex items-center justify-center gap-2 px-5 py-2.5 action-primary rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors shrink-0",children:[i?e.jsx(Oe,{className:"animate-spin",size:16}):e.jsx(J,{size:16}),i?"Analyzing...":"Run Analysis"]}),e.jsx("button",{onClick:h,className:"p-2.5 rounded-md hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400 transition-colors shrink-0",title:"Refresh jobs",children:e.jsx(Ke,{size:16,className:u?"animate-spin":""})}),e.jsx("button",{onClick:g,className:`p-2.5 rounded-md transition-colors shrink-0 ${m?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400"}`,title:"Drift thresholds",children:e.jsx(Ue,{size:16})})]})}function Kt({error:t,errorKind:s,onRetry:r}){return e.jsxs(e.Fragment,{children:[t&&s&&e.jsx("div",{className:"mx-4 mb-4",children:e.jsx(G,{error:s==="no_baseline"?`No baseline reference is available for this job yet. ${t}`:t,onRetry:r})}),t&&!s&&e.jsxs("div",{className:"mx-4 mb-4 p-3 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-200 rounded-md flex items-center gap-2 border border-red-200 dark:border-red-800 text-sm",children:[e.jsx(L,{size:16,className:"shrink-0"}),t]})]})}const Vt=()=>{const[t,s]=Ve(),r=Number(t.get("investigate")),[a,n]=x.useState(""),[l,i]=x.useState(null),[u,m]=x.useState(Mt),[p,h]=x.useState(!1),[g,b]=x.useState(!1),[k,c]=x.useState(!1),[d,o]=x.useState(Number.isFinite(r)&&r>0?r:null),{jobs:f,refreshing:y,refresh:C,updateJobDescription:ne}=Et(),{evaluatedReport:v,loading:P,error:M,errorKind:le,setError:ie,calculate:oe}=Ft(u),{driftHistory:O,columnSparklines:de,refreshHistory:ce}=Lt(a),{sortConfig:K,handleSort:xe,clearSort:ue}=$t(),w=Rt(d);x.useEffect(()=>{const j=new URLSearchParams(t);d!=null?j.set("investigate",String(d)):j.delete("investigate"),s(j,{replace:!0})},[d]);const N=x.useMemo(()=>f.find(j=>j.job_id===a),[f,a]),U=async()=>{if(!a||!l){c(!0),ie("Please select a Reference Job and upload Current Data.");return}c(!1),await oe({selectedJob:a,file:l,job:N,thresholds:u})&&ce()},me=()=>{v&&Pt(v,N==null?void 0:N.dataset_name)},pe=x.useMemo(()=>a?{job:a}:{},[a]);return e.jsxs("div",{className:"p-6 w-full text-slate-900 dark:text-slate-100",children:[e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Data Drift Analysis"})}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow mb-6 border dark:border-slate-700",children:[e.jsx(Ot,{jobs:f,selectedJob:a,setSelectedJob:n,file:l,setFile:i,submitAttempted:k,loading:P,refreshing:y,showThresholds:p,onCalculate:()=>void U(),onRefresh:()=>void C(),onToggleThresholds:()=>h(j=>!j)}),p&&e.jsx(zt,{thresholds:u,onChange:m}),N&&e.jsx(wt,{job:N,onUpdateDescription:j=>ne(N.job_id,j)}),e.jsx(Kt,{error:M,errorKind:le,onRetry:()=>void U()})]}),!v&&!P&&!M&&e.jsx(kt,{}),v&&e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700",children:[e.jsx(St,{report:v}),e.jsx(Nt,{missingColumns:v.missing_columns,newColumns:v.new_columns}),e.jsx(it,{showOnlyDrifted:g,onToggleDrifted:()=>b(j=>!j),sortConfig:K,onClearSort:ue,onExport:me}),e.jsx(ft,{report:v,showOnlyDrifted:g,sortConfig:K,onSort:xe,columnSparklines:de})]}),e.jsx(ot,{history:O}),e.jsx(lt,{history:O,onInvestigate:o}),e.jsx(nt,{alertId:d,detail:w.detail,loading:w.loading,error:w.error,actionPending:w.actionPending,onApplyDisposition:w.applyDisposition,onRetry:()=>void w.refresh(),onClose:()=>o(null),filters:pe})]})};export{Vt as DataDriftPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{O as he,j as L,Q as ge,f as H,t as be,U as fe,C as ke,V as je,a as u,T,S as X,Y as ye,X as E,K as ve,b as I,e as F,z as Ne,_ as we,p as R,$ as _e,a0 as Se,a1 as Ce,a2 as B,a3 as De,a4 as ze,a5 as J,a6 as _,a7 as Re,a8 as Le,w as Ee,a9 as Ae,aa as Te,s as Fe,ab as $e,ac as Me,ad as Pe,D as Oe,c as Ke,ae as Ue}from"./vendor-utils-VkF_O5b_.js";import{R as A,b as He,C as Ie,M as Be,L as Ye,E as G,m as S,u as We}from"./index-C2dSXwG1.js";import{R as Q,ag as Ve,C as Z,X as ee,Y as te,T as se,ah as re,ai as Y,B as qe,h as W}from"./vendor-charts-BkHP8M8k.js";import{F as V}from"./FormField-BaO1-ftW.js";const Xe={none:{label:"No drift",classes:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800"},warning:{label:"Warning",classes:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-800"},critical:{label:"Critical",classes:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800"}},ae=({severity:t})=>{const s=Xe[t],r=t==="critical"?he:t==="warning"?L:ge;return e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:[e.jsx(r,{size:12,"aria-hidden":"true"}),s.label]})},Je={new:{label:"New",classes:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800"},acknowledged:{label:"Acknowledged",classes:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400 border-purple-200 dark:border-purple-800"},resolved:{label:"Resolved",classes:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700"},reopened:{label:"Reopened",classes:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400 border-orange-200 dark:border-orange-800"}},$=({status:t})=>{const s=Je[t];return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-medium ${s.classes}`,children:s.label})};function Ge({detail:t,filters:s}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ae,{severity:t.severity}),e.jsx($,{status:t.status}),t.evaluation_status!=="completed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300 border-slate-200 dark:border-slate-700",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t.evaluation_status==="no_baseline"?"No baseline":"Evaluation failed"]})]}),t.evaluation_status!=="completed"&&t.error_message&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(H,{size:16,className:"shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:t.error_message})]}),e.jsx(Qe,{detail:t}),e.jsx(Ze,{detail:t,filters:s})]})}function Qe({detail:t}){var s;return e.jsxs("dl",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Detected"}),e.jsx("dd",{className:"font-medium",children:((s=t.created_at)==null?void 0:s.replace("T"," ").slice(0,16))??"Unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Threshold version"}),e.jsxs("dd",{className:"font-medium",children:[t.threshold_version!=null?`v${t.threshold_version}`:"β€”",t.threshold_version!=null&&e.jsxs("span",{className:"block text-[11px] font-normal text-gray-400",children:["PSI ",t.threshold_psi," Β· KS ",t.threshold_ks," Β· Wasserstein"," ",t.threshold_wasserstein," Β· KL ",t.threshold_kl]})]})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Drifted features"}),e.jsx("dd",{className:"font-medium",children:t.drifted_columns_count!=null&&t.total_columns!=null?`${t.drifted_columns_count} / ${t.total_columns}`:"β€”"})]})]})}function Ze({detail:t,filters:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[e.jsx(A,{recordRef:{kind:"job",jobId:t.job_id},origin:"/drift",filters:s}),t.model_version&&e.jsx(A,{recordRef:{kind:"modelVersion",jobId:t.job_id,version:t.model_version},origin:"/drift",filters:s}),t.deployment_id!=null&&e.jsx(A,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},origin:"/drift",filters:s})]})}function et({alertId:t,evaluationStatus:s,evidenceRows:r}){return s!=="completed"?null:e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Feature evidence"}),r.length===0?e.jsx(He,{title:"No evidence recorded",description:"This alert has no retained per-feature drift evidence."}):e.jsx(Ie,{caption:`Per-feature drift evidence for alert #${t??""}`,filename:`drift-alert-${t??"unknown"}-evidence`,columns:[{key:"column",label:"Feature"},{key:"drifted",label:"Drifted"},{key:"psi",label:"PSI"},{key:"wasserstein",label:"Wasserstein"},{key:"ks_statistic",label:"KS statistic"},{key:"ks_p_value",label:"KS p-value"}],rows:r,defaultOpen:!0})]})}function tt({entries:t}){return e.jsxs(e.Fragment,{children:[e.jsxs("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(be,{size:12})," History"]}),t.length===0?e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No disposition changes recorded yet."}):e.jsx("ul",{className:"space-y-1.5",children:t.map((s,r)=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx($,{status:s.status}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{size:11})," ",s.actor]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(ke,{size:11})," ",s.at.replace("T"," ").slice(0,16)]}),s.note&&e.jsxs("span",{className:"italic",children:['"',s.note,'"']})]},r))})]})}const q={new:["acknowledge"],acknowledged:["resolve","reopen"],resolved:["reopen"],reopened:["acknowledge"]},st={acknowledge:"Acknowledge",resolve:"Resolve",reopen:"Reopen"};function rt({detail:t,actor:s,note:r,actionError:a,error:n,actionPending:l,setActor:i,setNote:m,handleAction:c}){return e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2 flex items-center gap-1.5",children:[e.jsx(je,{size:13})," Disposition"]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:t.owner?e.jsxs(e.Fragment,{children:["Currently ",e.jsx("strong",{children:t.status})," by ",e.jsx("strong",{children:t.owner}),"."]}):e.jsx(e.Fragment,{children:"No disposition recorded yet β€” acknowledge to claim this alert."})}),(q[t.status]??[]).length>0&&e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[e.jsx(V,{label:"Your name",required:!0,children:x=>e.jsx("input",{...x,type:"text",value:s,onChange:g=>i(g.target.value),placeholder:"e.g. alice",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})}),e.jsx(V,{label:"Note",hint:"Optional context for the audit trail",children:x=>e.jsx("input",{...x,type:"text",value:r,onChange:g=>m(g.target.value),placeholder:"Optional",className:"w-full text-sm px-3 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800"})})]}),a&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:a}),n&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:n}),e.jsx("div",{className:"flex gap-2",children:(q[t.status]??[]).map(x=>e.jsx("button",{type:"button",disabled:l,onClick:()=>void c(x),className:"px-3 py-1.5 text-sm font-medium rounded-md action-primary disabled:opacity-50 disabled:cursor-not-allowed",children:st[x]},x))})]}),e.jsx(tt,{entries:t.disposition_history})]})}function at(t){return t!=null&&t.column_drifts?Object.entries(t.column_drifts).map(([s,r])=>{const a=Object.fromEntries(r.metrics.map(n=>[n.metric,n.value]));return{column:s,drifted:r.drift_detected?"Yes":"No",psi:a.psi!=null?Number(a.psi.toFixed(4)):null,wasserstein:a.wasserstein_distance!=null?Number(a.wasserstein_distance.toFixed(4)):null,ks_statistic:a.ks_statistic!=null?Number(a.ks_statistic.toFixed(4)):null,ks_p_value:a.ks_test_p_value!=null?Number(a.ks_test_p_value.toFixed(4)):null}}):[]}const nt=({alertId:t,detail:s,loading:r,error:a,actionPending:n,onApplyDisposition:l,onRetry:i,onClose:m,filters:c})=>{const[x,g]=u.useState(""),[h,f]=u.useState(""),[k,p]=u.useState(null),d=async b=>{if(!x.trim()){p("Enter your name so the disposition records who made it.");return}p(null),await l(b,x.trim(),h.trim()||void 0)&&f("")},o=at(s);return e.jsxs(Be,{isOpen:t!==null,onClose:m,title:t!==null?`Drift alert #${t}`:void 0,size:"3xl",children:[r&&e.jsx(Ye,{message:"Loading drift alert…"}),!r&&a&&!s&&e.jsx(G,{error:a,onRetry:i}),!r&&s&&e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsx(Ge,{detail:s,filters:c}),e.jsx(et,{alertId:t,evaluationStatus:s.evaluation_status,evidenceRows:o}),e.jsx(rt,{detail:s,actor:x,note:h,actionError:k,error:a,actionPending:n,setActor:g,setNote:f,handleAction:d})]})]})},lt=({history:t,onInvestigate:s})=>t.length===0?null:e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(T,{size:18})," Alert History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs uppercase tracking-wider text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-slate-700",children:[e.jsx("th",{className:"px-4 py-2 font-medium",children:"Detected"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Severity"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Evaluation"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Threshold"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Owner"}),e.jsx("th",{className:"px-4 py-2 font-medium sr-only",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(r=>{var a;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-slate-700/60 last:border-0",children:[e.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:((a=r.created_at)==null?void 0:a.replace("T"," ").slice(0,16))??"Unknown"}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(ae,{severity:r.severity})}),e.jsx("td",{className:"px-4 py-2",children:e.jsx($,{status:r.status})}),e.jsx("td",{className:"px-4 py-2 capitalize",children:r.evaluation_status.replace("_"," ")}),e.jsx("td",{className:"px-4 py-2",children:r.threshold_version!=null?`v${r.threshold_version}`:"β€”"}),e.jsx("td",{className:"px-4 py-2",children:r.owner??"β€”"}),e.jsx("td",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>s(r.id),className:"inline-flex items-center gap-1 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 text-xs font-medium",children:[e.jsx(X,{size:12,"aria-hidden":"true"}),"Investigate"]})})]},r.id)})})]})})]}),it=({showOnlyDrifted:t,onToggleDrifted:s,sortConfig:r,onClearSort:a,onExport:n})=>e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:s,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors border ${t?"bg-red-50 dark:bg-red-900/30 border-red-200 dark:border-red-700 text-red-700 dark:text-red-300":"border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700"}`,children:[e.jsx(ye,{size:12}),t?"Showing drifted only":"Show only drifted"]}),r&&e.jsxs("button",{onClick:a,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-xs text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:[e.jsx(E,{size:11})," Clear sort"]}),e.jsx("div",{className:"ml-auto",children:e.jsxs("button",{onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium border border-gray-200 dark:border-slate-600 text-gray-500 dark:text-slate-400 hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors",title:"Download drift report as CSV",children:[e.jsx(ve,{size:12})," Export CSV"]})})]}),ot=({history:t})=>{if(t.length<=1)return null;const s=[...t].reverse().map(r=>{var l;const a=r.summary?Object.values(r.summary):null,n=a?a.filter(i=>i.drifted).length:null;return{date:((l=r.created_at)==null?void 0:l.split("T")[0])??"",drifted:n,pct:a!=null&&a.length?Math.round((n??0)/a.length*100):null}});return e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700 mt-6",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(T,{size:18})," Drift History",e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-1",children:["(",t.length," checks)"]})]}),e.jsx("div",{className:"h-[280px]",children:e.jsx(Q,{width:"100%",height:"100%",children:e.jsxs(Ve,{data:s,margin:{top:5,right:30,left:0,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:"date",tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{tick:{fill:"hsl(var(--muted-foreground))",fontSize:11},tickLine:!1,axisLine:!1}),e.jsx(se,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(r,a)=>a==="Drifted Features"?[r,a]:a==="Drift %"?[`${r}%`,a]:[r,a]}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(Y,{type:"monotone",dataKey:"drifted",name:"Drifted Features",stroke:"#ef4444",strokeWidth:2,dot:{r:3,fill:"#ef4444"}}),e.jsx(Y,{type:"monotone",dataKey:"pct",name:"Drift %",stroke:"#f59e0b",strokeWidth:2,dot:{r:3,fill:"#f59e0b"},strokeDasharray:"5 5"})]})})})]})},D=({label:t,tooltip:s,icon:r})=>e.jsxs("div",{className:"group relative flex items-center gap-1 cursor-help",children:[e.jsx("span",{className:"border-b border-dotted border-gray-400",children:t}),r&&e.jsx("span",{className:"text-gray-400",children:r}),e.jsxs("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 w-64 p-2 bg-slate-900 text-white text-xs rounded shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 text-center pointer-events-none",children:[s,e.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 -mb-1 border-4 border-transparent border-b-slate-900"})]})]}),dt=({values:t,width:s=64,height:r=20})=>{if(t.length<2)return e.jsx("span",{className:"text-[10px] text-gray-400",children:"β€”"});const a=Math.min(...t),l=Math.max(...t)-a||1,i=t.map((g,h)=>{const f=h/(t.length-1)*s,k=r-(g-a)/l*(r-4)-2;return`${f},${k}`}).join(" "),m=t[t.length-1]??0,c=m>.2?"#ef4444":m>.1?"#f59e0b":"#22c55e",x=r-(m-a)/l*(r-4)-2;return e.jsxs("svg",{width:s,height:r,className:"inline-block",children:[e.jsx("polyline",{points:i,fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("circle",{cx:s,cy:x,r:"2",fill:c})]})},ct={wasserstein:"wasserstein_distance",psi:"psi",kl:"kl_divergence",ks:"ks_statistic"},xt=(t,s,r)=>{const a=(n,l)=>{var i;return((i=n.metrics.find(m=>m.metric===l||l==="psi"&&m.metric==="psi_categorical"))==null?void 0:i.value)??0};return[...t].sort((n,l)=>{let i=0;switch(s.key){case"column":i=n.column.localeCompare(l.column);break;case"status":i=(n.drift_detected?1:0)-(l.drift_detected?1:0);break;case"risk":i=((r==null?void 0:r[n.column])??0)-((r==null?void 0:r[l.column])??0);break;default:{const m=ct[s.key];m&&(i=a(n,m)-a(l,m))}}return s.dir==="asc"?i:-i})};function ut(t,s,r){let a=Object.values(t.column_drifts);return s&&(a=a.filter(n=>n.drift_detected)),r&&(a=xt(a,r,t.feature_importances)),a}const mt=({active:t,dir:s})=>t?s==="asc"?e.jsx(Se,{size:11}):e.jsx(Ce,{size:11}):e.jsx(_e,{size:11,className:"opacity-30"}),pt=({distribution:t})=>e.jsxs("div",{className:"h-[350px] w-full bg-white dark:bg-slate-800 p-6 rounded border dark:border-slate-700 shadow-sm",children:[e.jsxs("h4",{className:"text-sm font-semibold mb-6 flex items-center gap-2 text-slate-700 dark:text-slate-300",children:[e.jsx(J,{size:16})," Distribution Comparison"]}),e.jsx(Q,{width:"100%",height:"85%",children:e.jsxs(qe,{data:t.bins,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsx(Z,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ee,{dataKey:s=>`${s.bin_start.toFixed(2)}`,className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:{stroke:"#cbd5e1"}}),e.jsx(te,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"},tickLine:!1,axisLine:!1}),e.jsx(se,{cursor:{fill:"rgba(0,0,0,0.05)"},contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))",marginBottom:"0.5rem"}}),e.jsx(re,{verticalAlign:"top",height:36,iconType:"circle"}),e.jsx(W,{dataKey:"reference_count",name:"Reference (Training)",fill:"#94a3b8",radius:[4,4,0,0],barSize:30}),e.jsx(W,{dataKey:"current_count",name:"Current (Production)",fill:"#3b82f6",radius:[4,4,0,0],barSize:30})]})})]}),ht=({importance:t,rank:s,drifted:r,maxImportance:a})=>{if(t==null)return e.jsx("span",{className:"text-xs text-gray-400",children:"β€”"});const n=r&&s!=null&&s<=5,l=r&&s!=null&&s<=15&&!n;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[n?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300",children:[e.jsx(B,{size:12})," High"]}):l?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-semibold bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300",children:[e.jsx(B,{size:12})," Medium"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:[e.jsx(De,{size:12})," Low"]}),e.jsx("div",{className:"w-12 h-1.5 bg-gray-200 dark:bg-slate-700 rounded-full overflow-hidden",title:`Importance: ${(t*100/a).toFixed(0)}%`,children:e.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${a>0?t/a*100:0}%`}})})]})};function z({metric:t,showRawDistance:s=!1}){var a;const r=s&&(t==null?void 0:t.raw_value)!=null?`Raw earth-mover distance: ${t.raw_value.toFixed(4)} in column units`:void 0;return e.jsx("td",{className:`px-6 py-4 whitespace-nowrap tabular-nums ${t!=null&&t.has_drift?"text-red-600 dark:text-red-400 font-bold":""}`,title:r,children:((a=t==null?void 0:t.value)==null?void 0:a.toFixed(4))??"β€”"})}function gt({col:t,ks:s,ksPValue:r}){return e.jsxs("div",{className:"flex flex-col gap-4",children:[s&&e.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400",children:["KS statistic"," ",e.jsx("span",{className:"font-semibold tabular-nums",children:s.value.toFixed(4)})," ","vs threshold ",s.threshold.toFixed(2),r&&e.jsxs(e.Fragment,{children:[" ","Β· p-value"," ",e.jsx("span",{className:"tabular-nums",children:r.value<.001?"< 0.001":r.value.toFixed(3)})," ","(diagnostic only β€” drift is decided on the statistic)"]})]}),t.suggestions&&t.suggestions.length>0&&e.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ze,{size:16,className:"mt-0.5 shrink-0 text-yellow-600 dark:text-yellow-400"}),e.jsx("ul",{className:"list-disc list-inside text-sm text-yellow-800 dark:text-yellow-200",children:t.suggestions.map((a,n)=>e.jsx("li",{children:a},n))})]})}),t.distribution&&e.jsx(pt,{distribution:t.distribution})]})}function bt({col:t,fi:s,isExpanded:r,maxImportance:a,toggleRow:n,hasSparklines:l,columnSparklines:i,colSpan:m}){const c=t.metrics.find(d=>d.metric==="wasserstein_distance"),x=t.metrics.find(d=>d.metric==="psi"||d.metric==="psi_categorical"),g=t.metrics.find(d=>d.metric==="kl_divergence"),h=t.metrics.find(d=>d.metric==="ks_statistic"),f=t.metrics.find(d=>d.metric==="ks_test_p_value"),k=s==null?void 0:s[t.column],p=s?Object.values(s).filter(d=>d>(k??0)).length+1:null;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:t.drift_detected?"bg-red-50 dark:bg-red-900/10":"",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap font-medium",children:t.column}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.drift_detected?e.jsxs("span",{className:"text-red-600 dark:text-red-400 flex items-center gap-1",children:[e.jsx(Ne,{size:16})," Drifted"]}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(F,{size:16})," Stable"]})}),e.jsx(z,{metric:c,showRawDistance:!0}),e.jsx(z,{metric:x}),e.jsx(z,{metric:g}),e.jsx(z,{metric:h}),s&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(ht,{importance:k,rank:p,drifted:t.drift_detected,maxImportance:a})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("button",{onClick:()=>n(t.column),className:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 flex items-center gap-1 text-sm",children:[r?e.jsx(we,{size:16}):e.jsx(R,{size:16}),r?"Hide":"Details"]})}),l&&e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx(dt,{values:i[t.column]??[]})})]}),r&&e.jsx("tr",{children:e.jsx("td",{colSpan:m,className:"px-6 py-4 bg-gray-50 dark:bg-slate-900/50",children:e.jsx(gt,{col:t,ks:h,ksPValue:f})})})]})}const ft=({report:t,showOnlyDrifted:s,sortConfig:r,onSort:a,columnSparklines:n})=>{const[l,i]=u.useState({});I.useEffect(()=>{i({})},[t]),I.useEffect(()=>{const d=o=>{o.key==="Escape"&&i({})};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const m=d=>i(o=>({...o,[d]:!o[d]})),c=t.feature_importances,x=c?Math.max(...Object.values(c)):0,g=Object.keys(n).length>0,h=ut(t,s,r),f=(c?8:7)+(g?1:0),k=t.missing_columns.length>0||t.new_columns.length>0,p=(d,o)=>e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider cursor-pointer select-none hover:text-gray-700 dark:hover:text-slate-300",onClick:()=>a(d),children:e.jsxs("span",{className:"flex items-center gap-1",children:[o,e.jsx(mt,{active:(r==null?void 0:r.key)===d,dir:r==null?void 0:r.dir})]})});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-slate-900",children:e.jsxs("tr",{children:[p("column","Column"),p("status","Status"),p("wasserstein",e.jsx(D,{label:"Wasserstein",tooltip:"Measures distance between distributions, normalized by the reference column's standard deviation so the threshold is scale-free. Lower is better. < 0.1 usually means stable.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),p("psi",e.jsx(D,{label:"PSI",tooltip:"Population Stability Index. < 0.1: Stable, < 0.2: Minor Drift, > 0.2: Significant Drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),p("kl",e.jsx(D,{label:"KL Div",tooltip:"Kullback-Leibler Divergence. Measures how one probability distribution diverts from a second.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),p("ks",e.jsx(D,{label:"KS Stat",tooltip:"Kolmogorov-Smirnov statistic β€” maximum distance between the two cumulative distributions (0–1). Unlike the p-value it does not shrink with sample size; values above the threshold (default 0.1) indicate drift.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),c&&p("risk",e.jsx(D,{label:"Risk",tooltip:"Combines drift status with feature importance. High = drifted + important feature. Helps prioritize which drifts to investigate.",icon:e.jsx(_,{className:"w-3 h-3 text-slate-400"})})),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Actions"}),g&&e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{size:11})," Trend"]})})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-gray-200 dark:divide-slate-700",children:h.length===0&&s?e.jsx("tr",{children:e.jsxs("td",{colSpan:f,className:"px-6 py-8 text-center text-gray-500 dark:text-slate-400 text-sm",children:[e.jsx(F,{size:20,className:"inline mr-2 text-green-500"}),k?"No distribution drift among shared columns β€” see the schema drift above.":"No drifted columns found β€” all features are stable."]})}):h.map(d=>e.jsx(bt,{col:d,fi:c,isExpanded:l[d.column],maxImportance:x,toggleRow:m,hasSparklines:g,columnSparklines:n,colSpan:f},d.column))})]})})},kt=()=>e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow border dark:border-slate-700 p-12 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-gray-500 dark:text-slate-400",children:[e.jsx(Re,{size:48,strokeWidth:1.2}),e.jsx("h2",{className:"text-lg font-medium text-gray-500 dark:text-slate-400",children:"No Drift Report Yet"}),e.jsxs("p",{className:"text-sm max-w-md",children:["Select a reference model from the dropdown above, upload current production data (CSV or Parquet), and click ",e.jsx("strong",{children:"Run Analysis"})," to compare distributions."]})]})}),jt=({file:t,onFileChange:s,invalid:r})=>{const a=u.useRef(null),n=l=>{l.target.files&&l.target.files[0]&&s(l.target.files[0])};return e.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("input",{ref:a,type:"file",className:"hidden",onChange:n,accept:".csv,.parquet","aria-label":"Upload current data file (CSV or Parquet)"}),t?e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2.5 border border-gray-200 dark:border-slate-600 rounded-md text-sm bg-gray-50 dark:bg-slate-900",children:[e.jsx(Le,{size:14,className:"text-green-500 shrink-0"}),e.jsx("span",{className:"text-slate-700 dark:text-slate-300 truncate max-w-[180px]",children:t.name}),e.jsx("button",{type:"button",onClick:()=>s(null),"aria-label":`Remove ${t.name}`,className:"text-gray-400 hover:text-red-500 transition-colors ml-1",children:e.jsx(E,{size:14})})]}):e.jsxs("button",{type:"button",onClick:()=>{var l;return(l=a.current)==null?void 0:l.click()},"aria-describedby":r?"file-uploader-error":void 0,className:`flex items-center gap-2 px-3 py-2.5 border border-dashed rounded-md text-sm transition-colors ${r?"border-red-400 dark:border-red-500 text-red-600 dark:text-red-400 hover:border-red-500":"border-gray-300 dark:border-slate-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-500 dark:hover:border-blue-500"}`,children:[e.jsx(Ee,{size:15}),"Upload CSV / Parquet"]})]}),r&&!t&&e.jsx("span",{id:"file-uploader-error",className:"text-[11px] text-red-600 dark:text-red-400",children:"Current data file is required."})]})};function yt({triggerRef:t,open:s,listboxId:r,invalid:a,selectedJob:n,selectedJobData:l,onSelect:i,onToggle:m}){return e.jsxs("button",{ref:t,type:"button","aria-haspopup":"listbox","aria-expanded":s,"aria-controls":r,onClick:()=>{m()},className:`w-full flex items-center gap-2 px-3 py-2.5 border rounded-md text-sm transition-colors ${a?"border-red-400 dark:border-red-500 hover:border-red-500":n?"border-blue-300 dark:border-blue-700 bg-blue-50/50 dark:bg-blue-900/20":"border-gray-200 dark:border-slate-600 hover:border-gray-300 dark:hover:border-slate-500"}`,"aria-describedby":a?"job-selector-error":void 0,children:[e.jsx(Ae,{size:15,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:`truncate ${n?"text-slate-800 dark:text-slate-200":"text-gray-400"}`,children:l?`${l.dataset_name} (${l.job_id.slice(0,8)})`:"Select reference model..."}),n&&e.jsx("span",{role:"button",tabIndex:0,"aria-label":"Clear selected reference model",title:"Clear selection",onClick:c=>{c.stopPropagation(),i("")},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.stopPropagation(),c.preventDefault(),i(""))},className:"ml-auto shrink-0 p-0.5 rounded hover:bg-black/5 dark:hover:bg-white/10 text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:e.jsx(E,{size:13})}),e.jsx(R,{size:14,className:`${n?"":"ml-auto"} shrink-0 text-gray-400 transition-transform ${s?"rotate-180":""}`})]})}const vt=({jobs:t,selectedJob:s,onSelect:r,invalid:a})=>{const[n,l]=u.useState(!1),[i,m]=u.useState(""),c=u.useRef(null),x=u.useRef(null),g="job-selector-listbox";u.useEffect(()=>{const p=d=>{c.current&&!c.current.contains(d.target)&&l(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),u.useEffect(()=>{if(!n)return;const p=d=>{var o;d.key==="Escape"&&(l(!1),(o=x.current)==null||o.focus())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]);const h=u.useMemo(()=>{if(!i)return t;const p=i.toLowerCase();return t.filter(d=>{var o,b,y;return d.dataset_name.toLowerCase().includes(p)||d.job_id.toLowerCase().includes(p)||((o=d.description)==null?void 0:o.toLowerCase().includes(p))||((b=d.model_type)==null?void 0:b.toLowerCase().includes(p))||((y=d.target_column)==null?void 0:y.toLowerCase().includes(p))})},[i,t]),f=u.useMemo(()=>{var d;const p={};for(const o of h){const b=((d=o.created_at)==null?void 0:d.split(" ")[0])||"Unknown";p[b]||(p[b]=[]),p[b].push(o)}return Object.entries(p).sort(([o],[b])=>b.localeCompare(o))},[h]),k=u.useMemo(()=>t.find(p=>p.job_id===s),[t,s]);return e.jsxs("div",{ref:c,className:"relative flex-1 min-w-0",children:[e.jsx(yt,{triggerRef:x,open:n,listboxId:g,invalid:a,selectedJob:s,selectedJobData:k,onSelect:r,onToggle:()=>{l(!n),m("")}}),a&&!s&&e.jsx("span",{id:"job-selector-error",className:"block mt-1 text-[11px] text-red-600 dark:text-red-400",children:"Reference job is required."}),n&&e.jsxs("div",{id:g,role:"listbox","aria-label":"Reference model jobs",className:"absolute z-50 left-0 right-0 mt-1 bg-white dark:bg-slate-800 border border-gray-200 dark:border-slate-600 rounded-md shadow-lg overflow-hidden",children:[e.jsx("div",{className:"p-2 border-b border-gray-100 dark:border-slate-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(X,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none z-10",size:14}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:"Search jobs...",value:i,onChange:p=>m(p.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-200 dark:border-slate-600 rounded bg-gray-50 dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"})]})}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:h.length===0?e.jsx("div",{className:"p-4 text-center text-gray-400 text-sm",children:"No jobs found"}):f.map(([p,d])=>e.jsxs("div",{children:[e.jsx("div",{className:"sticky top-0 px-3 py-1.5 text-[11px] font-semibold text-gray-500 dark:text-slate-400 bg-gray-50 dark:bg-slate-900/80 uppercase tracking-wider border-b border-gray-100 dark:border-slate-700",children:p}),d.map(o=>e.jsxs("button",{type:"button",role:"option","aria-selected":s===o.job_id,onClick:()=>{r(o.job_id),l(!1)},className:`w-full text-left px-3 py-2.5 text-sm transition-colors ${s===o.job_id?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-slate-700/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:o.dataset_name}),e.jsx("span",{className:"text-[11px] text-gray-400 font-mono shrink-0",children:o.job_id.slice(0,8)}),o.model_type&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-300 shrink-0",children:o.model_type}),o.best_metric&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-100 dark:bg-green-900/40 text-green-600 dark:text-green-300 shrink-0 ml-auto tabular-nums truncate max-w-[140px]",title:o.best_metric,children:o.best_metric.split(" | ")[0]})]}),(o.target_column||o.description)&&e.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-[11px] text-gray-500 dark:text-slate-400",children:[o.target_column&&e.jsxs("span",{children:["target: ",o.target_column]}),o.description&&e.jsxs("span",{className:"truncate italic",children:["β€” ",o.description]})]})]},o.job_id))]},p))})]})]})},Nt=({missingColumns:t,newColumns:s})=>{const r=t.filter(n=>n.trim()!==""),a=s.filter(n=>n.trim()!=="");return r.length===0&&a.length===0?null:e.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.length>0&&e.jsxs("details",{className:"group bg-red-50 dark:bg-red-900/20 rounded border border-red-200 dark:border-red-800",children:[e.jsxs("summary",{className:"font-semibold text-red-800 dark:text-red-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(L,{size:16,className:"shrink-0"})," Missing Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-red-200 dark:bg-red-800 px-2 py-0.5 rounded-full",children:r.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-red-600/70 dark:text-red-300/60 mb-2",children:"Columns present in reference (training) data but missing from your uploaded file."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-red-700 dark:text-red-300",children:r.map(n=>e.jsx("li",{children:n},n))})]})]}),a.length>0&&e.jsxs("details",{className:"group bg-blue-50 dark:bg-blue-900/20 rounded border border-blue-200 dark:border-blue-800",children:[e.jsxs("summary",{className:"font-semibold text-blue-800 dark:text-blue-200 p-4 flex items-center gap-2 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden",children:[e.jsx(R,{size:14,className:"transition-transform group-open:rotate-180 shrink-0"}),e.jsx(_,{size:16,className:"shrink-0"})," Extra Columns",e.jsx("span",{className:"ml-auto text-xs font-normal bg-blue-200 dark:bg-blue-800 px-2 py-0.5 rounded-full",children:a.length})]}),e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("p",{className:"text-[11px] text-blue-600/70 dark:text-blue-300/60 mb-2",children:"Columns in your uploaded file that were not in the training reference. These are excluded from distribution metrics but reported as schema changes. The model target is excluded from both checks."}),e.jsx("ul",{className:"list-disc list-inside text-sm text-blue-700 dark:text-blue-300",children:a.map(n=>e.jsx("li",{children:n},n))})]})]})]})},wt=({job:t,onUpdateDescription:s})=>{const[r,a]=u.useState(!1),[n,l]=u.useState("");u.useEffect(()=>{a(!1)},[t.job_id]);const i=async()=>{await s(n),a(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pb-3 text-xs text-gray-500 dark:text-slate-400",children:[t.model_type&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-indigo-50 dark:bg-indigo-900/30 text-indigo-600 dark:text-indigo-300 font-medium",children:t.model_type}),t.target_column&&e.jsxs("span",{children:["Target:"," ",e.jsx("span",{className:"font-medium text-slate-600 dark:text-slate-300",children:t.target_column})]}),t.n_features!=null&&e.jsxs("span",{children:[t.n_features," features"]}),t.n_rows!=null&&e.jsxs("span",{children:[t.n_rows.toLocaleString()," rows"]}),t.best_metric&&e.jsx("span",{className:"px-2 py-0.5 rounded bg-green-50 dark:bg-green-900/30 text-green-600 dark:text-green-300 font-medium tabular-nums",children:t.best_metric}),e.jsx("span",{className:"border-l border-gray-200 dark:border-slate-700 h-3"}),r?e.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[e.jsx("input",{autoFocus:!0,value:n,onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&i(),m.key==="Escape"&&a(!1)},placeholder:"Add a description...",className:"flex-1 min-w-0 px-2 py-0.5 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500"}),e.jsx("button",{onClick:()=>void i(),className:"text-green-500 hover:text-green-600",children:e.jsx(Te,{size:13})}),e.jsx("button",{onClick:()=>a(!1),className:"text-gray-400 hover:text-red-500",children:e.jsx(E,{size:13})})]}):e.jsxs("button",{onClick:()=>{l(t.description||""),a(!0)},className:"flex items-center gap-1 hover:text-blue-500 transition-colors group",children:[e.jsx(Fe,{size:11,className:"opacity-50 group-hover:opacity-100"}),e.jsx("span",{className:t.description?"":"italic text-gray-400",children:t.description||"Add description..."})]})]})};function _t(t){const s=Object.values(t.column_drifts),r=s.length,a=s.filter(c=>c.drift_detected).length,n=s.flatMap(c=>{var g;const x=(g=c.metrics.find(h=>(h.metric==="psi"||h.metric==="psi_categorical")&&Number.isFinite(h.value)))==null?void 0:g.value;return x==null?[]:[{column:c.column,psi:x}]}),l=n.length>0?n.reduce((c,x)=>c+x.psi,0)/n.length:null,i=n.sort((c,x)=>x.psi-c.psi)[0],m=r>0?Math.round(a/r*100):0;return{totalCols:r,driftedCount:a,avgPsi:l,mostDrifted:i,driftedPct:m}}function St(t){return t==null?"No PSI available":t<.1?"Stable":t<.2?"Minor drift":"Significant drift"}const Ct=({report:t})=>{const{totalCols:s,driftedCount:r,avgPsi:a,mostDrifted:n,driftedPct:l}=_t(t);return e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx($e,{size:13})," Total Columns"]}),e.jsx("div",{className:"text-2xl font-bold tabular-nums",children:s}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["Ref: ",t.reference_rows.toLocaleString()," rows | Cur: ",t.current_rows.toLocaleString()," rows"]})]}),e.jsxs("div",{className:`rounded-lg p-4 border ${r>0?"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[r>0?e.jsx(L,{size:13}):e.jsx(F,{size:13})," Drifted"]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums",children:[r," ",e.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["/ ",s]})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[l,"% of features"]})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Me,{size:13})," Avg PSI"]}),e.jsx("div",{className:`text-2xl font-bold tabular-nums ${(a??0)>.2?"text-red-600 dark:text-red-400":(a??0)>.1?"text-amber-600 dark:text-amber-400":""}`,children:(a==null?void 0:a.toFixed(4))??"β€”"}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:St(a)})]}),e.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900/50 rounded-lg p-4 border dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mb-1",children:[e.jsx(Pe,{size:13})," Most Drifted"]}),e.jsx("div",{className:"text-lg font-bold truncate",title:n==null?void 0:n.column,children:(n==null?void 0:n.column)??"β€”"}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:["PSI: ",(n==null?void 0:n.psi.toFixed(4))??"β€”"]})]})]})},Dt=[{key:"psi",label:"PSI",step:.05,min:.01,max:1},{key:"ks",label:"KS statistic",step:.01,min:.01,max:.5},{key:"wasserstein",label:"Wasserstein",step:.05,min:.01,max:1},{key:"kl",label:"KL Div",step:.05,min:.01,max:1}],zt={psi:.2,ks:.1,wasserstein:.1,kl:.1},Rt=({thresholds:t,onChange:s})=>e.jsxs("div",{className:"px-4 pb-3 flex flex-wrap items-center gap-4 border-t border-gray-100 dark:border-slate-700 pt-3",children:[e.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-slate-400",children:"Thresholds:"}),Dt.map(({key:r,label:a,step:n,min:l,max:i})=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-slate-400",children:[e.jsx("span",{className:"font-medium",children:a}),e.jsx("input",{type:"number",value:t[r]??"",onChange:m=>s({...t,[r]:Number.parseFloat(m.target.value)||void 0}),step:n,min:l,max:i,className:"w-20 px-2 py-1 text-xs border border-gray-200 dark:border-slate-600 rounded bg-white dark:bg-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-blue-500 tabular-nums"})]},r)),e.jsx("button",{onClick:()=>s(zt),className:"text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-slate-300 transition-colors",children:"Reset defaults"})]});function Lt(t){const[s,r]=u.useState(null),[a,n]=u.useState(!1),[l,i]=u.useState(null),[m,c]=u.useState(!1),x=u.useCallback(async()=>{if(t==null){r(null);return}n(!0),i(null);try{const h=await S.getDriftAlert(t);r(h)}catch{i("Failed to load drift alert detail.")}finally{n(!1)}},[t]);u.useEffect(()=>{x()},[x]);const g=u.useCallback(async(h,f,k)=>{var p,d;if(t==null)return null;c(!0),i(null);try{const o=await S.updateDriftAlertDisposition(t,h,f,k);return r(o),o}catch(o){const b=o&&typeof o=="object"&&"response"in o?(d=(p=o.response)==null?void 0:p.data)==null?void 0:d.detail:void 0;return i(b||`Failed to ${h} the drift alert.`),null}finally{c(!1)}},[t]);return{detail:s,loading:a,error:l,actionPending:m,refresh:x,applyDisposition:g}}function Et(t){const[s,r]=u.useState([]),a=u.useCallback(()=>{if(!t){r([]);return}S.getDriftHistory(t).then(r).catch(()=>r([]))},[t]);u.useEffect(()=>{a()},[a]);const n=u.useMemo(()=>{if(s.length<2)return{};const l=[...s].reverse(),i={};for(const m of l)if(m.summary)for(const[c,x]of Object.entries(m.summary))i[c]||(i[c]=[]),i[c].push(x.psi??0);return i},[s]);return{driftHistory:s,columnSparklines:n,refreshHistory:a}}function At(){const[t,s]=u.useState([]),[r,a]=u.useState(!1),n=u.useCallback(async()=>{a(!0);try{const i=await S.getJobs();s(i)}catch(i){console.error("Failed to fetch jobs",i)}finally{a(!1)}},[]);u.useEffect(()=>{n()},[n]);const l=u.useCallback(async(i,m)=>{try{await S.updateJobDescription(i,m),s(c=>c.map(x=>x.job_id===i?{...x,description:m}:x))}catch(c){console.error("Failed to save description",c)}},[]);return{jobs:t,refreshing:r,refresh:n,updateJobDescription:l}}function Tt(t,s){switch(t){case"psi":case"psi_categorical":return s.psi;case"ks_statistic":return s.ks;case"wasserstein_distance":return s.wasserstein;case"kl_divergence":return s.kl;default:return}}function Ft(t,s,r){let a=t.has_drift;const n=Tt(t.metric,r);if(n!=null&&(a=t.value>n),t.metric==="ks_test_p_value"){const l=s.metrics.find(i=>i.metric==="ks_statistic");l!=null&&(a=l.value>(r.ks??l.threshold))}return{...t,has_drift:a}}function $t(t){const[s,r]=u.useState(null),[a,n]=u.useState(!1),[l,i]=u.useState(null),[m,c]=u.useState(null),x=u.useCallback(async({selectedJob:h,file:f,job:k,thresholds:p})=>{var d;n(!0),i(null),c(null);try{const o=await S.calculateDrift(h,f,k==null?void 0:k.dataset_name,p);return r(o),o}catch(o){const b=o&&typeof o=="object"&&"response"in o?o.response:void 0,y=(d=b==null?void 0:b.data)==null?void 0:d.detail;return i(y||"Failed to calculate drift."),c((b==null?void 0:b.status)===404?"no_baseline":"failed"),null}finally{n(!1)}},[]),g=u.useMemo(()=>{if(!s)return null;const h=t,f={};let k=0;for(const[d,o]of Object.entries(s.column_drifts)){const b=o.metrics.map(C=>Ft(C,o,h)),y=b.some(C=>C.has_drift);y&&k++,f[d]={...o,metrics:b,drift_detected:y}}const p=s.missing_columns.length+s.new_columns.length;return{...s,column_drifts:f,drifted_columns_count:k+p}},[s,t]);return{report:s,evaluatedReport:g,loading:a,error:l,errorKind:m,setError:i,calculate:x}}function Mt(){const[t,s]=u.useState(null),r=u.useCallback(n=>{s(l=>(l==null?void 0:l.key)===n?l.dir==="asc"?{key:n,dir:"desc"}:null:{key:n,dir:"asc"})},[]),a=u.useCallback(()=>s(null),[]);return{sortConfig:t,handleSort:r,clearSort:a}}function Pt(t,s){const r=t.feature_importances,a=["Column","Status","Wasserstein","PSI","KL Divergence","KS Statistic","KS P-Value",...r?["Importance","Risk"]:[]],n=Object.values(t.column_drifts).map(x=>{const g=p=>{var d,o;return((o=(d=x.metrics.find(b=>b.metric===p))==null?void 0:d.value)==null?void 0:o.toFixed(6))??""},h=r==null?void 0:r[x.column],f=r?Object.values(r).filter(p=>p>(h??0)).length+1:null,k=x.drift_detected&&f!=null?f<=5?"High":f<=15?"Medium":"Low":r?"Low":"";return[x.column,x.drift_detected?"Drifted":"Stable",g("wasserstein_distance"),g("psi"),g("kl_divergence"),g("ks_statistic"),g("ks_test_p_value"),...r?[(h==null?void 0:h.toFixed(6))??"",k]:[]]}),l=[a,...n].map(x=>x.map(g=>`"${g}"`).join(",")).join(` +`),i=new Blob([l],{type:"text/csv;charset=utf-8;"}),m=URL.createObjectURL(i),c=document.createElement("a");c.href=m,c.download=`drift_report_${s??"export"}_${new Date().toISOString().slice(0,10)}.csv`,c.click(),URL.revokeObjectURL(m)}const Ot={psi:.2,ks:.1,wasserstein:.1,kl:.1};function Kt({jobs:t,selectedJob:s,setSelectedJob:r,file:a,setFile:n,submitAttempted:l,loading:i,refreshing:m,showThresholds:c,onCalculate:x,onRefresh:g,onToggleThresholds:h}){return e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3 p-4",children:[e.jsx(vt,{jobs:t,selectedJob:s,onSelect:r,invalid:l&&!s}),e.jsx(jt,{file:a,onFileChange:n,invalid:l&&!a}),e.jsxs("button",{onClick:x,disabled:i||!s||!a,className:"flex items-center justify-center gap-2 px-5 py-2.5 action-primary rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors shrink-0",children:[i?e.jsx(Oe,{className:"animate-spin",size:16}):e.jsx(J,{size:16}),i?"Analyzing...":"Run Analysis"]}),e.jsx("button",{onClick:g,className:"p-2.5 rounded-md hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400 transition-colors shrink-0",title:"Refresh jobs",children:e.jsx(Ke,{size:16,className:m?"animate-spin":""})}),e.jsx("button",{onClick:h,className:`p-2.5 rounded-md transition-colors shrink-0 ${c?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"hover:bg-gray-100 dark:hover:bg-slate-700 text-gray-400"}`,title:"Drift thresholds",children:e.jsx(Ue,{size:16})})]})}function Ut({error:t,errorKind:s,onRetry:r}){return e.jsxs(e.Fragment,{children:[t&&s&&e.jsx("div",{className:"mx-4 mb-4",children:e.jsx(G,{error:s==="no_baseline"?`No baseline reference is available for this job yet. ${t}`:t,onRetry:r})}),t&&!s&&e.jsxs("div",{className:"mx-4 mb-4 p-3 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-200 rounded-md flex items-center gap-2 border border-red-200 dark:border-red-800 text-sm",children:[e.jsx(L,{size:16,className:"shrink-0"}),t]})]})}const Vt=()=>{const[t,s]=We(),r=Number(t.get("investigate")),[a,n]=u.useState(""),[l,i]=u.useState(null),[m,c]=u.useState(Ot),[x,g]=u.useState(!1),[h,f]=u.useState(!1),[k,p]=u.useState(!1),[d,o]=u.useState(Number.isFinite(r)&&r>0?r:null),{jobs:b,refreshing:y,refresh:C,updateJobDescription:ne}=At(),{evaluatedReport:v,loading:M,error:P,errorKind:le,setError:ie,calculate:oe}=$t(m),{driftHistory:O,columnSparklines:de,refreshHistory:ce}=Et(a),{sortConfig:K,handleSort:xe,clearSort:ue}=Mt(),w=Lt(d);u.useEffect(()=>{const j=new URLSearchParams(t);d!=null?j.set("investigate",String(d)):j.delete("investigate"),s(j,{replace:!0})},[d]);const N=u.useMemo(()=>b.find(j=>j.job_id===a),[b,a]),U=async()=>{if(!a||!l){p(!0),ie("Please select a Reference Job and upload Current Data.");return}p(!1),await oe({selectedJob:a,file:l,job:N,thresholds:m})&&ce()},me=()=>{v&&Pt(v,N==null?void 0:N.dataset_name)},pe=u.useMemo(()=>a?{job:a}:{},[a]);return e.jsxs("div",{className:"p-6 w-full text-slate-900 dark:text-slate-100",children:[e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsx("h1",{className:"text-2xl font-bold",children:"Data Drift Analysis"})}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-lg shadow mb-6 border dark:border-slate-700",children:[e.jsx(Kt,{jobs:b,selectedJob:a,setSelectedJob:n,file:l,setFile:i,submitAttempted:k,loading:M,refreshing:y,showThresholds:x,onCalculate:()=>void U(),onRefresh:()=>void C(),onToggleThresholds:()=>g(j=>!j)}),x&&e.jsx(Rt,{thresholds:m,onChange:c}),N&&e.jsx(wt,{job:N,onUpdateDescription:j=>ne(N.job_id,j)}),e.jsx(Ut,{error:P,errorKind:le,onRetry:()=>void U()})]}),!v&&!M&&!P&&e.jsx(kt,{}),v&&e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-lg shadow border dark:border-slate-700",children:[e.jsx(Ct,{report:v}),e.jsx(Nt,{missingColumns:v.missing_columns,newColumns:v.new_columns}),e.jsx(it,{showOnlyDrifted:h,onToggleDrifted:()=>f(j=>!j),sortConfig:K,onClearSort:ue,onExport:me}),e.jsx(ft,{report:v,showOnlyDrifted:h,sortConfig:K,onSort:xe,columnSparklines:de})]}),e.jsx(ot,{history:O}),e.jsx(lt,{history:O,onInvestigate:o}),e.jsx(nt,{alertId:d,detail:w.detail,loading:w.loading,error:w.error,actionPending:w.actionPending,onApplyDisposition:w.applyDisposition,onRetry:()=>void w.refresh(),onClose:()=>o(null),filters:pe})]})};export{Vt as DataDriftPage}; diff --git a/static/ml_canvas/assets/DeploymentsPage-CZDjMu-I.js b/static/ml_canvas/assets/DeploymentsPage-CB5LtP6P.js similarity index 99% rename from static/ml_canvas/assets/DeploymentsPage-CZDjMu-I.js rename to static/ml_canvas/assets/DeploymentsPage-CB5LtP6P.js index c6d06afd0..e6547fe8d 100644 --- a/static/ml_canvas/assets/DeploymentsPage-CZDjMu-I.js +++ b/static/ml_canvas/assets/DeploymentsPage-CB5LtP6P.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as s,c as T,d as U,C as O,B as q,e as z,P as C}from"./vendor-utils-VkF_O5b_.js";import{u as G,a as K,d as h,p as Q,E as v,L as F,b as W,t as u,R as p}from"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";const X=r=>!r||r.toLowerCase()==="unknown",i=r=>r.version!==void 0&&r.version!==null?`${r.model_type} v${r.version} (job ${r.job_id})`:`${r.model_type} (job ${r.job_id})`,M=({deployment:r})=>{const t=r.version!==void 0&&r.version!==null;return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsx(p,{recordRef:{kind:"job",jobId:r.job_id},label:`Job ${r.job_id.slice(0,8)}`,origin:"/deployments"}),t?e.jsx(p,{recordRef:{kind:"modelVersion",jobId:r.job_id,version:String(r.version)},label:`Version ${r.version}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"Version unavailable"}),X(r.dataset_id)?e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"No dataset available"}):e.jsx(p,{recordRef:{kind:"dataset",datasetId:r.dataset_id},label:"Dataset",origin:"/deployments"}),r.previous_deployment_id!==void 0&&r.previous_deployment_id!==null?e.jsx(p,{recordRef:{kind:"deployment",deploymentId:r.previous_deployment_id},label:`Replaced deployment #${r.previous_deployment_id}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",children:"No prior deployment"})]})},re=()=>{const[r]=G(),[t,P]=s.useState(null),[m,V]=s.useState([]),[n,f]=s.useState(!1),[k,N]=s.useState(null),[w,_]=s.useState(!1),[R,D]=s.useState(null),[$,I]=s.useState(null),[b,S]=s.useState(null),E=K(),o=s.useCallback(async()=>{f(!0),N(null);try{const[a,l]=await Promise.all([h.getActive(),h.getHistory(50,0)]);P(a),V(l)}catch(a){console.error("Failed to load deployments",a),N("Failed to load deployment data.")}finally{f(!1)}},[]);s.useEffect(()=>{o()},[o]);const d=s.useMemo(()=>Q(r),[r]),c=(d==null?void 0:d.ref.kind)==="deployment"?d.ref.deploymentId:null,x=(d==null?void 0:d.ref.kind)==="modelVersion"?d.ref.jobId:null,j=s.useRef(null),y=s.useCallback(a=>c!==null&&a.id===c||x!==null&&a.job_id===x,[c,x]);s.useEffect(()=>{var a;c===null&&x===null||n||(a=j.current)==null||a.scrollIntoView({block:"center",behavior:"smooth"})},[c,x,n,m,t]);const H=async()=>{!t||!await E({title:"Deactivate deployment?",message:`Deactivate ${i(t)}? It will no longer serve predictions.`,confirmLabel:"Deactivate",variant:"danger"})||await A(t)},A=async a=>{I(null),_(!0);try{await h.deactivate(),await o(),u.success("Deployment deactivated",i(a))}catch(l){console.error("Failed to deactivate",l);const g=l.message||"Failed to deactivate deployment.";I(g),u.error(`Failed to deactivate ${i(a)}`,g)}finally{_(!1)}},J=async a=>{await E({title:"Redeploy model?",message:`Redeploy ${i(a)}? This will replace the currently active deployment${t?` (${i(t)})`:""}.`,confirmLabel:"Redeploy"})&&await L(a)},L=async a=>{S(null),D(a.job_id);try{await h.deployModel(a.job_id),await o(),u.success("Model redeployed",i(a))}catch(l){console.error("Failed to redeploy",l);const g=l.message||"Failed to redeploy model.";S({jobId:a.job_id,message:g}),u.error(`Failed to redeploy ${i(a)}`,g)}finally{D(null)}},B=()=>t?e.jsxs("div",{ref:y(t)?j:null,className:`bg-white dark:bg-gray-800 rounded-xl border shadow-sm overflow-hidden ${y(t)?"border-blue-400 dark:border-blue-500 ring-2 ring-blue-200 dark:ring-blue-900":"border-green-200 dark:border-green-900"}`,children:[e.jsxs("div",{className:"p-6 border-b border-gray-100 dark:border-gray-700 flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(q,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t.model_type}),e.jsxs("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 text-xs font-medium rounded-full flex items-center gap-1",children:[e.jsx(z,{className:"w-3 h-3"})," Active"]})]}),e.jsx("div",{className:"mt-1",children:e.jsx(M,{deployment:t})}),e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:["Deployed: ",new Date(t.created_at).toLocaleString()]})]})]}),e.jsxs("button",{onClick:()=>{H()},disabled:w,className:"flex items-center gap-2 px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 dark:bg-red-900/20 dark:hover:bg-red-900/30 dark:text-red-400 rounded-lg transition-colors text-sm font-medium disabled:opacity-50",children:[w?e.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin"}):e.jsx(C,{className:"w-4 h-4"}),"Deactivate"]})]}),$&&e.jsx("div",{className:"border-b border-gray-100 dark:border-gray-700",children:e.jsx(v,{error:`Failed to deactivate ${i(t)}: ${$}`,onRetry:()=>A(t)})}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 text-xs font-mono text-gray-500 dark:text-gray-400 break-all",children:["Artifact URI: ",t.artifact_uri]})]}):n?e.jsx(F,{message:"Loading active deployment..."}):e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 p-8 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("h3",{className:"text-gray-900 dark:text-gray-100 font-medium",children:"No Active Model"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Deploy a model from the Experiments page to see it here."})]});return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-6 flex justify-between items-center shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100",children:"Model Deployments"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage active models and view deployment history"})]}),e.jsx("button",{onClick:()=>{o()},className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh","aria-label":"Refresh deployments",children:e.jsx(T,{className:`w-5 h-5 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[k&&e.jsx(v,{error:k,onRetry:()=>o()}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),"Active Deployment"]}),B()]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-blue-500"}),"Deployment History"]}),b&&e.jsx("div",{className:"mb-4",children:e.jsx(v,{error:`Failed to redeploy job ${b.jobId}: ${b.message}`,onRetry:()=>{const a=m.find(l=>l.job_id===b.jobId);return a?L(a):void 0}})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3",children:"Status"}),e.jsx("th",{className:"px-6 py-3",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3",children:"Lineage"}),e.jsx("th",{className:"px-6 py-3",children:"Deployed At"}),e.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:m.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:n?e.jsx(F,{message:"Loading deployment history..."}):e.jsx(W,{title:"No deployment history found."})})}):m.map(a=>e.jsxs("tr",{ref:y(a)?j:null,className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${y(a)?"bg-blue-50 dark:bg-blue-900/20 ring-1 ring-inset ring-blue-300 dark:ring-blue-700":""}`,children:[e.jsx("td",{className:"px-6 py-4",children:a.is_active?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),"Active"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),"Inactive"]})}),e.jsx("td",{className:"px-6 py-4 font-medium text-gray-900 dark:text-gray-100",children:a.model_type}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(M,{deployment:a})}),e.jsx("td",{className:"px-6 py-4 text-gray-500 dark:text-gray-400",children:new Date(a.created_at).toLocaleString()}),e.jsx("td",{className:"px-6 py-4 text-right",children:!a.is_active&&e.jsx("button",{onClick:()=>{J(a)},disabled:R===a.job_id,"aria-label":`Redeploy ${i(a)}`,className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium text-xs disabled:opacity-50",children:R===a.job_id?"Redeploying...":"Redeploy"})})]},a.id))})]})})})]})]})]})};export{re as DeploymentsPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as s,c as T,d as U,C as O,B as q,e as z,P as C}from"./vendor-utils-VkF_O5b_.js";import{u as G,a as K,d as h,p as Q,E as v,L as F,b as W,t as u,R as p}from"./index-C2dSXwG1.js";import"./vendor-charts-BkHP8M8k.js";const X=r=>!r||r.toLowerCase()==="unknown",i=r=>r.version!==void 0&&r.version!==null?`${r.model_type} v${r.version} (job ${r.job_id})`:`${r.model_type} (job ${r.job_id})`,M=({deployment:r})=>{const t=r.version!==void 0&&r.version!==null;return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs",children:[e.jsx(p,{recordRef:{kind:"job",jobId:r.job_id},label:`Job ${r.job_id.slice(0,8)}`,origin:"/deployments"}),t?e.jsx(p,{recordRef:{kind:"modelVersion",jobId:r.job_id,version:String(r.version)},label:`Version ${r.version}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"Version unavailable"}),X(r.dataset_id)?e.jsx("span",{className:"text-slate-400 italic",title:"No target available",children:"No dataset available"}):e.jsx(p,{recordRef:{kind:"dataset",datasetId:r.dataset_id},label:"Dataset",origin:"/deployments"}),r.previous_deployment_id!==void 0&&r.previous_deployment_id!==null?e.jsx(p,{recordRef:{kind:"deployment",deploymentId:r.previous_deployment_id},label:`Replaced deployment #${r.previous_deployment_id}`,origin:"/deployments"}):e.jsx("span",{className:"text-slate-400 italic",children:"No prior deployment"})]})},re=()=>{const[r]=G(),[t,P]=s.useState(null),[m,V]=s.useState([]),[n,f]=s.useState(!1),[k,N]=s.useState(null),[w,_]=s.useState(!1),[R,D]=s.useState(null),[$,I]=s.useState(null),[b,S]=s.useState(null),E=K(),o=s.useCallback(async()=>{f(!0),N(null);try{const[a,l]=await Promise.all([h.getActive(),h.getHistory(50,0)]);P(a),V(l)}catch(a){console.error("Failed to load deployments",a),N("Failed to load deployment data.")}finally{f(!1)}},[]);s.useEffect(()=>{o()},[o]);const d=s.useMemo(()=>Q(r),[r]),c=(d==null?void 0:d.ref.kind)==="deployment"?d.ref.deploymentId:null,x=(d==null?void 0:d.ref.kind)==="modelVersion"?d.ref.jobId:null,j=s.useRef(null),y=s.useCallback(a=>c!==null&&a.id===c||x!==null&&a.job_id===x,[c,x]);s.useEffect(()=>{var a;c===null&&x===null||n||(a=j.current)==null||a.scrollIntoView({block:"center",behavior:"smooth"})},[c,x,n,m,t]);const H=async()=>{!t||!await E({title:"Deactivate deployment?",message:`Deactivate ${i(t)}? It will no longer serve predictions.`,confirmLabel:"Deactivate",variant:"danger"})||await A(t)},A=async a=>{I(null),_(!0);try{await h.deactivate(),await o(),u.success("Deployment deactivated",i(a))}catch(l){console.error("Failed to deactivate",l);const g=l.message||"Failed to deactivate deployment.";I(g),u.error(`Failed to deactivate ${i(a)}`,g)}finally{_(!1)}},J=async a=>{await E({title:"Redeploy model?",message:`Redeploy ${i(a)}? This will replace the currently active deployment${t?` (${i(t)})`:""}.`,confirmLabel:"Redeploy"})&&await L(a)},L=async a=>{S(null),D(a.job_id);try{await h.deployModel(a.job_id),await o(),u.success("Model redeployed",i(a))}catch(l){console.error("Failed to redeploy",l);const g=l.message||"Failed to redeploy model.";S({jobId:a.job_id,message:g}),u.error(`Failed to redeploy ${i(a)}`,g)}finally{D(null)}},B=()=>t?e.jsxs("div",{ref:y(t)?j:null,className:`bg-white dark:bg-gray-800 rounded-xl border shadow-sm overflow-hidden ${y(t)?"border-blue-400 dark:border-blue-500 ring-2 ring-blue-200 dark:ring-blue-900":"border-green-200 dark:border-green-900"}`,children:[e.jsxs("div",{className:"p-6 border-b border-gray-100 dark:border-gray-700 flex justify-between items-start",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(q,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t.model_type}),e.jsxs("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 text-xs font-medium rounded-full flex items-center gap-1",children:[e.jsx(z,{className:"w-3 h-3"})," Active"]})]}),e.jsx("div",{className:"mt-1",children:e.jsx(M,{deployment:t})}),e.jsxs("p",{className:"text-xs text-gray-400 mt-2",children:["Deployed: ",new Date(t.created_at).toLocaleString()]})]})]}),e.jsxs("button",{onClick:()=>{H()},disabled:w,className:"flex items-center gap-2 px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 dark:bg-red-900/20 dark:hover:bg-red-900/30 dark:text-red-400 rounded-lg transition-colors text-sm font-medium disabled:opacity-50",children:[w?e.jsx("div",{className:"w-4 h-4 border-2 border-red-600 border-t-transparent rounded-full animate-spin"}):e.jsx(C,{className:"w-4 h-4"}),"Deactivate"]})]}),$&&e.jsx("div",{className:"border-b border-gray-100 dark:border-gray-700",children:e.jsx(v,{error:`Failed to deactivate ${i(t)}: ${$}`,onRetry:()=>A(t)})}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 text-xs font-mono text-gray-500 dark:text-gray-400 break-all",children:["Artifact URI: ",t.artifact_uri]})]}):n?e.jsx(F,{message:"Loading active deployment..."}):e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl border border-dashed border-gray-300 dark:border-gray-700 p-8 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mx-auto mb-3",children:e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("h3",{className:"text-gray-900 dark:text-gray-100 font-medium",children:"No Active Model"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Deploy a model from the Experiments page to see it here."})]});return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 overflow-hidden",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 p-6 flex justify-between items-center shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100",children:"Model Deployments"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Manage active models and view deployment history"})]}),e.jsx("button",{onClick:()=>{o()},className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-500 transition-colors",title:"Refresh","aria-label":"Refresh deployments",children:e.jsx(T,{className:`w-5 h-5 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-8",children:[k&&e.jsx(v,{error:k,onRetry:()=>o()}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-green-500"}),"Active Deployment"]}),B()]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-lg font-medium text-gray-800 dark:text-gray-200 mb-4 flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-blue-500"}),"Deployment History"]}),b&&e.jsx("div",{className:"mb-4",children:e.jsx(v,{error:`Failed to redeploy job ${b.jobId}: ${b.message}`,onRetry:()=>{const a=m.find(l=>l.job_id===b.jobId);return a?L(a):void 0}})}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3",children:"Status"}),e.jsx("th",{className:"px-6 py-3",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3",children:"Lineage"}),e.jsx("th",{className:"px-6 py-3",children:"Deployed At"}),e.jsx("th",{className:"px-6 py-3 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:m.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:n?e.jsx(F,{message:"Loading deployment history..."}):e.jsx(W,{title:"No deployment history found."})})}):m.map(a=>e.jsxs("tr",{ref:y(a)?j:null,className:`hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${y(a)?"bg-blue-50 dark:bg-blue-900/20 ring-1 ring-inset ring-blue-300 dark:ring-blue-700":""}`,children:[e.jsx("td",{className:"px-6 py-4",children:a.is_active?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),"Active"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),"Inactive"]})}),e.jsx("td",{className:"px-6 py-4 font-medium text-gray-900 dark:text-gray-100",children:a.model_type}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(M,{deployment:a})}),e.jsx("td",{className:"px-6 py-4 text-gray-500 dark:text-gray-400",children:new Date(a.created_at).toLocaleString()}),e.jsx("td",{className:"px-6 py-4 text-right",children:!a.is_active&&e.jsx("button",{onClick:()=>{J(a)},disabled:R===a.job_id,"aria-label":`Redeploy ${i(a)}`,className:"text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 font-medium text-xs disabled:opacity-50",children:R===a.job_id?"Redeploying...":"Redeploy"})})]},a.id))})]})})})]})]})]})};export{re as DeploymentsPage}; diff --git a/static/ml_canvas/assets/EDAPage-BcPZlmKw.js b/static/ml_canvas/assets/EDAPage-viLu1lUt.js similarity index 99% rename from static/ml_canvas/assets/EDAPage-BcPZlmKw.js rename to static/ml_canvas/assets/EDAPage-viLu1lUt.js index 33b29f2d0..5015f2e3b 100644 --- a/static/ml_canvas/assets/EDAPage-BcPZlmKw.js +++ b/static/ml_canvas/assets/EDAPage-viLu1lUt.js @@ -1,4 +1,4 @@ -import{j as i,u as er,a as tr,P as vt,i as ir,B as sr,C as nr,M as os,H as Rn}from"./vendor-flow-Ct2sLZk5.js";import{af as pt,a as k,ad as rr,ag as ar,D as be,c as qt,E as lo,l as bi,ah as co,ai as ys,aj as ho,ak as uo,H as mo,al as fo,C as ls,am as go,an as or,ao as Ut,e as lr,f as bt,a9 as dr,ab as po,o as cr,_ as vs,p as wi,X as hr,q as bs,ap as xo,aq as _o,ar as yo,a3 as ur,as as mr,a4 as fr,a5 as yt,j as _i,at as vo,au as Zt,av as wt,aw as ds,ax as bo,ay as cs,k as gr,az as pr,a6 as jt,g as xr,K as ke,B as _r,b as $t,aa as Ht,R as wo,aA as ws,S as jo,aB as ko,h as No}from"./vendor-utils-VkF_O5b_.js";import{r as Co,g as yr,i as vr,f as ns,D as Lo,u as Po,t as Wt,a as So,M as To,S as br,s as ji,w as at,x as We,I as _e,C as ki,b as Kt,y as wr,z as Eo,B as Mo,F as Ao,G as yi,T as jr,H as hs,J as us,K as ms,O as zo,L as Io,E as Oo}from"./index-C87GWrUj.js";import{R as De,aj as Do,ak as Ro,j as js,T as He,ah as kr,al as Fo,am as Bo,an as Zo,ao as $o,ap as Ho,aq as Wo,ar as Vo,r as qo,B as nt,C as Ye,X as Xe,Y as Qe,as as Nr,h as Ve,at as Uo,au as rs,ag as Ko,ai as Fn,av as Cr}from"./vendor-charts-BkHP8M8k.js";import{F as as}from"./FormField-BaO1-ftW.js";import{r as Go,a as Yo}from"./vendor-plotly-EQ6XkBLq.js";const xt="/api/eda",qe={analyze:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/analyze`,{target_col:l,exclude_cols:a,filters:d,task_type:h})).data,getLatestReport:async n=>(await pt.get(`${xt}/${n}/latest`)).data,getReport:async n=>(await pt.get(`${xt}/reports/${n}`)).data,cancelJob:async n=>(await pt.post(`${xt}/reports/${n}/cancel`)).data,getHistory:async n=>(await pt.get(`${xt}/${n}/history`)).data,getDecomposition:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/decomposition`,{measure_col:l,measure_agg:a,split_col:d,filters:h})).data},Bn={x:"",y:"",z:"",color:"",is3D:!1,isPCA3D:!1},Zn=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,Xo=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>Zn(a)===Zn(l[d])),te=Co((n,l)=>({activeTab:"dashboard",selectedDataset:null,targetCol:"",taskType:"",excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],scatter:{...Bn},setActiveTab:a=>n({activeTab:a}),setSelectedDataset:a=>n({selectedDataset:a}),setTargetCol:a=>n({targetCol:a}),setTaskType:a=>n({taskType:a}),toggleExclude:(a,d)=>n(h=>{const u=h.excludedColsDraft.includes(a);return d?u?h:{excludedColsDraft:[...h.excludedColsDraft,a]}:u?{excludedColsDraft:h.excludedColsDraft.filter(m=>m!==a)}:h}),setExcludedDraft:a=>n({excludedColsDraft:a}),setExcludedApplied:a=>n({excludedColsApplied:a}),applyExcluded:()=>n({excludedColsApplied:[...l().excludedColsDraft]}),addFilterDraft:a=>n(d=>({filtersDraft:[...d.filtersDraft,a]})),removeFilterDraft:a=>n(d=>({filtersDraft:d.filtersDraft.filter((h,u)=>u!==a)})),clearFiltersDraft:()=>n({filtersDraft:[]}),setFiltersDraft:a=>n({filtersDraft:a}),setFiltersApplied:a=>n({filtersApplied:a}),applyFilters:()=>n(a=>({filtersApplied:[...a.filtersDraft]})),setScatter:a=>n(d=>({scatter:{...d.scatter,...a}})),resetForDataset:()=>n({excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],targetCol:"",activeTab:"dashboard",scatter:{...Bn}})})),Qo=n=>{if(n.excludedColsApplied.length!==n.excludedColsDraft.length)return!0;const l=new Set(n.excludedColsApplied);for(const a of n.excludedColsDraft)if(!l.has(a))return!0;return!1},Jo=n=>!Xo(n.filtersDraft,n.filtersApplied),Ee={datasets:["eda","datasets"],report:n=>["eda","report",n],history:n=>["eda","history",n],reportById:n=>["eda","reportById",n]},el=n=>{const l=yr();return vr({mutationFn:a=>qe.cancelJob(a),onSuccess:()=>{l.invalidateQueries({queryKey:Ee.history(n)}),l.invalidateQueries({queryKey:Ee.report(n)})}})};function fs(n){if(n==null)return null;const l=n.trim();if(!/^\d+$/.test(l))return null;const a=Number(l);return a>0?a:null}function tl(n,l,a){const d=fs(n);if(d!==null)return d;if(l!==null)return l;const h=a[0];return h===void 0?null:fs(String(h.id))}function il(n,l,a){return n===null||!a?!1:!l.some(d=>Number(d.id)===n)}function sl(n,l){return l===null?!1:fs(n)===null}function nl(n){return n.name.trim()||`Dataset ${n.id}`}function rl(n){const l=String(n.id);return l.length<=6?l:l.slice(-6)}function al(n){const l=n.map(d=>nl(d)),a=new Map;for(const d of l)a.set(d,(a.get(d)??0)+1);return n.map((d,h)=>{const u=l[h];return(a.get(u)??0)>1?{value:d.id,label:`${u} (${rl(d)})`}:{value:d.id,label:u}})}function ol(n){const l=ns({queryKey:Ee.datasets,queryFn:()=>Lo.getUsable()}),a=k.useMemo(()=>l.data??[],[l.data]),d=k.useMemo(()=>al(a),[a]),h=ns({queryKey:Ee.report(n??null),queryFn:async()=>{var y;try{return await qe.getLatestReport(n)}catch(b){if(((y=b==null?void 0:b.response)==null?void 0:y.status)===404)return null;throw b}},enabled:n!=null,refetchInterval:y=>{const b=y.state.data;return b&&b.status==="PENDING"?3e3:!1}}),u=h.data??null,m=h.isLoading,p=h.isError?"Failed to load report":null,w=ns({queryKey:Ee.history(n??null),queryFn:()=>qe.getHistory(n),enabled:n!=null,refetchInterval:(u==null?void 0:u.status)==="PENDING"?3e3:!1}).data??[];return{datasetsQuery:l,datasets:a,datasetOptions:d,reportQuery:h,report:u,loading:m,error:p,history:w}}function ll(){const[n,l]=Po(),a=yr(),[d,h]=k.useState(!1),[u,m]=k.useState(!1),[p,g]=k.useState(!1),w=k.useRef(!1),y=te(E=>E.activeTab),b=te(E=>E.setActiveTab),x=te(E=>E.selectedDataset),N=te(E=>E.setSelectedDataset),P=te(E=>E.targetCol),j=te(E=>E.setTargetCol),M=te(E=>E.taskType),D=te(E=>E.setTaskType),S=te(E=>E.excludedColsDraft),G=te(E=>E.excludedColsApplied),fe=te(E=>E.filtersDraft),le=te(E=>E.filtersApplied),ne=te(E=>E.scatter),we=te(E=>E.setScatter),A=te(Qo),I=te(Jo),{datasetsQuery:V,datasets:B,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge}=ol(x),O=vr({mutationFn:E=>qe.analyze(x,P||void 0,E.excluded,E.filters,M||void 0),onSuccess:()=>{a.invalidateQueries({queryKey:Ee.report(x??null)}),a.invalidateQueries({queryKey:Ee.history(x??null)})},onSettled:()=>{w.current=!1,g(!1)}}),ce=O.isPending||p,z=n.get("dataset_id");k.useEffect(()=>{const E=tl(z,x,B);E!==x&&N(E)},[z,B,x,N]),k.useEffect(()=>{if(!sl(z,x))return;const E=new URLSearchParams(n);E.set("dataset_id",String(x)),l(E,{replace:!0})},[z,x,n,l]);const q=il(x,B,V.isSuccess);k.useEffect(()=>{te.getState().resetForDataset()},[x]);const ee=k.useMemo(()=>{const E=Z==null?void 0:Z.profile_data;if(!E)return null;const ye=new Set(S),Ue={};return E.columns&&Object.entries(E.columns).forEach(([Re,Xt])=>{ye.has(Re)||(Ue[Re]=Xt)}),{...E,columns:Ue,excluded_columns:S}},[Z==null?void 0:Z.profile_data,S]),oe=(E,ye)=>{if(!x)return;const Ue=Array.isArray(E)?E:G,Re=Array.isArray(ye)?ye:le;O.mutate({excluded:Ue,filters:Re})},se=async E=>{if(x){m(!0);try{const ye=await a.fetchQuery({queryKey:Ee.reportById(E),queryFn:()=>qe.getReport(E)});a.setQueryData(Ee.report(x),ye)}catch(ye){Wt.error("Failed to load report",String(ye))}finally{m(!1)}}},J=(E,ye,Ue)=>{const Re={column:E,operator:Ue||"==",value:ye};te.getState().addFilterDraft(Re)},K=E=>{te.getState().removeFilterDraft(E)},Pe=()=>{te.getState().setFiltersDraft(le)},Me=()=>{if(w.current||ce)return;w.current=!0,g(!0);const E=te.getState().filtersDraft;te.getState().applyFilters(),oe(void 0,E)},Yt=(E,ye)=>{te.getState().toggleExclude(E,ye)},kt=()=>{const E=te.getState().excludedColsDraft;te.getState().applyExcluded(),oe(E)};k.useEffect(()=>{if(Z&&Z.profile_data){Z.profile_data.target_col&&j(Z.profile_data.target_col);const E=Array.isArray(Z.profile_data.excluded_columns)?Z.profile_data.excluded_columns:[];te.getState().setExcludedApplied(E),te.getState().setExcludedDraft(E)}},[Z==null?void 0:Z.id]);const Nt=P?ge.find(E=>E.target_col===P&&E.status==="COMPLETED"):null;return{searchParams:n,setSearchParams:l,queryClient:a,showHistoryModal:d,setShowHistoryModal:h,isLoadingReport:u,activeTab:y,setActiveTab:b,selectedDataset:x,targetCol:P,setTargetCol:j,taskType:M,setTaskType:D,excludedColsDraft:S,filtersDraft:fe,filtersApplied:le,scatter:ne,setScatter:we,excludedDirty:A,filtersDirty:I,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge,analyzeMutation:O,analyzing:ce,selectionUnavailable:q,profileForUi:ee,runAnalysis:oe,loadSpecificReport:se,handleAddFilter:J,handleRemoveFilter:K,handleResetFilters:Pe,handleApplyFilters:Me,handleToggleExclude:Yt,handleApplyExcluded:kt,existingReport:Nt}}function dl(n){return i.jsx(i.Fragment,{children:i.jsxs("header",{className:"flex-none bg-white dark:bg-slate-900 border-b border-gray-200 dark:border-gray-800 px-4 py-2 flex flex-wrap items-center justify-between gap-3 z-20 shadow-sm lg:h-16 lg:flex-nowrap lg:py-0 lg:gap-4",children:[i.jsx(cl,{...n}),i.jsx(hl,{...n}),i.jsx(fl,{...n})]})})}function cl(n){const{report:l,selectionUnavailable:a,selectedDataset:d,searchParams:h,setSearchParams:u,datasetOptions:m}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-4 lg:gap-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white leading-tight",children:"Exploratory Analysis"}),l&&l.created_at&&i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Last analyzed: ",new Date(l.created_at).toLocaleString()]})]}),i.jsx("div",{className:"h-8 w-px bg-gray-200 dark:bg-gray-700 mx-2"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{htmlFor:"eda-toolbar-dataset",className:"text-[10px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Dataset"}),i.jsxs("select",{id:"eda-toolbar-dataset",value:a?"":d||"",onChange:p=>{const g=new URLSearchParams(h);g.set("dataset_id",p.target.value),u(g)},className:"block w-48 text-sm font-medium bg-transparent border-none p-0 focus:ring-0 text-gray-900 dark:text-white cursor-pointer hover:text-blue-600",children:[i.jsx("option",{value:"",disabled:!0,children:"Select a dataset"}),m.map(p=>i.jsx("option",{value:p.value,children:p.label},p.value))]})]})]})})}function hl(n){const{taskType:l,setTaskType:a,report:d}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-50 dark:bg-gray-800/50 p-1.5 rounded-lg border border-gray-200 dark:border-gray-700 lg:flex-nowrap lg:gap-4",children:[i.jsx(ul,{...n}),i.jsx("div",{className:"w-px h-8 bg-gray-200 dark:bg-gray-700"}),i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{htmlFor:"eda-toolbar-task-type",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Task Type"}),i.jsxs("div",{className:"group relative",children:[i.jsx(ar,{className:"w-3 h-3 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute bottom-full mb-2 w-56 p-2 bg-slate-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none left-1/2 -translate-x-1/2",children:"Force Classification or Regression."})]})]}),i.jsxs("select",{id:"eda-toolbar-task-type",value:l,onChange:h=>a(h.target.value),disabled:!d||!d.profile_data,className:"block w-28 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"Auto"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]})]}),i.jsx(ml,{...n})]})})}function ul(n){const{targetCol:l,setTargetCol:a,report:d,excludedColsDraft:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsx("label",{htmlFor:"eda-toolbar-target-column",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Target Column"}),i.jsxs("select",{id:"eda-toolbar-target-column",value:l,onChange:u=>a(u.target.value),disabled:!d||!d.profile_data,className:"block w-36 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"None"}),d&&d.profile_data&&Object.keys(d.profile_data.columns).filter(u=>!h.includes(u)).map(u=>i.jsx("option",{value:u,children:u},u))]})]})})}function ml(n){const{selectedDataset:l,runAnalysis:a,analyzing:d,existingReport:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("button",{onClick:()=>l&&a(),disabled:!l||d,className:`ml-2 px-3 py-1.5 rounded text-sm font-medium transition-colors flex items-center shadow-sm ${h?"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 hover:bg-gray-50":"action-primary border border-transparent"}`,children:[d?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(bi,{className:"w-4 h-4 mr-2"}),h?"Re-Run":"Analyze"]})})}function fl(n){const{existingReport:l,report:a,loadSpecificReport:d,isLoadingReport:h,setShowHistoryModal:u}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[l&&a&&a.id!==l.id&&i.jsxs("button",{onClick:()=>d(l.id),disabled:h,className:"flex items-center px-3 py-1.5 text-xs bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 rounded-md hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:`Load existing from ${new Date(l.created_at).toLocaleString()}`,children:[h?i.jsx(be,{className:"w-3 h-3 mr-1 animate-spin"}):i.jsx(qt,{className:"w-3 h-3 mr-1"}),"Load Saved"]}),i.jsxs("button",{onClick:()=>u(!0),className:"flex items-center px-3 py-1.5 text-sm font-medium text-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[i.jsx(lo,{className:"w-4 h-4 mr-2"}),"History"]})]})})}function gl(n){const{history:l,report:a,loadSpecificReport:d,isLoadingReport:h}=n;return i.jsx(i.Fragment,{children:l.length>0&&i.jsxs("div",{className:"flex-none bg-white dark:bg-slate-950 border-b border-gray-100 dark:border-gray-800 px-4 py-1.5 flex items-center gap-3 overflow-x-auto z-10 shadow-[0_2px_3px_-1px_rgba(0,0,0,0.02)]",children:[i.jsx("span",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider whitespace-nowrap",children:"Recent Targets:"}),i.jsx("div",{className:"flex gap-2",children:Array.from(new Set(l.filter(u=>u.target_col&&u.status==="COMPLETED").map(u=>u.target_col))).slice(0,8).map(u=>{var m;return i.jsxs("button",{onClick:()=>{const p=l.find(g=>g.target_col===u&&g.status==="COMPLETED");p&&d(p.id)},disabled:h,className:`px-2 py-0.5 text-xs rounded-full border transition-colors flex items-center disabled:opacity-50 disabled:cursor-not-allowed ${((m=a==null?void 0:a.profile_data)==null?void 0:m.target_col)===u?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 font-medium":"bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-200"}`,children:[i.jsx(rr,{className:"w-3 h-3 mr-1"}),u]},u)})})]})})}const pl={Numeric:{badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",iconColorClass:"text-blue-500",Icon:mo},Categorical:{badgeClass:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",iconColorClass:"text-purple-500",Icon:uo},Boolean:{badgeClass:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",iconColorClass:"text-amber-500",Icon:ho},DateTime:{badgeClass:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",iconColorClass:"text-teal-500",Icon:ys},Text:{badgeClass:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-300",iconColorClass:"text-slate-500",Icon:co}},xl={badgeClass:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",iconColorClass:"text-gray-500",Icon:fo};function ks(n){return pl[n]??xl}function _l(n){return ks(n).badgeClass}function yl(n){return ks(n).iconColorClass}function vl(n){return ks(n).Icon}const bl=({isOpen:n,onClose:l,history:a,datasetId:d,onSelect:h,onFetchReport:u,onRefresh:m})=>{const[p,g]=k.useState(null),[w,y]=k.useState(!1),b=k.useRef(0),x=el(d),N=x.isPending?x.variables??null:null,P=So(),j=()=>{g(null),l()},M=async(S,G)=>{if(S.stopPropagation(),!!await P({title:"Cancel analysis?",message:"Are you sure you want to cancel this analysis?",confirmLabel:"Cancel job",variant:"danger"}))try{await x.mutateAsync(G),m&&m()}catch(le){console.error("Failed to cancel job",le),Wt.error("Failed to cancel job")}},D=async S=>{const G=++b.current;y(!0);try{const fe=await u(S.id);if(G!==b.current)return;g(fe)}catch(fe){console.error("Failed to load report details",fe),G===b.current&&Wt.error("Failed to load job details","Please try again.")}finally{G===b.current&&y(!1)}};return i.jsx(To,{isOpen:n,onClose:j,size:p?"5xl":"2xl",title:i.jsxs("div",{className:"flex items-center gap-3",children:[p?i.jsx("button",{onClick:()=>g(null),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":"Back to history",children:i.jsx(go,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})}):i.jsx(ls,{className:"w-5 h-5 text-blue-500"}),i.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:p?`Analysis #${p.id} Details`:"Analysis History"})]}),footer:p?i.jsx("div",{className:"flex justify-end",children:i.jsxs("button",{onClick:()=>{h(p),j()},className:"flex items-center px-4 py-2 action-primary rounded-md transition-colors shadow-sm",children:[i.jsx(bi,{className:"w-4 h-4 mr-2"}),"Load this Report"]})}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center w-full",children:"Select a previous analysis to view details."}),children:i.jsx("div",{className:"p-6",children:p?w?i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[i.jsx(be,{className:"w-12 h-12 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Loading analysis details..."})]}):i.jsx(kl,{selectedJob:p}):a.length===0?i.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[i.jsx(ls,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),i.jsx("p",{children:"No history available for this dataset."})]}):i.jsx("div",{className:"space-y-3",children:a.map(S=>i.jsx(wl,{job:S,handleJobClick:D,cancelling:N,handleCancel:M},S.id))})})})};function wl({job:n,handleJobClick:l,cancelling:a,handleCancel:d}){return i.jsxs("div",{...ji(()=>l(n)),className:"flex items-center justify-between p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer transition-all group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(jl,{status:n.status}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 flex items-center gap-2",children:["Analysis #",n.id,i.jsx(br,{status:n.status??"unknown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:n.created_at?new Date(n.created_at).toLocaleString():"β€”"}),n.target_col&&i.jsxs("div",{className:"text-xs text-gray-400 mt-1 flex items-center gap-1",children:[i.jsx(bi,{className:"w-3 h-3"})," Target: ",n.target_col,n.task_type&&i.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 rounded text-[10px]",children:n.task_type})]})]})]}),i.jsx("div",{className:"text-right flex items-center gap-4",children:(n.status==="PENDING"||n.status==="STARTED"||n.status==="RUNNING")&&i.jsx("button",{onClick:h=>d(h,n.id),disabled:a===n.id,className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full transition-colors",title:"Cancel Analysis",children:a===n.id?i.jsx(be,{className:"w-4 h-4 animate-spin"}):i.jsx(or,{className:"w-4 h-4"})})})]})}function jl({status:n}){return i.jsx("div",{className:`p-2 rounded-full ${n==="COMPLETED"?"bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400":n==="FAILED"?"bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400":n==="CANCELLED"?"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400":"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:n==="COMPLETED"?i.jsx(lr,{className:"w-5 h-5"}):n==="FAILED"?i.jsx(bt,{className:"w-5 h-5"}):n==="CANCELLED"?i.jsx(or,{className:"w-5 h-5"}):i.jsx(be,{className:"w-5 h-5 animate-spin"})})}function kl({selectedJob:n}){var l,a;return i.jsxs("div",{className:"space-y-8",children:[i.jsx(Nl,{selectedJob:n}),((l=n.profile_data)==null?void 0:l.excluded_columns)&&n.profile_data.excluded_columns.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[i.jsx(Ut,{className:"w-4 h-4 text-gray-500"}),"Excluded Columns (",n.profile_data.excluded_columns.length,")"]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:n.profile_data.excluded_columns.map(d=>i.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded text-sm line-through",children:d},d))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Variables Overview"}),i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm text-left",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Missing"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Distinct"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:((a=n.profile_data)==null?void 0:a.columns)&&Object.values(n.profile_data.columns).map(d=>{var u;const h=vl(d.dtype);return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("td",{className:"px-4 py-3 font-medium text-gray-900 dark:text-white",children:d.name}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:`w-4 h-4 ${yl(d.dtype)}`}),i.jsx("span",{children:d.dtype})]})}),i.jsx("td",{className:"px-4 py-3",children:d.missing_percentage>0?i.jsxs("span",{className:"text-amber-600",children:[d.missing_percentage.toFixed(1),"%"]}):i.jsx("span",{className:"text-green-600",children:"0%"})}),i.jsx("td",{className:"px-4 py-3 text-gray-500 dark:text-gray-400",children:((u=d.categorical_stats)==null?void 0:u.unique_count)||"-"})]},d.name)})})]})})]})]})}function Nl({selectedJob:n}){var l,a,d,h,u,m;return i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(dr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Rows"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((a=(l=n.profile_data)==null?void 0:l.row_count)==null?void 0:a.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(po,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Columns"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((h=(d=n.profile_data)==null?void 0:d.column_count)==null?void 0:h.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(cr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Missing Cells"})]}),i.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[(m=(u=n.profile_data)==null?void 0:u.missing_cells_percentage)==null?void 0:m.toFixed(1),"%"]})]})]})}function Cl(n){const{selectionUnavailable:l,selectedDataset:a,analyzeMutation:d,analyzing:h,runAnalysis:u}=n;return i.jsxs(i.Fragment,{children:[l&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Dataset #",a," isn't available for analysis β€” it may still be processing or have no usable columns. Pick another dataset above to continue."]})]}),d.isError&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Could not start the analysis: ",d.error instanceof Error?d.error.message:"the request was rejected."," ","Your dataset, target, and filter choices were kept."]}),i.jsxs("button",{onClick:()=>{const m=d.variables;u(m==null?void 0:m.excluded,m==null?void 0:m.filters)},disabled:h,className:"flex items-center rounded-md border border-red-300 px-3 py-1.5 font-medium hover:bg-red-100 disabled:opacity-50 dark:border-red-800 dark:hover:bg-red-900/40",children:[i.jsx(qt,{className:"mr-2 h-4 w-4"}),"Try again"]}),i.jsx("button",{onClick:()=>d.reset(),className:"rounded-md px-2 py-1.5 font-medium underline hover:no-underline",children:"Dismiss"})]})]})}function Ll(n){const{showHistoryModal:l,setShowHistoryModal:a,history:d,selectedDataset:h,queryClient:u}=n;return i.jsx(i.Fragment,{children:i.jsx(bl,{isOpen:l,onClose:()=>a(!1),history:d,datasetId:h??null,onRefresh:()=>u.invalidateQueries({queryKey:Ee.history(h??null)}),onFetchReport:async m=>{const p=await qe.getReport(m);return{...p,id:p.id??m}},onSelect:m=>{var g;h&&u.setQueryData(Ee.report(h),m);const p=Array.isArray((g=m.profile_data)==null?void 0:g.excluded_columns)?m.profile_data.excluded_columns:[];te.getState().setExcludedApplied(p),te.getState().setExcludedDraft(p)}})})}function Pl(n,l,a,d){return l?a&&!d?`${n===">"?"Greater than":n==="<"?"Less than":n===">="?"Greater than or equal to":"Less than or equal to"} needs a numeric value`:"":"Enter a filter value"}function Sl(n,l,a){const d=[">","<",">=","<="].includes(l),h=n.trim().length>0,u=l.trim().length>0,m=a.trim().length>0,p=Number.isFinite(Number(a)),g=Pl(l,m,d,p);return{hasFilterColumn:h,hasFilterOperator:u,hasFilterValue:m,isComparisonOperator:d,currentFilterValueError:g}}function Tl(n){const[l,a]=k.useState(!1),[d,h]=k.useState(""),[u,m]=k.useState("=="),[p,g]=k.useState(""),[w,y]=k.useState(!1),{hasFilterColumn:b,hasFilterOperator:x,hasFilterValue:N,isComparisonOperator:P,currentFilterValueError:j}=Sl(d,u,p);return{isAddingFilter:l,setIsAddingFilter:a,newFilterCol:d,setNewFilterCol:h,newFilterOp:u,setNewFilterOp:m,newFilterVal:p,setNewFilterVal:g,filterValidationAttempted:w,setFilterValidationAttempted:y,columnError:w&&!b?"Choose a filter column":"",operatorError:w&&!x?"Choose a filter operator":"",valueError:w&&j?j:"",handleAddFilterSubmit:()=>{y(!0),!(!b||!x||!N||j)&&(n(d,P?Number(p):Number.isNaN(Number(p))?p:Number(p),u),a(!1),y(!1),h(""),m("=="),g(""))}}}const $n=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,El=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>$n(a)===$n(l[d]));function Ml({filtersDraft:n,filtersApplied:l,filtersDirty:a,columns:d,analyzing:h,onRemoveFilter:u,onResetFilters:m,onApplyFilters:p,showFilters:g,setShowFilters:w,form:y}){const b=a||!El(n,l);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between w-full mb-2",children:[i.jsxs("button",{onClick:()=>w(!g),className:"flex items-center text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Draft Filters (",n.length,")"]}),g?i.jsx(vs,{className:"w-3 h-3 ml-1"}):i.jsx(wi,{className:"w-3 h-3 ml-1"})]}),a&&i.jsx("span",{className:"text-[10px] font-medium rounded-full bg-amber-100 text-amber-800 px-2 py-0.5",children:"Pending"})]}),g&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Report uses ",l.length," applied filter",l.length===1?"":"s"," until you apply draft changes."]}),i.jsx(Al,{filtersDraft:n,filtersDirty:a,analyzing:h,onRemoveFilter:u}),i.jsx(zl,{form:y,columns:d}),i.jsx(Il,{disabled:!b||h,onResetFilters:m,onApplyFilters:p})]})]})}function Al({filtersDraft:n,filtersDirty:l,analyzing:a,onRemoveFilter:d}){return i.jsx(i.Fragment,{children:n.length>0?n.map((h,u)=>i.jsxs("div",{className:`flex items-center justify-between rounded px-2 py-1 text-xs border ${l?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700"}`,children:[i.jsxs("div",{className:"truncate max-w-[140px]",children:[i.jsx("span",{className:"font-medium text-blue-700 dark:text-blue-300",children:h.column}),i.jsx("span",{className:"mx-1 text-gray-500 dark:text-gray-400",children:h.operator}),i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:String(h.value)})]}),i.jsx("button",{onClick:()=>d(u),className:"text-gray-500 dark:text-gray-400 hover:text-red-500","aria-label":`Remove filter ${u+1}`,disabled:a,children:i.jsx(hr,{className:"w-3 h-3"})})]},u)):i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No draft filters yet."})})}function zl({form:n,columns:l}){const{isAddingFilter:a,setIsAddingFilter:d,newFilterCol:h,setNewFilterCol:u,newFilterOp:m,setNewFilterOp:p,newFilterVal:g,setNewFilterVal:w,filterValidationAttempted:y,setFilterValidationAttempted:b,columnError:x,operatorError:N,valueError:P,handleAddFilterSubmit:j}=n;return i.jsx(i.Fragment,{children:a?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsx(as,{label:"Filter column",hideLabel:!0,required:!0,...y?{error:x}:{},children:M=>i.jsxs("select",{...M,value:h,onChange:D=>u(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"",disabled:!0,children:"Column"}),l.map(D=>i.jsx("option",{value:D,children:D},D))]})}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(as,{label:"Filter operator",hideLabel:!0,required:!0,className:"w-1/3",...y?{error:N}:{},children:M=>i.jsxs("select",{...M,value:m,onChange:D=>p(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"==",children:"=="}),i.jsx("option",{value:"!=",children:"!="}),i.jsx("option",{value:">",children:">"}),i.jsx("option",{value:"<",children:"<"}),i.jsx("option",{value:">=",children:">="}),i.jsx("option",{value:"<=",children:"<="})]})}),i.jsx(as,{label:"Filter value",hideLabel:!0,required:!0,className:"w-2/3",...y?{error:P}:{},children:M=>i.jsx("input",{...M,type:"text",value:g,onChange:D=>w(D.target.value),placeholder:"Value",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onKeyDown:D=>D.key==="Enter"&&j()})})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{onClick:()=>{d(!1),b(!1),u(""),p("=="),w("")},className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Cancel"}),i.jsx("button",{onClick:j,className:"text-xs bg-blue-600 text-white px-2 py-1 rounded hover:bg-blue-700",children:"Save draft"})]})]}):i.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-blue-600 hover:border-blue-300 transition-colors",children:[i.jsx(bs,{className:"w-3 h-3 mr-1"})," Add Filter"]})})}function Il({disabled:n,onResetFilters:l,onApplyFilters:a}){return i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.jsx("button",{onClick:l,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-white dark:bg-gray-900 text-gray-600 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:"Reset filters"}),i.jsx("button",{onClick:a,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-blue-600 text-white border-blue-700 hover:bg-blue-700"}`,children:"Apply filters"})]})}function Ol({columns:n,excludedCols:l,excludedDirty:a,analyzing:d,onToggleExclude:h,onApplyExcluded:u,showExclusions:m,setShowExclusions:p,isAddingExclusion:g,setIsAddingExclusion:w}){return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>p(!m),className:"flex items-center justify-between w-full text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Excluded (",l.length,")"]}),m?i.jsx(vs,{className:"w-3 h-3"}):i.jsx(wi,{className:"w-3 h-3"})]}),m&&i.jsxs("div",{className:"space-y-2",children:[l.map((y,b)=>i.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-xs",children:[i.jsx("span",{className:"font-medium text-gray-500 dark:text-gray-400 line-through truncate max-w-[140px]",children:y}),i.jsx("button",{onClick:()=>h(y,!1),className:"text-gray-500 dark:text-gray-400 hover:text-green-500",title:"Include back",children:i.jsx(bs,{className:"w-3 h-3"})})]},b)),i.jsx(Dl,{onApplyExcluded:u,excludedDirty:a,analyzing:d}),g?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsxs("select",{"aria-label":"Column to exclude from analysis",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onChange:y=>{y.target.value&&(h(y.target.value,!0),w(!1))},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"Select Column"}),n.filter(y=>!l.includes(y)).map(y=>i.jsx("option",{value:y,children:y},y))]}),i.jsx("button",{onClick:()=>w(!1),className:"w-full text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-center",children:"Cancel"})]}):i.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-red-600 hover:border-red-300 transition-colors",children:[i.jsx(Ut,{className:"w-3 h-3 mr-1"})," Exclude Column"]})]})]})}function Dl({onApplyExcluded:n,excludedDirty:l,analyzing:a}){return i.jsx("button",{onClick:n,disabled:!l||a,className:`w-full flex items-center justify-center px-2 py-1 text-xs rounded border transition-colors ${l&&!a?"bg-blue-600 text-white border-blue-700 hover:bg-blue-700":"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed"}`,title:l?"Apply excluded columns to re-run analysis":"No pending exclusion changes",children:"Apply changes"})}function Rl(n){return[{title:"Overview",items:[{id:"dashboard",label:"Dashboard",icon:yo,show:!0},{id:"pii",label:"PII Review",icon:ur,show:!0},{id:"sample",label:"Sample Data",icon:mr,show:!!n.sample_data},{id:"insights",label:"Smart Insights",icon:fr,show:!0}]},{title:"Univariate Analysis",items:[{id:"variables",label:"Variables",icon:yt,show:!0},{id:"outliers",label:"Outliers",icon:_i,show:!!n.outliers},{id:"target",label:"Target Analysis",icon:rr,show:!!(n.target_col&&n.target_correlations)}]},{title:"Multivariate Analysis",items:[{id:"correlations",label:"Correlations",icon:vo,show:!!(n.correlations||n.correlations_with_target||n.causal_target_exclusion_reason)},{id:"bivariate",label:"Bivariate",icon:Zt,show:!0},{id:"pca",label:"PCA & Clusters",icon:wt,show:!!n.pca_data||!!n.clustering}]},{title:"Structure & Causal",items:[{id:"causal",label:"Causal Graph",icon:wt,show:!!(n.causal_graph||n.causal_target_exclusion_reason)},{id:"rules",label:"Decision Tree",icon:ds,show:!!n.rule_tree},{id:"decomposition",label:"Decomposition",icon:bo,show:!0}]},{title:"Specialized",items:[{id:"timeseries",label:"Time Series",icon:ys,show:!!n.timeseries},{id:"geospatial",label:"Geospatial",icon:cs,show:!!n.geospatial}]}]}function Fl({activeTab:n,setActiveTab:l,profile:a,isCollapsed:d,setIsCollapsed:h}){const u=Rl(a);return i.jsxs("div",{className:`flex-1 overflow-y-auto ${d?"p-2":"p-3"}`,children:[i.jsxs("div",{className:`flex items-center ${d?"justify-center":"justify-between"} mb-3`,children:[!d&&i.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Analysis Modules"}),i.jsx("button",{onClick:()=>h(!d),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400",title:d?"Expand Sidebar":"Collapse Sidebar",children:d?i.jsx(xo,{className:"w-4 h-4"}):i.jsx(_o,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"space-y-6",children:u.map((m,p)=>{const g=m.items.filter(w=>w.show);return g.length===0?null:i.jsxs("div",{children:[!d&&i.jsx("h3",{className:"px-2 text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:m.title}),i.jsx("div",{className:"space-y-1",children:g.map(w=>i.jsx(Bl,{item:w,activeTab:n,setActiveTab:l,isCollapsed:d},w.id))})]},p)})})]})}function Bl({item:n,activeTab:l,setActiveTab:a,isCollapsed:d}){const h=l===n.id?{button:"bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",icon:"text-blue-500",current:"page"}:{button:"text-gray-600 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-700",icon:"text-gray-400",current:void 0};return i.jsxs("button",{onClick:()=>a(n.id),"aria-label":n.label,"aria-current":h.current,title:d?n.label:void 0,className:`w-full flex items-center ${d?"justify-center py-2":"px-2 py-2"} text-sm font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 ${h.button}`,children:[i.jsx(n.icon,{className:`${d?"h-5 w-5":"mr-3 h-4 w-4"} ${h.icon}`}),!d&&i.jsxs(i.Fragment,{children:[n.label,l===n.id&&i.jsx(gr,{className:"ml-auto h-4 w-4 text-blue-400"})]})]})}const Zl=n=>{const[l,a]=k.useState(!0),[d,h]=k.useState(!1),[u,m]=k.useState(!1),p=Tl(n.onAddFilter),[g,w]=k.useState(!1);return i.jsxs("div",{className:`${u?"w-14":"w-60"} bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 flex-shrink-0 h-full overflow-y-auto flex flex-col transition-all duration-300`,children:[!u&&n.activeTab!=="pii"&&i.jsxs("div",{className:"p-3 border-b border-gray-200 dark:border-gray-700 space-y-3 bg-gray-50/50 dark:bg-gray-900/20",children:[i.jsx(Ml,{...n,showFilters:l,setShowFilters:a,form:p}),i.jsx(Ol,{...n,showExclusions:d,setShowExclusions:h,isAddingExclusion:g,setIsAddingExclusion:w})]}),i.jsx(Fl,{activeTab:n.activeTab,setActiveTab:n.setActiveTab,profile:n.profile,isCollapsed:u,setIsCollapsed:m})]})},$l=({profile:n})=>{if(!n)return null;const l=n.missing_cells_percentage??0,a=n.duplicate_rows??0;return i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Rows"}),i.jsx("div",{className:"text-2xl font-bold",children:(n.row_count??0).toLocaleString()})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Columns"}),i.jsx("div",{className:"text-2xl font-bold",children:n.column_count})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Missing Cells"}),i.jsxs("div",{className:"text-2xl font-bold",children:[l.toFixed(1),"%"]})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Duplicates"}),i.jsx("div",{className:"text-2xl font-bold",children:a})]}),n.vif&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"High VIF Features"}),i.jsx("div",{className:"text-2xl font-bold text-amber-600",children:Object.values(n.vif).filter(d=>d>5).length})]})]})},Hl=({alerts:n})=>{const[l,a]=k.useState(!0);return!n||n.length===0?null:i.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex justify-between items-center cursor-pointer",...ji(()=>a(!l)),children:[i.jsxs("h3",{className:"font-medium text-amber-800 dark:text-amber-200 flex items-center",children:[i.jsx(bt,{className:"w-4 h-4 mr-2"}),"Data Quality Alerts (",n.length,")"]}),l?i.jsx(vs,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"}):i.jsx(wi,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"})]}),l&&i.jsx("div",{className:"max-h-40 overflow-y-auto pr-2 mt-2 animate-in slide-in-from-top-2 duration-200",children:i.jsx("ul",{className:"space-y-1",children:n.map((d,h)=>i.jsxs("li",{className:"text-sm text-amber-700 dark:text-amber-300 flex items-start",children:[i.jsx("span",{className:"mr-2",children:"β€’"}),i.jsxs("span",{children:[d.column&&i.jsxs("span",{className:"font-semibold",children:[d.column,": "]}),d.message]})]},h))})})]})},Wl=({profile:n,onToggleExclude:l,excludedCols:a=[]})=>{const d=at(),h=k.useMemo(()=>{if(!(n!=null&&n.columns))return[];const m={};return Object.values(n.columns).forEach(p=>{m[String(p.dtype)]=(m[String(p.dtype)]||0)+1}),Object.entries(m).map(([p,g])=>({name:p,value:g}))},[n]),u=k.useMemo(()=>n!=null&&n.columns?Object.values(n.columns).filter(m=>m.missing_percentage>0).sort((m,p)=>p.missing_percentage-m.missing_percentage).slice(0,20).map(m=>({name:m.name,value:m.missing_percentage})):[],[n]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx($l,{profile:n}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(dr,{className:"w-5 h-5 mr-2 text-blue-500"}),"Column Types"]}),i.jsx("div",{className:"h-64",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Do,{children:[i.jsx(Ro,{data:h,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,fill:"#8884d8",paddingAngle:5,dataKey:"value",children:h.map((m,p)=>i.jsx(js,{fill:We[p%We.length]},`cell-${p}`))}),i.jsx(He,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),i.jsx(kr,{verticalAlign:"bottom",height:36})]})})})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-amber-500"}),"Top Missing Values"]}),u.length>0?i.jsx("div",{className:"h-64 overflow-y-auto pr-2 space-y-3",children:u.map((m,p)=>{const g=a.includes(m.name);return i.jsxs("div",{className:"flex items-center gap-3 text-sm group",children:[i.jsx("div",{className:"w-32 truncate text-gray-600 dark:text-gray-300 font-medium",title:m.name,children:m.name}),i.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m.value}%`,backgroundColor:`hsl(10, 80%, ${60-p*2}%)`}})}),i.jsxs("div",{className:"w-12 text-right text-gray-500 text-xs",children:[m.value.toFixed(1),"%"]}),l&&i.jsx("button",{onClick:()=>l(m.name,!g),className:`p-1.5 rounded-md transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 ${g?"bg-red-100 text-red-600 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 opacity-100":"text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Include Column":"Exclude Column","aria-label":g?"Include Column":"Exclude Column",children:g?i.jsx(Ut,{className:"w-4 h-4"}):i.jsx(pr,{className:"w-4 h-4"})})]},p)})}):i.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400",children:[i.jsx(cr,{className:"w-12 h-12 mb-2 opacity-20"}),i.jsx("p",{children:"No missing values found!"})]})]})]}),i.jsx(Hl,{alerts:n.alerts??[]})]})},Vl=({profile:n})=>{const l=Array.isArray(n.recommendations)?n.recommendations:[];return i.jsx("div",{className:"mt-4 space-y-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(fr,{className:"w-5 h-5 mr-2 text-yellow-500"}),"Smart Recommendations"]}),l.length>0?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.map((a,d)=>i.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/10 rounded-lg border border-blue-100 dark:border-blue-800",children:[i.jsxs("div",{className:"flex justify-between items-start mb-2",children:[i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-800 px-2 py-1 rounded border border-blue-100 dark:border-blue-800",children:a.action}),a.column&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:a.column})]}),i.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm mb-1",children:a.reason}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.suggestion})]},d))}):i.jsx("p",{className:"text-gray-500 dark:text-gray-400 italic",children:"No specific recommendations found. Your data looks clean!"})]})})};function ql({alerts:n=[]}){const l=n.filter(d=>d.type==="PII"),a=new Set(l.map(d=>d.column).filter(Boolean)).size;return i.jsxs("section",{id:"eda-pii-review","aria-labelledby":"eda-pii-heading",className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"eda-pii-heading",className:"flex items-center gap-2 text-xl font-semibold text-gray-900 dark:text-white",children:[i.jsx(ur,{"aria-hidden":"true",className:"h-5 w-5 text-blue-600 dark:text-blue-400"}),"PII review"]}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Review columns that may contain personally identifiable information (PII). Values and samples are not shown here."})]}),i.jsxs("div",{className:"flex gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:[i.jsx(jt,{"aria-hidden":"true",className:"mt-0.5 h-5 w-5 shrink-0 text-blue-700 dark:text-blue-300"}),i.jsxs("div",{className:"space-y-1 text-sm text-blue-900 dark:text-blue-100",children:[i.jsx("p",{className:"font-semibold",children:"Advisory heuristics only"}),i.jsx("p",{children:"Matches can be false positives, and detection can miss personal information. Findings do not classify data as legally sensitive or determine compliance. This review does not mask, delete, or block data."})]})]}),l.length===0?i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800",children:[i.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"No PII findings recorded"}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"This profile contains no PII alerts. That does not guarantee the dataset is free of personal information."})]}):i.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white",children:[l.length," finding",l.length===1?"":"s"," across ",a," flagged column",a===1?"":"s"]}),i.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300",children:"The detector checks email and phone patterns together; it does not report which pattern matched. Findings describe the saved profile, including columns with pending exclusions."})]}),i.jsx("div",{role:"region","aria-label":"PII findings table",tabIndex:0,className:"overflow-x-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500",children:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("caption",{className:"sr-only",children:"Possible PII findings from this profile"}),i.jsx("thead",{className:"bg-gray-50 text-gray-600 dark:bg-gray-900/50 dark:text-gray-300",children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Column"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Detector category"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Severity"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Explanation"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:l.map((d,h)=>{const u=d.severity==="error"?"Error":d.severity==="warning"?"Warning":d.severity==="info"?"Info":"Unspecified",m=u==="Error"?"bg-red-50 text-red-800 dark:bg-red-900/30 dark:text-red-200":u==="Warning"?"bg-amber-50 text-amber-800 dark:bg-amber-900/30 dark:text-amber-200":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200";return i.jsxs("tr",{className:"align-top",children:[i.jsx("th",{scope:"row",className:"max-w-64 break-words px-4 py-4 font-medium text-gray-900 dark:text-white",children:d.column||"Column not specified"}),i.jsx("td",{className:"whitespace-nowrap px-4 py-4 text-gray-700 dark:text-gray-200",children:"Email / phone"}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${m}`,children:u})}),i.jsx("td",{className:"px-4 py-4 text-gray-600 dark:text-gray-300",children:"Values may match an email address or phone number pattern. Review whether this column is appropriate for your intended use."})]},h)})})]})})]})]})}var Ul=Go();const Lr=xr(Ul);var Kl=Yo();const Gl=xr(Kl),Yl=Gl(Lr),Hn=["circle","square","diamond","cross","x"],Xl={circle:"circle",square:"rect",diamond:"rectRot",cross:"cross",x:"crossRot"},Ql={circle:"circle",square:"square",diamond:"diamond",cross:"cross",x:"x"},Wn=n=>Hn[n%Hn.length],Jl=n=>Xl[n],ed=n=>Ql[n],td=(n,l)=>{const a=n.localeCompare(l,"en");return a!==0||n===l?a:n{let l="Unlabeled",a=1;for(;n.has(l);)l=a===1?"Unlabeled (missing)":`Unlabeled (missing) ${a}`,a+=1;return l},Gt=(n,l)=>{if(!l)return[{value:null,label:"Data Points",points:n,color:We[0],shape:Wn(0)}];const a=new Map;n.forEach(m=>{const p=m[l],g=p==null?null:String(p),w=a.get(g)??[];w.push(m),a.set(g,w)});const d=[...a.keys()].filter(m=>m!==null).sort(td),h=d.map((m,p)=>({value:m,label:m,points:a.get(m),color:We[p%We.length],shape:Wn(p)})),u=a.get(null);return u&&h.push({value:null,label:id(new Set(d)),points:u,color:"#6b7280",shape:"cross"}),h},Pr=n=>n.map(({label:l,color:a,shape:d})=>({label:l,color:a,shape:d})),Sr=({data:n,xKey:l,yKey:a,zKey:d,labelKey:h,xLabel:u,yLabel:m,zLabel:p,height:g=600})=>{const w=k.useMemo(()=>Gt(n,h).map(({label:x,points:N,color:P,shape:j})=>{const M=ed(j);return{x:N.map(D=>D[l]),y:N.map(D=>D[a]),z:N.map(D=>D[d]),mode:"markers",type:"scatter3d",name:x,marker:{size:3,opacity:.8,color:P,symbol:M},hovertemplate:`${x}
${u||l}: %{x}
${m||a}: %{y}
${p||d}: %{z}`}}),[n,l,a,d,h,u,m,p]),y=at();return n.length===0?i.jsx("div",{className:"text-gray-500 text-sm italic p-4 text-center",children:"No data points to display"}):i.jsx("div",{style:{height:g,width:"100%"},children:i.jsx(Yl,{data:w,layout:{autosize:!0,height:g,margin:{l:0,r:0,b:0,t:0},paper_bgcolor:y.bgColor,plot_bgcolor:y.bgColor,font:{color:y.textColor},scene:{xaxis:{title:{text:u||l},color:y.axisColor,gridcolor:y.gridColor},yaxis:{title:{text:m||a},color:y.axisColor,gridcolor:y.gridColor},zaxis:{title:{text:p||d},color:y.axisColor,gridcolor:y.gridColor}},showlegend:!1},useResizeHandler:!0,style:{width:"100%",height:"100%"},config:{displayModeBar:!0}})})};Bo.register(Zo,$o,Ho,Wo,Vo);const Tr=({data:n,xKey:l,yKey:a,labelKey:d,xLabel:h,yLabel:u,height:m=500})=>{const p=k.useMemo(()=>Gt(n,d).map(({label:b,points:x,color:N,shape:P})=>({label:b,data:x.map(j=>({x:Number(j[l]),y:Number(j[a]),raw:j})),backgroundColor:N,borderColor:N,pointStyle:Jl(P),pointRadius:3,pointHoverRadius:5})),[n,l,a,d]),g=at(),w={responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!h,text:h,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}},y:{title:{display:!!u,text:u,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}}},plugins:{tooltip:{callbacks:{label:y=>{const b=y.raw;let x=y.dataset.label||"";return x&&(x+=": "),x+=`(${b.x}, ${b.y})`,x}}},legend:{display:!1}}};return i.jsx("div",{style:{height:m,width:"100%"},children:i.jsx(Fo,{options:w,data:{datasets:p}})})},sd=({shape:n,color:l})=>{const a={width:12,height:12,"aria-hidden":!0};switch(n){case"square":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("rect",{x:"1",y:"1",width:"10",height:"10",fill:l})});case"diamond":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("polygon",{points:"6,0 12,6 6,12 0,6",fill:l})});case"cross":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M6 1 L6 11 M1 6 L11 6",stroke:l,strokeWidth:2})});case"x":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M2 2 L10 10 M10 2 L2 10",stroke:l,strokeWidth:2})});case"circle":default:return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("circle",{cx:"6",cy:"6",r:"5",fill:l})})}},Ns=({entries:n,filterThreshold:l=12})=>{const[a,d]=k.useState(""),h=k.useMemo(()=>{if(!a.trim())return n;const m=a.trim().toLowerCase();return n.filter(p=>p.label.toLowerCase().includes(m))},[n,a]);if(n.length===0)return null;const u=n.length>l;return i.jsxs("div",{className:"mt-3 border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[u&&i.jsx("input",{type:"search",value:a,onChange:m=>d(m.target.value),placeholder:`Filter ${n.length} legend groups…`,"aria-label":"Filter legend groups",className:"mb-2 w-full text-xs rounded border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white px-2 py-1"}),i.jsxs("ul",{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-gray-700 dark:text-gray-300 ${u?"max-h-32 overflow-y-auto":""}`,children:[h.map(m=>i.jsxs("li",{className:"flex items-center gap-1.5",children:[i.jsx(sd,{shape:m.shape,color:m.color}),i.jsx("span",{className:"truncate max-w-[10rem]",title:m.label,children:m.label})]},m.label)),h.length===0&&i.jsxs("li",{className:"italic text-gray-500 dark:text-gray-400",children:["No groups match β€œ",a,"”."]})]})]})},nd=({profile:n,downloadChart:l})=>{const a=n.clustering;return a?i.jsxs("div",{className:"mt-4 space-y-6",id:"clustering-chart",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-rose-500"}),"Post-Hoc Clustering (Segmentation)",i.jsx(_e,{text:"Automatically groups data points into distinct clusters (segments) based on similarity. Useful for finding natural groups like 'High Spenders' or 'At Risk' users."})]}),i.jsx("button",{onClick:()=>l("clustering-chart","clustering-analysis","Clustering Segmentation",`${a.n_clusters} Clusters Found`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:i.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:i.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"Algorithm Summary"}),i.jsxs("div",{className:"space-y-1 text-sm text-purple-700 dark:text-purple-300",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Method:"}),i.jsx("span",{className:"font-medium",children:a.method})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Metric (Inertia):"}),i.jsx("span",{className:"font-medium",children:a.inertia.toFixed(1)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Clusters:"}),i.jsx("span",{className:"font-medium",children:a.n_clusters})]})]})]})}),i.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mt-4",children:"Cluster Profiles (Centroids)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:a.clusters.map(d=>i.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[i.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:rd(d.cluster_id)}}),"Cluster ",d.cluster_id]}),i.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[d.percentage.toFixed(1),"% (",d.size,")"]})]}),i.jsxs("div",{className:"space-y-1",children:[Object.entries(d.center).sort(([,h],[,u])=>Math.abs(u)-Math.abs(h)).slice(0,5).map(([h,u])=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:h,children:h}),i.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:u.toFixed(2)})]},h)),Object.keys(d.center).length>5&&i.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(d.center).length-5," more features"]})]})]},d.cluster_id))})]})})]}),i.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 rounded-lg text-sm border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),i.jsx("div",{children:"These clusters are found using unsupervised learning (K-Means) on numeric features. The plot shows a 2D projection (PCA) of the clusters. Use this to identify distinct groups of data points that behave similarly."})]})]}):i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm flex flex-col items-center justify-center text-gray-500 min-h-[300px]",children:[i.jsx(wt,{className:"w-12 h-12 mb-4 opacity-20"}),i.jsx("p",{children:"Clustering analysis not available."}),i.jsx("p",{className:"text-sm mt-2",children:"Requires at least 2 numeric columns."})]})},rd=n=>We[n%We.length];function ad({components:n,isPCA3D:l}){return i.jsx(i.Fragment,{children:n&&n.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Principal Component Composition"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,l?3:2).map(a=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex justify-between items-center border-b border-gray-200 dark:border-gray-700 pb-2 mb-2",children:[i.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-200",children:a.component}),i.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 px-2 py-0.5 rounded-full",children:[(a.explained_variance_ratio*100).toFixed(1),"% Var"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:"Top Loadings"}),Object.entries(a.top_features||{}).map(([d,h],u)=>i.jsxs("div",{className:"flex justify-between text-xs items-center group",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400 truncate mr-2 flex-1",title:d,children:d}),i.jsxs("span",{className:`font-mono text-[10px] ${Number(h)>0?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400"}`,children:[Number(h)>0?"+":"",Number(h).toFixed(3)]})]},u))]})]},a.component))})]})})}const od=({profile:n,isPCA3D:l,setIsPCA3D:a,downloadChart:d})=>{const h=Array.isArray(n.pca_data)&&n.pca_data.length>0,u=h?"Download Chart":"Not enough numeric data for PCA",m=k.useMemo(()=>n.pca_data??[],[n.pca_data]),p=k.useMemo(()=>Pr(Gt(m,"label")),[m]),g=k.useMemo(()=>{const w=[{key:"x",label:"PC1"},{key:"y",label:"PC2"}];return l&&w.push({key:"z",label:"PC3"}),w.push({key:"label",label:"Group"}),w},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Multivariate Structure (PCA)",i.jsx(_e,{text:"Reduces data to 2D or 3D. Points closer together are similar. Colors show clusters or target values."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{disabled:!h,onClick:()=>d("pca-chart","pca-analysis","Multivariate Structure (PCA)",l?"3D Projection":"2D Projection"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:u,"aria-label":u,children:i.jsx(ke,{className:"w-4 h-4"})}),i.jsxs("button",{onClick:()=>a(!l),className:`p-2 rounded-md border transition-colors flex items-center gap-2 text-sm ${l?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,children:[i.jsx(_r,{className:"w-4 h-4"}),l?"Switch to 2D":"Switch to 3D"]})]})]}),i.jsx("div",{id:"pca-chart",children:n.pca_data?l?i.jsx(Sr,{data:n.pca_data,xKey:"x",yKey:"y",zKey:"z",labelKey:"label",xLabel:"PC1",yLabel:"PC2",zLabel:"PC3"}):i.jsx(Tr,{data:n.pca_data,xKey:"x",yKey:"y",labelKey:"label",xLabel:"Principal Component 1 (PC1)",yLabel:"Principal Component 2 (PC2)"}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm text-center p-4",children:"Not enough numeric data for PCA."})}),p.length>0&&i.jsx(Ns,{entries:p}),i.jsx(ki,{caption:"PCA projection data",filename:"pca-analysis",columns:g,rows:m}),i.jsxs("div",{className:"mt-6 flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:"About this visualization"}),i.jsxs("p",{children:["This chart shows a ",l?"3D":"2D"," projection of your data using Principal Component Analysis (PCA). Points that are close together share similar characteristics across all numeric features."]}),i.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["* For performance, this visualization uses a random sample of up to ",i.jsx("strong",{children:"5,000 points"}),"."]})]})]}),i.jsx(ad,{components:n.pca_components,isPCA3D:l})]}),i.jsx(nd,{profile:n,downloadChart:d})]})};function Er(n,l){const a=k.useRef(l);k.useEffect(function(){l!==a.current&&n.attributionControl!=null&&(a.current!=null&&n.attributionControl.removeAttribution(a.current),l!=null&&n.attributionControl.addAttribution(l)),a.current=l},[n,l])}function ld(n,l,a){l.center!==a.center&&n.setLatLng(l.center),l.radius!=null&&l.radius!==a.radius&&n.setRadius(l.radius)}const dd=1;function cd(n){return Object.freeze({__version:dd,map:n})}function hd(n,l){return Object.freeze({...n,...l})}const Mr=k.createContext(null),Ar=Mr.Provider;function Cs(){const n=k.useContext(Mr);if(n==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return n}function ud(n){function l(a,d){const{instance:h,context:u}=n(a).current;return k.useImperativeHandle(d,()=>h),a.children==null?null:$t.createElement(Ar,{value:u},a.children)}return k.forwardRef(l)}function md(n){function l(a,d){const[h,u]=k.useState(!1),{instance:m}=n(a,u).current;k.useImperativeHandle(d,()=>m),k.useEffect(function(){h&&m.update()},[m,h,a.children]);const p=m._contentNode;return p?qo.createPortal(a.children,p):null}return k.forwardRef(l)}function fd(n){function l(a,d){const{instance:h}=n(a).current;return k.useImperativeHandle(d,()=>h),null}return k.forwardRef(l)}function Ls(n,l){const a=k.useRef();k.useEffect(function(){return l!=null&&n.instance.on(l),a.current=l,function(){a.current!=null&&n.instance.off(a.current),a.current=null}},[n,l])}function Ni(n,l){const a=n.pane??l.pane;return a?{...n,pane:a}:n}function gd(n,l){return function(d,h){const u=Cs(),m=n(Ni(d,u),u);return Er(u.map,d.attribution),Ls(m.current,d.eventHandlers),l(m.current,u,d,h),m}}var Bt={exports:{}};/* @preserve +import{j as i,u as er,a as tr,P as vt,i as ir,B as sr,C as nr,M as os,H as Rn}from"./vendor-flow-Ct2sLZk5.js";import{af as pt,a as k,ad as rr,ag as ar,D as be,c as qt,E as lo,l as bi,ah as co,ai as ys,aj as ho,ak as uo,H as mo,al as fo,C as ls,am as go,an as or,ao as Ut,e as lr,f as bt,a9 as dr,ab as po,o as cr,_ as vs,p as wi,X as hr,q as bs,ap as xo,aq as _o,ar as yo,a3 as ur,as as mr,a4 as fr,a5 as yt,j as _i,at as vo,au as Zt,av as wt,aw as ds,ax as bo,ay as cs,k as gr,az as pr,a6 as jt,g as xr,K as ke,B as _r,b as $t,aa as Ht,R as wo,aA as ws,S as jo,aB as ko,h as No}from"./vendor-utils-VkF_O5b_.js";import{r as Co,g as yr,i as vr,f as ns,D as Lo,u as Po,t as Wt,a as So,M as To,S as br,s as ji,w as at,x as We,I as _e,C as ki,b as Kt,y as wr,z as Eo,B as Mo,F as Ao,G as yi,T as jr,H as hs,J as us,K as ms,O as zo,L as Io,E as Oo}from"./index-C2dSXwG1.js";import{R as De,aj as Do,ak as Ro,j as js,T as He,ah as kr,al as Fo,am as Bo,an as Zo,ao as $o,ap as Ho,aq as Wo,ar as Vo,r as qo,B as nt,C as Ye,X as Xe,Y as Qe,as as Nr,h as Ve,at as Uo,au as rs,ag as Ko,ai as Fn,av as Cr}from"./vendor-charts-BkHP8M8k.js";import{F as as}from"./FormField-BaO1-ftW.js";import{r as Go,a as Yo}from"./vendor-plotly-EQ6XkBLq.js";const xt="/api/eda",qe={analyze:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/analyze`,{target_col:l,exclude_cols:a,filters:d,task_type:h})).data,getLatestReport:async n=>(await pt.get(`${xt}/${n}/latest`)).data,getReport:async n=>(await pt.get(`${xt}/reports/${n}`)).data,cancelJob:async n=>(await pt.post(`${xt}/reports/${n}/cancel`)).data,getHistory:async n=>(await pt.get(`${xt}/${n}/history`)).data,getDecomposition:async(n,l,a,d,h)=>(await pt.post(`${xt}/${n}/decomposition`,{measure_col:l,measure_agg:a,split_col:d,filters:h})).data},Bn={x:"",y:"",z:"",color:"",is3D:!1,isPCA3D:!1},Zn=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,Xo=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>Zn(a)===Zn(l[d])),te=Co((n,l)=>({activeTab:"dashboard",selectedDataset:null,targetCol:"",taskType:"",excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],scatter:{...Bn},setActiveTab:a=>n({activeTab:a}),setSelectedDataset:a=>n({selectedDataset:a}),setTargetCol:a=>n({targetCol:a}),setTaskType:a=>n({taskType:a}),toggleExclude:(a,d)=>n(h=>{const u=h.excludedColsDraft.includes(a);return d?u?h:{excludedColsDraft:[...h.excludedColsDraft,a]}:u?{excludedColsDraft:h.excludedColsDraft.filter(m=>m!==a)}:h}),setExcludedDraft:a=>n({excludedColsDraft:a}),setExcludedApplied:a=>n({excludedColsApplied:a}),applyExcluded:()=>n({excludedColsApplied:[...l().excludedColsDraft]}),addFilterDraft:a=>n(d=>({filtersDraft:[...d.filtersDraft,a]})),removeFilterDraft:a=>n(d=>({filtersDraft:d.filtersDraft.filter((h,u)=>u!==a)})),clearFiltersDraft:()=>n({filtersDraft:[]}),setFiltersDraft:a=>n({filtersDraft:a}),setFiltersApplied:a=>n({filtersApplied:a}),applyFilters:()=>n(a=>({filtersApplied:[...a.filtersDraft]})),setScatter:a=>n(d=>({scatter:{...d.scatter,...a}})),resetForDataset:()=>n({excludedColsDraft:[],excludedColsApplied:[],filtersDraft:[],filtersApplied:[],targetCol:"",activeTab:"dashboard",scatter:{...Bn}})})),Qo=n=>{if(n.excludedColsApplied.length!==n.excludedColsDraft.length)return!0;const l=new Set(n.excludedColsApplied);for(const a of n.excludedColsDraft)if(!l.has(a))return!0;return!1},Jo=n=>!Xo(n.filtersDraft,n.filtersApplied),Ee={datasets:["eda","datasets"],report:n=>["eda","report",n],history:n=>["eda","history",n],reportById:n=>["eda","reportById",n]},el=n=>{const l=yr();return vr({mutationFn:a=>qe.cancelJob(a),onSuccess:()=>{l.invalidateQueries({queryKey:Ee.history(n)}),l.invalidateQueries({queryKey:Ee.report(n)})}})};function fs(n){if(n==null)return null;const l=n.trim();if(!/^\d+$/.test(l))return null;const a=Number(l);return a>0?a:null}function tl(n,l,a){const d=fs(n);if(d!==null)return d;if(l!==null)return l;const h=a[0];return h===void 0?null:fs(String(h.id))}function il(n,l,a){return n===null||!a?!1:!l.some(d=>Number(d.id)===n)}function sl(n,l){return l===null?!1:fs(n)===null}function nl(n){return n.name.trim()||`Dataset ${n.id}`}function rl(n){const l=String(n.id);return l.length<=6?l:l.slice(-6)}function al(n){const l=n.map(d=>nl(d)),a=new Map;for(const d of l)a.set(d,(a.get(d)??0)+1);return n.map((d,h)=>{const u=l[h];return(a.get(u)??0)>1?{value:d.id,label:`${u} (${rl(d)})`}:{value:d.id,label:u}})}function ol(n){const l=ns({queryKey:Ee.datasets,queryFn:()=>Lo.getUsable()}),a=k.useMemo(()=>l.data??[],[l.data]),d=k.useMemo(()=>al(a),[a]),h=ns({queryKey:Ee.report(n??null),queryFn:async()=>{var y;try{return await qe.getLatestReport(n)}catch(b){if(((y=b==null?void 0:b.response)==null?void 0:y.status)===404)return null;throw b}},enabled:n!=null,refetchInterval:y=>{const b=y.state.data;return b&&b.status==="PENDING"?3e3:!1}}),u=h.data??null,m=h.isLoading,p=h.isError?"Failed to load report":null,w=ns({queryKey:Ee.history(n??null),queryFn:()=>qe.getHistory(n),enabled:n!=null,refetchInterval:(u==null?void 0:u.status)==="PENDING"?3e3:!1}).data??[];return{datasetsQuery:l,datasets:a,datasetOptions:d,reportQuery:h,report:u,loading:m,error:p,history:w}}function ll(){const[n,l]=Po(),a=yr(),[d,h]=k.useState(!1),[u,m]=k.useState(!1),[p,g]=k.useState(!1),w=k.useRef(!1),y=te(E=>E.activeTab),b=te(E=>E.setActiveTab),x=te(E=>E.selectedDataset),N=te(E=>E.setSelectedDataset),P=te(E=>E.targetCol),j=te(E=>E.setTargetCol),M=te(E=>E.taskType),D=te(E=>E.setTaskType),S=te(E=>E.excludedColsDraft),G=te(E=>E.excludedColsApplied),fe=te(E=>E.filtersDraft),le=te(E=>E.filtersApplied),ne=te(E=>E.scatter),we=te(E=>E.setScatter),A=te(Qo),I=te(Jo),{datasetsQuery:V,datasets:B,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge}=ol(x),O=vr({mutationFn:E=>qe.analyze(x,P||void 0,E.excluded,E.filters,M||void 0),onSuccess:()=>{a.invalidateQueries({queryKey:Ee.report(x??null)}),a.invalidateQueries({queryKey:Ee.history(x??null)})},onSettled:()=>{w.current=!1,g(!1)}}),ce=O.isPending||p,z=n.get("dataset_id");k.useEffect(()=>{const E=tl(z,x,B);E!==x&&N(E)},[z,B,x,N]),k.useEffect(()=>{if(!sl(z,x))return;const E=new URLSearchParams(n);E.set("dataset_id",String(x)),l(E,{replace:!0})},[z,x,n,l]);const q=il(x,B,V.isSuccess);k.useEffect(()=>{te.getState().resetForDataset()},[x]);const ee=k.useMemo(()=>{const E=Z==null?void 0:Z.profile_data;if(!E)return null;const ye=new Set(S),Ue={};return E.columns&&Object.entries(E.columns).forEach(([Re,Xt])=>{ye.has(Re)||(Ue[Re]=Xt)}),{...E,columns:Ue,excluded_columns:S}},[Z==null?void 0:Z.profile_data,S]),oe=(E,ye)=>{if(!x)return;const Ue=Array.isArray(E)?E:G,Re=Array.isArray(ye)?ye:le;O.mutate({excluded:Ue,filters:Re})},se=async E=>{if(x){m(!0);try{const ye=await a.fetchQuery({queryKey:Ee.reportById(E),queryFn:()=>qe.getReport(E)});a.setQueryData(Ee.report(x),ye)}catch(ye){Wt.error("Failed to load report",String(ye))}finally{m(!1)}}},J=(E,ye,Ue)=>{const Re={column:E,operator:Ue||"==",value:ye};te.getState().addFilterDraft(Re)},K=E=>{te.getState().removeFilterDraft(E)},Pe=()=>{te.getState().setFiltersDraft(le)},Me=()=>{if(w.current||ce)return;w.current=!0,g(!0);const E=te.getState().filtersDraft;te.getState().applyFilters(),oe(void 0,E)},Yt=(E,ye)=>{te.getState().toggleExclude(E,ye)},kt=()=>{const E=te.getState().excludedColsDraft;te.getState().applyExcluded(),oe(E)};k.useEffect(()=>{if(Z&&Z.profile_data){Z.profile_data.target_col&&j(Z.profile_data.target_col);const E=Array.isArray(Z.profile_data.excluded_columns)?Z.profile_data.excluded_columns:[];te.getState().setExcludedApplied(E),te.getState().setExcludedDraft(E)}},[Z==null?void 0:Z.id]);const Nt=P?ge.find(E=>E.target_col===P&&E.status==="COMPLETED"):null;return{searchParams:n,setSearchParams:l,queryClient:a,showHistoryModal:d,setShowHistoryModal:h,isLoadingReport:u,activeTab:y,setActiveTab:b,selectedDataset:x,targetCol:P,setTargetCol:j,taskType:M,setTaskType:D,excludedColsDraft:S,filtersDraft:fe,filtersApplied:le,scatter:ne,setScatter:we,excludedDirty:A,filtersDirty:I,datasetOptions:H,reportQuery:re,report:Z,loading:ie,error:Q,history:ge,analyzeMutation:O,analyzing:ce,selectionUnavailable:q,profileForUi:ee,runAnalysis:oe,loadSpecificReport:se,handleAddFilter:J,handleRemoveFilter:K,handleResetFilters:Pe,handleApplyFilters:Me,handleToggleExclude:Yt,handleApplyExcluded:kt,existingReport:Nt}}function dl(n){return i.jsx(i.Fragment,{children:i.jsxs("header",{className:"flex-none bg-white dark:bg-slate-900 border-b border-gray-200 dark:border-gray-800 px-4 py-2 flex flex-wrap items-center justify-between gap-3 z-20 shadow-sm lg:h-16 lg:flex-nowrap lg:py-0 lg:gap-4",children:[i.jsx(cl,{...n}),i.jsx(hl,{...n}),i.jsx(fl,{...n})]})})}function cl(n){const{report:l,selectionUnavailable:a,selectedDataset:d,searchParams:h,setSearchParams:u,datasetOptions:m}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-4 lg:gap-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white leading-tight",children:"Exploratory Analysis"}),l&&l.created_at&&i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Last analyzed: ",new Date(l.created_at).toLocaleString()]})]}),i.jsx("div",{className:"h-8 w-px bg-gray-200 dark:bg-gray-700 mx-2"}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("label",{htmlFor:"eda-toolbar-dataset",className:"text-[10px] font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Dataset"}),i.jsxs("select",{id:"eda-toolbar-dataset",value:a?"":d||"",onChange:p=>{const g=new URLSearchParams(h);g.set("dataset_id",p.target.value),u(g)},className:"block w-48 text-sm font-medium bg-transparent border-none p-0 focus:ring-0 text-gray-900 dark:text-white cursor-pointer hover:text-blue-600",children:[i.jsx("option",{value:"",disabled:!0,children:"Select a dataset"}),m.map(p=>i.jsx("option",{value:p.value,children:p.label},p.value))]})]})]})})}function hl(n){const{taskType:l,setTaskType:a,report:d}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-wrap items-center gap-3 bg-gray-50 dark:bg-gray-800/50 p-1.5 rounded-lg border border-gray-200 dark:border-gray-700 lg:flex-nowrap lg:gap-4",children:[i.jsx(ul,{...n}),i.jsx("div",{className:"w-px h-8 bg-gray-200 dark:bg-gray-700"}),i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("label",{htmlFor:"eda-toolbar-task-type",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Task Type"}),i.jsxs("div",{className:"group relative",children:[i.jsx(ar,{className:"w-3 h-3 text-gray-400 cursor-help"}),i.jsx("div",{className:"absolute bottom-full mb-2 w-56 p-2 bg-slate-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none left-1/2 -translate-x-1/2",children:"Force Classification or Regression."})]})]}),i.jsxs("select",{id:"eda-toolbar-task-type",value:l,onChange:h=>a(h.target.value),disabled:!d||!d.profile_data,className:"block w-28 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"Auto"}),i.jsx("option",{value:"Classification",children:"Classification"}),i.jsx("option",{value:"Regression",children:"Regression"})]})]}),i.jsx(ml,{...n})]})})}function ul(n){const{targetCol:l,setTargetCol:a,report:d,excludedColsDraft:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col px-2",children:[i.jsx("label",{htmlFor:"eda-toolbar-target-column",className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Target Column"}),i.jsxs("select",{id:"eda-toolbar-target-column",value:l,onChange:u=>a(u.target.value),disabled:!d||!d.profile_data,className:"block w-36 text-sm bg-transparent border-none p-0 focus:ring-0 text-gray-700 dark:text-gray-200 cursor-pointer disabled:opacity-50",children:[i.jsx("option",{value:"",children:"None"}),d&&d.profile_data&&Object.keys(d.profile_data.columns).filter(u=>!h.includes(u)).map(u=>i.jsx("option",{value:u,children:u},u))]})]})})}function ml(n){const{selectedDataset:l,runAnalysis:a,analyzing:d,existingReport:h}=n;return i.jsx(i.Fragment,{children:i.jsxs("button",{onClick:()=>l&&a(),disabled:!l||d,className:`ml-2 px-3 py-1.5 rounded text-sm font-medium transition-colors flex items-center shadow-sm ${h?"bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 hover:bg-gray-50":"action-primary border border-transparent"}`,children:[d?i.jsx(be,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(bi,{className:"w-4 h-4 mr-2"}),h?"Re-Run":"Analyze"]})})}function fl(n){const{existingReport:l,report:a,loadSpecificReport:d,isLoadingReport:h,setShowHistoryModal:u}=n;return i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[l&&a&&a.id!==l.id&&i.jsxs("button",{onClick:()=>d(l.id),disabled:h,className:"flex items-center px-3 py-1.5 text-xs bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 rounded-md hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:`Load existing from ${new Date(l.created_at).toLocaleString()}`,children:[h?i.jsx(be,{className:"w-3 h-3 mr-1 animate-spin"}):i.jsx(qt,{className:"w-3 h-3 mr-1"}),"Load Saved"]}),i.jsxs("button",{onClick:()=>u(!0),className:"flex items-center px-3 py-1.5 text-sm font-medium text-gray-600 bg-gray-50 dark:bg-gray-800 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[i.jsx(lo,{className:"w-4 h-4 mr-2"}),"History"]})]})})}function gl(n){const{history:l,report:a,loadSpecificReport:d,isLoadingReport:h}=n;return i.jsx(i.Fragment,{children:l.length>0&&i.jsxs("div",{className:"flex-none bg-white dark:bg-slate-950 border-b border-gray-100 dark:border-gray-800 px-4 py-1.5 flex items-center gap-3 overflow-x-auto z-10 shadow-[0_2px_3px_-1px_rgba(0,0,0,0.02)]",children:[i.jsx("span",{className:"text-[10px] uppercase font-bold text-gray-400 tracking-wider whitespace-nowrap",children:"Recent Targets:"}),i.jsx("div",{className:"flex gap-2",children:Array.from(new Set(l.filter(u=>u.target_col&&u.status==="COMPLETED").map(u=>u.target_col))).slice(0,8).map(u=>{var m;return i.jsxs("button",{onClick:()=>{const p=l.find(g=>g.target_col===u&&g.status==="COMPLETED");p&&d(p.id)},disabled:h,className:`px-2 py-0.5 text-xs rounded-full border transition-colors flex items-center disabled:opacity-50 disabled:cursor-not-allowed ${((m=a==null?void 0:a.profile_data)==null?void 0:m.target_col)===u?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 font-medium":"bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:text-gray-700 dark:hover:text-gray-200"}`,children:[i.jsx(rr,{className:"w-3 h-3 mr-1"}),u]},u)})})]})})}const pl={Numeric:{badgeClass:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",iconColorClass:"text-blue-500",Icon:mo},Categorical:{badgeClass:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",iconColorClass:"text-purple-500",Icon:uo},Boolean:{badgeClass:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",iconColorClass:"text-amber-500",Icon:ho},DateTime:{badgeClass:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",iconColorClass:"text-teal-500",Icon:ys},Text:{badgeClass:"bg-slate-100 text-slate-800 dark:bg-slate-800 dark:text-slate-300",iconColorClass:"text-slate-500",Icon:co}},xl={badgeClass:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",iconColorClass:"text-gray-500",Icon:fo};function ks(n){return pl[n]??xl}function _l(n){return ks(n).badgeClass}function yl(n){return ks(n).iconColorClass}function vl(n){return ks(n).Icon}const bl=({isOpen:n,onClose:l,history:a,datasetId:d,onSelect:h,onFetchReport:u,onRefresh:m})=>{const[p,g]=k.useState(null),[w,y]=k.useState(!1),b=k.useRef(0),x=el(d),N=x.isPending?x.variables??null:null,P=So(),j=()=>{g(null),l()},M=async(S,G)=>{if(S.stopPropagation(),!!await P({title:"Cancel analysis?",message:"Are you sure you want to cancel this analysis?",confirmLabel:"Cancel job",variant:"danger"}))try{await x.mutateAsync(G),m&&m()}catch(le){console.error("Failed to cancel job",le),Wt.error("Failed to cancel job")}},D=async S=>{const G=++b.current;y(!0);try{const fe=await u(S.id);if(G!==b.current)return;g(fe)}catch(fe){console.error("Failed to load report details",fe),G===b.current&&Wt.error("Failed to load job details","Please try again.")}finally{G===b.current&&y(!1)}};return i.jsx(To,{isOpen:n,onClose:j,size:p?"5xl":"2xl",title:i.jsxs("div",{className:"flex items-center gap-3",children:[p?i.jsx("button",{onClick:()=>g(null),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":"Back to history",children:i.jsx(go,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})}):i.jsx(ls,{className:"w-5 h-5 text-blue-500"}),i.jsx("span",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:p?`Analysis #${p.id} Details`:"Analysis History"})]}),footer:p?i.jsx("div",{className:"flex justify-end",children:i.jsxs("button",{onClick:()=>{h(p),j()},className:"flex items-center px-4 py-2 action-primary rounded-md transition-colors shadow-sm",children:[i.jsx(bi,{className:"w-4 h-4 mr-2"}),"Load this Report"]})}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center w-full",children:"Select a previous analysis to view details."}),children:i.jsx("div",{className:"p-6",children:p?w?i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[i.jsx(be,{className:"w-12 h-12 mb-4 animate-spin text-blue-500"}),i.jsx("p",{children:"Loading analysis details..."})]}):i.jsx(kl,{selectedJob:p}):a.length===0?i.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400",children:[i.jsx(ls,{className:"w-12 h-12 mx-auto mb-3 opacity-20"}),i.jsx("p",{children:"No history available for this dataset."})]}):i.jsx("div",{className:"space-y-3",children:a.map(S=>i.jsx(wl,{job:S,handleJobClick:D,cancelling:N,handleCancel:M},S.id))})})})};function wl({job:n,handleJobClick:l,cancelling:a,handleCancel:d}){return i.jsxs("div",{...ji(()=>l(n)),className:"flex items-center justify-between p-4 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer transition-all group",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(jl,{status:n.status}),i.jsxs("div",{children:[i.jsxs("div",{className:"font-medium text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 flex items-center gap-2",children:["Analysis #",n.id,i.jsx(br,{status:n.status??"unknown"})]}),i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:n.created_at?new Date(n.created_at).toLocaleString():"β€”"}),n.target_col&&i.jsxs("div",{className:"text-xs text-gray-400 mt-1 flex items-center gap-1",children:[i.jsx(bi,{className:"w-3 h-3"})," Target: ",n.target_col,n.task_type&&i.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 rounded text-[10px]",children:n.task_type})]})]})]}),i.jsx("div",{className:"text-right flex items-center gap-4",children:(n.status==="PENDING"||n.status==="STARTED"||n.status==="RUNNING")&&i.jsx("button",{onClick:h=>d(h,n.id),disabled:a===n.id,className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full transition-colors",title:"Cancel Analysis",children:a===n.id?i.jsx(be,{className:"w-4 h-4 animate-spin"}):i.jsx(or,{className:"w-4 h-4"})})})]})}function jl({status:n}){return i.jsx("div",{className:`p-2 rounded-full ${n==="COMPLETED"?"bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400":n==="FAILED"?"bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400":n==="CANCELLED"?"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400":"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:n==="COMPLETED"?i.jsx(lr,{className:"w-5 h-5"}):n==="FAILED"?i.jsx(bt,{className:"w-5 h-5"}):n==="CANCELLED"?i.jsx(or,{className:"w-5 h-5"}):i.jsx(be,{className:"w-5 h-5 animate-spin"})})}function kl({selectedJob:n}){var l,a;return i.jsxs("div",{className:"space-y-8",children:[i.jsx(Nl,{selectedJob:n}),((l=n.profile_data)==null?void 0:l.excluded_columns)&&n.profile_data.excluded_columns.length>0&&i.jsxs("div",{children:[i.jsxs("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3 flex items-center gap-2",children:[i.jsx(Ut,{className:"w-4 h-4 text-gray-500"}),"Excluded Columns (",n.profile_data.excluded_columns.length,")"]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:n.profile_data.excluded_columns.map(d=>i.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded text-sm line-through",children:d},d))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white mb-3",children:"Variables Overview"}),i.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:i.jsxs("table",{className:"w-full text-sm text-left",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50 text-gray-500 dark:text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Missing"}),i.jsx("th",{className:"px-4 py-3 font-medium",children:"Distinct"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:((a=n.profile_data)==null?void 0:a.columns)&&Object.values(n.profile_data.columns).map(d=>{var u;const h=vl(d.dtype);return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx("td",{className:"px-4 py-3 font-medium text-gray-900 dark:text-white",children:d.name}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:`w-4 h-4 ${yl(d.dtype)}`}),i.jsx("span",{children:d.dtype})]})}),i.jsx("td",{className:"px-4 py-3",children:d.missing_percentage>0?i.jsxs("span",{className:"text-amber-600",children:[d.missing_percentage.toFixed(1),"%"]}):i.jsx("span",{className:"text-green-600",children:"0%"})}),i.jsx("td",{className:"px-4 py-3 text-gray-500 dark:text-gray-400",children:((u=d.categorical_stats)==null?void 0:u.unique_count)||"-"})]},d.name)})})]})})]})]})}function Nl({selectedJob:n}){var l,a,d,h,u,m;return i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(dr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Rows"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((a=(l=n.profile_data)==null?void 0:l.row_count)==null?void 0:a.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(po,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Columns"})]}),i.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:((h=(d=n.profile_data)==null?void 0:d.column_count)==null?void 0:h.toLocaleString())||"-"})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400 mb-1",children:[i.jsx(cr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-xs uppercase font-medium",children:"Missing Cells"})]}),i.jsxs("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[(m=(u=n.profile_data)==null?void 0:u.missing_cells_percentage)==null?void 0:m.toFixed(1),"%"]})]})]})}function Cl(n){const{selectionUnavailable:l,selectedDataset:a,analyzeMutation:d,analyzing:h,runAnalysis:u}=n;return i.jsxs(i.Fragment,{children:[l&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Dataset #",a," isn't available for analysis β€” it may still be processing or have no usable columns. Pick another dataset above to continue."]})]}),d.isError&&i.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-200",children:[i.jsx(bt,{className:"h-4 w-4 shrink-0"}),i.jsxs("span",{className:"flex-1 min-w-[12rem]",children:["Could not start the analysis: ",d.error instanceof Error?d.error.message:"the request was rejected."," ","Your dataset, target, and filter choices were kept."]}),i.jsxs("button",{onClick:()=>{const m=d.variables;u(m==null?void 0:m.excluded,m==null?void 0:m.filters)},disabled:h,className:"flex items-center rounded-md border border-red-300 px-3 py-1.5 font-medium hover:bg-red-100 disabled:opacity-50 dark:border-red-800 dark:hover:bg-red-900/40",children:[i.jsx(qt,{className:"mr-2 h-4 w-4"}),"Try again"]}),i.jsx("button",{onClick:()=>d.reset(),className:"rounded-md px-2 py-1.5 font-medium underline hover:no-underline",children:"Dismiss"})]})]})}function Ll(n){const{showHistoryModal:l,setShowHistoryModal:a,history:d,selectedDataset:h,queryClient:u}=n;return i.jsx(i.Fragment,{children:i.jsx(bl,{isOpen:l,onClose:()=>a(!1),history:d,datasetId:h??null,onRefresh:()=>u.invalidateQueries({queryKey:Ee.history(h??null)}),onFetchReport:async m=>{const p=await qe.getReport(m);return{...p,id:p.id??m}},onSelect:m=>{var g;h&&u.setQueryData(Ee.report(h),m);const p=Array.isArray((g=m.profile_data)==null?void 0:g.excluded_columns)?m.profile_data.excluded_columns:[];te.getState().setExcludedApplied(p),te.getState().setExcludedDraft(p)}})})}function Pl(n,l,a,d){return l?a&&!d?`${n===">"?"Greater than":n==="<"?"Less than":n===">="?"Greater than or equal to":"Less than or equal to"} needs a numeric value`:"":"Enter a filter value"}function Sl(n,l,a){const d=[">","<",">=","<="].includes(l),h=n.trim().length>0,u=l.trim().length>0,m=a.trim().length>0,p=Number.isFinite(Number(a)),g=Pl(l,m,d,p);return{hasFilterColumn:h,hasFilterOperator:u,hasFilterValue:m,isComparisonOperator:d,currentFilterValueError:g}}function Tl(n){const[l,a]=k.useState(!1),[d,h]=k.useState(""),[u,m]=k.useState("=="),[p,g]=k.useState(""),[w,y]=k.useState(!1),{hasFilterColumn:b,hasFilterOperator:x,hasFilterValue:N,isComparisonOperator:P,currentFilterValueError:j}=Sl(d,u,p);return{isAddingFilter:l,setIsAddingFilter:a,newFilterCol:d,setNewFilterCol:h,newFilterOp:u,setNewFilterOp:m,newFilterVal:p,setNewFilterVal:g,filterValidationAttempted:w,setFilterValidationAttempted:y,columnError:w&&!b?"Choose a filter column":"",operatorError:w&&!x?"Choose a filter operator":"",valueError:w&&j?j:"",handleAddFilterSubmit:()=>{y(!0),!(!b||!x||!N||j)&&(n(d,P?Number(p):Number.isNaN(Number(p))?p:Number(p),u),a(!1),y(!1),h(""),m("=="),g(""))}}}const $n=n=>`${n.column}${n.operator}${JSON.stringify(n.value)}`,El=(n,l)=>n.length!==l.length?!1:n.every((a,d)=>$n(a)===$n(l[d]));function Ml({filtersDraft:n,filtersApplied:l,filtersDirty:a,columns:d,analyzing:h,onRemoveFilter:u,onResetFilters:m,onApplyFilters:p,showFilters:g,setShowFilters:w,form:y}){const b=a||!El(n,l);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between w-full mb-2",children:[i.jsxs("button",{onClick:()=>w(!g),className:"flex items-center text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Draft Filters (",n.length,")"]}),g?i.jsx(vs,{className:"w-3 h-3 ml-1"}):i.jsx(wi,{className:"w-3 h-3 ml-1"})]}),a&&i.jsx("span",{className:"text-[10px] font-medium rounded-full bg-amber-100 text-amber-800 px-2 py-0.5",children:"Pending"})]}),g&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{className:"text-[10px] text-gray-500 dark:text-gray-400",children:["Report uses ",l.length," applied filter",l.length===1?"":"s"," until you apply draft changes."]}),i.jsx(Al,{filtersDraft:n,filtersDirty:a,analyzing:h,onRemoveFilter:u}),i.jsx(zl,{form:y,columns:d}),i.jsx(Il,{disabled:!b||h,onResetFilters:m,onApplyFilters:p})]})]})}function Al({filtersDraft:n,filtersDirty:l,analyzing:a,onRemoveFilter:d}){return i.jsx(i.Fragment,{children:n.length>0?n.map((h,u)=>i.jsxs("div",{className:`flex items-center justify-between rounded px-2 py-1 text-xs border ${l?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700"}`,children:[i.jsxs("div",{className:"truncate max-w-[140px]",children:[i.jsx("span",{className:"font-medium text-blue-700 dark:text-blue-300",children:h.column}),i.jsx("span",{className:"mx-1 text-gray-500 dark:text-gray-400",children:h.operator}),i.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:String(h.value)})]}),i.jsx("button",{onClick:()=>d(u),className:"text-gray-500 dark:text-gray-400 hover:text-red-500","aria-label":`Remove filter ${u+1}`,disabled:a,children:i.jsx(hr,{className:"w-3 h-3"})})]},u)):i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No draft filters yet."})})}function zl({form:n,columns:l}){const{isAddingFilter:a,setIsAddingFilter:d,newFilterCol:h,setNewFilterCol:u,newFilterOp:m,setNewFilterOp:p,newFilterVal:g,setNewFilterVal:w,filterValidationAttempted:y,setFilterValidationAttempted:b,columnError:x,operatorError:N,valueError:P,handleAddFilterSubmit:j}=n;return i.jsx(i.Fragment,{children:a?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsx(as,{label:"Filter column",hideLabel:!0,required:!0,...y?{error:x}:{},children:M=>i.jsxs("select",{...M,value:h,onChange:D=>u(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"",disabled:!0,children:"Column"}),l.map(D=>i.jsx("option",{value:D,children:D},D))]})}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(as,{label:"Filter operator",hideLabel:!0,required:!0,className:"w-1/3",...y?{error:N}:{},children:M=>i.jsxs("select",{...M,value:m,onChange:D=>p(D.target.value),className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",children:[i.jsx("option",{value:"==",children:"=="}),i.jsx("option",{value:"!=",children:"!="}),i.jsx("option",{value:">",children:">"}),i.jsx("option",{value:"<",children:"<"}),i.jsx("option",{value:">=",children:">="}),i.jsx("option",{value:"<=",children:"<="})]})}),i.jsx(as,{label:"Filter value",hideLabel:!0,required:!0,className:"w-2/3",...y?{error:P}:{},children:M=>i.jsx("input",{...M,type:"text",value:g,onChange:D=>w(D.target.value),placeholder:"Value",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onKeyDown:D=>D.key==="Enter"&&j()})})]}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx("button",{onClick:()=>{d(!1),b(!1),u(""),p("=="),w("")},className:"text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300",children:"Cancel"}),i.jsx("button",{onClick:j,className:"text-xs bg-blue-600 text-white px-2 py-1 rounded hover:bg-blue-700",children:"Save draft"})]})]}):i.jsxs("button",{onClick:()=>d(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-blue-600 hover:border-blue-300 transition-colors",children:[i.jsx(bs,{className:"w-3 h-3 mr-1"})," Add Filter"]})})}function Il({disabled:n,onResetFilters:l,onApplyFilters:a}){return i.jsxs("div",{className:"flex gap-2 pt-1",children:[i.jsx("button",{onClick:l,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-white dark:bg-gray-900 text-gray-600 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:"Reset filters"}),i.jsx("button",{onClick:a,disabled:n,className:`flex-1 text-xs px-2 py-1 rounded border transition-colors ${n?"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed":"bg-blue-600 text-white border-blue-700 hover:bg-blue-700"}`,children:"Apply filters"})]})}function Ol({columns:n,excludedCols:l,excludedDirty:a,analyzing:d,onToggleExclude:h,onApplyExcluded:u,showExclusions:m,setShowExclusions:p,isAddingExclusion:g,setIsAddingExclusion:w}){return i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>p(!m),className:"flex items-center justify-between w-full text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2 hover:text-gray-700 dark:hover:text-gray-300",children:[i.jsxs("span",{children:["Excluded (",l.length,")"]}),m?i.jsx(vs,{className:"w-3 h-3"}):i.jsx(wi,{className:"w-3 h-3"})]}),m&&i.jsxs("div",{className:"space-y-2",children:[l.map((y,b)=>i.jsxs("div",{className:"flex items-center justify-between bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded px-2 py-1 text-xs",children:[i.jsx("span",{className:"font-medium text-gray-500 dark:text-gray-400 line-through truncate max-w-[140px]",children:y}),i.jsx("button",{onClick:()=>h(y,!1),className:"text-gray-500 dark:text-gray-400 hover:text-green-500",title:"Include back",children:i.jsx(bs,{className:"w-3 h-3"})})]},b)),i.jsx(Dl,{onApplyExcluded:u,excludedDirty:a,analyzing:d}),g?i.jsxs("div",{className:"bg-white dark:bg-gray-900 p-2 rounded border border-gray-200 dark:border-gray-700 space-y-2 shadow-sm",children:[i.jsxs("select",{"aria-label":"Column to exclude from analysis",className:"w-full text-xs rounded border-gray-300 dark:border-gray-600 dark:bg-gray-800 p-1",onChange:y=>{y.target.value&&(h(y.target.value,!0),w(!1))},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"Select Column"}),n.filter(y=>!l.includes(y)).map(y=>i.jsx("option",{value:y,children:y},y))]}),i.jsx("button",{onClick:()=>w(!1),className:"w-full text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 text-center",children:"Cancel"})]}):i.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center justify-center px-2 py-1 text-xs border border-dashed border-gray-300 dark:border-gray-600 rounded text-gray-500 dark:text-gray-400 hover:text-red-600 hover:border-red-300 transition-colors",children:[i.jsx(Ut,{className:"w-3 h-3 mr-1"})," Exclude Column"]})]})]})}function Dl({onApplyExcluded:n,excludedDirty:l,analyzing:a}){return i.jsx("button",{onClick:n,disabled:!l||a,className:`w-full flex items-center justify-center px-2 py-1 text-xs rounded border transition-colors ${l&&!a?"bg-blue-600 text-white border-blue-700 hover:bg-blue-700":"bg-gray-100 dark:bg-gray-800 text-gray-400 border-gray-200 dark:border-gray-700 cursor-not-allowed"}`,title:l?"Apply excluded columns to re-run analysis":"No pending exclusion changes",children:"Apply changes"})}function Rl(n){return[{title:"Overview",items:[{id:"dashboard",label:"Dashboard",icon:yo,show:!0},{id:"pii",label:"PII Review",icon:ur,show:!0},{id:"sample",label:"Sample Data",icon:mr,show:!!n.sample_data},{id:"insights",label:"Smart Insights",icon:fr,show:!0}]},{title:"Univariate Analysis",items:[{id:"variables",label:"Variables",icon:yt,show:!0},{id:"outliers",label:"Outliers",icon:_i,show:!!n.outliers},{id:"target",label:"Target Analysis",icon:rr,show:!!(n.target_col&&n.target_correlations)}]},{title:"Multivariate Analysis",items:[{id:"correlations",label:"Correlations",icon:vo,show:!!(n.correlations||n.correlations_with_target||n.causal_target_exclusion_reason)},{id:"bivariate",label:"Bivariate",icon:Zt,show:!0},{id:"pca",label:"PCA & Clusters",icon:wt,show:!!n.pca_data||!!n.clustering}]},{title:"Structure & Causal",items:[{id:"causal",label:"Causal Graph",icon:wt,show:!!(n.causal_graph||n.causal_target_exclusion_reason)},{id:"rules",label:"Decision Tree",icon:ds,show:!!n.rule_tree},{id:"decomposition",label:"Decomposition",icon:bo,show:!0}]},{title:"Specialized",items:[{id:"timeseries",label:"Time Series",icon:ys,show:!!n.timeseries},{id:"geospatial",label:"Geospatial",icon:cs,show:!!n.geospatial}]}]}function Fl({activeTab:n,setActiveTab:l,profile:a,isCollapsed:d,setIsCollapsed:h}){const u=Rl(a);return i.jsxs("div",{className:`flex-1 overflow-y-auto ${d?"p-2":"p-3"}`,children:[i.jsxs("div",{className:`flex items-center ${d?"justify-center":"justify-between"} mb-3`,children:[!d&&i.jsx("h2",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:"Analysis Modules"}),i.jsx("button",{onClick:()=>h(!d),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded text-gray-500 dark:text-gray-400",title:d?"Expand Sidebar":"Collapse Sidebar",children:d?i.jsx(xo,{className:"w-4 h-4"}):i.jsx(_o,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"space-y-6",children:u.map((m,p)=>{const g=m.items.filter(w=>w.show);return g.length===0?null:i.jsxs("div",{children:[!d&&i.jsx("h3",{className:"px-2 text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:m.title}),i.jsx("div",{className:"space-y-1",children:g.map(w=>i.jsx(Bl,{item:w,activeTab:n,setActiveTab:l,isCollapsed:d},w.id))})]},p)})})]})}function Bl({item:n,activeTab:l,setActiveTab:a,isCollapsed:d}){const h=l===n.id?{button:"bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",icon:"text-blue-500",current:"page"}:{button:"text-gray-600 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-700",icon:"text-gray-400",current:void 0};return i.jsxs("button",{onClick:()=>a(n.id),"aria-label":n.label,"aria-current":h.current,title:d?n.label:void 0,className:`w-full flex items-center ${d?"justify-center py-2":"px-2 py-2"} text-sm font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800 ${h.button}`,children:[i.jsx(n.icon,{className:`${d?"h-5 w-5":"mr-3 h-4 w-4"} ${h.icon}`}),!d&&i.jsxs(i.Fragment,{children:[n.label,l===n.id&&i.jsx(gr,{className:"ml-auto h-4 w-4 text-blue-400"})]})]})}const Zl=n=>{const[l,a]=k.useState(!0),[d,h]=k.useState(!1),[u,m]=k.useState(!1),p=Tl(n.onAddFilter),[g,w]=k.useState(!1);return i.jsxs("div",{className:`${u?"w-14":"w-60"} bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 flex-shrink-0 h-full overflow-y-auto flex flex-col transition-all duration-300`,children:[!u&&n.activeTab!=="pii"&&i.jsxs("div",{className:"p-3 border-b border-gray-200 dark:border-gray-700 space-y-3 bg-gray-50/50 dark:bg-gray-900/20",children:[i.jsx(Ml,{...n,showFilters:l,setShowFilters:a,form:p}),i.jsx(Ol,{...n,showExclusions:d,setShowExclusions:h,isAddingExclusion:g,setIsAddingExclusion:w})]}),i.jsx(Fl,{activeTab:n.activeTab,setActiveTab:n.setActiveTab,profile:n.profile,isCollapsed:u,setIsCollapsed:m})]})},$l=({profile:n})=>{if(!n)return null;const l=n.missing_cells_percentage??0,a=n.duplicate_rows??0;return i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Rows"}),i.jsx("div",{className:"text-2xl font-bold",children:(n.row_count??0).toLocaleString()})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Columns"}),i.jsx("div",{className:"text-2xl font-bold",children:n.column_count})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Missing Cells"}),i.jsxs("div",{className:"text-2xl font-bold",children:[l.toFixed(1),"%"]})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Duplicates"}),i.jsx("div",{className:"text-2xl font-bold",children:a})]}),n.vif&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"High VIF Features"}),i.jsx("div",{className:"text-2xl font-bold text-amber-600",children:Object.values(n.vif).filter(d=>d>5).length})]})]})},Hl=({alerts:n})=>{const[l,a]=k.useState(!0);return!n||n.length===0?null:i.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex justify-between items-center cursor-pointer",...ji(()=>a(!l)),children:[i.jsxs("h3",{className:"font-medium text-amber-800 dark:text-amber-200 flex items-center",children:[i.jsx(bt,{className:"w-4 h-4 mr-2"}),"Data Quality Alerts (",n.length,")"]}),l?i.jsx(vs,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"}):i.jsx(wi,{className:"w-4 h-4 text-amber-800 dark:text-amber-200"})]}),l&&i.jsx("div",{className:"max-h-40 overflow-y-auto pr-2 mt-2 animate-in slide-in-from-top-2 duration-200",children:i.jsx("ul",{className:"space-y-1",children:n.map((d,h)=>i.jsxs("li",{className:"text-sm text-amber-700 dark:text-amber-300 flex items-start",children:[i.jsx("span",{className:"mr-2",children:"β€’"}),i.jsxs("span",{children:[d.column&&i.jsxs("span",{className:"font-semibold",children:[d.column,": "]}),d.message]})]},h))})})]})},Wl=({profile:n,onToggleExclude:l,excludedCols:a=[]})=>{const d=at(),h=k.useMemo(()=>{if(!(n!=null&&n.columns))return[];const m={};return Object.values(n.columns).forEach(p=>{m[String(p.dtype)]=(m[String(p.dtype)]||0)+1}),Object.entries(m).map(([p,g])=>({name:p,value:g}))},[n]),u=k.useMemo(()=>n!=null&&n.columns?Object.values(n.columns).filter(m=>m.missing_percentage>0).sort((m,p)=>p.missing_percentage-m.missing_percentage).slice(0,20).map(m=>({name:m.name,value:m.missing_percentage})):[],[n]);return i.jsxs("div",{className:"space-y-6",children:[i.jsx($l,{profile:n}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(dr,{className:"w-5 h-5 mr-2 text-blue-500"}),"Column Types"]}),i.jsx("div",{className:"h-64",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Do,{children:[i.jsx(Ro,{data:h,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,fill:"#8884d8",paddingAngle:5,dataKey:"value",children:h.map((m,p)=>i.jsx(js,{fill:We[p%We.length]},`cell-${p}`))}),i.jsx(He,{contentStyle:d.tooltipContentStyle,itemStyle:d.tooltipItemStyle,labelStyle:d.tooltipLabelStyle}),i.jsx(kr,{verticalAlign:"bottom",height:36})]})})})]}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-amber-500"}),"Top Missing Values"]}),u.length>0?i.jsx("div",{className:"h-64 overflow-y-auto pr-2 space-y-3",children:u.map((m,p)=>{const g=a.includes(m.name);return i.jsxs("div",{className:"flex items-center gap-3 text-sm group",children:[i.jsx("div",{className:"w-32 truncate text-gray-600 dark:text-gray-300 font-medium",title:m.name,children:m.name}),i.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m.value}%`,backgroundColor:`hsl(10, 80%, ${60-p*2}%)`}})}),i.jsxs("div",{className:"w-12 text-right text-gray-500 text-xs",children:[m.value.toFixed(1),"%"]}),l&&i.jsx("button",{onClick:()=>l(m.name,!g),className:`p-1.5 rounded-md transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 ${g?"bg-red-100 text-red-600 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 opacity-100":"text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Include Column":"Exclude Column","aria-label":g?"Include Column":"Exclude Column",children:g?i.jsx(Ut,{className:"w-4 h-4"}):i.jsx(pr,{className:"w-4 h-4"})})]},p)})}):i.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-gray-400",children:[i.jsx(cr,{className:"w-12 h-12 mb-2 opacity-20"}),i.jsx("p",{children:"No missing values found!"})]})]})]}),i.jsx(Hl,{alerts:n.alerts??[]})]})},Vl=({profile:n})=>{const l=Array.isArray(n.recommendations)?n.recommendations:[];return i.jsx("div",{className:"mt-4 space-y-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(fr,{className:"w-5 h-5 mr-2 text-yellow-500"}),"Smart Recommendations"]}),l.length>0?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.map((a,d)=>i.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/10 rounded-lg border border-blue-100 dark:border-blue-800",children:[i.jsxs("div",{className:"flex justify-between items-start mb-2",children:[i.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-800 px-2 py-1 rounded border border-blue-100 dark:border-blue-800",children:a.action}),a.column&&i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:a.column})]}),i.jsx("h4",{className:"font-medium text-gray-900 dark:text-white text-sm mb-1",children:a.reason}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a.suggestion})]},d))}):i.jsx("p",{className:"text-gray-500 dark:text-gray-400 italic",children:"No specific recommendations found. Your data looks clean!"})]})})};function ql({alerts:n=[]}){const l=n.filter(d=>d.type==="PII"),a=new Set(l.map(d=>d.column).filter(Boolean)).size;return i.jsxs("section",{id:"eda-pii-review","aria-labelledby":"eda-pii-heading",className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"eda-pii-heading",className:"flex items-center gap-2 text-xl font-semibold text-gray-900 dark:text-white",children:[i.jsx(ur,{"aria-hidden":"true",className:"h-5 w-5 text-blue-600 dark:text-blue-400"}),"PII review"]}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Review columns that may contain personally identifiable information (PII). Values and samples are not shown here."})]}),i.jsxs("div",{className:"flex gap-3 rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:[i.jsx(jt,{"aria-hidden":"true",className:"mt-0.5 h-5 w-5 shrink-0 text-blue-700 dark:text-blue-300"}),i.jsxs("div",{className:"space-y-1 text-sm text-blue-900 dark:text-blue-100",children:[i.jsx("p",{className:"font-semibold",children:"Advisory heuristics only"}),i.jsx("p",{children:"Matches can be false positives, and detection can miss personal information. Findings do not classify data as legally sensitive or determine compliance. This review does not mask, delete, or block data."})]})]}),l.length===0?i.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-800",children:[i.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:"No PII findings recorded"}),i.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"This profile contains no PII alerts. That does not guarantee the dataset is free of personal information."})]}):i.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800",children:[i.jsxs("div",{className:"border-b border-gray-200 p-4 dark:border-gray-700",children:[i.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white",children:[l.length," finding",l.length===1?"":"s"," across ",a," flagged column",a===1?"":"s"]}),i.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-300",children:"The detector checks email and phone patterns together; it does not report which pattern matched. Findings describe the saved profile, including columns with pending exclusions."})]}),i.jsx("div",{role:"region","aria-label":"PII findings table",tabIndex:0,className:"overflow-x-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500",children:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("caption",{className:"sr-only",children:"Possible PII findings from this profile"}),i.jsx("thead",{className:"bg-gray-50 text-gray-600 dark:bg-gray-900/50 dark:text-gray-300",children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Column"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Detector category"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Severity"}),i.jsx("th",{scope:"col",className:"px-4 py-3 font-medium",children:"Explanation"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:l.map((d,h)=>{const u=d.severity==="error"?"Error":d.severity==="warning"?"Warning":d.severity==="info"?"Info":"Unspecified",m=u==="Error"?"bg-red-50 text-red-800 dark:bg-red-900/30 dark:text-red-200":u==="Warning"?"bg-amber-50 text-amber-800 dark:bg-amber-900/30 dark:text-amber-200":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200";return i.jsxs("tr",{className:"align-top",children:[i.jsx("th",{scope:"row",className:"max-w-64 break-words px-4 py-4 font-medium text-gray-900 dark:text-white",children:d.column||"Column not specified"}),i.jsx("td",{className:"whitespace-nowrap px-4 py-4 text-gray-700 dark:text-gray-200",children:"Email / phone"}),i.jsx("td",{className:"px-4 py-4",children:i.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${m}`,children:u})}),i.jsx("td",{className:"px-4 py-4 text-gray-600 dark:text-gray-300",children:"Values may match an email address or phone number pattern. Review whether this column is appropriate for your intended use."})]},h)})})]})})]})]})}var Ul=Go();const Lr=xr(Ul);var Kl=Yo();const Gl=xr(Kl),Yl=Gl(Lr),Hn=["circle","square","diamond","cross","x"],Xl={circle:"circle",square:"rect",diamond:"rectRot",cross:"cross",x:"crossRot"},Ql={circle:"circle",square:"square",diamond:"diamond",cross:"cross",x:"x"},Wn=n=>Hn[n%Hn.length],Jl=n=>Xl[n],ed=n=>Ql[n],td=(n,l)=>{const a=n.localeCompare(l,"en");return a!==0||n===l?a:n{let l="Unlabeled",a=1;for(;n.has(l);)l=a===1?"Unlabeled (missing)":`Unlabeled (missing) ${a}`,a+=1;return l},Gt=(n,l)=>{if(!l)return[{value:null,label:"Data Points",points:n,color:We[0],shape:Wn(0)}];const a=new Map;n.forEach(m=>{const p=m[l],g=p==null?null:String(p),w=a.get(g)??[];w.push(m),a.set(g,w)});const d=[...a.keys()].filter(m=>m!==null).sort(td),h=d.map((m,p)=>({value:m,label:m,points:a.get(m),color:We[p%We.length],shape:Wn(p)})),u=a.get(null);return u&&h.push({value:null,label:id(new Set(d)),points:u,color:"#6b7280",shape:"cross"}),h},Pr=n=>n.map(({label:l,color:a,shape:d})=>({label:l,color:a,shape:d})),Sr=({data:n,xKey:l,yKey:a,zKey:d,labelKey:h,xLabel:u,yLabel:m,zLabel:p,height:g=600})=>{const w=k.useMemo(()=>Gt(n,h).map(({label:x,points:N,color:P,shape:j})=>{const M=ed(j);return{x:N.map(D=>D[l]),y:N.map(D=>D[a]),z:N.map(D=>D[d]),mode:"markers",type:"scatter3d",name:x,marker:{size:3,opacity:.8,color:P,symbol:M},hovertemplate:`${x}
${u||l}: %{x}
${m||a}: %{y}
${p||d}: %{z}`}}),[n,l,a,d,h,u,m,p]),y=at();return n.length===0?i.jsx("div",{className:"text-gray-500 text-sm italic p-4 text-center",children:"No data points to display"}):i.jsx("div",{style:{height:g,width:"100%"},children:i.jsx(Yl,{data:w,layout:{autosize:!0,height:g,margin:{l:0,r:0,b:0,t:0},paper_bgcolor:y.bgColor,plot_bgcolor:y.bgColor,font:{color:y.textColor},scene:{xaxis:{title:{text:u||l},color:y.axisColor,gridcolor:y.gridColor},yaxis:{title:{text:m||a},color:y.axisColor,gridcolor:y.gridColor},zaxis:{title:{text:p||d},color:y.axisColor,gridcolor:y.gridColor}},showlegend:!1},useResizeHandler:!0,style:{width:"100%",height:"100%"},config:{displayModeBar:!0}})})};Bo.register(Zo,$o,Ho,Wo,Vo);const Tr=({data:n,xKey:l,yKey:a,labelKey:d,xLabel:h,yLabel:u,height:m=500})=>{const p=k.useMemo(()=>Gt(n,d).map(({label:b,points:x,color:N,shape:P})=>({label:b,data:x.map(j=>({x:Number(j[l]),y:Number(j[a]),raw:j})),backgroundColor:N,borderColor:N,pointStyle:Jl(P),pointRadius:3,pointHoverRadius:5})),[n,l,a,d]),g=at(),w={responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!h,text:h,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}},y:{title:{display:!!u,text:u,color:g.axisColor,font:{weight:"bold"}},grid:{color:g.gridColor,lineWidth:1},ticks:{color:g.axisColor}}},plugins:{tooltip:{callbacks:{label:y=>{const b=y.raw;let x=y.dataset.label||"";return x&&(x+=": "),x+=`(${b.x}, ${b.y})`,x}}},legend:{display:!1}}};return i.jsx("div",{style:{height:m,width:"100%"},children:i.jsx(Fo,{options:w,data:{datasets:p}})})},sd=({shape:n,color:l})=>{const a={width:12,height:12,"aria-hidden":!0};switch(n){case"square":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("rect",{x:"1",y:"1",width:"10",height:"10",fill:l})});case"diamond":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("polygon",{points:"6,0 12,6 6,12 0,6",fill:l})});case"cross":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M6 1 L6 11 M1 6 L11 6",stroke:l,strokeWidth:2})});case"x":return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("path",{d:"M2 2 L10 10 M10 2 L2 10",stroke:l,strokeWidth:2})});case"circle":default:return i.jsx("svg",{...a,viewBox:"0 0 12 12",children:i.jsx("circle",{cx:"6",cy:"6",r:"5",fill:l})})}},Ns=({entries:n,filterThreshold:l=12})=>{const[a,d]=k.useState(""),h=k.useMemo(()=>{if(!a.trim())return n;const m=a.trim().toLowerCase();return n.filter(p=>p.label.toLowerCase().includes(m))},[n,a]);if(n.length===0)return null;const u=n.length>l;return i.jsxs("div",{className:"mt-3 border border-gray-200 dark:border-gray-700 rounded-md p-2",children:[u&&i.jsx("input",{type:"search",value:a,onChange:m=>d(m.target.value),placeholder:`Filter ${n.length} legend groups…`,"aria-label":"Filter legend groups",className:"mb-2 w-full text-xs rounded border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white px-2 py-1"}),i.jsxs("ul",{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-gray-700 dark:text-gray-300 ${u?"max-h-32 overflow-y-auto":""}`,children:[h.map(m=>i.jsxs("li",{className:"flex items-center gap-1.5",children:[i.jsx(sd,{shape:m.shape,color:m.color}),i.jsx("span",{className:"truncate max-w-[10rem]",title:m.label,children:m.label})]},m.label)),h.length===0&&i.jsxs("li",{className:"italic text-gray-500 dark:text-gray-400",children:["No groups match β€œ",a,"”."]})]})]})},nd=({profile:n,downloadChart:l})=>{const a=n.clustering;return a?i.jsxs("div",{className:"mt-4 space-y-6",id:"clustering-chart",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-rose-500"}),"Post-Hoc Clustering (Segmentation)",i.jsx(_e,{text:"Automatically groups data points into distinct clusters (segments) based on similarity. Useful for finding natural groups like 'High Spenders' or 'At Risk' users."})]}),i.jsx("button",{onClick:()=>l("clustering-chart","clustering-analysis","Clustering Segmentation",`${a.n_clusters} Clusters Found`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:i.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:i.jsxs("div",{className:"p-4 bg-purple-50 dark:bg-purple-900/10 rounded-lg border border-purple-100 dark:border-purple-800",children:[i.jsx("h4",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"Algorithm Summary"}),i.jsxs("div",{className:"space-y-1 text-sm text-purple-700 dark:text-purple-300",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Method:"}),i.jsx("span",{className:"font-medium",children:a.method})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Metric (Inertia):"}),i.jsx("span",{className:"font-medium",children:a.inertia.toFixed(1)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Clusters:"}),i.jsx("span",{className:"font-medium",children:a.n_clusters})]})]})]})}),i.jsx("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mt-4",children:"Cluster Profiles (Centroids)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:a.clusters.map(d=>i.jsxs("div",{className:"p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:shadow-md transition-shadow",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("span",{className:"font-bold text-gray-900 dark:text-white flex items-center",children:[i.jsx("span",{className:"w-3 h-3 rounded-full mr-2",style:{backgroundColor:rd(d.cluster_id)}}),"Cluster ",d.cluster_id]}),i.jsxs("span",{className:"text-xs px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-gray-600 dark:text-gray-300",children:[d.percentage.toFixed(1),"% (",d.size,")"]})]}),i.jsxs("div",{className:"space-y-1",children:[Object.entries(d.center).sort(([,h],[,u])=>Math.abs(u)-Math.abs(h)).slice(0,5).map(([h,u])=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400 truncate w-24",title:h,children:h}),i.jsx("span",{className:"font-mono text-gray-700 dark:text-gray-200",children:u.toFixed(2)})]},h)),Object.keys(d.center).length>5&&i.jsxs("div",{className:"text-xs text-center text-gray-400 italic pt-1",children:["+ ",Object.keys(d.center).length-5," more features"]})]})]},d.cluster_id))})]})})]}),i.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 rounded-lg text-sm border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),i.jsx("div",{children:"These clusters are found using unsupervised learning (K-Means) on numeric features. The plot shows a 2D projection (PCA) of the clusters. Use this to identify distinct groups of data points that behave similarly."})]})]}):i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm flex flex-col items-center justify-center text-gray-500 min-h-[300px]",children:[i.jsx(wt,{className:"w-12 h-12 mb-4 opacity-20"}),i.jsx("p",{children:"Clustering analysis not available."}),i.jsx("p",{className:"text-sm mt-2",children:"Requires at least 2 numeric columns."})]})},rd=n=>We[n%We.length];function ad({components:n,isPCA3D:l}){return i.jsx(i.Fragment,{children:n&&n.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 mb-3",children:"Principal Component Composition"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.slice(0,l?3:2).map(a=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 p-3 rounded-md border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex justify-between items-center border-b border-gray-200 dark:border-gray-700 pb-2 mb-2",children:[i.jsx("span",{className:"font-semibold text-gray-800 dark:text-gray-200",children:a.component}),i.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 px-2 py-0.5 rounded-full",children:[(a.explained_variance_ratio*100).toFixed(1),"% Var"]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:"Top Loadings"}),Object.entries(a.top_features||{}).map(([d,h],u)=>i.jsxs("div",{className:"flex justify-between text-xs items-center group",children:[i.jsx("span",{className:"text-gray-600 dark:text-gray-400 truncate mr-2 flex-1",title:d,children:d}),i.jsxs("span",{className:`font-mono text-[10px] ${Number(h)>0?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400"}`,children:[Number(h)>0?"+":"",Number(h).toFixed(3)]})]},u))]})]},a.component))})]})})}const od=({profile:n,isPCA3D:l,setIsPCA3D:a,downloadChart:d})=>{const h=Array.isArray(n.pca_data)&&n.pca_data.length>0,u=h?"Download Chart":"Not enough numeric data for PCA",m=k.useMemo(()=>n.pca_data??[],[n.pca_data]),p=k.useMemo(()=>Pr(Gt(m,"label")),[m]),g=k.useMemo(()=>{const w=[{key:"x",label:"PC1"},{key:"y",label:"PC2"}];return l&&w.push({key:"z",label:"PC3"}),w.push({key:"label",label:"Group"}),w},[l]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Multivariate Structure (PCA)",i.jsx(_e,{text:"Reduces data to 2D or 3D. Points closer together are similar. Colors show clusters or target values."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{disabled:!h,onClick:()=>d("pca-chart","pca-analysis","Multivariate Structure (PCA)",l?"3D Projection":"2D Projection"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:u,"aria-label":u,children:i.jsx(ke,{className:"w-4 h-4"})}),i.jsxs("button",{onClick:()=>a(!l),className:`p-2 rounded-md border transition-colors flex items-center gap-2 text-sm ${l?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,children:[i.jsx(_r,{className:"w-4 h-4"}),l?"Switch to 2D":"Switch to 3D"]})]})]}),i.jsx("div",{id:"pca-chart",children:n.pca_data?l?i.jsx(Sr,{data:n.pca_data,xKey:"x",yKey:"y",zKey:"z",labelKey:"label",xLabel:"PC1",yLabel:"PC2",zLabel:"PC3"}):i.jsx(Tr,{data:n.pca_data,xKey:"x",yKey:"y",labelKey:"label",xLabel:"Principal Component 1 (PC1)",yLabel:"Principal Component 2 (PC2)"}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm text-center p-4",children:"Not enough numeric data for PCA."})}),p.length>0&&i.jsx(Ns,{entries:p}),i.jsx(ki,{caption:"PCA projection data",filename:"pca-analysis",columns:g,rows:m}),i.jsxs("div",{className:"mt-6 flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:"About this visualization"}),i.jsxs("p",{children:["This chart shows a ",l?"3D":"2D"," projection of your data using Principal Component Analysis (PCA). Points that are close together share similar characteristics across all numeric features."]}),i.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["* For performance, this visualization uses a random sample of up to ",i.jsx("strong",{children:"5,000 points"}),"."]})]})]}),i.jsx(ad,{components:n.pca_components,isPCA3D:l})]}),i.jsx(nd,{profile:n,downloadChart:d})]})};function Er(n,l){const a=k.useRef(l);k.useEffect(function(){l!==a.current&&n.attributionControl!=null&&(a.current!=null&&n.attributionControl.removeAttribution(a.current),l!=null&&n.attributionControl.addAttribution(l)),a.current=l},[n,l])}function ld(n,l,a){l.center!==a.center&&n.setLatLng(l.center),l.radius!=null&&l.radius!==a.radius&&n.setRadius(l.radius)}const dd=1;function cd(n){return Object.freeze({__version:dd,map:n})}function hd(n,l){return Object.freeze({...n,...l})}const Mr=k.createContext(null),Ar=Mr.Provider;function Cs(){const n=k.useContext(Mr);if(n==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return n}function ud(n){function l(a,d){const{instance:h,context:u}=n(a).current;return k.useImperativeHandle(d,()=>h),a.children==null?null:$t.createElement(Ar,{value:u},a.children)}return k.forwardRef(l)}function md(n){function l(a,d){const[h,u]=k.useState(!1),{instance:m}=n(a,u).current;k.useImperativeHandle(d,()=>m),k.useEffect(function(){h&&m.update()},[m,h,a.children]);const p=m._contentNode;return p?qo.createPortal(a.children,p):null}return k.forwardRef(l)}function fd(n){function l(a,d){const{instance:h}=n(a).current;return k.useImperativeHandle(d,()=>h),null}return k.forwardRef(l)}function Ls(n,l){const a=k.useRef();k.useEffect(function(){return l!=null&&n.instance.on(l),a.current=l,function(){a.current!=null&&n.instance.off(a.current),a.current=null}},[n,l])}function Ni(n,l){const a=n.pane??l.pane;return a?{...n,pane:a}:n}function gd(n,l){return function(d,h){const u=Cs(),m=n(Ni(d,u),u);return Er(u.map,d.attribution),Ls(m.current,d.eventHandlers),l(m.current,u,d,h),m}}var Bt={exports:{}};/* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade */var pd=Bt.exports,Vn;function xd(){return Vn||(Vn=1,(function(n,l){(function(a,d){d(l)})(pd,(function(a){var d="1.9.4";function h(e){var t,s,r,o;for(s=1,r=arguments.length;s"u"||!L||!L.Mixin)){e=G(e)?e:[e];for(var t=0;t0?Math.floor(e):Math.ceil(e)};O.prototype={clone:function(){return new O(this.x,this.y)},add:function(e){return this.clone()._add(z(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(z(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new O(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new O(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=ce(this.x),this.y=ce(this.y),this},distanceTo:function(e){e=z(e);var t=e.x-this.x,s=e.y-this.y;return Math.sqrt(t*t+s*s)},equals:function(e){return e=z(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=z(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+x(this.x)+", "+x(this.y)+")"}};function z(e,t,s){return e instanceof O?e:G(e)?new O(e[0],e[1]):e==null?e:typeof e=="object"&&"x"in e&&"y"in e?new O(e.x,e.y):new O(e,t,s)}function q(e,t){if(e)for(var s=t?[e,t]:e,r=0,o=s.length;r=this.min.x&&s.x<=this.max.x&&t.y>=this.min.y&&s.y<=this.max.y},intersects:function(e){e=ee(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>=t.x&&r.x<=s.x,f=o.y>=t.y&&r.y<=s.y;return c&&f},overlaps:function(e){e=ee(e);var t=this.min,s=this.max,r=e.min,o=e.max,c=o.x>t.x&&r.xt.y&&r.y=t.lat&&o.lat<=s.lat&&r.lng>=t.lng&&o.lng<=s.lng},intersects:function(e){e=se(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>=t.lat&&r.lat<=s.lat,f=o.lng>=t.lng&&r.lng<=s.lng;return c&&f},overlaps:function(e){e=se(e);var t=this._southWest,s=this._northEast,r=e.getSouthWest(),o=e.getNorthEast(),c=o.lat>t.lat&&r.latt.lng&&r.lng1,Xr=(function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",b,t),window.removeEventListener("testPassiveEventSupport",b,t)}catch{}return e})(),Qr=(function(){return!!document.createElement("canvas").getContext})(),Ei=!!(document.createElementNS&&Re("svg").createSVGRect),Jr=!!Ei&&(function(){var e=document.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),ea=!Ei&&(function(){try{var e=document.createElement("div");e.innerHTML='';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&typeof t.adj=="object"}catch{return!1}})(),ta=navigator.platform.indexOf("Mac")===0,ia=navigator.platform.indexOf("Linux")===0;function Ae(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var R={ie:Qt,ielt9:Fr,edge:Ts,webkit:Pi,android:Es,android23:Ms,androidStock:Zr,opera:Si,chrome:As,gecko:zs,safari:$r,phantom:Is,opera12:Os,win:Hr,ie3d:Ds,webkit3d:Ti,gecko3d:Rs,any3d:Wr,mobile:Ct,mobileWebkit:Vr,mobileWebkit3d:qr,msPointer:Fs,pointer:Bs,touch:Ur,touchNative:Zs,mobileOpera:Kr,mobileGecko:Gr,retina:Yr,passiveEvents:Xr,canvas:Qr,svg:Ei,vml:ea,inlineSvg:Jr,mac:ta,linux:ia},$s=R.msPointer?"MSPointerDown":"pointerdown",Hs=R.msPointer?"MSPointerMove":"pointermove",Ws=R.msPointer?"MSPointerUp":"pointerup",Vs=R.msPointer?"MSPointerCancel":"pointercancel",Mi={touchstart:$s,touchmove:Hs,touchend:Ws,touchcancel:Vs},qs={touchstart:la,touchmove:Jt,touchend:Jt,touchcancel:Jt},ot={},Us=!1;function sa(e,t,s){return t==="touchstart"&&oa(),qs[t]?(s=qs[t].bind(this,s),e.addEventListener(Mi[t],s,!1),s):(console.warn("wrong event specified:",t),b)}function na(e,t,s){if(!Mi[t]){console.warn("wrong event specified:",t);return}e.removeEventListener(Mi[t],s,!1)}function ra(e){ot[e.pointerId]=e}function aa(e){ot[e.pointerId]&&(ot[e.pointerId]=e)}function Ks(e){delete ot[e.pointerId]}function oa(){Us||(document.addEventListener($s,ra,!0),document.addEventListener(Hs,aa,!0),document.addEventListener(Ws,Ks,!0),document.addEventListener(Vs,Ks,!0),Us=!0)}function Jt(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){t.touches=[];for(var s in ot)t.touches.push(ot[s]);t.changedTouches=[t],e(t)}}function la(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&xe(t),Jt(e,t)}function da(e){var t={},s,r;for(r in e)s=e[r],t[r]=s&&s.bind?s.bind(e):s;return e=t,t.type="dblclick",t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var ca=200;function ha(e,t){e.addEventListener("dblclick",t);var s=0,r;function o(c){if(c.detail!==1){r=c.detail;return}if(!(c.pointerType==="mouse"||c.sourceCapabilities&&!c.sourceCapabilities.firesTouchEvents)){var f=Js(c);if(!(f.some(function(v){return v instanceof HTMLLabelElement&&v.attributes.for})&&!f.some(function(v){return v instanceof HTMLInputElement||v instanceof HTMLSelectElement}))){var _=Date.now();_-s<=ca?(r++,r===2&&t(da(c))):r=1,s=_}}}return e.addEventListener("click",o),{dblclick:t,simDblclick:o}}function ua(e,t){e.removeEventListener("dblclick",t.dblclick),e.removeEventListener("click",t.simDblclick)}var Ai=ii(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Lt=ii(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Gs=Lt==="webkitTransition"||Lt==="OTransition"?Lt+"End":"transitionend";function Ys(e){return typeof e=="string"?document.getElementById(e):e}function Pt(e,t){var s=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!s||s==="auto")&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);s=r?r[t]:null}return s==="auto"?null:s}function X(e,t,s){var r=document.createElement(e);return r.className=t||"",s&&s.appendChild(r),r}function de(e){var t=e.parentNode;t&&t.removeChild(e)}function ei(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function lt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function dt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function zi(e,t){if(e.classList!==void 0)return e.classList.contains(t);var s=ti(e);return s.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(s)}function W(e,t){if(e.classList!==void 0)for(var s=P(t),r=0,o=s.length;r0?2*window.devicePixelRatio:1;function tn(e){return R.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/ga:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function qi(e,t){var s=t.relatedTarget;if(!s)return!0;try{for(;s&&s!==e;)s=s.parentNode}catch{return!1}return s!==e}var pa={__proto__:null,on:$,off:ae,stopPropagation:tt,disableScrollPropagation:Vi,disableClickPropagation:Mt,preventDefault:xe,stop:it,getPropagationPath:Js,getMousePosition:en,getWheelDelta:tn,isExternalTarget:qi,addListener:$,removeListener:ae},sn=ge.extend({run:function(e,t,s,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=s||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=et(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=B(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,s=this._duration*1e3;tthis.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var s=this.getCenter(),r=this._limitCenter(s,this._zoom,se(e));return s.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t=t||{};var s=z(t.paddingTopLeft||t.padding||[0,0]),r=z(t.paddingBottomRight||t.padding||[0,0]),o=this.project(this.getCenter()),c=this.project(e),f=this.getPixelBounds(),_=ee([f.min.add(s),f.max.subtract(r)]),v=_.getSize();if(!_.contains(c)){this._enforcingBounds=!0;var C=c.subtract(_.getCenter()),T=_.extend(c).getSize().subtract(v);o.x+=C.x<0?-T.x:T.x,o.y+=C.y<0?-T.y:T.y,this.panTo(this.unproject(o),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=h({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var s=this.getSize(),r=t.divideBy(2).round(),o=s.divideBy(2).round(),c=r.subtract(o);return!c.x&&!c.y?this:(e.animate&&e.pan?this.panBy(c):(e.pan&&this._rawPanBy(c),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(m(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:t,newSize:s}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=h({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=m(this._handleGeolocationResponse,this),s=m(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,s,e):navigator.geolocation.getCurrentPosition(t,s,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,s=e.message||(t===1?"permission denied":t===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+s+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,s=e.coords.longitude,r=new J(t,s),o=r.toBounds(e.coords.accuracy*2),c=this._locateOptions;if(c.setView){var f=this.getBoundsZoom(o);this.setView(r,c.maxZoom?Math.min(f,c.maxZoom):f)}var _={latlng:r,bounds:o,timestamp:e.timestamp};for(var v in e.coords)typeof e.coords[v]=="number"&&(_[v]=e.coords[v]);this.fire("locationfound",_)}},addHandler:function(e,t){if(!t)return this;var s=this[e]=new t(this);return this._handlers.push(s),this.options[e]&&s.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),de(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(H(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var e;for(e in this._layers)this._layers[e].remove();for(e in this._panes)de(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var s="leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),r=X("div",s,t||this._mapPane);return e&&(this._panes[e]=r),r},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds(),t=this.unproject(e.getBottomLeft()),s=this.unproject(e.getTopRight());return new oe(t,s)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,s){e=se(e),s=z(s||[0,0]);var r=this.getZoom()||0,o=this.getMinZoom(),c=this.getMaxZoom(),f=e.getNorthWest(),_=e.getSouthEast(),v=this.getSize().subtract(s),C=ee(this.project(_,r),this.project(f,r)).getSize(),T=R.any3d?this.options.zoomSnap:1,F=v.x/C.x,U=v.y/C.y,ve=t?Math.max(F,U):Math.min(F,U);return r=this.getScaleZoom(ve,r),T&&(r=Math.round(r/(T/100))*(T/100),r=t?Math.ceil(r/T)*T:Math.floor(r/T)*T),Math.max(o,Math.min(c,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var s=this._getTopLeftPoint(e,t);return new q(s,s.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e=="string"?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var s=this.options.crs;return t=t===void 0?this._zoom:t,s.scale(e)/s.scale(t)},getScaleZoom:function(e,t){var s=this.options.crs;t=t===void 0?this._zoom:t;var r=s.zoom(e*s.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(K(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(z(e),t)},layerPointToLatLng:function(e){var t=z(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){var t=this.project(K(e))._round();return t._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(K(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(se(e))},distance:function(e,t){return this.options.crs.distance(K(e),K(t))},containerPointToLayerPoint:function(e){return z(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return z(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(z(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(K(e)))},mouseEventToContainerPoint:function(e){return en(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=Ys(e);if(t){if(t._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");$(t,"scroll",this._onScroll,this),this._containerId=g(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&R.any3d,W(e,"leaflet-container"+(R.touch?" leaflet-touch":"")+(R.retina?" leaflet-retina":"")+(R.ielt9?" leaflet-oldie":"")+(R.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var t=Pt(e,"position");t!=="absolute"&&t!=="relative"&&t!=="fixed"&&t!=="sticky"&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ue(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(W(e.markerPane,"leaflet-zoom-hide"),W(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,t,s){ue(this._mapPane,new O(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset");var o=this._zoom!==t;this._moveStart(o,s)._move(e,t)._moveEnd(o),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(e,t){return e&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(e,t,s,r){t===void 0&&(t=this._zoom);var o=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?s&&s.pinch&&this.fire("zoom",s):((o||s&&s.pinch)&&this.fire("zoom",s),this.fire("move",s)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return H(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){ue(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[g(this._container)]=this;var t=e?ae:$;t(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&t(window,"resize",this._onResize,this),R.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){H(this._resizeRequest),this._resizeRequest=B(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var s=[],r,o=t==="mouseout"||t==="mouseover",c=e.target||e.srcElement,f=!1;c;){if(r=this._targets[g(c)],r&&(t==="click"||t==="preclick")&&this._draggableMoved(r)){f=!0;break}if(r&&r.listens(t,!0)&&(o&&!qi(c,e)||(s.push(r),o))||c===this._container)break;c=c.parentNode}return!s.length&&!f&&!o&&this.listens(t,!0)&&(s=[this]),s},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type==="click"&&this._isClickDisabled(t))){var s=e.type;s==="mousedown"&&Bi(t),this._fireDOMEvent(e,s)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,s){if(e.type==="click"){var r=h({},e);r.type="preclick",this._fireDOMEvent(r,r.type,s)}var o=this._findEventTargets(e,t);if(s){for(var c=[],f=0;f0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),s=this.getMaxZoom(),r=R.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(s,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){he(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,t){var s=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(s)?!1:(this.panBy(s,t),!0)},_createAnimProxy:function(){var e=this._proxy=X("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(t){var s=Ai,r=this._proxy.style[s];Je(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),r===this._proxy.style[s]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){de(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Je(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,t,s){if(this._animatingZoom)return!0;if(s=s||{},!this._zoomAnimated||s.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),o=this._getCenterOffset(e)._divideBy(1-1/r);return s.animate!==!0&&!this.getSize().contains(o)?!1:(B(function(){this._moveStart(!0,s.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,s,r){this._mapPane&&(s&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,W(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(m(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&he(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function xa(e,t){return new Y(e,t)}var Se=Z.extend({options:{position:"topright"},initialize:function(e){j(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),s=this.getPosition(),r=e._controlCorners[s];return W(t,"leaflet-control"),s.indexOf("bottom")!==-1?r.insertBefore(t,r.firstChild):r.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(de(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),At=function(e){return new Se(e)};Y.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t="leaflet-",s=this._controlContainer=X("div",t+"control-container",this._container);function r(o,c){var f=t+o+" "+t+c;e[o+c]=X("div",f,s)}r("top","left"),r("top","right"),r("bottom","left"),r("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)de(this._controlCorners[e]);de(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var nn=Se.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,s,r){return s1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=t&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(g(e.target)),s=t.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;s&&this._map.fire(s,t)},_createRadioElement:function(e,t){var s='",r=document.createElement("div");return r.innerHTML=s,r.firstChild},_addItem:function(e){var t=document.createElement("label"),s=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement("input"),r.type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=s):r=this._createRadioElement("leaflet-base-layers_"+g(this),s),this._layerControlInputs.push(r),r.layerId=g(e.layer),$(r,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+e.name;var c=document.createElement("span");t.appendChild(c),c.appendChild(r),c.appendChild(o);var f=e.overlay?this._overlaysList:this._baseLayersList;return f.appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,s,r=[],o=[];this._handlingClick=!0;for(var c=e.length-1;c>=0;c--)t=e[c],s=this._getLayer(t.layerId).layer,t.checked?r.push(s):t.checked||o.push(s);for(c=0;c=0;o--)t=e[o],s=this._getLayer(t.layerId).layer,t.disabled=s.options.minZoom!==void 0&&rs.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,$(e,"click",xe),this.expand();var t=this;setTimeout(function(){ae(e,"click",xe),t._preventClick=!1})}}),_a=function(e,t,s){return new nn(e,t,s)},Ui=Se.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",s=X("div",t+" leaflet-bar"),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+"-in",s,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+"-out",s,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),s},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,s,r,o){var c=X("a",s,r);return c.innerHTML=e,c.href="#",c.title=t,c.setAttribute("role","button"),c.setAttribute("aria-label",t),Mt(c),$(c,"click",it),$(c,"click",o,this),$(c,"click",this._refocusOnMap,this),c},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";he(this._zoomInButton,t),he(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(W(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(W(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});Y.mergeOptions({zoomControl:!0}),Y.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ui,this.addControl(this.zoomControl))});var ya=function(e){return new Ui(e)},rn=Se.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",s=X("div",t),r=this.options;return this._addScales(r,t+"-line",s),e.on(r.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),s},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,s){e.metric&&(this._mScale=X("div",t,s)),e.imperial&&(this._iScale=X("div",t,s))},_update:function(){var e=this._map,t=e.getSize().y/2,s=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(s)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),s=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,s,t/e)},_updateImperial:function(e){var t=e*3.2808399,s,r,o;t>5280?(s=t/5280,r=this._getRoundNum(s),this._updateScale(this._iScale,r+" mi",r/s)):(o=this._getRoundNum(t),this._updateScale(this._iScale,o+" ft",o/t))},_updateScale:function(e,t,s){e.style.width=Math.round(this.options.maxWidth*s)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),s=e/t;return s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:1,t*s}}),va=function(e){return new rn(e)},ba='',Ki=Se.extend({options:{position:"bottomright",prefix:''+(R.inlineSvg?ba+" ":"")+"Leaflet"},initialize:function(e){j(this,e),this._attributions={}},onAdd:function(e){e.attributionControl=this,this._container=X("div","leaflet-control-attribution"),Mt(this._container);for(var t in e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var s=[];this.options.prefix&&s.push(this.options.prefix),e.length&&s.push(e.join(", ")),this._container.innerHTML=s.join(' ')}}});Y.mergeOptions({attributionControl:!0}),Y.addInitHook(function(){this.options.attributionControl&&new Ki().addTo(this)});var wa=function(e){return new Ki(e)};Se.Layers=nn,Se.Zoom=Ui,Se.Scale=rn,Se.Attribution=Ki,At.layers=_a,At.zoom=ya,At.scale=va,At.attribution=wa;var Ie=Z.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ie.addTo=function(e,t){return e.addHandler(t,this),this};var ja={Events:Q},an=R.touch?"touchstart mousedown":"mousedown",Ke=ge.extend({options:{clickTolerance:3},initialize:function(e,t,s,r){j(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=s},enable:function(){this._enabled||($(this._dragStartTarget,an,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ke._dragging===this&&this.finishDrag(!0),ae(this._dragStartTarget,an,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!zi(this._element,"leaflet-zoom-anim"))){if(e.touches&&e.touches.length!==1){Ke._dragging===this&&this.finishDrag();return}if(!(Ke._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Ke._dragging=this,this._preventOutline&&Bi(this._element),Di(),St(),!this._moving)){this.fire("down");var t=e.touches?e.touches[0]:e,s=Xs(this._element);this._startPoint=new O(t.clientX,t.clientY),this._startPos=et(this._element),this._parentScale=Zi(s);var r=e.type==="mousedown";$(document,r?"mousemove":"touchmove",this._onMove,this),$(document,r?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,s=new O(t.clientX,t.clientY)._subtract(this._startPoint);!s.x&&!s.y||Math.abs(s.x)+Math.abs(s.y)c&&(f=_,c=v);c>s&&(t[f]=1,Yi(e,t,s,r,f),Yi(e,t,s,f,o))}function La(e,t){for(var s=[e[0]],r=1,o=0,c=e.length;rt&&(s.push(e[r]),o=r);return ot.max.x&&(s|=2),e.yt.max.y&&(s|=8),s}function Pa(e,t){var s=t.x-e.x,r=t.y-e.y;return s*s+r*r}function zt(e,t,s,r){var o=t.x,c=t.y,f=s.x-o,_=s.y-c,v=f*f+_*_,C;return v>0&&(C=((e.x-o)*f+(e.y-c)*_)/v,C>1?(o=s.x,c=s.y):C>0&&(o+=f*C,c+=_*C)),f=e.x-o,_=e.y-c,r?f*f+_*_:new O(o,c)}function Ce(e){return!G(e[0])||typeof e[0][0]!="object"&&typeof e[0][0]<"u"}function mn(e){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ce(e)}function fn(e,t){var s,r,o,c,f,_,v,C;if(!e||e.length===0)throw new Error("latlngs not passed");Ce(e)||(console.warn("latlngs are not flat! Only the first ring will be used"),e=e[0]);var T=K([0,0]),F=se(e),U=F.getNorthWest().distanceTo(F.getSouthWest())*F.getNorthEast().distanceTo(F.getNorthWest());U<1700&&(T=Gi(e));var ve=e.length,pe=[];for(s=0;sr){v=(c-r)/o,C=[_.x-v*(_.x-f.x),_.y-v*(_.y-f.y)];break}var je=t.unproject(z(C));return K([je.lat+T.lat,je.lng+T.lng])}var Sa={__proto__:null,simplify:dn,pointToSegmentDistance:cn,closestPointOnSegment:Na,clipSegment:un,_getEdgeIntersection:ri,_getBitCode:st,_sqClosestPointOnSegment:zt,isFlat:Ce,_flat:mn,polylineCenter:fn},Xi={project:function(e){return new O(e.lng,e.lat)},unproject:function(e){return new J(e.y,e.x)},bounds:new q([-180,-90],[180,90])},Qi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(e){var t=Math.PI/180,s=this.R,r=e.lat*t,o=this.R_MINOR/s,c=Math.sqrt(1-o*o),f=c*Math.sin(r),_=Math.tan(Math.PI/4-r/2)/Math.pow((1-f)/(1+f),c/2);return r=-s*Math.log(Math.max(_,1e-10)),new O(e.lng*t*s,r)},unproject:function(e){for(var t=180/Math.PI,s=this.R,r=this.R_MINOR/s,o=Math.sqrt(1-r*r),c=Math.exp(-e.y/s),f=Math.PI/2-2*Math.atan(c),_=0,v=.1,C;_<15&&Math.abs(v)>1e-7;_++)C=o*Math.sin(f),C=Math.pow((1-C)/(1+C),o/2),v=Math.PI/2-2*Math.atan(c*C)-f,f+=v;return new J(f*t,e.x*t/s)}},Ta={__proto__:null,LonLat:Xi,Mercator:Qi,SphericalMercator:kt},Ea=h({},Me,{code:"EPSG:3395",projection:Qi,transformation:(function(){var e=.5/(Math.PI*Qi.R);return E(e,.5,-e,.5)})()}),gn=h({},Me,{code:"EPSG:4326",projection:Xi,transformation:E(1/180,1,-1/180,.5)}),Ma=h({},Pe,{projection:Xi,transformation:E(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var s=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(s*s+r*r)},infinite:!0});Pe.Earth=Me,Pe.EPSG3395=Ea,Pe.EPSG3857=ye,Pe.EPSG900913=Ue,Pe.EPSG4326=gn,Pe.Simple=Ma;var Te=ge.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[g(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[g(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var s=this.getEvents();t.on(s,this),this.once("remove",function(){t.off(s,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});Y.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=g(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=g(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return g(e)in this._layers},eachLayer:function(e,t){for(var s in this._layers)e.call(t,this._layers[s]);return this},_addLayers:function(e){e=e?G(e)?e:[e]:[];for(var t=0,s=e.length;tthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&t[0]instanceof J&&t[0].equals(t[s-1])&&t.pop(),t},_setLatLngs:function(e){Be.prototype._setLatLngs.call(this,e),Ce(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ce(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,s=new O(t,t);if(e=new q(e.min.subtract(s),e.max.add(s)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,o=this._rings.length,c;re.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(t=!t);return t||Be.prototype._containsPoint.call(this,e,!0)}});function Ba(e,t){return new ut(e,t)}var Ze=Fe.extend({initialize:function(e,t){j(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=G(e)?e:e.features,s,r,o;if(t){for(s=0,r=t.length;s0&&o.push(o[0].slice()),o}function mt(e,t){return e.feature?h({},e.feature,{geometry:t}):hi(t)}function hi(e){return e.type==="Feature"||e.type==="FeatureCollection"?e:{type:"Feature",properties:{},geometry:e}}var is={toGeoJSON:function(e){return mt(this,{type:"Point",coordinates:ts(this.getLatLng(),e)})}};ai.include(is),Ji.include(is),oi.include(is),Be.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=ci(this._latlngs,t?1:0,!1,e);return mt(this,{type:(t?"Multi":"")+"LineString",coordinates:s})}}),ut.include({toGeoJSON:function(e){var t=!Ce(this._latlngs),s=t&&!Ce(this._latlngs[0]),r=ci(this._latlngs,s?2:t?1:0,!0,e);return t||(r=[r]),mt(this,{type:(s?"Multi":"")+"Polygon",coordinates:r})}}),ct.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(s){t.push(s.toGeoJSON(e).geometry.coordinates)}),mt(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t==="MultiPoint")return this.toMultiPoint(e);var s=t==="GeometryCollection",r=[];return this.eachLayer(function(o){if(o.toGeoJSON){var c=o.toGeoJSON(e);if(s)r.push(c.geometry);else{var f=hi(c);f.type==="FeatureCollection"?r.push.apply(r,f.features):r.push(f)}}}),s?mt(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function _n(e,t){return new Ze(e,t)}var Za=_n,ui=Te.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,s){this._url=e,this._bounds=se(t),j(this,s)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(W(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){de(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&<(this._image),this},bringToBack:function(){return this._map&&dt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=se(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName==="IMG",t=this._image=e?this._url:X("img");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onload=m(this.fire,this,"load"),t.onerror=m(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(t.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),s=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Je(this._image,s,t)},_reset:function(){var e=this._image,t=new q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),s=t.getSize();ue(e,t.min),e.style.width=s.x+"px",e.style.height=s.y+"px"},_updateOpacity:function(){Ne(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),$a=function(e,t,s){return new ui(e,t,s)},yn=ui.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName==="VIDEO",t=this._image=e?this._url:X("video");if(W(t,"leaflet-image-layer"),this._zoomAnimated&&W(t,"leaflet-zoom-animated"),this.options.className&&W(t,this.options.className),t.onselectstart=b,t.onmousemove=b,t.onloadeddata=m(this.fire,this,"load"),e){for(var s=t.getElementsByTagName("source"),r=[],o=0;o0?r:[t.src];return}G(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var c=0;co?(t.height=o+"px",W(e,c)):he(e,c),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),s=this._getAnchor();ue(this._container,t.add(s))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(Pt(this._container,"marginBottom"),10)||0,s=this._container.offsetHeight+t,r=this._containerWidth,o=new O(this._containerLeft,-s-this._containerBottom);o._add(et(this._container));var c=e.layerPointToContainerPoint(o),f=z(this.options.autoPanPadding),_=z(this.options.autoPanPaddingTopLeft||f),v=z(this.options.autoPanPaddingBottomRight||f),C=e.getSize(),T=0,F=0;c.x+r+v.x>C.x&&(T=c.x+r-C.x+v.x),c.x-T-_.x<0&&(T=c.x-_.x),c.y+s+v.y>C.y&&(F=c.y+s-C.y+v.y),c.y-F-_.y<0&&(F=c.y-_.y),(T||F)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([T,F]))}},_getAnchor:function(){return z(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Va=function(e,t){return new mi(e,t)};Y.mergeOptions({closePopupOnClick:!0}),Y.include({openPopup:function(e,t,s){return this._initOverlay(mi,e,t,s).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Te.include({bindPopup:function(e,t){return this._popup=this._initOverlay(mi,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Fe||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){it(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof Ge)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var fi=Oe.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Oe.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Oe.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Oe.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip",t=e+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=X("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+g(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,s,r=this._map,o=this._container,c=r.latLngToContainerPoint(r.getCenter()),f=r.layerPointToContainerPoint(e),_=this.options.direction,v=o.offsetWidth,C=o.offsetHeight,T=z(this.options.offset),F=this._getAnchor();_==="top"?(t=v/2,s=C):_==="bottom"?(t=v/2,s=0):_==="center"?(t=v/2,s=C/2):_==="right"?(t=0,s=C/2):_==="left"?(t=v,s=C/2):f.xthis.options.maxZoom||sr?this._retainParent(o,c,f,r):!1)},_retainChildren:function(e,t,s,r){for(var o=2*e;o<2*e+2;o++)for(var c=2*t;c<2*t+2;c++){var f=new O(o,c);f.z=s+1;var _=this._tileCoordsToKey(f),v=this._tiles[_];if(v&&v.active){v.retain=!0;continue}else v&&v.loaded&&(v.retain=!0);s+1this.options.maxZoom||this.options.minZoom!==void 0&&o1){this._setView(e,s);return}for(var F=o.min.y;F<=o.max.y;F++)for(var U=o.min.x;U<=o.max.x;U++){var ve=new O(U,F);if(ve.z=this._tileZoom,!!this._isValidTile(ve)){var pe=this._tiles[this._tileCoordsToKey(ve)];pe?pe.current=!0:f.push(ve)}}if(f.sort(function(je,gt){return je.distanceTo(c)-gt.distanceTo(c)}),f.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Le=document.createDocumentFragment();for(U=0;Us.max.x)||!t.wrapLat&&(e.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return se(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,s=this.getTileSize(),r=e.scaleBy(s),o=r.add(s),c=t.unproject(r,e.z),f=t.unproject(o,e.z);return[c,f]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),s=new oe(t[0],t[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),s=new O(+t[0],+t[1]);return s.z=+t[2],s},_removeTile:function(e){var t=this._tiles[e];t&&(de(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){W(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=b,e.onmousemove=b,R.ielt9&&this.options.opacity<1&&Ne(e,this.options.opacity)},_addTile:function(e,t){var s=this._getTilePos(e),r=this._tileCoordsToKey(e),o=this.createTile(this._wrapCoords(e),m(this._tileReady,this,e));this._initTile(o),this.createTile.length<2&&B(m(this._tileReady,this,e,null,o)),ue(o,s),this._tiles[r]={el:o,coords:e,current:!0},t.appendChild(o),this.fire("tileloadstart",{tile:o,coords:e})},_tileReady:function(e,t,s){t&&this.fire("tileerror",{error:t,tile:s,coords:e});var r=this._tileCoordsToKey(e);s=this._tiles[r],s&&(s.loaded=+new Date,this._map._fadeAnimated?(Ne(s.el,0),H(this._fadeFrame),this._fadeFrame=B(this._updateOpacity,this)):(s.active=!0,this._pruneTiles()),t||(W(s.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:s.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),R.ielt9||!this._map._fadeAnimated?B(this._pruneTiles,this):setTimeout(m(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new O(this._wrapX?y(e.x,this._wrapX):e.x,this._wrapY?y(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new q(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Ka(e){return new Ot(e)}var ft=Ot.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=j(this,t),t.detectRetina&&R.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains=="string"&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var s=document.createElement("img");return $(s,"load",m(this._tileOnLoad,this,t,s)),$(s,"error",m(this._tileOnError,this,t,s)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(s.referrerPolicy=this.options.referrerPolicy),s.alt="",s.src=this.getTileUrl(e),s},getTileUrl:function(e){var t={r:R.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var s=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=s),t["-y"]=s}return S(this._url,h(t,this.options))},_tileOnLoad:function(e,t){R.ielt9?setTimeout(m(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,s){var r=this.options.errorTileUrl;r&&t.getAttribute("src")!==r&&(t.src=r),e(s,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,s=this.options.zoomReverse,r=this.options.zoomOffset;return s&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=b,t.onerror=b,!t.complete)){t.src=le;var s=this._tiles[e].coords;de(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:s})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",le),Ot.prototype._removeTile.call(this,e)},_tileReady:function(e,t,s){if(!(!this._map||s&&s.getAttribute("src")===le))return Ot.prototype._tileReady.call(this,e,t,s)}});function wn(e,t){return new ft(e,t)}var jn=ft.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var s=h({},this.defaultWmsParams);for(var r in t)r in this.options||(s[r]=t[r]);t=j(this,t);var o=t.detectRetina&&R.retina?2:1,c=this.getTileSize();s.width=c.x*o,s.height=c.y*o,this.wmsParams=s},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,ft.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),s=this._crs,r=ee(s.project(t[0]),s.project(t[1])),o=r.min,c=r.max,f=(this._wmsVersion>=1.3&&this._crs===gn?[o.y,o.x,c.y,c.x]:[o.x,o.y,c.x,c.y]).join(","),_=ft.prototype.getTileUrl.call(this,e);return _+M(this.wmsParams,_,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+f},setParams:function(e,t){return h(this.wmsParams,e),t||this.redraw(),this}});function Ga(e,t){return new jn(e,t)}ft.WMS=jn,wn.wms=Ga;var $e=Te.extend({options:{padding:.1},initialize:function(e){j(this,e),g(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),W(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var s=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,t),c=r.multiplyBy(-s).add(o).subtract(this._map._getNewPixelOrigin(e,t));R.any3d?Je(this._container,c,s):ue(this._container,c)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var e in this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),s=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new q(s,s.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),kn=$e.extend({options:{tolerance:0},getEvents:function(){var e=$e.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$e.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");$(e,"mousemove",this._onMouseMove,this),$(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),$(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){H(this._redrawRequest),delete this._ctx,de(this._container),ae(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;this._redrawBounds=null;for(var t in this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=this._container,s=e.getSize(),r=R.retina?2:1;ue(t,e.min),t.width=r*s.x,t.height=r*s.y,t.style.width=s.x+"px",t.style.height=s.y+"px",R.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){$e.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[g(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,s=t.next,r=t.prev;s?s.prev=r:this._drawLast=r,r?r.next=s:this._drawFirst=s,delete e._order,delete this._layers[g(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray=="string"){var t=e.options.dashArray.split(/[, ]+/),s=[],r,o;for(o=0;o')}}catch{}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Ya={_initContainer:function(){this._container=X("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($e.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=Dt("shape");W(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=Dt("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;de(t),e.removeInteractiveTarget(t),delete this._layers[g(e)]},_updateStyle:function(e){var t=e._stroke,s=e._fill,r=e.options,o=e._container;o.stroked=!!r.stroke,o.filled=!!r.fill,r.stroke?(t||(t=e._stroke=Dt("stroke")),o.appendChild(t),t.weight=r.weight+"px",t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=G(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=r.lineCap.replace("butt","flat"),t.joinstyle=r.lineJoin):t&&(o.removeChild(t),e._stroke=null),r.fill?(s||(s=e._fill=Dt("fill")),o.appendChild(s),s.color=r.fillColor||r.color,s.opacity=r.fillOpacity):s&&(o.removeChild(s),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),s=Math.round(e._radius),r=Math.round(e._radiusY||s);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+s+","+r+" 0,"+65535*360)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){lt(e._container)},_bringToBack:function(e){dt(e._container)}},gi=R.vml?Dt:Re,Rt=$e.extend({_initContainer:function(){this._container=gi("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=gi("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){de(this._container),ae(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){$e.prototype._update.call(this);var e=this._bounds,t=e.getSize(),s=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,s.setAttribute("width",t.x),s.setAttribute("height",t.y)),ue(s,e.min),s.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=gi("path");e.options.className&&W(t,e.options.className),e.options.interactive&&W(t,"leaflet-interactive"),this._updateStyle(e),this._layers[g(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){de(e._path),e.removeInteractiveTarget(e._path),delete this._layers[g(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,s=e.options;t&&(s.stroke?(t.setAttribute("stroke",s.color),t.setAttribute("stroke-opacity",s.opacity),t.setAttribute("stroke-width",s.weight),t.setAttribute("stroke-linecap",s.lineCap),t.setAttribute("stroke-linejoin",s.lineJoin),s.dashArray?t.setAttribute("stroke-dasharray",s.dashArray):t.removeAttribute("stroke-dasharray"),s.dashOffset?t.setAttribute("stroke-dashoffset",s.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),s.fill?(t.setAttribute("fill",s.fillColor||s.color),t.setAttribute("fill-opacity",s.fillOpacity),t.setAttribute("fill-rule",s.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,Xt(e._parts,t))},_updateCircle:function(e){var t=e._point,s=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||s,o="a"+s+","+r+" 0 1,0 ",c=e._empty()?"M0 0":"M"+(t.x-s)+","+t.y+o+s*2+",0 "+o+-s*2+",0 ";this._setPath(e,c)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){lt(e._path)},_bringToBack:function(e){dt(e._path)}});R.vml&&Rt.include(Ya);function Cn(e){return R.svg||R.vml?new Rt(e):null}Y.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e==="overlayPane"||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Nn(e)||Cn(e)}});var Ln=ut.extend({initialize:function(e,t){ut.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=se(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function Xa(e,t){return new Ln(e,t)}Rt.create=gi,Rt.pointsToPath=Xt,Ze.geometryToLayer=li,Ze.coordsToLatLng=es,Ze.coordsToLatLngs=di,Ze.latLngToCoords=ts,Ze.latLngsToCoords=ci,Ze.getFeature=mt,Ze.asFeature=hi,Y.mergeOptions({boxZoom:!0});var Pn=Ie.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){$(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ae(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){de(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),St(),Di(),this._startPoint=this._map.mouseEventToContainerPoint(e),$(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=X("div","leaflet-zoom-box",this._container),W(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new q(this._point,this._startPoint),s=t.getSize();ue(this._box,t.min),this._box.style.width=s.x+"px",this._box.style.height=s.y+"px"},_finish:function(){this._moved&&(de(this._box),he(this._container,"leaflet-crosshair")),Tt(),Ri(),ae(document,{contextmenu:it,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(m(this._resetState,this),0);var t=new oe(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Y.addInitHook("addHandler","boxZoom",Pn),Y.mergeOptions({doubleClickZoom:!0});var Sn=Ie.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,s=t.getZoom(),r=t.options.zoomDelta,o=e.originalEvent.shiftKey?s-r:s+r;t.options.doubleClickZoom==="center"?t.setZoom(o):t.setZoomAround(e.containerPoint,o)}});Y.addInitHook("addHandler","doubleClickZoom",Sn),Y.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Tn=Ie.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Ke(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}W(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){he(this._map._container,"leaflet-grab"),he(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=se(this._map.options.maxBounds);this._offsetLimit=ee(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,s=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(s),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.xt.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),s=this._initialWorldOffset,r=this._draggable._newPos.x,o=(r-t+s)%e+t-s,c=(r+t+s)%e-t-s,f=Math.abs(o+s)0?c:-c))-t;this._delta=0,this._startTime=null,f&&(e.options.scrollWheelZoom==="center"?e.setZoom(t+f):e.setZoomAround(this._lastMousePos,t+f))}});Y.addInitHook("addHandler","scrollWheelZoom",Mn);var Qa=600;Y.mergeOptions({tapHold:R.touchNative&&R.safari&&R.mobile,tapTolerance:15});var An=Ie.extend({addHooks:function(){$(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ae(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new O(t.clientX,t.clientY),this._holdTimeout=setTimeout(m(function(){this._cancel(),this._isTapValid()&&($(document,"touchend",xe),$(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),Qa),$(document,"touchend touchcancel contextmenu",this._cancel,this),$(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){ae(document,"touchend",xe),ae(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),ae(document,"touchend touchcancel contextmenu",this._cancel,this),ae(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new O(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var s=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});s._simulated=!0,t.target.dispatchEvent(s)}});Y.addInitHook("addHandler","tapHold",An),Y.mergeOptions({touchZoom:R.touch,bounceAtZoomLimits:!0});var zn=Ie.extend({addHooks:function(){W(this._map._container,"leaflet-touch-zoom"),$(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){he(this._map._container,"leaflet-touch-zoom"),ae(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!=="center"&&(this._pinchStartLatLng=t.containerPointToLatLng(s.add(r)._divideBy(2))),this._startDist=s.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),$(document,"touchmove",this._onTouchMove,this),$(document,"touchend touchcancel",this._onTouchEnd,this),xe(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,s=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),o=s.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(o,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoomt.getMaxZoom()&&o>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom==="center"){if(this._center=this._startLatLng,o===1)return}else{var c=s._add(r)._divideBy(2)._subtract(this._centerPoint);if(o===1&&c.x===0&&c.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(c),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),H(this._animRequest);var f=m(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=B(f,this,!0),xe(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,H(this._animRequest),ae(document,"touchmove",this._onTouchMove,this),ae(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Y.addInitHook("addHandler","touchZoom",zn),Y.BoxZoom=Pn,Y.DoubleClickZoom=Sn,Y.Drag=Tn,Y.Keyboard=En,Y.ScrollWheelZoom=Mn,Y.TapHold=An,Y.TouchZoom=zn,a.Bounds=q,a.Browser=R,a.CRS=Pe,a.Canvas=kn,a.Circle=Ji,a.CircleMarker=oi,a.Class=Z,a.Control=Se,a.DivIcon=bn,a.DivOverlay=Oe,a.DomEvent=pa,a.DomUtil=fa,a.Draggable=Ke,a.Evented=ge,a.FeatureGroup=Fe,a.GeoJSON=Ze,a.GridLayer=Ot,a.Handler=Ie,a.Icon=ht,a.ImageOverlay=ui,a.LatLng=J,a.LatLngBounds=oe,a.Layer=Te,a.LayerGroup=ct,a.LineUtil=Sa,a.Map=Y,a.Marker=ai,a.Mixin=ja,a.Path=Ge,a.Point=O,a.PolyUtil=ka,a.Polygon=ut,a.Polyline=Be,a.Popup=mi,a.PosAnimation=sn,a.Projection=Ta,a.Rectangle=Ln,a.Renderer=$e,a.SVG=Rt,a.SVGOverlay=vn,a.TileLayer=ft,a.Tooltip=fi,a.Transformation=Nt,a.Util=re,a.VideoOverlay=yn,a.bind=m,a.bounds=ee,a.canvas=Nn,a.circle=Ra,a.circleMarker=Da,a.control=At,a.divIcon=Ua,a.extend=h,a.featureGroup=za,a.geoJSON=_n,a.geoJson=Za,a.gridLayer=Ka,a.icon=Ia,a.imageOverlay=$a,a.latLng=K,a.latLngBounds=se,a.layerGroup=Aa,a.map=xa,a.marker=Oa,a.point=z,a.polygon=Ba,a.polyline=Fa,a.popup=Va,a.rectangle=Xa,a.setOptions=j,a.stamp=g,a.svg=Cn,a.svgOverlay=Wa,a.tileLayer=wn,a.tooltip=qa,a.transformation=E,a.version=d,a.videoOverlay=Ha;var Ja=window.L;a.noConflict=function(){return window.L=Ja,this},window.L=a}))})(Bt,Bt.exports)),Bt.exports}var Ci=xd();function Ps(n,l,a){return Object.freeze({instance:n,context:l,container:a})}function Ss(n,l){return l==null?function(d,h){const u=k.useRef();return u.current||(u.current=n(d,h)),u}:function(d,h){const u=k.useRef();u.current||(u.current=n(d,h));const m=k.useRef(d),{instance:p}=u.current;return k.useEffect(function(){m.current!==d&&(l(p,d,m.current),m.current=d)},[p,d,h]),u}}function zr(n,l){k.useEffect(function(){return(l.layerContainer??l.map).addLayer(n.instance),function(){var u;(u=l.layerContainer)==null||u.removeLayer(n.instance),l.map.removeLayer(n.instance)}},[l,n])}function _d(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Er(d.map,a.attribution),Ls(h.current,a.eventHandlers),zr(h.current,d),h}}function yd(n,l){const a=k.useRef();k.useEffect(function(){if(l.pathOptions!==a.current){const h=l.pathOptions??{};n.instance.setStyle(h),a.current=h}},[n,l])}function vd(n){return function(a){const d=Cs(),h=n(Ni(a,d),d);return Ls(h.current,a.eventHandlers),zr(h.current,d),yd(h.current,a),h}}function bd(n,l){const a=Ss(n),d=gd(a,l);return md(d)}function wd(n,l){const a=Ss(n,l),d=vd(a);return ud(d)}function jd(n,l){const a=Ss(n,l),d=_d(a);return fd(d)}function kd(n,l,a){const{opacity:d,zIndex:h}=l;d!=null&&d!==a.opacity&&n.setOpacity(d),h!=null&&h!==a.zIndex&&n.setZIndex(h)}const Nd=wd(function({center:l,children:a,...d},h){const u=new Ci.CircleMarker(l,d);return Ps(u,hd(h,{overlayContainer:u}))},ld);function gs(){return gs=Object.assign||function(n){for(var l=1;l(N==null?void 0:N.map)??null,[N]);const j=k.useCallback(D=>{if(D!==null&&N===null){const S=new Ci.Map(D,y);a!=null&&w!=null?S.setView(a,w):n!=null&&S.fitBounds(n,l),g!=null&&S.whenReady(g),P(cd(S))}},[]);k.useEffect(()=>()=>{N==null||N.map.remove()},[N]);const M=N?$t.createElement(Ar,{value:N},d):m??null;return $t.createElement("div",gs({},x,{ref:j}),M)}const Ld=k.forwardRef(Cd),Pd=bd(function(l,a){const d=new Ci.Popup(l,a.overlayContainer);return Ps(d,a)},function(l,a,{position:d},h){k.useEffect(function(){const{instance:m}=l;function p(w){w.popup===m&&(m.update(),h(!0))}function g(w){w.popup===m&&h(!1)}return a.map.on({popupopen:p,popupclose:g}),a.overlayContainer==null?(d!=null&&m.setLatLng(d),m.openOn(a.map)):a.overlayContainer.bindPopup(m),function(){var y;a.map.off({popupopen:p,popupclose:g}),(y=a.overlayContainer)==null||y.unbindPopup(),a.map.removeLayer(m)}},[l,a,h,d])}),Sd=jd(function({url:l,...a},d){const h=new Ci.TileLayer(l,Ni(a,d));return Ps(h,d)},function(l,a,d){kd(l,a,d);const{url:h}=a;h!=null&&h!==d.url&&l.setUrl(h)}),Td=({profile:n})=>{var m,p,g,w;if(!((p=(m=n==null?void 0:n.geospatial)==null?void 0:m.sample_points)!=null&&p.length))return i.jsx(Kt,{icon:i.jsx(cs,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Geospatial Data",description:"No latitude/longitude columns were detected in the dataset."});const l=n.geospatial,a=!!n.target_col,d=Gt(l.sample_points??[],a?"label":void 0),h=d.map(({label:y,color:b})=>({label:y,color:b,shape:"circle"})),u=[[l.min_lat,l.min_lon],[l.max_lat,l.max_lon]];return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(cs,{className:"w-5 h-5 mr-2 text-blue-500"}),"Geospatial Analysis",i.jsx(_e,{text:"Visualizes data points on a map based on detected Latitude/Longitude columns. Colors indicate target values."})]}),i.jsxs("div",{className:"text-sm text-gray-500",children:["Detected columns: ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lat_col}),", ",i.jsx("span",{className:"font-mono bg-gray-100 dark:bg-gray-900 px-1 rounded",children:n.geospatial.lon_col})]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2 min-w-0",children:[i.jsx("div",{className:"h-96 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 relative z-0",children:i.jsxs(Ld,{bounds:u,style:{height:"100%",width:"100%"},scrollWheelZoom:!0,children:[i.jsx(Sd,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'Β© OpenStreetMap contributors'}),d.flatMap(y=>y.points.map((b,x)=>i.jsx(Nd,{center:[b.lat,b.lon],radius:5,pathOptions:{color:a?y.color:"#3b82f6",fillColor:a?y.color:"#3b82f6",fillOpacity:.7,weight:1},children:i.jsx(Pd,{children:i.jsxs("div",{className:"text-xs",children:[i.jsx("strong",{children:"Lat:"})," ",b.lat.toFixed(4),i.jsx("br",{}),i.jsx("strong",{children:"Lon:"})," ",b.lon.toFixed(4),i.jsx("br",{}),a&&i.jsxs(i.Fragment,{children:[i.jsxs("strong",{children:[n.target_col,":"]})," ",y.label]})]})})},JSON.stringify([y.value,x]))))]},`${l.lat_col??""}-${l.lon_col??""}-${u.flat().join(",")}`)}),a&&i.jsx(Ns,{entries:h})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Spatial Bounds"}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Latitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lat.toFixed(4)," to ",n.geospatial.max_lat.toFixed(4)]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-xs text-gray-400",children:"Longitude Range"}),i.jsxs("span",{className:"font-mono",children:[n.geospatial.min_lon.toFixed(4)," to ",n.geospatial.max_lon.toFixed(4)]})]})]})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-3",children:"Centroid"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),i.jsxs("span",{className:"font-mono text-sm",children:[((g=n.geospatial.centroid_lat)==null?void 0:g.toFixed(4))??"β€”",", ",((w=n.geospatial.centroid_lon)==null?void 0:w.toFixed(4))??"β€”"]})]})]}),i.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 dark:bg-blue-900/20 p-3 rounded-md border border-blue-100 dark:border-blue-800",children:[i.jsx(jt,{className:"w-4 h-4 text-blue-500 mt-0.5 shrink-0"}),i.jsx("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:i.jsxs("p",{children:["This scatter plot shows the spatial distribution of your data.",!!n.target_col&&" Points are colored by the target variable."]})})]})]})]})]})},Ed=({profile:n,downloadChart:l,history:a,loading:d,loadSpecificReport:h,report:u})=>{var b;const[m,p]=k.useState("idle"),g=at(),w=k.useCallback(()=>{p("done"),setTimeout(()=>p("idle"),1200)},[]),y=async()=>{if(n!=null&&n.target_interactions){p("downloading");try{const x=wr(),N=n.target_interactions,P=400,j=800,M=40,D=2,S=Math.ceil(N.length/D),G=D*j+(D+1)*M,fe=S*(P+M)+100,le=document.createElement("canvas");le.width=G,le.height=fe;const ne=le.getContext("2d");if(!ne)return;ne.fillStyle=x.bgColor,ne.fillRect(0,0,le.width,le.height),ne.fillStyle=x.textColor,ne.font="bold 24px sans-serif",ne.textAlign="center",ne.fillText("Detailed Interactions (Box Plots)",G/2,50);for(let A=0;A{ce.onload=()=>{ne.drawImage(ce,ie,Q+30,j,P-50),URL.revokeObjectURL(q),ee()},ce.onerror=()=>{URL.revokeObjectURL(q),ee()},ce.src=q})}const we=document.createElement("a");we.download="all-interactions.png",we.href=le.toDataURL("image/png"),we.click()}finally{w()}}};return i.jsxs("div",{className:"mt-4 grid grid-cols-1 lg:grid-cols-4 gap-6",children:[i.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Target Analysis: ",i.jsx("span",{className:"ml-2 text-blue-600",children:n.target_col}),i.jsx(_e,{text:"Analyzes relationships between the target variable and other features. Shows top correlations and key drivers."})]}),i.jsx("button",{onClick:()=>l("target-analysis-chart","target-analysis",`Target Analysis: ${n.target_col}`,"Top Associated Features"),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-4",children:"Top Associated Features"}),i.jsx("div",{className:"h-64 w-full",id:"target-analysis-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:Object.entries(n.target_correlations).slice(0,10).map(([x,N])=>({name:x,value:N})),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!1,stroke:g.gridColor}),i.jsx(Xe,{type:"number",domain:[0,1],tick:{fontSize:12,fill:g.axisColor}}),i.jsx(Qe,{type:"category",dataKey:"name",width:120,tick:{fontSize:12,fill:g.axisColor}}),i.jsx(He,{contentStyle:g.tooltipContentStyle,itemStyle:g.tooltipItemStyle,labelStyle:g.tooltipLabelStyle,formatter:x=>[x.toFixed(3),"Association"]}),i.jsx(Nr,{x:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"value",fill:"#3b82f6",radius:[0,4,4,0],barSize:20})]})})})]}),i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-md",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500 mb-2",children:"Key Insights"}),i.jsxs("ul",{className:"space-y-2 text-sm",children:[i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Target is ",i.jsx("strong",{children:(b=n.columns[n.target_col])==null?void 0:b.dtype})]})]}),i.jsxs("li",{className:"flex items-start",children:[i.jsx("span",{className:"mr-2 text-blue-500",children:"β€’"}),i.jsxs("span",{children:["Strongest predictor: ",i.jsx("strong",{children:Object.keys(n.target_correlations)[0]||"None"}),Object.values(n.target_correlations)[0]!==void 0&&i.jsxs(i.Fragment,{children:[" (",Object.values(n.target_correlations)[0].toFixed(2),")"]})]})]})]})]})]})]}),n.target_interactions&&n.target_interactions.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Detailed Interactions (Box Plots)",i.jsx(_e,{text:"Shows distribution of values across categories. The box represents the middle 50% of data (Q1 to Q3). The line inside is the median."})]}),i.jsx("button",{onClick:y,disabled:m!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download All Charts","aria-label":"Download All Charts",children:m==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):m==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6",children:[i.jsx("span",{className:"font-semibold",children:"ANOVA Analysis:"})," A p-value < 0.05 (highlighted in green) indicates that the feature varies significantly across the target categories, making it a strong predictor."]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:n.target_interactions.map((x,N)=>i.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg border border-gray-100 dark:border-gray-800 relative group",children:[i.jsx("div",{className:"absolute top-2 right-2 opacity-100",children:i.jsx("button",{onClick:()=>l(`interaction-chart-${N}`,`interaction-${x.feature}`,`${x.feature} vs ${n.target_col}`,x.p_value!==void 0?`ANOVA p: ${Number(x.p_value).toExponential(2)}`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"text-center mb-2",children:[i.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[x.feature," vs ",n.target_col]}),x.p_value!==void 0&&x.p_value!==null&&i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full inline-block mt-1 ${x.p_value<.05?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:["ANOVA p: ",Number(x.p_value).toExponential(2)]})]}),i.jsx("div",{className:"h-64 w-full",id:`interaction-chart-${N}`,children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Uo,{data:x.data.map(P=>({...P,boxBottom:P.stats.q1,boxHeight:P.stats.q3-P.stats.q1})),margin:{top:20,right:30,left:20,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:g.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:g.axisColor}}),i.jsx(Qe,{domain:["auto","auto"],tick:{fontSize:11,fill:g.axisColor}}),i.jsx(He,{cursor:{fill:"transparent"},content:({active:P,payload:j})=>{if(P&&j&&j.length){const M=j[0].payload;return i.jsxs("div",{style:g.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg z-50",children:[i.jsx("p",{className:"font-semibold mb-1",children:M.name}),i.jsxs("p",{children:["Max: ",M.stats.max.toFixed(2)]}),i.jsxs("p",{children:["Q3: ",M.stats.q3.toFixed(2)]}),i.jsxs("p",{children:["Median: ",M.stats.median.toFixed(2)]}),i.jsxs("p",{children:["Q1: ",M.stats.q1.toFixed(2)]}),i.jsxs("p",{children:["Min: ",M.stats.min.toFixed(2)]})]})}return null}}),i.jsx(Ve,{dataKey:"boxBottom",stackId:"a",fill:"transparent",legendType:"none"}),i.jsx(Ve,{dataKey:"boxHeight",stackId:"a",fill:"#8884d8",fillOpacity:.6,name:"IQR (Q1-Q3)"}),i.jsx(rs,{name:"Median",dataKey:"stats.median",fill:"#ff7300",shape:"square"}),i.jsx(rs,{name:"Max",dataKey:"stats.max",fill:"#82ca9d",shape:"cross"}),i.jsx(rs,{name:"Min",dataKey:"stats.min",fill:"#82ca9d",shape:"cross"})]})})}),i.jsx("p",{className:"text-xs text-center text-gray-400 mt-2",children:"* Box: Q1-Q3. Orange square: Median. Green crosses: Min/Max."})]},N))})]})]}),i.jsx("div",{className:"lg:col-span-1",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm h-fit sticky top-4",children:[i.jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ls,{className:"w-4 h-4 mr-2"}),"Analysis History"]}),d&&i.jsx(be,{className:"w-3 h-3 animate-spin text-blue-500"})]}),i.jsx("div",{className:"space-y-2 max-h-[500px] overflow-y-auto",children:a.length===0?i.jsx("p",{className:"text-xs text-gray-500 italic",children:"No previous analyses found."}):a.slice(0,10).map(x=>i.jsxs("button",{onClick:()=>!d&&h(x.id),disabled:d,className:`w-full text-left p-3 rounded-md text-sm border transition-colors ${u&&u.id===x.id?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-gray-50 border-gray-100 text-gray-600 hover:bg-gray-100 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800"} ${d?"opacity-50 cursor-not-allowed":""}`,children:[i.jsx("div",{className:"font-medium truncate",children:x.target_col?`Target: ${x.target_col}`:"General Analysis"}),i.jsx("div",{className:"text-xs opacity-70 mt-1",children:new Date(x.created_at).toLocaleString()}),i.jsx("div",{className:"mt-1",children:i.jsx(br,{status:x.status})})]},x.id))})]})})]})},Md=({profile:n,downloadChart:l})=>{var d,h;const a=at();return i.jsxs("div",{className:"mt-4 space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(ys,{className:"w-5 h-5 mr-2 text-blue-500"}),"Trend Analysis (",n.timeseries.date_col,")",i.jsx(_e,{text:"Shows how values change over time. Look for long-term trends (up/down) or sudden shifts."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[n.timeseries.stationarity_test&&i.jsxs("div",{className:`text-xs px-3 py-1 rounded-full border flex items-center gap-1 ${n.timeseries.stationarity_test.is_stationary?"bg-green-50 border-green-200 text-green-700 dark:bg-green-900/20 dark:border-green-800 dark:text-green-300":"bg-yellow-50 border-yellow-200 text-yellow-700 dark:bg-yellow-900/20 dark:border-yellow-800 dark:text-yellow-300"}`,children:[i.jsx(_e,{text:"Augmented Dickey-Fuller Test. Stationary (p<0.05) means the data has constant mean/variance over time. Non-Stationary (p>=0.05) means it has a trend or seasonality."}),i.jsx("span",{className:"font-semibold",children:"ADF Test:"})," ",n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary",i.jsxs("span",{className:"opacity-75 ml-1",children:["(p=",n.timeseries.stationarity_test.p_value.toFixed(3),")"]})]}),i.jsx("button",{onClick:()=>l("trend-chart","trend-analysis","Trend Analysis",`Date Column: ${n.timeseries.date_col}`,n.timeseries.stationarity_test?`ADF Test: ${n.timeseries.stationarity_test.is_stationary?"Stationary":"Non-Stationary"} (p=${n.timeseries.stationarity_test.p_value.toFixed(3)})`:void 0),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx("div",{className:"h-80 w-full",id:"trend-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(Ko,{data:n.timeseries.trend,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"date",tick:{fontSize:12,fill:a.axisColor},minTickGap:30}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle}),i.jsx(kr,{}),Object.keys(((d=n.timeseries.trend[0])==null?void 0:d.values)||{}).map((u,m)=>i.jsx(Fn,{type:"monotone",dataKey:`values.${u}`,name:u,stroke:We[m%We.length],dot:!1,strokeWidth:2},u)),(!((h=n.timeseries.trend[0])!=null&&h.values)||Object.keys(n.timeseries.trend[0].values).length===0)&&i.jsx(Fn,{type:"monotone",dataKey:"count",stroke:"#3b82f6",dot:!1})]})})})]}),i.jsx("div",{className:"grid grid-cols-1 gap-6",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("day-seasonality-chart","day-seasonality","Day of Week Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Day of Week Seasonality"}),i.jsx(_e,{text:"Average values for each day. Helps identify weekly patterns (e.g., lower on weekends)."})]}),i.jsx("div",{className:"h-64 w-full",id:"day-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.day_of_week,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"day",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#8884d8",radius:[4,4,0,0]})]})})})]})}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsx("div",{className:"absolute top-4 right-4 opacity-100 z-10",children:i.jsx("button",{onClick:()=>l("month-seasonality-chart","month-seasonality","Monthly Seasonality"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})}),i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Monthly Seasonality"}),i.jsx(_e,{text:"Average values for each month. Helps identify yearly patterns or seasonal effects."})]}),i.jsx("div",{className:"h-64 w-full",id:"month-seasonality-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.seasonality.month_of_year,children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"month",tick:{fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"count",fill:"#82ca9d",radius:[4,4,0,0]})]})})})]}),n.timeseries.autocorrelation&&n.timeseries.autocorrelation.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm relative group",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-500",children:"Autocorrelation (Lag Analysis)"}),i.jsxs("div",{className:"group relative ml-2",children:[i.jsx(jt,{className:"w-4 h-4 text-gray-400 cursor-help"}),i.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-full mb-2 w-64 p-2 bg-gray-800 text-white text-xs rounded shadow-lg opacity-0 group-hover:opacity-100 transition-opacity z-50 pointer-events-none text-center",children:["Shows how much the current value depends on past values (lags). High bars indicate repeating patterns or seasonality.",i.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-800"})]})]})]}),i.jsx("button",{onClick:()=>l("autocorrelation-chart","autocorrelation","Autocorrelation (Lag Analysis)"),className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm",title:"Download Chart","aria-label":"Download Chart",children:i.jsx(ke,{className:"w-3 h-3"})})]}),i.jsx("div",{className:"h-80 w-full pb-6",id:"autocorrelation-chart",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:n.timeseries.autocorrelation,margin:{bottom:20},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"lag",tick:{fontSize:12,fill:a.axisColor},label:{value:"Lag (Days)",position:"insideBottom",offset:-15,fontSize:12,fill:a.axisColor}}),i.jsx(Qe,{domain:[-1,1],tick:{fill:a.axisColor}}),i.jsx(He,{contentStyle:a.tooltipContentStyle,itemStyle:a.tooltipItemStyle,labelStyle:a.tooltipLabelStyle,cursor:{fill:"transparent"},formatter:u=>[u.toFixed(3),"Correlation"]}),i.jsx(Nr,{y:0,stroke:"#9ca3af"}),i.jsx(Ve,{dataKey:"corr",fill:"#f59e0b",radius:[2,2,0,0]})]})})})]})]})},Ad=({profile:n,onBarClick:l})=>{const a=at(),{data:d,typeMatched:h}=k.useMemo(()=>{var p;if(!n)return{data:[],typeMatched:!1};const m=n.dtype;return m==="Numeric"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(2)}`,fullName:`${Number(g.start).toFixed(2)} - ${Number(g.end).toFixed(2)}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Text"&&n.histogram?{data:n.histogram.map(g=>({name:`${Number(g.start).toFixed(0)}`,fullName:`${Number(g.start).toFixed(0)} - ${Number(g.end).toFixed(0)} chars`,count:g.count,rawBin:g})),typeMatched:!0}:m==="DateTime"&&n.histogram?{data:n.histogram.map(g=>({name:new Date(g.start).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),fullName:`${new Date(g.start).toLocaleDateString()} - ${new Date(g.end).toLocaleDateString()}`,count:g.count,rawBin:g})),typeMatched:!0}:m==="Categorical"&&((p=n.categorical_stats)!=null&&p.top_k)?{data:n.categorical_stats.top_k.map(g=>({name:String(g.value).substring(0,15)+(String(g.value).length>15?"...":""),fullName:String(g.value),count:g.count,value:g.value})),typeMatched:!0}:{data:[],typeMatched:!1}},[n]);if(!n)return null;if(!h)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No distribution data available for this type"});if(d.length===0)return i.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-sm italic p-4 text-center",children:"No data points"});const u=n.dtype;return i.jsxs("div",{className:"w-full h-full flex flex-col",children:[i.jsxs("div",{className:"flex-1 w-full min-h-[250px] relative",children:[n.normality_test&&i.jsxs("div",{className:"absolute top-0 right-0 bg-white/90 dark:bg-gray-800/90 p-2 rounded border border-gray-200 dark:border-gray-700 text-xs z-10 shadow-sm",children:[i.jsxs("div",{className:"font-semibold text-gray-700 dark:text-gray-300 mb-1 flex items-center",children:["Normality Test (",n.normality_test.test_name,")",i.jsx(_e,{text:"Normality tests are performed on a sample of up to 5,000 rows. Shapiro-Wilk is used for smaller datasets (<5,000), and Kolmogorov-Smirnov for larger ones. For very large datasets, rely on Skewness and Kurtosis.",align:"right"})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"p-value:"}),i.jsx("span",{className:`font-mono ${n.normality_test.is_normal?"text-green-600":"text-red-500"}`,children:n.normality_test.p_value.toExponential(2)})]}),i.jsx("div",{className:"mt-1 text-[10px] text-gray-400",children:n.normality_test.is_normal?"Likely Normal Distribution":"Likely Not Normal"})]}),i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:d,margin:{top:5,right:30,left:20,bottom:30},children:[i.jsx(Ye,{strokeDasharray:"3 3",vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{dataKey:"name",tick:{fontSize:11,fill:a.axisColor},interval:"preserveStartEnd",angle:-45,textAnchor:"end"}),i.jsx(Qe,{tick:{fontSize:11,fill:a.axisColor}}),i.jsx(He,{content:({active:m,payload:p})=>{if(m&&p&&p.length){const g=p[0].payload;return i.jsxs("div",{style:a.tooltipContentStyle,className:"text-xs p-2 rounded shadow-lg",children:[i.jsx("p",{className:"font-semibold mb-1",children:g.fullName}),i.jsxs("p",{children:["Count: ",g.count]}),l&&i.jsx("p",{className:"text-blue-300 mt-1 italic",children:"Click to filter"})]})}return null}}),i.jsx(Ve,{dataKey:"count",radius:[4,4,0,0],onClick:m=>l&&l(m),className:l?"cursor-pointer hover:opacity-80":"",children:d.map((m,p)=>i.jsx(js,{fill:u==="Numeric"?"#3b82f6":"#8b5cf6"},`cell-${p}`))})]})})]}),i.jsx(ki,{caption:`Distribution data table for ${n.name}`,filename:`${n.name}-distribution`,columns:[{key:"fullName",label:"Bin / Value"},{key:"count",label:"Count"}],rows:d.map(m=>({fullName:m.fullName,count:m.count}))})]})};var zd=Symbol.for("react.lazy"),vi=wo[" use ".trim().toString()];function Id(n){return typeof n=="object"&&n!==null&&"then"in n}function Ir(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===zd&&"_payload"in n&&Id(n._payload)}function Od(n){const l=Rd(n),a=k.forwardRef((d,h)=>{let{children:u,...m}=d;Ir(u)&&typeof vi=="function"&&(u=vi(u._payload));const p=k.Children.toArray(u),g=p.find(Bd);if(g){const w=g.props.children,y=p.map(b=>b===g?k.Children.count(w)>1?k.Children.only(null):k.isValidElement(w)?w.props.children:null:b);return i.jsx(l,{...m,ref:h,children:k.isValidElement(w)?k.cloneElement(w,void 0,y):null})}return i.jsx(l,{...m,ref:h,children:u})});return a.displayName=`${n}.Slot`,a}var Dd=Od("Slot");function Rd(n){const l=k.forwardRef((a,d)=>{let{children:h,...u}=a;if(Ir(h)&&typeof vi=="function"&&(h=vi(h._payload)),k.isValidElement(h)){const m=$d(h),p=Zd(u,h.props);return h.type!==k.Fragment&&(p.ref=d?Eo(d,m):m),k.cloneElement(h,p)}return k.Children.count(h)>1?k.Children.only(null):null});return l.displayName=`${n}.SlotClone`,l}var Fd=Symbol("radix.slottable");function Bd(n){return k.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Fd}function Zd(n,l){const a={...l};for(const d in l){const h=n[d],u=l[d];/^on[A-Z]/.test(d)?h&&u?a[d]=(...p)=>{const g=u(...p);return h(...p),g}:h&&(a[d]=h):d==="style"?a[d]={...h,...u}:d==="className"&&(a[d]=[h,u].filter(Boolean).join(" "))}return{...n,...a}}function $d(n){var d,h;let l=(d=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:d.get,a=l&&"isReactWarning"in l&&l.isReactWarning;return a?n.ref:(l=(h=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:h.get,a=l&&"isReactWarning"in l&&l.isReactWarning,a?n.props.ref:n.props.ref||n.ref)}const qn=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Un=Cr,Or=(n,l)=>a=>{var d;if((l==null?void 0:l.variants)==null)return Un(n,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:h,defaultVariants:u}=l,m=Object.keys(h).map(w=>{const y=a==null?void 0:a[w],b=u==null?void 0:u[w];if(y===null)return null;const x=qn(y)||qn(b);return h[w][x]}),p=a&&Object.entries(a).reduce((w,y)=>{let[b,x]=y;return x===void 0||(w[b]=x),w},{}),g=l==null||(d=l.compoundVariants)===null||d===void 0?void 0:d.reduce((w,y)=>{let{class:b,className:x,...N}=y;return Object.entries(N).every(P=>{let[j,M]=P;return Array.isArray(M)?M.includes({...u,...p}[j]):{...u,...p}[j]===M})?[...w,b,x]:w},[]);return Un(n,m,g,a==null?void 0:a.class,a==null?void 0:a.className)},Hd=Or("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"action-primary",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"action-secondary",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Vt=k.forwardRef(({className:n,variant:l,size:a,asChild:d=!1,...h},u)=>{const m=d?Dd:"button";return i.jsx(m,{className:Hd({variant:l,size:a,className:n}),ref:u,...h})});Vt.displayName="Button";function Dr(...n){return Mo(Cr(n))}const Wd=Or("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rt({className:n,variant:l,...a}){return i.jsx("div",{className:Dr(Wd({variant:l}),n),...a})}function Vd({profile:n}){var a;let l=[];return n.histogram?l=n.histogram.map(d=>({name:String(d.start),count:d.count})):(a=n.categorical_stats)!=null&&a.top_k&&(l=n.categorical_stats.top_k.slice(0,10).map(d=>({name:String(d.value),count:d.count}))),i.jsxs("div",{className:"flex items-center justify-between w-full pr-4",children:[i.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground mr-auto",children:[i.jsx(qd,{profile:n}),i.jsx(Ud,{profile:n})]}),l.length>0&&i.jsx("div",{className:"h-8 w-24 hidden sm:block opacity-70",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsx(nt,{data:l,children:i.jsx(Ve,{dataKey:"count",fill:n.dtype==="Numeric"?"#3b82f6":n.dtype==="Categorical"?"#8b5cf6":"#10b981",radius:[1,1,0,0]})})})})]})}function qd({profile:n}){var l,a,d,h,u;return i.jsx(i.Fragment,{children:n.numeric_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Mean: ",i.jsx("span",{className:"font-mono text-foreground",children:(l=n.numeric_stats.mean)==null?void 0:l.toFixed(2)})]}),i.jsxs("span",{children:["Std: ",i.jsx("span",{className:"font-mono text-foreground",children:(a=n.numeric_stats.std)==null?void 0:a.toFixed(2)})]}),i.jsxs("span",{children:["Min: ",i.jsx("span",{className:"font-mono text-foreground",children:(d=n.numeric_stats.min)==null?void 0:d.toFixed(2)})]}),i.jsxs("span",{children:["Max: ",i.jsx("span",{className:"font-mono text-foreground",children:(h=n.numeric_stats.max)==null?void 0:h.toFixed(2)})]})]}):n.categorical_stats?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:["Unique: ",i.jsx("span",{className:"font-mono text-foreground",children:n.categorical_stats.unique_count})]}),((u=n.categorical_stats.top_k)==null?void 0:u[0])&&i.jsxs("span",{children:["Top: ",i.jsx("span",{className:"font-mono text-foreground",children:String(n.categorical_stats.top_k[0].value).slice(0,20)})]})]}):null})}function Ud({profile:n}){return i.jsxs(i.Fragment,{children:[n.normality_test&&n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20",children:"Normal Dist"}),n.normality_test&&!n.normality_test.is_normal&&i.jsx(rt,{variant:"outline",className:"text-[10px] h-4 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20",children:"Not Normal"})]})}function Kd({profile:n}){return i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("span",{className:"font-medium text-sm truncate",children:n.name}),i.jsx(rt,{variant:"outline",className:`text-[10px] h-5 px-1 ${_l(n.dtype)}`,children:n.dtype}),n.is_unique&&i.jsx(rt,{variant:"secondary",className:"text-[10px] h-5",children:"ID"}),n.is_constant&&i.jsx(rt,{variant:"destructive",className:"text-[10px] h-5",children:"Constant"})]})}function Gd({profile:n,isExcluded:l,onToggleExclude:a}){return i.jsxs("div",{className:"flex items-center gap-4 px-2",children:[i.jsxs("div",{className:"flex flex-col items-end w-24",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:n.missing_percentage>0?`${n.missing_percentage.toFixed(1)}% Missing`:"100% Present"}),i.jsx(_e,{text:"Green bar indicates the percentage of valid (non-null) data. Full green means no missing values.",align:"end",size:"sm"})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-100 dark:bg-gray-800 rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${n.missing_percentage>0?"bg-amber-400":"bg-green-500"}`,style:{width:`${Math.max(100-n.missing_percentage,0)}%`}})})]}),i.jsx("div",{className:"h-8 w-[1px] bg-border mx-2"}),i.jsx(Vt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground",onClick:d=>{d.stopPropagation(),a(n.name,!l)},title:l?"Include in analysis":"Exclude from analysis","aria-label":l?"Include in analysis":"Exclude from analysis",children:l?i.jsx(Ut,{size:16}):i.jsx(pr,{size:16})})]})}function Yd({profile:n}){return i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Statistics"}),i.jsxs("div",{className:"bg-background rounded-md border p-3 text-sm space-y-2 font-mono",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Missing"}),i.jsxs("span",{children:[n.missing_count," (",n.missing_percentage.toFixed(2),"%)"]})]}),n.numeric_stats&&i.jsx(Xd,{stats:n.numeric_stats,vif:n.vif}),n.text_stats&&i.jsx(ec,{stats:n.text_stats}),n.categorical_stats&&i.jsx(tc,{stats:n.categorical_stats})]})]})}function Xd({stats:n,vif:l}){var a,d,h,u,m,p,g,w;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mean"}),i.jsx("span",{children:(a=n.mean)==null?void 0:a.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Std Dev"}),i.jsx("span",{children:(d=n.std)==null?void 0:d.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Variance"}),i.jsx("span",{children:((h=n.variance)==null?void 0:h.toFixed(4))||Math.pow(n.std||0,2).toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min"}),i.jsx("span",{children:(u=n.min)==null?void 0:u.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"25% (Q1)"}),i.jsx("span",{children:(m=n.q25)==null?void 0:m.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Median"}),i.jsx("span",{children:(p=n.median)==null?void 0:p.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"75% (Q3)"}),i.jsx("span",{children:(g=n.q75)==null?void 0:g.toFixed(4)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max"}),i.jsx("span",{children:(w=n.max)==null?void 0:w.toFixed(4)})]}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Qd,{stats:n}),i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx(Jd,{stats:n,vif:l})]})}function Qd({stats:n}){var l,a;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Skewness"}),i.jsx("span",{children:(l=n.skewness)==null?void 0:l.toFixed(4)})]}),n.skewness!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.skewness)<.5?"↳ Symmetric":Math.abs(n.skewness)<1?"↳ Moderately Skewed":"↳ Highly Skewed"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Kurtosis"}),i.jsx("span",{children:(a=n.kurtosis)==null?void 0:a.toFixed(4)})]}),n.kurtosis!=null&&i.jsx("div",{className:"text-[10px] text-muted-foreground pl-2",children:Math.abs(n.kurtosis)<.5?"↳ Mesokurtic (Normal-like)":n.kurtosis>0?"↳ Leptokurtic (Heavy Tails)":"↳ Platykurtic (Light Tails)"})]})}function Jd({stats:n,vif:l}){return i.jsxs(i.Fragment,{children:[n.zeros_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Zeros"}),i.jsx("span",{children:n.zeros_count})]}),n.negatives_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Negatives"}),i.jsx("span",{children:n.negatives_count})]}),l!=null&&i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:["VIF",i.jsx(_e,{text:"Variance Inflation Factor. VIF > 5 = high multicollinearity, VIF > 10 = severe.",size:"sm"})]}),i.jsx("span",{className:l>5?"text-red-500 font-semibold":l>2?"text-amber-500":"text-green-500",children:l.toFixed(2)})]})]})}function ec({stats:n}){var l;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Avg Length"}),i.jsxs("span",{children:[(l=n.avg_length)==null?void 0:l.toFixed(1)," chars"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Min Length"}),i.jsx("span",{children:n.min_length})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Max Length"}),i.jsx("span",{children:n.max_length})]}),n.sentiment_distribution&&i.jsx(ic,{distribution:n.sentiment_distribution}),n.common_words&&n.common_words.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Common Words"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:n.common_words.slice(0,10).map((a,d)=>i.jsxs(rt,{variant:"secondary",className:"text-[10px] h-4",children:[a.word??a.value," (",a.count,")"]},d))})]})]})}function tc({stats:n}){var l,a,d,h;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Unique"}),i.jsx("span",{children:n.unique_count})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Mode"}),i.jsx("span",{className:"truncate max-w-[100px]",title:String((a=(l=n.top_k)==null?void 0:l[0])==null?void 0:a.value),children:String(((h=(d=n.top_k)==null?void 0:d[0])==null?void 0:h.value)||"-")})]}),n.rare_labels_count!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:"Rare Labels"}),i.jsx("span",{children:n.rare_labels_count})]}),n.top_k&&n.top_k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Top Categories"}),i.jsx("div",{className:"space-y-1",children:n.top_k.slice(0,5).map((u,m)=>i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsx("span",{className:"truncate max-w-[120px]",title:String(u.value),children:String(u.value)}),i.jsx("span",{className:"text-muted-foreground",children:u.count})]},m))})]})]})}function ic({distribution:n}){const l=n.positive||0,a=n.neutral||0,d=n.negative||0;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"my-2 border-t border-dashed"}),i.jsx("div",{className:"text-xs font-semibold mb-1",children:"Sentiment"}),i.jsxs("div",{className:"flex h-3 rounded-full overflow-hidden w-full bg-secondary",children:[i.jsx("div",{className:"bg-green-500 h-full",style:{width:`${l*100}%`},title:`Positive: ${(l*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-gray-400 h-full",style:{width:`${a*100}%`},title:`Neutral: ${(a*100).toFixed(1)}%`}),i.jsx("div",{className:"bg-red-500 h-full",style:{width:`${d*100}%`},title:`Negative: ${(d*100).toFixed(1)}%`})]}),i.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1 px-1",children:[i.jsxs("span",{children:["Pos: ",(l*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neu: ",(a*100).toFixed(0),"%"]}),i.jsxs("span",{children:["Neg: ",(d*100).toFixed(0),"%"]})]})]})}const Kn=({profile:n,isExpanded:l,onToggleExpand:a,onToggleExclude:d,isExcluded:h,handleAddFilter:u})=>{const m=k.useRef(null),[p,g]=k.useState("idle"),w=async()=>{if(m.current){g("downloading");try{const b=document.documentElement.classList.contains("dark"),x=await ws(m.current,{backgroundColor:b?"#1f2937":"#ffffff",pixelRatio:2}),N=document.createElement("a");N.href=x,N.download=`${n.name}_distribution.png`,N.click()}catch(b){console.error("Failed to download chart",b),Wt.error("Chart download failed",String(b))}finally{g("done"),setTimeout(()=>g("idle"),1200)}}},y=b=>{if(n.dtype==="Categorical"||n.dtype==="Boolean"){const x=b.value!==void 0?b.value:b.name;u(n.name,x,"==")}else n.dtype==="Numeric"&&b.rawBin&&u(n.name,b.rawBin.start,">=")};return i.jsxs("div",{className:`border rounded-lg mb-2 transition-all ${l?"border-primary/50 shadow-md bg-card/50":"border-border bg-card"}`,children:[i.jsxs("div",{className:"flex items-center p-3 hover:bg-accent/50 cursor-pointer rounded-t-lg",...ji(a),children:[i.jsx("div",{className:"mr-2 text-muted-foreground",children:l?i.jsx(wi,{size:18}):i.jsx(gr,{size:18})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx(Kd,{profile:n}),!l&&i.jsx(Vd,{profile:n})]}),i.jsx(Gd,{profile:n,isExcluded:h,onToggleExclude:d})]}),l&&i.jsx("div",{className:"p-4 border-t border-border bg-card/30 animate-in slide-in-from-top-2 duration-200",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 items-stretch",children:[i.jsx(Yd,{profile:n}),i.jsxs("div",{className:"md:col-span-2 flex flex-col min-h-[300px]",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Distribution"}),i.jsx(Vt,{size:"icon",variant:"outline",className:"h-8 w-8",title:"Download Chart",onClick:w,disabled:p!=="idle",children:p==="downloading"?i.jsx(be,{size:16,className:"animate-spin"}):p==="done"?i.jsx(Ht,{size:16,className:"text-green-500"}):i.jsx(ke,{size:16})})]}),i.jsx("div",{className:"flex-1 bg-background rounded-md border p-4 min-h-0",ref:m,children:i.jsx(Ad,{profile:n,onBarClick:y})})]})]})})]})},Rr=k.forwardRef(({className:n,type:l,...a},d)=>i.jsx("input",{type:l,className:Dr("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:d,...a}));Rr.displayName="Input";const sc=({profile:n,handleToggleExclude:l,handleAddFilter:a})=>{const[d,h]=k.useState(""),[u,m]=k.useState(new Set);Ao(()=>m(new Set),u.size>0);const p=x=>{const N=new Set(u);N.has(x)?N.delete(x):N.add(x),m(N)},g=()=>{m(new Set(Object.keys(n.columns)))},w=()=>{m(new Set)},y=Object.values(n.columns).filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),b=(n.excluded_columns??[]).filter(x=>x.toLowerCase().includes(d.toLowerCase()));return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4 bg-card p-2 rounded-lg border",children:[i.jsxs("div",{className:"relative flex-1 max-w-sm",children:[i.jsx(jo,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none z-10"}),i.jsx(Rr,{placeholder:"Search variables...",className:"pl-8 h-9",value:d,onChange:x=>h(x.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Vt,{variant:"outline",size:"sm",onClick:g,className:"h-9 text-xs",children:"Expand All"}),i.jsx(Vt,{variant:"outline",size:"sm",onClick:w,className:"h-9 text-xs",children:"Collapse All"})]}),i.jsxs("div",{className:"ml-auto text-sm text-muted-foreground px-2",children:["Showing ",y.length," of ",Object.keys(n.columns).length," variables"]})]}),i.jsxs("div",{className:"space-y-2",children:[y.map(x=>i.jsx(Kn,{profile:x,isExpanded:u.has(x.name),onToggleExpand:()=>p(x.name),onToggleExclude:l,isExcluded:!1,handleAddFilter:a},x.name)),b.length>0&&i.jsxs("div",{className:"mt-8",children:[i.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2 text-muted-foreground",children:["Excluded Variables ",i.jsx(rt,{variant:"secondary",children:b.length})]}),b.map(x=>i.jsx(Kn,{profile:{name:x,dtype:"Excluded",missing_count:0,missing_percentage:0},isExpanded:u.has(x),onToggleExpand:()=>p(x),onToggleExclude:l,isExcluded:!0,handleAddFilter:a},x))]})]})]})};function nc({profile:n,scatterX:l,scatterY:a,scatterZ:d,scatterColor:h,is3D:u}){return i.jsx(i.Fragment,{children:l&&a?u&&d?i.jsx(Sr,{data:n.sample_data??[],xKey:l,yKey:a,zKey:d,labelKey:h||void 0,xLabel:l,yLabel:a,zLabel:d}):i.jsx(Tr,{data:n.sample_data??[],xKey:l,yKey:a,labelKey:h||void 0,xLabel:l,yLabel:a}):i.jsx("div",{className:"h-64 flex items-center justify-center bg-gray-50 dark:bg-gray-900 rounded text-gray-400 text-sm",children:"Select X and Y variables to generate scatter plot."})})}const rc=({profile:n,downloadChart:l,scatterX:a,setScatterX:d,scatterY:h,setScatterY:u,scatterZ:m,setScatterZ:p,scatterColor:g,setScatterColor:w,is3D:y,setIs3D:b})=>{const x=k.useMemo(()=>(n==null?void 0:n.sample_data)??[],[n==null?void 0:n.sample_data]),N=k.useMemo(()=>Pr(Gt(x,g||void 0)),[x,g]),P=k.useMemo(()=>{const S=[{key:a,label:a||"X"},{key:h,label:h||"Y"}];return y&&m&&S.push({key:m,label:m}),g&&S.push({key:g,label:g}),S},[a,h,m,g,y]),j=k.useMemo(()=>x.map(S=>S),[x]);if(!(n!=null&&n.columns)||!(n!=null&&n.sample_data))return i.jsx(Kt,{icon:i.jsx(Zt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Data Available",description:"Sample data is required for bivariate analysis."});const M=!!(a&&h&&n.sample_data.length>0),D=M?"Download Chart":"Select X and Y variables to enable download";return i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(Zt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Bivariate Analysis (Scatter Plot)",i.jsx(_e,{text:"Visualize the relationship between two numeric variables."})]}),i.jsx("button",{disabled:!M,onClick:()=>l("bivariate-chart","bivariate-analysis","Bivariate Analysis",`${a} vs ${h}`),className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:D,"aria-label":D,children:i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-6 items-end",children:[i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"X Axis"}),i.jsxs("select",{value:a,onChange:S=>d(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Y Axis"}),i.jsxs("select",{value:h,onChange:S=>u(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),y&&i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Z Axis"}),i.jsxs("select",{value:m,onChange:S=>p(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"Select Variable"}),Object.values(n.columns).filter(S=>S.dtype==="Numeric").map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Color By"}),i.jsxs("select",{value:g,onChange:S=>w(S.target.value),className:"block w-full sm:w-48 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm p-2 border dark:bg-slate-700 dark:border-slate-600 dark:text-white",children:[i.jsx("option",{value:"",children:"None"}),Object.values(n.columns).map(S=>i.jsx("option",{value:S.name,children:S.name},S.name))]})]}),i.jsx("button",{onClick:()=>b(!y),className:`p-2 rounded-md border transition-colors ${y?"bg-blue-50 border-blue-200 text-blue-700 dark:bg-blue-900/20 dark:border-blue-800 dark:text-blue-300":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300"}`,title:"Toggle 3D View","aria-label":"Toggle 3D View",children:i.jsx(_r,{className:"w-5 h-5"})})]}),i.jsx("div",{id:"bivariate-chart",children:i.jsx(nc,{profile:n,scatterX:a,scatterY:h,scatterZ:m,scatterColor:g,is3D:y})}),g&&N.length>0&&i.jsx(Ns,{entries:N}),i.jsx(ki,{caption:"Bivariate scatter plot data",filename:"bivariate-analysis",columns:P,rows:j})]})},ac=({profile:n})=>{var l,a;return(a=(l=n==null?void 0:n.outliers)==null?void 0:l.top_outliers)!=null&&a.length?i.jsxs("div",{className:"mt-4 bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[i.jsx(_i,{className:"w-5 h-5 mr-2 text-red-500"}),"Outlier Analysis (",n.outliers.method,")",i.jsx(_e,{text:"Detects anomalous rows using Isolation Forest. Lower scores indicate higher anomaly."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-6",children:[i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Total Outliers"}),i.jsx("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:n.outliers.total_outliers})]}),i.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-100 dark:border-red-800",children:[i.jsx("span",{className:"text-sm text-red-600 dark:text-red-400 block mb-1",children:"Percentage"}),i.jsxs("span",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:[n.outliers.outlier_percentage.toFixed(2),"%"]})]})]}),i.jsx("h4",{className:"text-md font-medium text-gray-900 dark:text-white mb-3",children:"Top Anomalous Rows"}),i.jsx("div",{className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Row Index"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Anomaly Score"}),i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Why is this an outlier?"}),n.outliers.top_outliers[0]&&Object.keys(n.outliers.top_outliers[0].values??{}).slice(0,5).map(d=>i.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:d},d))]})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.outliers.top_outliers.map(d=>{var h;return i.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-gray-500",children:d.index}),i.jsx("td",{className:"px-4 py-3 text-sm font-mono text-red-600",children:((h=d.score)==null?void 0:h.toFixed(4))??"β€”"}),i.jsx("td",{className:"px-4 py-3 text-sm",children:d.explanation?i.jsx("div",{className:"space-y-1",children:d.explanation.map((u,m)=>i.jsxs("div",{className:"text-xs",children:[i.jsxs("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:[u.feature,":"]})," ",i.jsx("span",{className:"text-red-600 dark:text-red-400",children:u.value.toFixed(2)})," ",i.jsxs("span",{className:"text-gray-400",children:["(Median: ",u.median.toFixed(2),", Diff: ",u.diff_pct.toFixed(0),"%)"]})]},m))}):i.jsx("span",{className:"text-gray-400 text-xs",children:"No explanation available"})}),Object.entries(d.values??{}).slice(0,5).map(([u,m])=>i.jsx("td",{className:"px-4 py-3 text-sm text-gray-900 dark:text-gray-300",children:typeof m=="number"?m.toFixed(2):String(m)},u))]},d.index)})})]})})]}):i.jsx(Kt,{icon:i.jsx(_i,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Outlier Data",description:"Outlier analysis did not return any results."})},oc=n=>{if(n===null||Number.isNaN(n))return"rgba(243, 244, 246, 1)";const l=Math.max(.4,Math.abs(n));return n>0?`rgba(239, 68, 68, ${l})`:`rgba(59, 130, 246, ${l})`},lc=()=>i.jsxs("div",{className:"mb-4 flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",role:"img","aria-label":"Correlation color scale from negative one (blue) through zero (white) to positive one (red)",children:[i.jsx("span",{children:"βˆ’1"}),i.jsx("div",{className:"h-3 w-40 rounded-sm border border-gray-200 dark:border-gray-700",style:{background:"linear-gradient(to right, rgba(59,130,246,1), rgba(59,130,246,0.4), rgba(243,244,246,1), rgba(239,68,68,0.4), rgba(239,68,68,1))"},"aria-hidden":"true"}),i.jsx("span",{children:"0"}),i.jsx("span",{className:"w-6"}),i.jsx("span",{children:"+1"}),i.jsx("span",{className:"ml-2 italic text-gray-500 dark:text-gray-400",children:"Negative (blue) Β· Positive (red)"})]}),Gn=({data:n})=>{const a=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(0,20),[n]),d=k.useMemo(()=>((n==null?void 0:n.values)??[]).slice(0,20).map(p=>p.slice(0,20)),[n]),h=k.useMemo(()=>((n==null?void 0:n.columns)??[]).slice(20),[n]),u=k.useMemo(()=>n!=null&&n.columns?n.columns.map((p,g)=>{const w={variable:p};return n.columns.forEach((y,b)=>{var x;w[y]=((x=n.values[g])==null?void 0:x[b])??null}),w}):[],[n]);if(!n||!n.columns)return i.jsx("div",{children:"No correlation data available"});const m=n.columns.length>20;return i.jsxs("div",{className:"overflow-x-auto p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsx(lc,{}),m&&i.jsxs("div",{className:"mb-4 p-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-800 dark:text-yellow-200 text-sm rounded-md",children:["Showing the first ",20," of ",n.columns.length," columns (",h.length," omitted: ",h.slice(0,5).join(", "),h.length>5?", …":"","). Use the data table below for the full matrix."]}),i.jsx("div",{className:"inline-block min-w-full",children:i.jsxs("div",{className:"grid gap-1",style:{gridTemplateColumns:`100px repeat(${a.length}, minmax(50px, 1fr))`,paddingTop:"4.5rem"},children:[i.jsx("div",{className:"p-2"}),a.map((p,g)=>i.jsx("div",{className:"relative p-2 text-xs font-medium text-gray-700 dark:text-gray-300",title:p,children:i.jsx("span",{className:"absolute bottom-1 left-1/2 whitespace-nowrap origin-bottom-left",style:{transform:"rotate(-45deg)"},children:p})},g)),a.map((p,g)=>i.jsxs($t.Fragment,{children:[i.jsx("div",{className:"p-2 text-xs font-medium truncate text-right pr-4 text-gray-700 dark:text-gray-300",title:p,children:p}),(d[g]??[]).map((w,y)=>i.jsx("div",{className:"h-10 w-full flex items-center justify-center text-[10px] text-gray-900 dark:text-gray-100 rounded-sm cursor-help transition-opacity hover:opacity-80",style:{backgroundColor:oc(w)},title:`${p} vs ${a[y]}: ${w!==null?w.toFixed(3):"N/A"}`,children:w!==null?w.toFixed(2):""},y))]},g))]})}),i.jsx(ki,{caption:"Full correlation matrix data table",filename:"correlation-matrix",columns:[{key:"variable",label:"Variable"},...n.columns.map(p=>({key:p,label:p}))],rows:u})]})};function ps({target:n,reason:l}){if(!n||!l)return null;const a={categorical:`The selected target β€œ${n}” is treated as categorical and is omitted from numeric-only causal discovery and Pearson correlations. Use Target Analysis for categorical associations.`,excluded:`The selected target β€œ${n}” is excluded from this report's analysis.`,unsupported:`The selected target β€œ${n}” is not supported by numeric-only causal discovery or Pearson correlations.`};return i.jsx("p",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:a[l]})}const dc=({profile:n})=>{const[l,a]=k.useState(null),[d,h]=k.useState(null);if(!(n!=null&&n.correlations))return i.jsxs(i.Fragment,{children:[i.jsx(ps,{target:n==null?void 0:n.target_col,reason:n==null?void 0:n.causal_target_exclusion_reason}),i.jsx(Kt,{icon:i.jsx(yt,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Correlation Data",description:"Not enough numeric columns to compute correlations."})]});const u=async(m,p,g)=>{if(m){a(g);try{const w=wr(),y=20,b=m.columns.slice(0,y),x=m.values.slice(0,y).map(A=>A.slice(0,y)),N=60,P=document.createElement("canvas"),j=P.getContext("2d");if(!j)return;j.font="12px sans-serif";let M=0;b.forEach(A=>{const I=j.measureText(A).width;I>M&&(M=I)});const D=M+40,S=M*.7+60,G=60,fe=D+b.length*N+50,le=S+b.length*N+G+50;P.width=fe,P.height=le,j.fillStyle=w.bgColor,j.fillRect(0,0,fe,le),j.fillStyle=w.textColor,j.font="bold 24px sans-serif",j.textAlign="center",j.fillText(p,fe/2,40);const ne=A=>{if(A===null)return w.bgColor==="#ffffff"?"#f3f4f6":"#374151";const I=Math.max(.2,Math.abs(A));return A>0?`rgba(239, 68, 68, ${I})`:`rgba(59, 130, 246, ${I})`};j.font="12px sans-serif",j.textBaseline="middle",x.forEach((A,I)=>{j.fillStyle=w.textColor,j.textAlign="right",j.fillText(b[I],D-10,S+G+I*N+N/2),A.forEach((V,B)=>{const H=D+B*N,re=S+G+I*N;j.fillStyle=ne(V),j.fillRect(H,re,N-2,N-2),V!==null&&(j.fillStyle=Math.abs(V)>.5?"#ffffff":w.textColor,j.textAlign="center",j.fillText(V.toFixed(2),H+N/2,re+N/2))})}),j.save(),b.forEach((A,I)=>{const V=D+I*N+N/2,B=S+G-10;j.translate(V,B),j.rotate(-Math.PI/4),j.fillStyle=w.textColor,j.textAlign="left",j.fillText(A,0,0),j.rotate(Math.PI/4),j.translate(-V,-B)}),j.restore();const we=document.createElement("a");we.download=g,we.href=P.toDataURL("image/png"),we.click()}finally{a(null),h(g),setTimeout(()=>h(null),1200)}}};return i.jsxs("div",{className:"space-y-8",children:[i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason}),i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-blue-500"}),"Feature Correlations (Multicollinearity)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation between features only. Use this to detect redundant variables (multicollinearity)."}),i.jsx("button",{onClick:()=>u(n.correlations,"Feature Correlations","feature-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="feature-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="feature-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations})]}),n.correlations_with_target&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(yt,{className:"w-5 h-5 mr-2 text-green-500"}),"Target Correlations (Feature Selection)"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{text:"Correlation including the target variable. Use this to identify the most predictive features."}),i.jsx("button",{onClick:()=>u(n.correlations_with_target,"Target Correlations","target-correlations.png"),disabled:l!==null,className:"p-1.5 rounded-md bg-white border border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-700 shadow-sm disabled:opacity-50",title:"Download Matrix","aria-label":"Download Matrix",children:l==="target-correlations.png"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):d==="target-correlations.png"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]})]}),i.jsx(Gn,{data:n.correlations_with_target})]})]})},cc=({profile:n,excludedCols:l,handleToggleExclude:a})=>{var h;if(!((h=n==null?void 0:n.sample_data)!=null&&h.length))return i.jsx(Kt,{icon:i.jsx(mr,{className:"w-12 h-12 text-slate-300 dark:text-slate-600"}),title:"No Sample Data",description:"No sample rows available for this dataset."});const d=Object.keys(n.sample_data[0]||{}).filter(u=>!l.includes(u)&&!u.endsWith("_encoded"));return i.jsxs("div",{className:"mt-4 overflow-x-auto bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[i.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[i.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900",children:i.jsx("tr",{children:d.map(u=>i.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider group",children:i.jsxs("div",{className:"flex items-center gap-2",children:[u,i.jsx("button",{onClick:m=>{m.stopPropagation(),a(u,!0)},className:"p-1 rounded transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 hover:bg-red-100 text-gray-400 hover:text-red-500 dark:hover:bg-red-900/30",title:"Exclude from analysis","aria-label":"Exclude from analysis",children:i.jsx(Ut,{className:"w-3 h-3"})})]})},u))})}),i.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:n.sample_data.slice(0,50).map((u,m)=>i.jsx("tr",{children:d.map((p,g)=>i.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:u[p]!==null?String(u[p]):i.jsx("span",{className:"italic text-gray-400",children:"null"})},g))},m))})]}),n.sample_data.length>50&&i.jsxs("div",{className:"p-4 text-center text-sm text-gray-500 border-t border-gray-200 dark:border-gray-700",children:["Showing first 50 rows of ",n.sample_data.length," sample rows."]})]})},xs=150,Yn=40,hc=()=>{const n=document.documentElement.classList.contains("dark");return{borderRadius:"5px",padding:"10px",width:xs,textAlign:"center",borderWidth:"1px",borderStyle:"solid",backgroundColor:n?"#222529":"#ffffff",color:n?"#f3f4f6":"#17102b",borderColor:n?"#666d77":"#b9b3c8"}},uc=n=>{const l=document.documentElement.classList.contains("dark");return n==="directed"?l?"#9acbfa":"#3b4bc4":l?"#abafb7":"#6b6485"},mc=(n,l)=>{const a={type:os.ArrowClosed,color:l};return n==="bidirected"?{markerStart:a,markerEnd:a}:n==="directed"?{markerEnd:a}:{}},fc=({graph:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),[p,g]=k.useState(0);k.useEffect(()=>{const y=new MutationObserver(()=>{g(b=>b+1)});return y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>y.disconnect()},[]);const w=k.useCallback((y,b)=>{try{const x=new yi.graphlib.Graph;return x.setDefaultEdgeLabel(()=>({})),x.setGraph({rankdir:"LR",nodesep:80,ranksep:200}),y.forEach(P=>{x.setNode(P.id,{width:xs,height:Yn})}),b.forEach(P=>{x.setEdge(P.source,P.target)}),yi.layout(x),{nodes:y.map(P=>{const j=x.node(P.id);return j?{...P,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:j.x-xs/2,y:j.y-Yn/2}}:{...P,position:{x:Math.random()*500,y:Math.random()*500}}}),edges:b}}catch(x){return console.error("Dagre layout failed:",x),{nodes:y.map((P,j)=>({...P,position:{x:j%3*250,y:Math.floor(j/3)*100}})),edges:b}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0){a([]),u([]);return}const y=new Map(n.nodes.map((P,j)=>[P.id,`causal-node-${j}`])),b=n.nodes.map((P,j)=>({id:`causal-node-${j}`,data:{label:P.label},position:{x:0,y:0},style:hc()})),x=n.edges.flatMap((P,j)=>{const M=y.get(P.source),D=y.get(P.target);if(M===void 0||D===void 0)return[];const S=uc(P.type);return[{id:`e${j}`,source:M,target:D,animated:!0,type:"default",label:P.type==="directed"?"causes":P.type==="bidirected"?"confounded":"related",labelStyle:{fill:"hsl(var(--foreground))",fontSize:12},labelBgStyle:{fill:"hsl(var(--card))"},style:{stroke:S,strokeDasharray:P.type==="directed"?"0":"5 5"},...mc(P.type,S)}]}),N=w(b,x);a(N.nodes),u(N.edges)},[n,w,a,u,p]),i.jsx("div",{className:"space-y-2",children:i.jsx("div",{style:{width:"100%",height:"500px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900"}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})})})};function gc(n){switch(n){case"all":return"This graph includes all eligible numeric variables; no feature cap was needed.";case"target_correlation":return"This graph includes the selected numeric target and up to 14 numeric features with the strongest absolute Pearson correlations to it.";case"variance":return"This graph includes up to 15 of the highest-variance numeric variables; no eligible numeric target was used for selection.";default:return"Causal discovery is limited to up to 15 numeric variables. Selection details were not recorded for this report."}}const pc=({profile:n})=>{var m;const l=n.causal_graph,[a,d]=k.useState("idle"),h=k.useCallback(()=>{const p=document.querySelector("#causal-chart .react-flow__viewport");if(!p)return;d("downloading");const w=document.documentElement.classList.contains("dark")?"#111827":"#f9fafb";ws(p,{backgroundColor:w,pixelRatio:2,filter:y=>{const b=y==null?void 0:y.classList;return b?!b.contains("react-flow__controls")&&!b.contains("react-flow__minimap"):!0}}).then(y=>{const b=document.createElement("a");b.download="causal-discovery.png",b.href=y,b.click()}).catch(y=>{console.error("Causal graph download failed",y),Wt.error("Causal graph download failed",String(y))}).finally(()=>{d("done"),setTimeout(()=>d("idle"),1200)})},[]),u=i.jsx(ps,{target:n.target_col,reason:n.causal_target_exclusion_reason});return(m=l==null?void 0:l.nodes)!=null&&m.length?i.jsx("div",{className:"space-y-6 mt-4",children:i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center",children:[i.jsx(wt,{className:"w-5 h-5 mr-2 text-purple-500"}),"Causal Discovery (PC Algorithm)",i.jsx(_e,{text:"Inferred causal structure using the Peter-Clark algorithm. Arrows (A->B) suggest A causes B. Lines (A-B) suggest correlation without clear direction. Bidirected arrows (A<->B) suggest a hidden common cause."})]}),i.jsx("button",{onClick:h,disabled:a!=="idle",className:"p-2 rounded-md border bg-white border-gray-300 text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-300 disabled:opacity-50",title:"Download Chart",children:a==="downloading"?i.jsx(be,{className:"w-4 h-4 animate-spin"}):a==="done"?i.jsx(Ht,{className:"w-4 h-4 text-green-500"}):i.jsx(ke,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"mb-4 text-sm text-gray-600 dark:text-gray-400 bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded border border-yellow-200 dark:border-yellow-800",children:[i.jsx("strong",{children:"Disclaimer:"})," This graph is inferred purely from observational data. Correlation does not imply causation. Use this as a hypothesis generation tool, not absolute truth."]}),u,i.jsx("div",{id:"causal-chart",children:i.jsx(fc,{graph:l})}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:gc(l.selection_method)})]})}):i.jsxs("div",{className:"p-8 text-center text-gray-500",children:[i.jsx(wt,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"No causal graph available. This might be because there are fewer than 2 numeric columns or the analysis failed."}),u]})},Xn=220,Qn=100;function xc(n,l){if(n.feature===void 0||n.threshold===void 0)return"";const a=l==null?void 0:l[n.feature];if(a){const d=a.filter((h,u)=>u<=n.threshold);return`${n.feature} in [${d.join(", ")}]`}return`${n.feature} <= ${n.threshold.toFixed(2)}`}const _c=({data:n})=>{const l=n.is_leaf,a=n.value.reduce((u,m)=>u+m,0),d=n.value.length>0?Math.max(...n.value):0,h=a>0?d/a*100:0;return i.jsxs("div",{className:`px-4 py-3 shadow-md rounded-md border-2 ${l?"border-green-500 bg-green-50 dark:bg-green-900/20":"border-blue-500 bg-white dark:bg-gray-800"} min-w-[200px]`,children:[i.jsx(Rn,{type:"target",position:vt.Left,className:"w-3 h-3 !bg-gray-400"}),i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("div",{className:"font-bold text-sm text-gray-900 dark:text-white border-b pb-1 mb-1",children:l?i.jsxs("span",{className:"flex items-center gap-2 text-green-700 dark:text-green-400",children:[i.jsx(lr,{className:"w-4 h-4"}),"Prediction: ",n.class_name]}):i.jsxs("span",{className:"flex items-center gap-2 text-blue-700 dark:text-blue-400",children:[i.jsx(ko,{className:"w-4 h-4"}),xc(n,n.categories)]})}),i.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 space-y-1",children:[i.jsxs(jr,{children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Samples:"})}),i.jsx(ms,{children:i.jsx("p",{children:"The number of data points that fall into this rule bucket."})})]}),i.jsx("span",{className:"font-mono",children:n.samples})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsx("span",{className:"cursor-help border-b border-dotted border-gray-400",children:"Purity:"})}),i.jsx(ms,{children:i.jsx("p",{className:"max-w-xs",children:"The percentage of samples in this node that belong to the majority class. Higher purity means a clearer separation."})})]}),i.jsxs("span",{className:`font-mono ${h>80?"text-green-600 font-bold":""}`,children:[h.toFixed(1),"%"]})]})]}),i.jsx("div",{className:"w-full h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full mt-1 overflow-hidden flex",children:n.value.map((u,m)=>i.jsx("div",{style:{width:`${a>0?u/a*100:0}%`,backgroundColor:`hsl(${m*137.5}, 70%, 50%)`},title:`Class ${m}: ${u}`},m))})]})]}),i.jsx(Rn,{type:"source",position:vt.Right,className:"w-3 h-3 !bg-gray-400"})]})},yc={decision:_c},vc=({tree:n})=>{const[l,a,d]=er([]),[h,u,m]=tr([]),p=k.useCallback((g,w)=>{try{const y=new yi.graphlib.Graph;return y.setDefaultEdgeLabel(()=>({})),y.setGraph({rankdir:"LR",nodesep:50,ranksep:150}),g.forEach(x=>{y.setNode(x.id,{width:Xn,height:Qn})}),w.forEach(x=>{y.setEdge(x.source,x.target)}),yi.layout(y),{nodes:g.map(x=>{const N=y.node(x.id);return{...x,targetPosition:vt.Left,sourcePosition:vt.Right,position:{x:N?N.x-Xn/2:0,y:N?N.y-Qn/2:0}}}),edges:w}}catch(y){return console.error("Dagre layout failed:",y),{nodes:g,edges:w}}},[]);return k.useEffect(()=>{if(!n||!n.nodes||n.nodes.length===0)return;const g=n.nodes.map(b=>({id:b.id.toString(),type:"decision",data:{...b,categories:n.categories},position:{x:0,y:0}})),w=[];n.nodes.forEach(b=>{b.children&&b.children.length>0&&(b.children[0]!==void 0&&w.push({id:`e${b.id}-${b.children[0]}`,source:b.id.toString(),target:b.children[0].toString(),label:"True",type:"smoothstep",style:{stroke:"#22c55e",strokeWidth:2},labelStyle:{fill:"#22c55e",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#22c55e"}}),b.children[1]!==void 0&&w.push({id:`e${b.id}-${b.children[1]}`,source:b.id.toString(),target:b.children[1].toString(),label:"False",type:"smoothstep",style:{stroke:"#ef4444",strokeWidth:2},labelStyle:{fill:"#ef4444",fontWeight:700},markerEnd:{type:os.ArrowClosed,color:"#ef4444"}}))});const y=p(g,w);a(y.nodes),u(y.edges)},[n,p,a,u]),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{style:{width:"100%",height:"600px"},className:"border rounded-lg bg-gray-50 dark:bg-gray-900 relative",children:i.jsxs(ir,{nodes:l,edges:h,onNodesChange:d,onEdgesChange:m,nodeTypes:yc,fitView:!0,className:"dark:bg-gray-900",children:[i.jsx(sr,{className:"dark:bg-gray-900",gap:16,size:1}),i.jsx(nr,{className:"dark:bg-gray-800 dark:text-white dark:border-gray-700"})]})}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 italic flex items-center gap-1",children:[i.jsx(jt,{className:"w-3 h-3"}),"This tree is a ",i.jsx("strong",{children:"surrogate (explanatory) model"})," trained on your data to surface readable rules. Do not treat it as a production-grade predictor. Green paths mean the condition is met (True); red paths mean it is not (False)."]})]})},bc=({profile:n})=>{const l=n==null?void 0:n.rule_tree,a=at();return l?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[i.jsx(ds,{className:"w-5 h-5 text-blue-600"}),"Decision Tree Analysis"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:["This is a ",i.jsx("strong",{children:"surrogate model"}),": a simple decision tree trained on your dataset to approximate the relationship between features and the target. Use it for interpretation (human-readable rules), not as a causal claim or a production model."]})]}),l.accuracy&&i.jsx(jr,{children:i.jsxs(hs,{children:[i.jsx(us,{asChild:!0,children:i.jsxs("div",{className:"text-sm bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 px-3 py-1 rounded-full border border-blue-200 dark:border-blue-800 cursor-help",children:["Tree Fidelity: ",i.jsxs("strong",{children:[(l.accuracy*100).toFixed(1),"%"]})]})}),i.jsx(ms,{children:i.jsxs("p",{className:"max-w-xs",children:[i.jsx("strong",{children:"Tree Fidelity:"})," How closely this surrogate tree matches the patterns in your data (higher is better). If fidelity is low, treat extracted rules as exploratory."]})})]})})]}),i.jsx(vc,{tree:l})]}),l.feature_importances&&l.feature_importances.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsxs("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2",children:[i.jsx(No,{className:"w-5 h-5 text-blue-600"}),"Feature Importance (Surrogate Model)"]}),i.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-4",children:["Importances reflect what the ",i.jsx("strong",{children:"surrogate tree"})," used to split the data. They may differ from a more complex model’s importances."]}),i.jsx("div",{className:"h-80 w-full",children:i.jsx(De,{width:"100%",height:"100%",children:i.jsxs(nt,{data:l.feature_importances.slice(0,10),layout:"vertical",margin:{top:5,right:30,left:40,bottom:5},children:[i.jsx(Ye,{strokeDasharray:"3 3",horizontal:!0,vertical:!1,stroke:a.gridColor}),i.jsx(Xe,{type:"number",domain:[0,"auto"],hide:!0}),i.jsx(Qe,{dataKey:"feature",type:"category",width:150,tick:{fontSize:12,fill:a.axisColor},interval:0}),i.jsx(He,{formatter:d=>[(d*100).toFixed(1)+"%","Importance"],contentStyle:a.tooltipContentStyle,cursor:{fill:"transparent"}}),i.jsx(Ve,{dataKey:"importance",radius:[0,4,4,0],barSize:20,children:l.feature_importances.slice(0,10).map((d,h)=>i.jsx(js,{fill:`hsl(217, 91%, ${60-h*3}%)`},`cell-${h}`))})]})})}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 text-center",children:"Showing top 10 features driving the decision rules."})]}),l.rules&&l.rules.length>0&&i.jsxs("div",{className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:[i.jsx("h3",{className:"text-md font-semibold text-gray-900 dark:text-white mb-4",children:"Segmentation-Decision Tree (Surrogate Model)"}),i.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:l.rules.map((d,h)=>i.jsx("div",{className:"p-3 bg-gray-50 dark:bg-gray-900 rounded border border-gray-100 dark:border-gray-700 text-sm font-mono text-gray-700 dark:text-gray-300",children:d},h))})]})]}):i.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-8",children:[i.jsx(ds,{className:"w-12 h-12 mb-4 text-gray-300 dark:text-gray-600"}),i.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Decision Tree Not Available"}),i.jsx("p",{className:"text-center max-w-md mb-4",children:"No tree was generated. This usually happens if the dataset is too small, or if a target column was not selected for analysis."}),i.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 dark:bg-amber-900/20 dark:text-amber-400 px-4 py-2 rounded-md",children:[i.jsx(bt,{className:"w-4 h-4"}),i.jsxs("span",{children:["Ensure you have selected a ",i.jsx("strong",{children:"Target Column"})," and re-run the analysis."]})]})]})},wc=20,_t=new Map;function _s(n){return n.filter_value===void 0?n.name:n.filter_value}function Ft(n){return JSON.stringify([_s(n)])}function jc(n,l){if(_t.delete(n),_t.set(n,l),_t.size>wc){const a=_t.keys().next().value;a!==void 0&&_t.delete(a)}}const kc=({datasetId:n,measureCol:l,measureAgg:a,columns:d,initialFilters:h})=>{const[u,m]=k.useState([]),[p,g]=k.useState(!1),[w,y]=k.useState(null),[b,x]=k.useState([null]),N=k.useRef(null),P=k.useRef(null),j=k.useRef(0),[M,D]=k.useState([]);k.useEffect(()=>{N.current&&N.current.scrollTo({left:N.current.scrollWidth,behavior:"smooth"})},[u.length]);const S=()=>{if(!P.current)return;const A=[],I=P.current.getBoundingClientRect();u.forEach((V,B)=>{if(B>=u.length-1)return;const H=V.items.findIndex(ie=>Ft(ie)===V.selectedItemKey);if(H<0)return;const re=`node-${B}-${H}`,Z=document.getElementById(re);if(Z){const ie=Z.getBoundingClientRect(),Q=ie.right-I.left,ge=ie.top+ie.height/2-I.top;let O,ce;const z=u[B+1];if(!z)return;if(z.selectedItemKey){const q=z.items.findIndex(se=>Ft(se)===z.selectedItemKey),ee=`node-${B+1}-${q}`,oe=document.getElementById(ee);if(oe){const se=oe.getBoundingClientRect();O=se.left-I.left,ce=se.top+se.height/2-I.top}else return}else{const q=`list-${B+1}`,ee=document.getElementById(q);if(ee){const oe=ee.getBoundingClientRect();O=oe.left-I.left,ce=oe.top+oe.height/2-I.top}else return}if(O!==void 0&&ce!==void 0){const q=(Q+O)/2,ee=`M ${Q} ${ge} C ${q} ${ge}, ${q} ${ce}, ${O} ${ce}`;A.push({d:ee})}}}),D(A)};$t.useLayoutEffect(()=>{S()},[u,w]),k.useEffect(()=>{if(u.length>0){const A=`${n}-${l}-${a}`;jc(A,{levels:u,splitPath:b})}},[u,b,n,l,a]),k.useEffect(()=>{const A=`${n}-${l}-${a}`,I=_t.get(A);I?(m(I.levels),x(I.splitPath)):G()},[n,l,a]);const G=async()=>{const A=++j.current;g(!0);try{const I=await qe.getDecomposition(n,l==="count"?null:l,a,"",h);if(A!==j.current)return;m([{id:"root",splitColumn:null,items:I,selectedItemKey:null,filters:h}]),x([null])}catch(I){A===j.current&&console.error(I)}finally{A===j.current&&g(!1)}},fe=(A,I)=>{var Z,ie,Q,ge,O;const V=u[A];if(!V||!V.selectedItemKey)return;const B=V.items.find(ce=>Ft(ce)===V.selectedItemKey);if(!B)return;const H=I.currentTarget.getBoundingClientRect(),re=(Z=N.current)==null?void 0:Z.getBoundingClientRect();if(re){let ce=H.right-re.left+10,z=H.top-re.top;const q=((Q=(ie=N.current)==null?void 0:ie.parentElement)==null?void 0:Q.clientWidth)||window.innerWidth;ce+260>q&&(ce=H.left-re.left-270);const ee=((O=(ge=N.current)==null?void 0:ge.parentElement)==null?void 0:O.clientHeight)||window.innerHeight;z+300>ee&&(z=ee-310),y({levelIndex:A,item:B,x:ce,y:z})}},le=async(A,I)=>{const V=u[A];if(!V)return;const B={...V,selectedItemKey:Ft(I)},H=u.map((Z,ie)=>ie===A?B:Z),re=b[A+1];if(re){const Z=++j.current;g(!0);try{const ie=[...B.filters];B.splitColumn&&ie.push({column:B.splitColumn,operator:"==",value:_s(I)});const Q=await qe.getDecomposition(n,l==="count"?null:l,a,re,ie);if(Z!==j.current)return;const ge={id:`level-${A+1}`,splitColumn:re,items:Q,selectedItemKey:null,filters:ie},O=[...H.slice(0,A+1),ge];m(O),x(b.slice(0,A+2))}catch(ie){Z===j.current&&console.error(ie)}finally{Z===j.current&&g(!1)}}else m(H)},ne=async A=>{if(!w)return;const{levelIndex:I,item:V}=w;y(null);const B=++j.current;g(!0);try{const H=u[I];if(!H)return;const re=[...H.filters];H.splitColumn&&re.push({column:H.splitColumn,operator:"==",value:_s(V)});const Z=await qe.getDecomposition(n,l==="count"?null:l,a,A,re);if(B!==j.current)return;const ie={id:`level-${I+1}`,splitColumn:A,items:Z,selectedItemKey:null,filters:re},Q=[...u.slice(0,I+1),ie];m(Q);const ge=[...b.slice(0,I+1),A];x(ge)}catch(H){B===j.current&&console.error(H)}finally{B===j.current&&g(!1)}},we=A=>{m(u.slice(0,A)),x(b.slice(0,A))};return i.jsxs("div",{className:"relative w-full h-[600px] bg-slate-50 dark:bg-slate-900 overflow-hidden flex flex-col",children:[p&&i.jsx("div",{className:"absolute top-2 right-2 z-50",children:i.jsx(be,{className:"w-5 h-5 animate-spin text-blue-500"})}),i.jsx("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",ref:N,children:i.jsxs("div",{className:"flex h-full p-8 min-w-max gap-12 relative",ref:P,children:[u.map((A,I)=>i.jsxs("div",{className:"flex flex-col w-[200px] h-full relative z-10",children:[i.jsxs("div",{id:`header-${I}`,className:"flex items-center justify-between mb-4 bg-white dark:bg-slate-800 p-2 rounded shadow-sm border border-slate-200 dark:border-slate-700",children:[i.jsx("span",{className:"font-semibold text-sm text-slate-700 dark:text-slate-200",children:A.splitColumn||"Total"}),i.jsxs("div",{className:"flex items-center gap-1",children:[I===u.length-1&&i.jsx("button",{onClick:V=>fe(I,V),className:` diff --git a/static/ml_canvas/assets/InferencePage-Csb-l3Ft.js b/static/ml_canvas/assets/InferencePage-Csb-l3Ft.js new file mode 100644 index 000000000..03da3f327 --- /dev/null +++ b/static/ml_canvas/assets/InferencePage-Csb-l3Ft.js @@ -0,0 +1,10 @@ +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as me,B as Oe,P as jt,f as Q,v as he,X as _e,w as Pe,x as Le,y as pe,W as wt,z as be,D as Je,l as Ue,h as Ve,E as kt,I as Nt,J as vt,K as St,N as Ct,t as Rt}from"./vendor-utils-VkF_O5b_.js";import{d as fe,D as Fe,t as T,n as It,o as Ot,a as Ft,q as Et,b as Tt,E as Mt}from"./index-C2dSXwG1.js";import"./vendor-charts-BkHP8M8k.js";const ne=`[ + { + "feature1": 0.5, + "feature2": 1.2 + } +]`,ye=5,Be=[1,5,10,25,100],ae=10,$t=500,He=3e4,ze=1440*60*1e3,xe="inferencePage:lastInput",Ee="inferencePage:sampleSize",Te="inferencePage:resultsView",We="inferencePage:runHistory",le="inferencePage:pendingRun",Me=()=>{try{const t=localStorage.getItem(We);if(!t)return[];const r=JSON.parse(t);if(!Array.isArray(r))return[];const a=Date.now();return r.filter(s=>s&&typeof s.at=="number"&&a-s.at{try{localStorage.setItem(We,JSON.stringify(t))}catch{}},At=t=>!!(t&&typeof t=="object"&&"code"in t&&t.code==="ERR_CANCELED"),Dt=(t,r)=>{const a=/position\s+(\d+)/i.exec(t);if(a&&a[1]){const l=Number(a[1]);if(!Number.isFinite(l))return null;const n=r.slice(0,l),o=n.split(` +`).length,u=n.lastIndexOf(` +`),c=u===-1?l+1:l-u;return{line:o,column:c}}const s=/line\s+(\d+)\s+column\s+(\d+)/i.exec(t);return s&&s[1]&&s[2]?{line:Number(s[1]),column:Number(s[2])}:null},_t=t=>{try{const r=JSON.parse(t);return Array.isArray(r)?{valid:!0,rows:r.length,message:`${r.length} row${r.length===1?"":"s"}`}:{valid:!1,rows:0,message:"Input must be a JSON array of objects"}}catch(r){const a=r.message,s=Dt(a,t);return s?{valid:!1,rows:0,message:`${a} (line ${s.line}, col ${s.column})`,line:s.line,column:s.column}:{valid:!1,rows:0,message:a}}},Pt=(t,r)=>{if(r.length===0)return null;let a;try{a=JSON.parse(t)}catch{return null}if(!Array.isArray(a)||a.length===0)return null;const s=new Set(r.map(c=>c.name)),l=new Set;a.forEach(c=>{c&&typeof c=="object"&&Object.keys(c).forEach(m=>l.add(m))});const n=[...s].filter(c=>!l.has(c)),o=[...l].filter(c=>!s.has(c)),u=[];return a.forEach((c,m)=>{const f=c&&typeof c=="object"?new Set(Object.keys(c)):new Set,j=[...s].filter(R=>!f.has(R));j.length>0&&u.push({rowIndex:m,missing:j})}),{missing:n,extra:o,rows:a.length,rowIssues:u}},Lt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Jt=t=>{const r=t.split(/\r?\n/).filter(s=>s.trim()!=="");if(r.length<2)return[];const a=(r[0]??"").split(",").map(s=>s.trim());return r.slice(1).map(s=>{const l=s.split(","),n={};return a.forEach((o,u)=>{const c=(l[u]??"").trim();if(c===""){n[o]="";return}if(Lt.test(c)){const m=Number(c);n[o]=Number.isFinite(m)?m:c}else n[o]=c}),n})},Ut=t=>t.map(r=>typeof r=="number"?r:Number(r)).filter(r=>Number.isFinite(r)),Vt=t=>{switch(t){case"override":return"ad-hoc override thresholds";case"saved-enabled":return"saved tuned thresholds";default:return"default thresholds"}},Bt=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),oe=t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),qe=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;const a=Object.entries(t);if(a.length===0)return null;const s={};for(const[n,o]of a){if(!zt(o))return null;s[n]=o}return Object.values(s).some(n=>n>=0&&n<=1)?s:null},$e=(t,r,a)=>{if(r.length>0){const l={};return r.forEach(n=>{a.has(n.name)||(l[n.name]=n.name in t?t[n.name]:0)}),l}const s={};return Object.entries(t).forEach(([l,n])=>{a.has(l)||(s[l]=n)}),s},Ht=t=>{if(t.length===0)return"";const r=Array.from(t.reduce((n,o)=>(Object.keys(o).forEach(u=>n.add(u)),n),new Set)),a=n=>{const o=n==null?"":String(n);return/[",\n]/.test(o)?`"${o.replace(/"/g,'""')}"`:o},s=r.join(","),l=t.map(n=>r.map(o=>a(n[o])).join(",")).join(` +`);return`${s} +${l}`},zt=t=>typeof t=="number"&&Number.isFinite(t);function Wt(t){const[r,a]=d.useState(null),[s,l]=d.useState(null),[n,o]=d.useState(new Set),[u,c]=d.useState(!1),[m,f]=d.useState(()=>{try{const p=Number(localStorage.getItem(Ee));return Be.includes(p)?p:1}catch{return 1}}),[j,R]=d.useState(null),k=d.useMemo(()=>(r==null?void 0:r.input_schema)??[],[r]);d.useEffect(()=>{try{localStorage.setItem(Ee,String(m))}catch{}},[m]);const O=async(p,b,A,N)=>{try{const F=await It.getJob(p.job_id),M=F.target_column,P=F.dropped_columns||[];if(qt(N,M,P),F.dataset_id){l(F.dataset_id);const B=await Fe.getSample(F.dataset_id,1);if(B.length>0){const I=B[0];if(A)Object.keys(b).forEach(D=>{D in I&&(b[D]=I[D])});else{b=$e(I,[],N);const D=Kt(M,P);D&&R(D)}}}}catch(F){console.warn("Failed to fetch dataset sample",F)}return b},$=d.useCallback(async()=>{try{const p=await fe.getActive();if(a(p),!p){l(null),o(new Set);return}let b={},A=!1;const N=new Set;p.input_schema&&p.input_schema.length>0&&(p.input_schema.forEach(F=>{b[F.name]=0}),A=!0,R(`Schema loaded from artifacts (${p.input_schema.length} features)`)),p.job_id&&(b=await O(p,b,A,N)),o(N),Yt(b,t)}catch(p){console.error("Failed to load active deployment",p),a(null),l(null),o(new Set)}},[t]);d.useEffect(()=>{$()},[$]);const V=d.useCallback(async()=>{if(!(!s||u)){c(!0);try{const p=await Fe.getSample(s,m);if(p.length===0){T.error("Dataset returned no rows");return}const b=p.map(A=>$e(A,k,n));t(JSON.stringify(b,null,2)),T.success(`Loaded ${b.length} sample row${b.length===1?"":"s"}`+(n.size>0?` (excluded ${n.size} cols)`:""))}catch(p){console.error("Failed to reload sample",p),T.error("Could not fetch new samples")}finally{c(!1)}}},[s,u,m,k,n,t]);return{activeDeployment:r,setActiveDeployment:a,datasetId:s,setDatasetId:l,excludedColumns:n,setExcludedColumns:o,isReloadingSample:u,sampleSize:m,setSampleSize:f,autoFilterInfo:j,schemaChips:k,handleReloadSample:V}}function qt(t,r,a){typeof r=="string"&&r&&t.add(r),a.forEach(s=>{typeof s=="string"&&s&&t.add(s)})}function Kt(t,r){const a=[];return t&&a.push(`Target: ${t}`),r.length>0&&a.push(`Dropped: ${r.length} cols`),a.length>0?`Auto-filtered from dataset: ${a.join(", ")}`:null}function Yt(t,r){if(Object.keys(t).length>0){let a=!1;try{const s=localStorage.getItem(xe);a=s==null||s===ne}catch{a=!0}a&&r(JSON.stringify([t],null,2))}}function Gt(t,r,a){const s=d.useRef(null),l=d.useRef(null),n=d.useRef(null),o=d.useRef(null),u=d.useRef(0),c=d.useRef(null),[m,f]=d.useState(null),[j,R]=d.useState(null),[k,O]=d.useState(null),[$,V]=d.useState(()=>Me()),[p,b]=d.useState(null),[A,N]=d.useState(null),[F,M]=d.useState(null),P=d.useCallback(()=>{var h;s.current=null,(h=l.current)==null||h.abort(),l.current=null,o.current=null,n.current!==null&&window.clearTimeout(n.current),n.current=null},[]);d.useEffect(()=>(R(null),P),[t==null?void 0:t.job_id,P]);const B=d.useCallback(()=>{P(),Ae(),c.current=null,R(null),f(null),O(null),b(null),N(null),M(null)},[P]),I=d.useCallback(h=>{V(v=>{const C=[h,...v].slice(0,ye);return ge(C),C})},[]);d.useEffect(()=>{let h=null;try{const C=localStorage.getItem(le);C&&(h=JSON.parse(C))}catch{h=null}try{localStorage.removeItem(le)}catch{}if(h){const C={...h,status:"failure",latencyMs:null,predictions:null,errorMessage:"This run was still in progress when the page was reloaded or closed β€” its outcome is unknown. Retry to get a fresh result."};O(C),b(C.errorMessage),I(C);return}const v=Me()[0];v&&(O(v),v.status==="success"?(f(v.predictions),N(v.latencyMs),M(v.overrideThresholdsUsed)):b(v.errorMessage))},[]);const D=d.useCallback(async(h,v,C,Y)=>{if(!t||s.current)return;const te=++u.current,_=`run-${Date.now().toString(36)}-${te}`,z=`Run #${te}`,G=Zt(v,r),W=new AbortController;l.current=W,s.current=_,o.current=null,c.current={data:h,overrideThresholds:v,inputSnapshot:C,runId:_};const ie={runId:_,label:z,at:Date.now(),rows:h.length,jobId:t.job_id,modelType:t.model_type,modelVersion:null,thresholdContext:G,input:C,overrideThresholdsUsed:v};er(ie);const X=window.setTimeout(()=>{o.current="timeout",W.abort()},He);n.current=X,R({runId:_,label:z,submittedAt:Date.now(),retryOf:(Y==null?void 0:Y.retryOf)??null}),b(null);const de=performance.now();try{const J=await fe.predict(h,v,{signal:W.signal});if(s.current!==_)return;Xt(W.signal);const U=Math.round(performance.now()-de);f(J.predictions),N(U),M(J.thresholds_applied??null);const H={runId:_,label:z,status:"success",at:Date.now(),rows:h.length,latencyMs:U,jobId:t.job_id,modelType:t.model_type,modelVersion:J.model_version??null,thresholdContext:G,input:C,overrideThresholdsUsed:v,predictions:J.predictions,errorMessage:null};O(H),I(H)}catch(J){if(s.current!==_)return;const{status:U,message:H}=Qt(J,o.current);f(null),N(null),M(null),b(H);const re={runId:_,label:z,status:U,at:Date.now(),rows:h.length,latencyMs:null,jobId:t.job_id,modelType:t.model_type,modelVersion:null,thresholdContext:G,input:C,overrideThresholdsUsed:v,predictions:null,errorMessage:H};O(re),I(re)}finally{window.clearTimeout(X),s.current===_&&(o.current=null,l.current=null,s.current=null,n.current=null,R(null),Ae())}},[t,r,I]),w=d.useCallback(async()=>{const h=c.current;!h||j||await D(h.data,h.overrideThresholds,h.inputSnapshot,{retryOf:h.runId})},[j,D]),K=d.useCallback(()=>{l.current&&(o.current="user",l.current.abort())},[]);return{lastAttemptRef:c,predictions:m,setPredictions:f,activeRun:j,currentRunMeta:k,setCurrentRunMeta:O,runHistory:$,setRunHistory:V,error:p,setError:b,latencyMs:A,setLatencyMs:N,thresholdsApplied:F,setThresholdsApplied:M,submitRun:D,handleRetryRun:w,handleCancelRun:K,handleRestoreRun:h=>{a(h.input),O(h),h.status==="success"?(f(h.predictions),N(h.latencyMs),M(h.overrideThresholdsUsed),b(null)):(f(null),N(null),M(null),b(h.errorMessage))},handleClearRunHistory:()=>{V([]),ge([])},clearResults:B}}function Ae(){try{localStorage.removeItem(le)}catch{}}function Xt(t){if(t.aborted)throw Object.assign(new Error("Run cancelled"),{code:"ERR_CANCELED"})}function Zt(t,r){return t?"override":r!=null&&r.enabled?"saved-enabled":"none"}function Qt(t,r){const a=At(t),s=a&&r==="timeout",l=a&&!s?"cancelled":"failure",n=s?`The server did not respond within ${Math.round(He/1e3)}s. Your input is unchanged β€” retry, or check the deployment.`:l==="cancelled"?"Run cancelled β€” your input is unchanged.":t.message||"Prediction failed";return{status:l,message:n}}function er(t){try{localStorage.setItem(le,JSON.stringify(t))}catch{}}const tr=t=>{const[r,a]=d.useState(null),s=d.useRef(0);return d.useEffect(()=>{const l=++s.current;if(!t){a(null);return}let n=!1;return a(null),Ot.get(t).then(o=>{n||s.current!==l||a(o)}).catch(o=>{n||s.current!==l||(console.warn("Failed to fetch saved tuned thresholds",o),a(null))}),()=>{n=!0}},[t]),r};function rr(){const t=Ft(),r=d.useRef(null),a=d.useRef(null),[s,l]=d.useState(()=>{try{return localStorage.getItem(xe)??ne}catch{return ne}}),{activeDeployment:n,setActiveDeployment:o,datasetId:u,setDatasetId:c,excludedColumns:m,setExcludedColumns:f,isReloadingSample:j,sampleSize:R,setSampleSize:k,autoFilterInfo:O,schemaChips:$,handleReloadSample:V}=Wt(l),[p,b]=d.useState(!1),[A,N]=d.useState({}),[F,M]=d.useState(""),[P,B]=d.useState("0.5"),I=tr((n==null?void 0:n.job_id)??null),{lastAttemptRef:D,predictions:w,activeRun:K,currentRunMeta:E,runHistory:ee,setRunHistory:h,error:v,setError:C,latencyMs:Y,thresholdsApplied:te,submitRun:_,handleRetryRun:z,handleCancelRun:G,handleRestoreRun:W,handleClearRunHistory:ie,clearResults:X}=Gt(n,I,l),[de,J]=d.useState(!1),[U,H]=d.useState(()=>{try{return localStorage.getItem(Te)==="table"?"table":"list"}catch{return"list"}}),[re,ce]=d.useState(!1),[se,je]=d.useState(!1),Ye=d.useMemo(()=>_t(s),[s]),S=d.useMemo(()=>Pt(s,$),[s,$]),Ge=d.useMemo(()=>$.some(i=>i.type==="unknown"),[$]),Xe=(S==null?void 0:S.rowIssues.map(i=>`${i.rowIndex}:${i.missing.join(",")}`).join("|"))??"";d.useEffect(()=>{je(!1)},[Xe]);const Ze=d.useMemo(()=>{if(!w||w.length===0)return null;const i=Ut(w);if(i.length===0)return null;const x=Math.min(...i),g=Math.max(...i),y=i.reduce((L,q)=>L+q,0)/i.length;return{count:i.length,mean:y,min:x,max:g,values:i}},[w]),we=d.useMemo(()=>{if(!w||(E==null?void 0:E.status)!=="success")return[];try{const i=JSON.parse(E.input);return Array.isArray(i)?i:[]}catch{return[]}},[w,E]),ue=d.useMemo(()=>!w||w.length!==1?null:qe(w[0]),[w]);d.useEffect(()=>{try{localStorage.setItem(xe,s)}catch{}},[s]),d.useEffect(()=>{try{localStorage.setItem(Te,U)}catch{}},[U]);const ke=d.useCallback(i=>{try{const x=Jt(i);if(x.length===0){T.error("CSV had no data rows");return}const g=x.map(y=>{if(m.size===0)return y;const L={};return Object.entries(y).forEach(([q,Z])=>{m.has(q)||(L[q]=Z)}),L});l(JSON.stringify(g,null,2)),T.success(`Loaded ${g.length} row${g.length===1?"":"s"} from CSV`)}catch(x){console.error("CSV parse failed",x),T.error("Could not parse CSV")}},[m]),Ne=d.useCallback(i=>{const x=new FileReader;x.onload=()=>ke(String(x.result??"")),x.onerror=()=>T.error("Could not read file"),x.readAsText(i)},[ke]),Qe=i=>{var g;const x=(g=i.target.files)==null?void 0:g[0];x&&Ne(x),i.target.value=""},et=i=>{i.dataTransfer.types.includes("Files")&&(i.preventDefault(),ce(!0))},tt=i=>{i.currentTarget===i.target&&ce(!1)},rt=i=>{var g;i.preventDefault(),ce(!1);const x=(g=i.dataTransfer.files)==null?void 0:g[0];if(x){if(!x.name.toLowerCase().endsWith(".csv")){T.error("Only .csv files are supported");return}Ne(x)}},st=async()=>{if(!S||S.rowIssues.length===0)return;const i=S.rowIssues.slice(0,8).map(y=>`Row ${y.rowIndex+1}: ${y.missing.join(", ")} β†’ 0`),x=S.rowIssues.length>8?S.rowIssues.length-8:0;if(await t({title:"Fill missing fields with 0?",message:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"This only fills in fields that are absent from a row. Fields that are already present keep their current value even if it looks wrong for this model β€” review those yourself before running."}),e.jsxs("ul",{className:"text-xs font-mono bg-gray-50 dark:bg-gray-900 rounded p-2 space-y-0.5 max-h-32 overflow-auto",children:[i.map(y=>e.jsx("li",{children:y},y)),x>0&&e.jsxs("li",{children:["…and ",x," more row(s)"]})]})]}),confirmLabel:"Fill with 0"}))try{const L=JSON.parse(s).map(q=>{const Z={...q};return S.missing.forEach(Ie=>{Ie in Z||(Z[Ie]=0)}),Z});l(JSON.stringify(L,null,2)),T.success(`Filled ${S.missing.length} missing field(s) with 0 β€” verify values before running`)}catch{T.error("Cannot pad: invalid JSON")}},at=async()=>{if(await t({title:"Undeploy model?",message:"Are you sure you want to undeploy the current model?",confirmLabel:"Undeploy",variant:"danger"}))try{await fe.deactivate(),o(null),c(null),f(new Set),X(),h([]),ge([])}catch(x){console.error("Failed to deactivate",x),T.error("Failed to undeploy model")}},ve=d.useCallback(async()=>{if(!n||K||sr(S,se))return;let i;try{i=nr(s)}catch(x){C(x.message);return}i.length>$t&&!await ar(i.length,t)||await _(i,p?A:null,s)},[n,K,s,t,p,A,S,se,_,C]),nt=()=>{try{const i=JSON.parse(s);l(JSON.stringify(i,null,2))}catch{T.error("Cannot format: invalid JSON")}},lt=()=>{l(ne),X()},ot=i=>{(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),ve())},it=()=>{const i=F.trim(),x=Number(P);!i||!Number.isFinite(x)||(N(g=>({...g,[i]:x})),M(""),B("0.5"))},dt=i=>{N(x=>{const g={...x};return delete g[i],g})},ct=(i,x)=>{const g=Number(x);Number.isFinite(g)&&N(y=>({...y,[i]:g}))},ut=()=>{I!=null&&I.thresholds&&(N({...I.thresholds}),b(!0))},xt=()=>{ue&&N(i=>{const x={...i};for(const g of Object.keys(ue))g in x||(x[g]=.5);return x})},gt=async()=>{if(w)try{await navigator.clipboard.writeText(JSON.stringify(w,null,2)),T.success("Copied predictions to clipboard")}catch{T.error("Failed to copy")}},Se=(i,x)=>{const g=URL.createObjectURL(i),y=document.createElement("a");y.href=g,y.download=x,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(g)},Ce=d.useMemo(()=>{const i=(E==null?void 0:E.jobId)??"unknown-job",x=(E==null?void 0:E.runId)??`run-${Date.now()}`;return`predictions_${i}_${x}`},[E]),mt=()=>{w&&Se(new Blob([JSON.stringify(w,null,2)],{type:"application/json"}),`${Ce}.json`)},ht=()=>{if(!w)return;const i=we.map((g,y)=>{const L=g&&typeof g=="object"?{...g}:{};return L.prediction=oe(w[y]),L}),x=i.length>0?i:w.map((g,y)=>({row:y+1,prediction:oe(g)}));Se(new Blob([Ht(x)],{type:"text/csv;charset=utf-8"}),`${Ce}.csv`)},pt=O&&!de,bt=S&&(S.missing.length>0||S.extra.length>0),Re=!!(S&&S.rowIssues.length>0),ft=!Re||se,yt=d.useMemo(()=>[...ee].reverse().map(i=>i.latencyMs).filter(i=>i!=null),[ee]);return{csvInputRef:r,editorWrapRef:a,lastAttemptRef:D,activeDeployment:n,datasetId:u,excludedColumns:m,inputData:s,setInputData:l,predictions:w,activeRun:K,currentRunMeta:E,runHistory:ee,isReloadingSample:j,sampleSize:R,setSampleSize:k,error:v,latencyMs:Y,thresholdsApplied:te,overrideThresholdsEnabled:p,setOverrideThresholdsEnabled:b,overrideThresholdsValue:A,newOverrideClass:F,setNewOverrideClass:M,newOverrideThreshold:P,setNewOverrideThreshold:B,savedThresholds:I,autoFilterInfo:O,setBannerDismissed:J,resultsView:U,setResultsView:H,isDragging:re,acknowledgeMissingFields:se,setAcknowledgeMissingFields:je,inputStatus:Ye,schemaChips:$,schemaCheck:S,hasUnknownTypedFields:Ge,predictionStats:Ze,parsedInputRows:we,singleProbMap:ue,handleReloadSample:V,handleCsvChange:Qe,handleDragOver:et,handleDragLeave:tt,handleDrop:rt,handleFixMissingFields:st,handleDeactivate:at,handlePredict:ve,handleRetryRun:z,handleCancelRun:G,handleFormatJson:nt,handleClearInput:lt,handleTextareaKeyDown:ot,handleAddOverrideEntry:it,handleRemoveOverrideEntry:dt,handleOverrideThresholdChange:ct,handlePrefillFromSavedThresholds:ut,handlePrefillFromLastPrediction:xt,handleCopyPredictions:gt,handleDownloadJson:mt,handleDownloadCsv:ht,handleRestoreRun:W,handleClearRunHistory:ie,showBanner:pt,hasSchemaIssues:bt,hasBlockingMissingFields:Re,canRunPrediction:ft,recentLatencies:yt}}function sr(t,r){return t&&t.rowIssues.length>0&&!r}async function ar(t,r){return r({title:"Large batch",message:`You are about to send ${t} rows. Continue?`,confirmLabel:"Send"})}function nr(t){const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("Input must be a JSON array of objects");return r}function lr({controller:t}){const{activeDeployment:r,handleDeactivate:a}=t;return e.jsxs("header",{className:"shrink-0 mb-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[e.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(De,{className:"w-6 h-6 text-blue-500 shrink-0"}),"Testing Model Inference"]}),r?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-xs min-w-0",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 font-medium",children:[e.jsx(me,{className:"w-3.5 h-3.5 shrink-0"})," Active"]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 min-w-0",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 text-blue-500 shrink-0"}),e.jsx("span",{className:"truncate max-w-[10rem]",children:r.model_type})]}),e.jsx("span",{className:"hidden sm:inline-flex items-center px-2 py-1 rounded-full bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border border-gray-200 dark:border-gray-700 font-mono min-w-0",title:`Job ${r.job_id} Β· deployed ${new Date(r.created_at).toLocaleString()}`,children:e.jsx("span",{className:"truncate max-w-[8rem]",children:r.job_id})}),e.jsxs("button",{onClick:()=>void a(),className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-red-50 text-red-600 border border-red-200 hover:bg-red-100 dark:bg-red-900/30 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/50 transition-colors",title:"Undeploy model",children:[e.jsx(jt,{className:"w-3.5 h-3.5"})," Undeploy"]})]}):e.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-xs",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-gray-500 dark:text-gray-400 italic",children:[e.jsx(Q,{className:"w-4 h-4 shrink-0"}),"No model is currently deployed."]}),e.jsxs(Et,{to:"/registry",className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-blue-50 text-blue-600 border border-blue-200 hover:bg-blue-100 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800 dark:hover:bg-blue-900/50 transition-colors",children:[e.jsx(Oe,{className:"w-3.5 h-3.5"})," Browse Model Registry"]})]})]})}const or=({values:t})=>{const r=d.useMemo(()=>{if(t.length===0)return null;const o=Math.min(...t),u=Math.max(...t);if(o===u)return{min:o,max:u,bins:[t.length]};const c=(u-o)/ae,m=new Array(ae).fill(0);return t.forEach(f=>{let j=Math.floor((f-o)/c);j>=ae&&(j=ae-1);const R=m[j];m[j]=(R??0)+1}),{min:o,max:u,bins:m}},[t]);if(!r)return null;const a=220,s=48,l=Math.max(...r.bins,1),n=a/r.bins.length;return e.jsxs("div",{className:"flex items-center gap-2",title:"Distribution of predictions",children:[e.jsx("svg",{width:a,height:s,className:"text-blue-500",children:r.bins.map((o,u)=>{const c=o/l*(s-4);return e.jsx("rect",{x:u*n+1,y:s-c,width:Math.max(1,n-2),height:c,fill:"currentColor",opacity:.85},u)})}),e.jsxs("div",{className:"flex flex-col text-[10px] text-gray-400 leading-tight",children:[e.jsx("span",{className:"tabular-nums",children:r.max.toFixed(2)}),e.jsx("span",{className:"tabular-nums",children:r.min.toFixed(2)})]})]})},ir=({values:t})=>{if(t.length<2)return null;const r=60,a=16,s=Math.max(...t),l=Math.min(...t),n=s-l||1,o=t.map((u,c)=>{const m=c/(t.length-1)*r,f=a-(u-l)/n*(a-2)-1;return`${m},${f}`}).join(" ");return e.jsx("svg",{width:r,height:a,className:"text-blue-400","aria-hidden":"true",children:e.jsx("polyline",{points:o,fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})},Ke=({probs:t})=>{const r=Object.entries(t).sort(([,s],[,l])=>l-s),a=Math.max(...r.map(([,s])=>s),1);return e.jsx("div",{className:"flex flex-col gap-1 w-full",children:r.map(([s,l],n)=>{const o=l/a*100,u=n===0;return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`font-mono shrink-0 w-20 truncate ${u?"text-blue-700 dark:text-blue-300 font-semibold":"text-gray-500 dark:text-gray-400"}`,title:s,children:s}),e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${u?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`,style:{width:`${o}%`}})}),e.jsxs("span",{className:"tabular-nums w-12 text-right text-gray-600 dark:text-gray-300",children:[(l*100).toFixed(1),"%"]})]},s)})})},dr=({rows:t,predictions:r})=>{const a=d.useMemo(()=>{const s=new Set;return t.forEach(l=>{l&&typeof l=="object"&&Object.keys(l).forEach(n=>s.add(n))}),[...s]},[t]);return t.length===0?null:e.jsx("div",{className:"overflow-auto h-full",children:e.jsxs("table",{className:"w-full text-xs border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-gray-50 dark:bg-gray-900",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-2 py-1 text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700 w-8",children:"#"}),a.map(s=>e.jsx("th",{className:"text-left px-2 py-1 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:s},s)),e.jsx("th",{className:"text-left px-2 py-1 text-blue-500 font-semibold border-b border-gray-200 dark:border-gray-700 sticky right-0 bg-gray-50 dark:bg-gray-900",children:"prediction"})]})}),e.jsx("tbody",{children:t.map((s,l)=>{const n=s&&typeof s=="object"?s:{};return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-2 py-1 text-gray-400 tabular-nums",children:l+1}),a.map(o=>e.jsx("td",{className:"px-2 py-1 font-mono text-gray-700 dark:text-gray-300 truncate max-w-[140px]",title:String(n[o]??""),children:n[o]===void 0?e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"β€”"}):String(n[o])},o)),e.jsx("td",{className:"px-2 py-1 font-mono font-medium text-blue-600 dark:text-blue-400 sticky right-0 bg-white dark:bg-gray-800",children:oe(r[l])})]},l)})})]})})},cr=({value:t,onChange:r,disabled:a})=>e.jsx("div",{className:`inline-flex rounded-md overflow-hidden border ${a?"border-gray-200 dark:border-gray-700 opacity-50 cursor-not-allowed":"border-gray-200 dark:border-gray-600"}`,role:"group","aria-label":"Sample row count",children:Be.map(s=>{const l=s===t;return e.jsx("button",{type:"button",disabled:a,onClick:()=>r(s),className:`px-2 py-1 text-[11px] font-medium tabular-nums transition-colors border-r last:border-r-0 ${a?"border-gray-200 dark:border-gray-700":"border-gray-200 dark:border-gray-600"} ${l?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Fetch ${s} sample row${s===1?"":"s"}`,children:s},s)})});function ur({controller:t}){const{overrideThresholdsEnabled:r,setOverrideThresholdsEnabled:a,overrideThresholdsValue:s,handleOverrideThresholdChange:l,handleRemoveOverrideEntry:n,newOverrideClass:o,setNewOverrideClass:u,newOverrideThreshold:c,setNewOverrideThreshold:m,handleAddOverrideEntry:f,singleProbMap:j,handlePrefillFromLastPrediction:R}=t;return e.jsxs("details",{className:"mt-3 shrink-0 rounded-lg border border-gray-200 dark:border-gray-700 group overflow-hidden",children:[e.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-300 flex items-center gap-2",children:[e.jsx(he,{className:"w-3.5 h-3.5"})," Advanced: override thresholds"]}),e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 border-t border-gray-100 dark:border-gray-700",children:[e.jsx(xr,{controller:t}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:k=>a(k.target.checked)}),"Apply these thresholds to this prediction"]}),Object.entries(s).length>0&&e.jsx("div",{className:"space-y-1",children:Object.entries(s).map(([k,O])=>e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-mono text-xs w-28 truncate text-gray-700 dark:text-gray-200",title:k,children:k}),e.jsx("input",{type:"number",min:0,max:1,step:.01,value:O,onChange:$=>l(k,$.target.value),className:"w-24 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("button",{onClick:()=>n(k),title:"Remove",className:"p-1 rounded text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/30",children:e.jsx(_e,{className:"w-3.5 h-3.5"})})]},k))}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("input",{type:"text",value:o,onChange:k=>u(k.target.value),placeholder:"class label",className:"w-28 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("input",{type:"number",min:0,max:1,step:.01,value:c,onChange:k=>m(k.target.value),className:"w-24 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("button",{onClick:f,disabled:!o.trim(),className:"px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",children:"Add"})]}),j&&e.jsx("button",{onClick:R,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline",children:"Use classes from last prediction"}),e.jsx("p",{className:"text-[10px] text-gray-400 italic",children:"Class labels must exactly match the deployed model's classes (e.g. 0, 1, 2), or the prediction will be rejected."})]})]})}function xr({controller:t}){const{savedThresholds:r,activeDeployment:a,handlePrefillFromSavedThresholds:s}=t;return!(r!=null&&r.thresholds)||!a?null:e.jsxs("div",{className:`p-2 rounded border text-[11px] ${r.enabled?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800 text-blue-700 dark:text-blue-300":"bg-slate-50 dark:bg-slate-800/60 border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-300"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-1",children:[e.jsx("strong",{children:r.enabled?"Saved tuned thresholds are enabled":"Saved tuned thresholds are available but disabled"}),e.jsxs("span",{className:"font-mono opacity-80",children:["Β· Job ",a.job_id," Β· ",a.model_type]})]}),e.jsx(gr,{savedThresholds:r}),e.jsx("div",{className:"flex flex-wrap gap-1 mb-1.5",children:Object.entries(r.thresholds).map(([l,n])=>e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded font-mono ${r.enabled?"bg-blue-100 dark:bg-blue-900/40":"bg-slate-100 dark:bg-slate-700/80"}`,children:[l,": ",n]},l))}),e.jsx("button",{onClick:s,className:"text-current hover:underline font-medium",children:"Copy into override editor to tweak"})]})}function gr({savedThresholds:t}){return e.jsxs("div",{className:"grid grid-cols-1 gap-0.5 mb-1.5",children:[e.jsxs("span",{children:["Optimized for ",e.jsx("strong",{children:t.metric??"unknown metric"})]}),e.jsxs("span",{children:["Computed from ",e.jsx("strong",{children:t.split_used??"unknown"})," split"]}),t.source==="training"&&e.jsxs("span",{children:["Seeded at ",e.jsx("strong",{children:"training time"})," (Tune decision threshold)"]}),t.computed_at&&e.jsxs("span",{children:["Computed at ",e.jsx("strong",{children:new Date(t.computed_at).toLocaleString()})]})]})}function mr({controller:t}){return e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 sm:p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 flex flex-col lg:h-full lg:min-h-0",children:[e.jsx(hr,{controller:t}),e.jsx(pr,{controller:t}),e.jsx(br,{controller:t}),e.jsx(fr,{controller:t}),e.jsx(yr,{controller:t}),e.jsx(jr,{controller:t}),e.jsx(wr,{controller:t}),e.jsx(ur,{controller:t})]})}function hr({controller:t}){const{csvInputRef:r,handleCsvChange:a,sampleSize:s,setSampleSize:l,datasetId:n,handleReloadSample:o,isReloadingSample:u,handleFormatJson:c,inputStatus:m,handleClearInput:f}=t;return e.jsxs("div",{className:"flex justify-between items-start mb-3 gap-3 flex-wrap",children:[e.jsx("h3",{id:"inference-input-heading",className:"text-lg font-medium text-gray-800 dark:text-gray-100",children:"Input Data (JSON)"}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx("input",{ref:r,type:"file",accept:".csv,text/csv",className:"hidden",onChange:a}),e.jsxs("button",{onClick:()=>{var j;return(j=r.current)==null?void 0:j.click()},className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Upload a CSV file (or drag & drop). Target/dropped columns are stripped automatically.",children:[e.jsx(Pe,{className:"w-3 h-3"})," CSV"]}),e.jsx(cr,{value:s,onChange:l,disabled:!n}),e.jsxs("button",{onClick:()=>void o(),disabled:!n||u,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",title:"Load fresh random rows from the training dataset (target / dropped columns excluded)",children:[e.jsx(Le,{className:`w-3 h-3 ${u?"animate-spin":""}`}),"Sample"]}),e.jsxs("button",{onClick:c,disabled:!m.valid,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",title:"Pretty-print JSON",children:[e.jsx(he,{className:"w-3 h-3"})," Format"]}),e.jsxs("button",{onClick:f,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Reset the editor and clear results",children:[e.jsx(pe,{className:"w-3 h-3"})," Clear"]})]})]})}function pr({controller:t}){const{schemaChips:r}=t;return e.jsx(e.Fragment,{children:r.length>0&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 overflow-x-auto pb-1 scrollbar-thin",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gray-400 shrink-0",children:"Schema"}),r.map(a=>e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-600",title:`${a.name} (${a.type})`,children:[e.jsx("span",{className:"font-mono",children:a.name}),e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:a.type})]},a.name))]})})}function br({controller:t}){const{excludedColumns:r}=t;return e.jsx(e.Fragment,{children:r.size>0&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 overflow-x-auto pb-1 scrollbar-thin text-[11px]",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gray-400 shrink-0",children:"Excluded"}),[...r].map(a=>e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-rose-50 dark:bg-rose-900/30 text-rose-700 dark:text-rose-300 border border-rose-200 dark:border-rose-800",title:"Stripped automatically from CSV uploads and Sample calls",children:[e.jsx(pe,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:a})]},a))]})})}function fr({controller:t}){const{showBanner:r,autoFilterInfo:a,setBannerDismissed:s}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mb-3 flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300 bg-amber-50 dark:bg-amber-900/20 px-3 py-2 rounded border border-amber-200 dark:border-amber-800",children:[e.jsxs("span",{className:"flex-1",children:[a,e.jsx("span",{className:"block text-[10px] text-amber-600/80 dark:text-amber-400/80 mt-0.5",children:"Please verify fields before running."})]}),e.jsx("button",{onClick:()=>s(!0),className:"text-amber-500 hover:text-amber-700 dark:hover:text-amber-200",title:"Dismiss",children:e.jsx(_e,{className:"w-3 h-3"})})]})})}function yr({controller:t}){const{editorWrapRef:r,handleDragOver:a,handleDragLeave:s,handleDrop:l,inputStatus:n,inputData:o,setInputData:u,handleTextareaKeyDown:c,isDragging:m}=t;return e.jsxs("div",{ref:r,onDragOver:a,onDragLeave:s,onDrop:l,className:"relative flex-1 min-h-[16rem] lg:min-h-0",children:[e.jsx("textarea",{id:"inference-input-editor","aria-labelledby":"inference-input-heading","aria-describedby":"inference-input-status","aria-invalid":!n.valid,className:"absolute inset-0 w-full h-full p-4 font-mono text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none resize-none",value:o,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:'[{"col1": 1, "col2": "A"}]',spellCheck:!1}),m&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-blue-500/10 dark:bg-blue-400/10 border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-lg",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-600 dark:text-blue-300 font-medium text-sm",children:[e.jsx(Pe,{className:"w-5 h-5"}),"Drop CSV to ingest"]})})]})}function jr({controller:t}){const{hasSchemaIssues:r,schemaCheck:a,handleFixMissingFields:s,hasBlockingMissingFields:l,acknowledgeMissingFields:n,setAcknowledgeMissingFields:o,hasUnknownTypedFields:u}=t;return a?e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.missing.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-50 dark:bg-rose-900/30 text-rose-700 dark:text-rose-300 border border-rose-200 dark:border-rose-800",title:a.missing.join(", "),children:[e.jsx(Q,{className:"w-3 h-3"}),a.missing.length," missing"]}),e.jsxs("button",{onClick:()=>void s(),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors",title:"Review and fill missing fields with value 0",children:[e.jsx(wt,{className:"w-3 h-3"})," Fix"]})]}),a.extra.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-amber-50 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 border border-amber-200 dark:border-amber-800",title:a.extra.join(", "),children:[e.jsx(Q,{className:"w-3 h-3"}),a.extra.length," extra"]}),e.jsx("span",{className:"text-[10px] text-gray-400 italic ml-1",children:"Hover badges for field names."})]}),e.jsx(vr,{schemaCheck:a}),l&&e.jsxs("label",{className:"flex items-start gap-1.5 text-gray-600 dark:text-gray-300 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:c=>o(c.target.checked),className:"mt-0.5","data-testid":"acknowledge-missing-fields"}),e.jsx("span",{children:"I understand some rows are missing schema fields and want to run anyway."})]}),u&&e.jsx("p",{className:"text-[10px] text-gray-400 italic",children:"This model's schema doesn't report field types β€” values are checked for presence only, not type or range, before sending."})]})}):null}function wr({controller:t}){const{activeDeployment:r,activeRun:a,inputStatus:s,canRunPrediction:l,handleCancelRun:n,handlePredict:o}=t,u=!r||!!a||!s.valid||!l;return e.jsxs("div",{className:"mt-3 flex justify-between items-center gap-3 flex-wrap",children:[e.jsx(kr,{controller:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("kbd",{className:"hidden md:inline-flex items-center gap-1 text-[10px] text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded border border-gray-200 dark:border-gray-600 font-mono",children:["Ctrl",e.jsx("span",{className:"text-gray-400",children:"+"}),"Enter"]}),a&&e.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-red-600 dark:text-red-400 border border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors",title:`Cancel ${a.label}`,children:[e.jsx(be,{className:"w-4 h-4"})," Cancel"]}),e.jsx("button",{onClick:()=>void o(),disabled:u,title:Nr(l,a),className:`flex items-center gap-2 px-4 py-2 rounded-lg font-medium transition-colors ${u?"bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-gray-800 dark:text-gray-600":"action-primary shadow-sm"}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 animate-spin"})," ",a.label," running…"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"w-4 h-4"})," Run Prediction"]})})]})]})}function kr({controller:t}){const{inputStatus:r}=t;return e.jsx("span",{id:"inference-input-status",role:"status",className:`text-xs flex items-center gap-1 ${r.valid?"text-gray-500 dark:text-gray-400":"text-red-600 dark:text-red-400"}`,children:r.valid?e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-3 h-3"})," ",r.message]}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"w-3 h-3"})," ",r.message]})})}function Nr(t,r){return t?r?`${r.label} is already running`:void 0:"Some rows are missing schema fields β€” fix them or check the acknowledgement above to run anyway"}function vr({schemaCheck:t}){return e.jsx(e.Fragment,{children:t.rowIssues.length>0&&e.jsxs("ul",{"data-testid":"schema-row-issues",className:"font-mono bg-rose-50/60 dark:bg-rose-900/10 border border-rose-100 dark:border-rose-900/40 rounded px-2 py-1 space-y-0.5 max-h-20 overflow-auto",children:[t.rowIssues.slice(0,5).map(r=>e.jsxs("li",{className:"text-rose-700 dark:text-rose-300",children:["Row ",r.rowIndex+1,": missing ",r.missing.join(", ")]},r.rowIndex)),t.rowIssues.length>5&&e.jsxs("li",{className:"text-rose-500 dark:text-rose-400",children:["…and ",t.rowIssues.length-5," more row(s)"]})]})})}function Sr({controller:t}){const{singleProbMap:r}=t;return e.jsx("div",{className:"flex flex-col lg:h-full lg:min-h-0",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 sm:p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 flex flex-col flex-1 min-h-[20rem] lg:min-h-0",children:[e.jsx(Cr,{controller:t}),e.jsx(Rr,{controller:t}),e.jsx(Ir,{controller:t}),e.jsx(Or,{controller:t}),r&&e.jsxs("div",{className:"mb-3 p-3 rounded bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-gray-400 mb-2 flex items-center gap-1",children:[e.jsx(Ve,{className:"w-3 h-3"})," Class probabilities"]}),e.jsx(Ke,{probs:r})]}),e.jsx(Fr,{controller:t}),e.jsx(Er,{controller:t}),e.jsx(Tr,{controller:t})]})})}function Cr({controller:t}){const{latencyMs:r,predictions:a,setResultsView:s,resultsView:l,handleCopyPredictions:n,handleDownloadJson:o,handleDownloadCsv:u}=t;return e.jsxs("div",{className:"flex justify-between items-center mb-4 gap-3 flex-wrap",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-100",children:"Prediction Results"}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r!=null&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(De,{className:"w-3 h-3"})," ",r," ms (client-observed)"]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex border border-gray-200 dark:border-gray-700 rounded overflow-hidden",children:[e.jsxs("button",{onClick:()=>s("list"),className:`flex items-center gap-1 text-xs px-2 py-1 transition-colors ${l==="list"?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"List view",children:[e.jsx(kt,{className:"w-3 h-3"})," List"]}),e.jsxs("button",{onClick:()=>s("table"),className:`flex items-center gap-1 text-xs px-2 py-1 transition-colors border-l border-gray-200 dark:border-gray-700 ${l==="table"?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Side-by-side input/output table",children:[e.jsx(Nt,{className:"w-3 h-3"})," Table"]})]}),e.jsxs("button",{onClick:()=>void n(),className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Copy as JSON",children:[e.jsx(vt,{className:"w-3 h-3"})," Copy"]}),e.jsxs("button",{onClick:o,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Download as JSON",children:[e.jsx(St,{className:"w-3 h-3"})," JSON"]}),e.jsxs("button",{onClick:u,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Download inputs + predictions as CSV",children:[e.jsx(Ct,{className:"w-3 h-3"})," CSV"]})]})]})]})}function Rr({controller:t}){const{currentRunMeta:r,resultsView:a}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:`mb-3 p-2.5 rounded border text-[11px] flex flex-wrap items-center gap-x-3 gap-y-1 ${Mr(r.status)}`,"data-testid":"run-provenance",children:[e.jsx("strong",{className:"font-mono",children:r.label}),e.jsxs("span",{children:[r.modelType,r.modelVersion?` Β· v${r.modelVersion}`:""," Β· job"," ",r.jobId]}),e.jsxs("span",{children:[r.rows," row",r.rows===1?"":"s"]}),e.jsx("span",{children:Vt(r.thresholdContext)}),r.latencyMs!=null&&e.jsxs("span",{children:[r.latencyMs," ms"]}),r.status==="success"&&e.jsx("span",{children:a==="table"?"table view":"list view"}),e.jsx("span",{className:"text-current opacity-70",children:new Date(r.at).toLocaleString()})]})})}function Ir({controller:t}){const{activeRun:r}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{role:"status","aria-atomic":"true",className:"mb-3 p-2.5 rounded border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 text-[11px] flex items-center gap-2",children:[e.jsx(Je,{className:"w-3.5 h-3.5 animate-spin shrink-0"}),e.jsxs("span",{children:[r.label,r.retryOf?" (retry)":""," is running…"]})]})})}function Or({controller:t}){const{predictionStats:r}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(Ve,{className:"w-3 h-3"})," Stats"]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200",children:["n = ",r.count]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["mean ",r.mean.toFixed(4)]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["min ",r.min.toFixed(4)]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["max ",r.max.toFixed(4)]})]}),r.values.length>1&&e.jsx(or,{values:r.values})]})})}function Fr({controller:t}){const{thresholdsApplied:r}=t;return e.jsx(e.Fragment,{children:r&&Object.keys(r).length>0&&e.jsxs("div",{className:"mb-3 p-3 rounded bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-gray-400 mb-2 flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3"})," Thresholds applied"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(r).map(([a,s])=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 text-[11px] font-mono",children:[a,": ",s]},a))})]})})}function Er({controller:t}){const{error:r,predictions:a,resultsView:s,parsedInputRows:l,schemaChips:n}=t;return e.jsx("div",{className:"flex-1 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx($r,{controller:t}):a?s==="table"&&l.length>0?e.jsx(dr,{rows:l,predictions:a}):e.jsx("div",{className:"p-4 space-y-2 overflow-auto h-full",children:a.map((o,u)=>{const c=qe(o);return e.jsxs("div",{className:"flex items-start gap-3 p-2 bg-white dark:bg-gray-800 rounded border border-gray-100 dark:border-gray-700",children:[e.jsxs("span",{className:"text-xs text-gray-500 w-8 shrink-0 mt-0.5",children:["#",u+1]}),c?e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(Ke,{probs:c})}):e.jsx("span",{className:"font-mono font-medium text-blue-600 dark:text-blue-400 break-all",children:oe(o)})]},u)})}):e.jsx(Tt,{icon:e.jsx(Ue,{className:"w-12 h-12 opacity-40"}),title:"Run a prediction to see results here.",...n.length>0?{description:"Tip: click Sample to load fresh rows from the training dataset."}:{}})})}function Tr({controller:t}){const{runHistory:r,recentLatencies:a,handleClearRunHistory:s,handleRestoreRun:l}=t;return e.jsx(e.Fragment,{children:r.length>0&&e.jsxs("div",{className:"mt-3 border-t border-gray-100 dark:border-gray-700 pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 flex-wrap gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wider text-gray-400",children:[e.jsx(Rt,{className:"w-3 h-3"})," Recent runs"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ir,{values:a}),e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/30",title:"Clear stored run history from this browser",children:[e.jsx(pe,{className:"w-3 h-3"})," Clear history"]})]})]}),e.jsxs("p",{className:"text-[10px] text-gray-400 mb-2",children:["Stored on this device only for ",Math.round(ze/(3600*1e3)),"h, kept to the ",ye," most recent runs β€” inputs and results, not a server record."]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(n=>e.jsxs("button",{onClick:()=>l(n),className:"flex items-center gap-2 text-[11px] px-2 py-1 rounded border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors",title:`Restore input and outcome from ${n.label}`,children:[n.status==="success"?e.jsx(me,{className:"w-3 h-3 text-emerald-500 shrink-0"}):n.status==="cancelled"?e.jsx(be,{className:"w-3 h-3 text-gray-400 shrink-0"}):e.jsx(Q,{className:"w-3 h-3 text-rose-500 shrink-0"}),e.jsx("span",{className:"font-mono",children:n.label}),e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsx("span",{className:"font-mono",children:Bt(n.at)}),e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsxs("span",{children:[n.rows," row",n.rows===1?"":"s"]}),n.latencyMs!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsxs("span",{className:"tabular-nums",children:[n.latencyMs," ms"]})]})]},n.runId))})]})})}function Mr(t){return t==="success"?"bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800 text-emerald-800 dark:text-emerald-300":t==="cancelled"?"bg-gray-50 dark:bg-gray-800/60 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-300":"bg-rose-50 dark:bg-rose-900/20 border-rose-200 dark:border-rose-800 text-rose-700 dark:text-rose-300"}function $r({controller:t}){const{error:r,currentRunMeta:a,lastAttemptRef:s,handleRetryRun:l,activeRun:n}=t;return r?(a==null?void 0:a.status)==="cancelled"?e.jsxs("div",{role:"status","aria-atomic":"true",className:"p-4 flex flex-col items-center justify-center gap-3 text-center h-full",children:[e.jsx(be,{className:"w-8 h-8 text-gray-400","aria-hidden":"true"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:r}),s.current&&e.jsxs("button",{type:"button",onClick:()=>void l(),disabled:!!n,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-slate-700 dark:text-slate-200 bg-slate-100 dark:bg-slate-700 rounded-md hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Le,{className:"w-4 h-4"})," Retry same input"]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Mt,{error:r,onRetry:s.current?l:void 0}),e.jsx("p",{className:"px-4 pb-4 -mt-6 text-xs text-gray-500 dark:text-gray-400 text-center",children:"Your input above hasn't changed β€” fix it, or retry the exact same request that failed."})]}):null}const Lr=()=>{const t=rr();return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 p-4 sm:p-6 overflow-y-auto lg:overflow-hidden",children:[e.jsx(lr,{controller:t}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 lg:flex-1 lg:min-h-0",children:[e.jsx(mr,{controller:t}),e.jsx(Sr,{controller:t})]})]})};export{Lr as InferencePage,tr as useSavedThresholdInfo}; diff --git a/static/ml_canvas/assets/InferencePage-fhCsGe-z.js b/static/ml_canvas/assets/InferencePage-fhCsGe-z.js deleted file mode 100644 index 62e60dbc1..000000000 --- a/static/ml_canvas/assets/InferencePage-fhCsGe-z.js +++ /dev/null @@ -1,10 +0,0 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,Z as De,e as ge,B as Ie,P as kt,f as X,v as me,X as $e,w as Ae,x as Pe,y as he,W as Nt,z as pe,D as _e,l as Le,h as Je,E as vt,I as St,J as Ct,K as Rt,N as It,t as Ot}from"./vendor-utils-VkF_O5b_.js";import{d as be,D as Oe,t as O,n as Ft,o as Mt,a as Et,q as Tt,b as Dt,E as $t}from"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";const re=`[ - { - "feature1": 0.5, - "feature2": 1.2 - } -]`,ye=5,Ue=[1,5,10,25,100],te=10,At=500,Ve=3e4,Be=1440*60*1e3,ue="inferencePage:lastInput",Fe="inferencePage:sampleSize",Me="inferencePage:resultsView",He="inferencePage:runHistory",se="inferencePage:pendingRun",Ee=()=>{try{const t=localStorage.getItem(He);if(!t)return[];const r=JSON.parse(t);if(!Array.isArray(r))return[];const a=Date.now();return r.filter(s=>s&&typeof s.at=="number"&&a-s.at{try{localStorage.setItem(He,JSON.stringify(t))}catch{}},Pt=t=>!!(t&&typeof t=="object"&&"code"in t&&t.code==="ERR_CANCELED"),_t=(t,r)=>{const a=/position\s+(\d+)/i.exec(t);if(a&&a[1]){const l=Number(a[1]);if(!Number.isFinite(l))return null;const n=r.slice(0,l),i=n.split(` -`).length,c=n.lastIndexOf(` -`),u=c===-1?l+1:l-c;return{line:i,column:u}}const s=/line\s+(\d+)\s+column\s+(\d+)/i.exec(t);return s&&s[1]&&s[2]?{line:Number(s[1]),column:Number(s[2])}:null},Lt=t=>{try{const r=JSON.parse(t);return Array.isArray(r)?{valid:!0,rows:r.length,message:`${r.length} row${r.length===1?"":"s"}`}:{valid:!1,rows:0,message:"Input must be a JSON array of objects"}}catch(r){const a=r.message,s=_t(a,t);return s?{valid:!1,rows:0,message:`${a} (line ${s.line}, col ${s.column})`,line:s.line,column:s.column}:{valid:!1,rows:0,message:a}}},Jt=(t,r)=>{if(r.length===0)return null;let a;try{a=JSON.parse(t)}catch{return null}if(!Array.isArray(a)||a.length===0)return null;const s=new Set(r.map(u=>u.name)),l=new Set;a.forEach(u=>{u&&typeof u=="object"&&Object.keys(u).forEach(g=>l.add(g))});const n=[...s].filter(u=>!l.has(u)),i=[...l].filter(u=>!s.has(u)),c=[];return a.forEach((u,g)=>{const w=u&&typeof u=="object"?new Set(Object.keys(u)):new Set,k=[...s].filter(M=>!w.has(M));k.length>0&&c.push({rowIndex:g,missing:k})}),{missing:n,extra:i,rows:a.length,rowIssues:c}},Ut=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Vt=t=>{const r=t.split(/\r?\n/).filter(s=>s.trim()!=="");if(r.length<2)return[];const a=(r[0]??"").split(",").map(s=>s.trim());return r.slice(1).map(s=>{const l=s.split(","),n={};return a.forEach((i,c)=>{const u=(l[c]??"").trim();if(u===""){n[i]="";return}if(Ut.test(u)){const g=Number(u);n[i]=Number.isFinite(g)?g:u}else n[i]=u}),n})},Bt=t=>t.map(r=>typeof r=="number"?r:Number(r)).filter(r=>Number.isFinite(r)),Ht=t=>{switch(t){case"override":return"ad-hoc override thresholds";case"saved-enabled":return"saved tuned thresholds";default:return"default thresholds"}},zt=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),ae=t=>typeof t=="object"&&t!==null?JSON.stringify(t):String(t),ze=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;const a=Object.entries(t);if(a.length===0)return null;const s={};for(const[n,i]of a){if(!qt(i))return null;s[n]=i}return Object.values(s).some(n=>n>=0&&n<=1)?s:null},Te=(t,r,a)=>{if(r.length>0){const l={};return r.forEach(n=>{a.has(n.name)||(l[n.name]=n.name in t?t[n.name]:0)}),l}const s={};return Object.entries(t).forEach(([l,n])=>{a.has(l)||(s[l]=n)}),s},Wt=t=>{if(t.length===0)return"";const r=Array.from(t.reduce((n,i)=>(Object.keys(i).forEach(c=>n.add(c)),n),new Set)),a=n=>{const i=n==null?"":String(n);return/[",\n]/.test(i)?`"${i.replace(/"/g,'""')}"`:i},s=r.join(","),l=t.map(n=>r.map(i=>a(n[i])).join(",")).join(` -`);return`${s} -${l}`},qt=t=>typeof t=="number"&&Number.isFinite(t);function Kt(t){const[r,a]=d.useState(null),[s,l]=d.useState(null),[n,i]=d.useState(new Set),[c,u]=d.useState(!1),[g,w]=d.useState(()=>{try{const m=Number(localStorage.getItem(Fe));return Ue.includes(m)?m:1}catch{return 1}}),[k,M]=d.useState(null),b=d.useMemo(()=>(r==null?void 0:r.input_schema)??[],[r]);d.useEffect(()=>{try{localStorage.setItem(Fe,String(g))}catch{}},[g]);const _=async(m,v,C,F)=>{try{const N=await Ft.getJob(m.job_id),T=N.target_column,D=N.dropped_columns||[];if(Yt(F,T,D),N.dataset_id){l(N.dataset_id);const J=await Oe.getSample(N.dataset_id,1);if(J.length>0){const E=J[0];if(C)Object.keys(v).forEach($=>{$ in E&&(v[$]=E[$])});else{v=Te(E,[],F);const $=Gt(T,D);$&&M($)}}}}catch(N){console.warn("Failed to fetch dataset sample",N)}return v},I=d.useCallback(async()=>{try{const m=await be.getActive();if(a(m),!m){l(null),i(new Set);return}let v={},C=!1;const F=new Set;m.input_schema&&m.input_schema.length>0&&(m.input_schema.forEach(N=>{v[N.name]=0}),C=!0,M(`Schema loaded from artifacts (${m.input_schema.length} features)`)),m.job_id&&(v=await _(m,v,C,F)),i(F),Xt(v,t)}catch(m){console.error("Failed to load active deployment",m),a(null),l(null),i(new Set)}},[t]);d.useEffect(()=>{I()},[I]);const K=d.useCallback(async()=>{if(!(!s||c)){u(!0);try{const m=await Oe.getSample(s,g);if(m.length===0){O.error("Dataset returned no rows");return}const v=m.map(C=>Te(C,b,n));t(JSON.stringify(v,null,2)),O.success(`Loaded ${v.length} sample row${v.length===1?"":"s"}`+(n.size>0?` (excluded ${n.size} cols)`:""))}catch(m){console.error("Failed to reload sample",m),O.error("Could not fetch new samples")}finally{u(!1)}}},[s,c,g,b,n,t]);return{activeDeployment:r,setActiveDeployment:a,datasetId:s,setDatasetId:l,excludedColumns:n,setExcludedColumns:i,isReloadingSample:c,sampleSize:g,setSampleSize:w,autoFilterInfo:k,schemaChips:b,handleReloadSample:K}}function Yt(t,r,a){typeof r=="string"&&r&&t.add(r),a.forEach(s=>{typeof s=="string"&&s&&t.add(s)})}function Gt(t,r){const a=[];return t&&a.push(`Target: ${t}`),r.length>0&&a.push(`Dropped: ${r.length} cols`),a.length>0?`Auto-filtered from dataset: ${a.join(", ")}`:null}function Xt(t,r){if(Object.keys(t).length>0){let a=!1;try{const s=localStorage.getItem(ue);a=s==null||s===re}catch{a=!0}a&&r(JSON.stringify([t],null,2))}}function Zt(t,r,a){const s=d.useRef(null),l=d.useRef(null),n=d.useRef(null),i=d.useRef(0),c=d.useRef(null),[u,g]=d.useState(null),[w,k]=d.useState(null),[M,b]=d.useState(null),[_,I]=d.useState(()=>Ee()),[K,m]=d.useState(null),[v,C]=d.useState(null),[F,N]=d.useState(null),T=d.useCallback(p=>{I(j=>{const y=[p,...j].slice(0,ye);return xe(y),y})},[]);d.useEffect(()=>{let p=null;try{const y=localStorage.getItem(se);y&&(p=JSON.parse(y))}catch{p=null}try{localStorage.removeItem(se)}catch{}if(p){const y={...p,status:"failure",latencyMs:null,predictions:null,errorMessage:"This run was still in progress when the page was reloaded or closed β€” its outcome is unknown. Retry to get a fresh result."};b(y),m(y.errorMessage),T(y);return}const j=Ee()[0];j&&(b(j),j.status==="success"?(g(j.predictions),C(j.latencyMs),N(j.overrideThresholdsUsed)):m(j.errorMessage))},[]);const D=d.useCallback(async(p,j,y,B)=>{if(!t||s.current)return;const H=++i.current,L=`run-${Date.now().toString(36)}-${H}`,z=`Run #${H}`,U=Qt(j,r),Y=new AbortController;l.current=Y,s.current=L,n.current=null,c.current={data:p,overrideThresholds:j,inputSnapshot:y,runId:L};const Z={runId:L,label:z,at:Date.now(),rows:p.length,jobId:t.job_id,modelType:t.model_type,modelVersion:null,thresholdContext:U,input:y,overrideThresholdsUsed:j};tr(Z);const ne=window.setTimeout(()=>{n.current="timeout",Y.abort()},Ve);k({runId:L,label:z,submittedAt:Date.now(),retryOf:(B==null?void 0:B.retryOf)??null}),m(null);const le=performance.now();try{const A=await be.predict(p,j,{signal:Y.signal}),W=Math.round(performance.now()-le);g(A.predictions),C(W),N(A.thresholds_applied??null);const V={runId:L,label:z,status:"success",at:Date.now(),rows:p.length,latencyMs:W,jobId:t.job_id,modelType:t.model_type,modelVersion:A.model_version??null,thresholdContext:U,input:y,overrideThresholdsUsed:j,predictions:A.predictions,errorMessage:null};b(V),T(V)}catch(A){const{status:W,message:V}=er(A,n.current);g(null),C(null),N(null),m(V);const Q={runId:L,label:z,status:W,at:Date.now(),rows:p.length,latencyMs:null,jobId:t.job_id,modelType:t.model_type,modelVersion:null,thresholdContext:U,input:y,overrideThresholdsUsed:j,predictions:null,errorMessage:V};b(Q),T(Q)}finally{window.clearTimeout(ne),n.current=null,l.current=null,s.current=null,k(null);try{localStorage.removeItem(se)}catch{}}},[t,r,T]),J=d.useCallback(async()=>{const p=c.current;!p||w||await D(p.data,p.overrideThresholds,p.inputSnapshot,{retryOf:p.runId})},[w,D]),E=d.useCallback(()=>{l.current&&(n.current="user",l.current.abort())},[]);return{lastAttemptRef:c,predictions:u,setPredictions:g,activeRun:w,currentRunMeta:M,setCurrentRunMeta:b,runHistory:_,setRunHistory:I,error:K,setError:m,latencyMs:v,setLatencyMs:C,thresholdsApplied:F,setThresholdsApplied:N,submitRun:D,handleRetryRun:J,handleCancelRun:E,handleRestoreRun:p=>{a(p.input),b(p),p.status==="success"?(g(p.predictions),C(p.latencyMs),N(p.overrideThresholdsUsed),m(null)):(g(null),C(null),N(null),m(p.errorMessage))},handleClearRunHistory:()=>{I([]),xe([])}}}function Qt(t,r){return t?"override":r!=null&&r.enabled?"saved-enabled":"none"}function er(t,r){const a=Pt(t),s=a&&r==="timeout",l=a&&!s?"cancelled":"failure",n=s?`The server did not respond within ${Math.round(Ve/1e3)}s. Your input is unchanged β€” retry, or check the deployment.`:l==="cancelled"?"Run cancelled β€” your input is unchanged.":t.message||"Prediction failed";return{status:l,message:n}}function tr(t){try{localStorage.setItem(se,JSON.stringify(t))}catch{}}const rr=t=>{const[r,a]=d.useState(null),s=d.useRef(0);return d.useEffect(()=>{const l=++s.current;if(!t){a(null);return}let n=!1;return a(null),Mt.get(t).then(i=>{n||s.current!==l||a(i)}).catch(i=>{n||s.current!==l||(console.warn("Failed to fetch saved tuned thresholds",i),a(null))}),()=>{n=!0}},[t]),r};function sr(){const t=Et(),r=d.useRef(null),a=d.useRef(null),[s,l]=d.useState(()=>{try{return localStorage.getItem(ue)??re}catch{return re}}),{activeDeployment:n,setActiveDeployment:i,datasetId:c,setDatasetId:u,excludedColumns:g,setExcludedColumns:w,isReloadingSample:k,sampleSize:M,setSampleSize:b,autoFilterInfo:_,schemaChips:I,handleReloadSample:K}=Kt(l),[m,v]=d.useState(!1),[C,F]=d.useState({}),[N,T]=d.useState(""),[D,J]=d.useState("0.5"),E=rr((n==null?void 0:n.job_id)??null),{lastAttemptRef:$,predictions:R,setPredictions:p,activeRun:j,currentRunMeta:y,setCurrentRunMeta:B,runHistory:H,setRunHistory:L,error:z,setError:U,latencyMs:Y,setLatencyMs:Z,thresholdsApplied:ne,setThresholdsApplied:le,submitRun:A,handleRetryRun:W,handleCancelRun:V,handleRestoreRun:Q,handleClearRunHistory:qe}=Zt(n,E,l),[Ke,Ye]=d.useState(!1),[oe,Ge]=d.useState(()=>{try{return localStorage.getItem(Me)==="table"?"table":"list"}catch{return"list"}}),[Xe,ie]=d.useState(!1),[ee,fe]=d.useState(!1),de=d.useMemo(()=>Lt(s),[s]),S=d.useMemo(()=>Jt(s,I),[s,I]),Ze=d.useMemo(()=>I.some(o=>o.type==="unknown"),[I]),Qe=(S==null?void 0:S.rowIssues.map(o=>`${o.rowIndex}:${o.missing.join(",")}`).join("|"))??"";d.useEffect(()=>{fe(!1)},[Qe]);const et=d.useMemo(()=>{if(!R||R.length===0)return null;const o=Bt(R);if(o.length===0)return null;const x=Math.min(...o),h=Math.max(...o),f=o.reduce((P,q)=>P+q,0)/o.length;return{count:o.length,mean:f,min:x,max:h,values:o}},[R]),je=d.useMemo(()=>{if(!de.valid)return[];try{const o=JSON.parse(s);return Array.isArray(o)?o:[]}catch{return[]}},[de.valid,s]),ce=d.useMemo(()=>!R||R.length!==1?null:ze(R[0]),[R]);d.useEffect(()=>{try{localStorage.setItem(ue,s)}catch{}},[s]),d.useEffect(()=>{try{localStorage.setItem(Me,oe)}catch{}},[oe]);const we=d.useCallback(o=>{try{const x=Vt(o);if(x.length===0){O.error("CSV had no data rows");return}const h=x.map(f=>{if(g.size===0)return f;const P={};return Object.entries(f).forEach(([q,G])=>{g.has(q)||(P[q]=G)}),P});l(JSON.stringify(h,null,2)),O.success(`Loaded ${h.length} row${h.length===1?"":"s"} from CSV`)}catch(x){console.error("CSV parse failed",x),O.error("Could not parse CSV")}},[g]),ke=d.useCallback(o=>{const x=new FileReader;x.onload=()=>we(String(x.result??"")),x.onerror=()=>O.error("Could not read file"),x.readAsText(o)},[we]),tt=o=>{var h;const x=(h=o.target.files)==null?void 0:h[0];x&&ke(x),o.target.value=""},rt=o=>{o.dataTransfer.types.includes("Files")&&(o.preventDefault(),ie(!0))},st=o=>{o.currentTarget===o.target&&ie(!1)},at=o=>{var h;o.preventDefault(),ie(!1);const x=(h=o.dataTransfer.files)==null?void 0:h[0];if(x){if(!x.name.toLowerCase().endsWith(".csv")){O.error("Only .csv files are supported");return}ke(x)}},nt=async()=>{if(!S||S.rowIssues.length===0)return;const o=S.rowIssues.slice(0,8).map(f=>`Row ${f.rowIndex+1}: ${f.missing.join(", ")} β†’ 0`),x=S.rowIssues.length>8?S.rowIssues.length-8:0;if(await t({title:"Fill missing fields with 0?",message:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"This only fills in fields that are absent from a row. Fields that are already present keep their current value even if it looks wrong for this model β€” review those yourself before running."}),e.jsxs("ul",{className:"text-xs font-mono bg-gray-50 dark:bg-gray-900 rounded p-2 space-y-0.5 max-h-32 overflow-auto",children:[o.map(f=>e.jsx("li",{children:f},f)),x>0&&e.jsxs("li",{children:["…and ",x," more row(s)"]})]})]}),confirmLabel:"Fill with 0"}))try{const P=JSON.parse(s).map(q=>{const G={...q};return S.missing.forEach(Re=>{Re in G||(G[Re]=0)}),G});l(JSON.stringify(P,null,2)),O.success(`Filled ${S.missing.length} missing field(s) with 0 β€” verify values before running`)}catch{O.error("Cannot pad: invalid JSON")}},lt=async()=>{if(await t({title:"Undeploy model?",message:"Are you sure you want to undeploy the current model?",confirmLabel:"Undeploy",variant:"danger"}))try{await be.deactivate(),i(null),u(null),w(new Set),p(null),Z(null),B(null),L([]),xe([])}catch(x){console.error("Failed to deactivate",x),O.error("Failed to undeploy model")}},Ne=d.useCallback(async()=>{if(!n||j||ar(S,ee))return;let o;try{o=lr(s)}catch(x){U(x.message);return}o.length>At&&!await nr(o.length,t)||await A(o,m?C:null,s)},[n,j,s,t,m,C,S,ee,A,U]),ot=()=>{try{const o=JSON.parse(s);l(JSON.stringify(o,null,2))}catch{O.error("Cannot format: invalid JSON")}},it=()=>{l(re),p(null),U(null),Z(null),le(null),B(null)},dt=o=>{(o.metaKey||o.ctrlKey)&&o.key==="Enter"&&(o.preventDefault(),Ne())},ct=()=>{const o=N.trim(),x=Number(D);!o||!Number.isFinite(x)||(F(h=>({...h,[o]:x})),T(""),J("0.5"))},ut=o=>{F(x=>{const h={...x};return delete h[o],h})},xt=(o,x)=>{const h=Number(x);Number.isFinite(h)&&F(f=>({...f,[o]:h}))},gt=()=>{E!=null&&E.thresholds&&(F({...E.thresholds}),v(!0))},mt=()=>{ce&&F(o=>{const x={...o};for(const h of Object.keys(ce))h in x||(x[h]=.5);return x})},ht=async()=>{if(R)try{await navigator.clipboard.writeText(JSON.stringify(R,null,2)),O.success("Copied predictions to clipboard")}catch{O.error("Failed to copy")}},ve=(o,x)=>{const h=URL.createObjectURL(o),f=document.createElement("a");f.href=h,f.download=x,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(h)},Se=d.useMemo(()=>{const o=(y==null?void 0:y.jobId)??"unknown-job",x=(y==null?void 0:y.runId)??`run-${Date.now()}`;return`predictions_${o}_${x}`},[y]),pt=()=>{R&&ve(new Blob([JSON.stringify(R,null,2)],{type:"application/json"}),`${Se}.json`)},bt=()=>{if(!R)return;const o=je.map((h,f)=>{const P=h&&typeof h=="object"?{...h}:{};return P.prediction=ae(R[f]),P}),x=o.length>0?o:R.map((h,f)=>({row:f+1,prediction:ae(h)}));ve(new Blob([Wt(x)],{type:"text/csv;charset=utf-8"}),`${Se}.csv`)},yt=_&&!Ke,ft=S&&(S.missing.length>0||S.extra.length>0),Ce=!!(S&&S.rowIssues.length>0),jt=!Ce||ee,wt=d.useMemo(()=>[...H].reverse().map(o=>o.latencyMs).filter(o=>o!=null),[H]);return{csvInputRef:r,editorWrapRef:a,lastAttemptRef:$,activeDeployment:n,datasetId:c,excludedColumns:g,inputData:s,setInputData:l,predictions:R,activeRun:j,currentRunMeta:y,runHistory:H,isReloadingSample:k,sampleSize:M,setSampleSize:b,error:z,latencyMs:Y,thresholdsApplied:ne,overrideThresholdsEnabled:m,setOverrideThresholdsEnabled:v,overrideThresholdsValue:C,newOverrideClass:N,setNewOverrideClass:T,newOverrideThreshold:D,setNewOverrideThreshold:J,savedThresholds:E,autoFilterInfo:_,setBannerDismissed:Ye,resultsView:oe,setResultsView:Ge,isDragging:Xe,acknowledgeMissingFields:ee,setAcknowledgeMissingFields:fe,inputStatus:de,schemaChips:I,schemaCheck:S,hasUnknownTypedFields:Ze,predictionStats:et,parsedInputRows:je,singleProbMap:ce,handleReloadSample:K,handleCsvChange:tt,handleDragOver:rt,handleDragLeave:st,handleDrop:at,handleFixMissingFields:nt,handleDeactivate:lt,handlePredict:Ne,handleRetryRun:W,handleCancelRun:V,handleFormatJson:ot,handleClearInput:it,handleTextareaKeyDown:dt,handleAddOverrideEntry:ct,handleRemoveOverrideEntry:ut,handleOverrideThresholdChange:xt,handlePrefillFromSavedThresholds:gt,handlePrefillFromLastPrediction:mt,handleCopyPredictions:ht,handleDownloadJson:pt,handleDownloadCsv:bt,handleRestoreRun:Q,handleClearRunHistory:qe,showBanner:yt,hasSchemaIssues:ft,hasBlockingMissingFields:Ce,canRunPrediction:jt,recentLatencies:wt}}function ar(t,r){return t&&t.rowIssues.length>0&&!r}async function nr(t,r){return r({title:"Large batch",message:`You are about to send ${t} rows. Continue?`,confirmLabel:"Send"})}function lr(t){const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("Input must be a JSON array of objects");return r}function or({controller:t}){const{activeDeployment:r,handleDeactivate:a}=t;return e.jsxs("header",{className:"shrink-0 mb-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[e.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(De,{className:"w-6 h-6 text-blue-500 shrink-0"}),"Testing Model Inference"]}),r?e.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-xs min-w-0",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400 border border-green-200 dark:border-green-800 font-medium",children:[e.jsx(ge,{className:"w-3.5 h-3.5 shrink-0"})," Active"]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 min-w-0",children:[e.jsx(Ie,{className:"w-3.5 h-3.5 text-blue-500 shrink-0"}),e.jsx("span",{className:"truncate max-w-[10rem]",children:r.model_type})]}),e.jsx("span",{className:"hidden sm:inline-flex items-center px-2 py-1 rounded-full bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 border border-gray-200 dark:border-gray-700 font-mono min-w-0",title:`Job ${r.job_id} Β· deployed ${new Date(r.created_at).toLocaleString()}`,children:e.jsx("span",{className:"truncate max-w-[8rem]",children:r.job_id})}),e.jsxs("button",{onClick:()=>void a(),className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-red-50 text-red-600 border border-red-200 hover:bg-red-100 dark:bg-red-900/30 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/50 transition-colors",title:"Undeploy model",children:[e.jsx(kt,{className:"w-3.5 h-3.5"})," Undeploy"]})]}):e.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-xs",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-gray-500 dark:text-gray-400 italic",children:[e.jsx(X,{className:"w-4 h-4 shrink-0"}),"No model is currently deployed."]}),e.jsxs(Tt,{to:"/registry",className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-blue-50 text-blue-600 border border-blue-200 hover:bg-blue-100 dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800 dark:hover:bg-blue-900/50 transition-colors",children:[e.jsx(Ie,{className:"w-3.5 h-3.5"})," Browse Model Registry"]})]})]})}const ir=({values:t})=>{const r=d.useMemo(()=>{if(t.length===0)return null;const i=Math.min(...t),c=Math.max(...t);if(i===c)return{min:i,max:c,bins:[t.length]};const u=(c-i)/te,g=new Array(te).fill(0);return t.forEach(w=>{let k=Math.floor((w-i)/u);k>=te&&(k=te-1);const M=g[k];g[k]=(M??0)+1}),{min:i,max:c,bins:g}},[t]);if(!r)return null;const a=220,s=48,l=Math.max(...r.bins,1),n=a/r.bins.length;return e.jsxs("div",{className:"flex items-center gap-2",title:"Distribution of predictions",children:[e.jsx("svg",{width:a,height:s,className:"text-blue-500",children:r.bins.map((i,c)=>{const u=i/l*(s-4);return e.jsx("rect",{x:c*n+1,y:s-u,width:Math.max(1,n-2),height:u,fill:"currentColor",opacity:.85},c)})}),e.jsxs("div",{className:"flex flex-col text-[10px] text-gray-400 leading-tight",children:[e.jsx("span",{className:"tabular-nums",children:r.max.toFixed(2)}),e.jsx("span",{className:"tabular-nums",children:r.min.toFixed(2)})]})]})},dr=({values:t})=>{if(t.length<2)return null;const r=60,a=16,s=Math.max(...t),l=Math.min(...t),n=s-l||1,i=t.map((c,u)=>{const g=u/(t.length-1)*r,w=a-(c-l)/n*(a-2)-1;return`${g},${w}`}).join(" ");return e.jsx("svg",{width:r,height:a,className:"text-blue-400","aria-hidden":"true",children:e.jsx("polyline",{points:i,fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})},We=({probs:t})=>{const r=Object.entries(t).sort(([,s],[,l])=>l-s),a=Math.max(...r.map(([,s])=>s),1);return e.jsx("div",{className:"flex flex-col gap-1 w-full",children:r.map(([s,l],n)=>{const i=l/a*100,c=n===0;return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`font-mono shrink-0 w-20 truncate ${c?"text-blue-700 dark:text-blue-300 font-semibold":"text-gray-500 dark:text-gray-400"}`,title:s,children:s}),e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${c?"bg-blue-500":"bg-gray-300 dark:bg-gray-600"}`,style:{width:`${i}%`}})}),e.jsxs("span",{className:"tabular-nums w-12 text-right text-gray-600 dark:text-gray-300",children:[(l*100).toFixed(1),"%"]})]},s)})})},cr=({rows:t,predictions:r})=>{const a=d.useMemo(()=>{const s=new Set;return t.forEach(l=>{l&&typeof l=="object"&&Object.keys(l).forEach(n=>s.add(n))}),[...s]},[t]);return t.length===0?null:e.jsx("div",{className:"overflow-auto h-full",children:e.jsxs("table",{className:"w-full text-xs border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-gray-50 dark:bg-gray-900",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-2 py-1 text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700 w-8",children:"#"}),a.map(s=>e.jsx("th",{className:"text-left px-2 py-1 text-gray-500 dark:text-gray-400 font-medium border-b border-gray-200 dark:border-gray-700",children:s},s)),e.jsx("th",{className:"text-left px-2 py-1 text-blue-500 font-semibold border-b border-gray-200 dark:border-gray-700 sticky right-0 bg-gray-50 dark:bg-gray-900",children:"prediction"})]})}),e.jsx("tbody",{children:t.map((s,l)=>{const n=s&&typeof s=="object"?s:{};return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/40",children:[e.jsx("td",{className:"px-2 py-1 text-gray-400 tabular-nums",children:l+1}),a.map(i=>e.jsx("td",{className:"px-2 py-1 font-mono text-gray-700 dark:text-gray-300 truncate max-w-[140px]",title:String(n[i]??""),children:n[i]===void 0?e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"β€”"}):String(n[i])},i)),e.jsx("td",{className:"px-2 py-1 font-mono font-medium text-blue-600 dark:text-blue-400 sticky right-0 bg-white dark:bg-gray-800",children:ae(r[l])})]},l)})})]})})},ur=({value:t,onChange:r,disabled:a})=>e.jsx("div",{className:`inline-flex rounded-md overflow-hidden border ${a?"border-gray-200 dark:border-gray-700 opacity-50 cursor-not-allowed":"border-gray-200 dark:border-gray-600"}`,role:"group","aria-label":"Sample row count",children:Ue.map(s=>{const l=s===t;return e.jsx("button",{type:"button",disabled:a,onClick:()=>r(s),className:`px-2 py-1 text-[11px] font-medium tabular-nums transition-colors border-r last:border-r-0 ${a?"border-gray-200 dark:border-gray-700":"border-gray-200 dark:border-gray-600"} ${l?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Fetch ${s} sample row${s===1?"":"s"}`,children:s},s)})});function xr({controller:t}){const{overrideThresholdsEnabled:r,setOverrideThresholdsEnabled:a,overrideThresholdsValue:s,handleOverrideThresholdChange:l,handleRemoveOverrideEntry:n,newOverrideClass:i,setNewOverrideClass:c,newOverrideThreshold:u,setNewOverrideThreshold:g,handleAddOverrideEntry:w,singleProbMap:k,handlePrefillFromLastPrediction:M}=t;return e.jsxs("details",{className:"mt-3 shrink-0 rounded-lg border border-gray-200 dark:border-gray-700 group overflow-hidden",children:[e.jsxs("summary",{className:"cursor-pointer select-none px-3 py-2 text-xs font-medium text-gray-600 dark:text-gray-300 flex items-center gap-2",children:[e.jsx(me,{className:"w-3.5 h-3.5"})," Advanced: override thresholds"]}),e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 border-t border-gray-100 dark:border-gray-700",children:[e.jsx(gr,{controller:t}),e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:b=>a(b.target.checked)}),"Apply these thresholds to this prediction"]}),Object.entries(s).length>0&&e.jsx("div",{className:"space-y-1",children:Object.entries(s).map(([b,_])=>e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-mono text-xs w-28 truncate text-gray-700 dark:text-gray-200",title:b,children:b}),e.jsx("input",{type:"number",min:0,max:1,step:.01,value:_,onChange:I=>l(b,I.target.value),className:"w-24 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("button",{onClick:()=>n(b),title:"Remove",className:"p-1 rounded text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/30",children:e.jsx($e,{className:"w-3.5 h-3.5"})})]},b))}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),placeholder:"class label",className:"w-28 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("input",{type:"number",min:0,max:1,step:.01,value:u,onChange:b=>g(b.target.value),className:"w-24 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100"}),e.jsx("button",{onClick:w,disabled:!i.trim(),className:"px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",children:"Add"})]}),k&&e.jsx("button",{onClick:M,className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline",children:"Use classes from last prediction"}),e.jsx("p",{className:"text-[10px] text-gray-400 italic",children:"Class labels must exactly match the deployed model's classes (e.g. 0, 1, 2), or the prediction will be rejected."})]})]})}function gr({controller:t}){const{savedThresholds:r,activeDeployment:a,handlePrefillFromSavedThresholds:s}=t;return!(r!=null&&r.thresholds)||!a?null:e.jsxs("div",{className:`p-2 rounded border text-[11px] ${r.enabled?"bg-blue-50 dark:bg-blue-900/20 border-blue-100 dark:border-blue-800 text-blue-700 dark:text-blue-300":"bg-slate-50 dark:bg-slate-800/60 border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-300"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-1",children:[e.jsx("strong",{children:r.enabled?"Saved tuned thresholds are enabled":"Saved tuned thresholds are available but disabled"}),e.jsxs("span",{className:"font-mono opacity-80",children:["Β· Job ",a.job_id," Β· ",a.model_type]})]}),e.jsx(mr,{savedThresholds:r}),e.jsx("div",{className:"flex flex-wrap gap-1 mb-1.5",children:Object.entries(r.thresholds).map(([l,n])=>e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded font-mono ${r.enabled?"bg-blue-100 dark:bg-blue-900/40":"bg-slate-100 dark:bg-slate-700/80"}`,children:[l,": ",n]},l))}),e.jsx("button",{onClick:s,className:"text-current hover:underline font-medium",children:"Copy into override editor to tweak"})]})}function mr({savedThresholds:t}){return e.jsxs("div",{className:"grid grid-cols-1 gap-0.5 mb-1.5",children:[e.jsxs("span",{children:["Optimized for ",e.jsx("strong",{children:t.metric??"unknown metric"})]}),e.jsxs("span",{children:["Computed from ",e.jsx("strong",{children:t.split_used??"unknown"})," split"]}),t.source==="training"&&e.jsxs("span",{children:["Seeded at ",e.jsx("strong",{children:"training time"})," (Tune decision threshold)"]}),t.computed_at&&e.jsxs("span",{children:["Computed at ",e.jsx("strong",{children:new Date(t.computed_at).toLocaleString()})]})]})}function hr({controller:t}){return e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 sm:p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 flex flex-col lg:h-full lg:min-h-0",children:[e.jsx(pr,{controller:t}),e.jsx(br,{controller:t}),e.jsx(yr,{controller:t}),e.jsx(fr,{controller:t}),e.jsx(jr,{controller:t}),e.jsx(wr,{controller:t}),e.jsx(kr,{controller:t}),e.jsx(xr,{controller:t})]})}function pr({controller:t}){const{csvInputRef:r,handleCsvChange:a,sampleSize:s,setSampleSize:l,datasetId:n,handleReloadSample:i,isReloadingSample:c,handleFormatJson:u,inputStatus:g,handleClearInput:w}=t;return e.jsxs("div",{className:"flex justify-between items-start mb-3 gap-3 flex-wrap",children:[e.jsx("h3",{id:"inference-input-heading",className:"text-lg font-medium text-gray-800 dark:text-gray-100",children:"Input Data (JSON)"}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx("input",{ref:r,type:"file",accept:".csv,text/csv",className:"hidden",onChange:a}),e.jsxs("button",{onClick:()=>{var k;return(k=r.current)==null?void 0:k.click()},className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Upload a CSV file (or drag & drop). Target/dropped columns are stripped automatically.",children:[e.jsx(Ae,{className:"w-3 h-3"})," CSV"]}),e.jsx(ur,{value:s,onChange:l,disabled:!n}),e.jsxs("button",{onClick:()=>void i(),disabled:!n||c,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",title:"Load fresh random rows from the training dataset (target / dropped columns excluded)",children:[e.jsx(Pe,{className:`w-3 h-3 ${c?"animate-spin":""}`}),"Sample"]}),e.jsxs("button",{onClick:u,disabled:!g.valid,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40 disabled:cursor-not-allowed",title:"Pretty-print JSON",children:[e.jsx(me,{className:"w-3 h-3"})," Format"]}),e.jsxs("button",{onClick:w,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Reset the editor and clear results",children:[e.jsx(he,{className:"w-3 h-3"})," Clear"]})]})]})}function br({controller:t}){const{schemaChips:r}=t;return e.jsx(e.Fragment,{children:r.length>0&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 overflow-x-auto pb-1 scrollbar-thin",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gray-400 shrink-0",children:"Schema"}),r.map(a=>e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-600",title:`${a.name} (${a.type})`,children:[e.jsx("span",{className:"font-mono",children:a.name}),e.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:a.type})]},a.name))]})})}function yr({controller:t}){const{excludedColumns:r}=t;return e.jsx(e.Fragment,{children:r.size>0&&e.jsxs("div",{className:"mb-3 flex items-center gap-2 overflow-x-auto pb-1 scrollbar-thin text-[11px]",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-gray-400 shrink-0",children:"Excluded"}),[...r].map(a=>e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-rose-50 dark:bg-rose-900/30 text-rose-700 dark:text-rose-300 border border-rose-200 dark:border-rose-800",title:"Stripped automatically from CSV uploads and Sample calls",children:[e.jsx(he,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:a})]},a))]})})}function fr({controller:t}){const{showBanner:r,autoFilterInfo:a,setBannerDismissed:s}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mb-3 flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300 bg-amber-50 dark:bg-amber-900/20 px-3 py-2 rounded border border-amber-200 dark:border-amber-800",children:[e.jsxs("span",{className:"flex-1",children:[a,e.jsx("span",{className:"block text-[10px] text-amber-600/80 dark:text-amber-400/80 mt-0.5",children:"Please verify fields before running."})]}),e.jsx("button",{onClick:()=>s(!0),className:"text-amber-500 hover:text-amber-700 dark:hover:text-amber-200",title:"Dismiss",children:e.jsx($e,{className:"w-3 h-3"})})]})})}function jr({controller:t}){const{editorWrapRef:r,handleDragOver:a,handleDragLeave:s,handleDrop:l,inputStatus:n,inputData:i,setInputData:c,handleTextareaKeyDown:u,isDragging:g}=t;return e.jsxs("div",{ref:r,onDragOver:a,onDragLeave:s,onDrop:l,className:"relative flex-1 min-h-[16rem] lg:min-h-0",children:[e.jsx("textarea",{id:"inference-input-editor","aria-labelledby":"inference-input-heading","aria-describedby":"inference-input-status","aria-invalid":!n.valid,className:"absolute inset-0 w-full h-full p-4 font-mono text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none resize-none",value:i,onChange:w=>c(w.target.value),onKeyDown:u,placeholder:'[{"col1": 1, "col2": "A"}]',spellCheck:!1}),g&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-blue-500/10 dark:bg-blue-400/10 border-2 border-dashed border-blue-400 dark:border-blue-500 rounded-lg",children:e.jsxs("div",{className:"flex items-center gap-2 text-blue-600 dark:text-blue-300 font-medium text-sm",children:[e.jsx(Ae,{className:"w-5 h-5"}),"Drop CSV to ingest"]})})]})}function wr({controller:t}){const{hasSchemaIssues:r,schemaCheck:a,handleFixMissingFields:s,hasBlockingMissingFields:l,acknowledgeMissingFields:n,setAcknowledgeMissingFields:i,hasUnknownTypedFields:c}=t;return a?e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.missing.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-rose-50 dark:bg-rose-900/30 text-rose-700 dark:text-rose-300 border border-rose-200 dark:border-rose-800",title:a.missing.join(", "),children:[e.jsx(X,{className:"w-3 h-3"}),a.missing.length," missing"]}),e.jsxs("button",{onClick:()=>void s(),className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors",title:"Review and fill missing fields with value 0",children:[e.jsx(Nt,{className:"w-3 h-3"})," Fix"]})]}),a.extra.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-amber-50 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 border border-amber-200 dark:border-amber-800",title:a.extra.join(", "),children:[e.jsx(X,{className:"w-3 h-3"}),a.extra.length," extra"]}),e.jsx("span",{className:"text-[10px] text-gray-400 italic ml-1",children:"Hover badges for field names."})]}),e.jsx(Sr,{schemaCheck:a}),l&&e.jsxs("label",{className:"flex items-start gap-1.5 text-gray-600 dark:text-gray-300 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:u=>i(u.target.checked),className:"mt-0.5","data-testid":"acknowledge-missing-fields"}),e.jsx("span",{children:"I understand some rows are missing schema fields and want to run anyway."})]}),c&&e.jsx("p",{className:"text-[10px] text-gray-400 italic",children:"This model's schema doesn't report field types β€” values are checked for presence only, not type or range, before sending."})]})}):null}function kr({controller:t}){const{activeDeployment:r,activeRun:a,inputStatus:s,canRunPrediction:l,handleCancelRun:n,handlePredict:i}=t,c=!r||!!a||!s.valid||!l;return e.jsxs("div",{className:"mt-3 flex justify-between items-center gap-3 flex-wrap",children:[e.jsx(Nr,{controller:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("kbd",{className:"hidden md:inline-flex items-center gap-1 text-[10px] text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded border border-gray-200 dark:border-gray-600 font-mono",children:["Ctrl",e.jsx("span",{className:"text-gray-400",children:"+"}),"Enter"]}),a&&e.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-red-600 dark:text-red-400 border border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors",title:`Cancel ${a.label}`,children:[e.jsx(pe,{className:"w-4 h-4"})," Cancel"]}),e.jsx("button",{onClick:()=>void i(),disabled:c,title:vr(l,a),className:`flex items-center gap-2 px-4 py-2 rounded-lg font-medium transition-colors ${c?"bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-gray-800 dark:text-gray-600":"action-primary shadow-sm"}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"w-4 h-4 animate-spin"})," ",a.label," running…"]}):e.jsxs(e.Fragment,{children:[e.jsx(Le,{className:"w-4 h-4"})," Run Prediction"]})})]})]})}function Nr({controller:t}){const{inputStatus:r}=t;return e.jsx("span",{id:"inference-input-status",role:"status",className:`text-xs flex items-center gap-1 ${r.valid?"text-gray-500 dark:text-gray-400":"text-red-600 dark:text-red-400"}`,children:r.valid?e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"w-3 h-3"})," ",r.message]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"w-3 h-3"})," ",r.message]})})}function vr(t,r){return t?r?`${r.label} is already running`:void 0:"Some rows are missing schema fields β€” fix them or check the acknowledgement above to run anyway"}function Sr({schemaCheck:t}){return e.jsx(e.Fragment,{children:t.rowIssues.length>0&&e.jsxs("ul",{"data-testid":"schema-row-issues",className:"font-mono bg-rose-50/60 dark:bg-rose-900/10 border border-rose-100 dark:border-rose-900/40 rounded px-2 py-1 space-y-0.5 max-h-20 overflow-auto",children:[t.rowIssues.slice(0,5).map(r=>e.jsxs("li",{className:"text-rose-700 dark:text-rose-300",children:["Row ",r.rowIndex+1,": missing ",r.missing.join(", ")]},r.rowIndex)),t.rowIssues.length>5&&e.jsxs("li",{className:"text-rose-500 dark:text-rose-400",children:["…and ",t.rowIssues.length-5," more row(s)"]})]})})}function Cr({controller:t}){const{singleProbMap:r}=t;return e.jsx("div",{className:"flex flex-col lg:h-full lg:min-h-0",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 sm:p-6 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 flex flex-col flex-1 min-h-[20rem] lg:min-h-0",children:[e.jsx(Rr,{controller:t}),e.jsx(Ir,{controller:t}),e.jsx(Or,{controller:t}),e.jsx(Fr,{controller:t}),r&&e.jsxs("div",{className:"mb-3 p-3 rounded bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-gray-400 mb-2 flex items-center gap-1",children:[e.jsx(Je,{className:"w-3 h-3"})," Class probabilities"]}),e.jsx(We,{probs:r})]}),e.jsx(Mr,{controller:t}),e.jsx(Er,{controller:t}),e.jsx(Tr,{controller:t})]})})}function Rr({controller:t}){const{latencyMs:r,predictions:a,setResultsView:s,resultsView:l,handleCopyPredictions:n,handleDownloadJson:i,handleDownloadCsv:c}=t;return e.jsxs("div",{className:"flex justify-between items-center mb-4 gap-3 flex-wrap",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-800 dark:text-gray-100",children:"Prediction Results"}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r!=null&&e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(De,{className:"w-3 h-3"})," ",r," ms (client-observed)"]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex border border-gray-200 dark:border-gray-700 rounded overflow-hidden",children:[e.jsxs("button",{onClick:()=>s("list"),className:`flex items-center gap-1 text-xs px-2 py-1 transition-colors ${l==="list"?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"List view",children:[e.jsx(vt,{className:"w-3 h-3"})," List"]}),e.jsxs("button",{onClick:()=>s("table"),className:`flex items-center gap-1 text-xs px-2 py-1 transition-colors border-l border-gray-200 dark:border-gray-700 ${l==="table"?"bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Side-by-side input/output table",children:[e.jsx(St,{className:"w-3 h-3"})," Table"]})]}),e.jsxs("button",{onClick:()=>void n(),className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Copy as JSON",children:[e.jsx(Ct,{className:"w-3 h-3"})," Copy"]}),e.jsxs("button",{onClick:i,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Download as JSON",children:[e.jsx(Rt,{className:"w-3 h-3"})," JSON"]}),e.jsxs("button",{onClick:c,className:"flex items-center gap-1 text-xs px-2 py-1 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"Download inputs + predictions as CSV",children:[e.jsx(It,{className:"w-3 h-3"})," CSV"]})]})]})]})}function Ir({controller:t}){const{currentRunMeta:r,resultsView:a}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:`mb-3 p-2.5 rounded border text-[11px] flex flex-wrap items-center gap-x-3 gap-y-1 ${Dr(r.status)}`,"data-testid":"run-provenance",children:[e.jsx("strong",{className:"font-mono",children:r.label}),e.jsxs("span",{children:[r.modelType,r.modelVersion?` Β· v${r.modelVersion}`:""," Β· job"," ",r.jobId]}),e.jsxs("span",{children:[r.rows," row",r.rows===1?"":"s"]}),e.jsx("span",{children:Ht(r.thresholdContext)}),r.latencyMs!=null&&e.jsxs("span",{children:[r.latencyMs," ms"]}),r.status==="success"&&e.jsx("span",{children:a==="table"?"table view":"list view"}),e.jsx("span",{className:"text-current opacity-70",children:new Date(r.at).toLocaleString()})]})})}function Or({controller:t}){const{activeRun:r}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{role:"status","aria-atomic":"true",className:"mb-3 p-2.5 rounded border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 text-[11px] flex items-center gap-2",children:[e.jsx(_e,{className:"w-3.5 h-3.5 animate-spin shrink-0"}),e.jsxs("span",{children:[r.label,r.retryOf?" (retry)":""," is running…"]})]})})}function Fr({controller:t}){const{predictionStats:r}=t;return e.jsx(e.Fragment,{children:r&&e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[e.jsx(Je,{className:"w-3 h-3"})," Stats"]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200",children:["n = ",r.count]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["mean ",r.mean.toFixed(4)]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["min ",r.min.toFixed(4)]}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 tabular-nums",children:["max ",r.max.toFixed(4)]})]}),r.values.length>1&&e.jsx(ir,{values:r.values})]})})}function Mr({controller:t}){const{thresholdsApplied:r}=t;return e.jsx(e.Fragment,{children:r&&Object.keys(r).length>0&&e.jsxs("div",{className:"mb-3 p-3 rounded bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-gray-400 mb-2 flex items-center gap-1",children:[e.jsx(me,{className:"w-3 h-3"})," Thresholds applied"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(r).map(([a,s])=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded bg-gray-100 dark:bg-gray-700/60 text-gray-700 dark:text-gray-200 text-[11px] font-mono",children:[a,": ",s]},a))})]})})}function Er({controller:t}){const{error:r,predictions:a,resultsView:s,parsedInputRows:l,schemaChips:n}=t;return e.jsx("div",{className:"flex-1 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden",children:r?e.jsx($r,{controller:t}):a?s==="table"&&l.length>0?e.jsx(cr,{rows:l,predictions:a}):e.jsx("div",{className:"p-4 space-y-2 overflow-auto h-full",children:a.map((i,c)=>{const u=ze(i);return e.jsxs("div",{className:"flex items-start gap-3 p-2 bg-white dark:bg-gray-800 rounded border border-gray-100 dark:border-gray-700",children:[e.jsxs("span",{className:"text-xs text-gray-500 w-8 shrink-0 mt-0.5",children:["#",c+1]}),u?e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(We,{probs:u})}):e.jsx("span",{className:"font-mono font-medium text-blue-600 dark:text-blue-400 break-all",children:ae(i)})]},c)})}):e.jsx(Dt,{icon:e.jsx(Le,{className:"w-12 h-12 opacity-40"}),title:"Run a prediction to see results here.",...n.length>0?{description:"Tip: click Sample to load fresh rows from the training dataset."}:{}})})}function Tr({controller:t}){const{runHistory:r,recentLatencies:a,handleClearRunHistory:s,handleRestoreRun:l}=t;return e.jsx(e.Fragment,{children:r.length>0&&e.jsxs("div",{className:"mt-3 border-t border-gray-100 dark:border-gray-700 pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 flex-wrap gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wider text-gray-400",children:[e.jsx(Ot,{className:"w-3 h-3"})," Recent runs"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dr,{values:a}),e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/30",title:"Clear stored run history from this browser",children:[e.jsx(he,{className:"w-3 h-3"})," Clear history"]})]})]}),e.jsxs("p",{className:"text-[10px] text-gray-400 mb-2",children:["Stored on this device only for ",Math.round(Be/(3600*1e3)),"h, kept to the ",ye," most recent runs β€” inputs and results, not a server record."]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(n=>e.jsxs("button",{onClick:()=>l(n),className:"flex items-center gap-2 text-[11px] px-2 py-1 rounded border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors",title:`Restore input and outcome from ${n.label}`,children:[n.status==="success"?e.jsx(ge,{className:"w-3 h-3 text-emerald-500 shrink-0"}):n.status==="cancelled"?e.jsx(pe,{className:"w-3 h-3 text-gray-400 shrink-0"}):e.jsx(X,{className:"w-3 h-3 text-rose-500 shrink-0"}),e.jsx("span",{className:"font-mono",children:n.label}),e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsx("span",{className:"font-mono",children:zt(n.at)}),e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsxs("span",{children:[n.rows," row",n.rows===1?"":"s"]}),n.latencyMs!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-400",children:"Β·"}),e.jsxs("span",{className:"tabular-nums",children:[n.latencyMs," ms"]})]})]},n.runId))})]})})}function Dr(t){return t==="success"?"bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800 text-emerald-800 dark:text-emerald-300":t==="cancelled"?"bg-gray-50 dark:bg-gray-800/60 border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-300":"bg-rose-50 dark:bg-rose-900/20 border-rose-200 dark:border-rose-800 text-rose-700 dark:text-rose-300"}function $r({controller:t}){const{error:r,currentRunMeta:a,lastAttemptRef:s,handleRetryRun:l,activeRun:n}=t;return r?(a==null?void 0:a.status)==="cancelled"?e.jsxs("div",{role:"status","aria-atomic":"true",className:"p-4 flex flex-col items-center justify-center gap-3 text-center h-full",children:[e.jsx(pe,{className:"w-8 h-8 text-gray-400","aria-hidden":"true"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:r}),s.current&&e.jsxs("button",{type:"button",onClick:()=>void l(),disabled:!!n,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-slate-700 dark:text-slate-200 bg-slate-100 dark:bg-slate-700 rounded-md hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(Pe,{className:"w-4 h-4"})," Retry same input"]})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx($t,{error:r,onRetry:s.current?l:void 0}),e.jsx("p",{className:"px-4 pb-4 -mt-6 text-xs text-gray-500 dark:text-gray-400 text-center",children:"Your input above hasn't changed β€” fix it, or retry the exact same request that failed."})]}):null}const Jr=()=>{const t=sr();return e.jsxs("div",{className:"h-full flex flex-col bg-gray-50 dark:bg-gray-900 p-4 sm:p-6 overflow-y-auto lg:overflow-hidden",children:[e.jsx(or,{controller:t}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6 lg:flex-1 lg:min-h-0",children:[e.jsx(hr,{controller:t}),e.jsx(Cr,{controller:t})]})]})};export{Jr as InferencePage,rr as useSavedThresholdInfo}; diff --git a/static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js b/static/ml_canvas/assets/ModelRegistry-CrF65Lot.js similarity index 99% rename from static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js rename to static/ml_canvas/assets/ModelRegistry-CrF65Lot.js index 1721c454d..a808c7d85 100644 --- a/static/ml_canvas/assets/ModelRegistry-BUrr8Bvp.js +++ b/static/ml_canvas/assets/ModelRegistry-CrF65Lot.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as d,A as q,B,e as L,k as ne,F as de,l as oe,m as ce,n as xe,o as me}from"./vendor-utils-VkF_O5b_.js";import{Q as pe,h as ue,c as he,e as ge,f as G,g as fe,i as be,j as S,a as ye,u as je,p as ke,L as Ne,E as $,b as ve,R as P,M as H,t as U}from"./index-C2dSXwG1.js";import"./vendor-charts-BkHP8M8k.js";var we=class extends pe{constructor(s,l){super(s,l)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,l){var b,p;const{state:c}=s,r=super.createResult(s,l),{isFetching:j,isRefetching:m,isError:o,isRefetchError:w}=r,g=(p=(b=c.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:p.direction,u=o&&g==="forward",k=j&&g==="forward",f=o&&g==="backward",x=j&&g==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(l,c.data),hasPreviousPage:ue(l,c.data),isFetchNextPageError:u,isFetchingNextPage:k,isFetchPreviousPageError:f,isFetchingPreviousPage:x,isRefetchError:w&&!u&&!f,isRefetching:m&&!k&&!x}}};function _e(s,l){return ge(s,we)}const h={all:["registry"],stats:()=>[...h.all,"stats"],models:()=>[...h.all,"models"],artifacts:s=>[...h.all,"artifacts",s]},Pe=3e4,D=10,Se=s=>{s.invalidateQueries({queryKey:h.models()}),s.invalidateQueries({queryKey:h.stats()})},Ce=()=>G({queryKey:h.stats(),queryFn:async()=>(await S.get("/registry/stats")).data,staleTime:Pe}),Me=()=>_e({queryKey:h.models(),initialPageParam:0,queryFn:async({pageParam:s})=>{const l=s*D,c=new URLSearchParams({skip:String(l),limit:String(D)});return(await S.get(`/registry/models?${c.toString()}`)).data},getNextPageParam:(s,l)=>s.lengthG({queryKey:s?h.artifacts(s):["registry","artifacts","idle"],enabled:!!s,queryFn:async()=>(await S.get(`/registry/artifacts/${s}`)).data}),Fe=()=>{const s=fe();return be({mutationFn:async l=>(await S.post(`/deployment/deploy/${l}`)).data,onSuccess:()=>Se(s)})},Le=s=>!s||s.toLowerCase()==="unknown",$e=20,Oe=()=>{const s=ye(),[l]=je(),c=Ce(),r=Me(),j=Fe(),m=c.data??null,o=d.useMemo(()=>{var t;return((t=r.data)==null?void 0:t.pages.flat())??[]},[r.data]),w=r.isFetching,g=r.error?r.error.message:null,u=r.hasNextPage??!1,[k,f]=d.useState(null),x=d.useMemo(()=>k?o.find(t=>`${t.model_type}-${t.dataset_id}`===k)??null:null,[k,o]),E=j.isPending?j.variables??null:null,b=d.useMemo(()=>ke(l),[l]),p=(b==null?void 0:b.ref.kind)==="modelVersion"?b.ref.jobId:null,C=d.useRef(null),[J,I]=d.useState(!1);d.useEffect(()=>{var a;if(!p||C.current===p)return;const t=o.find(i=>i.versions.some(n=>n.job_id===p));if(t){C.current=p,f(`${t.model_type}-${t.dataset_id}`),I(!1);return}if(u&&!r.isFetchingNextPage&&(((a=r.data)==null?void 0:a.pages.length)??0)<$e){r.fetchNextPage();return}u||(C.current=p,I(!0))},[p,o,u,r]);const[z,M]=d.useState(null),T=Re(z),y=T.data??null,W=T.isFetching,[R,X]=d.useState(""),[O,Z]=d.useState(""),[N,_]=d.useState(null),Y=t=>{M(t)},Q=d.useRef(null);d.useEffect(()=>{const t=Q.current;if(!t)return;const a=new IntersectionObserver(i=>{var n;(n=i[0])!=null&&n.isIntersecting&&!r.isFetchingNextPage&&u&&r.fetchNextPage()});return a.observe(t),()=>{a.disconnect()}},[r,u]);const ee=async(t,a)=>{const i=a&&a.job_id!==t.job_id?` This replaces the currently active version ${a.version} (job ${a.job_id}).`:"";await s({title:"Deploy model version?",message:`Deploy version ${t.version} (job ${t.job_id}) of ${t.model_type}?${i}`,confirmLabel:"Deploy",variant:"danger"})&&await V(t)},V=async t=>{_(null);try{await j.mutateAsync(t.job_id),U.success("Model deployed",`Version ${t.version} (job ${t.job_id}) is now active.`)}catch(a){const i=a.message||"Deploy failed.";_({jobId:t.job_id,version:t.version,message:i}),U.error(`Failed to deploy version ${t.version}`,i)}},K=t=>{switch(t.toLowerCase()){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400";case"failed":return"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400";case"running":return"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-gray-100 text-gray-800 dark:bg-slate-700 dark:text-slate-300"}},te=t=>{const a=t.score||t.accuracy||t.f1_score||t.rmse||t.mse;if(a!==void 0)return typeof a=="number"?a.toFixed(4):String(a);const n=Object.keys(t)[0];if(n){const v=t[n];return`${n}: ${typeof v=="number"?v.toFixed(4):v}`}return"-"},se=t=>t.toLowerCase()==="tuning"?"Advanced Training":t.toLowerCase()==="training"?"Standard Training":t.charAt(0).toUpperCase()+t.slice(1),F=o.filter(t=>{const a=(t.dataset_name||"").toLowerCase().includes(R.toLowerCase())||(t.dataset_id||"").toLowerCase().includes(R.toLowerCase()),i=t.model_type.toLowerCase().includes(O.toLowerCase());return a&&i}),ae=()=>e.jsxs("div",{className:"p-6",children:[" ",W?e.jsxs("div",{className:"flex justify-center py-8 text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading artifacts..."]}):!y||y.files.length===0?e.jsx("div",{className:"text-center py-8 text-slate-500 dark:text-slate-400",children:"No artifacts found."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800",children:[y.storage_type==="s3"?e.jsx(ce,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}):e.jsx(xe,{size:20,className:"text-slate-600 dark:text-slate-400 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-700 dark:text-blue-300",children:y.storage_type==="s3"?"S3 Bucket Storage":"Local Storage"}),e.jsx("span",{className:"text-xs font-mono text-slate-600 dark:text-slate-400 truncate",title:y.base_uri,children:y.base_uri})]})]}),e.jsx("ul",{className:"space-y-2",children:y.files.map((t,a)=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-lg bg-slate-50 dark:bg-slate-700/30 border border-slate-100 dark:border-slate-700",children:[e.jsx(me,{size:18,className:"text-slate-400"}),e.jsx("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300 break-all",children:t})]},a))})]})]}),re=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsx(A,{title:"Total Versions",value:(m==null?void 0:m.total_versions)||0,icon:e.jsx(B,{className:"text-blue-500"})}),e.jsx(A,{title:"Active Deployments",value:(m==null?void 0:m.active_deployments)||0,icon:e.jsx(De,{className:"text-green-500"}),valueColor:"text-green-600 dark:text-green-400"}),e.jsx(A,{title:"Model Types",value:o.length,icon:e.jsx(q,{className:"text-purple-500"}),valueColor:"text-purple-600 dark:text-purple-400"})]}),le=()=>e.jsx(H,{isOpen:!!x,onClose:()=>{f(null),_(null)},title:x==null?void 0:x.model_type,size:"4xl",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{f(null),_(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:x&&e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4",children:"Version History"}),N&&e.jsx("div",{className:"mb-4",children:e.jsx($,{error:`Failed to deploy version ${N.version} (job ${N.jobId}): ${N.message}`,onRetry:()=>{const t=x.versions.find(a=>a.job_id===N.jobId);return t?V(t):void 0}})}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Version"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Job"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Date"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Metrics"}),e.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-2 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-200 dark:divide-slate-700",children:x.versions.map(t=>{const a=x.versions.find(n=>n.is_deployed)??null,i=E===t.job_id;return e.jsxs("tr",{className:`hover:bg-slate-50 dark:hover:bg-slate-700/30 ${t.is_deployed?"bg-green-50/50 dark:bg-green-900/10":""}`,children:[e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono",children:["v",t.version]}),t.is_deployed&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 px-1.5 py-0.5 rounded border border-green-200 dark:border-green-800",children:"Deployed"})]})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm",children:e.jsx(P,{recordRef:{kind:"job",jobId:t.job_id},label:t.job_id.slice(0,8),origin:"/registry"})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(t.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-sm text-slate-600 dark:text-slate-300 font-mono",children:te(t.metrics)}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-0.5 inline-flex text-xs leading-5 font-semibold rounded-full ${K(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>{Y(t.job_id)},className:"text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",title:"View Artifacts",children:e.jsx(de,{size:16})}),t.status==="completed"&&!t.is_deployed&&e.jsxs("button",{onClick:()=>{ee(t,a)},disabled:i,"aria-label":`Deploy version ${t.version} (job ${t.job_id})`,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 disabled:opacity-50 flex items-center gap-1",children:[i?e.jsx("span",{className:"animate-spin h-3 w-3 border-b-2 border-current rounded-full"}):e.jsx(oe,{size:14}),"Deploy"]}),t.is_deployed&&(t.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:t.deployment_id},label:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}),origin:"/registry",className:"text-xs"}):e.jsxs("span",{className:"text-green-600 dark:text-green-400 text-xs flex items-center gap-1",children:[e.jsx(L,{size:14})," Active"]}))]})})]},t.job_id)})})]})]})});return w&&!m&&o.length===0?e.jsx("div",{className:"p-8",children:e.jsx(Ne,{message:"Loading registry..."})}):g?e.jsx("div",{className:"p-8",children:e.jsx($,{error:g,onRetry:()=>r.refetch()})}):e.jsxs("div",{className:"p-8 min-h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-200",children:[e.jsxs("div",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-slate-900 dark:text-white",children:"Model Registry"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-1",children:"Manage versions, track metrics, and deploy your best models."})]}),e.jsx("button",{onClick:()=>{r.refetch(),c.refetch()},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-md text-sm font-medium hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors shadow-sm",children:"Refresh"})]}),re(),J&&e.jsx("div",{className:"mb-6",children:e.jsx($,{error:"The linked model version could not be found in the registry. It may have been removed, or is on a page not yet loaded."})}),e.jsxs("div",{className:"mb-6 flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Model Type"}),e.jsx("input",{type:"text",placeholder:"e.g. RandomForest",value:O,onChange:t=>{Z(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1",children:"Filter by Dataset"}),e.jsx("input",{type:"text",placeholder:"e.g. Iris Dataset",value:R,onChange:t=>{X(t.target.value)},className:"w-full px-4 py-2 rounded-md border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/50",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{size:20,className:"text-slate-400"}),"Registered Models"]}),e.jsxs("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:["Showing ",F.length," of ",o.length," models"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 dark:divide-slate-700",children:[e.jsx("thead",{className:"bg-slate-50 dark:bg-slate-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Model Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Dataset"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Latest Version"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Source"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Created At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Deployments"}),e.jsx("th",{className:"px-6 py-3 text-right text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700",children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:e.jsx(ve,{icon:e.jsx(B,{size:48,className:"text-slate-300 dark:text-slate-600"}),title:"No models found matching your filters."})})}):F.map(t=>{const a=t.latest_version;if(!a)return null;const i=`${t.model_type}-${t.dataset_id}`,n=t.versions.find(ie=>ie.is_deployed)??null,v=!Le(t.dataset_id);return e.jsxs("tr",{className:"hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors",children:[e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900 dark:text-white",children:t.model_type}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex items-center gap-2",children:[v?e.jsx(P,{recordRef:{kind:"dataset",datasetId:t.dataset_id},label:t.dataset_name,className:"font-medium"}):e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",title:"No target available",children:t.dataset_name||"Unknown dataset"}),t.dataset_type&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-slate-100 dark:bg-slate-700 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-slate-600 uppercase",children:t.dataset_type})]})})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:e.jsxs("span",{className:"font-mono bg-slate-100 dark:bg-slate-700 px-2 py-1 rounded text-xs",children:["v",a.version]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:se(a.source)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:new Date(a.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${K(a.status)}`,children:a.status})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:n?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400 font-medium bg-green-50 dark:bg-green-900/20 px-2 py-1 rounded-full text-xs",children:[e.jsx(L,{size:12})," Active"]}),n.deployment_id!==void 0?e.jsx(P,{recordRef:{kind:"deployment",deploymentId:n.deployment_id},label:`v${n.version}`,origin:"/registry"}):e.jsxs("span",{className:"text-xs text-slate-400 italic",title:"No target available",children:["v",n.version]})]}):e.jsx("span",{className:"text-slate-400 dark:text-slate-600 text-xs",children:"None"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:e.jsxs("button",{onClick:()=>{f(`${t.model_type}-${t.dataset_id}`)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 flex items-center justify-end gap-1 ml-auto",children:["View Versions ",e.jsx(ne,{size:16})]})})]},i)})})]})})]}),e.jsx("div",{ref:Q,className:"h-1","aria-hidden":"true"}),w&&o.length>0&&e.jsxs("div",{className:"py-4 flex justify-center text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600 mr-2"}),"Loading more models..."]}),le(),e.jsx(H,{isOpen:!!z,onClose:()=>{M(null)},title:"Artifacts",size:"2xl",zIndex:"z-[60]",footer:e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>{M(null)},className:"px-4 py-2 bg-white dark:bg-slate-800 border border-slate-300 dark:border-slate-600 rounded-md text-sm font-medium text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors",children:"Close"})}),children:ae()})]})},A=({title:s,value:l,icon:c,valueColor:r="text-slate-900 dark:text-white"})=>e.jsxs("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-xl shadow-sm border border-slate-200 dark:border-slate-700 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider",children:s}),e.jsx("div",{className:`mt-2 text-3xl font-bold ${r}`,children:l})]}),e.jsx("div",{className:"p-3 bg-slate-50 dark:bg-slate-700/50 rounded-lg",children:c})]}),De=({className:s})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[e.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.jsx("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]});export{Oe as ModelRegistry}; diff --git a/static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js b/static/ml_canvas/assets/SlowNodesPage-82nWt6wC.js similarity index 99% rename from static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js rename to static/ml_canvas/assets/SlowNodesPage-82nWt6wC.js index 287917648..11a6e3304 100644 --- a/static/ml_canvas/assets/SlowNodesPage-BSLoobH9.js +++ b/static/ml_canvas/assets/SlowNodesPage-82nWt6wC.js @@ -1 +1 @@ -import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-C87GWrUj.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; +import{j as e}from"./vendor-flow-Ct2sLZk5.js";import{a as o,T as K,c as U,f as z,L as W,H,h as M,C as Y,i as O,j as _,S as q}from"./vendor-utils-VkF_O5b_.js";import{u as X,m as G,t as J,C as Q,M as V,b as Z,R as ee,N as te}from"./index-C2dSXwG1.js";import{R as se,B as re,C as ae,X as ne,Y as le,T as ie,h as oe,j as de}from"./vendor-charts-BkHP8M8k.js";const $=[1,7,30,90],F=[10,25,50],ce=["total_seconds","avg_seconds","p95_seconds","count","max_seconds"],xe=t=>t!==null&&ce.includes(t),L=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#ef4444","#a855f7","#eab308","#14b8a6"],b=t=>{if(t<1)return`${(t*1e3).toFixed(0)} ms`;if(t<60)return`${t.toFixed(2)} s`;const n=Math.floor(t/60),l=t-n*60;return`${n}m ${l.toFixed(1)}s`},me=t=>t?t.replace("T"," ").slice(0,16):"Unknown time",Ne=()=>{const[t,n]=X(),l=Number(t.get("days")),i=Number(t.get("limit")),x=t.get("sort"),s=t.get("investigate"),[r,u]=o.useState($.includes(l)?l:7),[m,k]=o.useState(F.includes(i)?i:10),[c,A]=o.useState(null),[v,S]=o.useState(!1),[C,I]=o.useState(null),[d,g]=o.useState(xe(x)?x:"total_seconds"),[y,R]=o.useState(s),N=o.useRef(0);o.useEffect(()=>{const a=new URLSearchParams;a.set("days",String(r)),a.set("limit",String(m)),a.set("sort",d),y&&a.set("investigate",y),n(a,{replace:!0})},[r,m,d,y]);const w=o.useCallback(async()=>{const a=++N.current;S(!0),I(null);try{const h=await G.getSlowNodes(r,m);if(a!==N.current)return;A(h)}catch(h){if(a!==N.current)return;const T=h.message||"Failed to load slow-nodes telemetry";I(T),J.error(T)}finally{a===N.current&&S(!1)}},[r,m]);o.useEffect(()=>{w()},[w]);const p=o.useMemo(()=>c?[...c.aggregates].sort((a,h)=>h[d]-a[d]):[],[c,d]),P=o.useMemo(()=>p.length===0?1:Math.max(...p.map(a=>a.total_seconds)),[p]),D=o.useMemo(()=>{if(p.length===0)return .001;const a=Math.min(...p.map(h=>h.total_seconds));return Math.max(a*.5,.001)},[p]),E=o.useMemo(()=>({days:String(r),limit:String(m),sort:d}),[r,m,d]),B=o.useMemo(()=>p.find(a=>a.step_type===y)??null,[p,y]);return e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[e.jsx(K,{className:"w-6 h-6 text-blue-500"}),"Slow Nodes"]}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"Workspace-wide step-type runtime aggregated from completed jobs in the last window. Use it to spot the cheapest optimisation wins."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:$.map(a=>e.jsx("button",{onClick:()=>u(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===r?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:a===1?"24 h":`${a} d`},a))}),e.jsx("div",{className:"inline-flex rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:F.map(a=>e.jsxs("button",{onClick:()=>k(a),className:`px-2.5 py-1 text-xs font-medium tabular-nums border-r last:border-r-0 border-gray-200 dark:border-gray-700 transition-colors ${a===m?"bg-blue-600 text-white":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,title:`Show top ${a} step types`,children:["Top ",a]},a))}),e.jsxs("button",{onClick:()=>void w(),disabled:v,className:"flex items-center gap-1.5 text-xs px-3 py-1.5 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(U,{className:`w-3 h-3 ${v?"animate-spin":""}`}),"Refresh"]})]})]}),e.jsx(ue,{data:c}),C&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 p-3 rounded border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 text-sm",children:[e.jsx(z,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:C})]}),e.jsx(be,{sortedAggregates:p,sortKey:d,chartFloor:D,data:c,days:r}),e.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/40 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Step type"}),e.jsx(f,{k:"count",label:"Runs",title:"Number of executions",sortKey:d,onSort:g}),e.jsx(f,{k:"total_seconds",label:"Total",title:"Cumulative time across all runs",sortKey:d,onSort:g}),e.jsx(f,{k:"avg_seconds",label:"Avg",title:"Mean wall-clock time per run",sortKey:d,onSort:g}),e.jsx(f,{k:"p95_seconds",label:"p95",title:"95th-percentile worst-case run",sortKey:d,onSort:g}),e.jsx(f,{k:"max_seconds",label:"Max",title:"Slowest single run",sortKey:d,onSort:g}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400","aria-label":"Distribution",children:"Share"}),e.jsx("th",{scope:"col",className:"text-left px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:"Investigate"})]})}),e.jsx(he,{isLoading:v,data:c,sortedAggregates:p,days:r,peakTotal:P,setInvestigateStep:R})]})})}),e.jsx(pe,{aggregate:B,days:(c==null?void 0:c.days)??r,unit:(c==null?void 0:c.unit)??"seconds",filters:E,onClose:()=>R(null)})]})},j=({icon:t,label:n,value:l})=>e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-3 flex items-center gap-3",children:[e.jsx("div",{className:"shrink-0 w-8 h-8 rounded bg-blue-50 dark:bg-blue-900/30 flex items-center justify-center",children:t}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 dark:text-gray-400",children:n}),e.jsx("div",{className:"font-semibold text-gray-800 dark:text-gray-100 tabular-nums truncate",children:l})]})]}),f=({k:t,label:n,title:l,sortKey:i,onSort:x})=>{const s=i===t;return e.jsx("th",{scope:"col","aria-sort":s?"descending":"none",className:"text-right px-3 py-2 text-[11px] uppercase tracking-wider font-semibold text-gray-500 dark:text-gray-400",children:e.jsxs("button",{type:"button",onClick:()=>x(t),title:l,"aria-label":`Sort by ${n}${s?" (currently sorted, descending)":""}`,className:`inline-flex items-center gap-1 select-none ${s?"text-blue-600 dark:text-blue-300":""}`,children:[n,s&&e.jsx("span",{"aria-hidden":"true",children:"β–Ύ"})]})})},pe=({aggregate:t,days:n,unit:l,filters:i,onClose:x})=>e.jsx(V,{isOpen:t!==null,onClose:x,title:t?`Investigate: ${t.step_type}`:void 0,size:"2xl",children:t&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:["Aggregated over the last ",n," day",n===1?"":"s"," across"," ",t.count.toLocaleString()," run",t.count===1?"":"s",", in"," ",l,"."," ",t.is_single_run&&e.jsx("span",{className:"font-medium text-amber-700 dark:text-amber-400",children:"This reflects a single run's measurement, not a statistical summary β€” treat it as one data point."})]}),!t.is_single_run&&!t.sample_is_representative&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 text-sm",children:[e.jsx(_,{className:"w-4 h-4 shrink-0 mt-0.5","aria-hidden":"true"}),e.jsx("span",{children:"The sample node shown in the table is an outlier for this step type β€” it is not representative of a typical run."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Contributing runs"}),t.contributing_runs.length===0?e.jsx(Z,{title:"Investigation unavailable",description:"This aggregate has no retained per-run detail to drill into."}):e.jsx("ul",{className:"space-y-2",children:t.contributing_runs.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 p-2 rounded border border-gray-100 dark:border-gray-800 text-sm",children:[s.is_outlier&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/30 rounded px-1.5 py-0.5",children:[e.jsx(_,{className:"w-3 h-3","aria-hidden":"true"}),"Outlier"]}),e.jsx("span",{className:"font-mono tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(s.execution_seconds)}),e.jsx("span",{className:"text-gray-400 text-xs",children:me(s.finished_at)}),e.jsx(ee,{recordRef:{kind:"job",jobId:s.job_id},origin:"/slow-nodes",filters:i}),e.jsx(te,{nodeId:s.node_id,jobId:s.job_id,pipelineId:s.pipeline_id,label:"Inspect node",origin:"/slow-nodes",filters:i})]},`${s.job_id}-${s.node_id}`))})]})]})});function ue({data:t}){return e.jsx(e.Fragment,{children:t&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-6",children:[e.jsx(j,{icon:e.jsx(W,{className:"w-4 h-4 text-blue-500"}),label:"Step types",value:String(t.aggregates.length)}),e.jsx(j,{icon:e.jsx(H,{className:"w-4 h-4 text-blue-500"}),label:"Node runs",value:t.total_node_runs.toLocaleString()}),e.jsx(j,{icon:e.jsx(M,{className:"w-4 h-4 text-blue-500"}),label:"Jobs scanned",value:t.total_jobs_scanned.toLocaleString()}),e.jsx(j,{icon:e.jsx(Y,{className:"w-4 h-4 text-blue-500"}),label:"Window",value:`${t.days} day${t.days===1?"":"s"}`}),e.jsx(j,{icon:e.jsx(O,{className:"w-4 h-4 text-blue-500"}),label:"Unit",value:t.unit})]})})}function be({sortedAggregates:t,sortKey:n,chartFloor:l,data:i,days:x}){return e.jsx(e.Fragment,{children:t.length>0&&e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(M,{className:"w-4 h-4 text-blue-500"}),e.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:"Total time by step type"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:["(",n==="total_seconds"?"sorted by total":`sorted by ${n.replace("_seconds","")}`,", log scale β€” totals span orders of magnitude)"]})]}),e.jsx("div",{className:"h-56",children:e.jsx(se,{width:"100%",height:"100%",children:e.jsxs(re,{data:t.map(s=>({step_type:s.step_type,total:Math.max(Number(s.total_seconds.toFixed(3)),l),totalRaw:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),runs:s.count})),margin:{top:4,right:8,left:8,bottom:28},children:[e.jsx(ae,{strokeDasharray:"3 3",className:"stroke-gray-200 dark:stroke-slate-700",vertical:!1}),e.jsx(ne,{dataKey:"step_type",tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},angle:-25,textAnchor:"end",interval:0,height:50}),e.jsx(le,{scale:"log",domain:[l,"auto"],allowDataOverflow:!0,tick:{fill:"hsl(var(--muted-foreground))",fontSize:10},tickFormatter:s=>b(s),width:64}),e.jsx(ie,{contentStyle:{backgroundColor:"hsl(var(--popover))",borderColor:"hsl(var(--border))",color:"hsl(var(--popover-foreground))",borderRadius:6,fontSize:12},itemStyle:{color:"hsl(var(--popover-foreground))"},labelStyle:{color:"hsl(var(--muted-foreground))"},formatter:(s,r,u)=>{var m;if(r==="runs")return[s,"Runs"];if(r==="total"){const k=(m=u==null?void 0:u.payload)==null?void 0:m.totalRaw;return[b(k??s),"Total time"]}return[b(s),"Avg per run"]}}),e.jsx(oe,{dataKey:"total",radius:[3,3,0,0],children:t.map((s,r)=>e.jsx(de,{fill:L[r%L.length]},`bar-${r}`))})]})})}),e.jsx(Q,{caption:"Total time by step type β€” text/table alternative to the bar chart",filename:`slow-nodes-${(i==null?void 0:i.days)??x}d`,columns:[{key:"step_type",label:"Step type"},{key:"runs",label:"Runs"},{key:"total",label:"Total (s)"},{key:"avg",label:"Avg (s)"},{key:"p95",label:"p95 (s)"},{key:"max",label:"Max (s)"}],rows:t.map(s=>({step_type:s.step_type,runs:s.count,total:Number(s.total_seconds.toFixed(3)),avg:Number(s.avg_seconds.toFixed(3)),p95:Number(s.p95_seconds.toFixed(3)),max:Number(s.max_seconds.toFixed(3))}))})]})})}function he({isLoading:t,data:n,sortedAggregates:l,days:i,peakTotal:x,setInvestigateStep:s}){return e.jsx("tbody",{children:t&&!n?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400 italic",children:"Loading…"})}):l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-3 py-8 text-center text-gray-400",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(O,{className:"w-8 h-8 opacity-40"}),e.jsxs("span",{className:"italic",children:["No node-timing data in the last ",i," day",i===1?"":"s","."]}),e.jsx("span",{className:"text-[11px] not-italic text-gray-500",children:"Pre-existing jobs are silently skipped β€” re-run a pipeline to seed this view."})]})})}):l.map(r=>{const u=r.total_seconds/x*100;return e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[e.jsxs("td",{className:"px-3 py-2",children:[e.jsx("div",{className:"font-mono font-medium text-gray-800 dark:text-gray-100",children:r.step_type}),e.jsxs("div",{className:"text-[10px] text-gray-400",children:[r.count.toLocaleString()," run",r.count===1?"":"s"," Β· last ",i," day",i===1?"":"s",r.is_single_run&&e.jsx("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:"(single run β€” not a trend)"})]}),r.sample_node_id&&e.jsxs("div",{className:"text-[10px] text-gray-400 truncate max-w-[260px] flex items-center gap-1",title:r.sample_node_id,children:[!r.sample_is_representative&&e.jsx(_,{className:"w-3 h-3 text-amber-500 shrink-0","aria-label":"Sample node is an outlier, not representative"}),e.jsxs("span",{children:[r.sample_is_representative?"e.g. ":"e.g. (outlier) ",r.sample_node_id]})]})]}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:r.count.toLocaleString()}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums font-medium text-gray-800 dark:text-gray-100",children:b(r.total_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.avg_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.p95_seconds)}),e.jsx("td",{className:"px-3 py-2 text-right tabular-nums text-gray-700 dark:text-gray-200",children:b(r.max_seconds)}),e.jsx("td",{className:"px-3 py-2 w-48",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-gray-100 dark:bg-gray-700/50 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-blue-500",style:{width:`${u}%`}})}),e.jsxs("span",{className:"text-[10px] text-gray-400 tabular-nums w-10 text-right",children:[u.toFixed(0),"%"]})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("button",{type:"button",onClick:()=>s(r.step_type),className:"inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-400 hover:underline","aria-label":`Investigate ${r.step_type} runs`,children:[e.jsx(q,{className:"w-3 h-3","aria-hidden":"true"}),"Investigate"]})})]},r.step_type)})})}export{Ne as SlowNodesPage}; diff --git a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-C2jvdv9H.js similarity index 83% rename from static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js rename to static/ml_canvas/assets/abnfDiagram-VCTEODGH-C2jvdv9H.js index 7a451d730..27f9b2bf5 100644 --- a/static/ml_canvas/assets/abnfDiagram-VCTEODGH-DZGlbml7.js +++ b/static/ml_canvas/assets/abnfDiagram-VCTEODGH-C2jvdv9H.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-SVP7TREG-DpJhy_Kq.js";import{p as f}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as n,l as o}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; +import{g as p,r as u,d as a}from"./chunk-SVP7TREG-CnnhSiZz.js";import{p as f}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{_ as n,l as o}from"./mermaid.core-fnA2DmhE.js";import"./vendor-flow-Ct2sLZk5.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-DPLixWx6.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),m=t?parseInt(t,10):0,l=s?parseInt(s,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},C={parser:R,db:a,renderer:u,styles:p};export{C as diagram}; diff --git a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BVZQqNWL.js similarity index 99% rename from static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js rename to static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BVZQqNWL.js index fb758c689..2242d4041 100644 --- a/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-CN8WuPMt.js +++ b/static/ml_canvas/assets/architectureDiagram-5GKGNRK7-BVZQqNWL.js @@ -1,4 +1,4 @@ -import{p as qe}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-CiBTFoht.js";import{p as cr}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` +import{p as qe}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{_ as ct,C as Qe,W as Je,l as Fe,b as Ke,a as je,m as _e,n as tr,g as er,s as rr,o as ir,z as ar,x as nr,A as or,c as Ee,ap as Te,a4 as pe,i as sr,p as hr,a5 as lr,aq as fr}from"./mermaid.core-fnA2DmhE.js";import{p as cr}from"./cynefin-OW5HDTMX-DPLixWx6.js";import{c as be}from"./cytoscape.esm-Bch-eiPH.js";import{g as gr}from"./vendor-utils-VkF_O5b_.js";import{s as ur}from"./vendor-flow-Ct2sLZk5.js";import"./index-C2dSXwG1.js";import"./vendor-charts-BkHP8M8k.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;hs?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;AL&&(h=L),Tw&&(u=w),dL&&(h=L),Tw&&(u=w),d=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(h),u=0;u=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);sn.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oL||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,wt){return Tt&&wt})(z0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return SF&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.widthS&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;FD&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=Zt),KtXt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gtK)for(var nt=0;ntat)for(var et=0;et1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gtz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o0&&S.merge(R)});for(var D=0;D1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;Eh&&(h=p),mu&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zh&&(h=X),rtu&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;BL&&(h=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q=1)break;_=et}for(var pt=0;pt=1)break;_=et}for(var lt=0;lt0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=gr(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await cr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; diff --git a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-B1z58EdC.js similarity index 99% rename from static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js rename to static/ml_canvas/assets/blockDiagram-I7D4REHJ-B1z58EdC.js index 8adc31f81..9e0f90f22 100644 --- a/static/ml_canvas/assets/blockDiagram-I7D4REHJ-BB5HUUKR.js +++ b/static/ml_canvas/assets/blockDiagram-I7D4REHJ-B1z58EdC.js @@ -1,4 +1,4 @@ -import{g as Pe}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-CiBTFoht.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-YEV_Sjpu.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: +import{g as Pe}from"./chunk-5VM5RSS4-CA43m6ys.js";import{_ as g,x as X,am as Fe,d as Me,l as y,o as Ke,r as Ye,c as me,Q as We,aj as Ve,ai as Ue,ak as He,j as je,an as Xe,a2 as ye,a3 as Ge}from"./mermaid.core-fnA2DmhE.js";import{s as qe,t as be,v as Je,w as Qe,x as Ze,y as $e,z as et,A as tt,D as st,E as rt,F as it,G as nt,H as at,I as ot,J as ct,K as lt,L as ut,M as gt,N as ht,O as dt,P as pt,Q as ft,S as St,U as xt,V as Lt,W as mt}from"./vendor-charts-BkHP8M8k.js";import{s as J}from"./vendor-flow-Ct2sLZk5.js";import{c as yt}from"./channel-Ckr7jPvY.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";function bt(e){if(qe(e))return e;const a=be(e);if(!wt(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Qe(e)){const s=e,c=s.constructor;return new c(s.buffer,s.byteOffset,s.length)}if(a==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(a==="[object DataView]"){const s=e,c=s.buffer,p=s.byteOffset,r=s.byteLength,d=new ArrayBuffer(r),x=new Uint8Array(c,p,r);return new Uint8Array(d).set(x),new DataView(d)}if(a==="[object Boolean]"||a==="[object Number]"||a==="[object String]"){const s=e.constructor,c=new s(e.valueOf());return a==="[object String]"?_t(c,e):re(c,e),c}if(a==="[object Date]")return new Date(Number(e));if(a==="[object RegExp]"){const s=e,c=new RegExp(s.source,s.flags);return c.lastIndex=s.lastIndex,c}if(a==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(a==="[object Map]"){const s=e,c=new Map;return s.forEach((p,r)=>{c.set(r,p)}),c}if(a==="[object Set]"){const s=e,c=new Set;return s.forEach(p=>{c.add(p)}),c}if(a==="[object Arguments]"){const s=e,c={};return re(c,s),c.length=s.length,c[Symbol.iterator]=s[Symbol.iterator],c}const l={};return Dt(l,e),re(l,e),Et(l,e),l}function wt(e){switch(be(e)){case mt:case Lt:case xt:case St:case ft:case pt:case dt:case ht:case gt:case ut:case lt:case ct:case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Ze:return!0;default:return!1}}function re(e,a){for(const l in a)Object.hasOwn(a,l)&&(e[l]=a[l])}function Et(e,a){const l=Object.getOwnPropertySymbols(a);for(let s=0;s=l)&&(e[s]=a[s])}function Dt(e,a){const l=Object.getPrototypeOf(a);l!==null&&typeof a.constructor=="function"&&Object.setPrototypeOf(e,l)}var ne=(function(){var e=g(function(T,h,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=h);return i},"o"),a=[1,15],l=[1,7],s=[1,13],c=[1,14],p=[1,19],r=[1,16],d=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],E=[1,23],z=[1,24],A=[8,10,15,16,21,28,29,30,31,39,43,46],_=[8,10,15,16,21,27,28,29,30,31,39,43,46],N=[1,49],I={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(h,i,o,u,L,t,O){var n=t.length-1;switch(L){case 4:u.getLogger().debug("Rule: separator (NL) ");break;case 5:u.getLogger().debug("Rule: separator (Space) ");break;case 6:u.getLogger().debug("Rule: separator (EOF) ");break;case 7:u.getLogger().debug("Rule: hierarchy: ",t[n-1]),u.setHierarchy(t[n-1]);break;case 8:u.getLogger().debug("Stop NL ");break;case 9:u.getLogger().debug("Stop EOF ");break;case 10:u.getLogger().debug("Stop NL2 ");break;case 11:u.getLogger().debug("Stop EOF2 ");break;case 12:u.getLogger().debug("Rule: statement: ",t[n]),typeof t[n].length=="number"?this.$=t[n]:this.$=[t[n]];break;case 13:u.getLogger().debug("Rule: statement #2: ",t[n-1]),this.$=[t[n-1]].concat(t[n]);break;case 14:u.getLogger().debug("Rule: link: ",t[n],h),this.$={edgeTypeStr:t[n],label:""};break;case 15:u.getLogger().debug("Rule: LABEL link: ",t[n-3],t[n-1],t[n]),this.$={edgeTypeStr:t[n],label:t[n-1]};break;case 18:const f=parseInt(t[n]),w=u.generateId();this.$={id:w,type:"space",label:"",width:f,children:[]};break;case 23:u.getLogger().debug("Rule: (nodeStatement link node) ",t[n-2],t[n-1],t[n]," typestr: ",t[n-1].edgeTypeStr);const C=u.edgeStrToEdgeData(t[n-1].edgeTypeStr),M=u.edgeStrToEdgeStartData(t[n-1].edgeTypeStr),K=u.edgeStrToThickness(t[n-1].edgeTypeStr),b=u.edgeStrToPattern(t[n-1].edgeTypeStr);this.$=[{id:t[n-2].id,label:t[n-2].label,type:t[n-2].type,directions:t[n-2].directions},{id:t[n-2].id+"-"+t[n].id,start:t[n-2].id,end:t[n].id,label:t[n-1].label,type:"edge",thickness:K,pattern:b,directions:t[n].directions,arrowTypeEnd:C,arrowTypeStart:M},{id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions}];break;case 24:u.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[n-1],t[n]),this.$={id:t[n-1].id,label:t[n-1].label,type:u.typeStr2Type(t[n-1].typeStr),directions:t[n-1].directions,widthInColumns:parseInt(t[n],10)};break;case 25:u.getLogger().debug("Rule: nodeStatement (node) ",t[n]),this.$={id:t[n].id,label:t[n].label,type:u.typeStr2Type(t[n].typeStr),directions:t[n].directions,widthInColumns:1};break;case 26:u.getLogger().debug("APA123",this?this:"na"),u.getLogger().debug("COLUMNS: ",t[n]),this.$={type:"column-setting",columns:t[n]==="auto"?-1:parseInt(t[n])};break;case 27:u.getLogger().debug("Rule: id-block statement : ",t[n-2],t[n-1]),u.generateId(),this.$={...t[n-2],type:"composite",children:t[n-1]};break;case 28:u.getLogger().debug("Rule: blockStatement : ",t[n-2],t[n-1],t[n]);const R=u.generateId();this.$={id:R,type:"composite",label:"",children:t[n-1]};break;case 29:u.getLogger().debug("Rule: node (NODE_ID separator): ",t[n]),this.$={id:t[n]};break;case 30:u.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[n-1],t[n]),this.$={id:t[n-1],label:t[n].label,typeStr:t[n].typeStr,directions:t[n].directions};break;case 31:u.getLogger().debug("Rule: dirList: ",t[n]),this.$=[t[n]];break;case 32:u.getLogger().debug("Rule: dirList: ",t[n-1],t[n]),this.$=[t[n-1]].concat(t[n]);break;case 33:u.getLogger().debug("Rule: nodeShapeNLabel: ",t[n-2],t[n-1],t[n]),this.$={typeStr:t[n-2]+t[n],label:t[n-1]};break;case 34:u.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[n-3],t[n-2]," #3:",t[n-1],t[n]),this.$={typeStr:t[n-3]+t[n],label:t[n-2],directions:t[n-1]};break;case 35:case 36:this.$={type:"classDef",id:t[n-1].trim(),css:t[n].trim()};break;case 37:this.$={type:"applyClass",id:t[n-1].trim(),styleClass:t[n].trim()};break;case 38:this.$={type:"applyStyles",id:t[n-1].trim(),stylesStr:t[n].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:a,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:a,21:l,28:s,29:c,31:p,39:r,43:d,46:x}),e(S,[2,16],{14:22,15:E,16:z}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(A,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:p},{10:a,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(_,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(A,[2,24]),{10:a,11:37,13:4,14:22,15:E,16:z,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:s,29:c,31:p,39:r,43:d,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(_,[2,30]),{18:[1,43]},{18:[1,44]},e(A,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:N},{15:[1,50]},e(S,[2,27]),e(_,[2,33]),{38:[1,51]},{33:52,34:N,38:[2,31]},{31:[2,15]},e(_,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(h,i){if(i.recoverable)this.trace(h);else{var o=new Error(h);throw o.hash=i,o}},"parseError"),parse:g(function(h){var i=this,o=[0],u=[],L=[null],t=[],O=this.table,n="",f=0,w=0,C=2,M=1,K=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(R.yy[Y]=this.yy[Y]);b.setInput(h,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var H=b.yylloc;t.push(H);var ee=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ke(k){o.length=o.length-2*k,L.length=L.length-k,t.length=t.length-k}g(ke,"popStack");function pe(){var k;return k=u.pop()||b.lex()||M,typeof k!="number"&&(k instanceof Array&&(u=k,k=u.pop()),k=i.symbols_[k]||k),k}g(pe,"lex");for(var B,V,P,te,U={},G,W,fe,q;;){if(V=o[o.length-1],this.defaultActions[V]?P=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=pe()),P=O[V]&&O[V][B]),typeof P>"u"||!P.length||!P[0]){var se="";q=[];for(G in O[V])this.terminals_[G]&&G>C&&q.push("'"+this.terminals_[G]+"'");b.showPosition?se="Parse error on line "+(f+1)+`: `+b.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":se="Parse error on line "+(f+1)+": Unexpected "+(B==M?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(se,{text:b.match,token:this.terminals_[B]||B,line:b.yylineno,loc:H,expected:q})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(P[0]){case 1:o.push(B),L.push(b.yytext),t.push(b.yylloc),o.push(P[1]),B=null,w=b.yyleng,n=b.yytext,f=b.yylineno,H=b.yylloc;break;case 2:if(W=this.productions_[P[1]][1],U.$=L[L.length-W],U._$={first_line:t[t.length-(W||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(W||1)].first_column,last_column:t[t.length-1].last_column},ee&&(U._$.range=[t[t.length-(W||1)].range[0],t[t.length-1].range[1]]),te=this.performAction.apply(U,[n,w,f,R.yy,P[1],L,t].concat(K)),typeof te<"u")return te;W&&(o=o.slice(0,-1*W*2),L=L.slice(0,-1*W),t=t.slice(0,-1*W)),o.push(this.productions_[P[1]][0]),L.push(U.$),t.push(U._$),fe=O[o[o.length-2]][o[o.length-1]],o.push(fe);break;case 3:return!0}}return!0},"parse")},D=(function(){var T={EOF:1,parseError:g(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:g(function(h,i){return this.yy=i||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var i=h.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:g(function(h){var i=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var L=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===u.length?this.yylloc.first_column:0)+u[u.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[L[0],L[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(h){this.unput(this.match.slice(h))},"less"),pastInput:g(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var h=this.pastInput(),i=new Array(h.length+1).join("-");return h+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-DLwAG1EW.js similarity index 99% rename from static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js rename to static/ml_canvas/assets/c4Diagram-7LVT6UL2-DLwAG1EW.js index 90a5ff479..fb57361f4 100644 --- a/static/ml_canvas/assets/c4Diagram-7LVT6UL2-BtG8dc0n.js +++ b/static/ml_canvas/assets/c4Diagram-7LVT6UL2-DLwAG1EW.js @@ -1,4 +1,4 @@ -import{d as Le}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-CiBTFoht.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: +import{d as Le}from"./chunk-F27PBJKO-BOjuYHBE.js";import{s as Ie,g as Me,a as Be,b as Ve,_ as d,c as wt,l as he,d as Ye,e as Fe,f as Dt,h as Ue,i as me,w as je,j as $t,k as de}from"./mermaid.core-fnA2DmhE.js";import{s as Jt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ut=(function(){var t=d(function(yt,b,x,E){for(x=x||{},E=yt.length;E--;x[yt[E]]=b);return x},"o"),e=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],n=[1,63],u=[1,64],r=[1,65],h=[1,66],y=[1,67],f=[1,68],m=[1,69],v=[1,29],w=[1,30],N=[1,31],O=[1,32],P=[1,33],I=[1,34],W=[1,35],X=[1,36],q=[1,37],H=[1,38],Q=[1,39],K=[1,40],G=[1,41],J=[1,42],Z=[1,43],$=[1,44],tt=[1,45],et=[1,46],nt=[1,47],st=[1,48],rt=[1,50],at=[1,51],it=[1,52],ot=[1,53],lt=[1,54],ct=[1,55],ut=[1,56],ht=[1,57],dt=[1,58],pt=[1,59],ft=[1,60],kt=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],k=[1,83],T=[1,84],C=[1,85],R=[12,14,42],ie=[12,14,33,42],Mt=[12,14,33,42,76,77,79,80],gt=[12,33],Xt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],qt={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(function(b,x,E,_,D,i,Pt){var p=i.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(i[p-3]);break;case 19:_.setTitle(i[p].substring(6)),this.$=i[p].substring(6);break;case 20:_.setAccDescription(i[p].substring(15)),this.$=i[p].substring(15);break;case 21:this.$=i[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=i[p].trim(),_.setAccDescription(this.$);break;case 28:i[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 29:i[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 30:_.addPersonOrSystemBoundary(...i[p]),this.$=i[p];break;case 31:i[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...i[p]),this.$=i[p];break;case 32:_.addDeploymentNode("node",...i[p]),this.$=i[p];break;case 33:_.addDeploymentNode("nodeL",...i[p]),this.$=i[p];break;case 34:_.addDeploymentNode("nodeR",...i[p]),this.$=i[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...i[p]),this.$=i[p];break;case 40:_.addPersonOrSystem("external_person",...i[p]),this.$=i[p];break;case 41:_.addPersonOrSystem("system",...i[p]),this.$=i[p];break;case 42:_.addPersonOrSystem("system_db",...i[p]),this.$=i[p];break;case 43:_.addPersonOrSystem("system_queue",...i[p]),this.$=i[p];break;case 44:_.addPersonOrSystem("external_system",...i[p]),this.$=i[p];break;case 45:_.addPersonOrSystem("external_system_db",...i[p]),this.$=i[p];break;case 46:_.addPersonOrSystem("external_system_queue",...i[p]),this.$=i[p];break;case 47:_.addContainer("container",...i[p]),this.$=i[p];break;case 48:_.addContainer("container_db",...i[p]),this.$=i[p];break;case 49:_.addContainer("container_queue",...i[p]),this.$=i[p];break;case 50:_.addContainer("external_container",...i[p]),this.$=i[p];break;case 51:_.addContainer("external_container_db",...i[p]),this.$=i[p];break;case 52:_.addContainer("external_container_queue",...i[p]),this.$=i[p];break;case 53:_.addComponent("component",...i[p]),this.$=i[p];break;case 54:_.addComponent("component_db",...i[p]),this.$=i[p];break;case 55:_.addComponent("component_queue",...i[p]),this.$=i[p];break;case 56:_.addComponent("external_component",...i[p]),this.$=i[p];break;case 57:_.addComponent("external_component_db",...i[p]),this.$=i[p];break;case 58:_.addComponent("external_component_queue",...i[p]),this.$=i[p];break;case 60:_.addRel("rel",...i[p]),this.$=i[p];break;case 61:_.addRel("birel",...i[p]),this.$=i[p];break;case 62:_.addRel("rel_u",...i[p]),this.$=i[p];break;case 63:_.addRel("rel_d",...i[p]),this.$=i[p];break;case 64:_.addRel("rel_l",...i[p]),this.$=i[p];break;case 65:_.addRel("rel_r",...i[p]),this.$=i[p];break;case 66:_.addRel("rel_b",...i[p]),this.$=i[p];break;case 67:i[p].splice(0,1),_.addRel("rel",...i[p]),this.$=i[p];break;case 68:_.updateElStyle("update_el_style",...i[p]),this.$=i[p];break;case 69:_.updateRelStyle("update_rel_style",...i[p]),this.$=i[p];break;case 70:_.updateLayoutConfig("update_layout_config",...i[p]),this.$=i[p];break;case 71:this.$=[i[p]];break;case 72:i[p].unshift(i[p-1]),this.$=i[p];break;case 73:case 75:this.$=i[p].trim();break;case 74:let xt={};xt[i[p-1].trim()]=i[p].trim(),this.$=xt;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:70,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:71,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:72,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{13:73,19:20,20:21,21:22,22:e,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{14:[1,74]},t(kt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(kt,[2,14]),t(Wt,[2,16],{12:[1,76]}),t(kt,[2,36],{12:[1,77]}),t(Ot,[2,19]),t(Ot,[2,20]),{25:[1,78]},{27:[1,79]},t(Ot,[2,23]),{35:80,75:81,76:S,77:k,79:T,80:C},{35:86,75:81,76:S,77:k,79:T,80:C},{35:87,75:81,76:S,77:k,79:T,80:C},{35:88,75:81,76:S,77:k,79:T,80:C},{35:89,75:81,76:S,77:k,79:T,80:C},{35:90,75:81,76:S,77:k,79:T,80:C},{35:91,75:81,76:S,77:k,79:T,80:C},{35:92,75:81,76:S,77:k,79:T,80:C},{35:93,75:81,76:S,77:k,79:T,80:C},{35:94,75:81,76:S,77:k,79:T,80:C},{35:95,75:81,76:S,77:k,79:T,80:C},{35:96,75:81,76:S,77:k,79:T,80:C},{35:97,75:81,76:S,77:k,79:T,80:C},{35:98,75:81,76:S,77:k,79:T,80:C},{35:99,75:81,76:S,77:k,79:T,80:C},{35:100,75:81,76:S,77:k,79:T,80:C},{35:101,75:81,76:S,77:k,79:T,80:C},{35:102,75:81,76:S,77:k,79:T,80:C},{35:103,75:81,76:S,77:k,79:T,80:C},{35:104,75:81,76:S,77:k,79:T,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:k,79:T,80:C},{35:106,75:81,76:S,77:k,79:T,80:C},{35:107,75:81,76:S,77:k,79:T,80:C},{35:108,75:81,76:S,77:k,79:T,80:C},{35:109,75:81,76:S,77:k,79:T,80:C},{35:110,75:81,76:S,77:k,79:T,80:C},{35:111,75:81,76:S,77:k,79:T,80:C},{35:112,75:81,76:S,77:k,79:T,80:C},{35:113,75:81,76:S,77:k,79:T,80:C},{35:114,75:81,76:S,77:k,79:T,80:C},{35:115,75:81,76:S,77:k,79:T,80:C},{20:116,29:49,30:61,32:62,34:n,36:u,37:r,38:h,39:y,40:f,41:m,43:23,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:k,79:T,80:C},{35:120,75:81,76:S,77:k,79:T,80:C},{35:121,75:81,76:S,77:k,79:T,80:C},{35:122,75:81,76:S,77:k,79:T,80:C},{35:123,75:81,76:S,77:k,79:T,80:C},{35:124,75:81,76:S,77:k,79:T,80:C},{35:125,75:81,76:S,77:k,79:T,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(kt,[2,15]),t(Wt,[2,17],{21:22,19:130,22:e,23:s,24:o,26:l,28:a}),t(kt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:o,26:l,28:a,34:n,36:u,37:r,38:h,39:y,40:f,41:m,44:v,45:w,46:N,47:O,48:P,49:I,50:W,51:X,52:q,53:H,54:Q,55:K,56:G,57:J,58:Z,59:$,60:tt,61:et,62:nt,63:st,64:rt,65:at,66:it,67:ot,68:lt,69:ct,70:ut,71:ht,72:dt,73:pt,74:ft}),t(Ot,[2,21]),t(Ot,[2,22]),t(R,[2,39]),t(ie,[2,71],{75:81,35:132,76:S,77:k,79:T,80:C}),t(Mt,[2,73]),{78:[1,133]},t(Mt,[2,75]),t(Mt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(gt,[2,28]),t(gt,[2,29]),t(gt,[2,30]),t(gt,[2,31]),t(gt,[2,32]),t(gt,[2,33]),t(gt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(Wt,[2,18]),t(kt,[2,38]),t(ie,[2,72]),t(Mt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Xt,[2,25]),t(Xt,[2,26],{12:[1,138]}),t(Xt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(function(b,x){if(x.recoverable)this.trace(b);else{var E=new Error(b);throw E.hash=x,E}},"parseError"),parse:d(function(b){var x=this,E=[0],_=[],D=[null],i=[],Pt=this.table,p="",xt=0,oe=0,Pe=2,le=1,De=i.slice.call(arguments,1),A=Object.create(this.lexer),vt={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(vt.yy[Ht]=this.yy[Ht]);A.setInput(b,vt.yy),vt.yy.lexer=A,vt.yy.parser=this,typeof A.yylloc>"u"&&(A.yylloc={});var Qt=A.yylloc;i.push(Qt);var Ne=A.options&&A.options.ranges;typeof vt.yy.parseError=="function"?this.parseError=vt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ae(B){E.length=E.length-2*B,D.length=D.length-B,i.length=i.length-B}d(Ae,"popStack");function ce(){var B;return B=_.pop()||A.lex()||le,typeof B!="number"&&(B instanceof Array&&(_=B,B=_.pop()),B=x.symbols_[B]||B),B}d(ce,"lex");for(var M,Et,V,Kt,Tt={},Vt,j,ue,Yt;;){if(Et=E[E.length-1],this.defaultActions[Et]?V=this.defaultActions[Et]:((M===null||typeof M>"u")&&(M=ce()),V=Pt[Et]&&Pt[Et][M]),typeof V>"u"||!V.length||!V[0]){var Gt="";Yt=[];for(Vt in Pt[Et])this.terminals_[Vt]&&Vt>Pe&&Yt.push("'"+this.terminals_[Vt]+"'");A.showPosition?Gt="Parse error on line "+(xt+1)+`: `+A.showPosition()+` Expecting `+Yt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":Gt="Parse error on line "+(xt+1)+": Unexpected "+(M==le?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[M]||M,line:A.yylineno,loc:Qt,expected:Yt})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Et+", token: "+M);switch(V[0]){case 1:E.push(M),D.push(A.yytext),i.push(A.yylloc),E.push(V[1]),M=null,oe=A.yyleng,p=A.yytext,xt=A.yylineno,Qt=A.yylloc;break;case 2:if(j=this.productions_[V[1]][1],Tt.$=D[D.length-j],Tt._$={first_line:i[i.length-(j||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(j||1)].first_column,last_column:i[i.length-1].last_column},Ne&&(Tt._$.range=[i[i.length-(j||1)].range[0],i[i.length-1].range[1]]),Kt=this.performAction.apply(Tt,[p,oe,xt,vt.yy,V[1],D,i].concat(De)),typeof Kt<"u")return Kt;j&&(E=E.slice(0,-1*j*2),D=D.slice(0,-1*j),i=i.slice(0,-1*j)),E.push(this.productions_[V[1]][0]),D.push(Tt.$),i.push(Tt._$),ue=Pt[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},Oe=(function(){var yt={EOF:1,parseError:d(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),setInput:d(function(b,x){return this.yy=x||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var x=b.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},"input"),unput:d(function(b){var x=b.length,E=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(b){this.unput(this.match.slice(b))},"less"),pastInput:d(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var b=this.pastInput(),x=new Array(b.length+1).join("-");return b+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/channel-Ckr7jPvY.js b/static/ml_canvas/assets/channel-Ckr7jPvY.js new file mode 100644 index 000000000..36af6c30a --- /dev/null +++ b/static/ml_canvas/assets/channel-Ckr7jPvY.js @@ -0,0 +1 @@ +import{Y as a,$ as n}from"./mermaid.core-fnA2DmhE.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/channel-YEV_Sjpu.js b/static/ml_canvas/assets/channel-YEV_Sjpu.js deleted file mode 100644 index c42c8b2c6..000000000 --- a/static/ml_canvas/assets/channel-YEV_Sjpu.js +++ /dev/null @@ -1 +0,0 @@ -import{Y as a,$ as n}from"./mermaid.core-CiBTFoht.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js b/static/ml_canvas/assets/chunk-2Q5K7J3B-BB3ve9kE.js similarity index 66% rename from static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js rename to static/ml_canvas/assets/chunk-2Q5K7J3B-BB3ve9kE.js index e347e243e..144d9be07 100644 --- a/static/ml_canvas/assets/chunk-2Q5K7J3B-CmWhNyCT.js +++ b/static/ml_canvas/assets/chunk-2Q5K7J3B-BB3ve9kE.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-CiBTFoht.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; +import{_ as s}from"./mermaid.core-fnA2DmhE.js";var t,e=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{e as I}; diff --git a/static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js b/static/ml_canvas/assets/chunk-5VM5RSS4-CA43m6ys.js similarity index 83% rename from static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js rename to static/ml_canvas/assets/chunk-5VM5RSS4-CA43m6ys.js index 5026f1d36..3b89689d4 100644 --- a/static/ml_canvas/assets/chunk-5VM5RSS4-BK7j-D0z.js +++ b/static/ml_canvas/assets/chunk-5VM5RSS4-CA43m6ys.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-CiBTFoht.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-fnA2DmhE.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js b/static/ml_canvas/assets/chunk-F27PBJKO-BOjuYHBE.js similarity index 96% rename from static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js rename to static/ml_canvas/assets/chunk-F27PBJKO-BOjuYHBE.js index 43e400a98..e6de557af 100644 --- a/static/ml_canvas/assets/chunk-F27PBJKO-DEK_ZtH8.js +++ b/static/ml_canvas/assets/chunk-F27PBJKO-BOjuYHBE.js @@ -1 +1 @@ -import{_ as i,S as d,H as o}from"./mermaid.core-CiBTFoht.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; +import{_ as i,S as d,H as o}from"./mermaid.core-fnA2DmhE.js";import{s as l}from"./vendor-flow-Ct2sLZk5.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),y=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),m=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),g=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),f=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),w=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),k=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{y as a,h as b,f as c,x as d,g as e,k as f,w as g,m as h}; diff --git a/static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js b/static/ml_canvas/assets/chunk-IMKFNOWR-DZB-acd2.js similarity index 99% rename from static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js rename to static/ml_canvas/assets/chunk-IMKFNOWR-DZB-acd2.js index a13a79dac..5596783c3 100644 --- a/static/ml_canvas/assets/chunk-IMKFNOWR-C2aIKqeI.js +++ b/static/ml_canvas/assets/chunk-IMKFNOWR-DZB-acd2.js @@ -1,4 +1,4 @@ -import{g as ee}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as se}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-CiBTFoht.js";import{f as pe}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: +import{g as ee}from"./chunk-XXDRQBXY-Cl-UVyYi.js";import{s as se}from"./chunk-POPQ4Y6H-DsvZbH4b.js";import{_ as S,l as b,c as F,u as ie,v as re,a as ae,b as ne,g as oe,s as le,m as ce,n as he,R as ue,j as K,o as de,O as fe}from"./mermaid.core-fnA2DmhE.js";import{f as pe}from"./chunk-F27PBJKO-BOjuYHBE.js";import{s as Dt}from"./vendor-flow-Ct2sLZk5.js";var Ct=(function(){var t=S(function(U,l,u,n){for(u=u||{},n=U.length;n--;u[U[n]]=l);return u},"o"),e=[1,2],s=[1,3],a=[1,4],i=[2,4],o=[1,9],h=[1,11],p=[1,16],d=[1,17],T=[1,18],E=[1,19],m=[1,33],O=[1,20],v=[1,21],x=[1,22],$=[1,23],R=[1,24],f=[1,26],L=[1,27],C=[1,28],V=[1,29],P=[1,30],k=[1,31],B=[1,32],j=[1,35],nt=[1,36],ot=[1,37],lt=[1,38],J=[1,34],y=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],ct=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Lt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],gt={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:S(function(l,u,n,g,_,r,Y){var c=r.length-1;switch(_){case 3:return g.setRootDoc(r[c]),r[c];case 4:this.$=[];break;case 5:r[c]!="nl"&&(r[c-1].push(r[c]),this.$=r[c-1]);break;case 6:case 7:this.$=r[c];break;case 8:this.$="nl";break;case 12:this.$=r[c];break;case 13:const et=r[c-1];et.description=g.trimColon(r[c]),this.$=et;break;case 14:this.$={stmt:"relation",state1:r[c-2],state2:r[c]};break;case 15:const Tt=g.trimColon(r[c]);this.$={stmt:"relation",state1:r[c-3],state2:r[c-1],description:Tt};break;case 19:this.$={stmt:"state",id:r[c-3],type:"default",description:"",doc:r[c-1]};break;case 20:var G=r[c],q=r[c-2].trim();if(r[c].match(":")){var ut=r[c].split(":");G=ut[0],q=[q,ut[1]]}this.$={stmt:"state",id:G,type:"default",description:q};break;case 21:this.$={stmt:"state",id:r[c-3],type:"default",description:r[c-5],doc:r[c-1]};break;case 22:this.$={stmt:"state",id:r[c],type:"fork"};break;case 23:this.$={stmt:"state",id:r[c],type:"join"};break;case 24:this.$={stmt:"state",id:r[c],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[c-1].trim(),note:{position:r[c-2].trim(),text:r[c].trim()}};break;case 29:this.$=r[c].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=r[c].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[c-3],url:r[c-2],tooltip:r[c-1]};break;case 33:this.$={stmt:"click",id:r[c-3],url:r[c-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[c-1].trim(),classes:r[c].trim()};break;case 36:this.$={stmt:"style",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 37:this.$={stmt:"applyClass",id:r[c-1].trim(),styleClass:r[c].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[c].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:r[c-2].trim(),classes:[r[c].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:s,6:a},{1:[3]},{3:5,4:e,5:s,6:a},{3:6,4:e,5:s,6:a},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:p,17:d,19:T,22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,7]),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(y,[2,11]),t(y,[2,12],{14:[1,40],15:[1,41]}),t(y,[2,16]),{18:[1,42]},t(y,[2,18],{20:[1,43]}),{23:[1,44]},t(y,[2,22]),t(y,[2,23]),t(y,[2,24]),t(y,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(y,[2,28]),{34:[1,49]},{36:[1,50]},t(y,[2,31]),{13:51,24:m,57:J},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(ct,[2,44],{58:[1,56]}),t(ct,[2,45],{58:[1,57]}),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,41]),t(y,[2,6]),t(y,[2,13]),{13:58,24:m,57:J},t(y,[2,17]),t(Lt,i,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(y,[2,29]),t(y,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(y,[2,14],{14:[1,71]}),{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,72],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(y,[2,37]),t(ct,[2,46]),t(ct,[2,47]),t(y,[2,15]),t(y,[2,19]),t(Lt,i,{7:78}),t(y,[2,26]),t(y,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:h,8:8,9:10,10:12,11:13,12:14,13:15,16:p,17:d,19:T,21:[1,81],22:E,24:m,25:O,26:v,27:x,28:$,29:R,32:25,33:f,35:L,37:C,38:V,41:P,45:k,48:B,51:j,52:nt,53:ot,54:lt,57:J},t(y,[2,32]),t(y,[2,33]),t(y,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:S(function(l,u){if(u.recoverable)this.trace(l);else{var n=new Error(l);throw n.hash=u,n}},"parseError"),parse:S(function(l){var u=this,n=[0],g=[],_=[null],r=[],Y=this.table,c="",G=0,q=0,ut=2,et=1,Tt=r.slice.call(arguments,1),D=Object.create(this.lexer),H={yy:{}};for(var Et in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Et)&&(H.yy[Et]=this.yy[Et]);D.setInput(l,H.yy),H.yy.lexer=D,H.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var _t=D.yylloc;r.push(_t);var Zt=D.options&&D.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(I){n.length=n.length-2*I,_.length=_.length-I,r.length=r.length-I}S(te,"popStack");function wt(){var I;return I=g.pop()||D.lex()||et,typeof I!="number"&&(I instanceof Array&&(g=I,I=g.pop()),I=u.symbols_[I]||I),I}S(wt,"lex");for(var w,z,N,mt,Q={},dt,M,Ot,ft;;){if(z=n[n.length-1],this.defaultActions[z]?N=this.defaultActions[z]:((w===null||typeof w>"u")&&(w=wt()),N=Y[z]&&Y[z][w]),typeof N>"u"||!N.length||!N[0]){var bt="";ft=[];for(dt in Y[z])this.terminals_[dt]&&dt>ut&&ft.push("'"+this.terminals_[dt]+"'");D.showPosition?bt="Parse error on line "+(G+1)+`: `+D.showPosition()+` Expecting `+ft.join(", ")+", got '"+(this.terminals_[w]||w)+"'":bt="Parse error on line "+(G+1)+": Unexpected "+(w==et?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(bt,{text:D.match,token:this.terminals_[w]||w,line:D.yylineno,loc:_t,expected:ft})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(N[0]){case 1:n.push(w),_.push(D.yytext),r.push(D.yylloc),n.push(N[1]),w=null,q=D.yyleng,c=D.yytext,G=D.yylineno,_t=D.yylloc;break;case 2:if(M=this.productions_[N[1]][1],Q.$=_[_.length-M],Q._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},Zt&&(Q._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(Q,[c,q,G,H.yy,N[1],_,r].concat(Tt)),typeof mt<"u")return mt;M&&(n=n.slice(0,-1*M*2),_=_.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[N[1]][0]),_.push(Q.$),r.push(Q._$),Ot=Y[n[n.length-2]][n[n.length-1]],n.push(Ot);break;case 3:return!0}}return!0},"parse")},Qt=(function(){var U={EOF:1,parseError:S(function(u,n){if(this.yy.parser)this.yy.parser.parseError(u,n);else throw new Error(u)},"parseError"),setInput:S(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:S(function(l){var u=l.length,n=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===g.length?this.yylloc.first_column:0)+g[g.length-n.length].length-n[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(l){this.unput(this.match.slice(l))},"less"),pastInput:S(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js b/static/ml_canvas/assets/chunk-JWPE2WC7-B4HV2Nxc.js similarity index 78% rename from static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js rename to static/ml_canvas/assets/chunk-JWPE2WC7-B4HV2Nxc.js index 80ead696c..0081c5eda 100644 --- a/static/ml_canvas/assets/chunk-JWPE2WC7-CSEprKif.js +++ b/static/ml_canvas/assets/chunk-JWPE2WC7-B4HV2Nxc.js @@ -1 +1 @@ -import{_ as l}from"./mermaid.core-CiBTFoht.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; +import{_ as l}from"./mermaid.core-fnA2DmhE.js";function m(e,c){var i,t,o;e.accDescr&&((i=c.setAccDescription)==null||i.call(c,e.accDescr)),e.accTitle&&((t=c.setAccTitle)==null||t.call(c,e.accTitle)),e.title&&((o=c.setDiagramTitle)==null||o.call(c,e.title))}l(m,"populateCommonDb");export{m as p}; diff --git a/static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js b/static/ml_canvas/assets/chunk-POPQ4Y6H-DsvZbH4b.js similarity index 87% rename from static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js rename to static/ml_canvas/assets/chunk-POPQ4Y6H-DsvZbH4b.js index 26fd3b6b6..f7b046900 100644 --- a/static/ml_canvas/assets/chunk-POPQ4Y6H-CVdo-unt.js +++ b/static/ml_canvas/assets/chunk-POPQ4Y6H-DsvZbH4b.js @@ -1 +1 @@ -import{_ as a,d as w,l as x}from"./mermaid.core-CiBTFoht.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; +import{_ as a,d as w,l as x}from"./mermaid.core-fnA2DmhE.js";var B=a((e,t,i,o)=>{e.attr("class",i);const{width:r,height:h,x:n,y:c}=u(e,t);w(e,h,r,o);const s=d(n,c,r,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{var o;const i=((o=e.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),d=a((e,t,i,o,r)=>`${e-r} ${t-r} ${i} ${o}`,"createViewBox");export{B as s}; diff --git a/static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js b/static/ml_canvas/assets/chunk-SVP7TREG-CnnhSiZz.js similarity index 99% rename from static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js rename to static/ml_canvas/assets/chunk-SVP7TREG-CnnhSiZz.js index b05c1be90..a1d8beeb5 100644 --- a/static/ml_canvas/assets/chunk-SVP7TREG-DpJhy_Kq.js +++ b/static/ml_canvas/assets/chunk-SVP7TREG-CnnhSiZz.js @@ -1,4 +1,4 @@ -import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-CiBTFoht.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` +import{_ as p,l as C,C as H,x as B,o as q,E as G,d as U,i as j,c as K}from"./mermaid.core-fnA2DmhE.js";var A="",M="",O="",D=[],b=new Map,v=p(e=>j(e,K()),"sanitizeText"),y=p(e=>{switch(e.type){case"terminal":return{...e,value:v(e.value)};case"nonterminal":return{...e,name:v(e.name)};case"sequence":return{...e,elements:e.elements.map(y)};case"choice":return{...e,alternatives:e.alternatives.map(y)};case"optional":return{...e,element:y(e.element)};case"repetition":return{...e,element:y(e.element),separator:e.separator?y(e.separator):void 0};case"special":return{...e,text:v(e.text)}}},"sanitizeAstNode"),J=p(()=>{A="",M="",O="",D.length=0,b.clear(),q(),C.debug("[Railroad] Database cleared")},"clear"),Y=p(e=>{A=v(e),C.debug("[Railroad] Title set:",e)},"setTitle"),P=p(()=>A,"getTitle"),Q=p(e=>{const i={...e,name:v(e.name),definition:y(e.definition),comment:e.comment?v(e.comment):void 0};C.debug("[Railroad] Adding rule:",i.name),b.has(i.name)&&C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),D.push(i),b.set(i.name,i)},"addRule"),Z=p(()=>D,"getRules"),V=p(e=>b.get(e),"getRule"),ee=p(e=>{M=v(e).replace(/^\s+/g,""),C.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),te=p(()=>M,"getAccTitle"),re=p(e=>{O=v(e).replace(/\n\s+/g,` `),C.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ie=p(()=>O,"getAccDescription"),ne=Y,ae=P,oe={clear:J,setTitle:Y,getTitle:P,addRule:Q,getRules:Z,getRule:V,setAccTitle:ee,getAccTitle:te,setAccDescription:re,getAccDescription:ie,setDiagramTitle:ne,getDiagramTitle:ae},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},le=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,se=/^[\w "',.-]+$/,de=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),L=p(e=>e?Object.keys(e).every(i=>i==="railroad"||de.has(i)):!1,"isRailroadStyleOptions"),ce=p(e=>e?"railroad"in e&&e.railroad?e.railroad:L(e)?e:{}:{},"extractRailroadOverrides"),me=p(e=>{if(!e||L(e))return{};const{railroad:i,svgId:a,theme:n,look:t,...r}=e;return r},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return le.test(a)?a:i},"sanitizeColorValue"),I=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return se.test(a)?a:i},"sanitizeFontFamilyValue"),F=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),he=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),pe=p(e=>{const i=I(e.fontFamily,f.fontFamily),a=he(e.fontSize)??f.fontSize;return{...f,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:m(e.lineColor,f.lineColor),markerFill:m(e.lineColor,f.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),E=p(e=>{const i=B(),a={...G(),...i.themeVariables??{},...me(e)},n=pe(a),t={...i.railroad??{},...ce(e)};return{compactMode:t.compactMode??n.compactMode,padding:F(t.padding,n.padding),verticalSeparation:F(t.verticalSeparation,n.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,n.horizontalSeparation),arcRadius:F(t.arcRadius,n.arcRadius),fontSize:F(t.fontSize,n.fontSize),fontFamily:I(t.fontFamily,n.fontFamily),terminalFill:m(t.terminalFill,n.terminalFill),terminalStroke:m(t.terminalStroke,n.terminalStroke),terminalTextColor:m(t.terminalTextColor,n.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:m(t.lineColor,n.lineColor),strokeWidth:F(t.strokeWidth,n.strokeWidth),markerFill:m(t.markerFill,n.markerFill),commentFill:m(t.commentFill,n.commentFill),commentStroke:m(t.commentStroke,n.commentStroke),commentTextColor:m(t.commentTextColor,n.commentTextColor),specialFill:m(t.specialFill,n.specialFill),specialStroke:m(t.specialStroke,n.specialStroke),ruleNameColor:m(t.ruleNameColor,n.ruleNameColor),showMarkers:t.showMarkers??n.showMarkers,markerRadius:F(t.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),Te=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:n,terminalStroke:t,terminalTextColor:r,nonTerminalFill:o,nonTerminalStroke:g,nonTerminalTextColor:l,lineColor:s,strokeWidth:h,markerFill:u,commentFill:c,commentStroke:w,commentTextColor:d,specialFill:T,specialStroke:z,ruleNameColor:S}=E(e);return` .railroad-diagram { font-family: ${i}; diff --git a/static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js b/static/ml_canvas/assets/chunk-TICWLB2K-vhLw6Q_A.js similarity index 99% rename from static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js rename to static/ml_canvas/assets/chunk-TICWLB2K-vhLw6Q_A.js index 27bacaae3..809c7310d 100644 --- a/static/ml_canvas/assets/chunk-TICWLB2K-DbX59BGa.js +++ b/static/ml_canvas/assets/chunk-TICWLB2K-vhLw6Q_A.js @@ -1,4 +1,4 @@ -import{g as st}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{g as it}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as at}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-CiBTFoht.js";import{f as mt}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: +import{g as st}from"./chunk-5VM5RSS4-CA43m6ys.js";import{g as it}from"./chunk-XXDRQBXY-Cl-UVyYi.js";import{s as at}from"./chunk-POPQ4Y6H-DsvZbH4b.js";import{_ as g,l as we,c as F,t as rt,u as nt,v as Ve,O as ut,b as lt,a as ct,s as ot,g as ht,m as dt,n as pt,j as I,o as At,p as ft,i as gt,P as z}from"./mermaid.core-fnA2DmhE.js";import{f as mt}from"./chunk-F27PBJKO-BOjuYHBE.js";import{s as fe}from"./vendor-flow-Ct2sLZk5.js";var Pe=(function(){var s=g(function(O,o,d,p){for(d=d||{},p=O.length;p--;d[O[p]]=o);return d},"o"),i=[1,18],a=[1,19],r=[1,20],n=[1,41],u=[1,26],h=[1,42],f=[1,24],c=[1,25],m=[1,32],B=[1,33],R=[1,34],b=[1,45],me=[1,35],Ce=[1,36],be=[1,37],ke=[1,38],Ee=[1,27],Te=[1,28],ye=[1,29],De=[1,30],Fe=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],Be=[1,9],A=[1,8,9],te=[1,58],se=[1,59],ie=[1,60],ae=[1,61],re=[1,62],_e=[1,63],Se=[1,64],S=[1,8,9,41],Me=[1,77],G=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ne=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ue=[13,60,86,100,102,103],K=[13,60,73,74,86,100,102,103],Re=[13,60,68,69,70,71,72,86,100,102,103],le=[1,103],W=[1,121],Q=[1,117],j=[1,113],X=[1,119],q=[1,114],H=[1,115],J=[1,116],Z=[1,118],$=[1,120],Ge=[22,50,60,61,82,86,87,88,89,90],Ue=[1,128],ce=[12,39],Ne=[1,8,9,39,41,44,46],oe=[1,8,9,22],ze=[1,153],Ye=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Le={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:g(function(o,d,p,l,C,e,ee){var t=e.length-1;switch(C){case 8:this.$=e[t-1];break;case 9:case 10:case 13:case 15:this.$=e[t];break;case 11:case 14:this.$=e[t-2]+"."+e[t];break;case 12:case 16:this.$=e[t-1]+e[t];break;case 17:case 18:this.$=e[t-1]+"~"+e[t]+"~";break;case 19:l.addRelation(e[t]);break;case 20:e[t-1].title=l.cleanupLabel(e[t]),l.addRelation(e[t-1]);break;case 31:this.$=e[t].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[t].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[t-3],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[t-4],e[t-1][0],e[t-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[t]);break;case 37:this.$=l.addNamespace(e[t-1],e[t]);break;case 38:this.$=[[e[t]],[]];break;case 39:this.$=[[e[t-1]],[]];break;case 40:e[t][0].unshift(e[t-2]),this.$=e[t];break;case 41:this.$=[[],[e[t]]];break;case 42:this.$=[[],[e[t-1]]];break;case 43:e[t][1].unshift(e[t-2]),this.$=e[t];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[t];break;case 48:l.setCssClass(e[t-2],e[t]);break;case 49:l.addMembers(e[t-3],e[t-1]);break;case 51:l.setCssClass(e[t-5],e[t-3]),l.addMembers(e[t-5],e[t-1]);break;case 52:l.addAnnotation(e[t-3],e[t-1]);break;case 53:l.addAnnotation(e[t-6],e[t-4]),l.addMembers(e[t-6],e[t-1]);break;case 54:l.addAnnotation(e[t-5],e[t-3]);break;case 55:this.$=e[t],l.addClass(e[t]);break;case 56:this.$=e[t-1],l.addClass(e[t-1]),l.setClassLabel(e[t-1],e[t]);break;case 60:l.addAnnotation(e[t],e[t-2]);break;case 61:case 74:this.$=[e[t]];break;case 62:e[t].push(e[t-1]),this.$=e[t];break;case 63:break;case 64:l.addMember(e[t-1],l.cleanupLabel(e[t]));break;case 65:break;case 66:break;case 67:this.$={id1:e[t-2],id2:e[t],relation:e[t-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[t-3],id2:e[t],relation:e[t-1],relationTitle1:e[t-2],relationTitle2:"none"};break;case 69:this.$={id1:e[t-3],id2:e[t],relation:e[t-2],relationTitle1:"none",relationTitle2:e[t-1]};break;case 70:this.$={id1:e[t-4],id2:e[t],relation:e[t-2],relationTitle1:e[t-3],relationTitle2:e[t-1]};break;case 71:this.$=l.addNote(e[t],e[t-1]);break;case 72:this.$=l.addNote(e[t]);break;case 73:this.$=e[t-2],l.defineClass(e[t-1],e[t]);break;case 75:this.$=e[t-2].concat([e[t]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[t-2],type2:e[t],lineType:e[t-1]};break;case 81:this.$={type1:"none",type2:e[t],lineType:e[t-1]};break;case 82:this.$={type1:e[t-1],type2:"none",lineType:e[t]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[t]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[t-2],l.setClickEvent(e[t-1],e[t]);break;case 92:case 98:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 93:this.$=e[t-2],l.setLink(e[t-1],e[t]);break;case 94:this.$=e[t-3],l.setLink(e[t-2],e[t-1],e[t]);break;case 95:this.$=e[t-3],l.setLink(e[t-2],e[t-1]),l.setTooltip(e[t-2],e[t]);break;case 96:this.$=e[t-4],l.setLink(e[t-3],e[t-2],e[t]),l.setTooltip(e[t-3],e[t-1]);break;case 99:this.$=e[t-3],l.setClickEvent(e[t-2],e[t-1],e[t]);break;case 100:this.$=e[t-4],l.setClickEvent(e[t-3],e[t-2],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 101:this.$=e[t-3],l.setLink(e[t-2],e[t]);break;case 102:this.$=e[t-4],l.setLink(e[t-3],e[t-1],e[t]);break;case 103:this.$=e[t-4],l.setLink(e[t-3],e[t-1]),l.setTooltip(e[t-3],e[t]);break;case 104:this.$=e[t-5],l.setLink(e[t-4],e[t-2],e[t]),l.setTooltip(e[t-4],e[t-1]);break;case 105:this.$=e[t-2],l.setCssStyle(e[t-1],e[t]);break;case 106:l.setCssClass(e[t-1],e[t]);break;case 107:this.$=[e[t]];break;case 108:e[t-2].push(e[t]),this.$=e[t-2];break;case 110:this.$=e[t-1]+e[t];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(Be,[2,5],{8:[1,48]}),{8:[1,49]},s(A,[2,19],{22:[1,50]}),s(A,[2,21]),s(A,[2,22]),s(A,[2,23]),s(A,[2,24]),s(A,[2,25]),s(A,[2,26]),s(A,[2,27]),s(A,[2,28]),s(A,[2,29]),s(A,[2,30]),{34:[1,51]},{36:[1,52]},s(A,[2,33]),s(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se}),{39:[1,65]},s(S,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),s(A,[2,65]),s(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Me,55:76},{58:78,60:[1,79]},s(A,[2,76]),s(A,[2,77]),s(A,[2,78]),s(A,[2,79]),s(G,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),s(G,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},s(ne,[2,133]),s(ne,[2,134]),s(ne,[2,135]),s(ne,[2,136]),s([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),s(Be,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:r,42:n,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:r,38:22,42:n,43:23,46:u,48:h,51:f,52:c,54:m,56:B,57:R,60:b,62:me,63:Ce,64:be,65:ke,75:Ee,76:Te,78:ye,82:De,83:Fe,86:k,100:E,102:T,103:y},s(A,[2,20]),s(A,[2,31]),s(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:te,69:se,70:ie,71:ae,72:re,73:_e,74:Se},s(A,[2,64]),{67:93,73:_e,74:Se},s(ue,[2,83],{66:94,68:te,69:se,70:ie,71:ae,72:re}),s(K,[2,84]),s(K,[2,85]),s(K,[2,86]),s(K,[2,87]),s(K,[2,88]),s(Re,[2,89]),s(Re,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:h,54:m,56:B},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:le},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:W,50:Q,59:110,60:j,82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},{60:[1,122]},{13:Me,55:123},s(S,[2,72]),s(S,[2,138]),{22:W,50:Q,59:124,60:j,61:[1,125],82:X,84:111,85:112,86:q,87:H,88:J,89:Z,90:$},s(Ge,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},s(G,[2,16]),s(G,[2,17]),s(G,[2,18]),{11:127,12:Ue,39:[2,36]},s(ce,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),s(ce,[2,10]),s(Ne,[2,55],{11:131,12:Ue}),s(Be,[2,7]),{9:[1,132]},s(oe,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},s(ue,[2,82],{66:136,68:te,69:se,70:ie,71:ae,72:re}),s(ue,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:h,54:m,56:B},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},s(S,[2,48],{39:[1,142]}),{41:[1,143]},s(S,[2,50]),{41:[2,61],45:144,51:le},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},s(A,[2,91],{13:[1,147]}),s(A,[2,93],{13:[1,149],77:[1,148]}),s(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},s(A,[2,105],{61:ze}),s(Ye,[2,107],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(x,[2,109]),s(x,[2,111]),s(x,[2,112]),s(x,[2,113]),s(x,[2,114]),s(x,[2,115]),s(x,[2,116]),s(x,[2,117]),s(x,[2,118]),s(x,[2,119]),s(A,[2,106]),s(S,[2,71]),s(A,[2,73],{61:ze}),{60:[1,155]},s(G,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},s(ce,[2,12]),s(Ne,[2,56]),{1:[2,4]},s(oe,[2,69]),s(oe,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},s(ue,[2,80]),s(S,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:h,54:m,56:B},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:h,54:m,56:B},{45:163,51:le},s(S,[2,49]),{41:[2,62]},s(S,[2,52],{39:[1,164]}),s(A,[2,60]),s(A,[2,92]),s(A,[2,94]),s(A,[2,95],{77:[1,165]}),s(A,[2,98]),s(A,[2,99],{13:[1,166]}),s(A,[2,101],{13:[1,168],77:[1,167]}),{22:W,50:Q,60:j,82:X,84:169,85:112,86:q,87:H,88:J,89:Z,90:$},s(x,[2,110]),s(Ge,[2,75]),{14:[1,170]},s(ce,[2,11]),s(oe,[2,70]),s(S,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:le},s(A,[2,96]),s(A,[2,100]),s(A,[2,102]),s(A,[2,103],{77:[1,174]}),s(Ye,[2,108],{85:154,22:W,50:Q,60:j,82:X,86:q,87:H,88:J,89:Z,90:$}),s(Ne,[2,8]),s(S,[2,51]),{41:[1,175]},s(S,[2,54]),s(A,[2,104]),s(S,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:g(function(o,d){if(d.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=d,p}},"parseError"),parse:g(function(o){var d=this,p=[0],l=[],C=[null],e=[],ee=this.table,t="",de=0,Ke=0,Ze=2,We=1,$e=e.slice.call(arguments,1),D=Object.create(this.lexer),V={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(V.yy[xe]=this.yy[xe]);D.setInput(o,V.yy),V.yy.lexer=D,V.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ve=D.yylloc;e.push(ve);var et=D.options&&D.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function tt(N){p.length=p.length-2*N,C.length=C.length-N,e.length=e.length-N}g(tt,"popStack");function Qe(){var N;return N=l.pop()||D.lex()||We,typeof N!="number"&&(N instanceof Array&&(l=N,N=l.pop()),N=d.symbols_[N]||N),N}g(Qe,"lex");for(var _,P,L,Ie,U={},pe,v,je,Ae;;){if(P=p[p.length-1],this.defaultActions[P]?L=this.defaultActions[P]:((_===null||typeof _>"u")&&(_=Qe()),L=ee[P]&&ee[P][_]),typeof L>"u"||!L.length||!L[0]){var Oe="";Ae=[];for(pe in ee[P])this.terminals_[pe]&&pe>Ze&&Ae.push("'"+this.terminals_[pe]+"'");D.showPosition?Oe="Parse error on line "+(de+1)+`: `+D.showPosition()+` Expecting `+Ae.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Oe="Parse error on line "+(de+1)+": Unexpected "+(_==We?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Oe,{text:D.match,token:this.terminals_[_]||_,line:D.yylineno,loc:ve,expected:Ae})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+_);switch(L[0]){case 1:p.push(_),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),_=null,Ke=D.yyleng,t=D.yytext,de=D.yylineno,ve=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],U.$=C[C.length-v],U._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},et&&(U._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),Ie=this.performAction.apply(U,[t,Ke,de,V.yy,L[1],C,e].concat($e)),typeof Ie<"u")return Ie;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(U.$),e.push(U._$),je=ee[p[p.length-2]][p[p.length-1]],p.push(je);break;case 3:return!0}}return!0},"parse")},Je=(function(){var O={EOF:1,parseError:g(function(d,p){if(this.yy.parser)this.yy.parser.parseError(d,p);else throw new Error(d)},"parseError"),setInput:g(function(o,d){return this.yy=d||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var d=o.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:g(function(o){var d=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(o){this.unput(this.match.slice(o))},"less"),pastInput:g(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var o=this.pastInput(),d=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js b/static/ml_canvas/assets/chunk-XXDRQBXY-Cl-UVyYi.js similarity index 76% rename from static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js rename to static/ml_canvas/assets/chunk-XXDRQBXY-Cl-UVyYi.js index 1f68d904c..d4fc1d4a3 100644 --- a/static/ml_canvas/assets/chunk-XXDRQBXY-B1omEyzC.js +++ b/static/ml_canvas/assets/chunk-XXDRQBXY-Cl-UVyYi.js @@ -1 +1 @@ -import{_ as s}from"./mermaid.core-CiBTFoht.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; +import{_ as s}from"./mermaid.core-fnA2DmhE.js";import{s as o}from"./vendor-flow-Ct2sLZk5.js";var d=s((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js deleted file mode 100644 index 0e0e3e57c..000000000 --- a/static/ml_canvas/assets/classDiagram-ZZMXUADV-BvfNDfXK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DbX59BGa.js";import{_ as i}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-BK7j-D0z.js";import"./chunk-XXDRQBXY-B1omEyzC.js";import"./chunk-POPQ4Y6H-CVdo-unt.js";import"./chunk-F27PBJKO-DEK_ZtH8.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-ZZMXUADV-CQ6ZZmKh.js b/static/ml_canvas/assets/classDiagram-ZZMXUADV-CQ6ZZmKh.js new file mode 100644 index 000000000..93b58a2e0 --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-ZZMXUADV-CQ6ZZmKh.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-vhLw6Q_A.js";import{_ as i}from"./mermaid.core-fnA2DmhE.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-CA43m6ys.js";import"./chunk-XXDRQBXY-Cl-UVyYi.js";import"./chunk-POPQ4Y6H-DsvZbH4b.js";import"./chunk-F27PBJKO-BOjuYHBE.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js deleted file mode 100644 index 0e0e3e57c..000000000 --- a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-BvfNDfXK.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-DbX59BGa.js";import{_ as i}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-BK7j-D0z.js";import"./chunk-XXDRQBXY-B1omEyzC.js";import"./chunk-POPQ4Y6H-CVdo-unt.js";import"./chunk-F27PBJKO-DEK_ZtH8.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-CQ6ZZmKh.js b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-CQ6ZZmKh.js new file mode 100644 index 000000000..93b58a2e0 --- /dev/null +++ b/static/ml_canvas/assets/classDiagram-v2-VYDZK3BY-CQ6ZZmKh.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-vhLw6Q_A.js";import{_ as i}from"./mermaid.core-fnA2DmhE.js";import"./vendor-flow-Ct2sLZk5.js";import"./chunk-5VM5RSS4-CA43m6ys.js";import"./chunk-XXDRQBXY-Cl-UVyYi.js";import"./chunk-POPQ4Y6H-DsvZbH4b.js";import"./chunk-F27PBJKO-BOjuYHBE.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{c as diagram}; diff --git a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-C4_NA6Sr.js similarity index 99% rename from static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js rename to static/ml_canvas/assets/cose-bilkent-JH36ORCC-C4_NA6Sr.js index 735ec9c88..f93d07b9e 100644 --- a/static/ml_canvas/assets/cose-bilkent-JH36ORCC-B7WR3tUy.js +++ b/static/ml_canvas/assets/cose-bilkent-JH36ORCC-C4_NA6Sr.js @@ -1 +1 @@ -import{_ as V,l as k}from"./mermaid.core-CiBTFoht.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; +import{_ as V,l as k}from"./mermaid.core-fnA2DmhE.js";import{c as tt}from"./cytoscape.esm-Bch-eiPH.js";import{g as lt}from"./vendor-utils-VkF_O5b_.js";import{s as gt}from"./vendor-flow-Ct2sLZk5.js";import"./index-C2dSXwG1.js";import"./vendor-charts-BkHP8M8k.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,T){G.exports=T()})(ut,function(){return(function(N){var I={};function T(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,T),e.l=!0,e.exports}return T.m=N,T.c=I,T.i=function(o){return o},T.d=function(o,e,t){T.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},T.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return T.d(e,"a",e),e},T.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},T.p="",T(T.s=26)})([(function(N,I,T){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,T){var o=T(2),e=T(8),t=T(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,T){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(13),i=T(0),l=T(16),g=T(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,T){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,T){var o=T(2),e=T(10),t=T(0),i=T(6),l=T(3),g=T(1),n=T(13),d=T(12),r=T(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var E=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(E.source=v,E.target=D,E.isInterGraph=!1,this.getEdges().push(E),v.edges.push(E),D!=v&&D.edges.push(E),E)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,E=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,E,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?E=y[0].getParent().paddingLeft:E=this.margin,this.left=v-E,this.top=p-E,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,E=-e.MAX_VALUE,y,O,s,f,c,L=this.nodes,A=L.length,m=0;my&&(v=y),Ds&&(u=s),Ey&&(v=y),Ds&&(u=s),E=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,T){var o,e=T(1);function t(i){o=T(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=L,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=L,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=L,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+E*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-E*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=L,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,E=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,L=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,L=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*L-f*c)/A,E=(O*c-y*L)/A,new o(u,E))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,T){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,T){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,T){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),E.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}E=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(L,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,E=p[0])}return E},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,T){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,T){var o=T(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,T){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),E=new Set,a=0;ay||E>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||E>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,T){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(L){return f.has(L)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,L=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,L),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RL&&(L=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var L=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,L);var A=u.calculateBounds(s),m=new E;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(L-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],L=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,L=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,L,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var L=s.idToDummyNode[c],A=L.paddingLeft,m=L.paddingTop;s.adjustLocations(f[c],L.rect.x,L.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var L=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,L=0;LM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(L){var A=f[L];c.tiledMemberPack[L]=c.tileNodes(s[L],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[L].width,A.rect.height=c.tiledMemberPack[L].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,L=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:L};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,L=0;Lc&&(f=L,c=s.rowWidth[L]);return f},y.prototype.canAddHorizontal=function(s,f,c){var L=this.getShortestRowIndex(s);if(L<0)return!0;var A=s.rowWidth[L];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[L]0&&(m=c+s.verticalPadding-s.rowHeight[L]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){L.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=L[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=E.getGraphManager().add(E.newGraph(),c),this.processChildrenList(R,f,E)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=lt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(T=>{["id","label","height","width","padding","x","y"].includes(T)||(I[T]=N[T])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(T=>{["id","start","end"].includes(T)||(I[T]=N[T])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=gt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const T={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(T).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),T={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(T[o]=N[o])}),T})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,T={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(T[o]=N[o])}),T})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),T=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${T.length} edges`),{nodes:I,edges:T}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:T,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const E={...u};n[u.id]=E,g[u.id]=E,await N(r,u)}else{const E={...u};g[u.id]=E;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();E.width=O.width,E.height=O.height,E.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const E=g[u.id];return{...u,width:E.width,height:E.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const E=g[u.id];E!=null&&E.domId&&(E.domId.attr("transform",`translate(${u.x}, ${u.y})`),E.x=u.x,E.y=u.y,t.debug(`Positioned node ${E.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const E=G.edges.find(y=>y.id===u.id);E&&(E.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await T(a,u);const E=g[u.start??""],y=g[u.end??""];if(E&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:E.x||0,y:E.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,E,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),mt=Lt;export{mt as render}; diff --git a/static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js b/static/ml_canvas/assets/cynefin-OW5HDTMX-DPLixWx6.js similarity index 99% rename from static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js rename to static/ml_canvas/assets/cynefin-OW5HDTMX-DPLixWx6.js index 0c352cf2a..0f258e14f 100644 --- a/static/ml_canvas/assets/cynefin-OW5HDTMX-CgUfycTN.js +++ b/static/ml_canvas/assets/cynefin-OW5HDTMX-DPLixWx6.js @@ -1,4 +1,4 @@ -var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-C87GWrUj.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` +var dk=Object.defineProperty;var pk=(t,e,r)=>e in t?dk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Br=(t,e,r)=>pk(t,typeof e!="symbol"?e+"":e,r);import{_ as ut}from"./index-C2dSXwG1.js";var mk=Object.create,Du=Object.defineProperty,hk=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyNames,yk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty,s=(t,e)=>Du(t,"name",{value:e,configurable:!0}),vk=(t,e)=>function(){return t&&(e=(0,t[Th(t)[0]])(t=0)),e},X=(t,e)=>function(){return e||(0,t[Th(t)[0]])((e={exports:{}}).exports,e),e.exports},tn=(t,e)=>{for(var r in e)Du(t,r,{get:e[r],enumerable:!0})},$h=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Th(e))!gk.call(t,a)&&a!==r&&Du(t,a,{get:()=>e[a],enumerable:!(n=hk(e,a))||n.enumerable});return t},Of=(t,e,r)=>($h(t,e,"default"),r),Rh=(t,e,r)=>(r=t!=null?mk(yk(t)):{},$h(Du(r,"default",{value:t,enumerable:!0}),t)),Ah=t=>$h(Du({},"__esModule",{value:!0}),t),Lf={};tn(Lf,{AnnotatedTextEdit:()=>Ar,ChangeAnnotation:()=>mn,ChangeAnnotationIdentifier:()=>et,CodeAction:()=>Qp,CodeActionContext:()=>Zp,CodeActionKind:()=>Jp,CodeActionTriggerKind:()=>Xl,CodeDescription:()=>Ip,CodeLens:()=>em,Color:()=>Ec,ColorInformation:()=>Ep,ColorPresentation:()=>Cp,Command:()=>pn,CompletionItem:()=>Fp,CompletionItemKind:()=>Op,CompletionItemLabelDetails:()=>Gp,CompletionItemTag:()=>Dp,CompletionList:()=>zp,CreateFile:()=>_a,DeleteFile:()=>wa,Diagnostic:()=>Vl,DiagnosticRelatedInformation:()=>Cc,DiagnosticSeverity:()=>Sp,DiagnosticTag:()=>wp,DocumentHighlight:()=>Wp,DocumentHighlightKind:()=>Kp,DocumentLink:()=>rm,DocumentSymbol:()=>Xp,DocumentUri:()=>$p,EOL:()=>x$,FoldingRange:()=>_p,FoldingRangeKind:()=>bp,FormattingOptions:()=>tm,Hover:()=>jp,InlayHint:()=>fm,InlayHintKind:()=>Sc,InlayHintLabelPart:()=>wc,InlineCompletionContext:()=>gm,InlineCompletionItem:()=>pm,InlineCompletionList:()=>mm,InlineCompletionTriggerKind:()=>hm,InlineValueContext:()=>cm,InlineValueEvaluatableExpression:()=>um,InlineValueText:()=>om,InlineValueVariableLookup:()=>lm,InsertReplaceEdit:()=>Mp,InsertTextFormat:()=>Lp,InsertTextMode:()=>xp,Location:()=>Wl,LocationLink:()=>Ap,MarkedString:()=>Yl,MarkupContent:()=>Ia,MarkupKind:()=>_c,OptionalVersionedTextDocumentIdentifier:()=>Hl,ParameterInformation:()=>Bp,Position:()=>oe,Range:()=>te,RenameFile:()=>Sa,SelectedCompletionInfo:()=>ym,SelectionRange:()=>nm,SemanticTokenModifiers:()=>im,SemanticTokenTypes:()=>am,SemanticTokens:()=>sm,SignatureInformation:()=>Up,StringValue:()=>dm,SymbolInformation:()=>Hp,SymbolKind:()=>Vp,SymbolTag:()=>qp,TextDocument:()=>Tm,TextDocumentEdit:()=>ql,TextDocumentIdentifier:()=>Np,TextDocumentItem:()=>kp,TextEdit:()=>ar,URI:()=>Ac,VersionedTextDocumentIdentifier:()=>Pp,WorkspaceChange:()=>M$,WorkspaceEdit:()=>bc,WorkspaceFolder:()=>vm,WorkspaceSymbol:()=>Yp,integer:()=>Rp,uinteger:()=>Kl});var $p,Ac,Rp,Kl,oe,te,Wl,Ap,Ec,Ep,Cp,bp,_p,Cc,Sp,wp,Ip,Vl,pn,ar,mn,et,Ar,ql,_a,Sa,wa,bc,kl,Ud,M$,Np,Pp,Hl,kp,_c,Ia,Op,Lp,Dp,Mp,xp,Gp,Fp,zp,Yl,jp,Bp,Up,Kp,Wp,Vp,qp,Hp,Yp,Xp,Jp,Xl,Zp,Qp,em,tm,rm,nm,am,im,sm,om,lm,um,cm,Sc,wc,fm,dm,pm,mm,hm,ym,gm,vm,x$,Tm,iv,C,Mu=vk({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})($p||($p={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Ac||(Ac={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Rp||(Rp={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(Kl||(Kl={})),(function(a){function i(u,l){return u===Number.MAX_VALUE&&(u=Kl.MAX_VALUE),l===Number.MAX_VALUE&&(l=Kl.MAX_VALUE),{line:u,character:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&C.uinteger(l.line)&&C.uinteger(l.character)}s(o,"is"),a.is=o})(oe||(oe={})),(function(a){function i(u,l,c,f){if(C.uinteger(u)&&C.uinteger(l)&&C.uinteger(c)&&C.uinteger(f))return{start:oe.create(u,l),end:oe.create(c,f)};if(oe.is(u)&&oe.is(l))return{start:u,end:l};throw new Error(`Range#create called with invalid arguments[${u}, ${l}, ${c}, ${f}]`)}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&oe.is(l.start)&&oe.is(l.end)}s(o,"is"),a.is=o})(te||(te={})),(function(a){function i(u,l){return{uri:u,range:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(C.string(l.uri)||C.undefined(l.uri))}s(o,"is"),a.is=o})(Wl||(Wl={})),(function(a){function i(u,l,c,f){return{targetUri:u,targetRange:l,targetSelectionRange:c,originSelectionRange:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.targetRange)&&C.string(l.targetUri)&&te.is(l.targetSelectionRange)&&(te.is(l.originSelectionRange)||C.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(u,l,c,f){return{red:u,green:l,blue:c,alpha:f}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.numberRange(l.red,0,1)&&C.numberRange(l.green,0,1)&&C.numberRange(l.blue,0,1)&&C.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(Ec||(Ec={})),(function(a){function i(u,l){return{range:u,color:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&te.is(l.range)&&Ec.is(l.color)}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(u,l,c){return{label:u,textEdit:l,additionalTextEdits:c}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.undefined(l.textEdit)||ar.is(l))&&(C.undefined(l.additionalTextEdits)||C.typedArray(l.additionalTextEdits,ar.is))}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(bp||(bp={})),(function(a){function i(u,l,c,f,d,p){const h={startLine:u,endLine:l};return C.defined(c)&&(h.startCharacter=c),C.defined(f)&&(h.endCharacter=f),C.defined(d)&&(h.kind=d),C.defined(p)&&(h.collapsedText=p),h}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.uinteger(l.startLine)&&C.uinteger(l.startLine)&&(C.undefined(l.startCharacter)||C.uinteger(l.startCharacter))&&(C.undefined(l.endCharacter)||C.uinteger(l.endCharacter))&&(C.undefined(l.kind)||C.string(l.kind))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(u,l){return{location:u,message:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Wl.is(l.location)&&C.string(l.message)}s(o,"is"),a.is=o})(Cc||(Cc={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Sp||(Sp={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(wp||(wp={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&C.string(u.href)}s(i,"is"),a.is=i})(Ip||(Ip={})),(function(a){function i(u,l,c,f,d,p){let h={range:u,message:l};return C.defined(c)&&(h.severity=c),C.defined(f)&&(h.code=f),C.defined(d)&&(h.source=d),C.defined(p)&&(h.relatedInformation=p),h}s(i,"create"),a.create=i;function o(u){var l;let c=u;return C.defined(c)&&te.is(c.range)&&C.string(c.message)&&(C.number(c.severity)||C.undefined(c.severity))&&(C.integer(c.code)||C.string(c.code)||C.undefined(c.code))&&(C.undefined(c.codeDescription)||C.string((l=c.codeDescription)===null||l===void 0?void 0:l.href))&&(C.string(c.source)||C.undefined(c.source))&&(C.undefined(c.relatedInformation)||C.typedArray(c.relatedInformation,Cc.is))}s(o,"is"),a.is=o})(Vl||(Vl={})),(function(a){function i(u,l,...c){let f={title:u,command:l};return C.defined(c)&&c.length>0&&(f.arguments=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.title)&&C.string(l.command)}s(o,"is"),a.is=o})(pn||(pn={})),(function(a){function i(c,f){return{range:c,newText:f}}s(i,"replace"),a.replace=i;function o(c,f){return{range:{start:c,end:c},newText:f}}s(o,"insert"),a.insert=o;function u(c){return{range:c,newText:""}}s(u,"del"),a.del=u;function l(c){const f=c;return C.objectLiteral(f)&&C.string(f.newText)&&te.is(f.range)}s(l,"is"),a.is=l})(ar||(ar={})),(function(a){function i(u,l,c){const f={label:u};return l!==void 0&&(f.needsConfirmation=l),c!==void 0&&(f.description=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&C.string(l.label)&&(C.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(C.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(mn||(mn={})),(function(a){function i(o){const u=o;return C.string(u)}s(i,"is"),a.is=i})(et||(et={})),(function(a){function i(c,f,d){return{range:c,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(c,f,d){return{range:{start:c,end:c},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function u(c,f){return{range:c,newText:"",annotationId:f}}s(u,"del"),a.del=u;function l(c){const f=c;return ar.is(f)&&(mn.is(f.annotationId)||et.is(f.annotationId))}s(l,"is"),a.is=l})(Ar||(Ar={})),(function(a){function i(u,l){return{textDocument:u,edits:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&Hl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(ql||(ql={})),(function(a){function i(u,l,c){let f={kind:"create",uri:u};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="create"&&C.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(_a||(_a={})),(function(a){function i(u,l,c,f){let d={kind:"rename",oldUri:u,newUri:l};return c!==void 0&&(c.overwrite!==void 0||c.ignoreIfExists!==void 0)&&(d.options=c),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="rename"&&C.string(l.oldUri)&&C.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||C.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||C.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(Sa||(Sa={})),(function(a){function i(u,l,c){let f={kind:"delete",uri:u};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),c!==void 0&&(f.annotationId=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&l.kind==="delete"&&C.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||C.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||C.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||et.is(l.annotationId))}s(o,"is"),a.is=o})(wa||(wa={})),(function(a){function i(o){let u=o;return u&&(u.changes!==void 0||u.documentChanges!==void 0)&&(u.documentChanges===void 0||u.documentChanges.every(l=>C.string(l.kind)?_a.is(l)||Sa.is(l)||wa.is(l):ql.is(l)))}s(i,"is"),a.is=i})(bc||(bc={})),kl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,u){let l,c;if(u===void 0?l=ar.insert(i,o):et.is(u)?(c=u,l=Ar.insert(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.insert(i,o,c)),this.edits.push(l),c!==void 0)return c}replace(i,o,u){let l,c;if(u===void 0?l=ar.replace(i,o):et.is(u)?(c=u,l=Ar.replace(i,o,u)):(this.assertChangeAnnotations(this.changeAnnotations),c=this.changeAnnotations.manage(u),l=Ar.replace(i,o,c)),this.edits.push(l),c!==void 0)return c}delete(i,o){let u,l;if(o===void 0?u=ar.del(i):et.is(o)?(l=o,u=Ar.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),u=Ar.del(i,l)),this.edits.push(u),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),Ud=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let u;if(et.is(i)?u=i:(u=this.nextId(),o=i),this._annotations[u]!==void 0)throw new Error(`Id ${u} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${u}`);return this._annotations[u]=o,this._size++,u}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),M$=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new Ud(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(ql.is(o)){const u=new kl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=u}})):i.changes&&Object.keys(i.changes).forEach(o=>{const u=new kl(i.changes[o]);this._textEditChanges[o]=u})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(Hl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let u=this._textEditChanges[o.uri];if(!u){const l=[],c={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(c),u=new kl(l,this._changeAnnotations),this._textEditChanges[o.uri]=u}return u}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let u=[];this._workspaceEdit.changes[i]=u,o=new kl(u),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ud,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=_a.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=_a.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}renameFile(i,o,u,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let c;mn.is(u)||et.is(u)?c=u:l=u;let f,d;if(c===void 0?f=Sa.create(i,o,l):(d=et.is(c)?c:this._changeAnnotations.manage(c),f=Sa.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,u){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;mn.is(o)||et.is(o)?l=o:u=o;let c,f;if(l===void 0?c=wa.create(i,u):(f=et.is(l)?l:this._changeAnnotations.manage(l),c=wa.create(i,u,f)),this._workspaceEdit.documentChanges.push(c),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(u){return{uri:u}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)}s(o,"is"),a.is=o})(Np||(Np={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.integer(l.version)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(u,l){return{uri:u,version:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&(l.version===null||C.integer(l.version))}s(o,"is"),a.is=o})(Hl||(Hl={})),(function(a){function i(u,l,c,f){return{uri:u,languageId:l,version:c,text:f}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.string(l.uri)&&C.string(l.languageId)&&C.integer(l.version)&&C.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const u=o;return u===a.PlainText||u===a.Markdown}s(i,"is"),a.is=i})(_c||(_c={})),(function(a){function i(o){const u=o;return C.objectLiteral(o)&&_c.is(u.kind)&&C.string(u.value)}s(i,"is"),a.is=i})(Ia||(Ia={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(Op||(Op={})),(function(a){a.PlainText=1,a.Snippet=2})(Lp||(Lp={})),(function(a){a.Deprecated=1})(Dp||(Dp={})),(function(a){function i(u,l,c){return{newText:u,insert:l,replace:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l&&C.string(l.newText)&&te.is(l.insert)&&te.is(l.replace)}s(o,"is"),a.is=o})(Mp||(Mp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(xp||(xp={})),(function(a){function i(o){const u=o;return u&&(C.string(u.detail)||u.detail===void 0)&&(C.string(u.description)||u.description===void 0)}s(i,"is"),a.is=i})(Gp||(Gp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){function i(o,u){return{items:o||[],isIncomplete:!!u}}s(i,"create"),a.create=i})(zp||(zp={})),(function(a){function i(u){return u.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(u){const l=u;return C.string(l)||C.objectLiteral(l)&&C.string(l.language)&&C.string(l.value)}s(o,"is"),a.is=o})(Yl||(Yl={})),(function(a){function i(o){let u=o;return!!u&&C.objectLiteral(u)&&(Ia.is(u.contents)||Yl.is(u.contents)||C.typedArray(u.contents,Yl.is))&&(o.range===void 0||te.is(o.range))}s(i,"is"),a.is=i})(jp||(jp={})),(function(a){function i(o,u){return u?{label:o,documentation:u}:{label:o}}s(i,"create"),a.create=i})(Bp||(Bp={})),(function(a){function i(o,u,...l){let c={label:o};return C.defined(u)&&(c.documentation=u),C.defined(l)?c.parameters=l:c.parameters=[],c}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(Kp||(Kp={})),(function(a){function i(o,u){let l={range:o};return C.number(u)&&(l.kind=u),l}s(i,"create"),a.create=i})(Wp||(Wp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(Vp||(Vp={})),(function(a){a.Deprecated=1})(qp||(qp={})),(function(a){function i(o,u,l,c,f){let d={name:o,kind:u,location:{uri:c,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(Hp||(Hp={})),(function(a){function i(o,u,l,c){return c!==void 0?{name:o,kind:u,location:{uri:l,range:c}}:{name:o,kind:u,location:{uri:l}}}s(i,"create"),a.create=i})(Yp||(Yp={})),(function(a){function i(u,l,c,f,d,p){let h={name:u,detail:l,kind:c,range:f,selectionRange:d};return p!==void 0&&(h.children=p),h}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.name)&&C.number(l.kind)&&te.is(l.range)&&te.is(l.selectionRange)&&(l.detail===void 0||C.string(l.detail))&&(l.deprecated===void 0||C.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Xp||(Xp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})(Jp||(Jp={})),(function(a){a.Invoked=1,a.Automatic=2})(Xl||(Xl={})),(function(a){function i(u,l,c){let f={diagnostics:u};return l!=null&&(f.only=l),c!=null&&(f.triggerKind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.typedArray(l.diagnostics,Vl.is)&&(l.only===void 0||C.typedArray(l.only,C.string))&&(l.triggerKind===void 0||l.triggerKind===Xl.Invoked||l.triggerKind===Xl.Automatic)}s(o,"is"),a.is=o})(Zp||(Zp={})),(function(a){function i(u,l,c){let f={title:u},d=!0;return typeof l=="string"?(d=!1,f.kind=l):pn.is(l)?f.command=l:f.edit=l,d&&c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){let l=u;return l&&C.string(l.title)&&(l.diagnostics===void 0||C.typedArray(l.diagnostics,Vl.is))&&(l.kind===void 0||C.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||pn.is(l.command))&&(l.isPreferred===void 0||C.boolean(l.isPreferred))&&(l.edit===void 0||bc.is(l.edit))}s(o,"is"),a.is=o})(Qp||(Qp={})),(function(a){function i(u,l){let c={range:u};return C.defined(l)&&(c.data=l),c}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.command)||pn.is(l.command))}s(o,"is"),a.is=o})(em||(em={})),(function(a){function i(u,l){return{tabSize:u,insertSpaces:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&C.uinteger(l.tabSize)&&C.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(tm||(tm={})),(function(a){function i(u,l,c){return{range:u,target:l,data:c}}s(i,"create"),a.create=i;function o(u){let l=u;return C.defined(l)&&te.is(l.range)&&(C.undefined(l.target)||C.string(l.target))}s(o,"is"),a.is=o})(rm||(rm={})),(function(a){function i(u,l){return{range:u,parent:l}}s(i,"create"),a.create=i;function o(u){let l=u;return C.objectLiteral(l)&&te.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(nm||(nm={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(am||(am={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(im||(im={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&(u.resultId===void 0||typeof u.resultId=="string")&&Array.isArray(u.data)&&(u.data.length===0||typeof u.data[0]=="number")}s(i,"is"),a.is=i})(sm||(sm={})),(function(a){function i(u,l){return{range:u,text:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.string(l.text)}s(o,"is"),a.is=o})(om||(om={})),(function(a){function i(u,l,c){return{range:u,variableName:l,caseSensitiveLookup:c}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&C.boolean(l.caseSensitiveLookup)&&(C.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(lm||(lm={})),(function(a){function i(u,l){return{range:u,expression:l}}s(i,"create"),a.create=i;function o(u){const l=u;return l!=null&&te.is(l.range)&&(C.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(um||(um={})),(function(a){function i(u,l){return{frameId:u,stoppedLocation:l}}s(i,"create"),a.create=i;function o(u){const l=u;return C.defined(l)&&te.is(u.stoppedLocation)}s(o,"is"),a.is=o})(cm||(cm={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(Sc||(Sc={})),(function(a){function i(u){return{value:u}}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.location===void 0||Wl.is(l.location))&&(l.command===void 0||pn.is(l.command))}s(o,"is"),a.is=o})(wc||(wc={})),(function(a){function i(u,l,c){const f={position:u,label:l};return c!==void 0&&(f.kind=c),f}s(i,"create"),a.create=i;function o(u){const l=u;return C.objectLiteral(l)&&oe.is(l.position)&&(C.string(l.label)||C.typedArray(l.label,wc.is))&&(l.kind===void 0||Sc.is(l.kind))&&l.textEdits===void 0||C.typedArray(l.textEdits,ar.is)&&(l.tooltip===void 0||C.string(l.tooltip)||Ia.is(l.tooltip))&&(l.paddingLeft===void 0||C.boolean(l.paddingLeft))&&(l.paddingRight===void 0||C.boolean(l.paddingRight))}s(o,"is"),a.is=o})(fm||(fm={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(dm||(dm={})),(function(a){function i(o,u,l,c){return{insertText:o,filterText:u,range:l,command:c}}s(i,"create"),a.create=i})(pm||(pm={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(mm||(mm={})),(function(a){a.Invoked=0,a.Automatic=1})(hm||(hm={})),(function(a){function i(o,u){return{range:o,text:u}}s(i,"create"),a.create=i})(ym||(ym={})),(function(a){function i(o,u){return{triggerKind:o,selectedCompletionInfo:u}}s(i,"create"),a.create=i})(gm||(gm={})),(function(a){function i(o){const u=o;return C.objectLiteral(u)&&Ac.is(u.uri)&&C.string(u.name)}s(i,"is"),a.is=i})(vm||(vm={})),x$=[` `,`\r `,"\r"],(function(a){function i(c,f,d,p){return new iv(c,f,d,p)}s(i,"create"),a.create=i;function o(c){let f=c;return!!(C.defined(f)&&C.string(f.uri)&&(C.undefined(f.languageId)||C.string(f.languageId))&&C.uinteger(f.lineCount)&&C.func(f.getText)&&C.func(f.positionAt)&&C.func(f.offsetAt))}s(o,"is"),a.is=o;function u(c,f){let d=c.getText(),p=l(f,(y,v)=>{let E=y.range.start.line-v.range.start.line;return E===0?y.range.start.character-v.range.start.character:E}),h=d.length;for(let y=p.length-1;y>=0;y--){let v=p[y],E=c.offsetAt(v.range.start),T=c.offsetAt(v.range.end);if(T<=h)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");h=E}return d}s(u,"applyEdits"),a.applyEdits=u;function l(c,f){if(c.length<=1)return c;const d=c.length/2|0,p=c.slice(0,d),h=c.slice(d);l(p,f),l(h,f);let y=0,v=0,E=0;for(;y({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` +import{p as ht}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{s as gt,g as $t,n as bt,m as Ct,a as wt,b as vt,_ as i,l as O,C as Dt,d as kt,o as At,z as U,x as Q,A as Tt,E as ot}from"./mermaid.core-fnA2DmhE.js";import{p as Bt}from"./cynefin-OW5HDTMX-DPLixWx6.js";import"./index-C2dSXwG1.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var rt=i(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=i(()=>H.domains,"getDomains"),Mt=i(()=>H.transitions,"getTransitions"),zt=i(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=i(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=i(()=>U({...Tt.cynefin,...Q().cynefin}),"getConfig"),Pt=i(()=>{At(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=i(t=>{ht(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:i(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function V(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}i(V,"seededRandom");function it(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Et=i((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();O.debug("Rendering Cynefin diagram");const s=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,_=s+b*2,E=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,E,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${E}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(s,f),Z=st(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(s,f,Z,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(s,f,Z+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(s,f)).attr("fill","none");const pt=s*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(s/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",s/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",s/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...L].forEach((g,S)=>{const C=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",T/2)}),N>0){const g=B+L.length*(T+4),S=`+${N} more`,C=K.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&A.append("text").attr("class","cynefinTitle").attr("x",s/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Ft={draw:Et},Vt=i(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=i(()=>{const t=Vt();return` .cynefinDomain { stroke: none; } diff --git a/static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js b/static/ml_canvas/assets/dagre-GXQ25YYZ-DetEQ7-C.js similarity index 98% rename from static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js rename to static/ml_canvas/assets/dagre-GXQ25YYZ-DetEQ7-C.js index de5f37e99..c135885cf 100644 --- a/static/ml_canvas/assets/dagre-GXQ25YYZ-V9wTvoj4.js +++ b/static/ml_canvas/assets/dagre-GXQ25YYZ-DetEQ7-C.js @@ -1,4 +1,4 @@ -import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-CiBTFoht.js";import{l as U}from"./layout-DWasCRDD.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX +import{_ as m,a8 as D,c as A,Q as Y,l as p,a9 as _,aa as H,ab as w,ac as J,ad as T,ae as z,af as R,ag as F,ah as j,ai as C,a3 as P,a1 as W,aj as q,ak as Q}from"./mermaid.core-fnA2DmhE.js";import{l as U}from"./layout-CQGetc0q.js";import"./index-C2dSXwG1.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var v=m((t,e,d)=>Math.max(e,Math.min(d,t)),"clamp"),B=m((t="TB")=>{switch(t){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),K=m(t=>t==="flowchart"||t==="flowchart-v2"||t==="stateDiagram"||t==="er"||t==="classDiagram","shouldMergeSelfLoopSegments"),V=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],Z=m((t,e,d,g,s)=>{const h=[],L=new Set;if(d.forEach(({start:l,end:r})=>{l!==g&&L.add(l),r!==g&&L.add(r)}),L.forEach(l=>{const r=t.node(l);typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)}),h.length===0&&d.forEach(({edge:l})=>{(l.points??[]).forEach(r=>{typeof(r==null?void 0:r.x)=="number"&&typeof(r==null?void 0:r.y)=="number"&&h.push(r)})}),h.length===0)return B(s);const c=h.reduce((l,r)=>({x:l.x+r.x/h.length,y:l.y+r.y/h.length}),{x:0,y:0}),i=c.x-e.x,o=c.y-e.y;return Math.abs(i)>Math.abs(o)?i>0?"right":"left":Math.abs(o)>0?o>0?"bottom":"top":B(s)},"getSelfLoopSide"),$=m((t,e="top",d=0,g=0)=>{const s=t.x,h=t.y-d,L=t.width/2,c=t.height/2,i=Math.max(36,Math.min(100,t.width*.8)),o=v(Math.max(g,t.width*.35),36,i),l=v(Math.min(t.width,t.height)*.45,24,48);switch(e){case"bottom":{const r=h+c;return[{x:s-o/2,y:r},{x:s-o/2,y:r+l},{x:s+o/2,y:r+l},{x:s+o/2,y:r}]}case"right":{const r=s+L;return[{x:r,y:h-o/2},{x:r+l,y:h-o/2},{x:r+l,y:h+o/2},{x:r,y:h+o/2}]}case"left":{const r=s-L;return[{x:r,y:h-o/2},{x:r-l,y:h-o/2},{x:r-l,y:h+o/2},{x:r,y:h+o/2}]}case"top":default:{const r=h-c;return[{x:s-o/2,y:r},{x:s-o/2,y:r-l},{x:s+o/2,y:r-l},{x:s+o/2,y:r}]}}},"getSelfLoopPoints"),ee=m((t,e,d="top",g=0,s={})=>{const L=t.x,c=t.y-g,i=s.width??0,o=s.height??0;switch(d){case"bottom":return{x:L,y:Math.max(...e.map(l=>l.y))+o/2+4};case"right":return{x:Math.max(...e.map(l=>l.x))+i/2+4,y:c};case"left":return{x:Math.min(...e.map(l=>l.x))-i/2-4,y:c};case"top":default:return{x:L,y:Math.min(...e.map(l=>l.y))-o/2-4}}},"getSelfLoopLabelPosition"),M=m((t,e=0,{mergeSelfLoops:d=!0}={})=>{var L;const g=new Map,s=[],h=(L=t.graph())==null?void 0:L.rankdir;return t.edges().forEach(c=>{const i=t.edge(c);if(d&&i.selfLoop){const o=i.selfLoop.id;g.has(o)||g.set(o,[]),g.get(o).push({edge:i,start:c.v,end:c.w})}else s.push({edge:i,start:c.v,end:c.w})}),g.forEach(c=>{if(c.length!==3){c.forEach(b=>s.push(b));return}c.sort((b,x)=>b.edge.selfLoop.order-x.edge.selfLoop.order);const[i,o,l]=c,r=i.edge.originalEdge??o.edge.originalEdge??l.edge.originalEdge??o.edge,a=t.node(r.start);if(!a){c.forEach(b=>s.push(b));return}const E={width:o.edge.width,height:o.edge.height},y=Z(t,a,c,r.start,h),f=$(a,y,e,E.width??0),n=ee(a,f,y,e,E),u={...o.edge,...r,id:r.id,points:f,start:r.start,end:r.end,x:n.x,y:n.y,width:E.width,height:E.height,labelStyle:o.edge.labelStyle,fromCluster:i.edge.fromCluster??o.edge.fromCluster??l.edge.fromCluster,toCluster:i.edge.toCluster??o.edge.toCluster??l.edge.toCluster};delete u.selfLoop,delete u.originalEdge,s.push({edge:u,start:u.start,end:u.end})}),s},"getEdgesToRender"),k=m(async({element:t,graph:e,diagramType:d,id:g,parentCluster:s,siteConfig:h})=>{const L=e.graph().rankdir;p.trace("Dir in recursive render - dir:",L);const{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r}=J(t,{edgePathsClass:"edgePaths"});e.nodes()?p.info("Recursive render XXX",e.nodes()):p.info("No nodes found for",e),e.edges().length>0&&p.info("Recursive edges",e.edge(e.edges()[0]));const a=K(d);await Promise.all(e.nodes().map(async function(f){const n=e.node(f);if(s!==void 0){const u=JSON.parse(JSON.stringify(s.clusterData));p.trace(`Setting data for parent cluster XXX Node.id = `,f,` data=`,u.height,` Parent cluster`,s.height),e.setNode(s.id,u),e.parent(f)||(p.trace("Setting parent",f,s.id),e.setParent(f,s.id,u))}if(p.info("(Insert) Node XXX"+f+": "+JSON.stringify(e.node(f))),n!=null&&n.clusterNode){p.info("Cluster identified XBX",f,n.width,e.node(f));const{ranksep:u,nodesep:b}=e.graph();n.graph.setGraph({...n.graph.graph(),ranksep:u+25,nodesep:b});const x=await ne({element:l,graph:n.graph,diagramType:d,id:g,parentCluster:e.node(f),siteConfig:h}),S=x.elem;T(n,S),n.diff=x.diff||0,p.info("New compound node after recursive render XAX",f,"width",n.width,"height",n.height),z(S,n)}else e.children(f).length>0?(p.trace("Cluster - the non recursive path XBX",f,n.id,n,n.width,"Graph:",e),p.trace(R(n.id,e)),w.set(n.id,{id:R(n.id,e),node:n})):(p.trace("Node - the non recursive path XAX",f,l,e.node(f),L),await F(l,e.node(f),{config:h,dir:L}))})),await m(async()=>{const f=e.edges().map(async function(n){var b,x,S,X;const u=e.edge(n.v,n.w,n.name);if(p.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),p.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(e.edge(n))),p.info("Fix",w,"ids:",n.v,n.w,"Translating: ",w.get(n.v),w.get(n.w)),a&&u.selfLoop){if(u.selfLoop.order!==1)return;const N={...u.originalEdge,...u,id:u.selfLoop.id,startLabelLeft:((b=u.originalEdge)==null?void 0:b.startLabelLeft)??u.startLabelLeft,startLabelRight:((x=u.originalEdge)==null?void 0:x.startLabelRight)??u.startLabelRight,endLabelLeft:((S=u.originalEdge)==null?void 0:S.endLabelLeft)??u.endLabelLeft,endLabelRight:((X=u.originalEdge)==null?void 0:X.endLabelRight)??u.endLabelRight};await C(o,N),u.width=N.width,u.height=N.height,u.labelStyle=N.labelStyle;return}await C(o,u)});await Promise.all(f)},"processEdges")();const{subGraphTitleTotalMargin:y}=j(h);return{elem:r,graph:e,groups:{clusters:c,edgePaths:i,edgeLabels:o,nodes:l,rootGroups:r},diagramType:d,id:g,mergeSelfLoops:a,subGraphTitleTotalMargin:y}},"measureDagreGraph"),G=m(t=>{p.info("############################################# XXX"),p.info("### Layout ### XXX"),p.info("############################################# XXX"),U(t)},"runDagreGraphLayout"),te=m((t,e,d)=>{const g=t.node(e);if(!g)return;const s={...g};return g!=null&&g.clusterNode?s.y=(g.y??0)+d:t.children(e).length>0?s.height=(g.height??0)+d:s.y=(g.y??0)+d/2,s},"normalizeDagreNode"),I=m((t,e)=>{V.forEach(d=>{e[d]!==void 0&&(t[d]=e[d])})},"applyDagreNodeLayout"),re=m((t,e,d,g)=>({...t,start:t.start??e,end:t.end??d,points:(t.points??[]).map(s=>({...s,y:typeof s.y=="number"?s.y+g:s.y}))}),"normalizeDagreEdge"),ae=m((t,e)=>{const{graph:d,mergeSelfLoops:g,subGraphTitleTotalMargin:s=0}=e,h=new Map(t.nodes.map(c=>[c.id,c]));D(d).forEach(c=>{const i=te(d,c,s);if(!i)return;I(d.node(c),i);const o=h.get(c);o&&I(o,i)});const L=s/2;return t.edges=M(d,L,{mergeSelfLoops:g}).map(({edge:c,start:i,end:o})=>re(c,i,o,L)),t},"applyDagreLayoutResult"),oe=m(async({elem:t,graph:e,groups:{clusters:d,edgePaths:g},diagramType:s,id:h,mergeSelfLoops:L,subGraphTitleTotalMargin:c})=>{let i=0;await Promise.all(D(e).map(async function(r){var E;const a=e.node(r);if(p.info("Position XBX => "+r+": ("+a.x,","+a.y,") width: ",a.width," height: ",a.height),a!=null&&a.clusterNode)a.y+=c,p.info("A tainted cluster node XBX1",r,a.id,a.width,a.height,a.x,a.y,e.parent(r)),w.get(a.id).node=a,P(a);else if(e.children(r).length>0){p.info("A pure cluster node XBX1",r,a.id,a.x,a.y,a.width,a.height,e.parent(r)),a.height+=c,e.node(a.parentId);const y=(a==null?void 0:a.padding)/2||0,f=((E=a==null?void 0:a.labelBBox)==null?void 0:E.height)||0,n=f-y||0;p.debug("OffsetY",n,"labelHeight",f,"halfPadding",y),await W(d,a),w.get(a.id).node=a}else{const y=e.node(a.parentId);a.y+=c/2,p.info("A regular node XBX1 - using the padding",a.id,"parent",a.parentId,a.width,a.height,a.x,a.y,"offsetY",a.offsetY,"parent",y,y==null?void 0:y.offsetY,a),P(a)}}));const o=c/2;return M(e,o,{mergeSelfLoops:L}).forEach(function({edge:r,start:a,end:E}){p.info("Edge "+a+" -> "+E+": "+JSON.stringify(r),r),r.points.forEach(u=>u.y+=o);const y=e.node(a),f=e.node(E),n=q(g,r,w,s,y,f,h);Q(r,n)}),e.nodes().forEach(function(r){const a=e.node(r);p.info(r,a.type,a.diff),a.isGroup&&(i=a.diff)}),p.warn("Returning from recursive render XAX",t,i),{elem:t,diff:i}},"paintDagreLayoutCore"),ne=m(async t=>{const e=await k(t);return G(e.graph),await oe(e)},"renderDagreSubgraph"),O=m(t=>{var d,g,s,h,L,c;const e=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:((d=t.config)==null?void 0:d.nodeSpacing)||t.nodeSpacing||((s=(g=t.config)==null?void 0:g.flowchart)==null?void 0:s.nodeSpacing),ranksep:((h=t.config)==null?void 0:h.rankSpacing)||t.rankSpacing||((c=(L=t.config)==null?void 0:L.flowchart)==null?void 0:c.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return t.nodes.forEach(i=>{e.setNode(i.id,{...i}),i.parentId&&e.setParent(i.id,i.parentId)}),p.debug("Edges:",t.edges),t.edges.forEach(i=>{if(i.start===i.end){const o=i.start,l=o+"---"+o+"---1",r=o+"---"+o+"---2",a=e.node(o);e.setNode(l,{domId:l,id:l,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(l,a.parentId),e.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(r,a.parentId);const E=structuredClone(i),y=structuredClone(i),f=structuredClone(i),n=structuredClone(i);y.originalEdge=E,y.selfLoop={id:E.id,order:0},f.originalEdge=E,f.selfLoop={id:E.id,order:1},n.originalEdge=E,n.selfLoop={id:E.id,order:2},y.label="",y.arrowTypeEnd="none",y.endLabelLeft="",y.endLabelRight="",y.startLabelLeft="",y.id=o+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=o+"-cyclic-special-mid",n.label="",n.startLabelRight="",n.startLabelLeft="",n.arrowTypeStart="none",a.isGroup&&(y.fromCluster=o,n.toCluster=o),n.id=o+"-cyclic-special-2",n.arrowTypeStart="none",e.setEdge(o,l,y,o+"-cyclic-special-0"),e.setEdge(l,r,f,o+"-cyclic-special-1"),e.setEdge(r,o,n,o+"-cyclic-special-2")}else e.setEdge(i.start,i.end,{...i},i.id)}),_(e),{graph:e}},"prepareLayoutForDagre"),se=m(async(t,{element:e,preparedLayout:d})=>{const g=d??O(t),s=A(),h=await k({element:e,graph:g.graph,diagramType:t.type,id:t.diagramId,parentCluster:void 0,siteConfig:s});return g.measuredLayout=h,h},"measureDagreLayout"),ie=m((t,e)=>{var g;const d=(g=e.preparedLayout)==null?void 0:g.measuredLayout;if(!d)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return G(d.graph),ae(t,d),d},"runDagreLayoutCore"),de=m((t,{measure:e})=>D(e.graph).map(d=>e.graph.node(d)).filter(Boolean),"getDagrePaintNodes"),le=m((t,e,{measure:d})=>t?d.graph.node(t):void 0,"getDagreEdgeNode"),ye=H({prepareLayout:O,measureLayout:se,runLayoutCore:ie,paintOptions:{clusterDb:w,getNodes:de,getEdgeNode:le,skipNode:m((t,{measure:e})=>!e.graph.hasNode(t.id),"skipNode"),isCluster:m((t,{measure:e})=>e.graph.hasNode(t.id)&&(e.graph.children(t.id)??[]).length>0,"isCluster")}});export{ae as applyDagreLayoutResult,M as getEdgesToRender,se as measureDagreLayout,O as prepareLayoutForDagre,ye as render,ie as runDagreLayoutCore}; diff --git a/static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js b/static/ml_canvas/assets/diagram-S7CK7UJ4-DbR9Egy-.js similarity index 96% rename from static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js rename to static/ml_canvas/assets/diagram-S7CK7UJ4-DbR9Egy-.js index 2758351af..b7fdc7c64 100644 --- a/static/ml_canvas/assets/diagram-S7CK7UJ4-D84RmsSo.js +++ b/static/ml_canvas/assets/diagram-S7CK7UJ4-DbR9Egy-.js @@ -1,4 +1,4 @@ -import{I as W}from"./chunk-2Q5K7J3B-CmWhNyCT.js";import{p as X}from"./chunk-JWPE2WC7-CSEprKif.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-CiBTFoht.js";import{p as te}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` +import{I as W}from"./chunk-2Q5K7J3B-BB3ve9kE.js";import{p as X}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{m as O,b as G,s as Y,n as P,g as F,a as Z,_ as g,z as A,l as E,C as q,d as U,x as L,o as j,i as J,a4 as K,A as Q,a5 as ee}from"./mermaid.core-fnA2DmhE.js";import{p as te}from"./cynefin-OW5HDTMX-DPLixWx6.js";import"./index-C2dSXwG1.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D=/[β”€β”β”‚β”ƒβ””β”—β”œβ”£]/,_=/[β””β”—β”œβ”£]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function S(r){return r.some(t=>D.test(t))}g(S,"isBoxDrawingFormat");function M(r){for(const t of r){const e=_.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(` `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,L().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{X(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,L()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function z(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(z,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function T(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=z(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g(T,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=T(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),me=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=T(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),w=p+s.paddingY*2,m=r+s.paddingX+(u?d:0);a.attr("x",m),a.attr("y",t+w/2);const f=m+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:w},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",w-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+w/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),we=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,w)=>{const m=w*(h.rowIndent+h.paddingX),f=me(m,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,m-h.rowIndent,s+v/2,m,s+v/2,h.lineThickness),o=Math.max(o,m+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:w,height:m}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,w+m,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const m=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+m.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=q(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=we(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),U(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return` diff --git a/static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js b/static/ml_canvas/assets/diagram-UQ7AKVKN-B7fAR4a4.js similarity index 95% rename from static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js rename to static/ml_canvas/assets/diagram-UQ7AKVKN-B7fAR4a4.js index 658027611..a7341a56c 100644 --- a/static/ml_canvas/assets/diagram-UQ7AKVKN-VN-erfx2.js +++ b/static/ml_canvas/assets/diagram-UQ7AKVKN-B7fAR4a4.js @@ -1,4 +1,4 @@ -import{p as I}from"./chunk-JWPE2WC7-CSEprKif.js";import{s as _,g as E,n as F,m as D,a as z,b as P,_ as c,C as G,o as B,z as C,x as w,A as W,l as b,E as V,d as H}from"./mermaid.core-CiBTFoht.js";import{p as j}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>C({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rC({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:P,getAccTitle:z,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),u=G(t),p=rt(u,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(p,n,v,o.ticks,o.graticule),nt(p,n,v,i),L(p,n,l,h,g,o.graticule,i),k(p,l,o.showLegend,i),p.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n{const p=2*u*Math.PI/n-Math.PI/2,g=o*Math.cos(p),h=o*Math.sin(p);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n.01?"start":i<-.01?"end":"middle",p=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",u).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,u)=>{if(d.entries.length!==o)return;const p=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(p,l.curveTension)).attr("class",`radarCurve-${u}`):n==="polygon"&&a.append("polygon").attr("points",p.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${u}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;rge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as oe}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{n as se,m as de,s as le,g as ce,a as me,b as ue,_ as o,l as g,c as T,y as xe,o as fe,z as ge,x as E,A as he,i as P,w as S,a6 as pe}from"./mermaid.core-fnA2DmhE.js";import{p as be,i as ve}from"./cynefin-OW5HDTMX-DPLixWx6.js";import{s as we}from"./vendor-flow-Ct2sLZk5.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),fe()},"clear");function O(){A={}}o(O,"reset");var ke=he.eventmodeling,Me=o(()=>ge({...ke,...E().eventmodeling}),"getConfig"),A={};function W(){let e=Be;const{ast:n}=A,t=R();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){A.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function R(){return s}o(R,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function _(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(_,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(v,"findNextAvailableIndex");function V(e,n){const t=H(e.entityIdentifier),i=_(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(V,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${S(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(y=>{var b;return y.name===((b=e.dataReference)==null?void 0:b.$refText)});p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function G(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(G,"decidePositionFrame");function j(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(j,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=V(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=j(a,d,r),m=c+l.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(ve(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:G,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:le,setDiagramTitle:de,getDiagramTitle:se,setAst:I,getDiagramProps:R,getState:W},Ae={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Re=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ie(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=T(),l=we(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(l,m.maxR,c,r)),m.boxes.forEach(ne(l,c)),m.relations.forEach(ae(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,(d==null?void 0:d.padding)??30,d==null?void 0:d.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,Ve={parser:Ae,db:F,renderer:Te,styles:Ne};export{Ve as diagram}; diff --git a/static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js b/static/ml_canvas/assets/diagram-VX7I27RA-BUAHOWTV.js similarity index 97% rename from static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js rename to static/ml_canvas/assets/diagram-VX7I27RA-BUAHOWTV.js index 7208d84d7..56ffa81a7 100644 --- a/static/ml_canvas/assets/diagram-VX7I27RA-B9cNG8zU.js +++ b/static/ml_canvas/assets/diagram-VX7I27RA-BUAHOWTV.js @@ -1,4 +1,4 @@ -import{p as ge}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-CiBTFoht.js";import{s as Ne}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{p as Me}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` +import{p as ge}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{_ as w,E as ye,x as ae,z as ee,C as Se,d as ve,l as te,at as B,b as xe,a as be,m as we,n as Ce,g as Te,s as Le,A as $e,au as Ae,o as Fe}from"./mermaid.core-fnA2DmhE.js";import{s as Ne}from"./chunk-POPQ4Y6H-DsvZbH4b.js";import{p as Me}from"./cynefin-OW5HDTMX-DPLixWx6.js";import{s as U}from"./vendor-flow-Ct2sLZk5.js";import{af as O,o as Q}from"./vendor-charts-BkHP8M8k.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++dN&&(N=c),M=p*p*W,$=Math.max(N/M,M/y),$>V){p-=c;break}V=$}h.push(g={value:p,dice:x1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,ue=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,J=A?2:4,se=A?8:10,K=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(TT&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+K+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(FT||m(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+K;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*J;f.node().getComputedTextLength()>me||F+m>ie||m{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js b/static/ml_canvas/assets/diagram-Z3DM3KII-DZ6YNH9v.js similarity index 95% rename from static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js rename to static/ml_canvas/assets/diagram-Z3DM3KII-DZ6YNH9v.js index e1523d01c..f50b11e01 100644 --- a/static/ml_canvas/assets/diagram-Z3DM3KII-R6sNZIXz.js +++ b/static/ml_canvas/assets/diagram-Z3DM3KII-DZ6YNH9v.js @@ -1,4 +1,4 @@ -import{p as B}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-CiBTFoht.js";import{p as N}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` +import{p as B}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{_ as b,z as u,C,d as S,l as w,b as D,a as T,m as z,n as P,g as A,s as E,x as F,A as W,o as _}from"./mermaid.core-fnA2DmhE.js";import{p as N}from"./cynefin-OW5HDTMX-DPLixWx6.js";import"./index-C2dSXwG1.js";import"./vendor-flow-Ct2sLZk5.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var L=W.packet,m,v=(m=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=z,this.getDiagramTitle=P,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=u({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(m,"PacketDB"),m),M=1e4,Y=b((e,t)=>{B(e,t);let o=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*o)return[e,void 0];const r=t*o-1,n=t*o;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),o=(r=x.parser)==null?void 0:r.yy;if(!(o instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,o)},"parse")},O=b((e,t,o,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,o,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=o*(r+l)+l;for(const s of t){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),G={draw:O},H={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=u(H,e);return` .packetByte { font-size: ${t.byteFontSize}; } diff --git a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-vkXORHvt.js similarity index 84% rename from static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js rename to static/ml_canvas/assets/ebnfDiagram-PWID7BFC-vkXORHvt.js index 35c46b5b3..d3c497192 100644 --- a/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-puQdVF5r.js +++ b/static/ml_canvas/assets/ebnfDiagram-PWID7BFC-vkXORHvt.js @@ -1 +1 @@ -import{g as m,r as l,d as n}from"./chunk-SVP7TREG-DpJhy_Kq.js";import{p}from"./chunk-JWPE2WC7-CSEprKif.js";import{_ as t,l as o}from"./mermaid.core-CiBTFoht.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-CgUfycTN.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; +import{g as m,r as l,d as n}from"./chunk-SVP7TREG-CnnhSiZz.js";import{p}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{_ as t,l as o}from"./mermaid.core-fnA2DmhE.js";import"./vendor-flow-Ct2sLZk5.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-DPLixWx6.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:g,db:n,renderer:l,styles:m};export{B as diagram}; diff --git a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-d-xdSgZH.js similarity index 98% rename from static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js rename to static/ml_canvas/assets/erDiagram-RLTQ6QDP-d-xdSgZH.js index c1432c0eb..45b121fd0 100644 --- a/static/ml_canvas/assets/erDiagram-RLTQ6QDP-l6mI01km.js +++ b/static/ml_canvas/assets/erDiagram-RLTQ6QDP-d-xdSgZH.js @@ -1,4 +1,4 @@ -import{g as Ut}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as Kt}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-CiBTFoht.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-YEV_Sjpu.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: +import{g as Ut}from"./chunk-XXDRQBXY-Cl-UVyYi.js";import{s as Kt}from"./chunk-POPQ4Y6H-DsvZbH4b.js";import{_ as f,b as Zt,a as jt,s as qt,g as Wt,m as Ht,n as Qt,c as tt,l as F,j as Xt,o as Jt,p as $t,r as te,q as ee,t as se,u as ie,v as re}from"./mermaid.core-fnA2DmhE.js";import{s as ne}from"./vendor-flow-Ct2sLZk5.js";import{c as ae}from"./channel-Ckr7jPvY.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var Ot=(function(){var s=f(function(G,a,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=a);return h},"o"),n=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],c=[2,2],o=[1,7],r=[1,9],l=[1,10],y=[1,11],b=[1,12],k=[1,30],R=[1,23],p=[1,24],g=[1,25],C=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],N=[1,20],D=[1,18],L=[1,21],w=[1,22],xt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],pt=[1,36],ft=[1,37],bt=[1,38],gt=[1,39],yt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],Nt=[69,70,71,72,73],Ct=[1,91],It=[6,9,45,50],z=[6,9,12,44,45,50,51,52],nt=[1,101],at=[1,100],ot=[1,99],J=[18,61],At=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],_t=[18,61,64,66],kt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(a,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(n,c,{5:3}),{6:[1,4],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},s(n,xt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:pt,70:ft,71:bt,72:gt,73:yt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,c,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:N,53:D,54:L,55:w},{10:51,43:x,51:N,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:N,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:o,10:8,21:r,23:l,25:y,27:b,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:R,38:p,39:g,40:C,41:v,43:x,46:T,47:I,51:N,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:pt,70:ft,71:bt,72:gt,73:yt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:pt,70:ft,71:bt,72:gt,73:yt},s(Nt,[2,82]),s(Nt,[2,83]),s(u,[2,31]),s(u,xt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(It,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:N,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:nt,53:at,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:N,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:At,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:N,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(_t,[2,72]),s(J,[2,75]),s(_t,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(It,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:nt,53:at,76:ot},{15:127,43:V,44:M},{13:128,43:nt,53:at,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:At},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(_t,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:nt,53:at,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(a,h){if(h.recoverable)this.trace(a);else{var d=new Error(a);throw d.hash=h,d}},"parseError"),parse:f(function(a){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",lt=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var mt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,mt)&&(Y.yy[mt]=this.yy[mt]);m.setInput(a,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var Et=m.yylloc;t.push(Et);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,St,U={},ht,A,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var Tt="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?Tt="Parse error on line "+(lt+1)+`: `+m.showPosition()+` Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Tt="Parse error on line "+(lt+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Tt,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:Et,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,lt=m.yylineno,Et=m.yylloc;break;case 2:if(A=this.productions_[O[1]][1],U.$=_[_.length-A],U._$={first_line:t[t.length-(A||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(A||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(A||1)].range[0],t[t.length-1].range[1]]),St=this.performAction.apply(U,[e,Dt,lt,Y.yy,O[1],_,t].concat(Yt)),typeof St<"u")return St;A&&(d=d.slice(0,-1*A*2),_=_.slice(0,-1*A),t=t.slice(0,-1*A)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(a,h){return this.yy=h||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var h=a.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var h=a.length,d=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),h=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js b/static/ml_canvas/assets/flowDiagram-HODETNUW-_LJ7FEBS.js similarity index 99% rename from static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js rename to static/ml_canvas/assets/flowDiagram-HODETNUW-_LJ7FEBS.js index f25c040c4..623482240 100644 --- a/static/ml_canvas/assets/flowDiagram-HODETNUW-iQJS2Nou.js +++ b/static/ml_canvas/assets/flowDiagram-HODETNUW-_LJ7FEBS.js @@ -1,4 +1,4 @@ -import{g as Xt}from"./chunk-5VM5RSS4-BK7j-D0z.js";import{g as Qt}from"./chunk-XXDRQBXY-B1omEyzC.js";import{s as Jt}from"./chunk-POPQ4Y6H-CVdo-unt.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-CiBTFoht.js";import{f as g1}from"./chunk-F27PBJKO-DEK_ZtH8.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-YEV_Sjpu.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` +import{g as Xt}from"./chunk-5VM5RSS4-CA43m6ys.js";import{g as Qt}from"./chunk-XXDRQBXY-Cl-UVyYi.js";import{s as Jt}from"./chunk-POPQ4Y6H-DsvZbH4b.js";import{_ as k,a0 as Zt,G as Mt,l as $,c as ke,t as $t,u as e1,v as rt,b as t1,s as s1,m as i1,a as r1,g as a1,n as n1,j as u1,I as o1,J as l1,bi as c1,p as st,O as h1,o as d1,as as p1,r as f1}from"./mermaid.core-fnA2DmhE.js";import{f as g1}from"./chunk-F27PBJKO-BOjuYHBE.js";import{s as it}from"./vendor-flow-Ct2sLZk5.js";import{c as b1}from"./channel-Ckr7jPvY.js";var A1="flowchart-",Pe,k1=(Pe=class{constructor(){this.vertexCounter=0,this.config=ke(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=t1,this.setAccDescription=s1,this.setDiagramTitle=i1,this.getAccTitle=r1,this.getAccDescription=a1,this.getDiagramTitle=n1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return u1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const r of this.vertices.values())if(r.id===i)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,r,a,n,l,g,h={},m){var F,c;if(!i||i.trim().length===0)return;let u;if(m!==void 0){let d;m.includes(` `)?d=m+` `:d=`{ `+m+` diff --git a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-CRLdpC8K.js similarity index 99% rename from static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js rename to static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-CRLdpC8K.js index 1c7361c7b..fb4cdb2d8 100644 --- a/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-Da5WtBzk.js +++ b/static/ml_canvas/assets/ganttDiagram-EL5Y4UJY-CRLdpC8K.js @@ -1,4 +1,4 @@ -import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-CiBTFoht.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-C87GWrUj.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: +import{g as Te,s as be,n as we,m as _e,a as De,b as Se,_ as l,c as dt,d as Ce,ar as U,l as ot,j as Me,H as Ee,o as Ie,v as Ye}from"./mermaid.core-fnA2DmhE.js";import{g as It}from"./vendor-utils-VkF_O5b_.js";import{s as vt}from"./vendor-flow-Ct2sLZk5.js";import{Z as $e,_ as Ae,$ as Fe,m as Le,a0 as Oe,a1 as Zt,a2 as Qt,a3 as We,a4 as Pe,a5 as Ve,a6 as Re,a7 as ze,a8 as Ne,a9 as He,aa as Kt,ab as Jt,ac as te,ad as ee,ae as re}from"./vendor-charts-BkHP8M8k.js";import"./index-C2dSXwG1.js";function Be(t){return t}var Tt=1,$t=2,Ft=3,xt=4,se=1e-6;function qe(t){return"translate("+t+",0)"}function Ge(t){return"translate(0,"+t+")"}function Xe(t){return e=>+t(e)}function je(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),s=>+t(s)+e}function Ue(){return!this.__axis}function de(t,e){var s=[],r=null,n=null,g=6,y=6,b=3,C=typeof window<"u"&&window.devicePixelRatio>1?0:.5,L=t===Tt||t===xt?-1:1,w=t===xt||t===$t?"x":"y",P=t===Tt||t===Ft?qe:Ge;function _(D){var G=r??(e.ticks?e.ticks.apply(e,s):e.domain()),N=n??(e.tickFormat?e.tickFormat.apply(e,s):Be),k=Math.max(g,0)+b,M=e.range(),W=+M[0]+C,O=+M[M.length-1]+C,H=(e.bandwidth?je:Xe)(e.copy(),C),z=D.selection?D.selection():D,I=z.selectAll(".domain").data([null]),x=z.selectAll(".tick").data(G,e).order(),h=x.exit(),E=x.enter().append("g").attr("class","tick"),f=x.select("line"),T=x.select("text");I=I.merge(I.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(E),f=f.merge(E.append("line").attr("stroke","currentColor").attr(w+"2",L*g)),T=T.merge(E.append("text").attr("fill","currentColor").attr(w,L*k).attr("dy",t===Tt?"0em":t===Ft?"0.71em":"0.32em")),D!==z&&(I=I.transition(D),x=x.transition(D),f=f.transition(D),T=T.transition(D),h=h.transition(D).attr("opacity",se).attr("transform",function(v){return isFinite(v=H(v))?P(v+C):this.getAttribute("transform")}),E.attr("opacity",se).attr("transform",function(v){var p=this.parentNode.__axis;return P((p&&isFinite(p=p(v))?p:H(v))+C)})),h.remove(),I.attr("d",t===xt||t===$t?y?"M"+L*y+","+W+"H"+C+"V"+O+"H"+L*y:"M"+C+","+W+"V"+O:y?"M"+W+","+L*y+"V"+C+"H"+O+"V"+L*y:"M"+W+","+C+"H"+O),x.attr("opacity",1).attr("transform",function(v){return P(H(v)+C)}),f.attr(w+"2",L*g),T.attr(w,L*k).text(N),z.filter(Ue).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$t?"start":t===xt?"end":"middle"),z.each(function(){this.__axis=H})}return _.scale=function(D){return arguments.length?(e=D,_):e},_.ticks=function(){return s=Array.from(arguments),_},_.tickArguments=function(D){return arguments.length?(s=D==null?[]:Array.from(D),_):s.slice()},_.tickValues=function(D){return arguments.length?(r=D==null?null:Array.from(D),_):r&&r.slice()},_.tickFormat=function(D){return arguments.length?(n=D,_):n},_.tickSize=function(D){return arguments.length?(g=y=+D,_):g},_.tickSizeInner=function(D){return arguments.length?(g=+D,_):g},_.tickSizeOuter=function(D){return arguments.length?(y=+D,_):y},_.tickPadding=function(D){return arguments.length?(b=+D,_):b},_.offset=function(D){return arguments.length?(C=+D,_):C},_}function Ze(t){return de(Tt,t)}function Qe(t){return de(Ft,t)}var bt={exports:{}},Ke=bt.exports,ie;function Je(){return ie||(ie=1,(function(t,e){(function(s,r){t.exports=r()})(Ke,(function(){var s="day";return function(r,n,g){var y=function(L){return L.add(4-L.isoWeekday(),s)},b=n.prototype;b.isoWeekYear=function(){return y(this).year()},b.isoWeek=function(L){if(!this.$utils().u(L))return this.add(7*(L-this.isoWeek()),s);var w,P,_,D,G=y(this),N=(w=this.isoWeekYear(),P=this.$u,_=(P?g.utc:g)().year(w).startOf("year"),D=4-_.isoWeekday(),_.isoWeekday()>4&&(D+=7),_.add(D,s));return G.diff(N,"week")+1},b.isoWeekday=function(L){return this.$utils().u(L)?this.day()||7:this.day(this.day()%7?L:L-7)};var C=b.startOf;b.startOf=function(L,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(L)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):C.bind(this)(L,w)}}}))})(bt)),bt.exports}var tr=Je();const er=It(tr);var wt={exports:{}},rr=wt.exports,ne;function sr(){return ne||(ne=1,(function(t,e){(function(s,r){t.exports=r()})(rr,(function(){var s={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,g=/\d\d/,y=/\d\d?/,b=/\d*[^-_:/,()\s\d]+/,C={},L=function(k){return(k=+k)+(k>68?1900:2e3)},w=function(k){return function(M){this[k]=+M}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(k){(this.zone||(this.zone={})).offset=(function(M){if(!M||M==="Z")return 0;var W=M.match(/([+-]|\d\d)/g),O=60*W[1]+(+W[2]||0);return O===0?0:W[0]==="+"?-O:O})(k)}],_=function(k){var M=C[k];return M&&(M.indexOf?M:M.s.concat(M.f))},D=function(k,M){var W,O=C.meridiem;if(O){for(var H=1;H<=24;H+=1)if(k.indexOf(O(H,0,M))>-1){W=H>12;break}}else W=k===(M?"pm":"PM");return W},G={A:[b,function(k){this.afternoon=D(k,!1)}],a:[b,function(k){this.afternoon=D(k,!0)}],Q:[n,function(k){this.month=3*(k-1)+1}],S:[n,function(k){this.milliseconds=100*+k}],SS:[g,function(k){this.milliseconds=10*+k}],SSS:[/\d{3}/,function(k){this.milliseconds=+k}],s:[y,w("seconds")],ss:[y,w("seconds")],m:[y,w("minutes")],mm:[y,w("minutes")],H:[y,w("hours")],h:[y,w("hours")],HH:[y,w("hours")],hh:[y,w("hours")],D:[y,w("day")],DD:[g,w("day")],Do:[b,function(k){var M=C.ordinal,W=k.match(/\d+/);if(this.day=W[0],M)for(var O=1;O<=31;O+=1)M(O).replace(/\[|\]/g,"")===k&&(this.day=O)}],w:[y,w("week")],ww:[g,w("week")],M:[y,w("month")],MM:[g,w("month")],MMM:[b,function(k){var M=_("months"),W=(_("monthsShort")||M.map((function(O){return O.slice(0,3)}))).indexOf(k)+1;if(W<1)throw new Error;this.month=W%12||W}],MMMM:[b,function(k){var M=_("months").indexOf(k)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,w("year")],YY:[g,function(k){this.year=L(k)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function N(k){var M,W;M=k,W=C&&C.formats;for(var O=(k=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,T,v){var p=v&&v.toUpperCase();return T||W[v]||s[v]||W[p].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(a,d,m){return d||m.slice(1)}))}))).match(r),H=O.length,z=0;z-1)return new Date((S==="X"?1e3:1)*u);var o=N(S)(u),q=o.year,c=o.month,$=o.day,A=o.hours,R=o.minutes,F=o.seconds,B=o.milliseconds,V=o.zone,st=o.week,nt=new Date,yt=$||(q||c?1:nt.getDate()),lt=q||nt.getFullYear(),X=0;q&&!c||(X=c>0?c-1:nt.getMonth());var K,Z=A||0,at=R||0,J=F||0,it=B||0;return V?new Date(Date.UTC(lt,X,yt,Z,at,J,it+60*V.offset*1e3)):i?new Date(Date.UTC(lt,X,yt,Z,at,J,it)):(K=new Date(lt,X,yt,Z,at,J,it),st&&(K=Y(K).week(st).toDate()),K)}catch{return new Date("")}})(I,E,x,W),this.init(),p&&p!==!0&&(this.$L=this.locale(p).$L),v&&I!=this.format(E)&&(this.$d=new Date("")),C={}}else if(E instanceof Array)for(var a=E.length,d=1;d<=a;d+=1){h[1]=E[d-1];var m=W.apply(this,h);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}d===a&&(this.$d=new Date(""))}else H.call(this,z)}}}))})(wt)),wt.exports}var ir=sr();const nr=It(ir);var _t={exports:{}},ar=_t.exports,ae;function or(){return ae||(ae=1,(function(t,e){(function(s,r){t.exports=r()})(ar,(function(){return function(s,r){var n=r.prototype,g=n.format;n.format=function(y){var b=this,C=this.$locale();if(!this.isValid())return g.bind(this)(y);var L=this.$utils(),w=(y||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((b.$M+1)/3);case"Do":return C.ordinal(b.$D);case"gggg":return b.weekYear();case"GGGG":return b.isoWeekYear();case"wo":return C.ordinal(b.week(),"W");case"w":case"ww":return L.s(b.week(),P==="w"?1:2,"0");case"W":case"WW":return L.s(b.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return L.s(String(b.$H===0?24:b.$H),P==="k"?1:2,"0");case"X":return Math.floor(b.$d.getTime()/1e3);case"x":return b.$d.getTime();case"z":return"["+b.offsetName()+"]";case"zzz":return"["+b.offsetName("long")+"]";default:return P}}));return g.bind(this)(w)}}}))})(_t)),_t.exports}var cr=or();const lr=It(cr);var Dt={exports:{}},ur=Dt.exports,oe;function dr(){return oe||(oe=1,(function(t,e){(function(s,r){t.exports=r()})(ur,(function(){var s,r,n=1e3,g=6e4,y=36e5,b=864e5,C=31536e6,L=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:C,months:L,days:b,hours:y,minutes:g,seconds:n,milliseconds:1,weeks:6048e5},D=function(I){return I instanceof H},G=function(I,x,h){return new H(I,h,x.$l)},N=function(I){return r.p(I)+"s"},k=function(I){return I<0},M=function(I){return k(I)?Math.ceil(I):Math.floor(I)},W=function(I){return Math.abs(I)},O=function(I,x){return I?k(I)?{negative:!0,format:""+W(I)+x}:{negative:!1,format:""+I+x}:{negative:!1,format:""}},H=(function(){function I(h,E,f){var T=this;if(this.$d={},this.$l=f,h===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return G(h*_[N(E)],this);if(typeof h=="number")return this.$ms=h,this.parseFromMilliseconds(),this;if(typeof h=="object")return Object.keys(h).forEach((function(a){T.$d[N(a)]=h[a]})),this.calMilliseconds(),this;if(typeof h=="string"){var v=h.match(w);if(v){var p=v.slice(2).map((function(a){return a!=null?Number(a):0}));return this.$d.years=p[0],this.$d.months=p[1],this.$d.weeks=p[2],this.$d.days=p[3],this.$d.hours=p[4],this.$d.minutes=p[5],this.$d.seconds=p[6],this.calMilliseconds(),this}}return this}var x=I.prototype;return x.calMilliseconds=function(){var h=this;this.$ms=Object.keys(this.$d).reduce((function(E,f){return E+(h.$d[f]||0)*_[f]}),0)},x.parseFromMilliseconds=function(){var h=this.$ms;this.$d.years=M(h/C),h%=C,this.$d.months=M(h/L),h%=L,this.$d.days=M(h/b),h%=b,this.$d.hours=M(h/y),h%=y,this.$d.minutes=M(h/g),h%=g,this.$d.seconds=M(h/n),h%=n,this.$d.milliseconds=h},x.toISOString=function(){var h=O(this.$d.years,"Y"),E=O(this.$d.months,"M"),f=+this.$d.days||0;this.$d.weeks&&(f+=7*this.$d.weeks);var T=O(f,"D"),v=O(this.$d.hours,"H"),p=O(this.$d.minutes,"M"),a=this.$d.seconds||0;this.$d.milliseconds&&(a+=this.$d.milliseconds/1e3,a=Math.round(1e3*a)/1e3);var d=O(a,"S"),m=h.negative||E.negative||T.negative||v.negative||p.negative||d.negative,u=v.format||p.format||d.format?"T":"",S=(m?"-":"")+"P"+h.format+E.format+T.format+u+v.format+p.format+d.format;return S==="P"||S==="-P"?"P0D":S},x.toJSON=function(){return this.toISOString()},x.format=function(h){var E=h||"YYYY-MM-DDTHH:mm:ss",f={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return E.replace(P,(function(T,v){return v||String(f[T])}))},x.as=function(h){return this.$ms/_[N(h)]},x.get=function(h){var E=this.$ms,f=N(h);return f==="milliseconds"?E%=1e3:E=f==="weeks"?M(E/_[f]):this.$d[f],E||0},x.add=function(h,E,f){var T;return T=E?h*_[N(E)]:D(h)?h.$ms:G(h,this).$ms,G(this.$ms+T*(f?-1:1),this)},x.subtract=function(h,E){return this.add(h,E,!0)},x.locale=function(h){var E=this.clone();return E.$l=h,E},x.clone=function(){return G(this.$ms,this)},x.humanize=function(h){return s().add(this.$ms,"ms").locale(this.$l).fromNow(!h)},x.valueOf=function(){return this.asMilliseconds()},x.milliseconds=function(){return this.get("milliseconds")},x.asMilliseconds=function(){return this.as("milliseconds")},x.seconds=function(){return this.get("seconds")},x.asSeconds=function(){return this.as("seconds")},x.minutes=function(){return this.get("minutes")},x.asMinutes=function(){return this.as("minutes")},x.hours=function(){return this.get("hours")},x.asHours=function(){return this.as("hours")},x.days=function(){return this.get("days")},x.asDays=function(){return this.as("days")},x.weeks=function(){return this.get("weeks")},x.asWeeks=function(){return this.as("weeks")},x.months=function(){return this.get("months")},x.asMonths=function(){return this.as("months")},x.years=function(){return this.get("years")},x.asYears=function(){return this.as("years")},I})(),z=function(I,x,h){return I.add(x.years()*h,"y").add(x.months()*h,"M").add(x.days()*h,"d").add(x.hours()*h,"h").add(x.minutes()*h,"m").add(x.seconds()*h,"s").add(x.milliseconds()*h,"ms")};return function(I,x,h){s=h,r=h().$utils(),h.duration=function(T,v){var p=h.locale();return G(T,{$l:p},v)},h.isDuration=D;var E=x.prototype.add,f=x.prototype.subtract;x.prototype.add=function(T,v){return D(T)?z(this,T,1):E.bind(this)(T,v)},x.prototype.subtract=function(T,v){return D(T)?z(this,T,-1):f.bind(this)(T,v)}}}))})(Dt)),Dt.exports}var fr=dr();const hr=It(fr);var Lt=(function(){var t=l(function(p,a,d,m){for(d=d||{},m=p.length;m--;d[p[m]]=a);return d},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],s=[1,26],r=[1,27],n=[1,28],g=[1,29],y=[1,30],b=[1,31],C=[1,32],L=[1,33],w=[1,34],P=[1,9],_=[1,10],D=[1,11],G=[1,12],N=[1,13],k=[1,14],M=[1,15],W=[1,16],O=[1,19],H=[1,20],z=[1,21],I=[1,22],x=[1,23],h=[1,25],E=[1,35],f={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:l(function(a,d,m,u,S,i,Y){var o=i.length-1;switch(S){case 1:return i[o-1];case 2:this.$=[];break;case 3:i[o-1].push(i[o]),this.$=i[o-1];break;case 4:case 5:this.$=i[o];break;case 6:case 7:this.$=[];break;case 8:u.setWeekday("monday");break;case 9:u.setWeekday("tuesday");break;case 10:u.setWeekday("wednesday");break;case 11:u.setWeekday("thursday");break;case 12:u.setWeekday("friday");break;case 13:u.setWeekday("saturday");break;case 14:u.setWeekday("sunday");break;case 15:u.setWeekend("friday");break;case 16:u.setWeekend("saturday");break;case 17:u.setDateFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 18:u.enableInclusiveEndDates(),this.$=i[o].substr(18);break;case 19:u.TopAxis(),this.$=i[o].substr(8);break;case 20:u.setAxisFormat(i[o].substr(11)),this.$=i[o].substr(11);break;case 21:u.setTickInterval(i[o].substr(13)),this.$=i[o].substr(13);break;case 22:u.setExcludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 23:u.setIncludes(i[o].substr(9)),this.$=i[o].substr(9);break;case 24:u.setTodayMarker(i[o].substr(12)),this.$=i[o].substr(12);break;case 27:u.setDiagramTitle(i[o].substr(6)),this.$=i[o].substr(6);break;case 28:this.$=i[o].trim(),u.setAccTitle(this.$);break;case 29:case 30:this.$=i[o].trim(),u.setAccDescription(this.$);break;case 31:u.addSection(i[o].substr(8)),this.$=i[o].substr(8);break;case 33:u.addTask(i[o-1],i[o]),this.$="task";break;case 34:this.$=i[o-1],u.setClickEvent(i[o-1],i[o],null);break;case 35:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],i[o]);break;case 36:this.$=i[o-2],u.setClickEvent(i[o-2],i[o-1],null),u.setLink(i[o-2],i[o]);break;case 37:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-2],i[o-1]),u.setLink(i[o-3],i[o]);break;case 38:this.$=i[o-2],u.setClickEvent(i[o-2],i[o],null),u.setLink(i[o-2],i[o-1]);break;case 39:this.$=i[o-3],u.setClickEvent(i[o-3],i[o-1],i[o]),u.setLink(i[o-3],i[o-2]);break;case 40:this.$=i[o-1],u.setLink(i[o-1],i[o]);break;case 41:case 47:this.$=i[o-1]+" "+i[o];break;case 42:case 43:case 45:this.$=i[o-2]+" "+i[o-1]+" "+i[o];break;case 44:case 46:this.$=i[o-3]+" "+i[o-2]+" "+i[o-1]+" "+i[o];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:s,13:r,14:n,15:g,16:y,17:b,18:C,19:18,20:L,21:w,22:P,23:_,24:D,25:G,26:N,27:k,28:M,29:W,30:O,31:H,33:z,35:I,36:x,37:24,38:h,40:E},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:l(function(a,d){if(d.recoverable)this.trace(a);else{var m=new Error(a);throw m.hash=d,m}},"parseError"),parse:l(function(a){var d=this,m=[0],u=[],S=[null],i=[],Y=this.table,o="",q=0,c=0,$=2,A=1,R=i.slice.call(arguments,1),F=Object.create(this.lexer),B={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(B.yy[V]=this.yy[V]);F.setInput(a,B.yy),B.yy.lexer=F,B.yy.parser=this,typeof F.yylloc>"u"&&(F.yylloc={});var st=F.yylloc;i.push(st);var nt=F.options&&F.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Q){m.length=m.length-2*Q,S.length=S.length-Q,i.length=i.length-Q}l(yt,"popStack");function lt(){var Q;return Q=u.pop()||F.lex()||A,typeof Q!="number"&&(Q instanceof Array&&(u=Q,Q=u.pop()),Q=d.symbols_[Q]||Q),Q}l(lt,"lex");for(var X,K,Z,at,J={},it,tt,Ut,pt;;){if(K=m[m.length-1],this.defaultActions[K]?Z=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=lt()),Z=Y[K]&&Y[K][X]),typeof Z>"u"||!Z.length||!Z[0]){var Yt="";pt=[];for(it in Y[K])this.terminals_[it]&&it>$&&pt.push("'"+this.terminals_[it]+"'");F.showPosition?Yt="Parse error on line "+(q+1)+`: `+F.showPosition()+` Expecting `+pt.join(", ")+", got '"+(this.terminals_[X]||X)+"'":Yt="Parse error on line "+(q+1)+": Unexpected "+(X==A?"end of input":"'"+(this.terminals_[X]||X)+"'"),this.parseError(Yt,{text:F.match,token:this.terminals_[X]||X,line:F.yylineno,loc:st,expected:pt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+K+", token: "+X);switch(Z[0]){case 1:m.push(X),S.push(F.yytext),i.push(F.yylloc),m.push(Z[1]),X=null,c=F.yyleng,o=F.yytext,q=F.yylineno,st=F.yylloc;break;case 2:if(tt=this.productions_[Z[1]][1],J.$=S[S.length-tt],J._$={first_line:i[i.length-(tt||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(tt||1)].first_column,last_column:i[i.length-1].last_column},nt&&(J._$.range=[i[i.length-(tt||1)].range[0],i[i.length-1].range[1]]),at=this.performAction.apply(J,[o,c,q,B.yy,Z[1],S,i].concat(R)),typeof at<"u")return at;tt&&(m=m.slice(0,-1*tt*2),S=S.slice(0,-1*tt),i=i.slice(0,-1*tt)),m.push(this.productions_[Z[1]][0]),S.push(J.$),i.push(J._$),Ut=Y[m[m.length-2]][m[m.length-1]],m.push(Ut);break;case 3:return!0}}return!0},"parse")},T=(function(){var p={EOF:1,parseError:l(function(d,m){if(this.yy.parser)this.yy.parser.parseError(d,m);else throw new Error(d)},"parseError"),setInput:l(function(a,d){return this.yy=d||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:l(function(a){var d=a.length,m=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===u.length?this.yylloc.first_column:0)+u[u.length-m.length].length-m[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(a){this.unput(this.match.slice(a))},"less"),pastInput:l(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-C7yJAXuE.js similarity index 99% rename from static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js rename to static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-C7yJAXuE.js index 47776c6ce..c49fe9278 100644 --- a/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-KBfX5NiQ.js +++ b/static/ml_canvas/assets/gitGraphDiagram-WWUBYQGX-C7yJAXuE.js @@ -1,4 +1,4 @@ -import{I as he}from"./chunk-2Q5K7J3B-CmWhNyCT.js";import{p as $e}from"./chunk-JWPE2WC7-CSEprKif.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-CiBTFoht.js";import{p as Be}from"./cynefin-OW5HDTMX-CgUfycTN.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-C87GWrUj.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` +import{I as he}from"./chunk-2Q5K7J3B-BB3ve9kE.js";import{p as $e}from"./chunk-JWPE2WC7-B4HV2Nxc.js";import{n as fe,m as ge,s as ue,g as ye,a as xe,b as me,_ as $,x as Q,l as k,c as z,v as pe,y as be,o as we,j as L,z as ke,A as ve,B as Ee}from"./mermaid.core-fnA2DmhE.js";import{p as Be}from"./cynefin-OW5HDTMX-DPLixWx6.js";import{s as Ce}from"./vendor-flow-Ct2sLZk5.js";import"./index-C2dSXwG1.js";import"./vendor-utils-VkF_O5b_.js";import"./vendor-charts-BkHP8M8k.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Te=ve.gitGraph,D=$(()=>ke({...Te,...Q().gitGraph}),"getConfig"),i=new he(()=>{const e=D(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function K(){return Ee({length:7})}$(K,"getID");function ae(e,r){const t=Object.create(null);return e.reduce((o,s)=>{const d=r(s);return t[d]||(t[d]=!0,o.push(s)),o},[])}$(ae,"uniqBy");var Le=$(function(e){i.records.direction=e},"setDirection"),Me=$(function(e){k.debug("options str",e),e=e==null?void 0:e.trim(),e=e||"{}";try{i.records.options=JSON.parse(e)}catch(r){k.error("error while parsing gitGraph options",r.message)}},"setOptions"),Re=$(function(){return i.records.options},"getOptions"),Ie=$(function(e){let r=e.msg,t=e.id;const o=e.type;let s=e.tags;k.info("commit",r,t,o,s),k.debug("Entering commit:",r,t,o,s);const d=D();t=L.sanitizeText(t,d),r=L.sanitizeText(r,d),s=s==null?void 0:s.map(a=>L.sanitizeText(a,d));const n={id:t||i.records.seq+"-"+K(),message:r,seq:i.records.seq++,type:o??p.NORMAL,tags:s??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=n,k.info("main branch",d.mainBranchName),i.records.commits.has(n.id)&&k.warn(`Commit ID ${n.id} already exists`),i.records.commits.set(n.id,n),i.records.branches.set(i.records.currBranch,n.id),k.debug("in pushCommit "+n.id)},"commit"),Oe=$(function(e){let r=e.name;const t=e.order;if(r=L.sanitizeText(r,D()),i.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:t}),ne(r),k.debug("in createBranch")},"branch"),_e=$(e=>{let r=e.branch,t=e.id;const o=e.type,s=e.tags,d=D();r=L.sanitizeText(r,d),t&&(t=L.sanitizeText(t,d));const n=i.records.branches.get(i.records.currBranch),a=i.records.branches.get(r),l=n?i.records.commits.get(n):void 0,h=a?i.records.commits.get(a):void 0;if(l&&h&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!i.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(h===void 0||!h){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===h){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&i.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,token:`merge ${r} ${t} ${o} ${s==null?void 0:s.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${o} ${s==null?void 0:s.join(" ")}`]},c}const g=a||"",f={id:t||`${i.records.seq}-${K()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,g],branch:i.records.currBranch,type:p.MERGE,customType:o,customId:!!t,tags:s??[]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),k.debug(i.records.branches),k.debug("in mergeBranch")},"merge"),Ge=$(function(e){let r=e.id,t=e.targetId,o=e.tags,s=e.parent;k.debug("Entering cherryPick:",r,t,o);const d=D();if(r=L.sanitizeText(r,d),t=L.sanitizeText(t,d),o=o==null?void 0:o.map(l=>L.sanitizeText(l,d)),s=L.sanitizeText(s,d),!r||!i.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=i.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(n.parents)&&n.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===p.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!i.records.commits.has(t)){if(a===i.records.currBranch){const f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const l=i.records.branches.get(i.records.currBranch);if(l===void 0||!l){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const h=i.records.commits.get(l);if(h===void 0||!h){const f=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},f}const g={id:i.records.seq+"-"+K(),message:`cherry-picked ${n==null?void 0:n.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,n.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${n.id}${n.type===p.MERGE?`|parent:${s}`:""}`]};i.records.head=g,i.records.commits.set(g.id,g),i.records.branches.set(i.records.currBranch,g.id),k.debug(i.records.branches),k.debug("in cherryPick")}},"cherryPick"),ne=$(function(e){if(e=L.sanitizeText(e,D()),i.records.branches.has(e)){i.records.currBranch=e;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function X(e,r,t){const o=e.indexOf(r);o===-1?e.push(t):e.splice(o,1,t)}$(X,"upsert");function Z(e){const r=e.reduce((s,d)=>s.seq>d.seq?s:d,e[0]);let t="";e.forEach(function(s){s===r?t+=" *":t+=" |"});const o=[t,r.id,r.seq];for(const s in i.records.branches)i.records.branches.get(s)===r.id&&o.push(s);if(k.debug(o.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const s=i.records.commits.get(r.parents[0]);X(e,r,s),r.parents[1]&&e.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const s=i.records.commits.get(r.parents[0]);X(e,r,s)}}e=ae(e,s=>s.id),Z(e)}$(Z,"prettyPrintCommitHistory");var He=$(function(){k.debug(i.records.commits);const e=se()[0];Z([e])},"prettyPrint"),Ae=$(function(){i.reset(),we()},"clear"),Se=$(function(){return[...i.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),De=$(function(){return i.records.branches},"getBranches"),Pe=$(function(){return i.records.commits},"getCommits"),se=$(function(){const e=[...i.records.commits.values()];return e.forEach(function(r){k.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),We=$(function(){return i.records.currBranch},"getCurrentBranch"),qe=$(function(){return i.records.direction},"getDirection"),Ne=$(function(){return i.records.head},"getHead"),oe={commitType:p,getConfig:D,setDirection:Le,setOptions:Me,getOptions:Re,commit:Ie,branch:Oe,merge:_e,cherryPick:Ge,checkout:ne,prettyPrint:He,clear:Ae,getBranchesAsObjArray:Se,getBranches:De,getCommits:Pe,getCommitsArray:se,getCurrentBranch:We,getDirection:qe,getHead:Ne,setAccTitle:me,getAccTitle:xe,getAccDescription:ye,setAccDescription:ue,setDiagramTitle:ge,getDiagramTitle:fe},Fe=$((e,r)=>{$e(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)ze(t,r)},"populate"),ze=$((e,r)=>{const o={Commit:$(s=>r.commit(Ye(s)),"Commit"),Branch:$(s=>r.branch(je(s)),"Branch"),Merge:$(s=>r.merge(Ue(s)),"Merge"),Checkout:$(s=>r.checkout(Ke(s)),"Checkout"),CherryPicking:$(s=>r.cherryPick(Ve(s)),"CherryPicking")}[e.$type];o?o(e):k.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ye=$(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?p[e.type]:p.NORMAL,tags:e.tags??void 0}),"parseCommit"),je=$(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=$(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?p[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ke=$(e=>e.branch,"parseCheckout"),Ve=$(e=>{var t;return{id:e.id,targetId:"",tags:((t=e.tags)==null?void 0:t.length)===0?void 0:e.tags,parent:e.parent}},"parseCherryPicking"),Xe={parse:$(async e=>{const r=await Be("gitGraph",e);k.debug(r),Fe(r,oe)},"parse")},G=10,H=40,M=4,I=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),J=12,ee=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),S=$((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,T=new Map,j=30,N=new Map,U=[],O=0,y="LR",Qe=$(()=>{C.clear(),T.clear(),N.clear(),O=0,U=[],y="LR"},"clear"),ce=$(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(o=>{const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=o.trim(),r.appendChild(s)}),r},"drawText"),ie=$(e=>{let r,t,o;return y==="BT"?(t=$((s,d)=>s<=d,"comparisonFunc"),o=1/0):(t=$((s,d)=>s>=d,"comparisonFunc"),o=0),e.forEach(s=>{var n,a;const d=y==="TB"||y=="BT"?(n=T.get(s))==null?void 0:n.y:(a=T.get(s))==null?void 0:a.x;d!==void 0&&t(d,o)&&(r=s,o=d)}),r},"findClosestParent"),Ze=$(e=>{let r="",t=1/0;return e.forEach(o=>{const s=T.get(o).y;s<=t&&(r=o,t=s)}),r||void 0},"findClosestParentBT"),er=$((e,r,t)=>{let o=t,s=t;const d=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(o=tr(a),s=Math.max(o,s)):d.push(a),ar(a,o)}),o=s,d.forEach(n=>{nr(n,o,t)}),e.forEach(n=>{const a=r.get(n);if(a!=null&&a.parents.length){const l=Ze(a.parents);o=T.get(l).y-H,o<=s&&(s=o);const h=C.get(a.branch).pos,g=o-G;T.set(a.id,{x:h,y:g})}})},"setParallelBTPos"),rr=$(e=>{var o;const r=ie(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=(o=T.get(r))==null?void 0:o.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),tr=$(e=>rr(e)+H,"calculateCommitPosition"),ar=$((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const o=t.pos,s=r+G;return T.set(e.id,{x:o,y:s}),{x:o,y:s}},"setCommitPosition"),nr=$((e,r,t)=>{const o=C.get(e.branch);if(!o)throw new Error(`Branch not found for commit ${e.id}`);const s=r+t,d=o.pos;T.set(e.id,{x:d,y:s})},"setRootPosition"),sr=$((e,r,t,o,s,d)=>{const{theme:n}=z(),a=V.has(n??""),l=ee.has(n??""),h=Je.has(n??"");if(d===p.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${S(s,A,l)} ${o}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${S(s,A,l)} ${o}-inner`);else if(d===p.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${S(s,A,l)}`),d===p.MERGE){const f=e.append("circle");f.attr("cx",t.x),f.attr("cy",t.y),f.attr("r",a?5:6),f.attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}if(d===p.REVERSE){const f=e.append("path"),c=a?4:5;f.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${o} ${r.id} commit${S(s,A,l)}`)}}},"drawCommitBullet"),or=$((e,r,t,o,s)=>{var d;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&s.showCommitLabel){const n=e.append("g"),a=n.insert("rect").attr("class","commit-label-bkg"),l=n.append("text").attr("x",o).attr("y",t.y+25).attr("class","commit-label").text(r.id),h=(d=l.node())==null?void 0:d.getBBox();if(h&&(a.attr("x",t.posWithOffset-h.width/2-I).attr("y",t.y+13.5).attr("width",h.width+2*I).attr("height",h.height+2*I),y==="TB"||y==="BT"?(a.attr("x",t.x-(h.width+4*M+5)).attr("y",t.y-12),l.attr("x",t.x-(h.width+4*M)).attr("y",t.y+h.height-12)):l.attr("x",t.posWithOffset-h.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")l.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),a.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const g=-7.5-(h.width+10)/25*9.5,f=10+h.width/25*8.5;n.attr("transform","translate("+g+", "+f+") rotate(-45, "+o+", "+t.y+")")}}},"drawCommitLabel"),cr=$((e,r,t,o)=>{var s;if(r.tags.length>0){let d=0,n=0,a=0;const l=[];for(const h of r.tags.reverse()){const g=e.insert("polygon"),f=e.append("circle"),c=e.append("text").attr("y",t.y-16-d).attr("class","tag-label").text(h),x=(s=c.node())==null?void 0:s.getBBox();if(!x)throw new Error("Tag bbox not found");n=Math.max(n,x.width),a=Math.max(a,x.height),c.attr("x",t.posWithOffset-x.width/2),l.push({tag:c,hole:f,rect:g,yOffset:d}),d+=20}for(const{tag:h,hole:g,rect:f,yOffset:c}of l){const x=a/2,u=t.y-19.2-c;if(f.attr("class","tag-label-bkg").attr("points",` ${o-n/2-M/2},${u+I} ${o-n/2-M/2},${u-I} ${t.posWithOffset-n/2-M},${u-x-I} diff --git a/static/ml_canvas/assets/index-C87GWrUj.js b/static/ml_canvas/assets/index-C2dSXwG1.js similarity index 87% rename from static/ml_canvas/assets/index-C87GWrUj.js rename to static/ml_canvas/assets/index-C2dSXwG1.js index 5c35d739f..deb6fd3f6 100644 --- a/static/ml_canvas/assets/index-C87GWrUj.js +++ b/static/ml_canvas/assets/index-C2dSXwG1.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CiBTFoht.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-fhCsGe-z.js","assets/EDAPage-BcPZlmKw.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-CPfpybeF.js","assets/ModelRegistry-BUrr8Bvp.js","assets/DeploymentsPage-CZDjMu-I.js","assets/SlowNodesPage-BSLoobH9.js","assets/AuditLogPage-No5dzqER.js"])))=>i.map(i=>d[i]); -var b0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var y0=(e,s,r)=>s in e?b0(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Pt=(e,s,r)=>y0(e,typeof s!="symbol"?s+"":s,r),zi=(e,s,r)=>s.has(e)||zd("Cannot "+r);var C=(e,s,r)=>(zi(e,s,"read from private field"),r?r.call(e):s.get(e)),ne=(e,s,r)=>s.has(e)?zd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,r),Q=(e,s,r,a)=>(zi(e,s,"write to private field"),a?a.call(e,r):s.set(e,r),r),he=(e,s,r)=>(zi(e,s,"access private method"),r);var lo=(e,s,r,a)=>({set _(n){Q(e,s,n,r)},get _(){return C(e,s,a)}});import{j as t,c as wp,b as Bi,d as v0,e as j0,f as Np,g as An,H as wl,P as as,h as w0,k as N0,l as kp,m as k0,E as _0,R as _p,i as Sp,B as Cp,C as Ep,n as Kt,M as S0}from"./vendor-flow-Ct2sLZk5.js";import{g as Rp,a as p,b as ae,af as Tp,aC as C0,X as Ee,Q as $n,f as $t,j as Te,a6 as Qe,aD as vc,aE as E0,ar as Mp,a7 as at,a5 as Fn,T as jc,aw as ds,a9 as Ct,A as R0,d as Pa,aF as ri,i as T0,u as M0,aG as P0,aH as I0,D as ge,c as us,aI as A0,C as _t,an as Nl,z as ir,e as Ut,x as Pp,aa as Ie,J as Dn,a0 as Ip,a1 as Ap,q as Es,l as ms,aJ as wc,L as Ln,w as $0,N as F0,o as Dr,aK as D0,ab as L0,m as O0,p as Ce,k as tt,aL as kl,aM as ai,aN as hn,aO as z0,_ as Ia,aP as $p,s as Nc,y as gt,ai as _l,S as lr,Y as On,az as Fp,K as Ae,ap as B0,aq as V0,R as Dp,aB as kc,aQ as xn,aR as U0,aS as _c,aT as Sc,v as tr,aU as H0,aV as Aa,aA as Lp,aW as W0,ak as gn,aX as Op,aY as zp,aZ as G0,a_ as q0,a$ as K0,b0 as Sl,b1 as J0,W as ni,t as oi,ac as Cc,b2 as Bp,b3 as Y0,b4 as zn,b5 as Q0,as as Vp,b6 as Zt,ax as Ec,b7 as X0,V as Z0,am as eb,b8 as tb,b9 as sb,ba as rb,bb as Up,bc as Hp,bd as ab,be as nb,bf as ob,bg as ib,bh as lb,Z as Cl,bi as Rc,bj as Tc,ag as Wp,bk as ii,bl as cb,bm as db,bn as ub,bo as Gp,bp as mb,bq as pb,a4 as qp,br as hb,bs as xb,h as Mc,bt as gb,bu as fb,bv as bb,bw as yb,bx as vb,H as Kp,by as Jp,bz as Yp,bA as Pc,bB as jb,bC as Bd,bD as wb,bE as Nb,bF as kb,bG as _b}from"./vendor-utils-VkF_O5b_.js";import{aY as Sb,u as Cb,r as Bn,R as $e,B as Jt,C as Ue,X as Oe,Y as ze,T as Fe,h as lt,aj as Eb,ak as Rb,j as wa,ah as Lr,aZ as Tb,ag as Mb,ai as ht,av as Pb,a_ as pr,a$ as Ib,as as ct,au as hr,at as Zr,b0 as Vi,b1 as Vd}from"./vendor-charts-BkHP8M8k.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var co={},Ud;function Ab(){if(Ud)return co;Ud=1;var e=Sb();return co.createRoot=e.createRoot,co.hydrateRoot=e.hydrateRoot,co}var $b=Ab();const Fb=Rp($b);var $a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},br,Hs,ca,up,Db=(up=class extends $a{constructor(){super();ne(this,br);ne(this,Hs);ne(this,ca);Q(this,ca,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Hs)||this.setEventListener(C(this,ca))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Hs))==null||s.call(this),Q(this,Hs,void 0))}setEventListener(s){var r;Q(this,ca,s),(r=C(this,Hs))==null||r.call(this),Q(this,Hs,s(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(s){C(this,br)!==s&&(Q(this,br,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof C(this,br)=="boolean"?C(this,br):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},br=new WeakMap,Hs=new WeakMap,ca=new WeakMap,up),Ic=new Db,Lb={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},Ws,yc,mp,Ob=(mp=class{constructor(){ne(this,Ws,Lb);ne(this,yc,!1)}setTimeoutProvider(e){Q(this,Ws,e)}setTimeout(e,s){return C(this,Ws).setTimeout(e,s)}clearTimeout(e){C(this,Ws).clearTimeout(e)}setInterval(e,s){return C(this,Ws).setInterval(e,s)}clearInterval(e){C(this,Ws).clearInterval(e)}},Ws=new WeakMap,yc=new WeakMap,mp),gr=new Ob;function zb(e){setTimeout(e,0)}var Bb=typeof window>"u"||"Deno"in globalThis;function xt(){}function Vb(e,s){return typeof e=="function"?e(s):e}function El(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qp(e,s){return Math.max(e+(s||0)-Date.now(),0)}function Zs(e,s){return typeof e=="function"?e(s):e}function wt(e,s){return typeof e=="function"?e(s):e}function Hd(e,s){const{type:r="all",exact:a,fetchStatus:n,predicate:o,queryKey:i,stale:l}=e;if(i){if(a){if(s.queryHash!==Ac(i,s.options))return!1}else if(!fn(s.queryKey,i))return!1}if(r!=="all"){const c=s.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&s.isStale()!==l||n&&n!==s.state.fetchStatus||o&&!o(s))}function Wd(e,s){const{exact:r,status:a,predicate:n,mutationKey:o}=e;if(o){if(!s.options.mutationKey)return!1;if(r){if(Mr(s.options.mutationKey)!==Mr(o))return!1}else if(!fn(s.options.mutationKey,o))return!1}return!(a&&s.state.status!==a||n&&!n(s))}function Ac(e,s){return((s==null?void 0:s.queryKeyHashFn)||Mr)(e)}function Mr(e){return JSON.stringify(e,(s,r)=>Rl(r)?Object.keys(r).sort().reduce((a,n)=>(a[n]=r[n],a),{}):r)}function fn(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(r=>fn(e[r],s[r])):!1}var Ub=Object.prototype.hasOwnProperty;function Xp(e,s,r=0){if(e===s)return e;if(r>500)return s;const a=Gd(e)&&Gd(s);if(!a&&!(Rl(e)&&Rl(s)))return s;const o=(a?e:Object.keys(e)).length,i=a?s:Object.keys(s),l=i.length,c=a?new Array(l):{};let d=0;for(let u=0;u{gr.setTimeout(s,e)})}function Tl(e,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,s):r.structuralSharing!==!1?Xp(e,s):s}function Wb(e,s,r=0){const a=[...e,s];return r&&a.length>r?a.slice(1):a}function Gb(e,s,r=0){const a=[s,...e];return r&&a.length>r?a.slice(0,-1):a}var $c=Symbol();function Zp(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===$c?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fc(e,s){return typeof e=="function"?e(...s):!!e}function qb(e,s,r){let a=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=s()),a||(a=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var bn=(()=>{let e=()=>Bb;return{isServer(){return e()},setIsServer(s){e=s}}})();function Ml(){let e,s;const r=new Promise((n,o)=>{e=n,s=o});r.status="pending",r.catch(()=>{});function a(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{a({status:"fulfilled",value:n}),e(n)},r.reject=n=>{a({status:"rejected",reason:n}),s(n)},r}var Kb=zb;function Jb(){let e=[],s=0,r=l=>{l()},a=l=>{l()},n=Kb;const o=l=>{s?e.push(l):n(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&n(()=>{a(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;s++;try{c=l()}finally{s--,s||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{a=l},setScheduler:l=>{n=l}}}var et=Jb(),da,Gs,ua,pp,Yb=(pp=class extends $a{constructor(){super();ne(this,da,!0);ne(this,Gs);ne(this,ua);Q(this,ua,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),a=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){C(this,Gs)||this.setEventListener(C(this,ua))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Gs))==null||s.call(this),Q(this,Gs,void 0))}setEventListener(s){var r;Q(this,ua,s),(r=C(this,Gs))==null||r.call(this),Q(this,Gs,s(this.setOnline.bind(this)))}setOnline(s){C(this,da)!==s&&(Q(this,da,s),this.listeners.forEach(a=>{a(s)}))}isOnline(){return C(this,da)}},da=new WeakMap,Gs=new WeakMap,ua=new WeakMap,pp),zo=new Yb;function Qb(e){return Math.min(1e3*2**e,3e4)}function eh(e){return(e??"online")==="online"?zo.isOnline():!0}var Pl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function th(e){let s=!1,r=0,a;const n=Ml(),o=()=>n.status!=="pending",i=g=>{var b;if(!o()){const y=new Pl(g);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{s=!0},c=()=>{s=!1},d=()=>Ic.isFocused()&&(e.networkMode==="always"||zo.isOnline())&&e.canRun(),u=()=>eh(e.networkMode)&&e.canRun(),m=g=>{o()||(a==null||a(),n.resolve(g))},h=g=>{o()||(a==null||a(),n.reject(g))},x=()=>new Promise(g=>{var b;a=y=>{(o()||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;a=void 0,o()||(g=e.onContinue)==null||g.call(e)}),f=()=>{if(o())return;let g;const b=r===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(m).catch(y=>{var k;if(o())return;const v=e.retry??(bn.isServer()?0:3),j=e.retryDelay??Qb,w=typeof j=="function"?j(r,y):j,N=v===!0||typeof v=="number"&&rd()?void 0:x()).then(()=>{s?h(y):f()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(a==null||a(),n),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?f():x().then(f),n)}}var yr,hp,sh=(hp=class{constructor(){ne(this,yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),El(this.gcTime)&&Q(this,yr,gr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,yr)!==void 0&&(gr.clearTimeout(C(this,yr)),Q(this,yr,void 0))}},yr=new WeakMap,hp);function Xb(e){return{onFetch:(s,r)=>{var u,m,h,x,f;const a=s.options,n=(h=(m=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,o=((x=s.state.data)==null?void 0:x.pages)||[],i=((f=s.state.data)==null?void 0:f.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=j=>{qb(j,()=>s.signal,()=>g=!0)},y=Zp(s.options,s.fetchOptions),v=async(j,w,N)=>{if(g)return Promise.reject(s.signal.reason);if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const T={client:s.client,queryKey:s.queryKey,pageParam:w,direction:N?"backward":"forward",meta:s.options.meta};return b(T),T})(),R=await y(_),{maxPages:M}=s.options,E=N?Gb:Wb;return{pages:E(j.pages,R,M),pageParams:E(j.pageParams,w,M)}};if(n&&o.length){const j=n==="backward",w=j?rh:Il,N={pages:o,pageParams:i},k=w(a,N);l=await v(N,k,j)}else{const j=e??o.length;do{const w=c===0?i[0]??a.initialPageParam:Il(a,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c{var g,b;return(b=(g=s.options).persister)==null?void 0:b.call(g,d,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=d}}}function Il(e,{pages:s,pageParams:r}){const a=s.length-1;return s.length>0?e.getNextPageParam(s[a],s,r[a],r):void 0}function rh(e,{pages:s,pageParams:r}){var a;return s.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,s[0],s,r[0],r):void 0}function h6(e,s){return s?Il(e,s)!=null:!1}function x6(e,s){return!s||!e.getPreviousPageParam?!1:rh(e,s)!=null}var ma,vr,pa,At,jr,rt,Rn,wr,jt,ah,ys,xp,Zb=(xp=class extends sh{constructor(s){super();ne(this,jt);ne(this,ma);ne(this,vr);ne(this,pa);ne(this,At);ne(this,jr);ne(this,rt);ne(this,Rn);ne(this,wr);Q(this,wr,!1),Q(this,Rn,s.defaultOptions),this.setOptions(s.options),this.observers=[],Q(this,jr,s.client),Q(this,At,C(this,jr).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Q(this,vr,Jd(this.options)),this.state=s.state??C(this,vr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ma)}get promise(){var s;return(s=C(this,rt))==null?void 0:s.promise}setOptions(s){if(this.options={...C(this,Rn),...s},s!=null&&s._type&&Q(this,ma,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Jd(this.options);r.data!==void 0&&(this.setState(Kd(r.data,r.dataUpdatedAt)),Q(this,vr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,At).remove(this)}setData(s,r){const a=Tl(this.state.data,s,this.options);return he(this,jt,ys).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(s){he(this,jt,ys).call(this,{type:"setState",state:s})}cancel(s){var a,n;const r=(a=C(this,rt))==null?void 0:a.promise;return(n=C(this,rt))==null||n.cancel(s),r?r.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,vr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>wt(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$c||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>Zs(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Qp(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(a=>a.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}onOnline(){var r;const s=this.observers.find(a=>a.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),C(this,At).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(C(this,rt)&&(C(this,wr)||he(this,jt,ah).call(this)?C(this,rt).cancel({revert:!0}):C(this,rt).cancelRetry()),this.scheduleGc()),C(this,At).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,ys).call(this,{type:"invalidate"})}async fetch(s,r){var d,u,m,h,x,f,g,b,y,v,j;if(this.state.fetchStatus!=="idle"&&((d=C(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,rt))return C(this,rt).continueRetry(),C(this,rt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const a=new AbortController,n=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Q(this,wr,!0),a.signal)})},o=()=>{const w=Zp(this.options,r),k=(()=>{const _={client:C(this,jr),queryKey:this.queryKey,meta:this.meta};return n(_),_})();return Q(this,wr,!1),this.options.persister?this.options.persister(w,k,this):w(k)},l=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,jr),state:this.state,fetchFn:o};return n(w),w})(),c=C(this,ma)==="infinite"?Xb(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Q(this,pa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&he(this,jt,ys).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Q(this,rt,th({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Pl&&w.revert&&this.setState({...C(this,pa),fetchStatus:"idle"}),a.abort()},onFail:(w,N)=>{he(this,jt,ys).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{he(this,jt,ys).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,ys).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await C(this,rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=C(this,At).config).onSuccess)==null||x.call(h,w,this),(g=(f=C(this,At).config).onSettled)==null||g.call(f,w,this.state.error,this),w}catch(w){if(w instanceof Pl){if(w.silent)return C(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,jt,ys).call(this,{type:"error",error:w}),(y=(b=C(this,At).config).onError)==null||y.call(b,w,this),(j=(v=C(this,At).config).onSettled)==null||j.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},ma=new WeakMap,vr=new WeakMap,pa=new WeakMap,At=new WeakMap,jr=new WeakMap,rt=new WeakMap,Rn=new WeakMap,wr=new WeakMap,jt=new WeakSet,ah=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ys=function(s){const r=a=>{switch(s.type){case"failed":return{...a,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...nh(a.data,this.options),fetchMeta:s.meta??null};case"success":const n={...a,...Kd(s.data,s.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,pa,s.manual?n:void 0),n;case"error":const o=s.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...s.state}}};this.state=r(this.state),et.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),C(this,At).notify({query:this,type:"updated",action:s})})},xp);function nh(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eh(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kd(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jd(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,r=s!==void 0,a=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ft,ye,Tn,mt,Nr,ha,vs,qs,Mn,xa,ga,kr,_r,Ks,fa,ke,cn,Al,$l,Fl,Dl,Ll,Ol,zl,oh,gp,ey=(gp=class extends $a{constructor(s,r){super();ne(this,ke);ne(this,ft);ne(this,ye);ne(this,Tn);ne(this,mt);ne(this,Nr);ne(this,ha);ne(this,vs);ne(this,qs);ne(this,Mn);ne(this,xa);ne(this,ga);ne(this,kr);ne(this,_r);ne(this,Ks);ne(this,fa,new Set);this.options=r,Q(this,ft,s),Q(this,qs,null),Q(this,vs,Ml()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Yd(C(this,ye),this.options)?he(this,ke,cn).call(this):this.updateResult(),he(this,ke,Dl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bl(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bl(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,ke,Ll).call(this),he(this,ke,Ol).call(this),C(this,ye).removeObserver(this)}setOptions(s){const r=this.options,a=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,ke,zl).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Oo(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const n=this.hasListeners();n&&Qd(C(this,ye),a,this.options,r)&&he(this,ke,cn).call(this),this.updateResult(),n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||Zs(this.options.staleTime,C(this,ye))!==Zs(r.staleTime,C(this,ye)))&&he(this,ke,Al).call(this);const o=he(this,ke,$l).call(this);n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||o!==C(this,Ks))&&he(this,ke,Fl).call(this,o)}getOptimisticResult(s){const r=C(this,ft).getQueryCache().build(C(this,ft),s),a=this.createResult(r,s);return sy(this,a)&&(Q(this,mt,a),Q(this,ha,this.options),Q(this,Nr,C(this,ye).state)),a}getCurrentResult(){return C(this,mt)}trackResult(s,r){return new Proxy(s,{get:(a,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,vs).status==="pending"&&C(this,vs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,n))})}trackProp(s){C(this,fa).add(s)}getCurrentQuery(){return C(this,ye)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=C(this,ft).defaultQueryOptions(s),a=C(this,ft).getQueryCache().build(C(this,ft),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(s){return he(this,ke,cn).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,mt)))}createResult(s,r){var M;const a=C(this,ye),n=this.options,o=C(this,mt),i=C(this,Nr),l=C(this,ha),d=s!==a?s.state:C(this,Tn),{state:u}=s;let m={...u},h=!1,x;if(r._optimisticResults){const E=this.hasListeners(),T=!E&&Yd(s,r),S=E&&Qd(s,a,r,n);(T||S)&&(m={...m,...nh(u.data,s.options)}),r._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:b}=m;x=m.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let E;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,y=!0):E=typeof r.placeholderData=="function"?r.placeholderData((M=C(this,ga))==null?void 0:M.state.data,C(this,ga)):r.placeholderData,E!==void 0&&(b="success",x=Tl(o==null?void 0:o.data,E,r),h=!0)}if(r.select&&x!==void 0&&!y)if(o&&x===(i==null?void 0:i.data)&&r.select===C(this,Mn))x=C(this,xa);else try{Q(this,Mn,r.select),x=r.select(x),x=Tl(o==null?void 0:o.data,x,r),Q(this,xa,x),Q(this,qs,null)}catch(E){Q(this,qs,E)}C(this,qs)&&(f=C(this,qs),x=C(this,xa),g=Date.now(),b="error");const v=m.fetchStatus==="fetching",j=b==="pending",w=b==="error",N=j&&v,k=x!==void 0,R={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!j,isLoadingError:w&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&k,isStale:Dc(s,r),refetch:this.refetch,promise:C(this,vs),isEnabled:wt(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const E=R.data!==void 0,T=R.status==="error"&&!E,S=A=>{T?A.reject(R.error):E&&A.resolve(R.data)},P=()=>{const A=Q(this,vs,R.promise=Ml());S(A)},I=C(this,vs);switch(I.status){case"pending":s.queryHash===a.queryHash&&S(I);break;case"fulfilled":(T||R.data!==I.value)&&P();break;case"rejected":(!T||R.error!==I.reason)&&P();break}}return R}updateResult(){const s=C(this,mt),r=this.createResult(C(this,ye),this.options);if(Q(this,Nr,C(this,ye).state),Q(this,ha,this.options),C(this,Nr).data!==void 0&&Q(this,ga,C(this,ye)),Oo(r,s))return;Q(this,mt,r);const a=()=>{if(!s)return!0;const{notifyOnChangeProps:n}=this.options,o=typeof n=="function"?n():n;if(o==="all"||!o&&!C(this,fa).size)return!0;const i=new Set(o??C(this,fa));return this.options.throwOnError&&i.add("error"),Object.keys(C(this,mt)).some(l=>{const c=l;return C(this,mt)[c]!==s[c]&&i.has(c)})};he(this,ke,oh).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,ke,Dl).call(this)}},ft=new WeakMap,ye=new WeakMap,Tn=new WeakMap,mt=new WeakMap,Nr=new WeakMap,ha=new WeakMap,vs=new WeakMap,qs=new WeakMap,Mn=new WeakMap,xa=new WeakMap,ga=new WeakMap,kr=new WeakMap,_r=new WeakMap,Ks=new WeakMap,fa=new WeakMap,ke=new WeakSet,cn=function(s){he(this,ke,zl).call(this);let r=C(this,ye).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(xt)),r},Al=function(){he(this,ke,Ll).call(this);const s=Zs(this.options.staleTime,C(this,ye));if(bn.isServer()||C(this,mt).isStale||!El(s))return;const a=Qp(C(this,mt).dataUpdatedAt,s)+1;Q(this,kr,gr.setTimeout(()=>{C(this,mt).isStale||this.updateResult()},a))},$l=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Fl=function(s){he(this,ke,Ol).call(this),Q(this,Ks,s),!(bn.isServer()||wt(this.options.enabled,C(this,ye))===!1||!El(C(this,Ks))||C(this,Ks)===0)&&Q(this,_r,gr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ic.isFocused())&&he(this,ke,cn).call(this)},C(this,Ks)))},Dl=function(){he(this,ke,Al).call(this),he(this,ke,Fl).call(this,he(this,ke,$l).call(this))},Ll=function(){C(this,kr)!==void 0&&(gr.clearTimeout(C(this,kr)),Q(this,kr,void 0))},Ol=function(){C(this,_r)!==void 0&&(gr.clearInterval(C(this,_r)),Q(this,_r,void 0))},zl=function(){const s=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(s===C(this,ye))return;const r=C(this,ye);Q(this,ye,s),Q(this,Tn,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},oh=function(s){et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(C(this,mt))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},gp);function ty(e,s){return wt(s.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&wt(s.retryOnMount,e)===!1)}function Yd(e,s){return ty(e,s)||e.state.data!==void 0&&Bl(e,s,s.refetchOnMount)}function Bl(e,s,r){if(wt(s.enabled,e)!==!1&&Zs(s.staleTime,e)!=="static"){const a=typeof r=="function"?r(e):r;return a==="always"||a!==!1&&Dc(e,s)}return!1}function Qd(e,s,r,a){return(e!==s||wt(a.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Dc(e,r)}function Dc(e,s){return wt(s.enabled,e)!==!1&&e.isStaleByTime(Zs(s.staleTime,e))}function sy(e,s){return!Oo(e.getCurrentResult(),s)}var Pn,es,it,Sr,ts,Bs,fp,ry=(fp=class extends sh{constructor(s){super();ne(this,ts);ne(this,Pn);ne(this,es);ne(this,it);ne(this,Sr);Q(this,Pn,s.client),this.mutationId=s.mutationId,Q(this,it,s.mutationCache),Q(this,es,[]),this.state=s.state||ih(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){C(this,es).includes(s)||(C(this,es).push(s),this.clearGcTimeout(),C(this,it).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Q(this,es,C(this,es).filter(r=>r!==s)),this.scheduleGc(),C(this,it).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){C(this,es).length||(this.state.status==="pending"?this.scheduleGc():C(this,it).remove(this))}continue(){var s;return((s=C(this,Sr))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,l,c,d,u,m,h,x,f,g,b,y,v,j,w,N,k,_;const r=()=>{he(this,ts,Bs).call(this,{type:"continue"})},a={client:C(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Sr,th({fn:()=>this.options.mutationFn?this.options.mutationFn(s,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{he(this,ts,Bs).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{he(this,ts,Bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,it).canRun(this)}));const n=this.state.status==="pending",o=!C(this,Sr).canStart();try{if(n)r();else{he(this,ts,Bs).call(this,{type:"pending",variables:s,isPaused:o}),C(this,it).config.onMutate&&await C(this,it).config.onMutate(s,this,a);const M=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,s,a));M!==this.state.context&&he(this,ts,Bs).call(this,{type:"pending",context:M,variables:s,isPaused:o})}const R=await C(this,Sr).start();return await((d=(c=C(this,it).config).onSuccess)==null?void 0:d.call(c,R,s,this.state.context,this,a)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,R,s,this.state.context,a)),await((x=(h=C(this,it).config).onSettled)==null?void 0:x.call(h,R,null,this.state.variables,this.state.context,this,a)),await((g=(f=this.options).onSettled)==null?void 0:g.call(f,R,null,s,this.state.context,a)),he(this,ts,Bs).call(this,{type:"success",data:R}),R}catch(R){try{await((y=(b=C(this,it).config).onError)==null?void 0:y.call(b,R,s,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((j=(v=this.options).onError)==null?void 0:j.call(v,R,s,this.state.context,a))}catch(M){Promise.reject(M)}try{await((N=(w=C(this,it).config).onSettled)==null?void 0:N.call(w,void 0,R,this.state.variables,this.state.context,this,a))}catch(M){Promise.reject(M)}try{await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,R,s,this.state.context,a))}catch(M){Promise.reject(M)}throw he(this,ts,Bs).call(this,{type:"error",error:R}),R}finally{C(this,it).runNext(this)}}},Pn=new WeakMap,es=new WeakMap,it=new WeakMap,Sr=new WeakMap,ts=new WeakSet,Bs=function(s){const r=a=>{switch(s.type){case"failed":return{...a,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...a,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:s.error,failureCount:a.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),et.batch(()=>{C(this,es).forEach(a=>{a.onMutationUpdate(s)}),C(this,it).notify({mutation:this,type:"updated",action:s})})},fp);function ih(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js,Lt,In,bp,ay=(bp=class extends $a{constructor(s={}){super();ne(this,js);ne(this,Lt);ne(this,In);this.config=s,Q(this,js,new Set),Q(this,Lt,new Map),Q(this,In,0)}build(s,r,a){const n=new ry({client:s,mutationCache:this,mutationId:++lo(this,In)._,options:s.defaultMutationOptions(r),state:a});return this.add(n),n}add(s){C(this,js).add(s);const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);a?a.push(s):C(this,Lt).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(C(this,js).delete(s)){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);if(a)if(a.length>1){const n=a.indexOf(s);n!==-1&&a.splice(n,1)}else a[0]===s&&C(this,Lt).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r),n=a==null?void 0:a.find(o=>o.state.status==="pending");return!n||n===s}else return!0}runNext(s){var a;const r=uo(s);if(typeof r=="string"){const n=(a=C(this,Lt).get(r))==null?void 0:a.find(o=>o!==s&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{C(this,js).forEach(s=>{this.notify({type:"removed",mutation:s})}),C(this,js).clear(),C(this,Lt).clear()})}getAll(){return Array.from(C(this,js))}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Wd(r,a))}findAll(s={}){return this.getAll().filter(r=>Wd(s,r))}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(s.map(r=>r.continue().catch(xt))))}},js=new WeakMap,Lt=new WeakMap,In=new WeakMap,bp);function uo(e){var s;return(s=e.options.scope)==null?void 0:s.id}var ws,Js,bt,Ns,ks,To,Vl,yp,ny=(yp=class extends $a{constructor(r,a){super();ne(this,ks);ne(this,ws);ne(this,Js);ne(this,bt);ne(this,Ns);Q(this,ws,r),this.setOptions(a),this.bindMethods(),he(this,ks,To).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const a=this.options;this.options=C(this,ws).defaultMutationOptions(r),Oo(this.options,a)||C(this,ws).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,bt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Mr(a.mutationKey)!==Mr(this.options.mutationKey)?this.reset():((n=C(this,bt))==null?void 0:n.state.status)==="pending"&&C(this,bt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,bt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,ks,To).call(this),he(this,ks,Vl).call(this,r)}getCurrentResult(){return C(this,Js)}reset(){var r;(r=C(this,bt))==null||r.removeObserver(this),Q(this,bt,void 0),he(this,ks,To).call(this),he(this,ks,Vl).call(this)}mutate(r,a){var n;return Q(this,Ns,a),(n=C(this,bt))==null||n.removeObserver(this),Q(this,bt,C(this,ws).getMutationCache().build(C(this,ws),this.options)),C(this,bt).addObserver(this),C(this,bt).execute(r)}},ws=new WeakMap,Js=new WeakMap,bt=new WeakMap,Ns=new WeakMap,ks=new WeakSet,To=function(){var a;const r=((a=C(this,bt))==null?void 0:a.state)??ih();Q(this,Js,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(r){et.batch(()=>{var a,n,o,i,l,c,d,u;if(C(this,Ns)&&this.hasListeners()){const m=C(this,Js).variables,h=C(this,Js).context,x={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(a=C(this,Ns)).onSuccess)==null||n.call(a,r.data,m,h,x)}catch(f){Promise.reject(f)}try{(i=(o=C(this,Ns)).onSettled)==null||i.call(o,r.data,null,m,h,x)}catch(f){Promise.reject(f)}}else if((r==null?void 0:r.type)==="error"){try{(c=(l=C(this,Ns)).onError)==null||c.call(l,r.error,m,h,x)}catch(f){Promise.reject(f)}try{(u=(d=C(this,Ns)).onSettled)==null||u.call(d,void 0,r.error,m,h,x)}catch(f){Promise.reject(f)}}}this.listeners.forEach(m=>{m(C(this,Js))})})},yp),ss,vp,oy=(vp=class extends $a{constructor(s={}){super();ne(this,ss);this.config=s,Q(this,ss,new Map)}build(s,r,a){const n=r.queryKey,o=r.queryHash??Ac(n,r);let i=this.get(o);return i||(i=new Zb({client:s,queryKey:n,queryHash:o,options:s.defaultQueryOptions(r),state:a,defaultOptions:s.getQueryDefaults(n)}),this.add(i)),i}add(s){C(this,ss).has(s.queryHash)||(C(this,ss).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=C(this,ss).get(s.queryHash);r&&(s.destroy(),r===s&&C(this,ss).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return C(this,ss).get(s)}getAll(){return[...C(this,ss).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Hd(r,a))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(a=>Hd(s,a)):r}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},ss=new WeakMap,vp),Ge,Ys,Qs,ba,ya,Xs,va,ja,jp,iy=(jp=class{constructor(e={}){ne(this,Ge);ne(this,Ys);ne(this,Qs);ne(this,ba);ne(this,ya);ne(this,Xs);ne(this,va);ne(this,ja);Q(this,Ge,e.queryCache||new oy),Q(this,Ys,e.mutationCache||new ay),Q(this,Qs,e.defaultOptions||{}),Q(this,ba,new Map),Q(this,ya,new Map),Q(this,Xs,0)}mount(){lo(this,Xs)._++,C(this,Xs)===1&&(Q(this,va,Ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onFocus())})),Q(this,ja,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onOnline())})))}unmount(){var e,s;lo(this,Xs)._--,C(this,Xs)===0&&((e=C(this,va))==null||e.call(this),Q(this,va,void 0),(s=C(this,ja))==null||s.call(this),Q(this,ja,void 0))}isFetching(e){return C(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),r=C(this,Ge).build(this,s),a=r.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zs(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(a))}getQueriesData(e){return C(this,Ge).findAll(e).map(({queryKey:s,state:r})=>{const a=r.data;return[s,a]})}setQueryData(e,s,r){const a=this.defaultQueryOptions({queryKey:e}),n=C(this,Ge).get(a.queryHash),o=n==null?void 0:n.state.data,i=Vb(s,o);if(i!==void 0)return C(this,Ge).build(this,a).setData(i,{...r,manual:!0})}setQueriesData(e,s,r){return et.batch(()=>C(this,Ge).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,s,r)]))}getQueryState(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state}removeQueries(e){const s=C(this,Ge);et.batch(()=>{s.findAll(e).forEach(r=>{s.remove(r)})})}resetQueries(e,s){const r=C(this,Ge);return et.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const r={revert:!0,...s},a=et.batch(()=>C(this,Ge).findAll(e).map(n=>n.cancel(r)));return Promise.all(a).then(xt).catch(xt)}invalidateQueries(e,s={}){return et.batch(()=>(C(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},s)))}refetchQueries(e,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},a=et.batch(()=>C(this,Ge).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,r);return r.throwOnError||(o=o.catch(xt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(xt)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const r=C(this,Ge).build(this,s);return r.isStaleByTime(Zs(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zo.isOnline()?C(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Ge)}getMutationCache(){return C(this,Ys)}getDefaultOptions(){return C(this,Qs)}setDefaultOptions(e){Q(this,Qs,e)}setQueryDefaults(e,s){C(this,ba).set(Mr(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...C(this,ba).values()],r={};return s.forEach(a=>{fn(e,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(e,s){C(this,ya).set(Mr(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...C(this,ya).values()],r={};return s.forEach(a=>{fn(e,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const s={...C(this,Qs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Ac(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===$c&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Ge).clear(),C(this,Ys).clear()}},Ge=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,ba=new WeakMap,ya=new WeakMap,Xs=new WeakMap,va=new WeakMap,ja=new WeakMap,jp),lh=p.createContext(void 0),Fa=e=>{const s=p.useContext(lh);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},ly=({client:e,children:s})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(lh.Provider,{value:e,children:s})),ch=p.createContext(!1),cy=()=>p.useContext(ch);ch.Provider;function dy(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var uy=p.createContext(dy()),my=()=>p.useContext(uy),py=(e,s,r)=>{const a=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Fc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(s.isReset()||(e.retryOnMount=!1))},hy=e=>{p.useEffect(()=>{e.clearReset()},[e])},xy=({result:e,errorResetBoundary:s,throwOnError:r,query:a,suspense:n})=>e.isError&&!s.isReset()&&!e.isFetching&&a&&(n&&e.data===void 0||Fc(r,[e.error,a])),gy=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...n)=>r(a(...n)):r(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},fy=(e,s)=>e.isLoading&&e.isFetching&&!s,by=(e,s)=>(e==null?void 0:e.suspense)&&s.isPending,Xd=(e,s,r)=>s.fetchOptimistic(e).catch(()=>{r.clearReset()});function yy(e,s,r){var x,f,g,b;const a=cy(),n=my(),o=Fa(),i=o.defaultQueryOptions(e);(f=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||f.call(x,i);const l=o.getQueryCache().get(i.queryHash),c=e.subscribed!==!1;i._optimisticResults=a?"isRestoring":c?"optimistic":void 0,gy(i),py(i,n,l),hy(n);const d=!o.getQueryCache().get(i.queryHash),[u]=p.useState(()=>new s(o,i)),m=u.getOptimisticResult(i),h=!a&&c;if(p.useSyncExternalStore(p.useCallback(y=>{const v=h?u.subscribe(et.batchCalls(y)):xt;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),p.useEffect(()=>{u.setOptions(i)},[i,u]),by(i,m))throw Xd(i,u,n);if(xy({result:m,errorResetBoundary:n,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw m.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,i,m),i.experimental_prefetchInRender&&!bn.isServer()&&fy(m,a)){const y=d?Xd(i,u,n):l==null?void 0:l.promise;y==null||y.catch(xt).finally(()=>{u.updateResult()})}return i.notifyOnChangeProps?m:u.trackResult(m)}function li(e,s){return yy(e,ey)}function ci(e,s){const r=Fa(),[a]=p.useState(()=>new ny(r,e));p.useEffect(()=>{a.setOptions(e)},[a,e]);const n=p.useSyncExternalStore(p.useCallback(i=>a.subscribe(et.batchCalls(i)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=p.useCallback((i,l)=>{a.mutate(i,l).catch(xt)},[a]);if(n.error&&Fc(a.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const vy="modulepreload",jy=function(e){return"/"+e},Zd={},cr=function(s,r,a){let n=Promise.resolve();if(r&&r.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(r.map(d=>{if(d=jy(d),d in Zd)return;Zd[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":vy,u||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((x,f)=>{h.addEventListener("load",x),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-fnA2DmhE.js","assets/vendor-utils-VkF_O5b_.js","assets/vendor-flow-Ct2sLZk5.js","assets/vendor-charts-BkHP8M8k.js","assets/InferencePage-Csb-l3Ft.js","assets/EDAPage-viLu1lUt.js","assets/FormField-BaO1-ftW.js","assets/vendor-plotly-EQ6XkBLq.js","assets/EDAPage-Dgihpmma.css","assets/DataDriftPage-C5Xkdsih.js","assets/ModelRegistry-CrF65Lot.js","assets/DeploymentsPage-CB5LtP6P.js","assets/SlowNodesPage-82nWt6wC.js","assets/AuditLogPage-DIZX5m-b.js"])))=>i.map(i=>d[i]); +var y0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var v0=(e,s,r)=>s in e?y0(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var Pt=(e,s,r)=>v0(e,typeof s!="symbol"?s+"":s,r),zi=(e,s,r)=>s.has(e)||zd("Cannot "+r);var C=(e,s,r)=>(zi(e,s,"read from private field"),r?r.call(e):s.get(e)),ne=(e,s,r)=>s.has(e)?zd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,r),Q=(e,s,r,a)=>(zi(e,s,"write to private field"),a?a.call(e,r):s.set(e,r),r),he=(e,s,r)=>(zi(e,s,"access private method"),r);var lo=(e,s,r,a)=>({set _(n){Q(e,s,n,r)},get _(){return C(e,s,a)}});import{j as t,c as Np,b as Bi,d as j0,e as w0,f as kp,g as An,H as wl,P as as,h as N0,k as k0,l as _p,m as _0,E as S0,R as Sp,i as Cp,B as Ep,C as Rp,n as Kt,M as C0}from"./vendor-flow-Ct2sLZk5.js";import{g as Tp,a as p,b as ae,af as Mp,aC as E0,X as Ee,Q as $n,f as $t,j as Te,a6 as Qe,aD as vc,aE as R0,ar as Pp,a7 as at,a5 as Fn,T as jc,aw as ds,a9 as Ct,A as T0,d as Pa,aF as ri,i as M0,u as P0,aG as I0,aH as A0,D as ge,c as us,aI as $0,C as _t,an as Nl,z as ir,e as Ut,x as Ip,aa as Ie,J as Dn,a0 as Ap,a1 as $p,q as Es,l as ms,aJ as wc,L as Ln,w as F0,N as D0,o as Dr,aK as L0,ab as O0,m as z0,p as Ce,k as tt,aL as kl,aM as ai,aN as hn,aO as B0,_ as Ia,aP as Fp,s as Nc,y as gt,ai as _l,S as lr,Y as On,az as Dp,K as Ae,ap as V0,aq as U0,R as Lp,aB as kc,aQ as xn,aR as H0,aS as _c,aT as Sc,v as tr,aU as W0,aV as Aa,aA as Op,aW as G0,ak as gn,aX as zp,aY as Bp,aZ as q0,a_ as K0,a$ as J0,b0 as Sl,b1 as Y0,W as ni,t as oi,ac as Cc,b2 as Vp,b3 as Q0,b4 as zn,b5 as X0,as as Up,b6 as Zt,ax as Ec,b7 as Z0,V as eb,am as tb,b8 as sb,b9 as rb,ba as ab,bb as Hp,bc as Wp,bd as nb,be as ob,bf as ib,bg as lb,bh as cb,Z as Cl,bi as Rc,bj as Tc,ag as Gp,bk as ii,bl as db,bm as ub,bn as mb,bo as qp,bp as pb,bq as hb,a4 as Kp,br as xb,bs as gb,h as Mc,bt as fb,bu as bb,bv as yb,bw as vb,bx as jb,H as Jp,by as Yp,bz as Qp,bA as Pc,bB as wb,bC as Bd,bD as Nb,bE as kb,bF as _b,bG as Sb}from"./vendor-utils-VkF_O5b_.js";import{aY as Cb,u as Eb,r as Bn,R as $e,B as Jt,C as Ue,X as Oe,Y as ze,T as Fe,h as lt,aj as Rb,ak as Tb,j as wa,ah as Lr,aZ as Mb,ag as Pb,ai as ht,av as Ib,a_ as pr,a$ as Ab,as as ct,au as hr,at as Zr,b0 as Vi,b1 as Vd}from"./vendor-charts-BkHP8M8k.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var co={},Ud;function $b(){if(Ud)return co;Ud=1;var e=Cb();return co.createRoot=e.createRoot,co.hydrateRoot=e.hydrateRoot,co}var Fb=$b();const Db=Tp(Fb);var $a=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},br,Hs,ca,mp,Lb=(mp=class extends $a{constructor(){super();ne(this,br);ne(this,Hs);ne(this,ca);Q(this,ca,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){C(this,Hs)||this.setEventListener(C(this,ca))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Hs))==null||s.call(this),Q(this,Hs,void 0))}setEventListener(s){var r;Q(this,ca,s),(r=C(this,Hs))==null||r.call(this),Q(this,Hs,s(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(s){C(this,br)!==s&&(Q(this,br,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(r=>{r(s)})}isFocused(){var s;return typeof C(this,br)=="boolean"?C(this,br):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},br=new WeakMap,Hs=new WeakMap,ca=new WeakMap,mp),Ic=new Lb,Ob={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},Ws,yc,pp,zb=(pp=class{constructor(){ne(this,Ws,Ob);ne(this,yc,!1)}setTimeoutProvider(e){Q(this,Ws,e)}setTimeout(e,s){return C(this,Ws).setTimeout(e,s)}clearTimeout(e){C(this,Ws).clearTimeout(e)}setInterval(e,s){return C(this,Ws).setInterval(e,s)}clearInterval(e){C(this,Ws).clearInterval(e)}},Ws=new WeakMap,yc=new WeakMap,pp),gr=new zb;function Bb(e){setTimeout(e,0)}var Vb=typeof window>"u"||"Deno"in globalThis;function xt(){}function Ub(e,s){return typeof e=="function"?e(s):e}function El(e){return typeof e=="number"&&e>=0&&e!==1/0}function Xp(e,s){return Math.max(e+(s||0)-Date.now(),0)}function Zs(e,s){return typeof e=="function"?e(s):e}function wt(e,s){return typeof e=="function"?e(s):e}function Hd(e,s){const{type:r="all",exact:a,fetchStatus:n,predicate:o,queryKey:i,stale:l}=e;if(i){if(a){if(s.queryHash!==Ac(i,s.options))return!1}else if(!fn(s.queryKey,i))return!1}if(r!=="all"){const c=s.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&s.isStale()!==l||n&&n!==s.state.fetchStatus||o&&!o(s))}function Wd(e,s){const{exact:r,status:a,predicate:n,mutationKey:o}=e;if(o){if(!s.options.mutationKey)return!1;if(r){if(Mr(s.options.mutationKey)!==Mr(o))return!1}else if(!fn(s.options.mutationKey,o))return!1}return!(a&&s.state.status!==a||n&&!n(s))}function Ac(e,s){return((s==null?void 0:s.queryKeyHashFn)||Mr)(e)}function Mr(e){return JSON.stringify(e,(s,r)=>Rl(r)?Object.keys(r).sort().reduce((a,n)=>(a[n]=r[n],a),{}):r)}function fn(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(r=>fn(e[r],s[r])):!1}var Hb=Object.prototype.hasOwnProperty;function Zp(e,s,r=0){if(e===s)return e;if(r>500)return s;const a=Gd(e)&&Gd(s);if(!a&&!(Rl(e)&&Rl(s)))return s;const o=(a?e:Object.keys(e)).length,i=a?s:Object.keys(s),l=i.length,c=a?new Array(l):{};let d=0;for(let u=0;u{gr.setTimeout(s,e)})}function Tl(e,s,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,s):r.structuralSharing!==!1?Zp(e,s):s}function Gb(e,s,r=0){const a=[...e,s];return r&&a.length>r?a.slice(1):a}function qb(e,s,r=0){const a=[s,...e];return r&&a.length>r?a.slice(0,-1):a}var $c=Symbol();function eh(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===$c?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fc(e,s){return typeof e=="function"?e(...s):!!e}function Kb(e,s,r){let a=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=s()),a||(a=!0,n.aborted?r():n.addEventListener("abort",r,{once:!0})),n)}),e}var bn=(()=>{let e=()=>Vb;return{isServer(){return e()},setIsServer(s){e=s}}})();function Ml(){let e,s;const r=new Promise((n,o)=>{e=n,s=o});r.status="pending",r.catch(()=>{});function a(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{a({status:"fulfilled",value:n}),e(n)},r.reject=n=>{a({status:"rejected",reason:n}),s(n)},r}var Jb=Bb;function Yb(){let e=[],s=0,r=l=>{l()},a=l=>{l()},n=Jb;const o=l=>{s?e.push(l):n(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&n(()=>{a(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;s++;try{c=l()}finally{s--,s||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{a=l},setScheduler:l=>{n=l}}}var et=Yb(),da,Gs,ua,hp,Qb=(hp=class extends $a{constructor(){super();ne(this,da,!0);ne(this,Gs);ne(this,ua);Q(this,ua,s=>{if(typeof window<"u"&&window.addEventListener){const r=()=>s(!0),a=()=>s(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}})}onSubscribe(){C(this,Gs)||this.setEventListener(C(this,ua))}onUnsubscribe(){var s;this.hasListeners()||((s=C(this,Gs))==null||s.call(this),Q(this,Gs,void 0))}setEventListener(s){var r;Q(this,ua,s),(r=C(this,Gs))==null||r.call(this),Q(this,Gs,s(this.setOnline.bind(this)))}setOnline(s){C(this,da)!==s&&(Q(this,da,s),this.listeners.forEach(a=>{a(s)}))}isOnline(){return C(this,da)}},da=new WeakMap,Gs=new WeakMap,ua=new WeakMap,hp),zo=new Qb;function Xb(e){return Math.min(1e3*2**e,3e4)}function th(e){return(e??"online")==="online"?zo.isOnline():!0}var Pl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function sh(e){let s=!1,r=0,a;const n=Ml(),o=()=>n.status!=="pending",i=g=>{var b;if(!o()){const y=new Pl(g);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{s=!0},c=()=>{s=!1},d=()=>Ic.isFocused()&&(e.networkMode==="always"||zo.isOnline())&&e.canRun(),u=()=>th(e.networkMode)&&e.canRun(),m=g=>{o()||(a==null||a(),n.resolve(g))},h=g=>{o()||(a==null||a(),n.reject(g))},x=()=>new Promise(g=>{var b;a=y=>{(o()||d())&&g(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var g;a=void 0,o()||(g=e.onContinue)==null||g.call(e)}),f=()=>{if(o())return;let g;const b=r===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(m).catch(y=>{var k;if(o())return;const v=e.retry??(bn.isServer()?0:3),j=e.retryDelay??Xb,w=typeof j=="function"?j(r,y):j,N=v===!0||typeof v=="number"&&rd()?void 0:x()).then(()=>{s?h(y):f()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(a==null||a(),n),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?f():x().then(f),n)}}var yr,xp,rh=(xp=class{constructor(){ne(this,yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),El(this.gcTime)&&Q(this,yr,gr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bn.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,yr)!==void 0&&(gr.clearTimeout(C(this,yr)),Q(this,yr,void 0))}},yr=new WeakMap,xp);function Zb(e){return{onFetch:(s,r)=>{var u,m,h,x,f;const a=s.options,n=(h=(m=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,o=((x=s.state.data)==null?void 0:x.pages)||[],i=((f=s.state.data)==null?void 0:f.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const b=j=>{Kb(j,()=>s.signal,()=>g=!0)},y=eh(s.options,s.fetchOptions),v=async(j,w,N)=>{if(g)return Promise.reject(s.signal.reason);if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const M={client:s.client,queryKey:s.queryKey,pageParam:w,direction:N?"backward":"forward",meta:s.options.meta};return b(M),M})(),R=await y(_),{maxPages:P}=s.options,E=N?qb:Gb;return{pages:E(j.pages,R,P),pageParams:E(j.pageParams,w,P)}};if(n&&o.length){const j=n==="backward",w=j?ah:Il,N={pages:o,pageParams:i},k=w(a,N);l=await v(N,k,j)}else{const j=e??o.length;do{const w=c===0?i[0]??a.initialPageParam:Il(a,l);if(c>0&&w==null)break;l=await v(l,w),c++}while(c{var g,b;return(b=(g=s.options).persister)==null?void 0:b.call(g,d,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},r)}:s.fetchFn=d}}}function Il(e,{pages:s,pageParams:r}){const a=s.length-1;return s.length>0?e.getNextPageParam(s[a],s,r[a],r):void 0}function ah(e,{pages:s,pageParams:r}){var a;return s.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,s[0],s,r[0],r):void 0}function h6(e,s){return s?Il(e,s)!=null:!1}function x6(e,s){return!s||!e.getPreviousPageParam?!1:ah(e,s)!=null}var ma,vr,pa,At,jr,rt,Rn,wr,jt,nh,ys,gp,ey=(gp=class extends rh{constructor(s){super();ne(this,jt);ne(this,ma);ne(this,vr);ne(this,pa);ne(this,At);ne(this,jr);ne(this,rt);ne(this,Rn);ne(this,wr);Q(this,wr,!1),Q(this,Rn,s.defaultOptions),this.setOptions(s.options),this.observers=[],Q(this,jr,s.client),Q(this,At,C(this,jr).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Q(this,vr,Jd(this.options)),this.state=s.state??C(this,vr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,ma)}get promise(){var s;return(s=C(this,rt))==null?void 0:s.promise}setOptions(s){if(this.options={...C(this,Rn),...s},s!=null&&s._type&&Q(this,ma,s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Jd(this.options);r.data!==void 0&&(this.setState(Kd(r.data,r.dataUpdatedAt)),Q(this,vr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,At).remove(this)}setData(s,r){const a=Tl(this.state.data,s,this.options);return he(this,jt,ys).call(this,{data:a,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),a}setState(s){he(this,jt,ys).call(this,{type:"setState",state:s})}cancel(s){var a,n;const r=(a=C(this,rt))==null?void 0:a.promise;return(n=C(this,rt))==null||n.cancel(s),r?r.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,vr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>wt(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$c||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>Zs(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Xp(this.state.dataUpdatedAt,s)}onFocus(){var r;const s=this.observers.find(a=>a.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}onOnline(){var r;const s=this.observers.find(a=>a.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(r=C(this,rt))==null||r.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),C(this,At).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(r=>r!==s),this.observers.length||(C(this,rt)&&(C(this,wr)||he(this,jt,nh).call(this)?C(this,rt).cancel({revert:!0}):C(this,rt).cancelRetry()),this.scheduleGc()),C(this,At).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,ys).call(this,{type:"invalidate"})}async fetch(s,r){var d,u,m,h,x,f,g,b,y,v,j;if(this.state.fetchStatus!=="idle"&&((d=C(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(C(this,rt))return C(this,rt).continueRetry(),C(this,rt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const w=this.observers.find(N=>N.options.queryFn);w&&this.setOptions(w.options)}const a=new AbortController,n=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Q(this,wr,!0),a.signal)})},o=()=>{const w=eh(this.options,r),k=(()=>{const _={client:C(this,jr),queryKey:this.queryKey,meta:this.meta};return n(_),_})();return Q(this,wr,!1),this.options.persister?this.options.persister(w,k,this):w(k)},l=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:C(this,jr),state:this.state,fetchFn:o};return n(w),w})(),c=C(this,ma)==="infinite"?Zb(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Q(this,pa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&he(this,jt,ys).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Q(this,rt,sh({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Pl&&w.revert&&this.setState({...C(this,pa),fetchStatus:"idle"}),a.abort()},onFail:(w,N)=>{he(this,jt,ys).call(this,{type:"failed",failureCount:w,error:N})},onPause:()=>{he(this,jt,ys).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,ys).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await C(this,rt).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(x=(h=C(this,At).config).onSuccess)==null||x.call(h,w,this),(g=(f=C(this,At).config).onSettled)==null||g.call(f,w,this.state.error,this),w}catch(w){if(w instanceof Pl){if(w.silent)return C(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,jt,ys).call(this,{type:"error",error:w}),(y=(b=C(this,At).config).onError)==null||y.call(b,w,this),(j=(v=C(this,At).config).onSettled)==null||j.call(v,this.state.data,w,this),w}finally{this.scheduleGc()}}},ma=new WeakMap,vr=new WeakMap,pa=new WeakMap,At=new WeakMap,jr=new WeakMap,rt=new WeakMap,Rn=new WeakMap,wr=new WeakMap,jt=new WeakSet,nh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ys=function(s){const r=a=>{switch(s.type){case"failed":return{...a,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...oh(a.data,this.options),fetchMeta:s.meta??null};case"success":const n={...a,...Kd(s.data,s.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Q(this,pa,s.manual?n:void 0),n;case"error":const o=s.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...s.state}}};this.state=r(this.state),et.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),C(this,At).notify({query:this,type:"updated",action:s})})},gp);function oh(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:th(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kd(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Jd(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,r=s!==void 0,a=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:r?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ft,ye,Tn,mt,Nr,ha,vs,qs,Mn,xa,ga,kr,_r,Ks,fa,ke,cn,Al,$l,Fl,Dl,Ll,Ol,zl,ih,fp,ty=(fp=class extends $a{constructor(s,r){super();ne(this,ke);ne(this,ft);ne(this,ye);ne(this,Tn);ne(this,mt);ne(this,Nr);ne(this,ha);ne(this,vs);ne(this,qs);ne(this,Mn);ne(this,xa);ne(this,ga);ne(this,kr);ne(this,_r);ne(this,Ks);ne(this,fa,new Set);this.options=r,Q(this,ft,s),Q(this,qs,null),Q(this,vs,Ml()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ye).addObserver(this),Yd(C(this,ye),this.options)?he(this,ke,cn).call(this):this.updateResult(),he(this,ke,Dl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bl(C(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bl(C(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,ke,Ll).call(this),he(this,ke,Ol).call(this),C(this,ye).removeObserver(this)}setOptions(s){const r=this.options,a=C(this,ye);if(this.options=C(this,ft).defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wt(this.options.enabled,C(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,ke,zl).call(this),C(this,ye).setOptions(this.options),r._defaulted&&!Oo(this.options,r)&&C(this,ft).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ye),observer:this});const n=this.hasListeners();n&&Qd(C(this,ye),a,this.options,r)&&he(this,ke,cn).call(this),this.updateResult(),n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||Zs(this.options.staleTime,C(this,ye))!==Zs(r.staleTime,C(this,ye)))&&he(this,ke,Al).call(this);const o=he(this,ke,$l).call(this);n&&(C(this,ye)!==a||wt(this.options.enabled,C(this,ye))!==wt(r.enabled,C(this,ye))||o!==C(this,Ks))&&he(this,ke,Fl).call(this,o)}getOptimisticResult(s){const r=C(this,ft).getQueryCache().build(C(this,ft),s),a=this.createResult(r,s);return ry(this,a)&&(Q(this,mt,a),Q(this,ha,this.options),Q(this,Nr,C(this,ye).state)),a}getCurrentResult(){return C(this,mt)}trackResult(s,r){return new Proxy(s,{get:(a,n)=>(this.trackProp(n),r==null||r(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,vs).status==="pending"&&C(this,vs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,n))})}trackProp(s){C(this,fa).add(s)}getCurrentQuery(){return C(this,ye)}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const r=C(this,ft).defaultQueryOptions(s),a=C(this,ft).getQueryCache().build(C(this,ft),r);return a.fetch().then(()=>this.createResult(a,r))}fetch(s){return he(this,ke,cn).call(this,{...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,mt)))}createResult(s,r){var P;const a=C(this,ye),n=this.options,o=C(this,mt),i=C(this,Nr),l=C(this,ha),d=s!==a?s.state:C(this,Tn),{state:u}=s;let m={...u},h=!1,x;if(r._optimisticResults){const E=this.hasListeners(),M=!E&&Yd(s,r),S=E&&Qd(s,a,r,n);(M||S)&&(m={...m,...oh(u.data,s.options)}),r._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:b}=m;x=m.data;let y=!1;if(r.placeholderData!==void 0&&x===void 0&&b==="pending"){let E;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(E=o.data,y=!0):E=typeof r.placeholderData=="function"?r.placeholderData((P=C(this,ga))==null?void 0:P.state.data,C(this,ga)):r.placeholderData,E!==void 0&&(b="success",x=Tl(o==null?void 0:o.data,E,r),h=!0)}if(r.select&&x!==void 0&&!y)if(o&&x===(i==null?void 0:i.data)&&r.select===C(this,Mn))x=C(this,xa);else try{Q(this,Mn,r.select),x=r.select(x),x=Tl(o==null?void 0:o.data,x,r),Q(this,xa,x),Q(this,qs,null)}catch(E){Q(this,qs,E)}C(this,qs)&&(f=C(this,qs),x=C(this,xa),g=Date.now(),b="error");const v=m.fetchStatus==="fetching",j=b==="pending",w=b==="error",N=j&&v,k=x!==void 0,R={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:w,isInitialLoading:N,isLoading:N,data:x,dataUpdatedAt:m.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!j,isLoadingError:w&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&k,isStale:Dc(s,r),refetch:this.refetch,promise:C(this,vs),isEnabled:wt(r.enabled,s)!==!1};if(this.options.experimental_prefetchInRender){const E=R.data!==void 0,M=R.status==="error"&&!E,S=A=>{M?A.reject(R.error):E&&A.resolve(R.data)},T=()=>{const A=Q(this,vs,R.promise=Ml());S(A)},I=C(this,vs);switch(I.status){case"pending":s.queryHash===a.queryHash&&S(I);break;case"fulfilled":(M||R.data!==I.value)&&T();break;case"rejected":(!M||R.error!==I.reason)&&T();break}}return R}updateResult(){const s=C(this,mt),r=this.createResult(C(this,ye),this.options);if(Q(this,Nr,C(this,ye).state),Q(this,ha,this.options),C(this,Nr).data!==void 0&&Q(this,ga,C(this,ye)),Oo(r,s))return;Q(this,mt,r);const a=()=>{if(!s)return!0;const{notifyOnChangeProps:n}=this.options,o=typeof n=="function"?n():n;if(o==="all"||!o&&!C(this,fa).size)return!0;const i=new Set(o??C(this,fa));return this.options.throwOnError&&i.add("error"),Object.keys(C(this,mt)).some(l=>{const c=l;return C(this,mt)[c]!==s[c]&&i.has(c)})};he(this,ke,ih).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,ke,Dl).call(this)}},ft=new WeakMap,ye=new WeakMap,Tn=new WeakMap,mt=new WeakMap,Nr=new WeakMap,ha=new WeakMap,vs=new WeakMap,qs=new WeakMap,Mn=new WeakMap,xa=new WeakMap,ga=new WeakMap,kr=new WeakMap,_r=new WeakMap,Ks=new WeakMap,fa=new WeakMap,ke=new WeakSet,cn=function(s){he(this,ke,zl).call(this);let r=C(this,ye).fetch(this.options,s);return s!=null&&s.throwOnError||(r=r.catch(xt)),r},Al=function(){he(this,ke,Ll).call(this);const s=Zs(this.options.staleTime,C(this,ye));if(bn.isServer()||C(this,mt).isStale||!El(s))return;const a=Xp(C(this,mt).dataUpdatedAt,s)+1;Q(this,kr,gr.setTimeout(()=>{C(this,mt).isStale||this.updateResult()},a))},$l=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ye)):this.options.refetchInterval)??!1},Fl=function(s){he(this,ke,Ol).call(this),Q(this,Ks,s),!(bn.isServer()||wt(this.options.enabled,C(this,ye))===!1||!El(C(this,Ks))||C(this,Ks)===0)&&Q(this,_r,gr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ic.isFocused())&&he(this,ke,cn).call(this)},C(this,Ks)))},Dl=function(){he(this,ke,Al).call(this),he(this,ke,Fl).call(this,he(this,ke,$l).call(this))},Ll=function(){C(this,kr)!==void 0&&(gr.clearTimeout(C(this,kr)),Q(this,kr,void 0))},Ol=function(){C(this,_r)!==void 0&&(gr.clearInterval(C(this,_r)),Q(this,_r,void 0))},zl=function(){const s=C(this,ft).getQueryCache().build(C(this,ft),this.options);if(s===C(this,ye))return;const r=C(this,ye);Q(this,ye,s),Q(this,Tn,s.state),this.hasListeners()&&(r==null||r.removeObserver(this),s.addObserver(this))},ih=function(s){et.batch(()=>{s.listeners&&this.listeners.forEach(r=>{r(C(this,mt))}),C(this,ft).getQueryCache().notify({query:C(this,ye),type:"observerResultsUpdated"})})},fp);function sy(e,s){return wt(s.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&wt(s.retryOnMount,e)===!1)}function Yd(e,s){return sy(e,s)||e.state.data!==void 0&&Bl(e,s,s.refetchOnMount)}function Bl(e,s,r){if(wt(s.enabled,e)!==!1&&Zs(s.staleTime,e)!=="static"){const a=typeof r=="function"?r(e):r;return a==="always"||a!==!1&&Dc(e,s)}return!1}function Qd(e,s,r,a){return(e!==s||wt(a.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Dc(e,r)}function Dc(e,s){return wt(s.enabled,e)!==!1&&e.isStaleByTime(Zs(s.staleTime,e))}function ry(e,s){return!Oo(e.getCurrentResult(),s)}var Pn,es,it,Sr,ts,Bs,bp,ay=(bp=class extends rh{constructor(s){super();ne(this,ts);ne(this,Pn);ne(this,es);ne(this,it);ne(this,Sr);Q(this,Pn,s.client),this.mutationId=s.mutationId,Q(this,it,s.mutationCache),Q(this,es,[]),this.state=s.state||lh(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){C(this,es).includes(s)||(C(this,es).push(s),this.clearGcTimeout(),C(this,it).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Q(this,es,C(this,es).filter(r=>r!==s)),this.scheduleGc(),C(this,it).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){C(this,es).length||(this.state.status==="pending"?this.scheduleGc():C(this,it).remove(this))}continue(){var s;return((s=C(this,Sr))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,l,c,d,u,m,h,x,f,g,b,y,v,j,w,N,k,_;const r=()=>{he(this,ts,Bs).call(this,{type:"continue"})},a={client:C(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};Q(this,Sr,sh({fn:()=>this.options.mutationFn?this.options.mutationFn(s,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,P)=>{he(this,ts,Bs).call(this,{type:"failed",failureCount:R,error:P})},onPause:()=>{he(this,ts,Bs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,it).canRun(this)}));const n=this.state.status==="pending",o=!C(this,Sr).canStart();try{if(n)r();else{he(this,ts,Bs).call(this,{type:"pending",variables:s,isPaused:o}),C(this,it).config.onMutate&&await C(this,it).config.onMutate(s,this,a);const P=await((l=(i=this.options).onMutate)==null?void 0:l.call(i,s,a));P!==this.state.context&&he(this,ts,Bs).call(this,{type:"pending",context:P,variables:s,isPaused:o})}const R=await C(this,Sr).start();return await((d=(c=C(this,it).config).onSuccess)==null?void 0:d.call(c,R,s,this.state.context,this,a)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,R,s,this.state.context,a)),await((x=(h=C(this,it).config).onSettled)==null?void 0:x.call(h,R,null,this.state.variables,this.state.context,this,a)),await((g=(f=this.options).onSettled)==null?void 0:g.call(f,R,null,s,this.state.context,a)),he(this,ts,Bs).call(this,{type:"success",data:R}),R}catch(R){try{await((y=(b=C(this,it).config).onError)==null?void 0:y.call(b,R,s,this.state.context,this,a))}catch(P){Promise.reject(P)}try{await((j=(v=this.options).onError)==null?void 0:j.call(v,R,s,this.state.context,a))}catch(P){Promise.reject(P)}try{await((N=(w=C(this,it).config).onSettled)==null?void 0:N.call(w,void 0,R,this.state.variables,this.state.context,this,a))}catch(P){Promise.reject(P)}try{await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,R,s,this.state.context,a))}catch(P){Promise.reject(P)}throw he(this,ts,Bs).call(this,{type:"error",error:R}),R}finally{C(this,it).runNext(this)}}},Pn=new WeakMap,es=new WeakMap,it=new WeakMap,Sr=new WeakMap,ts=new WeakSet,Bs=function(s){const r=a=>{switch(s.type){case"failed":return{...a,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...a,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:s.error,failureCount:a.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=r(this.state),et.batch(()=>{C(this,es).forEach(a=>{a.onMutationUpdate(s)}),C(this,it).notify({mutation:this,type:"updated",action:s})})},bp);function lh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var js,Lt,In,yp,ny=(yp=class extends $a{constructor(s={}){super();ne(this,js);ne(this,Lt);ne(this,In);this.config=s,Q(this,js,new Set),Q(this,Lt,new Map),Q(this,In,0)}build(s,r,a){const n=new ay({client:s,mutationCache:this,mutationId:++lo(this,In)._,options:s.defaultMutationOptions(r),state:a});return this.add(n),n}add(s){C(this,js).add(s);const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);a?a.push(s):C(this,Lt).set(r,[s])}this.notify({type:"added",mutation:s})}remove(s){if(C(this,js).delete(s)){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r);if(a)if(a.length>1){const n=a.indexOf(s);n!==-1&&a.splice(n,1)}else a[0]===s&&C(this,Lt).delete(r)}}this.notify({type:"removed",mutation:s})}canRun(s){const r=uo(s);if(typeof r=="string"){const a=C(this,Lt).get(r),n=a==null?void 0:a.find(o=>o.state.status==="pending");return!n||n===s}else return!0}runNext(s){var a;const r=uo(s);if(typeof r=="string"){const n=(a=C(this,Lt).get(r))==null?void 0:a.find(o=>o!==s&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{C(this,js).forEach(s=>{this.notify({type:"removed",mutation:s})}),C(this,js).clear(),C(this,Lt).clear()})}getAll(){return Array.from(C(this,js))}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Wd(r,a))}findAll(s={}){return this.getAll().filter(r=>Wd(s,r))}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}resumePausedMutations(){const s=this.getAll().filter(r=>r.state.isPaused);return et.batch(()=>Promise.all(s.map(r=>r.continue().catch(xt))))}},js=new WeakMap,Lt=new WeakMap,In=new WeakMap,yp);function uo(e){var s;return(s=e.options.scope)==null?void 0:s.id}var ws,Js,bt,Ns,ks,To,Vl,vp,oy=(vp=class extends $a{constructor(r,a){super();ne(this,ks);ne(this,ws);ne(this,Js);ne(this,bt);ne(this,Ns);Q(this,ws,r),this.setOptions(a),this.bindMethods(),he(this,ks,To).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var n;const a=this.options;this.options=C(this,ws).defaultMutationOptions(r),Oo(this.options,a)||C(this,ws).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,bt),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Mr(a.mutationKey)!==Mr(this.options.mutationKey)?this.reset():((n=C(this,bt))==null?void 0:n.state.status)==="pending"&&C(this,bt).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=C(this,bt))==null||r.removeObserver(this)}onMutationUpdate(r){he(this,ks,To).call(this),he(this,ks,Vl).call(this,r)}getCurrentResult(){return C(this,Js)}reset(){var r;(r=C(this,bt))==null||r.removeObserver(this),Q(this,bt,void 0),he(this,ks,To).call(this),he(this,ks,Vl).call(this)}mutate(r,a){var n;return Q(this,Ns,a),(n=C(this,bt))==null||n.removeObserver(this),Q(this,bt,C(this,ws).getMutationCache().build(C(this,ws),this.options)),C(this,bt).addObserver(this),C(this,bt).execute(r)}},ws=new WeakMap,Js=new WeakMap,bt=new WeakMap,Ns=new WeakMap,ks=new WeakSet,To=function(){var a;const r=((a=C(this,bt))==null?void 0:a.state)??lh();Q(this,Js,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Vl=function(r){et.batch(()=>{var a,n,o,i,l,c,d,u;if(C(this,Ns)&&this.hasListeners()){const m=C(this,Js).variables,h=C(this,Js).context,x={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(n=(a=C(this,Ns)).onSuccess)==null||n.call(a,r.data,m,h,x)}catch(f){Promise.reject(f)}try{(i=(o=C(this,Ns)).onSettled)==null||i.call(o,r.data,null,m,h,x)}catch(f){Promise.reject(f)}}else if((r==null?void 0:r.type)==="error"){try{(c=(l=C(this,Ns)).onError)==null||c.call(l,r.error,m,h,x)}catch(f){Promise.reject(f)}try{(u=(d=C(this,Ns)).onSettled)==null||u.call(d,void 0,r.error,m,h,x)}catch(f){Promise.reject(f)}}}this.listeners.forEach(m=>{m(C(this,Js))})})},vp),ss,jp,iy=(jp=class extends $a{constructor(s={}){super();ne(this,ss);this.config=s,Q(this,ss,new Map)}build(s,r,a){const n=r.queryKey,o=r.queryHash??Ac(n,r);let i=this.get(o);return i||(i=new ey({client:s,queryKey:n,queryHash:o,options:s.defaultQueryOptions(r),state:a,defaultOptions:s.getQueryDefaults(n)}),this.add(i)),i}add(s){C(this,ss).has(s.queryHash)||(C(this,ss).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const r=C(this,ss).get(s.queryHash);r&&(s.destroy(),r===s&&C(this,ss).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){et.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return C(this,ss).get(s)}getAll(){return[...C(this,ss).values()]}find(s){const r={exact:!0,...s};return this.getAll().find(a=>Hd(r,a))}findAll(s={}){const r=this.getAll();return Object.keys(s).length>0?r.filter(a=>Hd(s,a)):r}notify(s){et.batch(()=>{this.listeners.forEach(r=>{r(s)})})}onFocus(){et.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},ss=new WeakMap,jp),Ge,Ys,Qs,ba,ya,Xs,va,ja,wp,ly=(wp=class{constructor(e={}){ne(this,Ge);ne(this,Ys);ne(this,Qs);ne(this,ba);ne(this,ya);ne(this,Xs);ne(this,va);ne(this,ja);Q(this,Ge,e.queryCache||new iy),Q(this,Ys,e.mutationCache||new ny),Q(this,Qs,e.defaultOptions||{}),Q(this,ba,new Map),Q(this,ya,new Map),Q(this,Xs,0)}mount(){lo(this,Xs)._++,C(this,Xs)===1&&(Q(this,va,Ic.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onFocus())})),Q(this,ja,zo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,Ge).onOnline())})))}unmount(){var e,s;lo(this,Xs)._--,C(this,Xs)===0&&((e=C(this,va))==null||e.call(this),Q(this,va,void 0),(s=C(this,ja))==null||s.call(this),Q(this,ja,void 0))}isFetching(e){return C(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),r=C(this,Ge).build(this,s),a=r.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Zs(s.staleTime,r))&&this.prefetchQuery(s),Promise.resolve(a))}getQueriesData(e){return C(this,Ge).findAll(e).map(({queryKey:s,state:r})=>{const a=r.data;return[s,a]})}setQueryData(e,s,r){const a=this.defaultQueryOptions({queryKey:e}),n=C(this,Ge).get(a.queryHash),o=n==null?void 0:n.state.data,i=Ub(s,o);if(i!==void 0)return C(this,Ge).build(this,a).setData(i,{...r,manual:!0})}setQueriesData(e,s,r){return et.batch(()=>C(this,Ge).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,s,r)]))}getQueryState(e){var r;const s=this.defaultQueryOptions({queryKey:e});return(r=C(this,Ge).get(s.queryHash))==null?void 0:r.state}removeQueries(e){const s=C(this,Ge);et.batch(()=>{s.findAll(e).forEach(r=>{s.remove(r)})})}resetQueries(e,s){const r=C(this,Ge);return et.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const r={revert:!0,...s},a=et.batch(()=>C(this,Ge).findAll(e).map(n=>n.cancel(r)));return Promise.all(a).then(xt).catch(xt)}invalidateQueries(e,s={}){return et.batch(()=>(C(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},s)))}refetchQueries(e,s={}){const r={...s,cancelRefetch:s.cancelRefetch??!0},a=et.batch(()=>C(this,Ge).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,r);return r.throwOnError||(o=o.catch(xt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(xt)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const r=C(this,Ge).build(this,s);return r.isStaleByTime(Zs(s.staleTime,r))?r.fetch(s):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zo.isOnline()?C(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,Ge)}getMutationCache(){return C(this,Ys)}getDefaultOptions(){return C(this,Qs)}setDefaultOptions(e){Q(this,Qs,e)}setQueryDefaults(e,s){C(this,ba).set(Mr(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...C(this,ba).values()],r={};return s.forEach(a=>{fn(e,a.queryKey)&&Object.assign(r,a.defaultOptions)}),r}setMutationDefaults(e,s){C(this,ya).set(Mr(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...C(this,ya).values()],r={};return s.forEach(a=>{fn(e,a.mutationKey)&&Object.assign(r,a.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const s={...C(this,Qs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Ac(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===$c&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,Ge).clear(),C(this,Ys).clear()}},Ge=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,ba=new WeakMap,ya=new WeakMap,Xs=new WeakMap,va=new WeakMap,ja=new WeakMap,wp),ch=p.createContext(void 0),Fa=e=>{const s=p.useContext(ch);if(!s)throw new Error("No QueryClient set, use QueryClientProvider to set one");return s},cy=({client:e,children:s})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(ch.Provider,{value:e,children:s})),dh=p.createContext(!1),dy=()=>p.useContext(dh);dh.Provider;function uy(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var my=p.createContext(uy()),py=()=>p.useContext(my),hy=(e,s,r)=>{const a=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Fc(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(s.isReset()||(e.retryOnMount=!1))},xy=e=>{p.useEffect(()=>{e.clearReset()},[e])},gy=({result:e,errorResetBoundary:s,throwOnError:r,query:a,suspense:n})=>e.isError&&!s.isReset()&&!e.isFetching&&a&&(n&&e.data===void 0||Fc(r,[e.error,a])),fy=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...n)=>r(a(...n)):r(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},by=(e,s)=>e.isLoading&&e.isFetching&&!s,yy=(e,s)=>(e==null?void 0:e.suspense)&&s.isPending,Xd=(e,s,r)=>s.fetchOptimistic(e).catch(()=>{r.clearReset()});function vy(e,s,r){var x,f,g,b;const a=dy(),n=py(),o=Fa(),i=o.defaultQueryOptions(e);(f=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||f.call(x,i);const l=o.getQueryCache().get(i.queryHash),c=e.subscribed!==!1;i._optimisticResults=a?"isRestoring":c?"optimistic":void 0,fy(i),hy(i,n,l),xy(n);const d=!o.getQueryCache().get(i.queryHash),[u]=p.useState(()=>new s(o,i)),m=u.getOptimisticResult(i),h=!a&&c;if(p.useSyncExternalStore(p.useCallback(y=>{const v=h?u.subscribe(et.batchCalls(y)):xt;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),p.useEffect(()=>{u.setOptions(i)},[i,u]),yy(i,m))throw Xd(i,u,n);if(gy({result:m,errorResetBoundary:n,throwOnError:i.throwOnError,query:l,suspense:i.suspense}))throw m.error;if((b=(g=o.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,i,m),i.experimental_prefetchInRender&&!bn.isServer()&&by(m,a)){const y=d?Xd(i,u,n):l==null?void 0:l.promise;y==null||y.catch(xt).finally(()=>{u.updateResult()})}return i.notifyOnChangeProps?m:u.trackResult(m)}function li(e,s){return vy(e,ty)}function ci(e,s){const r=Fa(),[a]=p.useState(()=>new oy(r,e));p.useEffect(()=>{a.setOptions(e)},[a,e]);const n=p.useSyncExternalStore(p.useCallback(i=>a.subscribe(et.batchCalls(i)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=p.useCallback((i,l)=>{a.mutate(i,l).catch(xt)},[a]);if(n.error&&Fc(a.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const jy="modulepreload",wy=function(e){return"/"+e},Zd={},cr=function(s,r,a){let n=Promise.resolve();if(r&&r.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(r.map(d=>{if(d=wy(d),d in Zd)return;Zd[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":jy,u||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((x,f)=>{h.addEventListener("load",x),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};/** * react-router v7.18.2 * * Copyright (c) Remix Software Inc. @@ -8,28 +8,28 @@ var b0=Object.defineProperty;var zd=e=>{throw TypeError(e)};var y0=(e,s,r)=>s in * LICENSE.md file in the root directory of this source tree. * * @license MIT - */var Lc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,dh=/^[\\/]{2}/;function wy(e,s){return s+e.replace(/\\/g,"/")}var eu="popstate";function tu(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ny(e={}){function s(a,n){var d;let o=(d=n.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||a.location;return Ul("",{pathname:i,search:l,hash:c},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:yn(n)}return _y(s,r,null,e)}function We(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function Ht(e,s){if(!e){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function ky(){return Math.random().toString(36).substring(2,10)}function su(e,s){return{usr:e.state,key:e.key,idx:s,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ul(e,s,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof s=="string"?Da(s):s,state:r,key:s&&s.key||a||ky(),mask:n}}function yn({pathname:e="/",search:s="",hash:r=""}){return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Da(e){let s={};if(e){let r=e.indexOf("#");r>=0&&(s.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(s.search=e.substring(a),e=e.substring(0,a)),e&&(s.pathname=e)}return s}function _y(e,s,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let b=u(),y=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:y})}function h(b,y){l="PUSH";let v=tu(b)?b:Ul(g.location,b,y);d=u()+1;let j=su(v,d),w=g.createHref(v.mask||v);try{i.pushState(j,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;n.location.assign(w)}o&&c&&c({action:l,location:g.location,delta:1})}function x(b,y){l="REPLACE";let v=tu(b)?b:Ul(g.location,b,y);d=u();let j=su(v,d),w=g.createHref(v.mask||v);i.replaceState(j,"",w),o&&c&&c({action:l,location:g.location,delta:0})}function f(b){return Sy(n,b)}let g={get action(){return l},get location(){return e(n,i)},listen(b){if(c)throw new Error("A history only accepts one active listener");return n.addEventListener(eu,m),c=b,()=>{n.removeEventListener(eu,m),c=null}},createHref(b){return s(n,b)},createURL:f,encodeLocation(b){let y=f(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:x,go(b){return i.go(b)}};return g}function Sy(e,s,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),We(a,"No window.location.(origin|href) available to create URL");let n=typeof s=="string"?s:yn(s);return n=n.replace(/ $/,"%20"),!r&&dh.test(n)&&(n=a+n),new URL(n,a)}function uh(e,s,r="/"){return Cy(e,s,r,!1)}function Cy(e,s,r,a,n){let o=typeof s=="string"?Da(s):s,i=_s(o.pathname||"/",r);if(i==null)return null;let l=Ey(e),c=null,d=Oy(i);for(let u=0;c==null&&u{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&c)return;We(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let m=zt([a,u.relativePath]),h=r.concat(u);i.children&&i.children.length>0&&(We(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),mh(i.children,s,h,m,c)),!(i.path==null&&!i.index)&&s.push({path:m,score:Fy(m,i.index),routesMeta:h.map((x,f)=>{let[g,b]=xh(x.relativePath,x.caseSensitive,f===h.length-1);return{...x,matcher:g,compiledParams:b}})})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of ph(i.path))o(i,l,!0,d)}),s}function ph(e){let s=e.split("/");if(s.length===0)return[];let[r,...a]=s,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=ph(a.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),n&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Ry(e){e.sort((s,r)=>s.score!==r.score?r.score-s.score:Dy(s.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Ty=/^:[\w-]+$/,My=3,Py=2,Iy=1,Ay=10,$y=-2,ru=e=>e==="*";function Fy(e,s){let r=e.split("/"),a=r.length;return r.some(ru)&&(a+=$y),s&&(a+=Py),r.filter(n=>!ru(n)).reduce((n,o)=>n+(Ty.test(o)?My:o===""?Iy:Ay),a)}function Dy(e,s){return e.length===s.length&&e.slice(0,-1).every((a,n)=>a===s[n])?e[e.length-1]-s[s.length-1]:0}function Ly(e,s,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l{if(u==="*"){let f=l[h]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const x=l[h];return m&&!x?d[u]=void 0:d[u]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function xh(e,s=!1,r=!0){Ht(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,u)=>{if(a.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,s?void 0:"i"),a]}function Oy(e){try{return e.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ht(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),e}}function _s(e,s){if(s==="/")return e;if(!e.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function zy(e,s="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Da(e):e,o;return r?(r=fh(r),r.startsWith("/")?o=au(r.substring(1),"/"):o=au(r,s)):o=s,{pathname:o,search:Uy(a),hash:Hy(n)}}function au(e,s){let r=Vo(s).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Ui(e,s,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${s}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function By(e){return e.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function gh(e){let s=By(e);return s.map((r,a)=>a===s.length-1?r.pathname:r.pathnameBase)}function Oc(e,s,r,a=!1){let n;typeof e=="string"?n=Da(e):(n={...e},We(!n.pathname||!n.pathname.includes("?"),Ui("?","pathname","search",n)),We(!n.pathname||!n.pathname.includes("#"),Ui("#","pathname","hash",n)),We(!n.search||!n.search.includes("#"),Ui("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let m=s.length-1;if(!a&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),m-=1;n.pathname=h.join("/")}l=m>=0?s[m]:"/"}let c=zy(n,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var fh=e=>e.replace(/[\\/]{2,}/g,"/"),zt=e=>fh(e.join("/")),Vo=e=>e.replace(/\/+$/,""),Vy=e=>Vo(e).replace(/^\/*/,"/"),Uy=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hy=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Wy=class{constructor(e,s,r,a=!1){this.status=e,this.statusText=s||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Gy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qy(e){let s=e.map(r=>r.route.path).filter(Boolean);return zt(s)||"/"}var bh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yh(e,s){let r=e;if(typeof r!="string"||!Lc.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(bh)try{let o=new URL(window.location.href),i=dh.test(r)?new URL(wy(r,o.protocol)):new URL(r),l=_s(i.pathname,s);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{Ht(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vh=["POST","PUT","PATCH","DELETE"];new Set(vh);var Ky=["GET",...vh];new Set(Ky);var Jy=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Yy(e){try{return Jy.includes(new URL(e).protocol)}catch{return!1}}var La=p.createContext(null);La.displayName="DataRouter";var di=p.createContext(null);di.displayName="DataRouterState";var jh=p.createContext(!1);function Qy(){return p.useContext(jh)}var wh=p.createContext({isTransitioning:!1});wh.displayName="ViewTransition";var Xy=p.createContext(new Map);Xy.displayName="Fetchers";var Zy=p.createContext(null);Zy.displayName="Await";var Ft=p.createContext(null);Ft.displayName="Navigation";var Vn=p.createContext(null);Vn.displayName="Location";var ps=p.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var zc=p.createContext(null);zc.displayName="RouteError";var Nh="REACT_ROUTER_ERROR",ev="REDIRECT",tv="ROUTE_ERROR_RESPONSE";function sv(e){if(e.startsWith(`${Nh}:${ev}:{`))try{let s=JSON.parse(e.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function rv(e){if(e.startsWith(`${Nh}:${tv}:{`))try{let s=JSON.parse(e.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Wy(s.status,s.statusText,s.data)}catch{}}function av(e,{relative:s}={}){We(Un(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:a}=p.useContext(Ft),{hash:n,pathname:o,search:i}=Hn(e,{relative:s}),l=o;return r!=="/"&&(l=o==="/"?r:zt([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Un(){return p.useContext(Vn)!=null}function Rt(){return We(Un(),"useLocation() may be used only in the context of a component."),p.useContext(Vn).location}var kh="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _h(e){p.useContext(Ft).static||p.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=p.useContext(ps);return e?yv():nv()}function nv(){We(Un(),"useNavigate() may be used only in the context of a component.");let e=p.useContext(La),{basename:s,navigator:r}=p.useContext(Ft),{matches:a}=p.useContext(ps),{pathname:n}=Rt(),o=JSON.stringify(gh(a)),i=p.useRef(!1);return _h(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(Ht(i.current,kh),!i.current)return;if(typeof c=="number"){r.go(c);return}let u=Oc(c,JSON.parse(o),n,d.relative==="path");e==null&&s!=="/"&&(u.pathname=u.pathname==="/"?s:zt([s,u.pathname])),(d.replace?r.replace:r.push)(u,d.state,d)},[s,r,o,n,e])}var ov=p.createContext(null);function iv(e){let s=p.useContext(ps).outlet;return p.useMemo(()=>s&&p.createElement(ov.Provider,{value:e},s),[s,e])}function Hn(e,{relative:s}={}){let{matches:r}=p.useContext(ps),{pathname:a}=Rt(),n=JSON.stringify(gh(r));return p.useMemo(()=>Oc(e,JSON.parse(n),a,s==="path"),[e,n,a,s])}function lv(e,s){return Sh(e,s)}function Sh(e,s,r){var b;We(Un(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=p.useContext(Ft),{matches:n}=p.useContext(ps),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let y=d&&d.path||"";Eh(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${l}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + */var Lc=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,uh=/^[\\/]{2}/;function Ny(e,s){return s+e.replace(/\\/g,"/")}var eu="popstate";function tu(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ky(e={}){function s(a,n){var d;let o=(d=n.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||a.location;return Ul("",{pathname:i,search:l,hash:c},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:yn(n)}return Sy(s,r,null,e)}function We(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function Ht(e,s){if(!e){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function _y(){return Math.random().toString(36).substring(2,10)}function su(e,s){return{usr:e.state,key:e.key,idx:s,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ul(e,s,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof s=="string"?Da(s):s,state:r,key:s&&s.key||a||_y(),mask:n}}function yn({pathname:e="/",search:s="",hash:r=""}){return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Da(e){let s={};if(e){let r=e.indexOf("#");r>=0&&(s.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(s.search=e.substring(a),e=e.substring(0,a)),e&&(s.pathname=e)}return s}function Sy(e,s,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",c=null,d=u();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function u(){return(i.state||{idx:null}).idx}function m(){l="POP";let b=u(),y=b==null?null:b-d;d=b,c&&c({action:l,location:g.location,delta:y})}function h(b,y){l="PUSH";let v=tu(b)?b:Ul(g.location,b,y);d=u()+1;let j=su(v,d),w=g.createHref(v.mask||v);try{i.pushState(j,"",w)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;n.location.assign(w)}o&&c&&c({action:l,location:g.location,delta:1})}function x(b,y){l="REPLACE";let v=tu(b)?b:Ul(g.location,b,y);d=u();let j=su(v,d),w=g.createHref(v.mask||v);i.replaceState(j,"",w),o&&c&&c({action:l,location:g.location,delta:0})}function f(b){return Cy(n,b)}let g={get action(){return l},get location(){return e(n,i)},listen(b){if(c)throw new Error("A history only accepts one active listener");return n.addEventListener(eu,m),c=b,()=>{n.removeEventListener(eu,m),c=null}},createHref(b){return s(n,b)},createURL:f,encodeLocation(b){let y=f(b);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:x,go(b){return i.go(b)}};return g}function Cy(e,s,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),We(a,"No window.location.(origin|href) available to create URL");let n=typeof s=="string"?s:yn(s);return n=n.replace(/ $/,"%20"),!r&&uh.test(n)&&(n=a+n),new URL(n,a)}function mh(e,s,r="/"){return Ey(e,s,r,!1)}function Ey(e,s,r,a,n){let o=typeof s=="string"?Da(s):s,i=_s(o.pathname||"/",r);if(i==null)return null;let l=Ry(e),c=null,d=zy(i);for(let u=0;c==null&&u{let u={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&c)return;We(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let m=zt([a,u.relativePath]),h=r.concat(u);i.children&&i.children.length>0&&(We(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),ph(i.children,s,h,m,c)),!(i.path==null&&!i.index)&&s.push({path:m,score:Dy(m,i.index),routesMeta:h.map((x,f)=>{let[g,b]=gh(x.relativePath,x.caseSensitive,f===h.length-1);return{...x,matcher:g,compiledParams:b}})})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of hh(i.path))o(i,l,!0,d)}),s}function hh(e){let s=e.split("/");if(s.length===0)return[];let[r,...a]=s,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=hh(a.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),n&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Ty(e){e.sort((s,r)=>s.score!==r.score?r.score-s.score:Ly(s.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var My=/^:[\w-]+$/,Py=3,Iy=2,Ay=1,$y=10,Fy=-2,ru=e=>e==="*";function Dy(e,s){let r=e.split("/"),a=r.length;return r.some(ru)&&(a+=Fy),s&&(a+=Iy),r.filter(n=>!ru(n)).reduce((n,o)=>n+(My.test(o)?Py:o===""?Ay:$y),a)}function Ly(e,s){return e.length===s.length&&e.slice(0,-1).every((a,n)=>a===s[n])?e[e.length-1]-s[s.length-1]:0}function Oy(e,s,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l{if(u==="*"){let f=l[h]||"";i=o.slice(0,o.length-f.length).replace(/(.)\/+$/,"$1")}const x=l[h];return m&&!x?d[u]=void 0:d[u]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function gh(e,s=!1,r=!0){Ht(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,u)=>{if(a.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+i.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,s?void 0:"i"),a]}function zy(e){try{return e.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Ht(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),e}}function _s(e,s){if(s==="/")return e;if(!e.toLowerCase().startsWith(s.toLowerCase()))return null;let r=s.endsWith("/")?s.length-1:s.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function By(e,s="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Da(e):e,o;return r?(r=bh(r),r.startsWith("/")?o=au(r.substring(1),"/"):o=au(r,s)):o=s,{pathname:o,search:Hy(a),hash:Wy(n)}}function au(e,s){let r=Vo(s).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Ui(e,s,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${s}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Vy(e){return e.filter((s,r)=>r===0||s.route.path&&s.route.path.length>0)}function fh(e){let s=Vy(e);return s.map((r,a)=>a===s.length-1?r.pathname:r.pathnameBase)}function Oc(e,s,r,a=!1){let n;typeof e=="string"?n=Da(e):(n={...e},We(!n.pathname||!n.pathname.includes("?"),Ui("?","pathname","search",n)),We(!n.pathname||!n.pathname.includes("#"),Ui("#","pathname","hash",n)),We(!n.search||!n.search.includes("#"),Ui("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let m=s.length-1;if(!a&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),m-=1;n.pathname=h.join("/")}l=m>=0?s[m]:"/"}let c=By(n,l),d=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var bh=e=>e.replace(/[\\/]{2,}/g,"/"),zt=e=>bh(e.join("/")),Vo=e=>e.replace(/\/+$/,""),Uy=e=>Vo(e).replace(/^\/*/,"/"),Hy=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Wy=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Gy=class{constructor(e,s,r,a=!1){this.status=e,this.statusText=s||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function qy(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Ky(e){let s=e.map(r=>r.route.path).filter(Boolean);return zt(s)||"/"}var yh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vh(e,s){let r=e;if(typeof r!="string"||!Lc.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(yh)try{let o=new URL(window.location.href),i=uh.test(r)?new URL(Ny(r,o.protocol)):new URL(r),l=_s(i.pathname,s);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{Ht(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var jh=["POST","PUT","PATCH","DELETE"];new Set(jh);var Jy=["GET",...jh];new Set(Jy);var Yy=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Qy(e){try{return Yy.includes(new URL(e).protocol)}catch{return!1}}var La=p.createContext(null);La.displayName="DataRouter";var di=p.createContext(null);di.displayName="DataRouterState";var wh=p.createContext(!1);function Xy(){return p.useContext(wh)}var Nh=p.createContext({isTransitioning:!1});Nh.displayName="ViewTransition";var Zy=p.createContext(new Map);Zy.displayName="Fetchers";var ev=p.createContext(null);ev.displayName="Await";var Ft=p.createContext(null);Ft.displayName="Navigation";var Vn=p.createContext(null);Vn.displayName="Location";var ps=p.createContext({outlet:null,matches:[],isDataRoute:!1});ps.displayName="Route";var zc=p.createContext(null);zc.displayName="RouteError";var kh="REACT_ROUTER_ERROR",tv="REDIRECT",sv="ROUTE_ERROR_RESPONSE";function rv(e){if(e.startsWith(`${kh}:${tv}:{`))try{let s=JSON.parse(e.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function av(e){if(e.startsWith(`${kh}:${sv}:{`))try{let s=JSON.parse(e.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Gy(s.status,s.statusText,s.data)}catch{}}function nv(e,{relative:s}={}){We(Un(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:a}=p.useContext(Ft),{hash:n,pathname:o,search:i}=Hn(e,{relative:s}),l=o;return r!=="/"&&(l=o==="/"?r:zt([r,o])),a.createHref({pathname:l,search:i,hash:n})}function Un(){return p.useContext(Vn)!=null}function Rt(){return We(Un(),"useLocation() may be used only in the context of a component."),p.useContext(Vn).location}var _h="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Sh(e){p.useContext(Ft).static||p.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=p.useContext(ps);return e?vv():ov()}function ov(){We(Un(),"useNavigate() may be used only in the context of a component.");let e=p.useContext(La),{basename:s,navigator:r}=p.useContext(Ft),{matches:a}=p.useContext(ps),{pathname:n}=Rt(),o=JSON.stringify(fh(a)),i=p.useRef(!1);return Sh(()=>{i.current=!0}),p.useCallback((c,d={})=>{if(Ht(i.current,_h),!i.current)return;if(typeof c=="number"){r.go(c);return}let u=Oc(c,JSON.parse(o),n,d.relative==="path");e==null&&s!=="/"&&(u.pathname=u.pathname==="/"?s:zt([s,u.pathname])),(d.replace?r.replace:r.push)(u,d.state,d)},[s,r,o,n,e])}var iv=p.createContext(null);function lv(e){let s=p.useContext(ps).outlet;return p.useMemo(()=>s&&p.createElement(iv.Provider,{value:e},s),[s,e])}function Hn(e,{relative:s}={}){let{matches:r}=p.useContext(ps),{pathname:a}=Rt(),n=JSON.stringify(fh(r));return p.useMemo(()=>Oc(e,JSON.parse(n),a,s==="path"),[e,n,a,s])}function cv(e,s){return Ch(e,s)}function Ch(e,s,r){var b;We(Un(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=p.useContext(Ft),{matches:n}=p.useContext(ps),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let y=d&&d.path||"";Rh(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${l}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let u=Rt(),m;if(s){let y=typeof s=="string"?Da(s):s;We(c==="/"||((b=y.pathname)==null?void 0:b.startsWith(c)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${y.pathname}" was given in the \`location\` prop.`),m=y}else m=u;let h=m.pathname||"/",x=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");x="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let f=r&&r.state.matches.length?r.state.matches.map(y=>Object.assign(y,{route:r.manifest[y.route.id]||y.route})):uh(e,{pathname:x});Ht(d||f!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ht(f==null||f[f.length-1].route.element!==void 0||f[f.length-1].route.Component!==void 0||f[f.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let g=pv(f&&f.map(y=>Object.assign({},y,{params:Object.assign({},i,y.params),pathname:zt([c,a.encodeLocation?a.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:zt([c,a.encodeLocation?a.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),n,r);return s&&g?p.createElement(Vn.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},g):g}function cv(){let e=bv(),s=Gy(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=p.createElement(p.Fragment,null,p.createElement("p",null,"πŸ’Ώ Hey developer πŸ‘‹"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:o},"ErrorBoundary")," or"," ",p.createElement("code",{style:o},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},s),r?p.createElement("pre",{style:n},r):null,i)}var dv=p.createElement(cv,null),Ch=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,s){return s.location!==e.location||s.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:s.error,location:s.location,revalidation:e.revalidation||s.revalidation}}componentDidCatch(e,s){this.props.onError?this.props.onError(e,s):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=rv(e.digest);r&&(e=r)}let s=e!==void 0?p.createElement(ps.Provider,{value:this.props.routeContext},p.createElement(zc.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(uv,{error:e},s):s}};Ch.contextType=jh;var Hi=new WeakMap;function uv({children:e,error:s}){let{basename:r}=p.useContext(Ft);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let a=sv(s.digest);if(a){let n=Hi.get(s);if(n)throw n;let o=yh(a.location,r),i=o.absoluteURL||o.to;if(Yy(i))throw new Error("Invalid redirect location");if(bh&&!Hi.get(s))if(o.isExternal||a.reloadDocument)window.location.href=i;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw Hi.set(s,l),l}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i}`})}}return e}function mv({routeContext:e,match:s,children:r}){let a=p.useContext(La);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),p.createElement(ps.Provider,{value:e},r)}function pv(e,s=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(s.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a==null?void 0:a.errors;if(o!=null){let u=n.findIndex(m=>m.route.id&&(o==null?void 0:o[m.route.id])!==void 0);We(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,u+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let u=0;u=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let c=r==null?void 0:r.onError,d=a&&c?(u,m)=>{var h,x;c(u,{location:a.location,params:((x=(h=a.matches)==null?void 0:h[0])==null?void 0:x.params)??{},pattern:qy(a.matches),errorInfo:m})}:void 0;return n.reduceRight((u,m,h)=>{let x,f=!1,g=null,b=null;a&&(x=o&&m.route.id?o[m.route.id]:void 0,g=m.route.errorElement||dv,i&&(l<0&&h===0?(Eh("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,b=null):l===h&&(f=!0,b=m.route.hydrateFallbackElement||null)));let y=s.concat(n.slice(0,h+1)),v=()=>{let j;return x?j=g:f?j=b:m.route.Component?j=p.createElement(m.route.Component,null):m.route.element?j=m.route.element:j=u,p.createElement(mv,{match:m,routeContext:{outlet:u,matches:y,isDataRoute:a!=null},children:j})};return a&&(m.route.ErrorBoundary||m.route.errorElement||h===0)?p.createElement(Ch,{location:a.location,revalidation:a.revalidation,component:g,error:x,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):v()},null)}function Bc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hv(e){let s=p.useContext(La);return We(s,Bc(e)),s}function xv(e){let s=p.useContext(di);return We(s,Bc(e)),s}function gv(e){let s=p.useContext(ps);return We(s,Bc(e)),s}function Vc(e){let s=gv(e),r=s.matches[s.matches.length-1];return We(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function fv(){return Vc("useRouteId")}function bv(){var a;let e=p.useContext(zc),s=xv("useRouteError"),r=Vc("useRouteError");return e!==void 0?e:(a=s.errors)==null?void 0:a[r]}function yv(){let{router:e}=hv("useNavigate"),s=Vc("useNavigate"),r=p.useRef(!1);return _h(()=>{r.current=!0}),p.useCallback(async(n,o={})=>{Ht(r.current,kh),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:s,...o}))},[e,s])}var nu={};function Eh(e,s,r){!s&&!nu[e]&&(nu[e]=!0,Ht(!1,r))}p.memo(vv);function vv({routes:e,manifest:s,future:r,state:a,isStatic:n,onError:o}){return Sh(e,void 0,{manifest:s,state:a,isStatic:n,onError:o})}function jv(e){return iv(e.context)}function vt(e){We(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function wv({basename:e="/",children:s=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){We(!Un(),"You cannot render a inside another . You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=p.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=Da(r));let{pathname:d="/",search:u="",hash:m="",state:h=null,key:x="default",mask:f}=r,g=p.useMemo(()=>{let b=_s(d,l);return b==null?null:{location:{pathname:b,search:u,hash:m,state:h,key:x,mask:f},navigationType:a}},[l,d,u,m,h,x,a,f]);return Ht(g!=null,` is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the won't render anything.`),g==null?null:p.createElement(Ft.Provider,{value:c},p.createElement(Vn.Provider,{children:s,value:g}))}function Nv({children:e,location:s}){return lv(Hl(e),s)}function Hl(e,s=[]){let r=[];return p.Children.forEach(e,(a,n)=>{if(!p.isValidElement(a))return;let o=[...s,n];if(a.type===p.Fragment){r.push.apply(r,Hl(a.props.children,o));return}We(a.type===vt,`[${typeof a.type=="string"?a.type:a.type.name}] is not a component. All component children of must be a or `),We(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=Hl(a.props.children,o)),r.push(i)}),r}var Mo="get",Po="application/x-www-form-urlencoded";function ui(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function kv(e){return ui(e)&&e.tagName.toLowerCase()==="button"}function _v(e){return ui(e)&&e.tagName.toLowerCase()==="form"}function Sv(e){return ui(e)&&e.tagName.toLowerCase()==="input"}function Cv(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ev(e,s){return e.button===0&&(!s||s==="_self")&&!Cv(e)}function Wl(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((s,r)=>{let a=e[r];return s.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function Rv(e,s){let r=Wl(e);return s&&s.forEach((a,n)=>{r.has(n)||s.getAll(n).forEach(o=>{r.append(n,o)})}),r}var mo=null;function Tv(){if(mo===null)try{new FormData(document.createElement("form"),0),mo=!1}catch{mo=!0}return mo}var Mv=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wi(e){return e!=null&&!Mv.has(e)?(Ht(!1,`"${e}" is not a valid \`encType\` for \`\`/\`\` and will default to "${Po}"`),null):e}function Pv(e,s){let r,a,n,o,i;if(_v(e)){let l=e.getAttribute("action");a=l?_s(l,s):null,r=e.getAttribute("method")||Mo,n=Wi(e.getAttribute("enctype"))||Po,o=new FormData(e)}else if(kv(e)||Sv(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a