From d67c49cc277044bdf47f96c68bf21720e7c2ca09 Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Fri, 14 Aug 2026 19:56:29 -0400 Subject: [PATCH] fix: review follow-ups on metrics, trace controls and inspector width Three findings from the dev->main review, plus a docs gap. Non-finite profiling metrics displayed as 0. `toNumber` mapped anything that was not a finite number to zero, and non-finite floats now arrive as tokens, so a rate of NaN rendered as `0.0 Hz` -- indistinguishable from an idle publisher, which is precisely the confusion that makes an empty trace look broken. Decode tokens instead and let the value stay non-finite; `toFixed` spells it out ("Infinity Hz") and the consumers that do arithmetic on rates already guard. Selecting a unit collapsed a publisher row that was capturing, hiding its stop control while the capture kept running. Keep active trace rows expanded when the list refocuses. The inspector's 900px ceiling was arbitrary, and on a narrow window it still allowed the topology to be squeezed to a sliver. Bound the inspector by what the topology needs instead: at least 480px, enforced in the grid template too, so a width stored on a wide monitor cannot squash the graph after a resize. The global settings list in the user guide did not mention the settings-channel toggle. Co-Authored-By: Claude Opus 5 (1M context) --- docs/user-guide.md | 2 +- frontend/src/App.tsx | 25 ++++++---- frontend/src/components/ProfilingPanel.tsx | 8 +++- frontend/src/styles.css | 6 ++- frontend/src/utils/nonFiniteNumbers.test.ts | 24 ++++++++++ frontend/src/utils/nonFiniteNumbers.ts | 11 +++++ frontend/tests/e2e/dashboard.spec.ts | 47 ++++++++++++++++++- .../{index-CxDljRP7.js => index-B0UL7Pvv.js} | 28 +++++------ .../dashboard/_web/assets/index-CbvX57-3.css | 1 - .../dashboard/_web/assets/index-D2HkN7I-.css | 1 + src/ezmsg/dashboard/_web/index.html | 4 +- 11 files changed, 124 insertions(+), 33 deletions(-) rename src/ezmsg/dashboard/_web/assets/{index-CxDljRP7.js => index-B0UL7Pvv.js} (65%) delete mode 100644 src/ezmsg/dashboard/_web/assets/index-CbvX57-3.css create mode 100644 src/ezmsg/dashboard/_web/assets/index-D2HkN7I-.css diff --git a/docs/user-guide.md b/docs/user-guide.md index 813e500..767fe14 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -125,7 +125,7 @@ The top-right dock in the topology viewport contains: - **Layout toggle**: left-to-right vs top-to-bottom - **Theme toggle**: light vs dark -- **Global settings**: snapshot poll frequency, theme, default layout, edge connector type, default trace metrics, inspector width, legend/minimap visibility, and auto-fit/auto-focus behaviors +- **Global settings**: snapshot poll frequency, theme, default layout, edge connector type, default trace metrics, inspector width, legend/minimap visibility, auto-fit/auto-focus behaviors, and whether the Publishers pane shows settings channels ## Good Troubleshooting Patterns diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 44489a0..0cbf417 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -139,16 +139,21 @@ const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = { }; const CANONICAL_GRAPH_ADDRESS = "127.0.0.1:25978"; const INSPECTOR_WIDTH_MIN_PX = 360; -const INSPECTOR_WIDTH_MAX_PX = 900; +// The topology is the point of the page, so it -- not an arbitrary ceiling -- +// is what bounds how wide the inspector may get. Mirrored in the grid template, +// which keeps a stale stored width from squeezing the graph after a resize. +const TOPOLOGY_MIN_WIDTH_PX = 480; /** How far one arrow key press moves the inspector divider. */ const INSPECTOR_WIDTH_KEY_STEP_PX = 16; type HealthTone = "ok" | "warn" | "err"; +function maxInspectorWidth(): number { + const viewportWidth = typeof window === "undefined" ? Number.POSITIVE_INFINITY : window.innerWidth; + return Math.max(INSPECTOR_WIDTH_MIN_PX, viewportWidth - TOPOLOGY_MIN_WIDTH_PX); +} + function clampInspectorWidth(value: number): number { - return Math.min( - INSPECTOR_WIDTH_MAX_PX, - Math.max(INSPECTOR_WIDTH_MIN_PX, Math.round(value)) - ); + return Math.min(maxInspectorWidth(), Math.max(INSPECTOR_WIDTH_MIN_PX, Math.round(value))); } function toEpochMillis(timestamp: number): number | null { @@ -491,7 +496,7 @@ export function App() { if (event.key === "Home" || event.key === "End") { event.preventDefault(); commitInspectorWidth( - event.key === "Home" ? INSPECTOR_WIDTH_MAX_PX : INSPECTOR_WIDTH_MIN_PX + event.key === "Home" ? maxInspectorWidth() : INSPECTOR_WIDTH_MIN_PX ); } }; @@ -544,7 +549,7 @@ export function App() { aria-orientation="vertical" aria-label="Resize inspector" aria-valuemin={INSPECTOR_WIDTH_MIN_PX} - aria-valuemax={INSPECTOR_WIDTH_MAX_PX} + aria-valuemax={maxInspectorWidth()} aria-valuenow={inspectorWidthPx} tabIndex={0} onPointerDown={handleInspectorResizeStart} @@ -905,8 +910,8 @@ export function App() { Inspector Width (px) { @@ -916,7 +921,7 @@ export function App() { } setGlobalSettings((previous) => ({ ...previous, - inspectorWidthPx: Math.max(360, Math.min(900, next)), + inspectorWidthPx: clampInspectorWidth(next), })); }} /> diff --git a/frontend/src/components/ProfilingPanel.tsx b/frontend/src/components/ProfilingPanel.tsx index 73ddccd..3bccb86 100644 --- a/frontend/src/components/ProfilingPanel.tsx +++ b/frontend/src/components/ProfilingPanel.tsx @@ -10,6 +10,7 @@ import { parseTopicAndEndpoint, streamAddressWithoutEndpoint, } from "../utils/streamAddress"; +import { metricNumber } from "../utils/nonFiniteNumbers"; import { isSettingsChannelTopic } from "../utils/settingsChannel"; import type { GraphSnapshotPayload, @@ -111,7 +112,7 @@ const TRACE_PUBLISHER_METRICS = new Set(["publish_delta_ns"]); const TRACE_SUBSCRIBER_METRICS = new Set(["lease_time_ns", "user_span_ns"]); function toNumber(value: unknown): number { - return typeof value === "number" && Number.isFinite(value) ? value : 0; + return metricNumber(value); } function formatRate(hz: number): string { @@ -611,7 +612,9 @@ export function ProfilingPanel({ } lastHandledFocusActionIdRef.current = focusActionId; setSearchText(""); - setExpandedIds(matchedIds); + // A row that is capturing stays expanded: collapsing it would hide the + // stop control while the capture kept running. + setExpandedIds([...new Set([...matchedIds, ...activeTraceRowIds])]); setExpandedContributorEndpointByRowId((previous) => { if (contributorEndpointId === null) { return {}; @@ -677,6 +680,7 @@ export function ProfilingPanel({ focusUnitAddress, focusActionId, publisherRows, + activeTraceRowIds, ]); useEffect(() => { diff --git a/frontend/src/styles.css b/frontend/src/styles.css index d1b7122..f08dbfe 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -219,7 +219,11 @@ body { .dashboard-layout { display: grid; - grid-template-columns: minmax(0, 1fr) minmax(360px, var(--inspector-width, 500px)); + /* The topology keeps at least 480px: a stored inspector width from a wider + window must not squeeze it away after a resize. */ + grid-template-columns: + minmax(0, 1fr) + minmax(360px, min(var(--inspector-width, 500px), calc(100vw - 480px))); grid-template-rows: minmax(0, 1fr); width: 100vw; height: 100vh; diff --git a/frontend/src/utils/nonFiniteNumbers.test.ts b/frontend/src/utils/nonFiniteNumbers.test.ts index 2cd730e..2f82cff 100644 --- a/frontend/src/utils/nonFiniteNumbers.test.ts +++ b/frontend/src/utils/nonFiniteNumbers.test.ts @@ -5,6 +5,7 @@ import { encodeNumericValue, formatNumericValue, isNonFiniteToken, + metricNumber, parseNumericInput, } from "./nonFiniteNumbers"; @@ -75,3 +76,26 @@ describe("non-finite number tokens", () => { expect(parseNumericInput("alpha")).toBeNull(); }); }); + +describe("snapshot metrics", () => { + it("keeps non-finite metrics distinguishable from zero", () => { + expect(metricNumber(12.5)).toBe(12.5); + expect(metricNumber(0)).toBe(0); + expect(metricNumber("Infinity")).toBe(Number.POSITIVE_INFINITY); + expect(metricNumber("-Infinity")).toBe(Number.NEGATIVE_INFINITY); + expect(metricNumber("NaN")).toBeNaN(); + }); + + it("falls back to zero for values that are not numbers at all", () => { + expect(metricNumber("alpha")).toBe(0); + expect(metricNumber(null)).toBe(0); + expect(metricNumber(undefined)).toBe(0); + expect(metricNumber({})).toBe(0); + }); + + it("formats a non-finite rate readably", () => { + // What ProfilingPanel's formatRate does with the decoded value. + expect(`${metricNumber("Infinity").toFixed(1)} Hz`).toBe("Infinity Hz"); + expect(`${metricNumber("NaN").toFixed(1)} Hz`).toBe("NaN Hz"); + }); +}); diff --git a/frontend/src/utils/nonFiniteNumbers.ts b/frontend/src/utils/nonFiniteNumbers.ts index ae41026..8facb4b 100644 --- a/frontend/src/utils/nonFiniteNumbers.ts +++ b/frontend/src/utils/nonFiniteNumbers.ts @@ -69,3 +69,14 @@ export function parseNumericInput(raw: string): number | null { const numeric = Number(trimmed); return Number.isNaN(numeric) ? null : numeric; } + +/** + * Read a snapshot metric that may have arrived as a token. + * + * Non-finite values stay non-finite rather than flattening to zero: a rate of + * `NaN` shown as `0.0 Hz` is indistinguishable from an idle publisher, which is + * exactly the confusion that makes an empty profiling trace look broken. + */ +export function metricNumber(value: unknown): number { + return decodeNumericValue(value) ?? 0; +} diff --git a/frontend/tests/e2e/dashboard.spec.ts b/frontend/tests/e2e/dashboard.spec.ts index b2a7156..2485472 100644 --- a/frontend/tests/e2e/dashboard.spec.ts +++ b/frontend/tests/e2e/dashboard.spec.ts @@ -604,7 +604,8 @@ test("the divider clamps the inspector width and resets on double click", async const handleCenterY = handleBox.y + handleBox.height / 2; const handleCenterX = handleBox.x + handleBox.width / 2; - // Drag far past the maximum; the width stops at the clamp. + // Drag far past the limit; the width stops where the topology's 480px + // minimum begins, rather than at a fixed ceiling. await page.mouse.move(handleCenterX, handleCenterY); await page.mouse.down(); await page.mouse.move(handleCenterX - 900, handleCenterY, { steps: 8 }); @@ -612,7 +613,7 @@ test("the divider clamps the inspector width and resets on double click", async await expect .poll(async () => Math.round((await inspector.boundingBox())?.width ?? 0)) - .toBe(900); + .toBe(1400 - 480); await handle.dblclick(); await expect @@ -873,3 +874,45 @@ test("settings channels can be shown again from global settings", async ({ page page.locator('.publisher-topic[title="SYSTEM/PING/INPUT_SETTINGS"]') ).toBeVisible(); }); + +test("a capturing publisher row stays expanded when a unit is selected", async ({ + page, +}) => { + await page.goto("/?fixture=profiling-trace-rates"); + + const traceRow = page.locator(".publisher-row", { + has: page.locator('.publisher-topic[title="TRACE_LAB/DENSE_TOPIC"]'), + }); + await traceRow.locator(".publisher-row__toggle").click(); + await traceRow.locator(".publisher-trace-button").click(); + await expect(traceRow.locator(".publisher-trace-button.is-stop")).toBeVisible(); + + // Selecting a unit refocuses the publishers list; the stop control for a + // running capture must not disappear with it. + await page.locator('[data-testid^="rf__node-unit:"]').first().click({ + position: { x: 24, y: 18 }, + }); + await page.waitForTimeout(500); + + await expect(traceRow.locator(".publisher-trace-button.is-stop")).toBeVisible(); +}); + +test("the inspector cannot be dragged over the topology", async ({ page }) => { + await primeGlobalSettings(page, { inspectorWidthPx: 500 }); + await page.setViewportSize({ width: 1000, height: 800 }); + await page.goto("/?fixture=root-scope-navigation"); + + const handle = page.locator(".inspector-resize-handle"); + const box = await handle.boundingBox(); + if (!box) { + throw new Error("resize handle is not visible"); + } + await page.mouse.move(box.x + box.width / 2, box.y + 300); + await page.mouse.down(); + await page.mouse.move(10, box.y + 300, { steps: 10 }); // drag to the far left + await page.mouse.up(); + + const topologyWidth = + (await page.locator(".dashboard-main").boundingBox())?.width ?? 0; + expect(topologyWidth).toBeGreaterThanOrEqual(480); +}); diff --git a/src/ezmsg/dashboard/_web/assets/index-CxDljRP7.js b/src/ezmsg/dashboard/_web/assets/index-B0UL7Pvv.js similarity index 65% rename from src/ezmsg/dashboard/_web/assets/index-CxDljRP7.js rename to src/ezmsg/dashboard/_web/assets/index-B0UL7Pvv.js index 66a8e1e..cbb240f 100644 --- a/src/ezmsg/dashboard/_web/assets/index-CxDljRP7.js +++ b/src/ezmsg/dashboard/_web/assets/index-B0UL7Pvv.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Bp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fp={exports:{}},hl={},zp={exports:{}},xe={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Bp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fp={exports:{}},yl={},zp={exports:{}},xe={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var To=Symbol.for("react.element"),f0=Symbol.for("react.portal"),p0=Symbol.for("react.fragment"),h0=Symbol.for("react.strict_mode"),m0=Symbol.for("react.profiler"),g0=Symbol.for("react.provider"),y0=Symbol.for("react.context"),_0=Symbol.for("react.forward_ref"),v0=Symbol.for("react.suspense"),x0=Symbol.for("react.memo"),w0=Symbol.for("react.lazy"),yd=Symbol.iterator;function S0(e){return e===null||typeof e!="object"?null:(e=yd&&e[yd]||e["@@iterator"],typeof e=="function"?e:null)}var Dp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Up=Object.assign,Hp={};function ms(e,t,n){this.props=e,this.context=t,this.refs=Hp,this.updater=n||Dp}ms.prototype.isReactComponent={};ms.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ms.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Wp(){}Wp.prototype=ms.prototype;function ec(e,t,n){this.props=e,this.context=t,this.refs=Hp,this.updater=n||Dp}var tc=ec.prototype=new Wp;tc.constructor=ec;Up(tc,ms.prototype);tc.isPureReactComponent=!0;var _d=Array.isArray,Vp=Object.prototype.hasOwnProperty,nc={current:null},Gp={key:!0,ref:!0,__self:!0,__source:!0};function Yp(e,t,n){var r,s={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Vp.call(t,r)&&!Gp.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,M=C[j];if(0>>1;js(ee,b))tes(pe,ee)?(C[j]=pe,C[te]=b,j=te):(C[j]=ee,C[Y]=b,j=Y);else if(tes(pe,b))C[j]=pe,C[te]=b,j=te;else break e}}return S}function s(C,S){var b=C.sortIndex-S.sortIndex;return b!==0?b:C.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var a=[],u=[],c=1,d=null,f=3,m=!1,v=!1,x=!1,T=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(C){for(var S=n(u);S!==null;){if(S.callback===null)r(u);else if(S.startTime<=C)r(u),S.sortIndex=S.expirationTime,t(a,S);else break;S=n(u)}}function w(C){if(x=!1,_(C),!v)if(n(a)!==null)v=!0,N(P);else{var S=n(u);S!==null&&O(w,S.startTime-C)}}function P(C,S){v=!1,x&&(x=!1,p($),$=-1),m=!0;var b=f;try{for(_(S),d=n(a);d!==null&&(!(d.expirationTime>S)||C&&!U());){var j=d.callback;if(typeof j=="function"){d.callback=null,f=d.priorityLevel;var M=j(d.expirationTime<=S);S=e.unstable_now(),typeof M=="function"?d.callback=M:d===n(a)&&r(a),_(S)}else r(a);d=n(a)}if(d!==null)var K=!0;else{var Y=n(u);Y!==null&&O(w,Y.startTime-S),K=!1}return K}finally{d=null,f=b,m=!1}}var A=!1,R=null,$=-1,B=5,D=-1;function U(){return!(e.unstable_now()-DC||125j?(C.sortIndex=b,t(u,C),n(a)===null&&C===n(u)&&(x?(p($),$=-1):x=!0,O(w,b-j))):(C.sortIndex=M,t(a,C),v||m||(v=!0,N(P))),C},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(C){var S=f;return function(){var b=f;f=S;try{return C.apply(this,arguments)}finally{f=b}}}})(qp);Zp.exports=qp;var M0=Zp.exports;/** + */(function(e){function t(C,S){var b=C.length;C.push(S);e:for(;0>>1,M=C[j];if(0>>1;js(ee,b))tes(pe,ee)?(C[j]=pe,C[te]=b,j=te):(C[j]=ee,C[Y]=b,j=Y);else if(tes(pe,b))C[j]=pe,C[te]=b,j=te;else break e}}return S}function s(C,S){var b=C.sortIndex-S.sortIndex;return b!==0?b:C.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var a=[],u=[],c=1,d=null,f=3,m=!1,v=!1,x=!1,T=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(C){for(var S=n(u);S!==null;){if(S.callback===null)r(u);else if(S.startTime<=C)r(u),S.sortIndex=S.expirationTime,t(a,S);else break;S=n(u)}}function w(C){if(x=!1,_(C),!v)if(n(a)!==null)v=!0,N(P);else{var S=n(u);S!==null&&O(w,S.startTime-C)}}function P(C,S){v=!1,x&&(x=!1,p($),$=-1),m=!0;var b=f;try{for(_(S),d=n(a);d!==null&&(!(d.expirationTime>S)||C&&!U());){var j=d.callback;if(typeof j=="function"){d.callback=null,f=d.priorityLevel;var M=j(d.expirationTime<=S);S=e.unstable_now(),typeof M=="function"?d.callback=M:d===n(a)&&r(a),_(S)}else r(a);d=n(a)}if(d!==null)var K=!0;else{var Y=n(u);Y!==null&&O(w,Y.startTime-S),K=!1}return K}finally{d=null,f=b,m=!1}}var A=!1,R=null,$=-1,B=5,D=-1;function U(){return!(e.unstable_now()-DC||125j?(C.sortIndex=b,t(u,C),n(a)===null&&C===n(u)&&(x?(p($),$=-1):x=!0,O(w,b-j))):(C.sortIndex=M,t(a,C),v||m||(v=!0,N(P))),C},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(C){var S=f;return function(){var b=f;f=S;try{return C.apply(this,arguments)}finally{f=b}}}})(qp);Zp.exports=qp;var O0=Zp.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var O0=E,Nt=M0;function se(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ba=Object.prototype.hasOwnProperty,L0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,xd={},wd={};function $0(e){return Ba.call(wd,e)?!0:Ba.call(xd,e)?!1:L0.test(e)?wd[e]=!0:(xd[e]=!0,!1)}function j0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function B0(e,t,n,r){if(t===null||typeof t>"u"||j0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pt(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var nt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){nt[e]=new pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];nt[t]=new pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){nt[e]=new pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){nt[e]=new pt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){nt[e]=new pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){nt[e]=new pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){nt[e]=new pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){nt[e]=new pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){nt[e]=new pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var sc=/[\-:]([a-z])/g;function oc(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){nt[e]=new pt(e,1,!1,e.toLowerCase(),null,!1,!1)});nt.xlinkHref=new pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){nt[e]=new pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ic(e,t,n,r){var s=nt.hasOwnProperty(t)?nt[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Da=Object.prototype.hasOwnProperty,$0=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,xd={},wd={};function j0(e){return Da.call(wd,e)?!0:Da.call(xd,e)?!1:$0.test(e)?wd[e]=!0:(xd[e]=!0,!1)}function B0(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function F0(e,t,n,r){if(t===null||typeof t>"u"||B0(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pt(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var nt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){nt[e]=new pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];nt[t]=new pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){nt[e]=new pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){nt[e]=new pt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){nt[e]=new pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){nt[e]=new pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){nt[e]=new pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){nt[e]=new pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){nt[e]=new pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var sc=/[\-:]([a-z])/g;function oc(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(sc,oc);nt[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){nt[e]=new pt(e,1,!1,e.toLowerCase(),null,!1,!1)});nt.xlinkHref=new pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){nt[e]=new pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function ic(e,t,n,r){var s=nt.hasOwnProperty(t)?nt[t]:null;(s!==null?s.type!==0:r||!(2l||s[i]!==o[l]){var a=` -`+s[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=l);break}}}finally{Gl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Os(e):""}function F0(e){switch(e.tag){case 5:return Os(e.type);case 16:return Os("Lazy");case 13:return Os("Suspense");case 19:return Os("SuspenseList");case 0:case 2:case 15:return e=Yl(e.type,!1),e;case 11:return e=Yl(e.type.render,!1),e;case 1:return e=Yl(e.type,!0),e;default:return""}}function Ua(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Mr:return"Fragment";case Rr:return"Portal";case Fa:return"Profiler";case lc:return"StrictMode";case za:return"Suspense";case Da:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case th:return(e.displayName||"Context")+".Consumer";case eh:return(e._context.displayName||"Context")+".Provider";case ac:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case uc:return t=e.displayName||null,t!==null?t:Ua(e.type)||"Memo";case In:t=e._payload,e=e._init;try{return Ua(e(t))}catch{}}return null}function z0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ua(t);case 8:return t===lc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Wn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function rh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function D0(e){var t=rh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lo(e){e._valueTracker||(e._valueTracker=D0(e))}function sh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=rh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ai(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ha(e,t){var n=t.checked;return Fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ed(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Wn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function oh(e,t){t=t.checked,t!=null&&ic(e,"checked",t,!1)}function Wa(e,t){oh(e,t);var n=Wn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Va(e,t.type,n):t.hasOwnProperty("defaultValue")&&Va(e,t.type,Wn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nd(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Va(e,t,n){(t!=="number"||Ai(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ls=Array.isArray;function Kr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=$o.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function qs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ds={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},U0=["Webkit","ms","Moz","O"];Object.keys(Ds).forEach(function(e){U0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ds[t]=Ds[e]})});function uh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ds.hasOwnProperty(e)&&Ds[e]?(""+t).trim():t+"px"}function ch(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=uh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var H0=Fe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ka(e,t){if(t){if(H0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function Xa(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Qa=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Za=null,Xr=null,Qr=null;function Cd(e){if(e=ko(e)){if(typeof Za!="function")throw Error(se(280));var t=e.stateNode;t&&(t=vl(t),Za(e.stateNode,e.type,t))}}function dh(e){Xr?Qr?Qr.push(e):Qr=[e]:Xr=e}function fh(){if(Xr){var e=Xr,t=Qr;if(Qr=Xr=null,Cd(e),t)for(e=0;e>>=0,e===0?32:31-(e_(e)/t_|0)|0}var jo=64,Bo=4194304;function $s(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Li(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~s;l!==0?r=$s(l):(o&=i,o!==0&&(r=$s(o)))}else i=n&~s,i!==0?r=$s(i):o!==0&&(r=$s(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Io(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ht(t),e[t]=n}function o_(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Hs),$d=" ",jd=!1;function Rh(e,t){switch(e){case"keyup":return M_.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Or=!1;function L_(e,t){switch(e){case"compositionend":return Mh(t);case"keypress":return t.which!==32?null:(jd=!0,$d);case"textInput":return e=t.data,e===$d&&jd?null:e;default:return null}}function $_(e,t){if(Or)return e==="compositionend"||!_c&&Rh(e,t)?(e=bh(),yi=mc=Mn=null,Or=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Dd(n)}}function jh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Bh(){for(var e=window,t=Ai();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ai(e.document)}return t}function vc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function V_(e){var t=Bh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&jh(n.ownerDocument.documentElement,n)){if(r!==null&&vc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=Ud(n,o);var i=Ud(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Lr=null,ru=null,Vs=null,su=!1;function Hd(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;su||Lr==null||Lr!==Ai(r)||(r=Lr,"selectionStart"in r&&vc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vs&&so(Vs,r)||(Vs=r,r=Bi(ru,"onSelect"),0Br||(e.current=cu[Br],cu[Br]=null,Br--)}function Pe(e,t){Br++,cu[Br]=e.current,e.current=t}var Vn={},at=Yn(Vn),yt=Yn(!1),fr=Vn;function ss(e,t){var n=e.type.contextTypes;if(!n)return Vn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function _t(e){return e=e.childContextTypes,e!=null}function zi(){Me(yt),Me(at)}function Qd(e,t,n){if(at.current!==Vn)throw Error(se(168));Pe(at,t),Pe(yt,n)}function Yh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(se(108,z0(e)||"Unknown",s));return Fe({},n,r)}function Di(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vn,fr=at.current,Pe(at,e),Pe(yt,yt.current),!0}function Zd(e,t,n){var r=e.stateNode;if(!r)throw Error(se(169));n?(e=Yh(e,t,fr),r.__reactInternalMemoizedMergedChildContext=e,Me(yt),Me(at),Pe(at,e)):Me(yt),Pe(yt,n)}var un=null,xl=!1,la=!1;function Kh(e){un===null?un=[e]:un.push(e)}function rv(e){xl=!0,Kh(e)}function Kn(){if(!la&&un!==null){la=!0;var e=0,t=Ie;try{var n=un;for(Ie=1;e>=i,s-=i,cn=1<<32-Ht(t)+s|n<$?(B=R,R=null):B=R.sibling;var D=f(p,R,_[$],w);if(D===null){R===null&&(R=B);break}e&&R&&D.alternate===null&&t(p,R),g=o(D,g,$),A===null?P=D:A.sibling=D,A=D,R=B}if($===_.length)return n(p,R),Oe&&qn(p,$),P;if(R===null){for(;$<_.length;$++)R=d(p,_[$],w),R!==null&&(g=o(R,g,$),A===null?P=R:A.sibling=R,A=R);return Oe&&qn(p,$),P}for(R=r(p,R);$<_.length;$++)B=m(R,p,$,_[$],w),B!==null&&(e&&B.alternate!==null&&R.delete(B.key===null?$:B.key),g=o(B,g,$),A===null?P=B:A.sibling=B,A=B);return e&&R.forEach(function(U){return t(p,U)}),Oe&&qn(p,$),P}function x(p,g,_,w){var P=vs(_);if(typeof P!="function")throw Error(se(150));if(_=P.call(_),_==null)throw Error(se(151));for(var A=P=null,R=g,$=g=0,B=null,D=_.next();R!==null&&!D.done;$++,D=_.next()){R.index>$?(B=R,R=null):B=R.sibling;var U=f(p,R,D.value,w);if(U===null){R===null&&(R=B);break}e&&R&&U.alternate===null&&t(p,R),g=o(U,g,$),A===null?P=U:A.sibling=U,A=U,R=B}if(D.done)return n(p,R),Oe&&qn(p,$),P;if(R===null){for(;!D.done;$++,D=_.next())D=d(p,D.value,w),D!==null&&(g=o(D,g,$),A===null?P=D:A.sibling=D,A=D);return Oe&&qn(p,$),P}for(R=r(p,R);!D.done;$++,D=_.next())D=m(R,p,$,D.value,w),D!==null&&(e&&D.alternate!==null&&R.delete(D.key===null?$:D.key),g=o(D,g,$),A===null?P=D:A.sibling=D,A=D);return e&&R.forEach(function(Q){return t(p,Q)}),Oe&&qn(p,$),P}function T(p,g,_,w){if(typeof _=="object"&&_!==null&&_.type===Mr&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Oo:e:{for(var P=_.key,A=g;A!==null;){if(A.key===P){if(P=_.type,P===Mr){if(A.tag===7){n(p,A.sibling),g=s(A,_.props.children),g.return=p,p=g;break e}}else if(A.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===In&&ef(P)===A.type){n(p,A.sibling),g=s(A,_.props),g.ref=Ns(p,A,_),g.return=p,p=g;break e}n(p,A);break}else t(p,A);A=A.sibling}_.type===Mr?(g=ur(_.props.children,p.mode,w,_.key),g.return=p,p=g):(w=Ti(_.type,_.key,_.props,null,p.mode,w),w.ref=Ns(p,g,_),w.return=p,p=w)}return i(p);case Rr:e:{for(A=_.key;g!==null;){if(g.key===A)if(g.tag===4&&g.stateNode.containerInfo===_.containerInfo&&g.stateNode.implementation===_.implementation){n(p,g.sibling),g=s(g,_.children||[]),g.return=p,p=g;break e}else{n(p,g);break}else t(p,g);g=g.sibling}g=ma(_,p.mode,w),g.return=p,p=g}return i(p);case In:return A=_._init,T(p,g,A(_._payload),w)}if(Ls(_))return v(p,g,_,w);if(vs(_))return x(p,g,_,w);Vo(p,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,g!==null&&g.tag===6?(n(p,g.sibling),g=s(g,_),g.return=p,p=g):(n(p,g),g=ha(_,p.mode,w),g.return=p,p=g),i(p)):n(p,g)}return T}var is=qh(!0),Jh=qh(!1),Wi=Yn(null),Vi=null,Dr=null,Ec=null;function Nc(){Ec=Dr=Vi=null}function Tc(e){var t=Wi.current;Me(Wi),e._currentValue=t}function pu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qr(e,t){Vi=e,Ec=Dr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(mt=!0),e.firstContext=null)}function Ot(e){var t=e._currentValue;if(Ec!==e)if(e={context:e,memoizedValue:t,next:null},Dr===null){if(Vi===null)throw Error(se(308));Dr=e,Vi.dependencies={lanes:0,firstContext:e}}else Dr=Dr.next=e;return t}var sr=null;function Ic(e){sr===null?sr=[e]:sr.push(e)}function em(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Ic(t)):(n.next=s.next,s.next=n),t.interleaved=n,yn(e,r)}function yn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Cn=!1;function Cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ee&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,yn(e,n)}return s=r.interleaved,s===null?(t.next=t,Ic(r)):(t.next=s.next,s.next=t),r.interleaved=t,yn(e,n)}function vi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fc(e,n)}}function tf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Gi(e,t,n,r){var s=e.updateQueue;Cn=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,u=a.next;a.next=null,i===null?o=u:i.next=u,i=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==i&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(o!==null){var d=s.baseState;i=0,c=u=a=null,l=o;do{var f=l.lane,m=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,x=l;switch(f=t,m=n,x.tag){case 1:if(v=x.payload,typeof v=="function"){d=v.call(m,d,f);break e}d=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=x.payload,f=typeof v=="function"?v.call(m,d,f):v,f==null)break e;d=Fe({},d,f);break e;case 2:Cn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=m,a=d):c=c.next=m,i|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(c===null&&(a=d),s.baseState=a,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);mr|=i,e.lanes=i,e.memoizedState=d}}function nf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ua.transition;ua.transition={};try{e(!1),t()}finally{Ie=n,ua.transition=r}}function _m(){return Lt().memoizedState}function lv(e,t,n){var r=Dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vm(e))xm(t,n);else if(n=em(e,t,n,r),n!==null){var s=dt();Wt(n,e,r,s),wm(n,t,r)}}function av(e,t,n){var r=Dn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vm(e))xm(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(s.hasEagerState=!0,s.eagerState=l,Gt(l,i)){var a=t.interleaved;a===null?(s.next=s,Ic(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=em(e,t,s,r),n!==null&&(s=dt(),Wt(n,e,r,s),wm(n,t,r))}}function vm(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function xm(e,t){Gs=Ki=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wm(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fc(e,n)}}var Xi={readContext:Ot,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useInsertionEffect:st,useLayoutEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useMutableSource:st,useSyncExternalStore:st,useId:st,unstable_isNewReconciler:!1},uv={readContext:Ot,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:Ot,useEffect:sf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,wi(4194308,4,pm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return wi(4194308,4,e,t)},useInsertionEffect:function(e,t){return wi(4,2,e,t)},useMemo:function(e,t){var n=Qt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=lv.bind(null,Be,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:rf,useDebugValue:Lc,useDeferredValue:function(e){return Qt().memoizedState=e},useTransition:function(){var e=rf(!1),t=e[0];return e=iv.bind(null,e[1]),Qt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Be,s=Qt();if(Oe){if(n===void 0)throw Error(se(407));n=n()}else{if(n=t(),qe===null)throw Error(se(349));hr&30||om(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,sf(lm.bind(null,r,o,e),[e]),r.flags|=2048,po(9,im.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Qt(),t=qe.identifierPrefix;if(Oe){var n=dn,r=cn;n=(r&~(1<<32-Ht(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=co++,0")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=l);break}}}finally{Xl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Os(e):""}function z0(e){switch(e.tag){case 5:return Os(e.type);case 16:return Os("Lazy");case 13:return Os("Suspense");case 19:return Os("SuspenseList");case 0:case 2:case 15:return e=Ql(e.type,!1),e;case 11:return e=Ql(e.type.render,!1),e;case 1:return e=Ql(e.type,!0),e;default:return""}}function Va(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Mr:return"Fragment";case Rr:return"Portal";case Ua:return"Profiler";case lc:return"StrictMode";case Ha:return"Suspense";case Wa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case th:return(e.displayName||"Context")+".Consumer";case eh:return(e._context.displayName||"Context")+".Provider";case ac:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case uc:return t=e.displayName||null,t!==null?t:Va(e.type)||"Memo";case In:t=e._payload,e=e._init;try{return Va(e(t))}catch{}}return null}function D0(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Va(t);case 8:return t===lc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Wn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function rh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function U0(e){var t=rh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $o(e){e._valueTracker||(e._valueTracker=U0(e))}function sh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=rh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Oi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ga(e,t){var n=t.checked;return Fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ed(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Wn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function oh(e,t){t=t.checked,t!=null&&ic(e,"checked",t,!1)}function Ya(e,t){oh(e,t);var n=Wn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ka(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ka(e,t.type,Wn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Nd(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ka(e,t,n){(t!=="number"||Oi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ls=Array.isArray;function Kr(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=jo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Js(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ds={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},H0=["Webkit","ms","Moz","O"];Object.keys(Ds).forEach(function(e){H0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ds[t]=Ds[e]})});function uh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ds.hasOwnProperty(e)&&Ds[e]?(""+t).trim():t+"px"}function ch(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=uh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var W0=Fe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Za(e,t){if(t){if(W0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function qa(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ja=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var eu=null,Xr=null,Qr=null;function Cd(e){if(e=Po(e)){if(typeof eu!="function")throw Error(se(280));var t=e.stateNode;t&&(t=Sl(t),eu(e.stateNode,e.type,t))}}function dh(e){Xr?Qr?Qr.push(e):Qr=[e]:Xr=e}function fh(){if(Xr){var e=Xr,t=Qr;if(Qr=Xr=null,Cd(e),t)for(e=0;e>>=0,e===0?32:31-(t_(e)/n_|0)|0}var Bo=64,Fo=4194304;function $s(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~s;l!==0?r=$s(l):(o&=i,o!==0&&(r=$s(o)))}else i=n&~s,i!==0?r=$s(i):o!==0&&(r=$s(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Co(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ht(t),e[t]=n}function i_(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Hs),$d=" ",jd=!1;function Rh(e,t){switch(e){case"keyup":return O_.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Or=!1;function $_(e,t){switch(e){case"compositionend":return Mh(t);case"keypress":return t.which!==32?null:(jd=!0,$d);case"textInput":return e=t.data,e===$d&&jd?null:e;default:return null}}function j_(e,t){if(Or)return e==="compositionend"||!_c&&Rh(e,t)?(e=bh(),_i=mc=Mn=null,Or=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Dd(n)}}function jh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Bh(){for(var e=window,t=Oi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Oi(e.document)}return t}function vc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function G_(e){var t=Bh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&jh(n.ownerDocument.documentElement,n)){if(r!==null&&vc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=Ud(n,o);var i=Ud(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Lr=null,iu=null,Vs=null,lu=!1;function Hd(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lu||Lr==null||Lr!==Oi(r)||(r=Lr,"selectionStart"in r&&vc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vs&&oo(Vs,r)||(Vs=r,r=Di(iu,"onSelect"),0Br||(e.current=pu[Br],pu[Br]=null,Br--)}function Pe(e,t){Br++,pu[Br]=e.current,e.current=t}var Vn={},at=Yn(Vn),yt=Yn(!1),fr=Vn;function ss(e,t){var n=e.type.contextTypes;if(!n)return Vn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function _t(e){return e=e.childContextTypes,e!=null}function Hi(){Me(yt),Me(at)}function Qd(e,t,n){if(at.current!==Vn)throw Error(se(168));Pe(at,t),Pe(yt,n)}function Yh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(se(108,D0(e)||"Unknown",s));return Fe({},n,r)}function Wi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vn,fr=at.current,Pe(at,e),Pe(yt,yt.current),!0}function Zd(e,t,n){var r=e.stateNode;if(!r)throw Error(se(169));n?(e=Yh(e,t,fr),r.__reactInternalMemoizedMergedChildContext=e,Me(yt),Me(at),Pe(at,e)):Me(yt),Pe(yt,n)}var un=null,El=!1,ca=!1;function Kh(e){un===null?un=[e]:un.push(e)}function sv(e){El=!0,Kh(e)}function Kn(){if(!ca&&un!==null){ca=!0;var e=0,t=Ie;try{var n=un;for(Ie=1;e>=i,s-=i,cn=1<<32-Ht(t)+s|n<$?(B=R,R=null):B=R.sibling;var D=f(p,R,_[$],w);if(D===null){R===null&&(R=B);break}e&&R&&D.alternate===null&&t(p,R),g=o(D,g,$),A===null?P=D:A.sibling=D,A=D,R=B}if($===_.length)return n(p,R),Oe&&qn(p,$),P;if(R===null){for(;$<_.length;$++)R=d(p,_[$],w),R!==null&&(g=o(R,g,$),A===null?P=R:A.sibling=R,A=R);return Oe&&qn(p,$),P}for(R=r(p,R);$<_.length;$++)B=m(R,p,$,_[$],w),B!==null&&(e&&B.alternate!==null&&R.delete(B.key===null?$:B.key),g=o(B,g,$),A===null?P=B:A.sibling=B,A=B);return e&&R.forEach(function(U){return t(p,U)}),Oe&&qn(p,$),P}function x(p,g,_,w){var P=vs(_);if(typeof P!="function")throw Error(se(150));if(_=P.call(_),_==null)throw Error(se(151));for(var A=P=null,R=g,$=g=0,B=null,D=_.next();R!==null&&!D.done;$++,D=_.next()){R.index>$?(B=R,R=null):B=R.sibling;var U=f(p,R,D.value,w);if(U===null){R===null&&(R=B);break}e&&R&&U.alternate===null&&t(p,R),g=o(U,g,$),A===null?P=U:A.sibling=U,A=U,R=B}if(D.done)return n(p,R),Oe&&qn(p,$),P;if(R===null){for(;!D.done;$++,D=_.next())D=d(p,D.value,w),D!==null&&(g=o(D,g,$),A===null?P=D:A.sibling=D,A=D);return Oe&&qn(p,$),P}for(R=r(p,R);!D.done;$++,D=_.next())D=m(R,p,$,D.value,w),D!==null&&(e&&D.alternate!==null&&R.delete(D.key===null?$:D.key),g=o(D,g,$),A===null?P=D:A.sibling=D,A=D);return e&&R.forEach(function(Q){return t(p,Q)}),Oe&&qn(p,$),P}function T(p,g,_,w){if(typeof _=="object"&&_!==null&&_.type===Mr&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Lo:e:{for(var P=_.key,A=g;A!==null;){if(A.key===P){if(P=_.type,P===Mr){if(A.tag===7){n(p,A.sibling),g=s(A,_.props.children),g.return=p,p=g;break e}}else if(A.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===In&&ef(P)===A.type){n(p,A.sibling),g=s(A,_.props),g.ref=Ns(p,A,_),g.return=p,p=g;break e}n(p,A);break}else t(p,A);A=A.sibling}_.type===Mr?(g=ur(_.props.children,p.mode,w,_.key),g.return=p,p=g):(w=Ii(_.type,_.key,_.props,null,p.mode,w),w.ref=Ns(p,g,_),w.return=p,p=w)}return i(p);case Rr:e:{for(A=_.key;g!==null;){if(g.key===A)if(g.tag===4&&g.stateNode.containerInfo===_.containerInfo&&g.stateNode.implementation===_.implementation){n(p,g.sibling),g=s(g,_.children||[]),g.return=p,p=g;break e}else{n(p,g);break}else t(p,g);g=g.sibling}g=_a(_,p.mode,w),g.return=p,p=g}return i(p);case In:return A=_._init,T(p,g,A(_._payload),w)}if(Ls(_))return v(p,g,_,w);if(vs(_))return x(p,g,_,w);Go(p,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,g!==null&&g.tag===6?(n(p,g.sibling),g=s(g,_),g.return=p,p=g):(n(p,g),g=ya(_,p.mode,w),g.return=p,p=g),i(p)):n(p,g)}return T}var is=qh(!0),Jh=qh(!1),Yi=Yn(null),Ki=null,Dr=null,Ec=null;function Nc(){Ec=Dr=Ki=null}function Tc(e){var t=Yi.current;Me(Yi),e._currentValue=t}function gu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qr(e,t){Ki=e,Ec=Dr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(mt=!0),e.firstContext=null)}function Ot(e){var t=e._currentValue;if(Ec!==e)if(e={context:e,memoizedValue:t,next:null},Dr===null){if(Ki===null)throw Error(se(308));Dr=e,Ki.dependencies={lanes:0,firstContext:e}}else Dr=Dr.next=e;return t}var sr=null;function Ic(e){sr===null?sr=[e]:sr.push(e)}function em(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Ic(t)):(n.next=s.next,s.next=n),t.interleaved=n,yn(e,r)}function yn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Cn=!1;function Cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tm(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ee&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,yn(e,n)}return s=r.interleaved,s===null?(t.next=t,Ic(r)):(t.next=s.next,s.next=t),r.interleaved=t,yn(e,n)}function xi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fc(e,n)}}function tf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Xi(e,t,n,r){var s=e.updateQueue;Cn=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,u=a.next;a.next=null,i===null?o=u:i.next=u,i=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==i&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(o!==null){var d=s.baseState;i=0,c=u=a=null,l=o;do{var f=l.lane,m=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var v=e,x=l;switch(f=t,m=n,x.tag){case 1:if(v=x.payload,typeof v=="function"){d=v.call(m,d,f);break e}d=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=x.payload,f=typeof v=="function"?v.call(m,d,f):v,f==null)break e;d=Fe({},d,f);break e;case 2:Cn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=m,a=d):c=c.next=m,i|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(c===null&&(a=d),s.baseState=a,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);mr|=i,e.lanes=i,e.memoizedState=d}}function nf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=fa.transition;fa.transition={};try{e(!1),t()}finally{Ie=n,fa.transition=r}}function _m(){return Lt().memoizedState}function av(e,t,n){var r=Dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vm(e))xm(t,n);else if(n=em(e,t,n,r),n!==null){var s=dt();Wt(n,e,r,s),wm(n,t,r)}}function uv(e,t,n){var r=Dn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vm(e))xm(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(s.hasEagerState=!0,s.eagerState=l,Gt(l,i)){var a=t.interleaved;a===null?(s.next=s,Ic(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=em(e,t,s,r),n!==null&&(s=dt(),Wt(n,e,r,s),wm(n,t,r))}}function vm(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function xm(e,t){Gs=Zi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wm(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fc(e,n)}}var qi={readContext:Ot,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useInsertionEffect:st,useLayoutEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useMutableSource:st,useSyncExternalStore:st,useId:st,unstable_isNewReconciler:!1},cv={readContext:Ot,useCallback:function(e,t){return Qt().memoizedState=[e,t===void 0?null:t],e},useContext:Ot,useEffect:sf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Si(4194308,4,pm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Si(4194308,4,e,t)},useInsertionEffect:function(e,t){return Si(4,2,e,t)},useMemo:function(e,t){var n=Qt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=av.bind(null,Be,e),[r.memoizedState,e]},useRef:function(e){var t=Qt();return e={current:e},t.memoizedState=e},useState:rf,useDebugValue:Lc,useDeferredValue:function(e){return Qt().memoizedState=e},useTransition:function(){var e=rf(!1),t=e[0];return e=lv.bind(null,e[1]),Qt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Be,s=Qt();if(Oe){if(n===void 0)throw Error(se(407));n=n()}else{if(n=t(),qe===null)throw Error(se(349));hr&30||om(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,sf(lm.bind(null,r,o,e),[e]),r.flags|=2048,ho(9,im.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Qt(),t=qe.identifierPrefix;if(Oe){var n=dn,r=cn;n=(r&~(1<<32-Ht(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=fo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Zt]=t,e[lo]=r,Am(e,t,!1,!1),t.stateNode=e;e:{switch(i=Xa(n,r),n){case"dialog":Re("cancel",e),Re("close",e),s=r;break;case"iframe":case"object":case"embed":Re("load",e),s=r;break;case"video":case"audio":for(s=0;sus&&(t.flags|=128,r=!0,Ts(o,!1),t.lanes=4194304)}else{if(!r)if(e=Yi(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ts(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Oe)return ot(t),null}else 2*He()-o.renderingStartTime>us&&n!==1073741824&&(t.flags|=128,r=!0,Ts(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=He(),t.sibling=null,n=Le.current,Pe(Le,r?n&1|2:n&1),t):(ot(t),null);case 22:case 23:return Dc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?wt&1073741824&&(ot(t),t.subtreeFlags&6&&(t.flags|=8192)):ot(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function yv(e,t){switch(wc(t),t.tag){case 1:return _t(t.type)&&zi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),Me(yt),Me(at),bc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pc(t),null;case 13:if(Me(Le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));os()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me(Le),null;case 4:return ls(),null;case 10:return Tc(t.type._context),null;case 22:case 23:return Dc(),null;case 24:return null;default:return null}}var Yo=!1,lt=!1,_v=typeof WeakSet=="function"?WeakSet:Set,fe=null;function Ur(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function Su(e,t,n){try{n()}catch(r){De(e,t,r)}}var gf=!1;function vv(e,t){if(ou=$i,e=Bh(),vc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,a=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(l=i+s),d!==o||r!==0&&d.nodeType!==3||(a=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++u===s&&(l=i),f===o&&++c===r&&(a=i),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(iu={focusedElem:e,selectionRange:n},$i=!1,fe=t;fe!==null;)if(t=fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,fe=e;else for(;fe!==null;){t=fe;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,T=v.memoizedState,p=t.stateNode,g=p.getSnapshotBeforeUpdate(t.elementType===t.type?x:jt(t.type,x),T);p.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(se(163))}}catch(w){De(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,fe=e;break}fe=t.return}return v=gf,gf=!1,v}function Ys(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Su(t,n,o)}s=s.next}while(s!==r)}}function El(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Eu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Om(e){var t=e.alternate;t!==null&&(e.alternate=null,Om(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zt],delete t[lo],delete t[uu],delete t[tv],delete t[nv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Lm(e){return e.tag===5||e.tag===3||e.tag===4}function yf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Nu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Fi));else if(r!==4&&(e=e.child,e!==null))for(Nu(e,t,n),e=e.sibling;e!==null;)Nu(e,t,n),e=e.sibling}function Tu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}var et=null,Bt=!1;function Sn(e,t,n){for(n=n.child;n!==null;)$m(e,t,n),n=n.sibling}function $m(e,t,n){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(ml,n)}catch{}switch(n.tag){case 5:lt||Ur(n,t);case 6:var r=et,s=Bt;et=null,Sn(e,t,n),et=r,Bt=s,et!==null&&(Bt?(e=et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):et.removeChild(n.stateNode));break;case 18:et!==null&&(Bt?(e=et,n=n.stateNode,e.nodeType===8?ia(e.parentNode,n):e.nodeType===1&&ia(e,n),no(e)):ia(et,n.stateNode));break;case 4:r=et,s=Bt,et=n.stateNode.containerInfo,Bt=!0,Sn(e,t,n),et=r,Bt=s;break;case 0:case 11:case 14:case 15:if(!lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Su(n,t,i),s=s.next}while(s!==r)}Sn(e,t,n);break;case 1:if(!lt&&(Ur(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){De(n,t,l)}Sn(e,t,n);break;case 21:Sn(e,t,n);break;case 22:n.mode&1?(lt=(r=lt)||n.memoizedState!==null,Sn(e,t,n),lt=r):Sn(e,t,n);break;default:Sn(e,t,n)}}function _f(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _v),t.forEach(function(r){var s=kv.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function $t(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~o}if(r=s,r=He()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*wv(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,qi=0,Ee&6)throw Error(se(331));var s=Ee;for(Ee|=4,fe=e.current;fe!==null;){var o=fe,i=o.child;if(fe.flags&16){var l=o.deletions;if(l!==null){for(var a=0;aHe()-Fc?ar(e,0):Bc|=n),vt(e,t)}function Wm(e,t){t===0&&(e.mode&1?(t=Bo,Bo<<=1,!(Bo&130023424)&&(Bo=4194304)):t=1);var n=dt();e=yn(e,t),e!==null&&(Io(e,t,n),vt(e,n))}function Cv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wm(e,n)}function kv(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(se(314))}r!==null&&r.delete(t),Wm(e,n)}var Vm;Vm=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)mt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return mt=!1,mv(e,t,n);mt=!!(e.flags&131072)}else mt=!1,Oe&&t.flags&1048576&&Xh(t,Hi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Si(e,t),e=t.pendingProps;var s=ss(t,at.current);qr(t,n),s=Rc(null,t,r,e,s,n);var o=Mc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(r)?(o=!0,Di(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Cc(t),s.updater=Sl,t.stateNode=s,s._reactInternals=t,mu(t,r,e,n),t=_u(null,t,r,!0,o,n)):(t.tag=0,Oe&&o&&xc(t),ut(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Si(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=bv(r),e=jt(r,e),s){case 0:t=yu(null,t,r,e,n);break e;case 1:t=pf(null,t,r,e,n);break e;case 11:t=df(null,t,r,e,n);break e;case 14:t=ff(null,t,r,jt(r.type,e),n);break e}throw Error(se(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),yu(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),pf(e,t,r,s,n);case 3:e:{if(km(t),e===null)throw Error(se(387));r=t.pendingProps,o=t.memoizedState,s=o.element,tm(e,t),Gi(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=as(Error(se(423)),t),t=hf(e,t,r,n,s);break e}else if(r!==s){s=as(Error(se(424)),t),t=hf(e,t,r,n,s);break e}else for(St=Bn(t.stateNode.containerInfo.firstChild),Et=t,Oe=!0,zt=null,n=Jh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(os(),r===s){t=_n(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return nm(t),e===null&&fu(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,lu(r,s)?i=null:o!==null&&lu(r,o)&&(t.flags|=32),Cm(e,t),ut(e,t,i,n),t.child;case 6:return e===null&&fu(t),null;case 13:return Pm(e,t,n);case 4:return kc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=is(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),df(e,t,r,s,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,Pe(Wi,r._currentValue),r._currentValue=i,o!==null)if(Gt(o.value,i)){if(o.children===s.children&&!yt.current){t=_n(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=pn(-1,n&-n),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),pu(o.return,n,t),l.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(se(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),pu(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ut(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,qr(t,n),s=Ot(s),r=r(s),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,s=jt(r,t.pendingProps),s=jt(r.type,s),ff(e,t,r,s,n);case 15:return Tm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),Si(e,t),t.tag=1,_t(r)?(e=!0,Di(t)):e=!1,qr(t,n),Sm(t,r,s),mu(t,r,s,n),_u(null,t,r,!0,e,n);case 19:return bm(e,t,n);case 22:return Im(e,t,n)}throw Error(se(156,t.tag))};function Gm(e,t){return vh(e,t)}function Pv(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function At(e,t,n,r){return new Pv(e,t,n,r)}function Hc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function bv(e){if(typeof e=="function")return Hc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ac)return 11;if(e===uc)return 14}return 2}function Un(e,t){var n=e.alternate;return n===null?(n=At(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ti(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")Hc(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Mr:return ur(n.children,s,o,t);case lc:i=8,s|=8;break;case Fa:return e=At(12,n,t,s|2),e.elementType=Fa,e.lanes=o,e;case za:return e=At(13,n,t,s),e.elementType=za,e.lanes=o,e;case Da:return e=At(19,n,t,s),e.elementType=Da,e.lanes=o,e;case nh:return Tl(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case eh:i=10;break e;case th:i=9;break e;case ac:i=11;break e;case uc:i=14;break e;case In:i=16,r=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=At(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function ur(e,t,n,r){return e=At(7,e,r,t),e.lanes=n,e}function Tl(e,t,n,r){return e=At(22,e,r,t),e.elementType=nh,e.lanes=n,e.stateNode={isHidden:!1},e}function ha(e,t,n){return e=At(6,e,null,t),e.lanes=n,e}function ma(e,t,n){return t=At(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Av(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xl(0),this.expirationTimes=Xl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xl(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Wc(e,t,n,r,s,o,i,l,a){return e=new Av(e,t,n,l,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=At(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cc(o),e}function Rv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qm)}catch(e){console.error(e)}}Qm(),Qp.exports=It;var Zm=Qp.exports,If=Zm;ja.createRoot=If.createRoot,ja.hydrateRoot=If.hydrateRoot;function tl({title:e,subtitle:t,children:n}){const r=!!e||!!t;return h.jsxs("section",{className:`panel ${r?"":"panel--headerless"}`.trim(),children:[r?h.jsxs("header",{className:"panel__header",children:[e?h.jsx("h2",{children:e}):null,t?h.jsx("p",{children:t}):null]}):null,h.jsx("div",{className:"panel__body",children:n})]})}const nl=["#93c5fd","#a78bfa","#f9a8d4","#86efac","#fdba74","#67e8f9","#fca5a5","#c4b5fd","#fde68a","#6ee7b7","#fda4af","#5eead4","#ddd6fe","#bef264","#fbcfe8","#bae6fd"];function jv(e){let t=0;for(let n=0;n>>0;return t}function Bv(e){return`hsl(${(e*137.508%360).toFixed(1)} 75% 68%)`}function Cf(e){const t=[...new Set(e)].sort(),n={};for(let r=0;re.layout.cols){Gv(e);for(let o=0;ol+a+1||(e.beginPath(),e.moveTo(c,t.top),e.lineTo(c,t.top+t.plotHeight),e.stroke())}for(let u=0;u<=t.yTicks;u+=1){const c=t.plotBottom-u/t.yTicks*(t.plotBottom-t.plotTop);e.beginPath(),e.moveTo(l,c),e.lineTo(l+a,c),e.stroke()}e.strokeStyle=s.axis,e.beginPath(),e.moveTo(l,t.plotBottom),e.lineTo(l+a,t.plotBottom),e.stroke()}function sl(e,t,{color:n,lineWidth:r,alpha:s=1,lineDash:o=[],startCol:i,endCol:l,yMaxMs:a,layout:u}){const c=Math.max(0,i-1),d=Math.min(u.cols-1,l+1);e.strokeStyle=n,e.lineWidth=r,e.globalAlpha=s,e.setLineDash(o),e.beginPath();const f=[];let m=null,v=Number.NaN,x=!1;for(let T=c-1;T>=0;T-=1){const p=t[T];if(Number.isFinite(p)){m=T,v=p,x=p>a;break}}for(let T=c;T<=d;T+=1){const p=t[T];if(!Number.isFinite(p))continue;const g=p>a;if(g&&!x&&f.push(T),m!==null&&Number.isFinite(v)){const _=v>a;if(!(_&&g)){const w=u.left+m+.5,P=_?u.plotTop:mo(v,a,u),A=u.left+T+.5,R=g?u.plotTop:mo(p,a,u);e.moveTo(w,P),e.lineTo(A,R)}}m=T,v=p,x=g}if(e.stroke(),e.setLineDash([]),e.globalAlpha=1,f.length>0){e.fillStyle=n,e.globalAlpha=Math.min(1,s+.1);for(const T of f){const p=u.left+T;e.fillRect(p,u.plotTop,1,3)}e.globalAlpha=1}}function Pf(e,t,n,{color:r,alpha:s,lineDash:o=[],startCol:i,endCol:l,yMaxMs:a,layout:u}){e.strokeStyle=r,e.lineWidth=1,e.globalAlpha=s,e.setLineDash(o);for(let c=i;c<=l;c+=1){const d=t[c],f=n[c];if(!Number.isFinite(d)||!Number.isFinite(f)||f<=d)continue;const m=u.left+c+.5,v=d>a?u.plotTop:mo(d,a,u),x=f>a?u.plotTop:mo(f,a,u);e.beginPath(),e.moveTo(m,v),e.lineTo(m,x),e.stroke()}e.setLineDash([]),e.globalAlpha=1}function bf(e,t,{color:n,alpha:r,startCol:s,endCol:o,yMaxMs:i,layout:l}){const a=Math.max(0,s-1),u=Math.min(l.cols-1,o+1);let c=null,d=null;for(let f=a;f<=u;f+=1){const m=t[f];!Number.isFinite(m)||m<=0||(c===null&&(c=f),d=f)}if(!(c===null||d===null)){e.fillStyle=n,e.globalAlpha=r,e.beginPath(),e.moveTo(l.left+c+.5,l.plotBottom);for(let f=c;f<=d;f+=1){const m=t[f];if(!Number.isFinite(m)||m<=0)continue;const v=Math.min(m,i),x=l.left+f+.5,T=mo(v,i,l);e.lineTo(x,T)}e.lineTo(l.left+d+.5,l.plotBottom),e.closePath(),e.fill(),e.globalAlpha=1}}function Xv(e,{leaseBins:t,userBins:n,color:r,startCol:s,endCol:o,yMaxMs:i,layout:l}){if(bf(e,t,{color:r,alpha:.18,startCol:s,endCol:o,yMaxMs:i,layout:l}),n!==null){const a=new Float32Array(n.length);a.fill(Number.NaN);for(let u=s;u<=o&&u9&&(n*=10,r=1),Math.max(Wr,r*n)}function Rf(e){if(!Number.isFinite(e)||e<=0)return Bs;const t=1e3/e;return Zv(t*1.25)}function Mf(e,t,n,r,s,o,i){let l=e.get(o),a=t.get(o),u=n.get(o),c=r.get(o),d=s.get(o);return l||(l=rl(i),e.set(o,l)),a||(a=rl(i),t.set(o,a)),u||(u=new Float64Array(i),n.set(o,u)),c||(c=new Uint16Array(i),r.set(o,c)),d||(d=new Int32Array(i),d.fill(-2147483648),s.set(o,d)),{bins:l,peakBins:a,sumBins:u,countBins:c,cycleBins:d}}function qv({samples:e,publisherProcessId:t,publisherEndpointId:n,nominalPublishRateHz:r,topic:s,topicScope:o,leaseColorMap:i,selectedSubscriberEndpointId:l=null,windowSeconds:a,onWindowSecondsChange:u,darkMode:c=!1}){const d=E.useRef(null),f=E.useRef(null),m=E.useRef(null),v=E.useRef(null),x=E.useRef(!0),T=E.useRef(!1),[p,g]=E.useState(()=>a.toFixed(1)),[_,w]=E.useState(!0),[P,A]=E.useState(`${Bs.toFixed(2)}`),[R,$]=E.useState("lease_time_ns"),B=E.useMemo(()=>l?Qs(l,i):null,[i,l]),D=c?qm:Fv,U=E.useMemo(()=>Qo(P),[P]),Q=E.useMemo(()=>o&&o.length>0?o:[s],[s,o]),z=E.useMemo(()=>[...Q].sort().join("|"),[Q]),y=`${t}|${n}`,I=O=>{const C=Qo(O??p);if(C===null||!u){g(a.toFixed(1));return}const S=yr(C,.5,30);u(S),g(S.toFixed(1))},N=()=>{var O;if(_){const C=((O=m.current)==null?void 0:O.yMaxMs)??Rf(r);A(C.toFixed(2)),w(!1);return}w(!0)};return E.useEffect(()=>{g(a.toFixed(1))},[a]),E.useEffect(()=>{const O=d.current;if(!O)return;const C=O.getContext("2d");if(!C)return;const S=Math.max(1,window.devicePixelRatio||1),b=Uv(O,a),j=Math.floor(b.width*S),M=Math.floor(b.height*S),K=f.current,Y=!K||K.width!==j||K.height!==M;Y&&(O.width=j,O.height=M,f.current={width:j,height:M}),C.setTransform(S,0,0,S,0,0);const ee=Math.max(1,a*1e9),te=Rf(r),pe=_?te:Math.max(Wr,U??Bs);let V=m.current;const me=V===null||Y||V.layout.cols!==b.cols||V.layout.width!==b.width||V.windowNs!==ee||V.scopeSignature!==z||V.publisherSignature!==y;if(me&&(V=Hv(b,ee,z,y,pe),m.current=V,v.current=null,C.fillStyle=D.background,C.fillRect(0,0,b.width,b.height)),V===null)return;const he=new Set;let ve=V.lastTimestamp,Se=!1,k=V.lastWipeCycle,L=null;V.originNs!==null&&Number.isFinite(V.lastTimestamp)&&(L=ga(V.lastTimestamp,V.originNs,V.windowNs,V.layout.cols));const ne=e!==v.current?e:[];e!==v.current&&(v.current=e);for(const J of ne){if(!Number.isFinite(J.timestamp)||!Number.isFinite(J.value)||!Wv(J.topic,Q))continue;const q=J.metric==="publish_delta_ns"&&J.processId===t&&J.endpointId===n,H=J.metric==="lease_time_ns",oe=J.metric==="user_span_ns";if(!q&&!H&&!oe||(V.originNs===null&&(V.originNs=J.timestamp),V.originNs===null||J.timestamp0&&(Yv(V,L,F,he),L=F):L=F,q){re>V.publishCycle[W]&&(V.publishCycle[W]=re,V.publishBins[W]=Number.NaN,V.publishPeakBins[W]=Number.NaN,V.publishSumBins[W]=0,V.publishCountBins[W]=0,he.add(W));const X=Math.min(65535,V.publishCountBins[W]+1);V.publishCountBins[W]=X,V.publishSumBins[W]+=ae;const Z=V.publishSumBins[W]/X,de=V.publishBins[W];(!Number.isFinite(de)||Math.abs(Z-de)>1e-6)&&(V.publishBins[W]=Z,he.add(W));const ce=V.publishPeakBins[W];(!Number.isFinite(ce)||ae>ce)&&(V.publishPeakBins[W]=ae,he.add(W))}else{const X=H?Mf(V.leaseBinsByEndpoint,V.leasePeakBinsByEndpoint,V.leaseSumByEndpoint,V.leaseCountByEndpoint,V.leaseCycleByEndpoint,J.endpointId,V.layout.cols):Mf(V.userBinsByEndpoint,V.userPeakBinsByEndpoint,V.userSumByEndpoint,V.userCountByEndpoint,V.userCycleByEndpoint,J.endpointId,V.layout.cols);re>X.cycleBins[W]&&(X.cycleBins[W]=re,X.bins[W]=Number.NaN,X.peakBins[W]=Number.NaN,X.sumBins[W]=0,X.countBins[W]=0,he.add(W));const Z=Math.min(65535,X.countBins[W]+1);X.countBins[W]=Z,X.sumBins[W]+=ae;const de=X.sumBins[W]/Z,ce=X.bins[W];(!Number.isFinite(ce)||Math.abs(de-ce)>1e-6)&&(X.bins[W]=de,he.add(W));const Ne=X.peakBins[W];(!Number.isFinite(Ne)||ae>Ne)&&(X.peakBins[W]=ae,he.add(W))}ve=Math.max(ve,J.timestamp),Se=!0}const le=_&&!x.current;if(x.current=_,_?le?V.yMaxMs=te:k>V.lastWipeCycle&&(V.lastWipeCycle=k,V.yMaxMs=te):V.yMaxMs=Math.max(Wr,U??Bs),_){const J=V.yMaxMs.toFixed(2);P!==J&&A(J)}if(Se&&V.originNs!==null){const J=ga(ve,V.originNs,V.windowNs,V.layout.cols);he.add(J.col),V.lastCursorCol!==null&&kf(he,V.lastCursorCol,V.layout.cols);const q=(J.col+zv)%V.layout.cols;kf(he,q,V.layout.cols),V.lastCursorCol=q,V.lastTimestamp=ve}if((me||he.size>0)&&(C.fillStyle=D.background,C.fillRect(0,0,V.layout.width,V.layout.height),Qv(C,V,0,V.layout.cols-1,R,l,i,D)),V.lastTimestamp<=0){C.fillStyle=D.background,C.fillRect(0,0,V.layout.width,V.layout.height),C.fillStyle=D.waitingText,C.font='12px "Avenir Next", sans-serif',C.fillText("Waiting for trace samples...",V.layout.left,26),Af(C,V,a,D);return}Af(C,V,a,D)},[_,c,Q,i,U,r,n,t,y,l,e,R,z,a,D]),h.jsxs("div",{className:"timing-trace",children:[h.jsxs("div",{className:"timing-trace__controls",children:[h.jsxs("div",{className:"timing-trace__controls-left",children:[h.jsxs("label",{className:"timing-trace__axis-input",children:[h.jsx("span",{children:"Window (s)"}),h.jsx("input",{type:"number",min:.5,max:30,step:"0.5",value:p,onChange:O=>{const C=O.target.value;g(C),T.current||I(C)},onMouseDown:()=>{T.current=!1},onBlur:()=>{T.current=!1,I()},onKeyDown:O=>{if(O.key==="Enter"){T.current=!1,I();return}if(O.key==="ArrowUp"||O.key==="ArrowDown"){O.preventDefault(),T.current=!1;const C=Qo(p)??a,S=O.key==="ArrowUp"?.5:-.5,b=yr(C+S,.5,30);g(b.toFixed(1)),u==null||u(b);return}(O.key.length===1||O.key==="Backspace"||O.key==="Delete")&&(T.current=!0)}})]}),h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:D.publish}}),"Publish Delta"]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:"transparent",border:`2px solid ${B??"#94a3b8"}`}}),"Lease Time"]}),h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:B??"#94a3b8"}}),"User Span"]})]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:`timing-trace__legend-item timing-trace__legend-toggle ${R==="lease_time_ns"?"is-active":""}`,onClick:()=>$("lease_time_ns"),"aria-pressed":R==="lease_time_ns",children:"Lease Time"}),h.jsx("button",{type:"button",className:`timing-trace__legend-item timing-trace__legend-toggle ${R==="user_span_ns"?"is-active":""}`,onClick:()=>$("user_span_ns"),"aria-pressed":R==="user_span_ns",children:"User Span"})]})]}),h.jsxs("div",{className:"timing-trace__controls-right",children:[h.jsxs("label",{className:"timing-trace__axis-input timing-trace__axis-input--ymax",children:[h.jsx("span",{children:"Y max (ms)"}),h.jsx("input",{type:"number",min:Wr,step:"0.1",value:P,onChange:O=>A(O.target.value),onBlur:()=>{const O=Qo(P);if(O===null){A(`${Bs.toFixed(2)}`);return}const C=Math.max(Wr,O);A(C.toFixed(2))},disabled:_})]}),h.jsx("button",{type:"button",role:"switch","aria-checked":_,className:`timing-trace__mode-toggle ${_?"is-auto":"is-fixed"}`,onClick:N,title:_?"Switch to Fixed Y":"Switch to Auto Y",children:h.jsx("span",{className:"timing-trace__mode-toggle-label",children:_?"Auto":"Fixed"})})]})]}),h.jsx("canvas",{ref:d,className:"timing-trace__canvas"})]})}function je(e){return e.split(":")[0]??e}function bl(e){const[t,...n]=e.split(":");return{topic:t??"",endpointToken:n.join(":")}}function Jv(e){const{endpointToken:t}=bl(e);return t.length>0?t:null}function e1(e){const{topic:t,endpointToken:n}=bl(e);return{topic:t.length>0?t:null,endpointId:n.length>0?n:null}}function Tn(e){return typeof e=="object"&&e!==null}function t1(e,t=null){if(t==="RelayMetadata")return"unknown";if(t==="InputRelayMetadata")return"input";if(t==="OutputRelayMetadata")return"output";if("leaky"in e||"max_queue"in e)return"input";if("num_buffers"in e||"buf_size"in e||"force_tcp"in e||"host"in e||"port"in e)return"output";const s=typeof e.name=="string"?e.name.toUpperCase():"",o=typeof e.address=="string"?e.address.toUpperCase():"";return s.includes("INPUT")||o.includes("/INPUT")?"input":s.includes("OUTPUT")||o.includes("/OUTPUT")?"output":"unknown"}function n1(e){const t=typeof e.metadata_type=="string"?e.metadata_type:typeof e.__type__=="string"?e.__type__:typeof e.type=="string"?e.type:null;if(typeof t=="string"){if(t==="InputRelayMetadata"||t.endsWith(".InputRelayMetadata"))return"InputRelayMetadata";if(t==="OutputRelayMetadata"||t.endsWith(".OutputRelayMetadata"))return"OutputRelayMetadata";if(t==="RelayMetadata"||t.endsWith(".RelayMetadata"))return"RelayMetadata"}const n="leaky"in e||"max_queue"in e,r="num_buffers"in e||"buf_size"in e||"force_tcp"in e||"host"in e||"port"in e;return n&&!r?"InputRelayMetadata":r&&!n?"OutputRelayMetadata":n||r?"RelayMetadata":null}function ya(e,t=null){if(!e)return[];const n=[];for(const[r,s]of Object.entries(e)){if(!Tn(s)||typeof s.address!="string")continue;const o=t==="relay",i=o?n1(s):null;n.push({name:r,address:s.address,direction:t1(s,i),msgType:typeof s.msg_type=="string"?s.msg_type:null,collectionKind:t,relayMetadataType:i,relayGroup:o&&typeof s.relay_group=="string"?s.relay_group:null,relayInputTopic:o&&typeof s.relay_input_topic=="string"?s.relay_input_topic:null,relayOutputTopic:o&&typeof s.relay_output_topic=="string"?s.relay_output_topic:null})}return n.sort((r,s)=>r.address.localeCompare(s.address)),n}function Kc(e){const t=new Map;for(const s of Object.values(e.sessions)){const o=Tn(s.metadata)?s.metadata:null,i=o&&Tn(o.components)?o.components:null;if(i)for(const[l,a]of Object.entries(i))!Tn(a)||t.has(l)||t.set(l,a)}const n=new Map,r=new Map;for(const[s,o]of t.entries()){const i=typeof o.name=="string"?o.name:s,l=typeof o.component_type=="string"?o.component_type:"Component",a=ya(Tn(o.topics)?o.topics:null,"topic"),u=ya(Tn(o.relays)?o.relays:null,"relay"),c=Array.isArray(o.children)?o.children.filter(v=>typeof v=="string"):[];if(c.length>0||a.length>0||u.length>0){const v=new Map;for(const x of a)v.set(x.address,x);for(const x of u)v.set(x.address,x);r.set(s,{address:s,name:i,componentType:l,streams:Array.from(v.values()).sort((x,T)=>x.address.localeCompare(T.address)),children:c})}const d=Tn(o.streams)?o.streams:null;if(!d)continue;const m=(Array.isArray(o.tasks)?o.tasks:[]).filter(Tn).map(v=>{if(typeof v.name!="string")return null;const x=Array.isArray(v.publishes)?v.publishes.filter(T=>typeof T=="string"):[];return{name:v.name,subscribes:typeof v.subscribes=="string"?v.subscribes:null,publishes:x}}).filter(v=>v!==null).sort((v,x)=>v.name.localeCompare(x.name));n.set(s,{address:s,name:i,componentType:l,streams:ya(d),tasks:m})}return{units:n,collections:r}}function Zo(e,t,n){t&&(e.set(t,n),e.set(je(t),n))}function Al(e){const t=new Map,n=new Map;for(const r of e.values())for(const s of r.streams)s.collectionKind==="relay"&&(Zo(t,s.relayInputTopic,s.address),Zo(t,s.relayOutputTopic,s.address),Zo(n,s.relayInputTopic,r.address),Zo(n,s.relayOutputTopic,r.address));return{endpointByInternalTopic:t,collectionByInternalTopic:n}}function r1(e,t){const n=new Map;for(const s of e)n.set(s,0);const r=Math.max(1,e.length);for(let s=0;sa&&(n.set(i.to,u),o=!0)}if(!o)break}return n}function bu(e,t,n){if(n){const o=t.get(n);return o?o.children.filter(i=>e.has(i)||t.has(i)):[]}const r=new Set;for(const o of t.values())for(const i of o.children)r.add(i);const s=[...Array.from(t.keys()),...Array.from(e.keys())].filter(o=>!r.has(o));return s.length>0?s:Array.from(e.keys())}function Rl(e){const t=new Map;for(const[n,r]of e.entries())for(const s of r.children)t.has(s)||t.set(s,n);return t}function s1(e,t){if(!t||!e.has(t))return[];const n=Rl(e),r=[],s=new Set;let o=t;for(;o&&!s.has(o);)s.add(o),r.push(o),o=n.get(o);return r.reverse()}function o1(e,t,n){const r=n.get(e);return r?r.children.some(s=>t.has(s)||n.has(s)):!1}function Au(e,t,n){if(e===t)return!0;const r=new Set;let s=e;for(;s&&!r.has(s);){r.add(s);const o=n.get(s);if(!o)return!1;if(o===t)return!0;s=o}return!1}function i1(e,t,n,r){const s=Rl(n),o=Al(n),i=new Map,l=(u,c)=>{i.set(u,c),i.set(je(u),c)};for(const u of t.values())for(const c of u.streams)l(c.address,u.address);for(const u of n.values())for(const c of u.streams)l(c.address,u.address);for(const[u,c]of o.collectionByInternalTopic.entries())i.set(u,c);const a=new Set;for(const[u,c]of Object.entries(e.graph)){a.add(u);for(const d of c)a.add(d)}for(const u of a){const c=i.get(u);if(!c||!Au(c,r,s))return!0}return!1}const l1="/INPUT_SETTINGS";function a1(e){return e.endsWith(l1)}const go=2,u1=.5,c1=30,d1=new Set(["publish_delta_ns"]),f1=new Set(["lease_time_ns","user_span_ns"]);function er(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function p1(e){return`${e.toFixed(1)} Hz`}function h1(e){return!Number.isFinite(e)||e<=0?"":Math.abs(e-Math.round(e))<1e-6?`${Math.round(e)}s`:`${e.toFixed(1)}s`}function m1(e,t,n){return Math.min(n,Math.max(t,e))}function Ru(e){return!Number.isFinite(e)||e<=0?go:m1(e,u1,c1)}function g1(e){if(!Number.isFinite(e)||e<=0)return go;const t=Math.max(go,Math.round(10/e));return Ru(t)}function y1(e,t=48){return e.length<=t?e:`${e.slice(0,t-1)}…`}function _1(e,t,n){return n!==null&&n>0&&t/n>.5?"backpressure":e>0?"active":"idle"}function Of(e){return typeof e=="object"&&e!==null}function cs(e,t){return t.get(e)??t.get(je(e))??e}function Xc(e,t){const{topic:n,endpointToken:r}=bl(e);return n.length===0||r.length===0?e:`${cs(n,t)}:${r}`}function v1(e,t){if(!e)return[];const n=[];for(const[r,s]of Object.entries(e.data.batches)){if(!Of(s))continue;const o=s.samples;if(Array.isArray(o))for(const i of o){if(!Of(i))continue;const l=i.endpoint_id,a=i.topic,u=i.metric,c=i.value,d=i.timestamp,f=i.sample_seq;if(typeof l!="string"||typeof a!="string"||typeof u!="string"||typeof c!="number"||!Number.isFinite(c))continue;const m=Xc(l,t),v=cs(a,t);n.push({rowId:`${r}:${m}`,processId:r,endpointId:m,topic:v,timestamp:typeof d=="number"&&Number.isFinite(d)?d:e.data.timestamp,metric:u,value:c,sampleSeq:typeof f=="number"&&Number.isFinite(f)?Math.trunc(f):null,channelKind:typeof i.channel_kind=="string"?i.channel_kind:null})}}return n}function x1(e,t,n,r,s){const o=cs(t.topic,s);return{id:`${e.process_id}:${t.endpoint_id}`,endpointId:t.endpoint_id,displayEndpointId:Xc(t.endpoint_id,s),topic:o,processId:e.process_id,pid:e.pid,host:e.host,messagesWindow:er(t.messages_received_window),channelKindLast:typeof t.channel_kind_last=="string"?t.channel_kind_last:"unknown",unitAddress:n.get(t.endpoint_id)??r.get(o)??null}}function Mu(e,t,n){const r=cs(e,n),s=new Set([r]),o=new Set([e,r]);for(const i of o){const l=t==null?void 0:t.graph[i];if(Array.isArray(l))for(const a of l)typeof a=="string"&&s.add(cs(a,n))}return s}function Lf(e,t){if(t.has(e))return!0;for(const n of t)if(e.startsWith(`${n}:`))return!0;return!1}function w1(e,t,n,r){const s=Mu(e,n,r);return t.filter(o=>s.has(o.topic)).sort((o,i)=>{const l=o.topic.localeCompare(i.topic);if(l!==0)return l;const a=o.processId.localeCompare(i.processId);return a!==0?a:o.endpointId.localeCompare(i.endpointId)})}function S1(e,t,n,r,s,o,i){const l=`${e.process_id}:${t.endpoint_id}`,a=t.num_buffers,u=typeof a=="number"&&Number.isFinite(a)?Math.max(0,Math.trunc(a)):null,c=cs(t.topic,i);return{id:l,endpointId:t.endpoint_id,displayEndpointId:Xc(t.endpoint_id,i),topic:c,processId:e.process_id,pid:e.pid,host:e.host,windowSeconds:er(e.window_seconds),publishRateHzWindow:er(t.publish_rate_hz_window),messagesPublishedWindow:er(t.messages_published_window),inflightCurrent:er(t.inflight_messages_current),numBuffers:u,activityTone:_1(er(t.messages_published_window),er(t.inflight_messages_current),u),contributors:w1(c,n,r,i),unitAddress:s.get(t.endpoint_id)??o.get(c)??null}}function E1({graphSnapshot:e,profilingSnapshot:t,latestTraceEvent:n,setProfilingTraceControl:r,focusPublisherEndpointId:s=null,focusPublisherTopic:o=null,focusSubscriberEndpointId:i=null,focusUnitAddress:l=null,focusActionId:a=0,showSettingsChannels:u=!1,hideFilters:c=!1,defaultTraceMetrics:d=["publish_delta_ns","lease_time_ns","user_span_ns"],traceDockHost:f=null,onTraceDockStateChange:m,traceCloseSignal:v=0,onPublisherSelect:x,onSubscriberSelect:T,darkMode:p=!1}){const[g,_]=E.useState(""),[w,P]=E.useState([]),[A,R]=E.useState([]),[$,B]=E.useState({}),[D,U]=E.useState({}),[Q,z]=E.useState({}),[y,I]=E.useState({}),[N,O]=E.useState({}),C=E.useRef(v),S=E.useRef(-1),b=E.useRef({}),j=E.useMemo(()=>t?Object.values(t):[],[t]),M=E.useMemo(()=>e?Kc(e):null,[e]),K=E.useMemo(()=>M?Al(M.collections).endpointByInternalTopic:new Map,[M]),Y=E.useMemo(()=>{const F=new Map;if(!M)return F;const X=(Z,de)=>{const ce=Jv(de);ce&&!F.has(ce)&&F.set(ce,Z)};for(const Z of M.units.values())for(const de of Z.streams)X(Z.address,de.address);for(const Z of M.collections.values())for(const de of Z.streams)X(Z.address,de.address);return F},[M]),ee=E.useMemo(()=>{const F=new Map;if(!M)return F;const X=(Z,de)=>{F.set(de,Z),F.set(je(de),Z)};for(const Z of M.units.values())for(const de of Z.streams)X(Z.address,de.address);for(const Z of M.collections.values())for(const de of Z.streams)X(Z.address,de.address);return F},[M]),te=E.useMemo(()=>{const F=[];for(const de of j)for(const ce of Object.values(de.subscribers))F.push(x1(de,ce,Y,ee,K));const X=[];for(const de of j)for(const ce of Object.values(de.publishers))X.push(S1(de,ce,F,e,Y,ee,K));return(u?X:X.filter(de=>!a1(de.topic))).sort((de,ce)=>{const Ne=de.topic.localeCompare(ce.topic);if(Ne!==0)return Ne;const Ae=de.processId.localeCompare(ce.processId);return Ae!==0?Ae:de.endpointId.localeCompare(ce.endpointId)})},[Y,ee,e,j,K,u]),pe=E.useMemo(()=>{const F=g.trim().toLowerCase();return te.filter(X=>F.length===0?!0:X.topic.toLowerCase().includes(F)||X.endpointId.toLowerCase().includes(F)||X.processId.toLowerCase().includes(F))},[te,g]),V=E.useMemo(()=>new Map(te.map(F=>[F.id,F])),[te]);E.useEffect(()=>{if(a===S.current)return;const F=(X,Z)=>{X.length!==0&&(S.current=a,_(""),P(X),O(de=>{if(Z===null)return{};const ce={...de};for(const Ne of X)ce[Ne]=Z;return ce}),window.requestAnimationFrame(()=>{var de;(de=b.current[X[0]])==null||de.scrollIntoView({block:"nearest",behavior:"smooth"})}))};if(s){F(te.filter(X=>X.endpointId===s?!0:o?X.topic===o:!1).map(X=>X.id),null);return}if(i){F(te.filter(X=>X.contributors.some(Z=>Z.endpointId===i)).map(X=>X.id),i);return}l&&F(te.filter(X=>X.unitAddress===l).map(X=>X.id),null)},[s,o,i,l,a,te]),E.useEffect(()=>{if(!n||A.length===0)return;const F=v1(n,K);if(F.length===0)return;const X=new Set(A),Z=A.map(ce=>V.get(ce)).filter(ce=>ce!==void 0).map(ce=>({row:ce,topicScope:Mu(ce.topic,e,K)})),de=new Map(Z.map(ce=>[ce.row.id,ce.topicScope]));B(ce=>{let Ne=!1;const Ae={...ce},we={};for(const ue of F){const ge=new Set,Te=V.get(ue.rowId),ke=de.get(ue.rowId);if(Te&&X.has(ue.rowId)&&ke&&Lf(ue.topic,ke)&&d1.has(ue.metric)&&ge.add(ue.rowId),f1.has(ue.metric))for(const ye of Z)Lf(ue.topic,ye.topicScope)&&ge.add(ye.row.id);for(const ye of ge){const Ce=we[ye];Ce?Ce.push(ue):we[ye]=[ue]}}for(const[ue,ge]of Object.entries(we))ge.length!==0&&(Ae[ue]=ge,Ne=!0);return Ne?Ae:ce})},[A,e,n,K,V]);const me=async(F,X)=>{if(!D[F.id]){U(Z=>({...Z,[F.id]:!0})),z(Z=>({...Z,[F.id]:null})),X?(B(Z=>({...Z,[F.id]:[]})),I(Z=>Z[F.id]!==void 0?Z:{...Z,[F.id]:g1(F.publishRateHzWindow)}),R([F.id])):R(Z=>Z.includes(F.id)?Z.filter(de=>de!==F.id):Z);try{if(X){const Z=A.find(de=>de!==F.id);if(Z){const de=V.get(Z);de&&await r({process_id:de.processId,enabled:!1,publisher_endpoint_id:null,publisher_topic:null,subscriber_topic:null,metrics:null,sample_mod:1,ttl_seconds:null,timeout:2})}}await r({process_id:F.processId,enabled:X,publisher_endpoint_id:X?F.endpointId:null,publisher_topic:null,subscriber_topic:X?F.topic:null,metrics:X?d:null,sample_mod:1,ttl_seconds:null,timeout:2})}catch(Z){const de=Z instanceof Error?Z.message:"Trace control request failed.";z(ce=>({...ce,[F.id]:de})),R(ce=>X?ce.filter(Ne=>Ne!==F.id):ce.includes(F.id)?ce:[...ce,F.id])}finally{U(Z=>({...Z,[F.id]:!1}))}}},he=F=>{const X=!w.includes(F.id);X&&(x==null||x({unitAddress:F.unitAddress,endpointId:F.endpointId,topic:F.topic})),P(Z=>Z.includes(F.id)?Z.filter(de=>de!==F.id):[...Z,F.id]),X||O(Z=>({...Z,[F.id]:null})),!X&&A.includes(F.id)&&me(F,!1)},ve=(F,X)=>{me(F,X)},Se=c,k=A[0]??null,L=k?V.get(k)??null:null,ne=k?$[k]??[]:[],le=k?!!D[k]:!1,J=k?Q[k]??null:null,q=Ru(k?y[k]??go:go),H=L?Array.from(Mu(L.topic,e,K)):[],oe=ne.filter(F=>F.metric==="lease_time_ns"||F.metric==="user_span_ns").map(F=>F.endpointId),W=Cf([...(L==null?void 0:L.contributors.map(F=>F.endpointId))??[],...oe]),re=k?N[k]??null:null;E.useEffect(()=>{if(v===C.current)return;C.current=v;const F=A[0];if(!F)return;const X=V.get(F);if(!X){R([]);return}R([]),r({process_id:X.processId,enabled:!1,publisher_endpoint_id:null,publisher_topic:null,subscriber_topic:null,metrics:null,sample_mod:1,ttl_seconds:null,timeout:2})},[A,V,r,v]),E.useEffect(()=>{if(m){if(!L){m(null);return}m({active:!0,topic:L.topic,endpointId:L.endpointId,status:le?"applying":"capturing"})}},[le,L,m]);const ae=f&&L?Zm.createPortal(h.jsxs("div",{className:"trace-dock-trace",children:[ne.length===0?h.jsx("p",{className:"muted",children:"Waiting for trace samples on this publisher endpoint."}):h.jsx(qv,{samples:ne,publisherProcessId:L.processId,publisherEndpointId:L.endpointId,nominalPublishRateHz:L.publishRateHzWindow,topic:L.topic,topicScope:H,leaseColorMap:W,selectedSubscriberEndpointId:re,windowSeconds:q,darkMode:p,onWindowSecondsChange:F=>I(X=>({...X,[L.id]:Ru(F)}))}),J?h.jsx("p",{className:"patch-status err",children:J}):null]}),f):null;return h.jsxs(tl,{children:[te.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No publishers snapshot entries available."})}):h.jsxs(h.Fragment,{children:[Se?null:h.jsx("div",{className:"settings-search",children:h.jsx("input",{type:"search",placeholder:"Search topic, endpoint, or process",value:g,onChange:F=>_(F.target.value)})}),pe.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No publishers match the current filter."})}):h.jsx("div",{className:"publisher-list",children:pe.map(F=>{const X=w.includes(F.id),Z=A.includes(F.id),de=!!D[F.id],ce=h1(F.windowSeconds),Ne=Cf(F.contributors.map(ue=>ue.endpointId)),Ae=N[F.id]??null,we=F.contributors.some(ue=>ue.endpointId===Ae)?Ae:null;return h.jsxs("article",{ref:ue=>{b.current[F.id]=ue},className:`publisher-row activity-${F.activityTone}`,children:[h.jsxs("button",{type:"button",className:"publisher-row__toggle",onClick:()=>he(F),"aria-expanded":X,children:[h.jsxs("div",{className:"publisher-row__top",children:[h.jsx("div",{className:"publisher-row__identity",children:h.jsx("div",{className:"publisher-row__identity-text",children:h.jsx("p",{className:"mono publisher-topic",title:F.topic,children:F.topic})})}),h.jsx("span",{className:"publisher-caret",children:X?"▾":"▸"})]}),h.jsxs("div",{className:"publisher-row__metrics",children:[h.jsxs("div",{children:[h.jsx("span",{children:"Rate"}),h.jsx("strong",{children:p1(F.publishRateHzWindow)})]}),h.jsxs("div",{children:[h.jsx("span",{children:ce?`Msgs (${ce})`:"Msgs"}),h.jsx("strong",{children:F.messagesPublishedWindow})]}),h.jsxs("div",{children:[h.jsx("span",{children:"Inflight"}),h.jsx("strong",{children:F.numBuffers===null?`${F.inflightCurrent}`:`${F.inflightCurrent} / ${F.numBuffers}`})]}),h.jsxs("div",{children:[h.jsx("span",{children:"Subscribers"}),h.jsx("strong",{children:F.contributors.length})]})]})]}),X?h.jsxs("div",{className:"publisher-row__details",children:[h.jsxs("div",{className:"publisher-kpis",children:[h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Host"}),h.jsx("strong",{children:F.host})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"PID"}),h.jsx("strong",{children:F.pid})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Process"}),h.jsx("strong",{className:"mono",title:F.processId,children:F.processId.slice(0,8)})]})]}),h.jsx("div",{className:"publisher-detail-line",children:h.jsxs("div",{className:"publisher-endpoint",children:[h.jsx("span",{children:"Endpoint"}),h.jsx("code",{className:"mono",title:F.displayEndpointId,children:F.displayEndpointId})]})}),h.jsxs("div",{className:"panel-section",children:[h.jsxs("button",{type:"button",className:`publisher-trace-button ${Z?"is-stop":"is-start"}`,onClick:()=>ve(F,!Z),disabled:de,"aria-pressed":Z,children:[h.jsx("span",{"aria-hidden":"true",className:"publisher-trace-button__icon",children:Z?"■":"▶"}),h.jsx("span",{children:de?"Applying...":Z?"Stop Profiling Trace":"Start Profiling Trace"})]}),h.jsx("div",{className:"subscriber-section-header",children:h.jsx("h3",{children:"Subscribers"})}),F.contributors.length===0?h.jsx("p",{className:"muted",children:"No subscriber profiling data is available for this topic."}):h.jsx("div",{className:"subscriber-list",children:F.contributors.map(ue=>{const ge=we===ue.endpointId;return h.jsxs("article",{className:`subscriber-item ${ge?"is-expanded":""}`,children:[h.jsxs("button",{type:"button",className:"subscriber-item__summary",onClick:()=>{const Te=ge?null:ue.endpointId;Te&&(T==null||T({unitAddress:ue.unitAddress,endpointId:ue.endpointId,topic:ue.topic})),O(ke=>({...ke,[F.id]:Te}))},children:[h.jsx("div",{className:"subscriber-item__identity",children:h.jsx("p",{className:"mono subscriber-topic-short",title:ue.topic,children:h.jsxs("span",{className:"subscriber-topic-with-color",children:[h.jsx("i",{className:"subscriber-trace-dot",style:{background:Qs(ue.endpointId,Ne)}}),h.jsx("span",{className:"subscriber-topic-label",children:y1(ue.topic,72)})]})})}),h.jsxs("div",{className:"subscriber-item__metrics",children:[h.jsxs("span",{children:[h.jsx("em",{children:ce?`Msgs (${ce})`:"Msgs"}),h.jsx("strong",{children:ue.messagesWindow})]}),h.jsxs("span",{children:[h.jsx("em",{children:"Channel"}),h.jsx("strong",{children:ue.channelKindLast})]})]})]}),ge?h.jsx("div",{className:"subscriber-item__detail",children:h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"publisher-kpis",children:[h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Host"}),h.jsx("strong",{children:ue.host})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"PID"}),h.jsx("strong",{children:ue.pid})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Process"}),h.jsx("strong",{className:"mono",title:ue.processId,children:ue.processId.slice(0,8)})]})]}),h.jsx("div",{className:"publisher-detail-line",children:h.jsxs("div",{className:"publisher-endpoint",children:[h.jsx("span",{children:"Endpoint"}),h.jsx("code",{className:"mono",title:ue.displayEndpointId,children:ue.displayEndpointId})]})})]})}):null]},ue.id)})})]})]}):null]},F.id)})})]}),ae]})}const eg="Infinity",tg="-Infinity",ng="NaN",N1=[eg,tg,ng],T1={inf:Number.POSITIVE_INFINITY,infinity:Number.POSITIVE_INFINITY,"+inf":Number.POSITIVE_INFINITY,"+infinity":Number.POSITIVE_INFINITY,"-inf":Number.NEGATIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY,nan:Number.NaN};function rg(e){return typeof e=="string"&&N1.includes(e)}function I1(e){return Number.isFinite(e)?e:Number.isNaN(e)?ng:e>0?eg:tg}function C1(e){return typeof e=="number"?e:rg(e)?Number(e):null}function k1(e){const t=C1(e);return t===null?"":String(t)}function P1(e){const t=e.trim();if(t.length===0)return null;const n=T1[t.toLowerCase()];if(n!==void 0)return n;const r=Number(t);return Number.isNaN(r)?null:r}function b1(e){const t=e.field_type.toLowerCase();return Array.isArray(e.choices)&&e.choices.length>0?"choice":t.includes("bool")?"boolean":t.includes("int")||t.includes("float")||t.includes("double")||t.includes("number")?"number":t.includes("str")||t.includes("string")?"text":"json"}function A1(e){return typeof e=="boolean"?"boolean":typeof e=="number"||rg(e)?"number":typeof e=="string"?"text":"json"}function $f(e,t){if(!e||typeof e!="object")return;const n=t.split(".").filter(s=>s.length>0);let r=e;for(const s of n){if(!r||typeof r!="object"||!(s in r))return;r=r[s]}return r}function sg(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function og(e,t=""){if(!e||typeof e!="object"||Array.isArray(e))return t.length>0?[t]:[];const n=Object.entries(e);if(n.length===0)return t.length>0?[t]:[];const r=[];for(const[s,o]of n){const i=t.length>0?`${t}.${s}`:s,l=og(o,i);l.length===0?r.push(i):r.push(...l)}return r}function R1(e){if(e.mode==="boolean")return!!e.currentValue;if(e.mode==="choice"){const t=e.choices??[],n=Math.max(0,t.findIndex(r=>JSON.stringify(r)===JSON.stringify(e.currentValue)));return String(n)}return e.mode==="number"?k1(e.currentValue):e.mode==="text"?typeof e.currentValue=="string"?e.currentValue:"":sg(e.currentValue)}function M1(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>e[s]===t[s])}function O1({settings:e,patchSettingField:t,focusComponentAddress:n=null,focusActionId:r=0,onComponentSelect:s}){const o=E.useMemo(()=>e?Object.keys(e).sort():[],[e]),i=E.useMemo(()=>o.join("|"),[o]),l=E.useMemo(()=>new Set(o),[i]),[a,u]=E.useState(null),[c,d]=E.useState(""),[f,m]=E.useState({}),[v,x]=E.useState({}),[T,p]=E.useState({}),[g,_]=E.useState({}),w=E.useRef({}),P=E.useRef({}),A=E.useRef(null);E.useEffect(()=>{a&&!o.includes(a)&&u(null)},[o,a]),E.useEffect(()=>{!n||!l.has(n)||(d(""),u(n),window.requestAnimationFrame(()=>{var y;(y=w.current[n])==null||y.scrollIntoView({block:"nearest",behavior:"smooth"})}))},[l,r,n]);const R=a?e==null?void 0:e[a]:null,$=E.useMemo(()=>(R==null?void 0:R.structured_value)??(R==null?void 0:R.repr_value),[R]),B=E.useMemo(()=>{var O;if(!R)return[];const y=((O=R.settings_schema)==null?void 0:O.fields)??[];if(y.length>0)return y.map(C=>{const S=$f($,C.name);return{path:C.name,mode:b1(C),currentValue:S??C.default??null,description:C.description,bounds:C.bounds,choices:C.choices,isInteger:C.field_type.toLowerCase().includes("int")}});const I=og($);return(I.length>0?I:["value"]).map(C=>{const S=C==="value"?$:$f($,C);return{path:C,mode:A1(S),currentValue:S,description:null,bounds:null,choices:null,isInteger:Number.isInteger(S)}})},[R,$]),D=!!(R!=null&&R.patchable),U=E.useMemo(()=>{const y=c.trim().toLowerCase();return y?o.filter(I=>{const N=e==null?void 0:e[I],O=typeof(N==null?void 0:N.component_name)=="string"?N.component_name:"",C=typeof(N==null?void 0:N.component_type)=="string"?N.component_type:"";return I.toLowerCase().includes(y)||O.toLowerCase().includes(y)||C.toLowerCase().includes(y)}):o},[o,c,e]);E.useEffect(()=>{const y={};for(const N of B)y[N.path]=R1(N);const I=A.current!==a;m(N=>{if(I)return y;const O={};for(const[C,S]of Object.entries(y)){const b=N[C],j=P.current[C];O[C]=b===void 0||b===j?S:b}return M1(N,O)?N:O}),I&&(x({}),p({}),_({})),P.current=y,A.current=a},[B,a]);const Q=y=>{const I=f[y.path];if(y.mode==="boolean")return!!I;if(y.mode==="choice"){const N=Number.parseInt(String(I),10),O=y.choices??[];if(!Number.isInteger(N)||N<0||N>=O.length)throw new Error("A valid choice must be selected.");return O[N]}if(y.mode==="number"){const N=P1(String(I??""));if(N===null)throw new Error("Value must be a valid number.");if(!Number.isFinite(N)){if(y.isInteger)throw new Error("Integer fields require a finite value.");return I1(N)}return y.isInteger?Math.trunc(N):N}if(y.mode==="text")return String(I??"");try{return JSON.parse(String(I??""))}catch{throw new Error("Value must be valid JSON.")}},z=async y=>{if(!a||!D)return;let I;try{I=Q(y)}catch(N){p(O=>({...O,[y.path]:N instanceof Error?N.message:"Invalid field value."})),_(O=>({...O,[y.path]:null}));return}x(N=>({...N,[y.path]:!0})),p(N=>({...N,[y.path]:null})),_(N=>({...N,[y.path]:null}));try{const N=await t(a,y.path,I);_(O=>({...O,[y.path]:`Applied ${N.field_path}`}))}catch(N){p(O=>({...O,[y.path]:N instanceof Error?N.message:"Patch request failed."}))}finally{x(N=>({...N,[y.path]:!1}))}};return h.jsx(tl,{children:o.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No settings snapshot entries available."})}):h.jsxs("div",{className:"settings-component-list",children:[h.jsx("div",{className:"settings-search",children:h.jsx("input",{type:"search",placeholder:"Search component, type, or address",value:c,onChange:y=>d(y.target.value)})}),U.map(y=>{const I=(e==null?void 0:e[y])??null,N=a===y,O=!!(I!=null&&I.patchable),C=typeof(I==null?void 0:I.component_name)=="string"&&I.component_name.length>0?I.component_name:y.split("/")[y.split("/").length-1]??y;return h.jsxs("article",{ref:S=>{w.current[y]=S},className:`settings-component-row ${N?"is-expanded":""}`,children:[h.jsxs("button",{type:"button",className:"settings-component-row__toggle","aria-expanded":N,onClick:()=>u(S=>{const b=S===y?null:y;return s==null||s(b),b}),children:[h.jsxs("div",{className:"settings-component-row__identity",children:[h.jsxs("div",{className:"settings-component-row__heading",children:[h.jsx("p",{className:"mono settings-component-title",title:C,children:C}),I!=null&&I.component_type?h.jsx("span",{className:"settings-type",title:I.component_type,children:I.component_type}):null]}),h.jsx("p",{className:"mono settings-component-address",title:y,children:y})]}),h.jsxs("div",{className:"settings-component-row__meta",children:[h.jsx("span",{className:`settings-access ${O?"is-patchable":"is-readonly"}`,children:O?"patchable":"read only"}),h.jsx("span",{className:"publisher-caret",children:N?"▾":"▸"})]})]}),N?h.jsx("section",{className:"settings-detail",children:B.length===0?h.jsx("p",{className:"muted",children:"No fields available for this component."}):h.jsx("div",{className:"settings-fields",children:B.map(S=>{var K,Y;const b=v[S.path]===!0,j=!D,M=f[S.path];return h.jsxs("div",{className:`settings-field-row ${j?"is-disabled":""}`,children:[h.jsxs("div",{className:"settings-field-row__meta",children:[h.jsx("label",{className:"mono",children:S.path}),S.description?h.jsx("p",{className:"muted",children:S.description}):null,S.bounds?h.jsxs("p",{className:"muted",children:["Bounds: [",S.bounds[0]??"-inf",", ",S.bounds[1]??"+inf","]"]}):null]}),h.jsxs("div",{className:`settings-field-row__control ${S.mode==="boolean"?"is-boolean":""}`,children:[S.mode==="boolean"?h.jsxs("label",{className:"patch-checkbox",children:[h.jsx("input",{type:"checkbox",checked:!!M,onChange:ee=>m(te=>({...te,[S.path]:ee.target.checked})),disabled:j||b}),h.jsx("span",{children:"Enabled"})]}):null,S.mode==="choice"?h.jsx("select",{value:String(M??"0"),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b,children:(S.choices??[]).map((ee,te)=>h.jsx("option",{value:String(te),children:sg(ee)},`${S.path}-${te}`))}):null,S.mode==="number"?S.isInteger?h.jsx("input",{type:"number",value:String(M??""),min:((K=S.bounds)==null?void 0:K[0])??void 0,max:((Y=S.bounds)==null?void 0:Y[1])??void 0,step:"any",onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):h.jsx("input",{type:"text",inputMode:"decimal",value:String(M??""),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,S.mode==="text"?h.jsx("input",{type:"text",value:String(M??""),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,S.mode==="json"?h.jsx("textarea",{value:String(M??""),rows:4,spellCheck:!1,className:"mono",onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,h.jsx("button",{type:"button",onClick:()=>{z(S)},disabled:j||b,children:b?"Applying...":"Apply"})]}),g[S.path]?h.jsx("p",{className:"patch-status ok",children:g[S.path]}):null,T[S.path]?h.jsx("p",{className:"patch-status err",children:T[S.path]}):null]},S.path)})})}):null]},y)})]})})}function rt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Zt]=t,e[ao]=r,Am(e,t,!1,!1),t.stateNode=e;e:{switch(i=qa(n,r),n){case"dialog":Re("cancel",e),Re("close",e),s=r;break;case"iframe":case"object":case"embed":Re("load",e),s=r;break;case"video":case"audio":for(s=0;sus&&(t.flags|=128,r=!0,Ts(o,!1),t.lanes=4194304)}else{if(!r)if(e=Qi(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ts(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Oe)return ot(t),null}else 2*He()-o.renderingStartTime>us&&n!==1073741824&&(t.flags|=128,r=!0,Ts(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=He(),t.sibling=null,n=Le.current,Pe(Le,r?n&1|2:n&1),t):(ot(t),null);case 22:case 23:return Dc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?wt&1073741824&&(ot(t),t.subtreeFlags&6&&(t.flags|=8192)):ot(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function _v(e,t){switch(wc(t),t.tag){case 1:return _t(t.type)&&Hi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ls(),Me(yt),Me(at),bc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Pc(t),null;case 13:if(Me(Le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));os()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me(Le),null;case 4:return ls(),null;case 10:return Tc(t.type._context),null;case 22:case 23:return Dc(),null;case 24:return null;default:return null}}var Ko=!1,lt=!1,vv=typeof WeakSet=="function"?WeakSet:Set,fe=null;function Ur(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function Tu(e,t,n){try{n()}catch(r){De(e,t,r)}}var gf=!1;function xv(e,t){if(au=Fi,e=Bh(),vc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,a=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(l=i+s),d!==o||r!==0&&d.nodeType!==3||(a=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++u===s&&(l=i),f===o&&++c===r&&(a=i),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(uu={focusedElem:e,selectionRange:n},Fi=!1,fe=t;fe!==null;)if(t=fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,fe=e;else for(;fe!==null;){t=fe;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,T=v.memoizedState,p=t.stateNode,g=p.getSnapshotBeforeUpdate(t.elementType===t.type?x:jt(t.type,x),T);p.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var _=t.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(se(163))}}catch(w){De(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,fe=e;break}fe=t.return}return v=gf,gf=!1,v}function Ys(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Tu(t,n,o)}s=s.next}while(s!==r)}}function Il(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Iu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Om(e){var t=e.alternate;t!==null&&(e.alternate=null,Om(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zt],delete t[ao],delete t[fu],delete t[nv],delete t[rv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Lm(e){return e.tag===5||e.tag===3||e.tag===4}function yf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ui));else if(r!==4&&(e=e.child,e!==null))for(Cu(e,t,n),e=e.sibling;e!==null;)Cu(e,t,n),e=e.sibling}function ku(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ku(e,t,n),e=e.sibling;e!==null;)ku(e,t,n),e=e.sibling}var et=null,Bt=!1;function Sn(e,t,n){for(n=n.child;n!==null;)$m(e,t,n),n=n.sibling}function $m(e,t,n){if(Jt&&typeof Jt.onCommitFiberUnmount=="function")try{Jt.onCommitFiberUnmount(_l,n)}catch{}switch(n.tag){case 5:lt||Ur(n,t);case 6:var r=et,s=Bt;et=null,Sn(e,t,n),et=r,Bt=s,et!==null&&(Bt?(e=et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):et.removeChild(n.stateNode));break;case 18:et!==null&&(Bt?(e=et,n=n.stateNode,e.nodeType===8?ua(e.parentNode,n):e.nodeType===1&&ua(e,n),ro(e)):ua(et,n.stateNode));break;case 4:r=et,s=Bt,et=n.stateNode.containerInfo,Bt=!0,Sn(e,t,n),et=r,Bt=s;break;case 0:case 11:case 14:case 15:if(!lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Tu(n,t,i),s=s.next}while(s!==r)}Sn(e,t,n);break;case 1:if(!lt&&(Ur(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){De(n,t,l)}Sn(e,t,n);break;case 21:Sn(e,t,n);break;case 22:n.mode&1?(lt=(r=lt)||n.memoizedState!==null,Sn(e,t,n),lt=r):Sn(e,t,n);break;default:Sn(e,t,n)}}function _f(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vv),t.forEach(function(r){var s=Pv.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function $t(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~o}if(r=s,r=He()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sv(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,tl=0,Ee&6)throw Error(se(331));var s=Ee;for(Ee|=4,fe=e.current;fe!==null;){var o=fe,i=o.child;if(fe.flags&16){var l=o.deletions;if(l!==null){for(var a=0;aHe()-Fc?ar(e,0):Bc|=n),vt(e,t)}function Wm(e,t){t===0&&(e.mode&1?(t=Fo,Fo<<=1,!(Fo&130023424)&&(Fo=4194304)):t=1);var n=dt();e=yn(e,t),e!==null&&(Co(e,t,n),vt(e,n))}function kv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wm(e,n)}function Pv(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(se(314))}r!==null&&r.delete(t),Wm(e,n)}var Vm;Vm=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yt.current)mt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return mt=!1,gv(e,t,n);mt=!!(e.flags&131072)}else mt=!1,Oe&&t.flags&1048576&&Xh(t,Gi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ei(e,t),e=t.pendingProps;var s=ss(t,at.current);qr(t,n),s=Rc(null,t,r,e,s,n);var o=Mc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(r)?(o=!0,Wi(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Cc(t),s.updater=Tl,t.stateNode=s,s._reactInternals=t,_u(t,r,e,n),t=wu(null,t,r,!0,o,n)):(t.tag=0,Oe&&o&&xc(t),ut(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ei(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Av(r),e=jt(r,e),s){case 0:t=xu(null,t,r,e,n);break e;case 1:t=pf(null,t,r,e,n);break e;case 11:t=df(null,t,r,e,n);break e;case 14:t=ff(null,t,r,jt(r.type,e),n);break e}throw Error(se(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),xu(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),pf(e,t,r,s,n);case 3:e:{if(km(t),e===null)throw Error(se(387));r=t.pendingProps,o=t.memoizedState,s=o.element,tm(e,t),Xi(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=as(Error(se(423)),t),t=hf(e,t,r,n,s);break e}else if(r!==s){s=as(Error(se(424)),t),t=hf(e,t,r,n,s);break e}else for(St=Bn(t.stateNode.containerInfo.firstChild),Et=t,Oe=!0,zt=null,n=Jh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(os(),r===s){t=_n(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return nm(t),e===null&&mu(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,cu(r,s)?i=null:o!==null&&cu(r,o)&&(t.flags|=32),Cm(e,t),ut(e,t,i,n),t.child;case 6:return e===null&&mu(t),null;case 13:return Pm(e,t,n);case 4:return kc(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=is(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),df(e,t,r,s,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,Pe(Yi,r._currentValue),r._currentValue=i,o!==null)if(Gt(o.value,i)){if(o.children===s.children&&!yt.current){t=_n(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=pn(-1,n&-n),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),gu(o.return,n,t),l.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(se(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),gu(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ut(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,qr(t,n),s=Ot(s),r=r(s),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,s=jt(r,t.pendingProps),s=jt(r.type,s),ff(e,t,r,s,n);case 15:return Tm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:jt(r,s),Ei(e,t),t.tag=1,_t(r)?(e=!0,Wi(t)):e=!1,qr(t,n),Sm(t,r,s),_u(t,r,s,n),wu(null,t,r,!0,e,n);case 19:return bm(e,t,n);case 22:return Im(e,t,n)}throw Error(se(156,t.tag))};function Gm(e,t){return vh(e,t)}function bv(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function At(e,t,n,r){return new bv(e,t,n,r)}function Hc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Av(e){if(typeof e=="function")return Hc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ac)return 11;if(e===uc)return 14}return 2}function Un(e,t){var n=e.alternate;return n===null?(n=At(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ii(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")Hc(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Mr:return ur(n.children,s,o,t);case lc:i=8,s|=8;break;case Ua:return e=At(12,n,t,s|2),e.elementType=Ua,e.lanes=o,e;case Ha:return e=At(13,n,t,s),e.elementType=Ha,e.lanes=o,e;case Wa:return e=At(19,n,t,s),e.elementType=Wa,e.lanes=o,e;case nh:return kl(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case eh:i=10;break e;case th:i=9;break e;case ac:i=11;break e;case uc:i=14;break e;case In:i=16,r=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=At(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function ur(e,t,n,r){return e=At(7,e,r,t),e.lanes=n,e}function kl(e,t,n,r){return e=At(22,e,r,t),e.elementType=nh,e.lanes=n,e.stateNode={isHidden:!1},e}function ya(e,t,n){return e=At(6,e,null,t),e.lanes=n,e}function _a(e,t,n){return t=At(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rv(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ql(0),this.expirationTimes=ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ql(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Wc(e,t,n,r,s,o,i,l,a){return e=new Rv(e,t,n,l,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=At(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cc(o),e}function Mv(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qm)}catch(e){console.error(e)}}Qm(),Qp.exports=It;var Zm=Qp.exports,If=Zm;za.createRoot=If.createRoot,za.hydrateRoot=If.hydrateRoot;function sl({title:e,subtitle:t,children:n}){const r=!!e||!!t;return h.jsxs("section",{className:`panel ${r?"":"panel--headerless"}`.trim(),children:[r?h.jsxs("header",{className:"panel__header",children:[e?h.jsx("h2",{children:e}):null,t?h.jsx("p",{children:t}):null]}):null,h.jsx("div",{className:"panel__body",children:n})]})}const ol=["#93c5fd","#a78bfa","#f9a8d4","#86efac","#fdba74","#67e8f9","#fca5a5","#c4b5fd","#fde68a","#6ee7b7","#fda4af","#5eead4","#ddd6fe","#bef264","#fbcfe8","#bae6fd"];function Bv(e){let t=0;for(let n=0;n>>0;return t}function Fv(e){return`hsl(${(e*137.508%360).toFixed(1)} 75% 68%)`}function Cf(e){const t=[...new Set(e)].sort(),n={};for(let r=0;re.layout.cols){Yv(e);for(let o=0;ol+a+1||(e.beginPath(),e.moveTo(c,t.top),e.lineTo(c,t.top+t.plotHeight),e.stroke())}for(let u=0;u<=t.yTicks;u+=1){const c=t.plotBottom-u/t.yTicks*(t.plotBottom-t.plotTop);e.beginPath(),e.moveTo(l,c),e.lineTo(l+a,c),e.stroke()}e.strokeStyle=s.axis,e.beginPath(),e.moveTo(l,t.plotBottom),e.lineTo(l+a,t.plotBottom),e.stroke()}function ll(e,t,{color:n,lineWidth:r,alpha:s=1,lineDash:o=[],startCol:i,endCol:l,yMaxMs:a,layout:u}){const c=Math.max(0,i-1),d=Math.min(u.cols-1,l+1);e.strokeStyle=n,e.lineWidth=r,e.globalAlpha=s,e.setLineDash(o),e.beginPath();const f=[];let m=null,v=Number.NaN,x=!1;for(let T=c-1;T>=0;T-=1){const p=t[T];if(Number.isFinite(p)){m=T,v=p,x=p>a;break}}for(let T=c;T<=d;T+=1){const p=t[T];if(!Number.isFinite(p))continue;const g=p>a;if(g&&!x&&f.push(T),m!==null&&Number.isFinite(v)){const _=v>a;if(!(_&&g)){const w=u.left+m+.5,P=_?u.plotTop:go(v,a,u),A=u.left+T+.5,R=g?u.plotTop:go(p,a,u);e.moveTo(w,P),e.lineTo(A,R)}}m=T,v=p,x=g}if(e.stroke(),e.setLineDash([]),e.globalAlpha=1,f.length>0){e.fillStyle=n,e.globalAlpha=Math.min(1,s+.1);for(const T of f){const p=u.left+T;e.fillRect(p,u.plotTop,1,3)}e.globalAlpha=1}}function Pf(e,t,n,{color:r,alpha:s,lineDash:o=[],startCol:i,endCol:l,yMaxMs:a,layout:u}){e.strokeStyle=r,e.lineWidth=1,e.globalAlpha=s,e.setLineDash(o);for(let c=i;c<=l;c+=1){const d=t[c],f=n[c];if(!Number.isFinite(d)||!Number.isFinite(f)||f<=d)continue;const m=u.left+c+.5,v=d>a?u.plotTop:go(d,a,u),x=f>a?u.plotTop:go(f,a,u);e.beginPath(),e.moveTo(m,v),e.lineTo(m,x),e.stroke()}e.setLineDash([]),e.globalAlpha=1}function bf(e,t,{color:n,alpha:r,startCol:s,endCol:o,yMaxMs:i,layout:l}){const a=Math.max(0,s-1),u=Math.min(l.cols-1,o+1);let c=null,d=null;for(let f=a;f<=u;f+=1){const m=t[f];!Number.isFinite(m)||m<=0||(c===null&&(c=f),d=f)}if(!(c===null||d===null)){e.fillStyle=n,e.globalAlpha=r,e.beginPath(),e.moveTo(l.left+c+.5,l.plotBottom);for(let f=c;f<=d;f+=1){const m=t[f];if(!Number.isFinite(m)||m<=0)continue;const v=Math.min(m,i),x=l.left+f+.5,T=go(v,i,l);e.lineTo(x,T)}e.lineTo(l.left+d+.5,l.plotBottom),e.closePath(),e.fill(),e.globalAlpha=1}}function Qv(e,{leaseBins:t,userBins:n,color:r,startCol:s,endCol:o,yMaxMs:i,layout:l}){if(bf(e,t,{color:r,alpha:.18,startCol:s,endCol:o,yMaxMs:i,layout:l}),n!==null){const a=new Float32Array(n.length);a.fill(Number.NaN);for(let u=s;u<=o&&u9&&(n*=10,r=1),Math.max(Wr,r*n)}function Rf(e){if(!Number.isFinite(e)||e<=0)return Bs;const t=1e3/e;return qv(t*1.25)}function Mf(e,t,n,r,s,o,i){let l=e.get(o),a=t.get(o),u=n.get(o),c=r.get(o),d=s.get(o);return l||(l=il(i),e.set(o,l)),a||(a=il(i),t.set(o,a)),u||(u=new Float64Array(i),n.set(o,u)),c||(c=new Uint16Array(i),r.set(o,c)),d||(d=new Int32Array(i),d.fill(-2147483648),s.set(o,d)),{bins:l,peakBins:a,sumBins:u,countBins:c,cycleBins:d}}function Jv({samples:e,publisherProcessId:t,publisherEndpointId:n,nominalPublishRateHz:r,topic:s,topicScope:o,leaseColorMap:i,selectedSubscriberEndpointId:l=null,windowSeconds:a,onWindowSecondsChange:u,darkMode:c=!1}){const d=E.useRef(null),f=E.useRef(null),m=E.useRef(null),v=E.useRef(null),x=E.useRef(!0),T=E.useRef(!1),[p,g]=E.useState(()=>a.toFixed(1)),[_,w]=E.useState(!0),[P,A]=E.useState(`${Bs.toFixed(2)}`),[R,$]=E.useState("lease_time_ns"),B=E.useMemo(()=>l?Qs(l,i):null,[i,l]),D=c?qm:zv,U=E.useMemo(()=>Zo(P),[P]),Q=E.useMemo(()=>o&&o.length>0?o:[s],[s,o]),z=E.useMemo(()=>[...Q].sort().join("|"),[Q]),y=`${t}|${n}`,I=O=>{const C=Zo(O??p);if(C===null||!u){g(a.toFixed(1));return}const S=yr(C,.5,30);u(S),g(S.toFixed(1))},N=()=>{var O;if(_){const C=((O=m.current)==null?void 0:O.yMaxMs)??Rf(r);A(C.toFixed(2)),w(!1);return}w(!0)};return E.useEffect(()=>{g(a.toFixed(1))},[a]),E.useEffect(()=>{const O=d.current;if(!O)return;const C=O.getContext("2d");if(!C)return;const S=Math.max(1,window.devicePixelRatio||1),b=Hv(O,a),j=Math.floor(b.width*S),M=Math.floor(b.height*S),K=f.current,Y=!K||K.width!==j||K.height!==M;Y&&(O.width=j,O.height=M,f.current={width:j,height:M}),C.setTransform(S,0,0,S,0,0);const ee=Math.max(1,a*1e9),te=Rf(r),pe=_?te:Math.max(Wr,U??Bs);let V=m.current;const me=V===null||Y||V.layout.cols!==b.cols||V.layout.width!==b.width||V.windowNs!==ee||V.scopeSignature!==z||V.publisherSignature!==y;if(me&&(V=Wv(b,ee,z,y,pe),m.current=V,v.current=null,C.fillStyle=D.background,C.fillRect(0,0,b.width,b.height)),V===null)return;const he=new Set;let ve=V.lastTimestamp,Se=!1,k=V.lastWipeCycle,L=null;V.originNs!==null&&Number.isFinite(V.lastTimestamp)&&(L=va(V.lastTimestamp,V.originNs,V.windowNs,V.layout.cols));const ne=e!==v.current?e:[];e!==v.current&&(v.current=e);for(const J of ne){if(!Number.isFinite(J.timestamp)||!Number.isFinite(J.value)||!Vv(J.topic,Q))continue;const q=J.metric==="publish_delta_ns"&&J.processId===t&&J.endpointId===n,H=J.metric==="lease_time_ns",oe=J.metric==="user_span_ns";if(!q&&!H&&!oe||(V.originNs===null&&(V.originNs=J.timestamp),V.originNs===null||J.timestamp0&&(Kv(V,L,F,he),L=F):L=F,q){re>V.publishCycle[W]&&(V.publishCycle[W]=re,V.publishBins[W]=Number.NaN,V.publishPeakBins[W]=Number.NaN,V.publishSumBins[W]=0,V.publishCountBins[W]=0,he.add(W));const X=Math.min(65535,V.publishCountBins[W]+1);V.publishCountBins[W]=X,V.publishSumBins[W]+=ae;const Z=V.publishSumBins[W]/X,de=V.publishBins[W];(!Number.isFinite(de)||Math.abs(Z-de)>1e-6)&&(V.publishBins[W]=Z,he.add(W));const ce=V.publishPeakBins[W];(!Number.isFinite(ce)||ae>ce)&&(V.publishPeakBins[W]=ae,he.add(W))}else{const X=H?Mf(V.leaseBinsByEndpoint,V.leasePeakBinsByEndpoint,V.leaseSumByEndpoint,V.leaseCountByEndpoint,V.leaseCycleByEndpoint,J.endpointId,V.layout.cols):Mf(V.userBinsByEndpoint,V.userPeakBinsByEndpoint,V.userSumByEndpoint,V.userCountByEndpoint,V.userCycleByEndpoint,J.endpointId,V.layout.cols);re>X.cycleBins[W]&&(X.cycleBins[W]=re,X.bins[W]=Number.NaN,X.peakBins[W]=Number.NaN,X.sumBins[W]=0,X.countBins[W]=0,he.add(W));const Z=Math.min(65535,X.countBins[W]+1);X.countBins[W]=Z,X.sumBins[W]+=ae;const de=X.sumBins[W]/Z,ce=X.bins[W];(!Number.isFinite(ce)||Math.abs(de-ce)>1e-6)&&(X.bins[W]=de,he.add(W));const Ne=X.peakBins[W];(!Number.isFinite(Ne)||ae>Ne)&&(X.peakBins[W]=ae,he.add(W))}ve=Math.max(ve,J.timestamp),Se=!0}const le=_&&!x.current;if(x.current=_,_?le?V.yMaxMs=te:k>V.lastWipeCycle&&(V.lastWipeCycle=k,V.yMaxMs=te):V.yMaxMs=Math.max(Wr,U??Bs),_){const J=V.yMaxMs.toFixed(2);P!==J&&A(J)}if(Se&&V.originNs!==null){const J=va(ve,V.originNs,V.windowNs,V.layout.cols);he.add(J.col),V.lastCursorCol!==null&&kf(he,V.lastCursorCol,V.layout.cols);const q=(J.col+Dv)%V.layout.cols;kf(he,q,V.layout.cols),V.lastCursorCol=q,V.lastTimestamp=ve}if((me||he.size>0)&&(C.fillStyle=D.background,C.fillRect(0,0,V.layout.width,V.layout.height),Zv(C,V,0,V.layout.cols-1,R,l,i,D)),V.lastTimestamp<=0){C.fillStyle=D.background,C.fillRect(0,0,V.layout.width,V.layout.height),C.fillStyle=D.waitingText,C.font='12px "Avenir Next", sans-serif',C.fillText("Waiting for trace samples...",V.layout.left,26),Af(C,V,a,D);return}Af(C,V,a,D)},[_,c,Q,i,U,r,n,t,y,l,e,R,z,a,D]),h.jsxs("div",{className:"timing-trace",children:[h.jsxs("div",{className:"timing-trace__controls",children:[h.jsxs("div",{className:"timing-trace__controls-left",children:[h.jsxs("label",{className:"timing-trace__axis-input",children:[h.jsx("span",{children:"Window (s)"}),h.jsx("input",{type:"number",min:.5,max:30,step:"0.5",value:p,onChange:O=>{const C=O.target.value;g(C),T.current||I(C)},onMouseDown:()=>{T.current=!1},onBlur:()=>{T.current=!1,I()},onKeyDown:O=>{if(O.key==="Enter"){T.current=!1,I();return}if(O.key==="ArrowUp"||O.key==="ArrowDown"){O.preventDefault(),T.current=!1;const C=Zo(p)??a,S=O.key==="ArrowUp"?.5:-.5,b=yr(C+S,.5,30);g(b.toFixed(1)),u==null||u(b);return}(O.key.length===1||O.key==="Backspace"||O.key==="Delete")&&(T.current=!0)}})]}),h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:D.publish}}),"Publish Delta"]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:"transparent",border:`2px solid ${B??"#94a3b8"}`}}),"Lease Time"]}),h.jsxs("span",{className:"timing-trace__legend-item is-static",children:[h.jsx("i",{style:{background:B??"#94a3b8"}}),"User Span"]})]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:`timing-trace__legend-item timing-trace__legend-toggle ${R==="lease_time_ns"?"is-active":""}`,onClick:()=>$("lease_time_ns"),"aria-pressed":R==="lease_time_ns",children:"Lease Time"}),h.jsx("button",{type:"button",className:`timing-trace__legend-item timing-trace__legend-toggle ${R==="user_span_ns"?"is-active":""}`,onClick:()=>$("user_span_ns"),"aria-pressed":R==="user_span_ns",children:"User Span"})]})]}),h.jsxs("div",{className:"timing-trace__controls-right",children:[h.jsxs("label",{className:"timing-trace__axis-input timing-trace__axis-input--ymax",children:[h.jsx("span",{children:"Y max (ms)"}),h.jsx("input",{type:"number",min:Wr,step:"0.1",value:P,onChange:O=>A(O.target.value),onBlur:()=>{const O=Zo(P);if(O===null){A(`${Bs.toFixed(2)}`);return}const C=Math.max(Wr,O);A(C.toFixed(2))},disabled:_})]}),h.jsx("button",{type:"button",role:"switch","aria-checked":_,className:`timing-trace__mode-toggle ${_?"is-auto":"is-fixed"}`,onClick:N,title:_?"Switch to Fixed Y":"Switch to Auto Y",children:h.jsx("span",{className:"timing-trace__mode-toggle-label",children:_?"Auto":"Fixed"})})]})]}),h.jsx("canvas",{ref:d,className:"timing-trace__canvas"})]})}function je(e){return e.split(":")[0]??e}function Ml(e){const[t,...n]=e.split(":");return{topic:t??"",endpointToken:n.join(":")}}function e1(e){const{endpointToken:t}=Ml(e);return t.length>0?t:null}function t1(e){const{topic:t,endpointToken:n}=Ml(e);return{topic:t.length>0?t:null,endpointId:n.length>0?n:null}}function Tn(e){return typeof e=="object"&&e!==null}function n1(e,t=null){if(t==="RelayMetadata")return"unknown";if(t==="InputRelayMetadata")return"input";if(t==="OutputRelayMetadata")return"output";if("leaky"in e||"max_queue"in e)return"input";if("num_buffers"in e||"buf_size"in e||"force_tcp"in e||"host"in e||"port"in e)return"output";const s=typeof e.name=="string"?e.name.toUpperCase():"",o=typeof e.address=="string"?e.address.toUpperCase():"";return s.includes("INPUT")||o.includes("/INPUT")?"input":s.includes("OUTPUT")||o.includes("/OUTPUT")?"output":"unknown"}function r1(e){const t=typeof e.metadata_type=="string"?e.metadata_type:typeof e.__type__=="string"?e.__type__:typeof e.type=="string"?e.type:null;if(typeof t=="string"){if(t==="InputRelayMetadata"||t.endsWith(".InputRelayMetadata"))return"InputRelayMetadata";if(t==="OutputRelayMetadata"||t.endsWith(".OutputRelayMetadata"))return"OutputRelayMetadata";if(t==="RelayMetadata"||t.endsWith(".RelayMetadata"))return"RelayMetadata"}const n="leaky"in e||"max_queue"in e,r="num_buffers"in e||"buf_size"in e||"force_tcp"in e||"host"in e||"port"in e;return n&&!r?"InputRelayMetadata":r&&!n?"OutputRelayMetadata":n||r?"RelayMetadata":null}function xa(e,t=null){if(!e)return[];const n=[];for(const[r,s]of Object.entries(e)){if(!Tn(s)||typeof s.address!="string")continue;const o=t==="relay",i=o?r1(s):null;n.push({name:r,address:s.address,direction:n1(s,i),msgType:typeof s.msg_type=="string"?s.msg_type:null,collectionKind:t,relayMetadataType:i,relayGroup:o&&typeof s.relay_group=="string"?s.relay_group:null,relayInputTopic:o&&typeof s.relay_input_topic=="string"?s.relay_input_topic:null,relayOutputTopic:o&&typeof s.relay_output_topic=="string"?s.relay_output_topic:null})}return n.sort((r,s)=>r.address.localeCompare(s.address)),n}function Kc(e){const t=new Map;for(const s of Object.values(e.sessions)){const o=Tn(s.metadata)?s.metadata:null,i=o&&Tn(o.components)?o.components:null;if(i)for(const[l,a]of Object.entries(i))!Tn(a)||t.has(l)||t.set(l,a)}const n=new Map,r=new Map;for(const[s,o]of t.entries()){const i=typeof o.name=="string"?o.name:s,l=typeof o.component_type=="string"?o.component_type:"Component",a=xa(Tn(o.topics)?o.topics:null,"topic"),u=xa(Tn(o.relays)?o.relays:null,"relay"),c=Array.isArray(o.children)?o.children.filter(v=>typeof v=="string"):[];if(c.length>0||a.length>0||u.length>0){const v=new Map;for(const x of a)v.set(x.address,x);for(const x of u)v.set(x.address,x);r.set(s,{address:s,name:i,componentType:l,streams:Array.from(v.values()).sort((x,T)=>x.address.localeCompare(T.address)),children:c})}const d=Tn(o.streams)?o.streams:null;if(!d)continue;const m=(Array.isArray(o.tasks)?o.tasks:[]).filter(Tn).map(v=>{if(typeof v.name!="string")return null;const x=Array.isArray(v.publishes)?v.publishes.filter(T=>typeof T=="string"):[];return{name:v.name,subscribes:typeof v.subscribes=="string"?v.subscribes:null,publishes:x}}).filter(v=>v!==null).sort((v,x)=>v.name.localeCompare(x.name));n.set(s,{address:s,name:i,componentType:l,streams:xa(d),tasks:m})}return{units:n,collections:r}}function qo(e,t,n){t&&(e.set(t,n),e.set(je(t),n))}function Ol(e){const t=new Map,n=new Map;for(const r of e.values())for(const s of r.streams)s.collectionKind==="relay"&&(qo(t,s.relayInputTopic,s.address),qo(t,s.relayOutputTopic,s.address),qo(n,s.relayInputTopic,r.address),qo(n,s.relayOutputTopic,r.address));return{endpointByInternalTopic:t,collectionByInternalTopic:n}}function s1(e,t){const n=new Map;for(const s of e)n.set(s,0);const r=Math.max(1,e.length);for(let s=0;sa&&(n.set(i.to,u),o=!0)}if(!o)break}return n}function Mu(e,t,n){if(n){const o=t.get(n);return o?o.children.filter(i=>e.has(i)||t.has(i)):[]}const r=new Set;for(const o of t.values())for(const i of o.children)r.add(i);const s=[...Array.from(t.keys()),...Array.from(e.keys())].filter(o=>!r.has(o));return s.length>0?s:Array.from(e.keys())}function Ll(e){const t=new Map;for(const[n,r]of e.entries())for(const s of r.children)t.has(s)||t.set(s,n);return t}function o1(e,t){if(!t||!e.has(t))return[];const n=Ll(e),r=[],s=new Set;let o=t;for(;o&&!s.has(o);)s.add(o),r.push(o),o=n.get(o);return r.reverse()}function i1(e,t,n){const r=n.get(e);return r?r.children.some(s=>t.has(s)||n.has(s)):!1}function Ou(e,t,n){if(e===t)return!0;const r=new Set;let s=e;for(;s&&!r.has(s);){r.add(s);const o=n.get(s);if(!o)return!1;if(o===t)return!0;s=o}return!1}function l1(e,t,n,r){const s=Ll(n),o=Ol(n),i=new Map,l=(u,c)=>{i.set(u,c),i.set(je(u),c)};for(const u of t.values())for(const c of u.streams)l(c.address,u.address);for(const u of n.values())for(const c of u.streams)l(c.address,u.address);for(const[u,c]of o.collectionByInternalTopic.entries())i.set(u,c);const a=new Set;for(const[u,c]of Object.entries(e.graph)){a.add(u);for(const d of c)a.add(d)}for(const u of a){const c=i.get(u);if(!c||!Ou(c,r,s))return!0}return!1}const eg="Infinity",tg="-Infinity",ng="NaN",a1=[eg,tg,ng],u1={inf:Number.POSITIVE_INFINITY,infinity:Number.POSITIVE_INFINITY,"+inf":Number.POSITIVE_INFINITY,"+infinity":Number.POSITIVE_INFINITY,"-inf":Number.NEGATIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY,nan:Number.NaN};function rg(e){return typeof e=="string"&&a1.includes(e)}function c1(e){return Number.isFinite(e)?e:Number.isNaN(e)?ng:e>0?eg:tg}function sg(e){return typeof e=="number"?e:rg(e)?Number(e):null}function d1(e){const t=sg(e);return t===null?"":String(t)}function f1(e){const t=e.trim();if(t.length===0)return null;const n=u1[t.toLowerCase()];if(n!==void 0)return n;const r=Number(t);return Number.isNaN(r)?null:r}function p1(e){return sg(e)??0}const h1="/INPUT_SETTINGS";function m1(e){return e.endsWith(h1)}const yo=2,g1=.5,y1=30,_1=new Set(["publish_delta_ns"]),v1=new Set(["lease_time_ns","user_span_ns"]);function er(e){return p1(e)}function x1(e){return`${e.toFixed(1)} Hz`}function w1(e){return!Number.isFinite(e)||e<=0?"":Math.abs(e-Math.round(e))<1e-6?`${Math.round(e)}s`:`${e.toFixed(1)}s`}function S1(e,t,n){return Math.min(n,Math.max(t,e))}function Lu(e){return!Number.isFinite(e)||e<=0?yo:S1(e,g1,y1)}function E1(e){if(!Number.isFinite(e)||e<=0)return yo;const t=Math.max(yo,Math.round(10/e));return Lu(t)}function N1(e,t=48){return e.length<=t?e:`${e.slice(0,t-1)}…`}function T1(e,t,n){return n!==null&&n>0&&t/n>.5?"backpressure":e>0?"active":"idle"}function Of(e){return typeof e=="object"&&e!==null}function cs(e,t){return t.get(e)??t.get(je(e))??e}function Xc(e,t){const{topic:n,endpointToken:r}=Ml(e);return n.length===0||r.length===0?e:`${cs(n,t)}:${r}`}function I1(e,t){if(!e)return[];const n=[];for(const[r,s]of Object.entries(e.data.batches)){if(!Of(s))continue;const o=s.samples;if(Array.isArray(o))for(const i of o){if(!Of(i))continue;const l=i.endpoint_id,a=i.topic,u=i.metric,c=i.value,d=i.timestamp,f=i.sample_seq;if(typeof l!="string"||typeof a!="string"||typeof u!="string"||typeof c!="number"||!Number.isFinite(c))continue;const m=Xc(l,t),v=cs(a,t);n.push({rowId:`${r}:${m}`,processId:r,endpointId:m,topic:v,timestamp:typeof d=="number"&&Number.isFinite(d)?d:e.data.timestamp,metric:u,value:c,sampleSeq:typeof f=="number"&&Number.isFinite(f)?Math.trunc(f):null,channelKind:typeof i.channel_kind=="string"?i.channel_kind:null})}}return n}function C1(e,t,n,r,s){const o=cs(t.topic,s);return{id:`${e.process_id}:${t.endpoint_id}`,endpointId:t.endpoint_id,displayEndpointId:Xc(t.endpoint_id,s),topic:o,processId:e.process_id,pid:e.pid,host:e.host,messagesWindow:er(t.messages_received_window),channelKindLast:typeof t.channel_kind_last=="string"?t.channel_kind_last:"unknown",unitAddress:n.get(t.endpoint_id)??r.get(o)??null}}function $u(e,t,n){const r=cs(e,n),s=new Set([r]),o=new Set([e,r]);for(const i of o){const l=t==null?void 0:t.graph[i];if(Array.isArray(l))for(const a of l)typeof a=="string"&&s.add(cs(a,n))}return s}function Lf(e,t){if(t.has(e))return!0;for(const n of t)if(e.startsWith(`${n}:`))return!0;return!1}function k1(e,t,n,r){const s=$u(e,n,r);return t.filter(o=>s.has(o.topic)).sort((o,i)=>{const l=o.topic.localeCompare(i.topic);if(l!==0)return l;const a=o.processId.localeCompare(i.processId);return a!==0?a:o.endpointId.localeCompare(i.endpointId)})}function P1(e,t,n,r,s,o,i){const l=`${e.process_id}:${t.endpoint_id}`,a=t.num_buffers,u=typeof a=="number"&&Number.isFinite(a)?Math.max(0,Math.trunc(a)):null,c=cs(t.topic,i);return{id:l,endpointId:t.endpoint_id,displayEndpointId:Xc(t.endpoint_id,i),topic:c,processId:e.process_id,pid:e.pid,host:e.host,windowSeconds:er(e.window_seconds),publishRateHzWindow:er(t.publish_rate_hz_window),messagesPublishedWindow:er(t.messages_published_window),inflightCurrent:er(t.inflight_messages_current),numBuffers:u,activityTone:T1(er(t.messages_published_window),er(t.inflight_messages_current),u),contributors:k1(c,n,r,i),unitAddress:s.get(t.endpoint_id)??o.get(c)??null}}function b1({graphSnapshot:e,profilingSnapshot:t,latestTraceEvent:n,setProfilingTraceControl:r,focusPublisherEndpointId:s=null,focusPublisherTopic:o=null,focusSubscriberEndpointId:i=null,focusUnitAddress:l=null,focusActionId:a=0,showSettingsChannels:u=!1,hideFilters:c=!1,defaultTraceMetrics:d=["publish_delta_ns","lease_time_ns","user_span_ns"],traceDockHost:f=null,onTraceDockStateChange:m,traceCloseSignal:v=0,onPublisherSelect:x,onSubscriberSelect:T,darkMode:p=!1}){const[g,_]=E.useState(""),[w,P]=E.useState([]),[A,R]=E.useState([]),[$,B]=E.useState({}),[D,U]=E.useState({}),[Q,z]=E.useState({}),[y,I]=E.useState({}),[N,O]=E.useState({}),C=E.useRef(v),S=E.useRef(-1),b=E.useRef({}),j=E.useMemo(()=>t?Object.values(t):[],[t]),M=E.useMemo(()=>e?Kc(e):null,[e]),K=E.useMemo(()=>M?Ol(M.collections).endpointByInternalTopic:new Map,[M]),Y=E.useMemo(()=>{const F=new Map;if(!M)return F;const X=(Z,de)=>{const ce=e1(de);ce&&!F.has(ce)&&F.set(ce,Z)};for(const Z of M.units.values())for(const de of Z.streams)X(Z.address,de.address);for(const Z of M.collections.values())for(const de of Z.streams)X(Z.address,de.address);return F},[M]),ee=E.useMemo(()=>{const F=new Map;if(!M)return F;const X=(Z,de)=>{F.set(de,Z),F.set(je(de),Z)};for(const Z of M.units.values())for(const de of Z.streams)X(Z.address,de.address);for(const Z of M.collections.values())for(const de of Z.streams)X(Z.address,de.address);return F},[M]),te=E.useMemo(()=>{const F=[];for(const de of j)for(const ce of Object.values(de.subscribers))F.push(C1(de,ce,Y,ee,K));const X=[];for(const de of j)for(const ce of Object.values(de.publishers))X.push(P1(de,ce,F,e,Y,ee,K));return(u?X:X.filter(de=>!m1(de.topic))).sort((de,ce)=>{const Ne=de.topic.localeCompare(ce.topic);if(Ne!==0)return Ne;const Ae=de.processId.localeCompare(ce.processId);return Ae!==0?Ae:de.endpointId.localeCompare(ce.endpointId)})},[Y,ee,e,j,K,u]),pe=E.useMemo(()=>{const F=g.trim().toLowerCase();return te.filter(X=>F.length===0?!0:X.topic.toLowerCase().includes(F)||X.endpointId.toLowerCase().includes(F)||X.processId.toLowerCase().includes(F))},[te,g]),V=E.useMemo(()=>new Map(te.map(F=>[F.id,F])),[te]);E.useEffect(()=>{if(a===S.current)return;const F=(X,Z)=>{X.length!==0&&(S.current=a,_(""),P([...new Set([...X,...A])]),O(de=>{if(Z===null)return{};const ce={...de};for(const Ne of X)ce[Ne]=Z;return ce}),window.requestAnimationFrame(()=>{var de;(de=b.current[X[0]])==null||de.scrollIntoView({block:"nearest",behavior:"smooth"})}))};if(s){F(te.filter(X=>X.endpointId===s?!0:o?X.topic===o:!1).map(X=>X.id),null);return}if(i){F(te.filter(X=>X.contributors.some(Z=>Z.endpointId===i)).map(X=>X.id),i);return}l&&F(te.filter(X=>X.unitAddress===l).map(X=>X.id),null)},[s,o,i,l,a,te,A]),E.useEffect(()=>{if(!n||A.length===0)return;const F=I1(n,K);if(F.length===0)return;const X=new Set(A),Z=A.map(ce=>V.get(ce)).filter(ce=>ce!==void 0).map(ce=>({row:ce,topicScope:$u(ce.topic,e,K)})),de=new Map(Z.map(ce=>[ce.row.id,ce.topicScope]));B(ce=>{let Ne=!1;const Ae={...ce},we={};for(const ue of F){const ge=new Set,Te=V.get(ue.rowId),ke=de.get(ue.rowId);if(Te&&X.has(ue.rowId)&&ke&&Lf(ue.topic,ke)&&_1.has(ue.metric)&&ge.add(ue.rowId),v1.has(ue.metric))for(const ye of Z)Lf(ue.topic,ye.topicScope)&&ge.add(ye.row.id);for(const ye of ge){const Ce=we[ye];Ce?Ce.push(ue):we[ye]=[ue]}}for(const[ue,ge]of Object.entries(we))ge.length!==0&&(Ae[ue]=ge,Ne=!0);return Ne?Ae:ce})},[A,e,n,K,V]);const me=async(F,X)=>{if(!D[F.id]){U(Z=>({...Z,[F.id]:!0})),z(Z=>({...Z,[F.id]:null})),X?(B(Z=>({...Z,[F.id]:[]})),I(Z=>Z[F.id]!==void 0?Z:{...Z,[F.id]:E1(F.publishRateHzWindow)}),R([F.id])):R(Z=>Z.includes(F.id)?Z.filter(de=>de!==F.id):Z);try{if(X){const Z=A.find(de=>de!==F.id);if(Z){const de=V.get(Z);de&&await r({process_id:de.processId,enabled:!1,publisher_endpoint_id:null,publisher_topic:null,subscriber_topic:null,metrics:null,sample_mod:1,ttl_seconds:null,timeout:2})}}await r({process_id:F.processId,enabled:X,publisher_endpoint_id:X?F.endpointId:null,publisher_topic:null,subscriber_topic:X?F.topic:null,metrics:X?d:null,sample_mod:1,ttl_seconds:null,timeout:2})}catch(Z){const de=Z instanceof Error?Z.message:"Trace control request failed.";z(ce=>({...ce,[F.id]:de})),R(ce=>X?ce.filter(Ne=>Ne!==F.id):ce.includes(F.id)?ce:[...ce,F.id])}finally{U(Z=>({...Z,[F.id]:!1}))}}},he=F=>{const X=!w.includes(F.id);X&&(x==null||x({unitAddress:F.unitAddress,endpointId:F.endpointId,topic:F.topic})),P(Z=>Z.includes(F.id)?Z.filter(de=>de!==F.id):[...Z,F.id]),X||O(Z=>({...Z,[F.id]:null})),!X&&A.includes(F.id)&&me(F,!1)},ve=(F,X)=>{me(F,X)},Se=c,k=A[0]??null,L=k?V.get(k)??null:null,ne=k?$[k]??[]:[],le=k?!!D[k]:!1,J=k?Q[k]??null:null,q=Lu(k?y[k]??yo:yo),H=L?Array.from($u(L.topic,e,K)):[],oe=ne.filter(F=>F.metric==="lease_time_ns"||F.metric==="user_span_ns").map(F=>F.endpointId),W=Cf([...(L==null?void 0:L.contributors.map(F=>F.endpointId))??[],...oe]),re=k?N[k]??null:null;E.useEffect(()=>{if(v===C.current)return;C.current=v;const F=A[0];if(!F)return;const X=V.get(F);if(!X){R([]);return}R([]),r({process_id:X.processId,enabled:!1,publisher_endpoint_id:null,publisher_topic:null,subscriber_topic:null,metrics:null,sample_mod:1,ttl_seconds:null,timeout:2})},[A,V,r,v]),E.useEffect(()=>{if(m){if(!L){m(null);return}m({active:!0,topic:L.topic,endpointId:L.endpointId,status:le?"applying":"capturing"})}},[le,L,m]);const ae=f&&L?Zm.createPortal(h.jsxs("div",{className:"trace-dock-trace",children:[ne.length===0?h.jsx("p",{className:"muted",children:"Waiting for trace samples on this publisher endpoint."}):h.jsx(Jv,{samples:ne,publisherProcessId:L.processId,publisherEndpointId:L.endpointId,nominalPublishRateHz:L.publishRateHzWindow,topic:L.topic,topicScope:H,leaseColorMap:W,selectedSubscriberEndpointId:re,windowSeconds:q,darkMode:p,onWindowSecondsChange:F=>I(X=>({...X,[L.id]:Lu(F)}))}),J?h.jsx("p",{className:"patch-status err",children:J}):null]}),f):null;return h.jsxs(sl,{children:[te.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No publishers snapshot entries available."})}):h.jsxs(h.Fragment,{children:[Se?null:h.jsx("div",{className:"settings-search",children:h.jsx("input",{type:"search",placeholder:"Search topic, endpoint, or process",value:g,onChange:F=>_(F.target.value)})}),pe.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No publishers match the current filter."})}):h.jsx("div",{className:"publisher-list",children:pe.map(F=>{const X=w.includes(F.id),Z=A.includes(F.id),de=!!D[F.id],ce=w1(F.windowSeconds),Ne=Cf(F.contributors.map(ue=>ue.endpointId)),Ae=N[F.id]??null,we=F.contributors.some(ue=>ue.endpointId===Ae)?Ae:null;return h.jsxs("article",{ref:ue=>{b.current[F.id]=ue},className:`publisher-row activity-${F.activityTone}`,children:[h.jsxs("button",{type:"button",className:"publisher-row__toggle",onClick:()=>he(F),"aria-expanded":X,children:[h.jsxs("div",{className:"publisher-row__top",children:[h.jsx("div",{className:"publisher-row__identity",children:h.jsx("div",{className:"publisher-row__identity-text",children:h.jsx("p",{className:"mono publisher-topic",title:F.topic,children:F.topic})})}),h.jsx("span",{className:"publisher-caret",children:X?"▾":"▸"})]}),h.jsxs("div",{className:"publisher-row__metrics",children:[h.jsxs("div",{children:[h.jsx("span",{children:"Rate"}),h.jsx("strong",{children:x1(F.publishRateHzWindow)})]}),h.jsxs("div",{children:[h.jsx("span",{children:ce?`Msgs (${ce})`:"Msgs"}),h.jsx("strong",{children:F.messagesPublishedWindow})]}),h.jsxs("div",{children:[h.jsx("span",{children:"Inflight"}),h.jsx("strong",{children:F.numBuffers===null?`${F.inflightCurrent}`:`${F.inflightCurrent} / ${F.numBuffers}`})]}),h.jsxs("div",{children:[h.jsx("span",{children:"Subscribers"}),h.jsx("strong",{children:F.contributors.length})]})]})]}),X?h.jsxs("div",{className:"publisher-row__details",children:[h.jsxs("div",{className:"publisher-kpis",children:[h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Host"}),h.jsx("strong",{children:F.host})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"PID"}),h.jsx("strong",{children:F.pid})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Process"}),h.jsx("strong",{className:"mono",title:F.processId,children:F.processId.slice(0,8)})]})]}),h.jsx("div",{className:"publisher-detail-line",children:h.jsxs("div",{className:"publisher-endpoint",children:[h.jsx("span",{children:"Endpoint"}),h.jsx("code",{className:"mono",title:F.displayEndpointId,children:F.displayEndpointId})]})}),h.jsxs("div",{className:"panel-section",children:[h.jsxs("button",{type:"button",className:`publisher-trace-button ${Z?"is-stop":"is-start"}`,onClick:()=>ve(F,!Z),disabled:de,"aria-pressed":Z,children:[h.jsx("span",{"aria-hidden":"true",className:"publisher-trace-button__icon",children:Z?"■":"▶"}),h.jsx("span",{children:de?"Applying...":Z?"Stop Profiling Trace":"Start Profiling Trace"})]}),h.jsx("div",{className:"subscriber-section-header",children:h.jsx("h3",{children:"Subscribers"})}),F.contributors.length===0?h.jsx("p",{className:"muted",children:"No subscriber profiling data is available for this topic."}):h.jsx("div",{className:"subscriber-list",children:F.contributors.map(ue=>{const ge=we===ue.endpointId;return h.jsxs("article",{className:`subscriber-item ${ge?"is-expanded":""}`,children:[h.jsxs("button",{type:"button",className:"subscriber-item__summary",onClick:()=>{const Te=ge?null:ue.endpointId;Te&&(T==null||T({unitAddress:ue.unitAddress,endpointId:ue.endpointId,topic:ue.topic})),O(ke=>({...ke,[F.id]:Te}))},children:[h.jsx("div",{className:"subscriber-item__identity",children:h.jsx("p",{className:"mono subscriber-topic-short",title:ue.topic,children:h.jsxs("span",{className:"subscriber-topic-with-color",children:[h.jsx("i",{className:"subscriber-trace-dot",style:{background:Qs(ue.endpointId,Ne)}}),h.jsx("span",{className:"subscriber-topic-label",children:N1(ue.topic,72)})]})})}),h.jsxs("div",{className:"subscriber-item__metrics",children:[h.jsxs("span",{children:[h.jsx("em",{children:ce?`Msgs (${ce})`:"Msgs"}),h.jsx("strong",{children:ue.messagesWindow})]}),h.jsxs("span",{children:[h.jsx("em",{children:"Channel"}),h.jsx("strong",{children:ue.channelKindLast})]})]})]}),ge?h.jsx("div",{className:"subscriber-item__detail",children:h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"publisher-kpis",children:[h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Host"}),h.jsx("strong",{children:ue.host})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"PID"}),h.jsx("strong",{children:ue.pid})]}),h.jsxs("article",{className:"mini-kpi",children:[h.jsx("span",{children:"Process"}),h.jsx("strong",{className:"mono",title:ue.processId,children:ue.processId.slice(0,8)})]})]}),h.jsx("div",{className:"publisher-detail-line",children:h.jsxs("div",{className:"publisher-endpoint",children:[h.jsx("span",{children:"Endpoint"}),h.jsx("code",{className:"mono",title:ue.displayEndpointId,children:ue.displayEndpointId})]})})]})}):null]},ue.id)})})]})]}):null]},F.id)})})]}),ae]})}function A1(e){const t=e.field_type.toLowerCase();return Array.isArray(e.choices)&&e.choices.length>0?"choice":t.includes("bool")?"boolean":t.includes("int")||t.includes("float")||t.includes("double")||t.includes("number")?"number":t.includes("str")||t.includes("string")?"text":"json"}function R1(e){return typeof e=="boolean"?"boolean":typeof e=="number"||rg(e)?"number":typeof e=="string"?"text":"json"}function $f(e,t){if(!e||typeof e!="object")return;const n=t.split(".").filter(s=>s.length>0);let r=e;for(const s of n){if(!r||typeof r!="object"||!(s in r))return;r=r[s]}return r}function og(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ig(e,t=""){if(!e||typeof e!="object"||Array.isArray(e))return t.length>0?[t]:[];const n=Object.entries(e);if(n.length===0)return t.length>0?[t]:[];const r=[];for(const[s,o]of n){const i=t.length>0?`${t}.${s}`:s,l=ig(o,i);l.length===0?r.push(i):r.push(...l)}return r}function M1(e){if(e.mode==="boolean")return!!e.currentValue;if(e.mode==="choice"){const t=e.choices??[],n=Math.max(0,t.findIndex(r=>JSON.stringify(r)===JSON.stringify(e.currentValue)));return String(n)}return e.mode==="number"?d1(e.currentValue):e.mode==="text"?typeof e.currentValue=="string"?e.currentValue:"":og(e.currentValue)}function O1(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>e[s]===t[s])}function L1({settings:e,patchSettingField:t,focusComponentAddress:n=null,focusActionId:r=0,onComponentSelect:s}){const o=E.useMemo(()=>e?Object.keys(e).sort():[],[e]),i=E.useMemo(()=>o.join("|"),[o]),l=E.useMemo(()=>new Set(o),[i]),[a,u]=E.useState(null),[c,d]=E.useState(""),[f,m]=E.useState({}),[v,x]=E.useState({}),[T,p]=E.useState({}),[g,_]=E.useState({}),w=E.useRef({}),P=E.useRef({}),A=E.useRef(null);E.useEffect(()=>{a&&!o.includes(a)&&u(null)},[o,a]),E.useEffect(()=>{!n||!l.has(n)||(d(""),u(n),window.requestAnimationFrame(()=>{var y;(y=w.current[n])==null||y.scrollIntoView({block:"nearest",behavior:"smooth"})}))},[l,r,n]);const R=a?e==null?void 0:e[a]:null,$=E.useMemo(()=>(R==null?void 0:R.structured_value)??(R==null?void 0:R.repr_value),[R]),B=E.useMemo(()=>{var O;if(!R)return[];const y=((O=R.settings_schema)==null?void 0:O.fields)??[];if(y.length>0)return y.map(C=>{const S=$f($,C.name);return{path:C.name,mode:A1(C),currentValue:S??C.default??null,description:C.description,bounds:C.bounds,choices:C.choices,isInteger:C.field_type.toLowerCase().includes("int")}});const I=ig($);return(I.length>0?I:["value"]).map(C=>{const S=C==="value"?$:$f($,C);return{path:C,mode:R1(S),currentValue:S,description:null,bounds:null,choices:null,isInteger:Number.isInteger(S)}})},[R,$]),D=!!(R!=null&&R.patchable),U=E.useMemo(()=>{const y=c.trim().toLowerCase();return y?o.filter(I=>{const N=e==null?void 0:e[I],O=typeof(N==null?void 0:N.component_name)=="string"?N.component_name:"",C=typeof(N==null?void 0:N.component_type)=="string"?N.component_type:"";return I.toLowerCase().includes(y)||O.toLowerCase().includes(y)||C.toLowerCase().includes(y)}):o},[o,c,e]);E.useEffect(()=>{const y={};for(const N of B)y[N.path]=M1(N);const I=A.current!==a;m(N=>{if(I)return y;const O={};for(const[C,S]of Object.entries(y)){const b=N[C],j=P.current[C];O[C]=b===void 0||b===j?S:b}return O1(N,O)?N:O}),I&&(x({}),p({}),_({})),P.current=y,A.current=a},[B,a]);const Q=y=>{const I=f[y.path];if(y.mode==="boolean")return!!I;if(y.mode==="choice"){const N=Number.parseInt(String(I),10),O=y.choices??[];if(!Number.isInteger(N)||N<0||N>=O.length)throw new Error("A valid choice must be selected.");return O[N]}if(y.mode==="number"){const N=f1(String(I??""));if(N===null)throw new Error("Value must be a valid number.");if(!Number.isFinite(N)){if(y.isInteger)throw new Error("Integer fields require a finite value.");return c1(N)}return y.isInteger?Math.trunc(N):N}if(y.mode==="text")return String(I??"");try{return JSON.parse(String(I??""))}catch{throw new Error("Value must be valid JSON.")}},z=async y=>{if(!a||!D)return;let I;try{I=Q(y)}catch(N){p(O=>({...O,[y.path]:N instanceof Error?N.message:"Invalid field value."})),_(O=>({...O,[y.path]:null}));return}x(N=>({...N,[y.path]:!0})),p(N=>({...N,[y.path]:null})),_(N=>({...N,[y.path]:null}));try{const N=await t(a,y.path,I);_(O=>({...O,[y.path]:`Applied ${N.field_path}`}))}catch(N){p(O=>({...O,[y.path]:N instanceof Error?N.message:"Patch request failed."}))}finally{x(N=>({...N,[y.path]:!1}))}};return h.jsx(sl,{children:o.length===0?h.jsx("div",{className:"panel-section",children:h.jsx("p",{className:"muted",children:"No settings snapshot entries available."})}):h.jsxs("div",{className:"settings-component-list",children:[h.jsx("div",{className:"settings-search",children:h.jsx("input",{type:"search",placeholder:"Search component, type, or address",value:c,onChange:y=>d(y.target.value)})}),U.map(y=>{const I=(e==null?void 0:e[y])??null,N=a===y,O=!!(I!=null&&I.patchable),C=typeof(I==null?void 0:I.component_name)=="string"&&I.component_name.length>0?I.component_name:y.split("/")[y.split("/").length-1]??y;return h.jsxs("article",{ref:S=>{w.current[y]=S},className:`settings-component-row ${N?"is-expanded":""}`,children:[h.jsxs("button",{type:"button",className:"settings-component-row__toggle","aria-expanded":N,onClick:()=>u(S=>{const b=S===y?null:y;return s==null||s(b),b}),children:[h.jsxs("div",{className:"settings-component-row__identity",children:[h.jsxs("div",{className:"settings-component-row__heading",children:[h.jsx("p",{className:"mono settings-component-title",title:C,children:C}),I!=null&&I.component_type?h.jsx("span",{className:"settings-type",title:I.component_type,children:I.component_type}):null]}),h.jsx("p",{className:"mono settings-component-address",title:y,children:y})]}),h.jsxs("div",{className:"settings-component-row__meta",children:[h.jsx("span",{className:`settings-access ${O?"is-patchable":"is-readonly"}`,children:O?"patchable":"read only"}),h.jsx("span",{className:"publisher-caret",children:N?"▾":"▸"})]})]}),N?h.jsx("section",{className:"settings-detail",children:B.length===0?h.jsx("p",{className:"muted",children:"No fields available for this component."}):h.jsx("div",{className:"settings-fields",children:B.map(S=>{var K,Y;const b=v[S.path]===!0,j=!D,M=f[S.path];return h.jsxs("div",{className:`settings-field-row ${j?"is-disabled":""}`,children:[h.jsxs("div",{className:"settings-field-row__meta",children:[h.jsx("label",{className:"mono",children:S.path}),S.description?h.jsx("p",{className:"muted",children:S.description}):null,S.bounds?h.jsxs("p",{className:"muted",children:["Bounds: [",S.bounds[0]??"-inf",", ",S.bounds[1]??"+inf","]"]}):null]}),h.jsxs("div",{className:`settings-field-row__control ${S.mode==="boolean"?"is-boolean":""}`,children:[S.mode==="boolean"?h.jsxs("label",{className:"patch-checkbox",children:[h.jsx("input",{type:"checkbox",checked:!!M,onChange:ee=>m(te=>({...te,[S.path]:ee.target.checked})),disabled:j||b}),h.jsx("span",{children:"Enabled"})]}):null,S.mode==="choice"?h.jsx("select",{value:String(M??"0"),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b,children:(S.choices??[]).map((ee,te)=>h.jsx("option",{value:String(te),children:og(ee)},`${S.path}-${te}`))}):null,S.mode==="number"?S.isInteger?h.jsx("input",{type:"number",value:String(M??""),min:((K=S.bounds)==null?void 0:K[0])??void 0,max:((Y=S.bounds)==null?void 0:Y[1])??void 0,step:"any",onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):h.jsx("input",{type:"text",inputMode:"decimal",value:String(M??""),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,S.mode==="text"?h.jsx("input",{type:"text",value:String(M??""),onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,S.mode==="json"?h.jsx("textarea",{value:String(M??""),rows:4,spellCheck:!1,className:"mono",onChange:ee=>m(te=>({...te,[S.path]:ee.target.value})),disabled:j||b}):null,h.jsx("button",{type:"button",onClick:()=>{z(S)},disabled:j||b,children:b?"Applying...":"Apply"})]}),g[S.path]?h.jsx("p",{className:"patch-status ok",children:g[S.path]}):null,T[S.path]?h.jsx("p",{className:"patch-status err",children:T[S.path]}):null]},S.path)})})}):null]},y)})]})})}function rt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?U1:D1;ug.useSyncExternalStore=ds.useSyncExternalStore!==void 0?ds.useSyncExternalStore:H1;ag.exports=ug;var W1=ag.exports;/** + */var ds=E;function $1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var j1=typeof Object.is=="function"?Object.is:$1,B1=ds.useState,F1=ds.useEffect,z1=ds.useLayoutEffect,D1=ds.useDebugValue;function U1(e,t){var n=t(),r=B1({inst:{value:n,getSnapshot:t}}),s=r[0].inst,o=r[1];return z1(function(){s.value=n,s.getSnapshot=t,wa(s)&&o({inst:s})},[e,n,t]),F1(function(){return wa(s)&&o({inst:s}),e(function(){wa(s)&&o({inst:s})})},[e]),D1(n),n}function wa(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!j1(e,n)}catch{return!0}}function H1(e,t){return t()}var W1=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?H1:U1;cg.useSyncExternalStore=ds.useSyncExternalStore!==void 0?ds.useSyncExternalStore:W1;ug.exports=cg;var V1=ug.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -53,8 +53,8 @@ Error generating stack: `+o.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ml=E,V1=W1;function G1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Y1=typeof Object.is=="function"?Object.is:G1,K1=V1.useSyncExternalStore,X1=Ml.useRef,Q1=Ml.useEffect,Z1=Ml.useMemo,q1=Ml.useDebugValue;lg.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var o=X1(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=Z1(function(){function a(m){if(!u){if(u=!0,c=m,m=r(m),s!==void 0&&i.hasValue){var v=i.value;if(s(v,m))return d=v}return d=m}if(v=d,Y1(c,m))return v;var x=r(m);return s!==void 0&&s(v,x)?(c=m,v):(c=m,d=x)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,s]);var l=K1(e,o[0],o[1]);return Q1(function(){i.hasValue=!0,i.value=l},[l]),q1(l),l};ig.exports=lg;var J1=ig.exports;const ex=Bp(J1),tx={},jf=e=>{let t;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const m=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(v=>v(t,m))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(tx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,a);return a},nx=e=>e?jf(e):jf,{useDebugValue:rx}=G,{useSyncExternalStoreWithSelector:sx}=ex,ox=e=>e;function cg(e,t=ox,n){const r=sx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rx(r),r}const Bf=(e,t)=>{const n=nx(e),r=(s,o=t)=>cg(n,s,o);return Object.assign(r,n),r},ix=(e,t)=>e?Bf(e,t):Bf;function Je(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var lx={value:()=>{}};function Ol(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ii.prototype=Ol.prototype={constructor:Ii,on:function(e,t){var n=this._,r=ax(e+"",n),s,o=-1,i=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(s),r=0,s,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zf.hasOwnProperty(t)?{space:zf[t],local:e}:e}function cx(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ou&&t.documentElement.namespaceURI===Ou?t.createElement(e):t.createElementNS(n,e)}}function dx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dg(e){var t=Ll(e);return(t.local?dx:cx)(t)}function fx(){}function Qc(e){return e==null?fx:function(){return this.querySelector(e)}}function px(e){typeof e!="function"&&(e=Qc(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=_&&(_=g+1);!(P=T[_])&&++_=0;)(i=r[s])&&(o&&i.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(i,o),o=i);return this}function Bx(e){e||(e=Fx);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,s=new Array(r),o=0;ot?1:e>=t?0:NaN}function zx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dx(){return Array.from(this)}function Ux(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Jx:typeof t=="function"?tw:ew)(e,t,n??"")):fs(this.node(),e)}function fs(e,t){return e.style.getPropertyValue(t)||gg(e).getComputedStyle(e,null).getPropertyValue(t)}function rw(e){return function(){delete this[e]}}function sw(e,t){return function(){this[e]=t}}function ow(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function iw(e,t){return arguments.length>1?this.each((t==null?rw:typeof t=="function"?ow:sw)(e,t)):this.node()[e]}function yg(e){return e.trim().split(/^|\s+/)}function Zc(e){return e.classList||new _g(e)}function _g(e){this._node=e,this._names=yg(e.getAttribute("class")||"")}_g.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function vg(e,t){for(var n=Zc(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Ow(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n()=>e;function Lu(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:i,y:l,dx:a,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}Lu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ww(e){return!e.ctrlKey&&!e.button}function Vw(){return this.parentNode}function Gw(e,t){return t??{x:e.x,y:e.y}}function Yw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kw(){var e=Ww,t=Vw,n=Gw,r=Yw,s={},o=Ol("start","drag","end"),i=0,l,a,u,c,d=0;function f(w){w.on("mousedown.drag",m).filter(r).on("touchstart.drag",T).on("touchmove.drag",p,Hw).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,P){if(!(c||!e.call(this,w,P))){var A=_(this,t.call(this,w,P),w,P,"mouse");A&&(bt(w.view).on("mousemove.drag",v,yo).on("mouseup.drag",x,yo),Eg(w.view),va(w),u=!1,l=w.clientX,a=w.clientY,A("start",w))}}function v(w){if(es(w),!u){var P=w.clientX-l,A=w.clientY-a;u=P*P+A*A>d}s.mouse("drag",w)}function x(w){bt(w.view).on("mousemove.drag mouseup.drag",null),Ng(w.view,u),es(w),s.mouse("end",w)}function T(w,P){if(e.call(this,w,P)){var A=w.changedTouches,R=t.call(this,w,P),$=A.length,B,D;for(B=0;B<$;++B)(D=_(this,R,w,P,A[B].identifier,A[B]))&&(va(w),D("start",w,A[B]))}}function p(w){var P=w.changedTouches,A=P.length,R,$;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Qw.exec(e))?new gt(t[1],t[2],t[3],1):(t=Zw.exec(e))?new gt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qw.exec(e))?Jo(t[1],t[2],t[3],t[4]):(t=Jw.exec(e))?Jo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eS.exec(e))?Yf(t[1],t[2]/100,t[3]/100,1):(t=tS.exec(e))?Yf(t[1],t[2]/100,t[3]/100,t[4]):Df.hasOwnProperty(e)?Wf(Df[e]):e==="transparent"?new gt(NaN,NaN,NaN,0):null}function Wf(e){return new gt(e>>16&255,e>>8&255,e&255,1)}function Jo(e,t,n,r){return r<=0&&(e=t=n=NaN),new gt(e,t,n,r)}function sS(e){return e instanceof Ao||(e=xo(e)),e?(e=e.rgb(),new gt(e.r,e.g,e.b,e.opacity)):new gt}function $u(e,t,n,r){return arguments.length===1?sS(e):new gt(e,t,n,r??1)}function gt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}qc(gt,$u,Tg(Ao,{brighter(e){return e=e==null?il:Math.pow(il,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_o:Math.pow(_o,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gt(cr(this.r),cr(this.g),cr(this.b),ll(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Vf,formatHex:Vf,formatHex8:oS,formatRgb:Gf,toString:Gf}));function Vf(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}`}function oS(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}${ir((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gf(){const e=ll(this.opacity);return`${e===1?"rgb(":"rgba("}${cr(this.r)}, ${cr(this.g)}, ${cr(this.b)}${e===1?")":`, ${e})`}`}function ll(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function cr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ir(e){return e=cr(e),(e<16?"0":"")+e.toString(16)}function Yf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Dt(e,t,n,r)}function Ig(e){if(e instanceof Dt)return new Dt(e.h,e.s,e.l,e.opacity);if(e instanceof Ao||(e=xo(e)),!e)return new Dt;if(e instanceof Dt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,l=o-s,a=(o+s)/2;return l?(t===o?i=(n-r)/l+(n0&&a<1?0:i,new Dt(i,l,a,e.opacity)}function iS(e,t,n,r){return arguments.length===1?Ig(e):new Dt(e,t,n,r??1)}function Dt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}qc(Dt,iS,Tg(Ao,{brighter(e){return e=e==null?il:Math.pow(il,e),new Dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_o:Math.pow(_o,e),new Dt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new gt(xa(e>=240?e-240:e+120,s,r),xa(e,s,r),xa(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Dt(Kf(this.h),ei(this.s),ei(this.l),ll(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ll(this.opacity);return`${e===1?"hsl(":"hsla("}${Kf(this.h)}, ${ei(this.s)*100}%, ${ei(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kf(e){return e=(e||0)%360,e<0?e+360:e}function ei(e){return Math.max(0,Math.min(1,e||0))}function xa(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Cg=e=>()=>e;function lS(e,t){return function(n){return e+n*t}}function aS(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function uS(e){return(e=+e)==1?kg:function(t,n){return n-t?aS(t,n,e):Cg(isNaN(t)?n:t)}}function kg(e,t){var n=t-e;return n?lS(e,n):Cg(isNaN(e)?t:e)}const Xf=function e(t){var n=uS(t);function r(s,o){var i=n((s=$u(s)).r,(o=$u(o)).r),l=n(s.g,o.g),a=n(s.b,o.b),u=kg(s.opacity,o.opacity);return function(c){return s.r=i(c),s.g=l(c),s.b=a(c),s.opacity=u(c),s+""}}return r.gamma=e,r}(1);function kn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var ju=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wa=new RegExp(ju.source,"g");function cS(e){return function(){return e}}function dS(e){return function(t){return e(t)+""}}function fS(e,t){var n=ju.lastIndex=wa.lastIndex=0,r,s,o,i=-1,l=[],a=[];for(e=e+"",t=t+"";(r=ju.exec(e))&&(s=wa.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),l[i]?l[i]+=o:l[++i]=o),(r=r[0])===(s=s[0])?l[i]?l[i]+=s:l[++i]=s:(l[++i]=null,a.push({i,x:kn(r,s)})),n=wa.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,r)-2,x:kn(u,c)})):c&&d.push(s(d)+"rotate("+c+r)}function l(u,c,d,f){u!==c?f.push({i:d.push(s(d)+"skewX(",null,r)-2,x:kn(u,c)}):c&&d.push(s(d)+"skewX("+c+r)}function a(u,c,d,f,m,v){if(u!==d||c!==f){var x=m.push(s(m)+"scale(",null,",",null,")");v.push({i:x-4,x:kn(u,d)},{i:x-2,x:kn(c,f)})}else(d!==1||f!==1)&&m.push(s(m)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),i(u.rotate,c.rotate,d,f),l(u.skewX,c.skewX,d,f),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(m){for(var v=-1,x=f.length,T;++v=0&&e._call.call(void 0,t),e=e._next;--ps}function qf(){_r=(ul=wo.now())+$l,ps=Fs=0;try{SS()}finally{ps=0,NS(),_r=0}}function ES(){var e=wo.now(),t=e-ul;t>Ag&&($l-=t,ul=e)}function NS(){for(var e,t=al,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:al=n);zs=e,Fu(r)}function Fu(e){if(!ps){Fs&&(Fs=clearTimeout(Fs));var t=e-_r;t>24?(e<1/0&&(Fs=setTimeout(qf,e-wo.now()-$l)),Cs&&(Cs=clearInterval(Cs))):(Cs||(ul=wo.now(),Cs=setInterval(ES,Ag)),ps=1,Rg(qf))}}function Jf(e,t,n){var r=new cl;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var TS=Ol("start","end","cancel","interrupt"),IS=[],Og=0,ep=1,zu=2,Ci=3,tp=4,Du=5,ki=6;function jl(e,t,n,r,s,o){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;CS(e,n,{name:t,index:r,group:s,on:TS,tween:IS,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Og})}function ed(e,t){var n=Yt(e,t);if(n.state>Og)throw new Error("too late; already scheduled");return n}function nn(e,t){var n=Yt(e,t);if(n.state>Ci)throw new Error("too late; already running");return n}function Yt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function CS(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Mg(o,0,n.time);function o(u){n.state=ep,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var c,d,f,m;if(n.state!==ep)return a();for(c in r)if(m=r[c],m.name===n.name){if(m.state===Ci)return Jf(i);m.state===tp?(m.state=ki,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[c]):+czu&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function rE(e,t,n){var r,s,o=nE(t)?ed:nn;return function(){var i=o(this,e),l=i.on;l!==r&&(s=(r=l).copy()).on(t,n),i.on=s}}function sE(e,t){var n=this._id;return arguments.length<2?Yt(this.node(),n).on.on(e):this.each(rE(n,e,t))}function oE(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function iE(){return this.on("end.remove",oE(this._id))}function lE(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qc(e));for(var r=this._groups,s=r.length,o=new Array(s),i=0;i()=>e;function RE(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function fn(e,t,n){this.k=e,this.x=t,this.y=n}fn.prototype={constructor:fn,scale:function(e){return e===1?this:new fn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new fn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var hn=new fn(1,0,0);fn.prototype;function Sa(e){e.stopImmediatePropagation()}function ks(e){e.preventDefault(),e.stopImmediatePropagation()}function ME(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function OE(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function np(){return this.__zoom||hn}function LE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $E(){return navigator.maxTouchPoints||"ontouchstart"in this}function jE(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i))}function Bg(){var e=ME,t=OE,n=jE,r=LE,s=$E,o=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,a=xS,u=Ol("start","zoom","end"),c,d,f,m=500,v=150,x=0,T=10;function p(y){y.property("__zoom",np).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",D).filter(s).on("touchstart.zoom",U).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(y,I,N,O){var C=y.selection?y.selection():y;C.property("__zoom",np),y!==C?P(y,I,N,O):C.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},p.scaleBy=function(y,I,N,O){p.scaleTo(y,function(){var C=this.__zoom.k,S=typeof I=="function"?I.apply(this,arguments):I;return C*S},N,O)},p.scaleTo=function(y,I,N,O){p.transform(y,function(){var C=t.apply(this,arguments),S=this.__zoom,b=N==null?w(C):typeof N=="function"?N.apply(this,arguments):N,j=S.invert(b),M=typeof I=="function"?I.apply(this,arguments):I;return n(_(g(S,M),b,j),C,i)},N,O)},p.translateBy=function(y,I,N,O){p.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,O)},p.translateTo=function(y,I,N,O,C){p.transform(y,function(){var S=t.apply(this,arguments),b=this.__zoom,j=O==null?w(S):typeof O=="function"?O.apply(this,arguments):O;return n(hn.translate(j[0],j[1]).scale(b.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),S,i)},O,C)};function g(y,I){return I=Math.max(o[0],Math.min(o[1],I)),I===y.k?y:new fn(I,y.x,y.y)}function _(y,I,N){var O=I[0]-N[0]*y.k,C=I[1]-N[1]*y.k;return O===y.x&&C===y.y?y:new fn(y.k,O,C)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function P(y,I,N,O){y.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var C=this,S=arguments,b=A(C,S).event(O),j=t.apply(C,S),M=N==null?w(j):typeof N=="function"?N.apply(C,S):N,K=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=C.__zoom,ee=typeof I=="function"?I.apply(C,S):I,te=a(Y.invert(M).concat(K/Y.k),ee.invert(M).concat(K/ee.k));return function(pe){if(pe===1)pe=ee;else{var V=te(pe),me=K/V[2];pe=new fn(me,M[0]-V[0]*me,M[1]-V[1]*me)}b.zoom(null,pe)}})}function A(y,I,N){return!N&&y.__zooming||new R(y,I)}function R(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}R.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=bt(this.that).datum();u.call(y,this.that,new RE(y,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:u}),I)}};function $(y,...I){if(!e.apply(this,arguments))return;var N=A(this,I).event(y),O=this.__zoom,C=Math.max(o[0],Math.min(o[1],O.k*Math.pow(2,r.apply(this,arguments)))),S=Ft(y);if(N.wheel)(N.mouse[0][0]!==S[0]||N.mouse[0][1]!==S[1])&&(N.mouse[1]=O.invert(N.mouse[0]=S)),clearTimeout(N.wheel);else{if(O.k===C)return;N.mouse=[S,O.invert(S)],Pi(this),N.start()}ks(y),N.wheel=setTimeout(b,v),N.zoom("mouse",n(_(g(O,C),N.mouse[0],N.mouse[1]),N.extent,i));function b(){N.wheel=null,N.end()}}function B(y,...I){if(f||!e.apply(this,arguments))return;var N=y.currentTarget,O=A(this,I,!0).event(y),C=bt(y.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",K,!0),S=Ft(y,N),b=y.clientX,j=y.clientY;Eg(y.view),Sa(y),O.mouse=[S,this.__zoom.invert(S)],Pi(this),O.start();function M(Y){if(ks(Y),!O.moved){var ee=Y.clientX-b,te=Y.clientY-j;O.moved=ee*ee+te*te>x}O.event(Y).zoom("mouse",n(_(O.that.__zoom,O.mouse[0]=Ft(Y,N),O.mouse[1]),O.extent,i))}function K(Y){C.on("mousemove.zoom mouseup.zoom",null),Ng(Y.view,O.moved),ks(Y),O.event(Y).end()}}function D(y,...I){if(e.apply(this,arguments)){var N=this.__zoom,O=Ft(y.changedTouches?y.changedTouches[0]:y,this),C=N.invert(O),S=N.k*(y.shiftKey?.5:2),b=n(_(g(N,S),O,C),t.apply(this,I),i);ks(y),l>0?bt(this).transition().duration(l).call(P,b,O,y):bt(this).call(p.transform,b,O,y)}}function U(y,...I){if(e.apply(this,arguments)){var N=y.touches,O=N.length,C=A(this,I,y.changedTouches.length===O).event(y),S,b,j,M;for(Sa(y),b=0;b"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Fg=xn.error001();function be(e,t){const n=E.useContext(Bl);if(n===null)throw new Error(Fg);return cg(n,e,t)}const Xe=()=>{const e=E.useContext(Bl);if(e===null)throw new Error(Fg);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},FE=e=>e.userSelectionActive?"none":"all";function nd({position:e,children:t,className:n,style:r,...s}){const o=be(FE),i=`${e}`.split("-");return G.createElement("div",{className:rt(["react-flow__panel",n,...i]),style:{...r,pointerEvents:o},...s},t)}function zE({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:G.createElement(nd,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},G.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const DE=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:o={},labelBgPadding:i=[2,4],labelBgBorderRadius:l=2,children:a,className:u,...c})=>{const d=E.useRef(null),[f,m]=E.useState({x:0,y:0,width:0,height:0}),v=rt(["react-flow__edge-textwrapper",u]);return E.useEffect(()=>{if(d.current){const x=d.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:G.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:v,visibility:f.width?"visible":"hidden",...c},s&&G.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:o,rx:l,ry:l}),G.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r},n),a)};var UE=E.memo(DE);const rd=e=>({width:e.offsetWidth,height:e.offsetHeight}),hs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),sd=(e={x:0,y:0},t)=>({x:hs(e.x,t[0][0],t[1][0]),y:hs(e.y,t[0][1],t[1][1])}),rp=(e,t,n)=>en?-hs(Math.abs(e-n),1,50)/50:0,zg=(e,t)=>{const n=rp(e.x,35,t.width-35)*20,r=rp(e.y,35,t.height-35)*20;return[n,r]},Dg=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Ug=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),So=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Hg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),sp=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),HE=(e,t)=>Hg(Ug(So(e),So(t))),Uu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},WE=e=>Rt(e.width)&&Rt(e.height)&&Rt(e.x)&&Rt(e.y),Rt=e=>!isNaN(e)&&isFinite(e),Ue=Symbol.for("internals"),Wg=["Enter"," ","Escape"],VE=(e,t)=>{},GE=e=>"nativeEvent"in e;function Hu(e){var s,o;const t=GE(e)?e.nativeEvent:e,n=((o=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Vg=e=>"clientX"in e,Hn=(e,t)=>{var o,i;const n=Vg(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},dl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Ro=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m=20})=>G.createElement(G.Fragment,null,G.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),m&&G.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),s&&Rt(n)&&Rt(r)?G.createElement(UE,{x:n,y:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u}):null);Ro.displayName="BaseEdge";function Ps(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(o=>o.id===e);s&&n(r,{...s})}}function Gg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n{const[T,p,g]=Kg({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o});return G.createElement(Ro,{path:T,labelX:p,labelY:g,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,interactionWidth:x})});od.displayName="SimpleBezierEdge";const ip={[ie.Left]:{x:-1,y:0},[ie.Right]:{x:1,y:0},[ie.Top]:{x:0,y:-1},[ie.Bottom]:{x:0,y:1}},YE=({source:e,sourcePosition:t=ie.Bottom,target:n})=>t===ie.Left||t===ie.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function KE({source:e,sourcePosition:t=ie.Bottom,target:n,targetPosition:r=ie.Top,center:s,offset:o}){const i=ip[t],l=ip[r],a={x:e.x+i.x*o,y:e.y+i.y*o},u={x:n.x+l.x*o,y:n.y+l.y*o},c=YE({source:a,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let m=[],v,x;const T={x:0,y:0},p={x:0,y:0},[g,_,w,P]=Gg({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(i[d]*l[d]===-1){v=s.x??g,x=s.y??_;const R=[{x:v,y:a.y},{x:v,y:u.y}],$=[{x:a.x,y:x},{x:u.x,y:x}];i[d]===f?m=d==="x"?R:$:m=d==="x"?$:R}else{const R=[{x:a.x,y:u.y}],$=[{x:u.x,y:a.y}];if(d==="x"?m=i.x===f?$:R:m=i.y===f?R:$,t===r){const z=Math.abs(e[d]-n[d]);if(z<=o){const y=Math.min(o-1,o-z);i[d]===f?T[d]=(a[d]>e[d]?-1:1)*y:p[d]=(u[d]>n[d]?-1:1)*y}}if(t!==r){const z=d==="x"?"y":"x",y=i[d]===l[z],I=a[z]>u[z],N=a[z]=Q?(v=(B.x+D.x)/2,x=m[0].y):(v=m[0].x,x=(B.y+D.y)/2)}return[[e,{x:a.x+T.x,y:a.y+T.y},...m,{x:u.x+p.x,y:u.y+p.y},n],v,x,w,P]}function XE(e,t,n,r){const s=Math.min(lp(e,t)/2,lp(t,n)/2,r),{x:o,y:i}=t;if(e.x===o&&o===n.x||e.y===i&&i===n.y)return`L${o} ${i}`;if(e.y===i){const u=e.x{let _="";return g>0&&g{const[p,g,_]=Wu({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return G.createElement(Ro,{path:p,labelX:g,labelY:_,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:m,markerStart:v,interactionWidth:T})});Fl.displayName="SmoothStepEdge";const id=E.memo(e=>{var t;return G.createElement(Fl,{...e,pathOptions:E.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});id.displayName="StepEdge";function QE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,i,l]=Gg({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,i,l]}const ld=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m})=>{const[v,x,T]=QE({sourceX:e,sourceY:t,targetX:n,targetY:r});return G.createElement(Ro,{path:v,labelX:x,labelY:T,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m})});ld.displayName="StraightEdge";function ri(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ap({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case ie.Left:return[t-ri(t-r,o),n];case ie.Right:return[t+ri(r-t,o),n];case ie.Top:return[t,n-ri(n-s,o)];case ie.Bottom:return[t,n+ri(s-n,o)]}}function Xg({sourceX:e,sourceY:t,sourcePosition:n=ie.Bottom,targetX:r,targetY:s,targetPosition:o=ie.Top,curvature:i=.25}){const[l,a]=ap({pos:n,x1:e,y1:t,x2:r,y2:s,c:i}),[u,c]=ap({pos:o,x1:r,y1:s,x2:e,y2:t,c:i}),[d,f,m,v]=Yg({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:a,targetControlX:u,targetControlY:c});return[`M${e},${t} C${l},${a} ${u},${c} ${r},${s}`,d,f,m,v]}const fl=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=ie.Bottom,targetPosition:o=ie.Top,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,pathOptions:x,interactionWidth:T})=>{const[p,g,_]=Xg({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o,curvature:x==null?void 0:x.curvature});return G.createElement(Ro,{path:p,labelX:g,labelY:_,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,interactionWidth:T})});fl.displayName="BezierEdge";const ad=E.createContext(null),ZE=ad.Provider;ad.Consumer;const qE=()=>E.useContext(ad),JE=e=>"id"in e&&"source"in e&&"target"in e,eN=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Vu=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,tN=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),nN=(e,t)=>{if(!e.source||!e.target)return t;let n;return JE(e)?n={...e}:n={...e,id:eN(e)},tN(n,t)?t:t.concat(n)},Gu=({x:e,y:t},[n,r,s],o,[i,l])=>{const a={x:(e-n)/s,y:(t-r)/s};return o?{x:i*Math.round(a.x/i),y:l*Math.round(a.y/l)}:a},Qg=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),dr=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],s={x:e.position.x-n,y:e.position.y-r};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:s}},zl=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const{x:o,y:i}=dr(s,t).positionAbsolute;return Ug(r,So({x:o,y:i,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hg(n)},Zg=(e,t,[n,r,s]=[0,0,1],o=!1,i=!1,l=[0,0])=>{const a={x:(t.x-n)/s,y:(t.y-r)/s,width:t.width/s,height:t.height/s},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:m=!0,hidden:v=!1}=c;if(i&&!m||v)return!1;const{positionAbsolute:x}=dr(c,l),T={x:x.x,y:x.y,width:d||0,height:f||0},p=Uu(a,T),g=typeof d>"u"||typeof f>"u"||d===null||f===null,_=o&&p>0,w=(d||0)*(f||0);(g||_||p>=w||c.dragging)&&u.push(c)}),u},qg=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},Jg=(e,t,n,r,s,o=.1)=>{const i=t/(e.width*(1+o)),l=n/(e.height*(1+o)),a=Math.min(i,l),u=hs(a,r,s),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,m=n/2-d*u;return{x:f,y:m,zoom:u}},tr=(e,t=0)=>e.transition().duration(t);function up(e,t,n,r){return(t[n]||[]).reduce((s,o)=>{var i,l;return`${e.id}-${o.id}-${n}`!==r&&s.push({id:o.id||null,type:n,nodeId:e.id,x:(((i=e.positionAbsolute)==null?void 0:i.x)??0)+o.x+o.width/2,y:(((l=e.positionAbsolute)==null?void 0:l.y)??0)+o.y+o.height/2}),s},[])}function rN(e,t,n,r,s,o){const{x:i,y:l}=Hn(e),u=t.elementsFromPoint(i,l).find(v=>v.classList.contains("react-flow__handle"));if(u){const v=u.getAttribute("data-nodeid");if(v){const x=ud(void 0,u),T=u.getAttribute("data-handleid"),p=o({nodeId:v,id:T,type:x});if(p){const g=s.find(_=>_.nodeId===v&&_.type===x&&_.id===T);return{handle:{id:T,type:x,nodeId:v,x:(g==null?void 0:g.x)||n.x,y:(g==null?void 0:g.y)||n.y},validHandleResult:p}}}}let c=[],d=1/0;if(s.forEach(v=>{const x=Math.sqrt((v.x-n.x)**2+(v.y-n.y)**2);if(x<=r){const T=o(v);x<=d&&(xv.isValid),m=c.some(({handle:v})=>v.type==="target");return c.find(({handle:v,validHandleResult:x})=>m?v.type==="target":f?x.isValid:!0)||c[0]}const sN={source:null,target:null,sourceHandle:null,targetHandle:null},ey=()=>({handleDomNode:null,isValid:!1,connection:sN,endHandle:null});function ty(e,t,n,r,s,o,i){const l=s==="target",a=i.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...ey(),handleDomNode:a};if(a){const c=ud(void 0,a),d=a.getAttribute("data-nodeid"),f=a.getAttribute("data-handleid"),m=a.classList.contains("connectable"),v=a.classList.contains("connectableend"),x={source:l?d:n,sourceHandle:l?f:r,target:l?n:d,targetHandle:l?r:f};u.connection=x,m&&v&&(t===vr.Strict?l&&c==="source"||!l&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(x))}return u}function oN({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,o)=>{if(o[Ue]){const{handleBounds:i}=o[Ue];let l=[],a=[];i&&(l=up(o,i,"source",`${t}-${n}-${r}`),a=up(o,i,"target",`${t}-${n}-${r}`)),s.push(...l,...a)}return s},[])}function ud(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ea(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iN(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function ny({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:o,setState:i,isValidConnection:l,edgeUpdaterType:a,onReconnectEnd:u}){const c=Dg(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:m,connectionRadius:v,onConnectStart:x,panBy:T,getNodes:p,cancelConnection:g}=o();let _=0,w;const{x:P,y:A}=Hn(e),R=c==null?void 0:c.elementFromPoint(P,A),$=ud(a,R),B=f==null?void 0:f.getBoundingClientRect();if(!B||!$)return;let D,U=Hn(e,B),Q=!1,z=null,y=!1,I=null;const N=oN({nodes:p(),nodeId:n,handleId:t,handleType:$}),O=()=>{if(!m)return;const[b,j]=zg(U,B);T({x:b,y:j}),_=requestAnimationFrame(O)};i({connectionPosition:U,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:$,connectionStartHandle:{nodeId:n,handleId:t,type:$},connectionEndHandle:null}),x==null||x(e,{nodeId:n,handleId:t,handleType:$});function C(b){const{transform:j}=o();U=Hn(b,B);const{handle:M,validHandleResult:K}=rN(b,c,Gu(U,j,!1,[1,1]),v,N,Y=>ty(Y,d,n,t,s?"target":"source",l,c));if(w=M,Q||(O(),Q=!0),I=K.handleDomNode,z=K.connection,y=K.isValid,i({connectionPosition:w&&y?Qg({x:w.x,y:w.y},j):U,connectionStatus:iN(!!w,y),connectionEndHandle:K.endHandle}),!w&&!y&&!I)return Ea(D);z.source!==z.target&&I&&(Ea(D),D=I,I.classList.add("connecting","react-flow__handle-connecting"),I.classList.toggle("valid",y),I.classList.toggle("react-flow__handle-valid",y))}function S(b){var j,M;(w||I)&&z&&y&&(r==null||r(z)),(M=(j=o()).onConnectEnd)==null||M.call(j,b),a&&(u==null||u(b)),Ea(D),g(),cancelAnimationFrame(_),Q=!1,y=!1,z=null,I=null,c.removeEventListener("mousemove",C),c.removeEventListener("mouseup",S),c.removeEventListener("touchmove",C),c.removeEventListener("touchend",S)}c.addEventListener("mousemove",C),c.addEventListener("mouseup",S),c.addEventListener("touchmove",C),c.addEventListener("touchend",S)}const cp=()=>!0,lN=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),aN=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:o,connectionClickStartHandle:i}=r;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n}},ry=E.forwardRef(({type:e="source",position:t=ie.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:i,onConnect:l,children:a,className:u,onMouseDown:c,onTouchStart:d,...f},m)=>{var B,D;const v=i||null,x=e==="target",T=Xe(),p=qE(),{connectOnClick:g,noPanClassName:_}=be(lN,Je),{connecting:w,clickConnecting:P}=be(aN(p,v,e),Je);p||(D=(B=T.getState()).onError)==null||D.call(B,"010",xn.error010());const A=U=>{const{defaultEdgeOptions:Q,onConnect:z,hasDefaultEdges:y}=T.getState(),I={...Q,...U};if(y){const{edges:N,setEdges:O}=T.getState();O(nN(I,N))}z==null||z(I),l==null||l(I)},R=U=>{if(!p)return;const Q=Vg(U);s&&(Q&&U.button===0||!Q)&&ny({event:U,handleId:v,nodeId:p,onConnect:A,isTarget:x,getState:T.getState,setState:T.setState,isValidConnection:n||T.getState().isValidConnection||cp}),Q?c==null||c(U):d==null||d(U)},$=U=>{const{onClickConnectStart:Q,onClickConnectEnd:z,connectionClickStartHandle:y,connectionMode:I,isValidConnection:N}=T.getState();if(!p||!y&&!s)return;if(!y){Q==null||Q(U,{nodeId:p,handleId:v,handleType:e}),T.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:v}});return}const O=Dg(U.target),C=n||N||cp,{connection:S,isValid:b}=ty({nodeId:p,id:v,type:e},I,y.nodeId,y.handleId||null,y.type,C,O);b&&A(S),z==null||z(U),T.setState({connectionClickStartHandle:null})};return G.createElement("div",{"data-handleid":v,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${v}-${e}`,className:rt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:o,connecting:P,connectionindicator:r&&(s&&!w||o&&w)}]),onMouseDown:R,onTouchStart:R,onClick:g?$:void 0,ref:m,...f},a)});ry.displayName="Handle";var pl=E.memo(ry);const sy=({data:e,isConnectable:t,targetPosition:n=ie.Top,sourcePosition:r=ie.Bottom})=>G.createElement(G.Fragment,null,G.createElement(pl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,G.createElement(pl,{type:"source",position:r,isConnectable:t}));sy.displayName="DefaultNode";var Yu=E.memo(sy);const oy=({data:e,isConnectable:t,sourcePosition:n=ie.Bottom})=>G.createElement(G.Fragment,null,e==null?void 0:e.label,G.createElement(pl,{type:"source",position:n,isConnectable:t}));oy.displayName="InputNode";var iy=E.memo(oy);const ly=({data:e,isConnectable:t,targetPosition:n=ie.Top})=>G.createElement(G.Fragment,null,G.createElement(pl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);ly.displayName="OutputNode";var ay=E.memo(ly);const cd=()=>null;cd.displayName="GroupNode";const uN=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),si=e=>e.id;function cN(e,t){return Je(e.selectedNodes.map(si),t.selectedNodes.map(si))&&Je(e.selectedEdges.map(si),t.selectedEdges.map(si))}const uy=E.memo(({onSelectionChange:e})=>{const t=Xe(),{selectedNodes:n,selectedEdges:r}=be(uN,cN);return E.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(o=>o(s))},[n,r,e]),null});uy.displayName="SelectionListener";const dN=e=>!!e.onSelectionChange;function fN({onSelectionChange:e}){const t=be(dN);return e||t?G.createElement(uy,{onSelectionChange:e}):null}const pN=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Nr(e,t){E.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function _e(e,t,n){E.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const hN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:o,onConnectEnd:i,onClickConnectStart:l,onClickConnectEnd:a,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:v,minZoom:x,maxZoom:T,nodeExtent:p,onNodesChange:g,onEdgesChange:_,elementsSelectable:w,connectionMode:P,snapGrid:A,snapToGrid:R,translateExtent:$,connectOnClick:B,defaultEdgeOptions:D,fitView:U,fitViewOptions:Q,onNodesDelete:z,onEdgesDelete:y,onNodeDrag:I,onNodeDragStart:N,onNodeDragStop:O,onSelectionDrag:C,onSelectionDragStart:S,onSelectionDragStop:b,noPanClassName:j,nodeOrigin:M,rfId:K,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:te,connectionRadius:pe,isValidConnection:V,nodeDragThreshold:me})=>{const{setNodes:he,setEdges:ve,setDefaultNodesAndEdges:Se,setMinZoom:k,setMaxZoom:L,setTranslateExtent:ne,setNodeExtent:le,reset:J}=be(pN,Je),q=Xe();return E.useEffect(()=>{const H=r==null?void 0:r.map(oe=>({...oe,...D}));return Se(n,H),()=>{J()}},[]),_e("defaultEdgeOptions",D,q.setState),_e("connectionMode",P,q.setState),_e("onConnect",s,q.setState),_e("onConnectStart",o,q.setState),_e("onConnectEnd",i,q.setState),_e("onClickConnectStart",l,q.setState),_e("onClickConnectEnd",a,q.setState),_e("nodesDraggable",u,q.setState),_e("nodesConnectable",c,q.setState),_e("nodesFocusable",d,q.setState),_e("edgesFocusable",f,q.setState),_e("edgesUpdatable",m,q.setState),_e("elementsSelectable",w,q.setState),_e("elevateNodesOnSelect",v,q.setState),_e("snapToGrid",R,q.setState),_e("snapGrid",A,q.setState),_e("onNodesChange",g,q.setState),_e("onEdgesChange",_,q.setState),_e("connectOnClick",B,q.setState),_e("fitViewOnInit",U,q.setState),_e("fitViewOnInitOptions",Q,q.setState),_e("onNodesDelete",z,q.setState),_e("onEdgesDelete",y,q.setState),_e("onNodeDrag",I,q.setState),_e("onNodeDragStart",N,q.setState),_e("onNodeDragStop",O,q.setState),_e("onSelectionDrag",C,q.setState),_e("onSelectionDragStart",S,q.setState),_e("onSelectionDragStop",b,q.setState),_e("noPanClassName",j,q.setState),_e("nodeOrigin",M,q.setState),_e("rfId",K,q.setState),_e("autoPanOnConnect",Y,q.setState),_e("autoPanOnNodeDrag",ee,q.setState),_e("onError",te,q.setState),_e("connectionRadius",pe,q.setState),_e("isValidConnection",V,q.setState),_e("nodeDragThreshold",me,q.setState),Nr(e,he),Nr(t,ve),Nr(x,k),Nr(T,L),Nr($,ne),Nr(p,le),null},dp={display:"none"},mN={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},cy="react-flow__node-desc",dy="react-flow__edge-desc",gN="react-flow__aria-live",yN=e=>e.ariaLiveMessage;function _N({rfId:e}){const t=be(yN);return G.createElement("div",{id:`${gN}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:mN},t)}function vN({rfId:e,disableKeyboardA11y:t}){return G.createElement(G.Fragment,null,G.createElement("div",{id:`${cy}-${e}`,style:dp},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),G.createElement("div",{id:`${dy}-${e}`,style:dp},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&G.createElement(_N,{rfId:e}))}var No=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=E.useState(!1),s=E.useRef(!1),o=E.useRef(new Set([])),[i,l]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return E.useEffect(()=>{const a=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||a;if(e!==null){const c=m=>{if(s.current=m.ctrlKey||m.metaKey||m.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&Hu(m))return!1;const x=pp(m.code,l);o.current.add(m[x]),fp(i,o.current,!1)&&(m.preventDefault(),r(!0))},d=m=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&Hu(m))return!1;const x=pp(m.code,l);fp(i,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(m[x]),m.key==="Meta"&&o.current.clear(),s.current=!1},f=()=>{o.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function fp(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function pp(e,t){return t.includes(e)?"code":"key"}function fy(e,t,n,r){var l,a;const s=e.parentNode||e.parentId;if(!s)return n;const o=t.get(s),i=dr(o,r);return fy(o,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((l=o[Ue])==null?void 0:l.z)??0)>(n.z??0)?((a=o[Ue])==null?void 0:a.z)??0:n.z??0},r)}function py(e,t,n){e.forEach(r=>{var o;const s=r.parentNode||r.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||n!=null&&n[r.id]){const{x:i,y:l,z:a}=fy(r,e,{...r.position,z:((o=r[Ue])==null?void 0:o.z)??0},t);r.positionAbsolute={x:i,y:l},r[Ue].z=a,n!=null&&n[r.id]&&(r[Ue].isParent=!0)}})}function Na(e,t,n,r){const s=new Map,o={},i=r?1e3:0;return e.forEach(l=>{var m;const a=(Rt(l.zIndex)?l.zIndex:0)+(l.selected?i:0),u=t.get(l.id),c={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},d=l.parentNode||l.parentId;d&&(o[d]=!0);const f=(u==null?void 0:u.type)&&(u==null?void 0:u.type)!==l.type;Object.defineProperty(c,Ue,{enumerable:!1,value:{handleBounds:f||(m=u==null?void 0:u[Ue])==null?void 0:m.handleBounds,z:a}}),s.set(l.id,c)}),py(s,n,o),s}function hy(e,t={}){const{getNodes:n,width:r,height:s,minZoom:o,maxZoom:i,d3Zoom:l,d3Selection:a,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(l&&a&&(f||!t.initial)){const v=n().filter(T=>{var g;const p=t.includeHiddenNodes?T.width&&T.height:!T.hidden;return(g=t.nodes)!=null&&g.length?p&&t.nodes.some(_=>_.id===T.id):p}),x=v.every(T=>T.width&&T.height);if(v.length>0&&x){const T=zl(v,d),{x:p,y:g,zoom:_}=Jg(T,r,s,t.minZoom??o,t.maxZoom??i,t.padding??.1),w=hn.translate(p,g).scale(_);return typeof t.duration=="number"&&t.duration>0?l.transform(tr(a,t.duration),w):l.transform(a,w),!0}}return!1}function xN(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Ue]:r[Ue],selected:n.selected})}),new Map(t)}function wN(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function oi({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:o,onNodesChange:i,onEdgesChange:l,hasDefaultNodes:a,hasDefaultEdges:u}=n();e!=null&&e.length&&(a&&r({nodeInternals:xN(e,s)}),i==null||i(e)),t!=null&&t.length&&(u&&r({edges:wN(t,o)}),l==null||l(t))}const Tr=()=>{},SN={zoomIn:Tr,zoomOut:Tr,zoomTo:Tr,getZoom:()=>1,setViewport:Tr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Tr,fitBounds:Tr,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},EN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),NN=()=>{const e=Xe(),{d3Zoom:t,d3Selection:n}=be(EN,Je);return E.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(tr(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(tr(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,o)=>t.scaleTo(tr(n,o==null?void 0:o.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,o)=>{const[i,l,a]=e.getState().transform,u=hn.translate(s.x??i,s.y??l).scale(s.zoom??a);t.transform(tr(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[s,o,i]=e.getState().transform;return{x:s,y:o,zoom:i}},fitView:s=>hy(e.getState,s),setCenter:(s,o,i)=>{const{width:l,height:a,maxZoom:u}=e.getState(),c=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:u,d=l/2-s*c,f=a/2-o*c,m=hn.translate(d,f).scale(c);t.transform(tr(n,i==null?void 0:i.duration),m)},fitBounds:(s,o)=>{const{width:i,height:l,minZoom:a,maxZoom:u}=e.getState(),{x:c,y:d,zoom:f}=Jg(s,i,l,a,u,(o==null?void 0:o.padding)??.1),m=hn.translate(c,d).scale(f);t.transform(tr(n,o==null?void 0:o.duration),m)},project:s=>{const{transform:o,snapToGrid:i,snapGrid:l}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Gu(s,o,i,l)},screenToFlowPosition:s=>{const{transform:o,snapToGrid:i,snapGrid:l,domNode:a}=e.getState();if(!a)return s;const{x:u,y:c}=a.getBoundingClientRect(),d={x:s.x-u,y:s.y-c};return Gu(d,o,i,l)},flowToScreenPosition:s=>{const{transform:o,domNode:i}=e.getState();if(!i)return s;const{x:l,y:a}=i.getBoundingClientRect(),u=Qg(s,o);return{x:u.x+l,y:u.y+a}},viewportInitialized:!0}:SN,[t,n])};function dd(){const e=NN(),t=Xe(),n=E.useCallback(()=>t.getState().getNodes().map(x=>({...x})),[]),r=E.useCallback(x=>t.getState().nodeInternals.get(x),[]),s=E.useCallback(()=>{const{edges:x=[]}=t.getState();return x.map(T=>({...T}))},[]),o=E.useCallback(x=>{const{edges:T=[]}=t.getState();return T.find(p=>p.id===x)},[]),i=E.useCallback(x=>{const{getNodes:T,setNodes:p,hasDefaultNodes:g,onNodesChange:_}=t.getState(),w=T(),P=typeof x=="function"?x(w):x;if(g)p(P);else if(_){const A=P.length===0?w.map(R=>({type:"remove",id:R.id})):P.map(R=>({item:R,type:"reset"}));_(A)}},[]),l=E.useCallback(x=>{const{edges:T=[],setEdges:p,hasDefaultEdges:g,onEdgesChange:_}=t.getState(),w=typeof x=="function"?x(T):x;if(g)p(w);else if(_){const P=w.length===0?T.map(A=>({type:"remove",id:A.id})):w.map(A=>({item:A,type:"reset"}));_(P)}},[]),a=E.useCallback(x=>{const T=Array.isArray(x)?x:[x],{getNodes:p,setNodes:g,hasDefaultNodes:_,onNodesChange:w}=t.getState();if(_){const A=[...p(),...T];g(A)}else if(w){const P=T.map(A=>({item:A,type:"add"}));w(P)}},[]),u=E.useCallback(x=>{const T=Array.isArray(x)?x:[x],{edges:p=[],setEdges:g,hasDefaultEdges:_,onEdgesChange:w}=t.getState();if(_)g([...p,...T]);else if(w){const P=T.map(A=>({item:A,type:"add"}));w(P)}},[]),c=E.useCallback(()=>{const{getNodes:x,edges:T=[],transform:p}=t.getState(),[g,_,w]=p;return{nodes:x().map(P=>({...P})),edges:T.map(P=>({...P})),viewport:{x:g,y:_,zoom:w}}},[]),d=E.useCallback(({nodes:x,edges:T})=>{const{nodeInternals:p,getNodes:g,edges:_,hasDefaultNodes:w,hasDefaultEdges:P,onNodesDelete:A,onEdgesDelete:R,onNodesChange:$,onEdgesChange:B}=t.getState(),D=(x||[]).map(I=>I.id),U=(T||[]).map(I=>I.id),Q=g().reduce((I,N)=>{const O=N.parentNode||N.parentId,C=!D.includes(N.id)&&O&&I.find(b=>b.id===O);return(typeof N.deletable=="boolean"?N.deletable:!0)&&(D.includes(N.id)||C)&&I.push(N),I},[]),z=_.filter(I=>typeof I.deletable=="boolean"?I.deletable:!0),y=z.filter(I=>U.includes(I.id));if(Q||y){const I=qg(Q,z),N=[...y,...I],O=N.reduce((C,S)=>(C.includes(S.id)||C.push(S.id),C),[]);if((P||w)&&(P&&t.setState({edges:_.filter(C=>!O.includes(C.id))}),w&&(Q.forEach(C=>{p.delete(C.id)}),t.setState({nodeInternals:new Map(p)}))),O.length>0&&(R==null||R(N),B&&B(O.map(C=>({id:C,type:"remove"})))),Q.length>0&&(A==null||A(Q),$)){const C=Q.map(S=>({id:S.id,type:"remove"}));$(C)}}},[]),f=E.useCallback(x=>{const T=WE(x),p=T?null:t.getState().nodeInternals.get(x.id);return!T&&!p?[null,null,T]:[T?x:sp(p),p,T]},[]),m=E.useCallback((x,T=!0,p)=>{const[g,_,w]=f(x);return g?(p||t.getState().getNodes()).filter(P=>{if(!w&&(P.id===_.id||!P.positionAbsolute))return!1;const A=sp(P),R=Uu(A,g);return T&&R>0||R>=g.width*g.height}):[]},[]),v=E.useCallback((x,T,p=!0)=>{const[g]=f(x);if(!g)return!1;const _=Uu(g,T);return p&&_>0||_>=g.width*g.height},[]);return E.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:o,setNodes:i,setEdges:l,addNodes:a,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:m,isNodeIntersecting:v}),[e,n,r,s,o,i,l,a,u,c,d,m,v])}const TN={actInsideInputWithModifier:!1};var IN=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Xe(),{deleteElements:r}=dd(),s=No(e,TN),o=No(t);E.useEffect(()=>{if(s){const{edges:i,getNodes:l}=n.getState(),a=l().filter(c=>c.selected),u=i.filter(c=>c.selected);r({nodes:a,edges:u}),n.setState({nodesSelectionActive:!1})}},[s]),E.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function CN(e){const t=Xe();E.useEffect(()=>{let n;const r=()=>{var o,i;if(!e.current)return;const s=rd(e.current);(s.height===0||s.width===0)&&((i=(o=t.getState()).onError)==null||i.call(o,"004",xn.error004())),t.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const fd={position:"absolute",width:"100%",height:"100%",top:0,left:0},kN=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,ii=e=>({x:e.x,y:e.y,zoom:e.k}),Ir=(e,t)=>e.target.closest(`.${t}`),hp=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mp=e=>{const t=e.ctrlKey&&dl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},PN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),bN=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:o=!0,panOnScroll:i=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=lr.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:m,minZoom:v,maxZoom:x,zoomActivationKeyCode:T,preventScrolling:p=!0,children:g,noWheelClassName:_,noPanClassName:w})=>{const P=E.useRef(),A=Xe(),R=E.useRef(!1),$=E.useRef(!1),B=E.useRef(null),D=E.useRef({x:0,y:0,zoom:0}),{d3Zoom:U,d3Selection:Q,d3ZoomHandler:z,userSelectionActive:y}=be(PN,Je),I=No(T),N=E.useRef(0),O=E.useRef(!1),C=E.useRef();return CN(B),E.useEffect(()=>{if(B.current){const S=B.current.getBoundingClientRect(),b=Bg().scaleExtent([v,x]).translateExtent(m),j=bt(B.current).call(b),M=hn.translate(f.x,f.y).scale(hs(f.zoom,v,x)),K=[[0,0],[S.width,S.height]],Y=b.constrain()(M,K,m);b.transform(j,Y),b.wheelDelta(mp),A.setState({d3Zoom:b,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:B.current.closest(".react-flow")})}},[]),E.useEffect(()=>{Q&&U&&(i&&!I&&!y?Q.on("wheel.zoom",S=>{if(Ir(S,_))return!1;S.preventDefault(),S.stopImmediatePropagation();const b=Q.property("__zoom").k||1;if(S.ctrlKey&&o){const V=Ft(S),me=mp(S),he=b*Math.pow(2,me);U.scaleTo(Q,he,V,S);return}const j=S.deltaMode===1?20:1;let M=a===lr.Vertical?0:S.deltaX*j,K=a===lr.Horizontal?0:S.deltaY*j;!dl()&&S.shiftKey&&a!==lr.Vertical&&(M=S.deltaY*j,K=0),U.translateBy(Q,-(M/b)*l,-(K/b)*l,{internal:!0});const Y=ii(Q.property("__zoom")),{onViewportChangeStart:ee,onViewportChange:te,onViewportChangeEnd:pe}=A.getState();clearTimeout(C.current),O.current||(O.current=!0,t==null||t(S,Y),ee==null||ee(Y)),O.current&&(e==null||e(S,Y),te==null||te(Y),C.current=setTimeout(()=>{n==null||n(S,Y),pe==null||pe(Y),O.current=!1},150))},{passive:!1}):typeof z<"u"&&Q.on("wheel.zoom",function(S,b){if(!p&&S.type==="wheel"&&!S.ctrlKey||Ir(S,_))return null;S.preventDefault(),z.call(this,S,b)},{passive:!1}))},[y,i,a,Q,U,z,I,o,p,_,t,e,n]),E.useEffect(()=>{U&&U.on("start",S=>{var M,K;if(!S.sourceEvent||S.sourceEvent.internal)return null;N.current=(M=S.sourceEvent)==null?void 0:M.button;const{onViewportChangeStart:b}=A.getState(),j=ii(S.transform);R.current=!0,D.current=j,((K=S.sourceEvent)==null?void 0:K.type)==="mousedown"&&A.setState({paneDragging:!0}),b==null||b(j),t==null||t(S.sourceEvent,j)})},[U,t]),E.useEffect(()=>{U&&(y&&!R.current?U.on("zoom",null):y||U.on("zoom",S=>{var j;const{onViewportChange:b}=A.getState();if(A.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),$.current=!!(r&&hp(d,N.current??0)),(e||b)&&!((j=S.sourceEvent)!=null&&j.internal)){const M=ii(S.transform);b==null||b(M),e==null||e(S.sourceEvent,M)}}))},[y,U,e,d,r]),E.useEffect(()=>{U&&U.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:b}=A.getState();if(R.current=!1,A.setState({paneDragging:!1}),r&&hp(d,N.current??0)&&!$.current&&r(S.sourceEvent),$.current=!1,(n||b)&&kN(D.current,S.transform)){const j=ii(S.transform);D.current=j,clearTimeout(P.current),P.current=setTimeout(()=>{b==null||b(j),n==null||n(S.sourceEvent,j)},i?150:0)}})},[U,i,d,n,r]),E.useEffect(()=>{U&&U.filter(S=>{const b=I||s,j=o&&S.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&S.button===1&&S.type==="mousedown"&&(Ir(S,"react-flow__node")||Ir(S,"react-flow__edge")))return!0;if(!d&&!b&&!i&&!u&&!o||y||!u&&S.type==="dblclick"||Ir(S,_)&&S.type==="wheel"||Ir(S,w)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!I)||!o&&S.ctrlKey&&S.type==="wheel"||!b&&!i&&!j&&S.type==="wheel"||!d&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(d)&&!d.includes(S.button)&&S.type==="mousedown")return!1;const M=Array.isArray(d)&&d.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&M})},[y,U,s,o,i,u,d,c,I]),G.createElement("div",{className:"react-flow__renderer",ref:B,style:fd},g)},AN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function RN(){const{userSelectionActive:e,userSelectionRect:t}=be(AN,Je);return e&&t?G.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function gp(e,t){const n=t.parentNode||t.parentId,r=e.find(s=>s.id===n);if(r){const s=t.position.x+t.width-r.width,o=t.position.y+t.height-r.height;if(s>0||o>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),o>0&&(r.style.height+=o),t.position.x<0){const i=Math.abs(t.position.x);r.position.x=r.position.x-i,r.style.width+=i,t.position.x=0}if(t.position.y<0){const i=Math.abs(t.position.y);r.position.y=r.position.y-i,r.style.height+=i,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function MN(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,s)=>{const o=e.filter(l=>l.id===s.id);if(o.length===0)return r.push(s),r;const i={...s};for(const l of o)if(l)switch(l.type){case"select":{i.selected=l.selected;break}case"position":{typeof l.position<"u"&&(i.position=l.position),typeof l.positionAbsolute<"u"&&(i.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(i.dragging=l.dragging),i.expandParent&&gp(r,i);break}case"dimensions":{typeof l.dimensions<"u"&&(i.width=l.dimensions.width,i.height=l.dimensions.height),typeof l.updateStyle<"u"&&(i.style={...i.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(i.resizing=l.resizing),i.expandParent&&gp(r,i);break}case"remove":return r}return r.push(i),r},n)}function ON(e,t){return MN(e,t)}const Pn=(e,t)=>({id:e,type:"select",selected:t});function Vr(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Pn(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Pn(r.id,!1))),n},[])}const Ta=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},LN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),my=E.memo(({isSelecting:e,selectionMode:t=Eo.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:o,onPaneContextMenu:i,onPaneScroll:l,onPaneMouseEnter:a,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=E.useRef(null),m=Xe(),v=E.useRef(0),x=E.useRef(0),T=E.useRef(),{userSelectionActive:p,elementsSelectable:g,dragging:_}=be(LN,Je),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),v.current=0,x.current=0},P=z=>{o==null||o(z),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},A=z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){z.preventDefault();return}i==null||i(z)},R=l?z=>l(z):void 0,$=z=>{const{resetSelectedElements:y,domNode:I}=m.getState();if(T.current=I==null?void 0:I.getBoundingClientRect(),!g||!e||z.button!==0||z.target!==f.current||!T.current)return;const{x:N,y:O}=Hn(z,T.current);y(),m.setState({userSelectionRect:{width:0,height:0,startX:N,startY:O,x:N,y:O}}),r==null||r(z)},B=z=>{const{userSelectionRect:y,nodeInternals:I,edges:N,transform:O,onNodesChange:C,onEdgesChange:S,nodeOrigin:b,getNodes:j}=m.getState();if(!e||!T.current||!y)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const M=Hn(z,T.current),K=y.startX??0,Y=y.startY??0,ee={...y,x:M.xhe.id),me=pe.map(he=>he.id);if(v.current!==me.length){v.current=me.length;const he=Vr(te,me);he.length&&(C==null||C(he))}if(x.current!==V.length){x.current=V.length;const he=Vr(N,V);he.length&&(S==null||S(he))}m.setState({userSelectionRect:ee})},D=z=>{if(z.button!==0)return;const{userSelectionRect:y}=m.getState();!p&&y&&z.target===f.current&&(P==null||P(z)),m.setState({nodesSelectionActive:v.current>0}),w(),s==null||s(z)},U=z=>{p&&(m.setState({nodesSelectionActive:v.current>0}),s==null||s(z)),w()},Q=g&&(e||p);return G.createElement("div",{className:rt(["react-flow__pane",{dragging:_,selection:e}]),onClick:Q?void 0:Ta(P,f),onContextMenu:Ta(A,f),onWheel:Ta(R,f),onMouseEnter:Q?void 0:a,onMouseDown:Q?$:void 0,onMouseMove:Q?B:u,onMouseUp:Q?D:void 0,onMouseLeave:Q?U:c,ref:f,style:fd},d,G.createElement(RN,null))});my.displayName="Pane";function gy(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:gy(r,t):!1}function yp(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function $N(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!gy(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var o,i;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=s.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((i=s.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function jN(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function yy(e,t,n,r,s=[0,0],o){const i=jN(e,e.extent||r);let l=i;const a=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(a&&e.width&&e.height){const d=n.get(a),{x:f,y:m}=dr(d,s).positionAbsolute;l=d&&Rt(f)&&Rt(m)&&Rt(d.width)&&Rt(d.height)?[[f+e.width*s[0],m+e.height*s[1]],[f+d.width-e.width+e.width*s[0],m+d.height-e.height+e.height*s[1]]]:l}else o==null||o("005",xn.error005()),l=i;else if(e.extent&&a&&e.extent!=="parent"){const d=n.get(a),{x:f,y:m}=dr(d,s).positionAbsolute;l=[[e.extent[0][0]+f,e.extent[0][1]+m],[e.extent[1][0]+f,e.extent[1][1]+m]]}let u={x:0,y:0};if(a){const d=n.get(a);u=dr(d,s).positionAbsolute}const c=l&&l!=="parent"?sd(t,l):t;return{position:{x:c.x-u.x,y:c.y-u.y},positionAbsolute:c}}function Ia({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?r.find(s=>s.id===e):r[0],r]}const _p=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const o=Array.from(s),i=t.getBoundingClientRect(),l={x:i.width*r[0],y:i.height*r[1]};return o.map(a=>{const u=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(u.left-i.left-l.x)/n,y:(u.top-i.top-l.y)/n,...rd(a)}})};function bs(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function Ku({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:i,nodeInternals:l,onError:a}=t.getState(),u=l.get(e);if(!u){a==null||a("012",xn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):s([e])}function BN(){const e=Xe();return E.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:o}=e.getState(),i=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,a={x:(i-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:o?s[0]*Math.round(a.x/s[0]):a.x,ySnapped:o?s[1]*Math.round(a.y/s[1]):a.y,...a}},[])}function Ca(e){return(t,n,r)=>e==null?void 0:e(t,r)}function _y({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,selectNodesOnDrag:i}){const l=Xe(),[a,u]=E.useState(!1),c=E.useRef([]),d=E.useRef({x:null,y:null}),f=E.useRef(0),m=E.useRef(null),v=E.useRef({x:0,y:0}),x=E.useRef(null),T=E.useRef(!1),p=E.useRef(!1),g=E.useRef(!1),_=BN();return E.useEffect(()=>{if(e!=null&&e.current){const w=bt(e.current),P=({x:$,y:B})=>{const{nodeInternals:D,onNodeDrag:U,onSelectionDrag:Q,updateNodePositions:z,nodeExtent:y,snapGrid:I,snapToGrid:N,nodeOrigin:O,onError:C}=l.getState();d.current={x:$,y:B};let S=!1,b={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&y){const M=zl(c.current,O);b=So(M)}if(c.current=c.current.map(M=>{const K={x:$-M.distance.x,y:B-M.distance.y};N&&(K.x=I[0]*Math.round(K.x/I[0]),K.y=I[1]*Math.round(K.y/I[1]));const Y=[[y[0][0],y[0][1]],[y[1][0],y[1][1]]];c.current.length>1&&y&&!M.extent&&(Y[0][0]=M.positionAbsolute.x-b.x+y[0][0],Y[1][0]=M.positionAbsolute.x+(M.width??0)-b.x2+y[1][0],Y[0][1]=M.positionAbsolute.y-b.y+y[0][1],Y[1][1]=M.positionAbsolute.y+(M.height??0)-b.y2+y[1][1]);const ee=yy(M,K,D,Y,O,C);return S=S||M.position.x!==ee.position.x||M.position.y!==ee.position.y,M.position=ee.position,M.positionAbsolute=ee.positionAbsolute,M}),!S)return;z(c.current,!0,!0),u(!0);const j=s?U:Ca(Q);if(j&&x.current){const[M,K]=Ia({nodeId:s,dragItems:c.current,nodeInternals:D});j(x.current,M,K)}},A=()=>{if(!m.current)return;const[$,B]=zg(v.current,m.current);if($!==0||B!==0){const{transform:D,panBy:U}=l.getState();d.current.x=(d.current.x??0)-$/D[2],d.current.y=(d.current.y??0)-B/D[2],U({x:$,y:B})&&P(d.current)}f.current=requestAnimationFrame(A)},R=$=>{var O;const{nodeInternals:B,multiSelectionActive:D,nodesDraggable:U,unselectNodesAndEdges:Q,onNodeDragStart:z,onSelectionDragStart:y}=l.getState();p.current=!0;const I=s?z:Ca(y);(!i||!o)&&!D&&s&&((O=B.get(s))!=null&&O.selected||Q()),s&&o&&i&&Ku({id:s,store:l,nodeRef:e});const N=_($);if(d.current=N,c.current=$N(B,U,N,s),I&&c.current){const[C,S]=Ia({nodeId:s,dragItems:c.current,nodeInternals:B});I($.sourceEvent,C,S)}};if(t)w.on(".drag",null);else{const $=Kw().on("start",B=>{const{domNode:D,nodeDragThreshold:U}=l.getState();U===0&&R(B),g.current=!1;const Q=_(B);d.current=Q,m.current=(D==null?void 0:D.getBoundingClientRect())||null,v.current=Hn(B.sourceEvent,m.current)}).on("drag",B=>{var z,y;const D=_(B),{autoPanOnNodeDrag:U,nodeDragThreshold:Q}=l.getState();if(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1&&(g.current=!0),!g.current){if(!T.current&&p.current&&U&&(T.current=!0,A()),!p.current){const I=D.xSnapped-(((z=d==null?void 0:d.current)==null?void 0:z.x)??0),N=D.ySnapped-(((y=d==null?void 0:d.current)==null?void 0:y.y)??0);Math.sqrt(I*I+N*N)>Q&&R(B)}(d.current.x!==D.xSnapped||d.current.y!==D.ySnapped)&&c.current&&p.current&&(x.current=B.sourceEvent,v.current=Hn(B.sourceEvent,m.current),P(D))}}).on("end",B=>{if(!(!p.current||g.current)&&(u(!1),T.current=!1,p.current=!1,cancelAnimationFrame(f.current),c.current)){const{updateNodePositions:D,nodeInternals:U,onNodeDragStop:Q,onSelectionDragStop:z}=l.getState(),y=s?Q:Ca(z);if(D(c.current,!1,!1),y){const[I,N]=Ia({nodeId:s,dragItems:c.current,nodeInternals:U});y(B.sourceEvent,I,N)}}}).filter(B=>{const D=B.target;return!B.button&&(!n||!yp(D,`.${n}`,e))&&(!r||yp(D,r,e))});return w.call($),()=>{w.on(".drag",null)}}}},[e,t,n,r,o,l,s,i,_]),a}function vy(){const e=Xe();return E.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:o,getNodes:i,snapToGrid:l,snapGrid:a,onError:u,nodesDraggable:c}=e.getState(),d=i().filter(g=>g.selected&&(g.draggable||c&&typeof g.draggable>"u")),f=l?a[0]:5,m=l?a[1]:5,v=n.isShiftPressed?4:1,x=n.x*f*v,T=n.y*m*v,p=d.map(g=>{if(g.positionAbsolute){const _={x:g.positionAbsolute.x+x,y:g.positionAbsolute.y+T};l&&(_.x=a[0]*Math.round(_.x/a[0]),_.y=a[1]*Math.round(_.y/a[1]));const{positionAbsolute:w,position:P}=yy(g,_,r,s,void 0,u);g.position=P,g.positionAbsolute=w}return g});o(p,!0,!1)},[])}const ns={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var As=e=>{const t=({id:n,type:r,data:s,xPos:o,yPos:i,xPosOrigin:l,yPosOrigin:a,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:m,onContextMenu:v,onDoubleClick:x,style:T,className:p,isDraggable:g,isSelectable:_,isConnectable:w,isFocusable:P,selectNodesOnDrag:A,sourcePosition:R,targetPosition:$,hidden:B,resizeObserver:D,dragHandle:U,zIndex:Q,isParent:z,noDragClassName:y,noPanClassName:I,initialized:N,disableKeyboardA11y:O,ariaLabel:C,rfId:S,hasHandleBounds:b})=>{const j=Xe(),M=E.useRef(null),K=E.useRef(null),Y=E.useRef(R),ee=E.useRef($),te=E.useRef(r),pe=_||g||c||d||f||m,V=vy(),me=bs(n,j.getState,d),he=bs(n,j.getState,f),ve=bs(n,j.getState,m),Se=bs(n,j.getState,v),k=bs(n,j.getState,x),L=J=>{const{nodeDragThreshold:q}=j.getState();if(_&&(!A||!g||q>0)&&Ku({id:n,store:j,nodeRef:M}),c){const H=j.getState().nodeInternals.get(n);H&&c(J,{...H})}},ne=J=>{if(!Hu(J)&&!O)if(Wg.includes(J.key)&&_){const q=J.key==="Escape";Ku({id:n,store:j,unselect:q,nodeRef:M})}else g&&u&&Object.prototype.hasOwnProperty.call(ns,J.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${J.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~i}`}),V({x:ns[J.key].x,y:ns[J.key].y,isShiftPressed:J.shiftKey}))};E.useEffect(()=>()=>{K.current&&(D==null||D.unobserve(K.current),K.current=null)},[]),E.useEffect(()=>{if(M.current&&!B){const J=M.current;(!N||!b||K.current!==J)&&(K.current&&(D==null||D.unobserve(K.current)),D==null||D.observe(J),K.current=J)}},[B,N,b]),E.useEffect(()=>{const J=te.current!==r,q=Y.current!==R,H=ee.current!==$;M.current&&(J||q||H)&&(J&&(te.current=r),q&&(Y.current=R),H&&(ee.current=$),j.getState().updateNodeDimensions([{id:n,nodeElement:M.current,forceUpdate:!0}]))},[n,r,R,$]);const le=_y({nodeRef:M,disabled:B||!g,noDragClassName:y,handleSelector:U,nodeId:n,isSelectable:_,selectNodesOnDrag:A});return B?null:G.createElement("div",{className:rt(["react-flow__node",`react-flow__node-${r}`,{[I]:g},p,{selected:u,selectable:_,parent:z,dragging:le}]),ref:M,style:{zIndex:Q,transform:`translate(${l}px,${a}px)`,pointerEvents:pe?"all":"none",visibility:N?"visible":"hidden",...T},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:he,onMouseLeave:ve,onContextMenu:Se,onClick:L,onDoubleClick:k,onKeyDown:P?ne:void 0,tabIndex:P?0:void 0,role:P?"button":void 0,"aria-describedby":O?void 0:`${cy}-${S}`,"aria-label":C},G.createElement(ZE,{value:n},G.createElement(e,{id:n,data:s,type:r,xPos:o,yPos:i,selected:u,isConnectable:w,sourcePosition:R,targetPosition:$,dragging:le,dragHandle:U,zIndex:Q})))};return t.displayName="NodeWrapper",E.memo(t)};const FN=e=>{const t=e.getNodes().filter(n=>n.selected);return{...zl(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function zN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xe(),{width:s,height:o,x:i,y:l,transformString:a,userSelectionActive:u}=be(FN,Je),c=vy(),d=E.useRef(null);if(E.useEffect(()=>{var v;n||(v=d.current)==null||v.focus({preventScroll:!0})},[n]),_y({nodeRef:d}),u||!s||!o)return null;const f=e?v=>{const x=r.getState().getNodes().filter(T=>T.selected);e(v,x)}:void 0,m=v=>{Object.prototype.hasOwnProperty.call(ns,v.key)&&c({x:ns[v.key].x,y:ns[v.key].y,isShiftPressed:v.shiftKey})};return G.createElement("div",{className:rt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a}},G.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m,style:{width:s,height:o,top:l,left:i}}))}var DN=E.memo(zN);const UN=e=>e.nodesSelectionActive,xy=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,deleteKeyCode:l,onMove:a,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:m,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:T,panActivationKeyCode:p,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:w,zoomOnPinch:P,panOnScroll:A,panOnScrollSpeed:R,panOnScrollMode:$,zoomOnDoubleClick:B,panOnDrag:D,defaultViewport:U,translateExtent:Q,minZoom:z,maxZoom:y,preventScrolling:I,onSelectionContextMenu:N,noWheelClassName:O,noPanClassName:C,disableKeyboardA11y:S})=>{const b=be(UN),j=No(d),M=No(p),K=M||D,Y=M||A,ee=j||f&&K!==!0;return IN({deleteKeyCode:l,multiSelectionKeyCode:T}),G.createElement(bN,{onMove:a,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:_,zoomOnScroll:w,zoomOnPinch:P,panOnScroll:Y,panOnScrollSpeed:R,panOnScrollMode:$,zoomOnDoubleClick:B,panOnDrag:!j&&K,defaultViewport:U,translateExtent:Q,minZoom:z,maxZoom:y,zoomActivationKeyCode:g,preventScrolling:I,noWheelClassName:O,noPanClassName:C},G.createElement(my,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,panOnDrag:K,isSelecting:!!ee,selectionMode:m},e,b&&G.createElement(DN,{onSelectionContextMenu:N,noPanClassName:C,disableKeyboardA11y:S})))};xy.displayName="FlowRenderer";var HN=E.memo(xy);function WN(e){return be(E.useCallback(n=>e?Zg(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function VN(e){const t={input:As(e.input||iy),default:As(e.default||Yu),output:As(e.output||ay),group:As(e.group||cd)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,o)=>(s[o]=As(e[o]||Yu),s),n);return{...t,...r}}const GN=({x:e,y:t,width:n,height:r,origin:s})=>!n||!r?{x:e,y:t}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:t}:{x:e-n*s[0],y:t-r*s[1]},YN=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),wy=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:o,onError:i}=be(YN,Je),l=WN(e.onlyRenderVisibleElements),a=E.useRef(),u=E.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(m=>({id:m.target.getAttribute("data-id"),nodeElement:m.target,forceUpdate:!0}));o(f)});return a.current=c,c},[]);return E.useEffect(()=>()=>{var c;(c=a==null?void 0:a.current)==null||c.disconnect()},[]),G.createElement("div",{className:"react-flow__nodes",style:fd},l.map(c=>{var P,A,R;let d=c.type||"default";e.nodeTypes[d]||(i==null||i("003",xn.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,m=!!(c.draggable||t&&typeof c.draggable>"u"),v=!!(c.selectable||s&&typeof c.selectable>"u"),x=!!(c.connectable||n&&typeof c.connectable>"u"),T=!!(c.focusable||r&&typeof c.focusable>"u"),p=e.nodeExtent?sd(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,g=(p==null?void 0:p.x)??0,_=(p==null?void 0:p.y)??0,w=GN({x:g,y:_,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return G.createElement(f,{key:c.id,id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||ie.Bottom,targetPosition:c.targetPosition||ie.Top,hidden:c.hidden,xPos:g,yPos:_,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:m,isSelectable:v,isConnectable:x,isFocusable:T,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((P=c[Ue])==null?void 0:P.z)??0,isParent:!!((A=c[Ue])!=null&&A.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!((R=c[Ue])!=null&&R.handleBounds)})}))};wy.displayName="NodeRenderer";var KN=E.memo(wy);const XN=(e,t,n)=>n===ie.Left?e-t:n===ie.Right?e+t:e,QN=(e,t,n)=>n===ie.Top?e-t:n===ie.Bottom?e+t:e,vp="react-flow__edgeupdater",xp=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:i,type:l})=>G.createElement("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:i,className:rt([vp,`${vp}-${l}`]),cx:XN(t,r,e),cy:QN(n,r,e),r,stroke:"transparent",fill:"transparent"}),ZN=()=>!0;var Cr=e=>{const t=({id:n,className:r,type:s,data:o,onClick:i,onEdgeDoubleClick:l,selected:a,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:x,style:T,source:p,target:g,sourceX:_,sourceY:w,targetX:P,targetY:A,sourcePosition:R,targetPosition:$,elementsSelectable:B,hidden:D,sourceHandleId:U,targetHandleId:Q,onContextMenu:z,onMouseEnter:y,onMouseMove:I,onMouseLeave:N,reconnectRadius:O,onReconnect:C,onReconnectStart:S,onReconnectEnd:b,markerEnd:j,markerStart:M,rfId:K,ariaLabel:Y,isFocusable:ee,isReconnectable:te,pathOptions:pe,interactionWidth:V,disableKeyboardA11y:me})=>{const he=E.useRef(null),[ve,Se]=E.useState(!1),[k,L]=E.useState(!1),ne=Xe(),le=E.useMemo(()=>`url('#${Vu(M,K)}')`,[M,K]),J=E.useMemo(()=>`url('#${Vu(j,K)}')`,[j,K]);if(D)return null;const q=we=>{var Ce;const{edges:ue,addSelectedEdges:ge,unselectNodesAndEdges:Te,multiSelectionActive:ke}=ne.getState(),ye=ue.find(Ge=>Ge.id===n);ye&&(B&&(ne.setState({nodesSelectionActive:!1}),ye.selected&&ke?(Te({nodes:[],edges:[ye]}),(Ce=he.current)==null||Ce.blur()):ge([n])),i&&i(we,ye))},H=Ps(n,ne.getState,l),oe=Ps(n,ne.getState,z),W=Ps(n,ne.getState,y),re=Ps(n,ne.getState,I),ae=Ps(n,ne.getState,N),F=(we,ue)=>{if(we.button!==0)return;const{edges:ge,isValidConnection:Te}=ne.getState(),ke=ue?g:p,ye=(ue?Q:U)||null,Ce=ue?"target":"source",Ge=Te||ZN,Dl=ue,_s=ge.find(Xn=>Xn.id===n);L(!0),S==null||S(we,_s,Ce);const Ul=Xn=>{L(!1),b==null||b(Xn,_s,Ce)};ny({event:we,handleId:ye,nodeId:ke,onConnect:Xn=>C==null?void 0:C(_s,Xn),isTarget:Dl,getState:ne.getState,setState:ne.setState,isValidConnection:Ge,edgeUpdaterType:Ce,onReconnectEnd:Ul})},X=we=>F(we,!0),Z=we=>F(we,!1),de=()=>Se(!0),ce=()=>Se(!1),Ne=!B&&!i,Ae=we=>{var ue;if(!me&&Wg.includes(we.key)&&B){const{unselectNodesAndEdges:ge,addSelectedEdges:Te,edges:ke}=ne.getState();we.key==="Escape"?((ue=he.current)==null||ue.blur(),ge({edges:[ke.find(Ce=>Ce.id===n)]})):Te([n])}};return G.createElement("g",{className:rt(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:a,animated:u,inactive:Ne,updating:ve}]),onClick:q,onDoubleClick:H,onContextMenu:oe,onMouseEnter:W,onMouseMove:re,onMouseLeave:ae,onKeyDown:ee?Ae:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${p} to ${g}`,"aria-describedby":ee?`${dy}-${K}`:void 0,ref:he},!k&&G.createElement(e,{id:n,source:p,target:g,selected:a,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:x,data:o,style:T,sourceX:_,sourceY:w,targetX:P,targetY:A,sourcePosition:R,targetPosition:$,sourceHandleId:U,targetHandleId:Q,markerStart:le,markerEnd:J,pathOptions:pe,interactionWidth:V}),te&&G.createElement(G.Fragment,null,(te==="source"||te===!0)&&G.createElement(xp,{position:R,centerX:_,centerY:w,radius:O,onMouseDown:X,onMouseEnter:de,onMouseOut:ce,type:"source"}),(te==="target"||te===!0)&&G.createElement(xp,{position:$,centerX:P,centerY:A,radius:O,onMouseDown:Z,onMouseEnter:de,onMouseOut:ce,type:"target"})))};return t.displayName="EdgeWrapper",E.memo(t)};function qN(e){const t={default:Cr(e.default||fl),straight:Cr(e.bezier||ld),step:Cr(e.step||id),smoothstep:Cr(e.step||Fl),simplebezier:Cr(e.simplebezier||od)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,o)=>(s[o]=Cr(e[o]||fl),s),n);return{...t,...r}}function wp(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,s=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,i=(n==null?void 0:n.height)||t.height;switch(e){case ie.Top:return{x:r+o/2,y:s};case ie.Right:return{x:r+o,y:s+i/2};case ie.Bottom:return{x:r+o/2,y:s+i};case ie.Left:return{x:r,y:s+i/2}}}function Sp(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const JN=(e,t,n,r,s,o)=>{const i=wp(n,e,t),l=wp(o,r,s);return{sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}};function eT({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:o,width:i,height:l,transform:a}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=So({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:i/a[2],height:l/a[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function Ep(e){var r,s,o,i,l;const t=((r=e==null?void 0:e[Ue])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)||0,y:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const tT=[{level:0,isMaxLevel:!0,edges:[]}];function nT(e,t,n=!1){let r=-1;const s=e.reduce((i,l)=>{var c,d;const a=Rt(l.zIndex);let u=a?l.zIndex:0;if(n){const f=t.get(l.target),m=t.get(l.source),v=l.selected||(f==null?void 0:f.selected)||(m==null?void 0:m.selected),x=Math.max(((c=m==null?void 0:m[Ue])==null?void 0:c.z)||0,((d=f==null?void 0:f[Ue])==null?void 0:d.z)||0,1e3);u=(a?l.zIndex:0)+(v?x:0)}return i[u]?i[u].push(l):i[u]=[l],r=u>r?u:r,i},{}),o=Object.entries(s).map(([i,l])=>{const a=+i;return{edges:l,level:a,isMaxLevel:a===r}});return o.length===0?tT:o}function rT(e,t,n){const r=be(E.useCallback(s=>e?s.edges.filter(o=>{const i=t.get(o.source),l=t.get(o.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&eT({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return nT(r,t,n)}const sT=({color:e="none",strokeWidth:t=1})=>G.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),oT=({color:e="none",strokeWidth:t=1})=>G.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Np={[xr.Arrow]:sT,[xr.ArrowClosed]:oT};function iT(e){const t=Xe();return E.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(Np,e)?Np[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",xn.error009(e)),null)},[e])}const lT=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:i,orient:l="auto-start-reverse"})=>{const a=iT(t);return a?G.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:l,refX:"0",refY:"0"},G.createElement(a,{color:n,strokeWidth:i})):null},aT=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,o)=>([o.markerStart,o.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const l=Vu(i,t);r.includes(l)||(s.push({id:l,color:i.color||e,...i}),r.push(l))}}),s),[]).sort((s,o)=>s.id.localeCompare(o.id))},Sy=({defaultColor:e,rfId:t})=>{const n=be(E.useCallback(aT({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((o,i)=>o.id!==s[i].id)));return G.createElement("defs",null,n.map(r=>G.createElement(lT,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};Sy.displayName="MarkerDefinitions";var uT=E.memo(Sy);const cT=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Ey=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:o,onEdgeContextMenu:i,onEdgeMouseEnter:l,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:c,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:v,reconnectRadius:x,children:T,disableKeyboardA11y:p})=>{const{edgesFocusable:g,edgesUpdatable:_,elementsSelectable:w,width:P,height:A,connectionMode:R,nodeInternals:$,onError:B}=be(cT,Je),D=rT(t,$,n);return P?G.createElement(G.Fragment,null,D.map(({level:U,edges:Q,isMaxLevel:z})=>G.createElement("svg",{key:U,style:{zIndex:U},width:P,height:A,className:"react-flow__edges react-flow__container"},z&&G.createElement(uT,{defaultColor:e,rfId:r}),G.createElement("g",null,Q.map(y=>{const[I,N,O]=Ep($.get(y.source)),[C,S,b]=Ep($.get(y.target));if(!O||!b)return null;let j=y.type||"default";s[j]||(B==null||B("011",xn.error011(j)),j="default");const M=s[j]||s.default,K=R===vr.Strict?S.target:(S.target??[]).concat(S.source??[]),Y=Sp(N.source,y.sourceHandle),ee=Sp(K,y.targetHandle),te=(Y==null?void 0:Y.position)||ie.Bottom,pe=(ee==null?void 0:ee.position)||ie.Top,V=!!(y.focusable||g&&typeof y.focusable>"u"),me=y.reconnectable||y.updatable,he=typeof f<"u"&&(me||_&&typeof me>"u");if(!Y||!ee)return B==null||B("008",xn.error008(Y,y)),null;const{sourceX:ve,sourceY:Se,targetX:k,targetY:L}=JN(I,Y,te,C,ee,pe);return G.createElement(M,{key:y.id,id:y.id,className:rt([y.className,o]),type:j,data:y.data,selected:!!y.selected,animated:!!y.animated,hidden:!!y.hidden,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,style:y.style,source:y.source,target:y.target,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerEnd:y.markerEnd,markerStart:y.markerStart,sourceX:ve,sourceY:Se,targetX:k,targetY:L,sourcePosition:te,targetPosition:pe,elementsSelectable:w,onContextMenu:i,onMouseEnter:l,onMouseMove:a,onMouseLeave:u,onClick:c,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:v,reconnectRadius:x,rfId:r,ariaLabel:y.ariaLabel,isFocusable:V,isReconnectable:he,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth,disableKeyboardA11y:p})})))),T):null};Ey.displayName="EdgeRenderer";var dT=E.memo(Ey);const fT=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function pT({children:e}){const t=be(fT);return G.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function hT(e){const t=dd(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const mT={[ie.Left]:ie.Right,[ie.Right]:ie.Left,[ie.Top]:ie.Bottom,[ie.Bottom]:ie.Top},Ny=({nodeId:e,handleType:t,style:n,type:r=Rn.Bezier,CustomComponent:s,connectionStatus:o})=>{var A,R,$;const{fromNode:i,handleId:l,toX:a,toY:u,connectionMode:c}=be(E.useCallback(B=>({fromNode:B.nodeInternals.get(e),handleId:B.connectionHandleId,toX:(B.connectionPosition.x-B.transform[0])/B.transform[2],toY:(B.connectionPosition.y-B.transform[1])/B.transform[2],connectionMode:B.connectionMode}),[e]),Je),d=(A=i==null?void 0:i[Ue])==null?void 0:A.handleBounds;let f=d==null?void 0:d[t];if(c===vr.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!i||!f)return null;const m=l?f.find(B=>B.id===l):f[0],v=m?m.x+m.width/2:(i.width??0)/2,x=m?m.y+m.height/2:i.height??0,T=(((R=i.positionAbsolute)==null?void 0:R.x)??0)+v,p=((($=i.positionAbsolute)==null?void 0:$.y)??0)+x,g=m==null?void 0:m.position,_=g?mT[g]:null;if(!g||!_)return null;if(s)return G.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:T,fromY:p,toX:a,toY:u,fromPosition:g,toPosition:_,connectionStatus:o});let w="";const P={sourceX:T,sourceY:p,sourcePosition:g,targetX:a,targetY:u,targetPosition:_};return r===Rn.Bezier?[w]=Xg(P):r===Rn.Step?[w]=Wu({...P,borderRadius:0}):r===Rn.SmoothStep?[w]=Wu(P):r===Rn.SimpleBezier?[w]=Kg(P):w=`M${T},${p} ${a},${u}`,G.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};Ny.displayName="ConnectionLine";const gT=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function yT({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:o,nodesConnectable:i,width:l,height:a,connectionStatus:u}=be(gT,Je);return!(s&&o&&l&&i)?null:G.createElement("svg",{style:e,width:l,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},G.createElement("g",{className:rt(["react-flow__connection",u])},G.createElement(Ny,{nodeId:s,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})))}function Tp(e,t){return E.useRef(null),Xe(),E.useMemo(()=>t(e),[e])}const Ty=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:o,onNodeClick:i,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:v,onSelectionStart:x,onSelectionEnd:T,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:_,connectionLineContainerStyle:w,selectionKeyCode:P,selectionOnDrag:A,selectionMode:R,multiSelectionKeyCode:$,panActivationKeyCode:B,zoomActivationKeyCode:D,deleteKeyCode:U,onlyRenderVisibleElements:Q,elementsSelectable:z,selectNodesOnDrag:y,defaultViewport:I,translateExtent:N,minZoom:O,maxZoom:C,preventScrolling:S,defaultMarkerColor:b,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:te,panOnDrag:pe,onPaneClick:V,onPaneMouseEnter:me,onPaneMouseMove:he,onPaneMouseLeave:ve,onPaneScroll:Se,onPaneContextMenu:k,onEdgeContextMenu:L,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:q,onReconnectStart:H,onReconnectEnd:oe,reconnectRadius:W,noDragClassName:re,noWheelClassName:ae,noPanClassName:F,elevateEdgesOnSelect:X,disableKeyboardA11y:Z,nodeOrigin:de,nodeExtent:ce,rfId:Ne})=>{const Ae=Tp(e,VN),we=Tp(t,qN);return hT(o),G.createElement(HN,{onPaneClick:V,onPaneMouseEnter:me,onPaneMouseMove:he,onPaneMouseLeave:ve,onPaneContextMenu:k,onPaneScroll:Se,deleteKeyCode:U,selectionKeyCode:P,selectionOnDrag:A,selectionMode:R,onSelectionStart:x,onSelectionEnd:T,multiSelectionKeyCode:$,panActivationKeyCode:B,zoomActivationKeyCode:D,elementsSelectable:z,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:j,zoomOnPinch:M,zoomOnDoubleClick:te,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:pe,defaultViewport:I,translateExtent:N,minZoom:O,maxZoom:C,onSelectionContextMenu:v,preventScrolling:S,noDragClassName:re,noWheelClassName:ae,noPanClassName:F,disableKeyboardA11y:Z},G.createElement(pT,null,G.createElement(dT,{edgeTypes:we,onEdgeClick:l,onEdgeDoubleClick:u,onlyRenderVisibleElements:Q,onEdgeContextMenu:L,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:q,onReconnectStart:H,onReconnectEnd:oe,reconnectRadius:W,defaultMarkerColor:b,noPanClassName:F,elevateEdgesOnSelect:!!X,disableKeyboardA11y:Z,rfId:Ne},G.createElement(yT,{style:g,type:p,component:_,containerStyle:w})),G.createElement("div",{className:"react-flow__edgelabel-renderer"}),G.createElement(KN,{nodeTypes:Ae,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:y,onlyRenderVisibleElements:Q,noPanClassName:F,noDragClassName:re,disableKeyboardA11y:Z,nodeOrigin:de,nodeExtent:ce,rfId:Ne})))};Ty.displayName="GraphView";var _T=E.memo(Ty);const Xu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],En={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Xu,nodeExtent:Xu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:vr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:VE,isValidConnection:void 0},vT=()=>ix((e,t)=>({...En,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:o}=t();e({nodeInternals:Na(n,r,s,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",o=typeof r<"u",i=s?Na(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:i,edges:o?r:[],hasDefaultNodes:s,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:o,fitViewOnInitDone:i,fitViewOnInitOptions:l,domNode:a,nodeOrigin:u}=t(),c=a==null?void 0:a.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),m=n.reduce((x,T)=>{const p=s.get(T.id);if(p!=null&&p.hidden)s.set(p.id,{...p,[Ue]:{...p[Ue],handleBounds:void 0}});else if(p){const g=rd(T.nodeElement);!!(g.width&&g.height&&(p.width!==g.width||p.height!==g.height||T.forceUpdate))&&(s.set(p.id,{...p,[Ue]:{...p[Ue],handleBounds:{source:_p(".source",T.nodeElement,f,u),target:_p(".target",T.nodeElement,f,u)}},...g}),x.push({id:p.id,type:"dimensions",dimensions:g}))}return x},[]);py(s,u);const v=i||o&&!i&&hy(t,{initial:!0,...l});e({nodeInternals:new Map(s),fitViewOnInitDone:v}),(m==null?void 0:m.length)>0&&(r==null||r(m))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:o}=t(),i=n.map(l=>{const a={id:l.id,type:"position",dragging:s};return r&&(a.positionAbsolute=l.positionAbsolute,a.position=l.position),a});o(i)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:o,nodeOrigin:i,getNodes:l,elevateNodesOnSelect:a}=t();if(n!=null&&n.length){if(o){const u=ON(n,l()),c=Na(u,s,i,a);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let i,l=null;r?i=n.map(a=>Pn(a,!0)):(i=Vr(o(),n),l=Vr(s,[])),oi({changedNodes:i,changedEdges:l,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let i,l=null;r?i=n.map(a=>Pn(a,!0)):(i=Vr(s,n),l=Vr(o(),[])),oi({changedNodes:l,changedEdges:i,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:o}=t(),i=n||o(),l=r||s,a=i.map(c=>(c.selected=!1,Pn(c.id,!1))),u=l.map(c=>Pn(c.id,!1));oi({changedNodes:a,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=t();r==null||r.scaleExtent([n,s]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=t();r==null||r.scaleExtent([s,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(l=>l.selected).map(l=>Pn(l.id,!1)),i=n.filter(l=>l.selected).map(l=>Pn(l.id,!1));oi({changedNodes:o,changedEdges:i,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=sd(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:o,d3Zoom:i,d3Selection:l,translateExtent:a}=t();if(!i||!l||!n.x&&!n.y)return!1;const u=hn.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[s,o]],d=i==null?void 0:i.constrain()(u,c,a);return i.transform(l,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:En.connectionNodeId,connectionHandleId:En.connectionHandleId,connectionHandleType:En.connectionHandleType,connectionStatus:En.connectionStatus,connectionStartHandle:En.connectionStartHandle,connectionEndHandle:En.connectionEndHandle}),reset:()=>e({...En})}),Object.is),Iy=({children:e})=>{const t=E.useRef(null);return t.current||(t.current=vT()),G.createElement(BE,{value:t.current},e)};Iy.displayName="ReactFlowProvider";const Cy=({children:e})=>E.useContext(Bl)?G.createElement(G.Fragment,null,e):G.createElement(Iy,null,e);Cy.displayName="ReactFlowWrapper";const xT={input:iy,default:Yu,output:ay,group:cd},wT={default:fl,straight:ld,step:id,smoothstep:Fl,simplebezier:od},ST=[0,0],ET=[15,15],NT={x:0,y:0,zoom:1},TT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},ky=E.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o=xT,edgeTypes:i=wT,onNodeClick:l,onEdgeClick:a,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:m,onConnectStart:v,onConnectEnd:x,onClickConnectStart:T,onClickConnectEnd:p,onNodeMouseEnter:g,onNodeMouseMove:_,onNodeMouseLeave:w,onNodeContextMenu:P,onNodeDoubleClick:A,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:B,onNodesDelete:D,onEdgesDelete:U,onSelectionChange:Q,onSelectionDragStart:z,onSelectionDrag:y,onSelectionDragStop:I,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:C,connectionMode:S=vr.Strict,connectionLineType:b=Rn.Bezier,connectionLineStyle:j,connectionLineComponent:M,connectionLineContainerStyle:K,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:te=!1,selectionMode:pe=Eo.Full,panActivationKeyCode:V="Space",multiSelectionKeyCode:me=dl()?"Meta":"Control",zoomActivationKeyCode:he=dl()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:Se=ET,onlyRenderVisibleElements:k=!1,selectNodesOnDrag:L=!0,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,nodeOrigin:q=ST,edgesFocusable:H,edgesUpdatable:oe,elementsSelectable:W,defaultViewport:re=NT,minZoom:ae=.5,maxZoom:F=2,translateExtent:X=Xu,preventScrolling:Z=!0,nodeExtent:de,defaultMarkerColor:ce="#b1b1b7",zoomOnScroll:Ne=!0,zoomOnPinch:Ae=!0,panOnScroll:we=!1,panOnScrollSpeed:ue=.5,panOnScrollMode:ge=lr.Free,zoomOnDoubleClick:Te=!0,panOnDrag:ke=!0,onPaneClick:ye,onPaneMouseEnter:Ce,onPaneMouseMove:Ge,onPaneMouseLeave:Dl,onPaneScroll:_s,onPaneContextMenu:Ul,children:pd,onEdgeContextMenu:Xn,onEdgeDoubleClick:My,onEdgeMouseEnter:Oy,onEdgeMouseMove:Ly,onEdgeMouseLeave:$y,onEdgeUpdate:jy,onEdgeUpdateStart:By,onEdgeUpdateEnd:Fy,onReconnect:zy,onReconnectStart:Dy,onReconnectEnd:Uy,reconnectRadius:Hy=10,edgeUpdaterRadius:Wy=10,onNodesChange:Vy,onEdgesChange:Gy,noDragClassName:Yy="nodrag",noWheelClassName:Ky="nowheel",noPanClassName:hd="nopan",fitView:Xy=!1,fitViewOptions:Qy,connectOnClick:Zy=!0,attributionPosition:qy,proOptions:Jy,defaultEdgeOptions:e0,elevateNodesOnSelect:t0=!0,elevateEdgesOnSelect:n0=!1,disableKeyboardA11y:md=!1,autoPanOnConnect:r0=!0,autoPanOnNodeDrag:s0=!0,connectionRadius:o0=20,isValidConnection:i0,onError:l0,style:a0,id:gd,nodeDragThreshold:u0,...c0},d0)=>{const Hl=gd||"1";return G.createElement("div",{...c0,style:{...a0,...TT},ref:d0,className:rt(["react-flow",s]),"data-testid":"rf__wrapper",id:gd},G.createElement(Cy,null,G.createElement(_T,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:l,onEdgeClick:a,onNodeMouseEnter:g,onNodeMouseMove:_,onNodeMouseLeave:w,onNodeContextMenu:P,onNodeDoubleClick:A,nodeTypes:o,edgeTypes:i,connectionLineType:b,connectionLineStyle:j,connectionLineComponent:M,connectionLineContainerStyle:K,selectionKeyCode:ee,selectionOnDrag:te,selectionMode:pe,deleteKeyCode:Y,multiSelectionKeyCode:me,panActivationKeyCode:V,zoomActivationKeyCode:he,onlyRenderVisibleElements:k,selectNodesOnDrag:L,defaultViewport:re,translateExtent:X,minZoom:ae,maxZoom:F,preventScrolling:Z,zoomOnScroll:Ne,zoomOnPinch:Ae,zoomOnDoubleClick:Te,panOnScroll:we,panOnScrollSpeed:ue,panOnScrollMode:ge,panOnDrag:ke,onPaneClick:ye,onPaneMouseEnter:Ce,onPaneMouseMove:Ge,onPaneMouseLeave:Dl,onPaneScroll:_s,onPaneContextMenu:Ul,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:C,onEdgeContextMenu:Xn,onEdgeDoubleClick:My,onEdgeMouseEnter:Oy,onEdgeMouseMove:Ly,onEdgeMouseLeave:$y,onReconnect:zy??jy,onReconnectStart:Dy??By,onReconnectEnd:Uy??Fy,reconnectRadius:Hy??Wy,defaultMarkerColor:ce,noDragClassName:Yy,noWheelClassName:Ky,noPanClassName:hd,elevateEdgesOnSelect:n0,rfId:Hl,disableKeyboardA11y:md,nodeOrigin:q,nodeExtent:de}),G.createElement(hN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:v,onConnectEnd:x,onClickConnectStart:T,onClickConnectEnd:p,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,edgesFocusable:H,edgesUpdatable:oe,elementsSelectable:W,elevateNodesOnSelect:t0,minZoom:ae,maxZoom:F,nodeExtent:de,onNodesChange:Vy,onEdgesChange:Gy,snapToGrid:ve,snapGrid:Se,connectionMode:S,translateExtent:X,connectOnClick:Zy,defaultEdgeOptions:e0,fitView:Xy,fitViewOptions:Qy,onNodesDelete:D,onEdgesDelete:U,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:B,onSelectionDrag:y,onSelectionDragStart:z,onSelectionDragStop:I,noPanClassName:hd,nodeOrigin:q,rfId:Hl,autoPanOnConnect:r0,autoPanOnNodeDrag:s0,onError:l0,connectionRadius:o0,isValidConnection:i0,nodeDragThreshold:u0}),G.createElement(fN,{onSelectionChange:Q}),pd,G.createElement(zE,{proOptions:Jy,position:qy}),G.createElement(vN,{rfId:Hl,disableKeyboardA11y:md})))});ky.displayName="ReactFlow";const Py=({id:e,x:t,y:n,width:r,height:s,style:o,color:i,strokeColor:l,strokeWidth:a,className:u,borderRadius:c,shapeRendering:d,onClick:f,selected:m})=>{const{background:v,backgroundColor:x}=o||{},T=i||v||x;return G.createElement("rect",{className:rt(["react-flow__minimap-node",{selected:m},u]),x:t,y:n,rx:c,ry:c,width:r,height:s,fill:T,stroke:l,strokeWidth:a,shapeRendering:d,onClick:f?p=>f(p,e):void 0})};Py.displayName="MiniMapNode";var IT=E.memo(Py);const CT=e=>e.nodeOrigin,kT=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),ka=e=>e instanceof Function?e:()=>e;function PT({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:o=IT,onClick:i}){const l=be(kT,Je),a=be(CT),u=ka(t),c=ka(e),d=ka(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return G.createElement(G.Fragment,null,l.map(m=>{const{x:v,y:x}=dr(m,a).positionAbsolute;return G.createElement(o,{key:m.id,x:v,y:x,width:m.width,height:m.height,style:m.style,selected:m.selected,className:d(m),color:u(m),borderRadius:r,strokeColor:c(m),strokeWidth:s,shapeRendering:f,onClick:i,id:m.id})}))}var bT=E.memo(PT);const AT=200,RT=150,MT=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?HE(zl(t,e.nodeOrigin),n):n,rfId:e.rfId}},OT="react-flow__minimap-desc";function by({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:a="rgb(240, 240, 240, 0.6)",maskStrokeColor:u="none",maskStrokeWidth:c=1,position:d="bottom-right",onClick:f,onNodeClick:m,pannable:v=!1,zoomable:x=!1,ariaLabel:T="React Flow mini map",inversePan:p=!1,zoomStep:g=10,offsetScale:_=5}){const w=Xe(),P=E.useRef(null),{boundingRect:A,viewBB:R,rfId:$}=be(MT,Je),B=(e==null?void 0:e.width)??AT,D=(e==null?void 0:e.height)??RT,U=A.width/B,Q=A.height/D,z=Math.max(U,Q),y=z*B,I=z*D,N=_*z,O=A.x-(y-A.width)/2-N,C=A.y-(I-A.height)/2-N,S=y+N*2,b=I+N*2,j=`${OT}-${$}`,M=E.useRef(0);M.current=z,E.useEffect(()=>{if(P.current){const ee=bt(P.current),te=me=>{const{transform:he,d3Selection:ve,d3Zoom:Se}=w.getState();if(me.sourceEvent.type!=="wheel"||!ve||!Se)return;const k=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*g,L=he[2]*Math.pow(2,k);Se.scaleTo(ve,L)},pe=me=>{const{transform:he,d3Selection:ve,d3Zoom:Se,translateExtent:k,width:L,height:ne}=w.getState();if(me.sourceEvent.type!=="mousemove"||!ve||!Se)return;const le=M.current*Math.max(1,he[2])*(p?-1:1),J={x:he[0]-me.sourceEvent.movementX*le,y:he[1]-me.sourceEvent.movementY*le},q=[[0,0],[L,ne]],H=hn.translate(J.x,J.y).scale(he[2]),oe=Se.constrain()(H,q,k);Se.transform(ve,oe)},V=Bg().on("zoom",v?pe:null).on("zoom.wheel",x?te:null);return ee.call(V),()=>{ee.on("zoom",null)}}},[v,x,p,g]);const K=f?ee=>{const te=Ft(ee);f(ee,{x:te[0],y:te[1]})}:void 0,Y=m?(ee,te)=>{const pe=w.getState().nodeInternals.get(te);m(ee,pe)}:void 0;return G.createElement(nd,{position:d,style:e,className:rt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},G.createElement("svg",{width:B,height:D,viewBox:`${O} ${C} ${S} ${b}`,role:"img","aria-labelledby":j,ref:P,onClick:K},T&&G.createElement("title",{id:j},T),G.createElement(bT,{onClick:Y,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:i,nodeComponent:l}),G.createElement("path",{className:"react-flow__minimap-mask",d:`M${O-N},${C-N}h${S+N*2}v${b+N*2}h${-S-N*2}z - M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:a,fillRule:"evenodd",stroke:u,strokeWidth:c,pointerEvents:"none"})))}by.displayName="MiniMap";var LT=E.memo(by);function $T(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},G.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function jT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},G.createElement("path",{d:"M0 0h32v4.2H0z"}))}function BT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},G.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function FT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function zT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Gr=({children:e,className:t,...n})=>G.createElement("button",{type:"button",className:rt(["react-flow__controls-button",t]),...n},e);Gr.displayName="ControlButton";const DT=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Ay=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:i,onFitView:l,onInteractiveChange:a,className:u,children:c,position:d="bottom-left"})=>{const f=Xe(),[m,v]=E.useState(!1),{isInteractive:x,minZoomReached:T,maxZoomReached:p}=be(DT,Je),{zoomIn:g,zoomOut:_,fitView:w}=dd();if(E.useEffect(()=>{v(!0)},[]),!m)return null;const P=()=>{g(),o==null||o()},A=()=>{_(),i==null||i()},R=()=>{w(s),l==null||l()},$=()=>{f.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),a==null||a(!x)};return G.createElement(nd,{className:rt(["react-flow__controls",u]),position:d,style:e,"data-testid":"rf__controls"},t&&G.createElement(G.Fragment,null,G.createElement(Gr,{onClick:P,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},G.createElement($T,null)),G.createElement(Gr,{onClick:A,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:T},G.createElement(jT,null))),n&&G.createElement(Gr,{className:"react-flow__controls-fitview",onClick:R,title:"fit view","aria-label":"fit view"},G.createElement(BT,null)),r&&G.createElement(Gr,{className:"react-flow__controls-interactive",onClick:$,title:"toggle interactivity","aria-label":"toggle interactivity"},x?G.createElement(zT,null):G.createElement(FT,null)),c)};Ay.displayName="Controls";var UT=E.memo(Ay),Vt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Vt||(Vt={}));function HT({color:e,dimensions:t,lineWidth:n}){return G.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function WT({color:e,radius:t}){return G.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const VT={[Vt.Dots]:"#91919a",[Vt.Lines]:"#eee",[Vt.Cross]:"#e2e2e2"},GT={[Vt.Dots]:1,[Vt.Lines]:1,[Vt.Cross]:6},YT=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ry({id:e,variant:t=Vt.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=2,color:i,style:l,className:a}){const u=E.useRef(null),{transform:c,patternId:d}=be(YT,Je),f=i||VT[t],m=r||GT[t],v=t===Vt.Dots,x=t===Vt.Cross,T=Array.isArray(n)?n:[n,n],p=[T[0]*c[2]||1,T[1]*c[2]||1],g=m*c[2],_=x?[g,g]:p,w=v?[g/o,g/o]:[_[0]/o,_[1]/o];return G.createElement("svg",{className:rt(["react-flow__background",a]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:u,"data-testid":"rf__background"},G.createElement("pattern",{id:d+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},v?G.createElement(WT,{color:f,radius:g/o}):G.createElement(HT,{dimensions:_,color:f,lineWidth:s})),G.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${d+e})`}))}Ry.displayName="Background";var KT=E.memo(Ry);const Pa=320,ba=120,Ip=["#94a3b8","#60a5fa","#22d3ee","#34d399"],XT=["rgba(226, 232, 240, 0.28)","rgba(219, 234, 254, 0.28)","rgba(207, 250, 254, 0.28)","rgba(209, 250, 229, 0.24)"],QT=88,ZT=120,qT=72,JT=58,Qe=100,ze=30,nr=96,Aa=22,Ra=6,Cp=10,e2=20,kp=240,li=300,Ma=168,Oa=74,Pp=58,Rs=48,t2=87,n2=26,r2=30,s2=.36,o2=240,i2=.35,l2=1.8,a2=Qe*2+nr+60;function u2(e,t,n){const r=Math.min(176,Math.max(104,e.length*7.4)),s=Math.min(112,Math.max(66,n(t).length*6.1+14));return r+s+t2+n2}function c2(e,t,n){const r=Math.min(220,Math.max(96,e.length*8)),s=Math.min(122,Math.max(66,n(t).length*6.1+14));return r+s+r2}function ai(e,t,n,r){return e<=0?r:e*t+Math.max(0,e-1)*n+r}function ui(e,t=40){return e.length<=t?e:`${e.slice(0,Math.max(1,t-1))}…`}function Qu(e){const t=je(e),n=t.split("/");return n.length<=3?t:`${n[n.length-2]}/${n[n.length-1]}`}function Ms(e){const t=e.split(".");return t[t.length-1]||e}function Xt(e,t){const n=e.trim().length>0?e.trim():Qu(t),r=n.split("/");return r.length>0?r[r.length-1]??n:n}function it(e){if(!e)return null;const t=e.replace(/^builtins\./,""),n=t.split("."),r=n.length>0?n[n.length-1]:t;return r.length<=16?r:`${r.slice(0,15)}…`}function La(e){return e.collectionKind!==null&&e.direction==="unknown"}function ci(e){return`stream:${e}`}function d2(...e){return Math.max(1,e.reduce((t,n)=>t+(n.length>0?1:0),0))}function bi(e){const t=e.split("/");return t.length<=2?e:t.slice(Math.max(0,t.length-3)).join("/")}function $a(e,t,n){return[e,t,n].join(` + */var $l=E,G1=V1;function Y1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var K1=typeof Object.is=="function"?Object.is:Y1,X1=G1.useSyncExternalStore,Q1=$l.useRef,Z1=$l.useEffect,q1=$l.useMemo,J1=$l.useDebugValue;ag.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var o=Q1(null);if(o.current===null){var i={hasValue:!1,value:null};o.current=i}else i=o.current;o=q1(function(){function a(m){if(!u){if(u=!0,c=m,m=r(m),s!==void 0&&i.hasValue){var v=i.value;if(s(v,m))return d=v}return d=m}if(v=d,K1(c,m))return v;var x=r(m);return s!==void 0&&s(v,x)?(c=m,v):(c=m,d=x)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(t())},f===null?void 0:function(){return a(f())}]},[t,n,r,s]);var l=X1(e,o[0],o[1]);return Z1(function(){i.hasValue=!0,i.value=l},[l]),J1(l),l};lg.exports=ag;var ex=lg.exports;const tx=Bp(ex),nx={},jf=e=>{let t;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const m=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(v=>v(t,m))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(nx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,a);return a},rx=e=>e?jf(e):jf,{useDebugValue:sx}=G,{useSyncExternalStoreWithSelector:ox}=tx,ix=e=>e;function dg(e,t=ix,n){const r=ox(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return sx(r),r}const Bf=(e,t)=>{const n=rx(e),r=(s,o=t)=>dg(n,s,o);return Object.assign(r,n),r},lx=(e,t)=>e?Bf(e,t):Bf;function Je(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var ax={value:()=>{}};function jl(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ci.prototype=jl.prototype={constructor:Ci,on:function(e,t){var n=this._,r=ux(e+"",n),s,o=-1,i=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(s),r=0,s,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zf.hasOwnProperty(t)?{space:zf[t],local:e}:e}function dx(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ju&&t.documentElement.namespaceURI===ju?t.createElement(e):t.createElementNS(n,e)}}function fx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fg(e){var t=Bl(e);return(t.local?fx:dx)(t)}function px(){}function Qc(e){return e==null?px:function(){return this.querySelector(e)}}function hx(e){typeof e!="function"&&(e=Qc(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=_&&(_=g+1);!(P=T[_])&&++_=0;)(i=r[s])&&(o&&i.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(i,o),o=i);return this}function Fx(e){e||(e=zx);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,s=new Array(r),o=0;ot?1:e>=t?0:NaN}function Dx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ux(){return Array.from(this)}function Hx(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ew:typeof t=="function"?nw:tw)(e,t,n??"")):fs(this.node(),e)}function fs(e,t){return e.style.getPropertyValue(t)||yg(e).getComputedStyle(e,null).getPropertyValue(t)}function sw(e){return function(){delete this[e]}}function ow(e,t){return function(){this[e]=t}}function iw(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lw(e,t){return arguments.length>1?this.each((t==null?sw:typeof t=="function"?iw:ow)(e,t)):this.node()[e]}function _g(e){return e.trim().split(/^|\s+/)}function Zc(e){return e.classList||new vg(e)}function vg(e){this._node=e,this._names=_g(e.getAttribute("class")||"")}vg.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xg(e,t){for(var n=Zc(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Lw(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n()=>e;function Bu(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:i,y:l,dx:a,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}Bu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Vw(e){return!e.ctrlKey&&!e.button}function Gw(){return this.parentNode}function Yw(e,t){return t??{x:e.x,y:e.y}}function Kw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xw(){var e=Vw,t=Gw,n=Yw,r=Kw,s={},o=jl("start","drag","end"),i=0,l,a,u,c,d=0;function f(w){w.on("mousedown.drag",m).filter(r).on("touchstart.drag",T).on("touchmove.drag",p,Ww).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,P){if(!(c||!e.call(this,w,P))){var A=_(this,t.call(this,w,P),w,P,"mouse");A&&(bt(w.view).on("mousemove.drag",v,_o).on("mouseup.drag",x,_o),Ng(w.view),Sa(w),u=!1,l=w.clientX,a=w.clientY,A("start",w))}}function v(w){if(es(w),!u){var P=w.clientX-l,A=w.clientY-a;u=P*P+A*A>d}s.mouse("drag",w)}function x(w){bt(w.view).on("mousemove.drag mouseup.drag",null),Tg(w.view,u),es(w),s.mouse("end",w)}function T(w,P){if(e.call(this,w,P)){var A=w.changedTouches,R=t.call(this,w,P),$=A.length,B,D;for(B=0;B<$;++B)(D=_(this,R,w,P,A[B].identifier,A[B]))&&(Sa(w),D("start",w,A[B]))}}function p(w){var P=w.changedTouches,A=P.length,R,$;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ei(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ei(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Zw.exec(e))?new gt(t[1],t[2],t[3],1):(t=qw.exec(e))?new gt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Jw.exec(e))?ei(t[1],t[2],t[3],t[4]):(t=eS.exec(e))?ei(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tS.exec(e))?Yf(t[1],t[2]/100,t[3]/100,1):(t=nS.exec(e))?Yf(t[1],t[2]/100,t[3]/100,t[4]):Df.hasOwnProperty(e)?Wf(Df[e]):e==="transparent"?new gt(NaN,NaN,NaN,0):null}function Wf(e){return new gt(e>>16&255,e>>8&255,e&255,1)}function ei(e,t,n,r){return r<=0&&(e=t=n=NaN),new gt(e,t,n,r)}function oS(e){return e instanceof Ro||(e=wo(e)),e?(e=e.rgb(),new gt(e.r,e.g,e.b,e.opacity)):new gt}function Fu(e,t,n,r){return arguments.length===1?oS(e):new gt(e,t,n,r??1)}function gt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}qc(gt,Fu,Ig(Ro,{brighter(e){return e=e==null?ul:Math.pow(ul,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vo:Math.pow(vo,e),new gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gt(cr(this.r),cr(this.g),cr(this.b),cl(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Vf,formatHex:Vf,formatHex8:iS,formatRgb:Gf,toString:Gf}));function Vf(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}`}function iS(){return`#${ir(this.r)}${ir(this.g)}${ir(this.b)}${ir((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gf(){const e=cl(this.opacity);return`${e===1?"rgb(":"rgba("}${cr(this.r)}, ${cr(this.g)}, ${cr(this.b)}${e===1?")":`, ${e})`}`}function cl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function cr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ir(e){return e=cr(e),(e<16?"0":"")+e.toString(16)}function Yf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Dt(e,t,n,r)}function Cg(e){if(e instanceof Dt)return new Dt(e.h,e.s,e.l,e.opacity);if(e instanceof Ro||(e=wo(e)),!e)return new Dt;if(e instanceof Dt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,l=o-s,a=(o+s)/2;return l?(t===o?i=(n-r)/l+(n0&&a<1?0:i,new Dt(i,l,a,e.opacity)}function lS(e,t,n,r){return arguments.length===1?Cg(e):new Dt(e,t,n,r??1)}function Dt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}qc(Dt,lS,Ig(Ro,{brighter(e){return e=e==null?ul:Math.pow(ul,e),new Dt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vo:Math.pow(vo,e),new Dt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new gt(Ea(e>=240?e-240:e+120,s,r),Ea(e,s,r),Ea(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Dt(Kf(this.h),ti(this.s),ti(this.l),cl(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=cl(this.opacity);return`${e===1?"hsl(":"hsla("}${Kf(this.h)}, ${ti(this.s)*100}%, ${ti(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Kf(e){return e=(e||0)%360,e<0?e+360:e}function ti(e){return Math.max(0,Math.min(1,e||0))}function Ea(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const kg=e=>()=>e;function aS(e,t){return function(n){return e+n*t}}function uS(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function cS(e){return(e=+e)==1?Pg:function(t,n){return n-t?uS(t,n,e):kg(isNaN(t)?n:t)}}function Pg(e,t){var n=t-e;return n?aS(e,n):kg(isNaN(e)?t:e)}const Xf=function e(t){var n=cS(t);function r(s,o){var i=n((s=Fu(s)).r,(o=Fu(o)).r),l=n(s.g,o.g),a=n(s.b,o.b),u=Pg(s.opacity,o.opacity);return function(c){return s.r=i(c),s.g=l(c),s.b=a(c),s.opacity=u(c),s+""}}return r.gamma=e,r}(1);function kn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var zu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Na=new RegExp(zu.source,"g");function dS(e){return function(){return e}}function fS(e){return function(t){return e(t)+""}}function pS(e,t){var n=zu.lastIndex=Na.lastIndex=0,r,s,o,i=-1,l=[],a=[];for(e=e+"",t=t+"";(r=zu.exec(e))&&(s=Na.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),l[i]?l[i]+=o:l[++i]=o),(r=r[0])===(s=s[0])?l[i]?l[i]+=s:l[++i]=s:(l[++i]=null,a.push({i,x:kn(r,s)})),n=Na.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,r)-2,x:kn(u,c)})):c&&d.push(s(d)+"rotate("+c+r)}function l(u,c,d,f){u!==c?f.push({i:d.push(s(d)+"skewX(",null,r)-2,x:kn(u,c)}):c&&d.push(s(d)+"skewX("+c+r)}function a(u,c,d,f,m,v){if(u!==d||c!==f){var x=m.push(s(m)+"scale(",null,",",null,")");v.push({i:x-4,x:kn(u,d)},{i:x-2,x:kn(c,f)})}else(d!==1||f!==1)&&m.push(s(m)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),i(u.rotate,c.rotate,d,f),l(u.skewX,c.skewX,d,f),a(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(m){for(var v=-1,x=f.length,T;++v=0&&e._call.call(void 0,t),e=e._next;--ps}function qf(){_r=(fl=So.now())+Fl,ps=Fs=0;try{ES()}finally{ps=0,TS(),_r=0}}function NS(){var e=So.now(),t=e-fl;t>Rg&&(Fl-=t,fl=e)}function TS(){for(var e,t=dl,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:dl=n);zs=e,Uu(r)}function Uu(e){if(!ps){Fs&&(Fs=clearTimeout(Fs));var t=e-_r;t>24?(e<1/0&&(Fs=setTimeout(qf,e-So.now()-Fl)),Cs&&(Cs=clearInterval(Cs))):(Cs||(fl=So.now(),Cs=setInterval(NS,Rg)),ps=1,Mg(qf))}}function Jf(e,t,n){var r=new pl;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var IS=jl("start","end","cancel","interrupt"),CS=[],Lg=0,ep=1,Hu=2,ki=3,tp=4,Wu=5,Pi=6;function zl(e,t,n,r,s,o){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;kS(e,n,{name:t,index:r,group:s,on:IS,tween:CS,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Lg})}function ed(e,t){var n=Yt(e,t);if(n.state>Lg)throw new Error("too late; already scheduled");return n}function nn(e,t){var n=Yt(e,t);if(n.state>ki)throw new Error("too late; already running");return n}function Yt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function kS(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Og(o,0,n.time);function o(u){n.state=ep,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var c,d,f,m;if(n.state!==ep)return a();for(c in r)if(m=r[c],m.name===n.name){if(m.state===ki)return Jf(i);m.state===tp?(m.state=Pi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[c]):+cHu&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function sE(e,t,n){var r,s,o=rE(t)?ed:nn;return function(){var i=o(this,e),l=i.on;l!==r&&(s=(r=l).copy()).on(t,n),i.on=s}}function oE(e,t){var n=this._id;return arguments.length<2?Yt(this.node(),n).on.on(e):this.each(sE(n,e,t))}function iE(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function lE(){return this.on("end.remove",iE(this._id))}function aE(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qc(e));for(var r=this._groups,s=r.length,o=new Array(s),i=0;i()=>e;function ME(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function fn(e,t,n){this.k=e,this.x=t,this.y=n}fn.prototype={constructor:fn,scale:function(e){return e===1?this:new fn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new fn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var hn=new fn(1,0,0);fn.prototype;function Ta(e){e.stopImmediatePropagation()}function ks(e){e.preventDefault(),e.stopImmediatePropagation()}function OE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function LE(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function np(){return this.__zoom||hn}function $E(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jE(){return navigator.maxTouchPoints||"ontouchstart"in this}function BE(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i))}function Fg(){var e=OE,t=LE,n=BE,r=$E,s=jE,o=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,a=wS,u=jl("start","zoom","end"),c,d,f,m=500,v=150,x=0,T=10;function p(y){y.property("__zoom",np).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",B).on("dblclick.zoom",D).filter(s).on("touchstart.zoom",U).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(y,I,N,O){var C=y.selection?y.selection():y;C.property("__zoom",np),y!==C?P(y,I,N,O):C.interrupt().each(function(){A(this,arguments).event(O).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},p.scaleBy=function(y,I,N,O){p.scaleTo(y,function(){var C=this.__zoom.k,S=typeof I=="function"?I.apply(this,arguments):I;return C*S},N,O)},p.scaleTo=function(y,I,N,O){p.transform(y,function(){var C=t.apply(this,arguments),S=this.__zoom,b=N==null?w(C):typeof N=="function"?N.apply(this,arguments):N,j=S.invert(b),M=typeof I=="function"?I.apply(this,arguments):I;return n(_(g(S,M),b,j),C,i)},N,O)},p.translateBy=function(y,I,N,O){p.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,O)},p.translateTo=function(y,I,N,O,C){p.transform(y,function(){var S=t.apply(this,arguments),b=this.__zoom,j=O==null?w(S):typeof O=="function"?O.apply(this,arguments):O;return n(hn.translate(j[0],j[1]).scale(b.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),S,i)},O,C)};function g(y,I){return I=Math.max(o[0],Math.min(o[1],I)),I===y.k?y:new fn(I,y.x,y.y)}function _(y,I,N){var O=I[0]-N[0]*y.k,C=I[1]-N[1]*y.k;return O===y.x&&C===y.y?y:new fn(y.k,O,C)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function P(y,I,N,O){y.on("start.zoom",function(){A(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(O).end()}).tween("zoom",function(){var C=this,S=arguments,b=A(C,S).event(O),j=t.apply(C,S),M=N==null?w(j):typeof N=="function"?N.apply(C,S):N,K=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=C.__zoom,ee=typeof I=="function"?I.apply(C,S):I,te=a(Y.invert(M).concat(K/Y.k),ee.invert(M).concat(K/ee.k));return function(pe){if(pe===1)pe=ee;else{var V=te(pe),me=K/V[2];pe=new fn(me,M[0]-V[0]*me,M[1]-V[1]*me)}b.zoom(null,pe)}})}function A(y,I,N){return!N&&y.__zooming||new R(y,I)}function R(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}R.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=bt(this.that).datum();u.call(y,this.that,new ME(y,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:u}),I)}};function $(y,...I){if(!e.apply(this,arguments))return;var N=A(this,I).event(y),O=this.__zoom,C=Math.max(o[0],Math.min(o[1],O.k*Math.pow(2,r.apply(this,arguments)))),S=Ft(y);if(N.wheel)(N.mouse[0][0]!==S[0]||N.mouse[0][1]!==S[1])&&(N.mouse[1]=O.invert(N.mouse[0]=S)),clearTimeout(N.wheel);else{if(O.k===C)return;N.mouse=[S,O.invert(S)],bi(this),N.start()}ks(y),N.wheel=setTimeout(b,v),N.zoom("mouse",n(_(g(O,C),N.mouse[0],N.mouse[1]),N.extent,i));function b(){N.wheel=null,N.end()}}function B(y,...I){if(f||!e.apply(this,arguments))return;var N=y.currentTarget,O=A(this,I,!0).event(y),C=bt(y.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",K,!0),S=Ft(y,N),b=y.clientX,j=y.clientY;Ng(y.view),Ta(y),O.mouse=[S,this.__zoom.invert(S)],bi(this),O.start();function M(Y){if(ks(Y),!O.moved){var ee=Y.clientX-b,te=Y.clientY-j;O.moved=ee*ee+te*te>x}O.event(Y).zoom("mouse",n(_(O.that.__zoom,O.mouse[0]=Ft(Y,N),O.mouse[1]),O.extent,i))}function K(Y){C.on("mousemove.zoom mouseup.zoom",null),Tg(Y.view,O.moved),ks(Y),O.event(Y).end()}}function D(y,...I){if(e.apply(this,arguments)){var N=this.__zoom,O=Ft(y.changedTouches?y.changedTouches[0]:y,this),C=N.invert(O),S=N.k*(y.shiftKey?.5:2),b=n(_(g(N,S),O,C),t.apply(this,I),i);ks(y),l>0?bt(this).transition().duration(l).call(P,b,O,y):bt(this).call(p.transform,b,O,y)}}function U(y,...I){if(e.apply(this,arguments)){var N=y.touches,O=N.length,C=A(this,I,y.changedTouches.length===O).event(y),S,b,j,M;for(Ta(y),b=0;b"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},zg=xn.error001();function be(e,t){const n=E.useContext(Dl);if(n===null)throw new Error(zg);return dg(n,e,t)}const Xe=()=>{const e=E.useContext(Dl);if(e===null)throw new Error(zg);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},zE=e=>e.userSelectionActive?"none":"all";function nd({position:e,children:t,className:n,style:r,...s}){const o=be(zE),i=`${e}`.split("-");return G.createElement("div",{className:rt(["react-flow__panel",n,...i]),style:{...r,pointerEvents:o},...s},t)}function DE({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:G.createElement(nd,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},G.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const UE=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:o={},labelBgPadding:i=[2,4],labelBgBorderRadius:l=2,children:a,className:u,...c})=>{const d=E.useRef(null),[f,m]=E.useState({x:0,y:0,width:0,height:0}),v=rt(["react-flow__edge-textwrapper",u]);return E.useEffect(()=>{if(d.current){const x=d.current.getBBox();m({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:G.createElement("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:v,visibility:f.width?"visible":"hidden",...c},s&&G.createElement("rect",{width:f.width+2*i[0],x:-i[0],y:-i[1],height:f.height+2*i[1],className:"react-flow__edge-textbg",style:o,rx:l,ry:l}),G.createElement("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r},n),a)};var HE=E.memo(UE);const rd=e=>({width:e.offsetWidth,height:e.offsetHeight}),hs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),sd=(e={x:0,y:0},t)=>({x:hs(e.x,t[0][0],t[1][0]),y:hs(e.y,t[0][1],t[1][1])}),rp=(e,t,n)=>en?-hs(Math.abs(e-n),1,50)/50:0,Dg=(e,t)=>{const n=rp(e.x,35,t.width-35)*20,r=rp(e.y,35,t.height-35)*20;return[n,r]},Ug=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Hg=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Eo=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Wg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),sp=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),WE=(e,t)=>Wg(Hg(Eo(e),Eo(t))),Vu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},VE=e=>Rt(e.width)&&Rt(e.height)&&Rt(e.x)&&Rt(e.y),Rt=e=>!isNaN(e)&&isFinite(e),Ue=Symbol.for("internals"),Vg=["Enter"," ","Escape"],GE=(e,t)=>{},YE=e=>"nativeEvent"in e;function Gu(e){var s,o;const t=YE(e)?e.nativeEvent:e,n=((o=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const Gg=e=>"clientX"in e,Hn=(e,t)=>{var o,i;const n=Gg(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},hl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Mo=({id:e,path:t,labelX:n,labelY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m=20})=>G.createElement(G.Fragment,null,G.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),m&&G.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),s&&Rt(n)&&Rt(r)?G.createElement(HE,{x:n,y:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u}):null);Mo.displayName="BaseEdge";function Ps(e,t,n){return n===void 0?n:r=>{const s=t().edges.find(o=>o.id===e);s&&n(r,{...s})}}function Yg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n{const[T,p,g]=Xg({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o});return G.createElement(Mo,{path:T,labelX:p,labelY:g,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,interactionWidth:x})});od.displayName="SimpleBezierEdge";const ip={[ie.Left]:{x:-1,y:0},[ie.Right]:{x:1,y:0},[ie.Top]:{x:0,y:-1},[ie.Bottom]:{x:0,y:1}},KE=({source:e,sourcePosition:t=ie.Bottom,target:n})=>t===ie.Left||t===ie.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function XE({source:e,sourcePosition:t=ie.Bottom,target:n,targetPosition:r=ie.Top,center:s,offset:o}){const i=ip[t],l=ip[r],a={x:e.x+i.x*o,y:e.y+i.y*o},u={x:n.x+l.x*o,y:n.y+l.y*o},c=KE({source:a,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let m=[],v,x;const T={x:0,y:0},p={x:0,y:0},[g,_,w,P]=Yg({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(i[d]*l[d]===-1){v=s.x??g,x=s.y??_;const R=[{x:v,y:a.y},{x:v,y:u.y}],$=[{x:a.x,y:x},{x:u.x,y:x}];i[d]===f?m=d==="x"?R:$:m=d==="x"?$:R}else{const R=[{x:a.x,y:u.y}],$=[{x:u.x,y:a.y}];if(d==="x"?m=i.x===f?$:R:m=i.y===f?R:$,t===r){const z=Math.abs(e[d]-n[d]);if(z<=o){const y=Math.min(o-1,o-z);i[d]===f?T[d]=(a[d]>e[d]?-1:1)*y:p[d]=(u[d]>n[d]?-1:1)*y}}if(t!==r){const z=d==="x"?"y":"x",y=i[d]===l[z],I=a[z]>u[z],N=a[z]=Q?(v=(B.x+D.x)/2,x=m[0].y):(v=m[0].x,x=(B.y+D.y)/2)}return[[e,{x:a.x+T.x,y:a.y+T.y},...m,{x:u.x+p.x,y:u.y+p.y},n],v,x,w,P]}function QE(e,t,n,r){const s=Math.min(lp(e,t)/2,lp(t,n)/2,r),{x:o,y:i}=t;if(e.x===o&&o===n.x||e.y===i&&i===n.y)return`L${o} ${i}`;if(e.y===i){const u=e.x{let _="";return g>0&&g{const[p,g,_]=Yu({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return G.createElement(Mo,{path:p,labelX:g,labelY:_,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:m,markerStart:v,interactionWidth:T})});Ul.displayName="SmoothStepEdge";const id=E.memo(e=>{var t;return G.createElement(Ul,{...e,pathOptions:E.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});id.displayName="StepEdge";function ZE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,i,l]=Yg({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,i,l]}const ld=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m})=>{const[v,x,T]=ZE({sourceX:e,sourceY:t,targetX:n,targetY:r});return G.createElement(Mo,{path:v,labelX:x,labelY:T,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:l,labelBgPadding:a,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:m})});ld.displayName="StraightEdge";function si(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ap({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case ie.Left:return[t-si(t-r,o),n];case ie.Right:return[t+si(r-t,o),n];case ie.Top:return[t,n-si(n-s,o)];case ie.Bottom:return[t,n+si(s-n,o)]}}function Qg({sourceX:e,sourceY:t,sourcePosition:n=ie.Bottom,targetX:r,targetY:s,targetPosition:o=ie.Top,curvature:i=.25}){const[l,a]=ap({pos:n,x1:e,y1:t,x2:r,y2:s,c:i}),[u,c]=ap({pos:o,x1:r,y1:s,x2:e,y2:t,c:i}),[d,f,m,v]=Kg({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:a,targetControlX:u,targetControlY:c});return[`M${e},${t} C${l},${a} ${u},${c} ${r},${s}`,d,f,m,v]}const ml=E.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:s=ie.Bottom,targetPosition:o=ie.Top,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,pathOptions:x,interactionWidth:T})=>{const[p,g,_]=Qg({sourceX:e,sourceY:t,sourcePosition:s,targetX:n,targetY:r,targetPosition:o,curvature:x==null?void 0:x.curvature});return G.createElement(Mo,{path:p,labelX:g,labelY:_,label:i,labelStyle:l,labelShowBg:a,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,interactionWidth:T})});ml.displayName="BezierEdge";const ad=E.createContext(null),qE=ad.Provider;ad.Consumer;const JE=()=>E.useContext(ad),eN=e=>"id"in e&&"source"in e&&"target"in e,tN=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,Ku=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,nN=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),rN=(e,t)=>{if(!e.source||!e.target)return t;let n;return eN(e)?n={...e}:n={...e,id:tN(e)},nN(n,t)?t:t.concat(n)},Xu=({x:e,y:t},[n,r,s],o,[i,l])=>{const a={x:(e-n)/s,y:(t-r)/s};return o?{x:i*Math.round(a.x/i),y:l*Math.round(a.y/l)}:a},Zg=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r}),dr=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],s={x:e.position.x-n,y:e.position.y-r};return{...s,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:s}},Hl=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const{x:o,y:i}=dr(s,t).positionAbsolute;return Hg(r,Eo({x:o,y:i,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Wg(n)},qg=(e,t,[n,r,s]=[0,0,1],o=!1,i=!1,l=[0,0])=>{const a={x:(t.x-n)/s,y:(t.y-r)/s,width:t.width/s,height:t.height/s},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:m=!0,hidden:v=!1}=c;if(i&&!m||v)return!1;const{positionAbsolute:x}=dr(c,l),T={x:x.x,y:x.y,width:d||0,height:f||0},p=Vu(a,T),g=typeof d>"u"||typeof f>"u"||d===null||f===null,_=o&&p>0,w=(d||0)*(f||0);(g||_||p>=w||c.dragging)&&u.push(c)}),u},Jg=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},ey=(e,t,n,r,s,o=.1)=>{const i=t/(e.width*(1+o)),l=n/(e.height*(1+o)),a=Math.min(i,l),u=hs(a,r,s),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,m=n/2-d*u;return{x:f,y:m,zoom:u}},tr=(e,t=0)=>e.transition().duration(t);function up(e,t,n,r){return(t[n]||[]).reduce((s,o)=>{var i,l;return`${e.id}-${o.id}-${n}`!==r&&s.push({id:o.id||null,type:n,nodeId:e.id,x:(((i=e.positionAbsolute)==null?void 0:i.x)??0)+o.x+o.width/2,y:(((l=e.positionAbsolute)==null?void 0:l.y)??0)+o.y+o.height/2}),s},[])}function sN(e,t,n,r,s,o){const{x:i,y:l}=Hn(e),u=t.elementsFromPoint(i,l).find(v=>v.classList.contains("react-flow__handle"));if(u){const v=u.getAttribute("data-nodeid");if(v){const x=ud(void 0,u),T=u.getAttribute("data-handleid"),p=o({nodeId:v,id:T,type:x});if(p){const g=s.find(_=>_.nodeId===v&&_.type===x&&_.id===T);return{handle:{id:T,type:x,nodeId:v,x:(g==null?void 0:g.x)||n.x,y:(g==null?void 0:g.y)||n.y},validHandleResult:p}}}}let c=[],d=1/0;if(s.forEach(v=>{const x=Math.sqrt((v.x-n.x)**2+(v.y-n.y)**2);if(x<=r){const T=o(v);x<=d&&(xv.isValid),m=c.some(({handle:v})=>v.type==="target");return c.find(({handle:v,validHandleResult:x})=>m?v.type==="target":f?x.isValid:!0)||c[0]}const oN={source:null,target:null,sourceHandle:null,targetHandle:null},ty=()=>({handleDomNode:null,isValid:!1,connection:oN,endHandle:null});function ny(e,t,n,r,s,o,i){const l=s==="target",a=i.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...ty(),handleDomNode:a};if(a){const c=ud(void 0,a),d=a.getAttribute("data-nodeid"),f=a.getAttribute("data-handleid"),m=a.classList.contains("connectable"),v=a.classList.contains("connectableend"),x={source:l?d:n,sourceHandle:l?f:r,target:l?n:d,targetHandle:l?r:f};u.connection=x,m&&v&&(t===vr.Strict?l&&c==="source"||!l&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(x))}return u}function iN({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((s,o)=>{if(o[Ue]){const{handleBounds:i}=o[Ue];let l=[],a=[];i&&(l=up(o,i,"source",`${t}-${n}-${r}`),a=up(o,i,"target",`${t}-${n}-${r}`)),s.push(...l,...a)}return s},[])}function ud(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ia(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function lN(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function ry({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:s,getState:o,setState:i,isValidConnection:l,edgeUpdaterType:a,onReconnectEnd:u}){const c=Ug(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:m,connectionRadius:v,onConnectStart:x,panBy:T,getNodes:p,cancelConnection:g}=o();let _=0,w;const{x:P,y:A}=Hn(e),R=c==null?void 0:c.elementFromPoint(P,A),$=ud(a,R),B=f==null?void 0:f.getBoundingClientRect();if(!B||!$)return;let D,U=Hn(e,B),Q=!1,z=null,y=!1,I=null;const N=iN({nodes:p(),nodeId:n,handleId:t,handleType:$}),O=()=>{if(!m)return;const[b,j]=Dg(U,B);T({x:b,y:j}),_=requestAnimationFrame(O)};i({connectionPosition:U,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:$,connectionStartHandle:{nodeId:n,handleId:t,type:$},connectionEndHandle:null}),x==null||x(e,{nodeId:n,handleId:t,handleType:$});function C(b){const{transform:j}=o();U=Hn(b,B);const{handle:M,validHandleResult:K}=sN(b,c,Xu(U,j,!1,[1,1]),v,N,Y=>ny(Y,d,n,t,s?"target":"source",l,c));if(w=M,Q||(O(),Q=!0),I=K.handleDomNode,z=K.connection,y=K.isValid,i({connectionPosition:w&&y?Zg({x:w.x,y:w.y},j):U,connectionStatus:lN(!!w,y),connectionEndHandle:K.endHandle}),!w&&!y&&!I)return Ia(D);z.source!==z.target&&I&&(Ia(D),D=I,I.classList.add("connecting","react-flow__handle-connecting"),I.classList.toggle("valid",y),I.classList.toggle("react-flow__handle-valid",y))}function S(b){var j,M;(w||I)&&z&&y&&(r==null||r(z)),(M=(j=o()).onConnectEnd)==null||M.call(j,b),a&&(u==null||u(b)),Ia(D),g(),cancelAnimationFrame(_),Q=!1,y=!1,z=null,I=null,c.removeEventListener("mousemove",C),c.removeEventListener("mouseup",S),c.removeEventListener("touchmove",C),c.removeEventListener("touchend",S)}c.addEventListener("mousemove",C),c.addEventListener("mouseup",S),c.addEventListener("touchmove",C),c.addEventListener("touchend",S)}const cp=()=>!0,aN=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),uN=(e,t,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:o,connectionClickStartHandle:i}=r;return{connecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n}},sy=E.forwardRef(({type:e="source",position:t=ie.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:i,onConnect:l,children:a,className:u,onMouseDown:c,onTouchStart:d,...f},m)=>{var B,D;const v=i||null,x=e==="target",T=Xe(),p=JE(),{connectOnClick:g,noPanClassName:_}=be(aN,Je),{connecting:w,clickConnecting:P}=be(uN(p,v,e),Je);p||(D=(B=T.getState()).onError)==null||D.call(B,"010",xn.error010());const A=U=>{const{defaultEdgeOptions:Q,onConnect:z,hasDefaultEdges:y}=T.getState(),I={...Q,...U};if(y){const{edges:N,setEdges:O}=T.getState();O(rN(I,N))}z==null||z(I),l==null||l(I)},R=U=>{if(!p)return;const Q=Gg(U);s&&(Q&&U.button===0||!Q)&&ry({event:U,handleId:v,nodeId:p,onConnect:A,isTarget:x,getState:T.getState,setState:T.setState,isValidConnection:n||T.getState().isValidConnection||cp}),Q?c==null||c(U):d==null||d(U)},$=U=>{const{onClickConnectStart:Q,onClickConnectEnd:z,connectionClickStartHandle:y,connectionMode:I,isValidConnection:N}=T.getState();if(!p||!y&&!s)return;if(!y){Q==null||Q(U,{nodeId:p,handleId:v,handleType:e}),T.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:v}});return}const O=Ug(U.target),C=n||N||cp,{connection:S,isValid:b}=ny({nodeId:p,id:v,type:e},I,y.nodeId,y.handleId||null,y.type,C,O);b&&A(S),z==null||z(U),T.setState({connectionClickStartHandle:null})};return G.createElement("div",{"data-handleid":v,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${v}-${e}`,className:rt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,u,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:o,connecting:P,connectionindicator:r&&(s&&!w||o&&w)}]),onMouseDown:R,onTouchStart:R,onClick:g?$:void 0,ref:m,...f},a)});sy.displayName="Handle";var gl=E.memo(sy);const oy=({data:e,isConnectable:t,targetPosition:n=ie.Top,sourcePosition:r=ie.Bottom})=>G.createElement(G.Fragment,null,G.createElement(gl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,G.createElement(gl,{type:"source",position:r,isConnectable:t}));oy.displayName="DefaultNode";var Qu=E.memo(oy);const iy=({data:e,isConnectable:t,sourcePosition:n=ie.Bottom})=>G.createElement(G.Fragment,null,e==null?void 0:e.label,G.createElement(gl,{type:"source",position:n,isConnectable:t}));iy.displayName="InputNode";var ly=E.memo(iy);const ay=({data:e,isConnectable:t,targetPosition:n=ie.Top})=>G.createElement(G.Fragment,null,G.createElement(gl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);ay.displayName="OutputNode";var uy=E.memo(ay);const cd=()=>null;cd.displayName="GroupNode";const cN=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),oi=e=>e.id;function dN(e,t){return Je(e.selectedNodes.map(oi),t.selectedNodes.map(oi))&&Je(e.selectedEdges.map(oi),t.selectedEdges.map(oi))}const cy=E.memo(({onSelectionChange:e})=>{const t=Xe(),{selectedNodes:n,selectedEdges:r}=be(cN,dN);return E.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChange.forEach(o=>o(s))},[n,r,e]),null});cy.displayName="SelectionListener";const fN=e=>!!e.onSelectionChange;function pN({onSelectionChange:e}){const t=be(fN);return e||t?G.createElement(cy,{onSelectionChange:e}):null}const hN=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Nr(e,t){E.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function _e(e,t,n){E.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const mN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:o,onConnectEnd:i,onClickConnectStart:l,onClickConnectEnd:a,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:m,elevateNodesOnSelect:v,minZoom:x,maxZoom:T,nodeExtent:p,onNodesChange:g,onEdgesChange:_,elementsSelectable:w,connectionMode:P,snapGrid:A,snapToGrid:R,translateExtent:$,connectOnClick:B,defaultEdgeOptions:D,fitView:U,fitViewOptions:Q,onNodesDelete:z,onEdgesDelete:y,onNodeDrag:I,onNodeDragStart:N,onNodeDragStop:O,onSelectionDrag:C,onSelectionDragStart:S,onSelectionDragStop:b,noPanClassName:j,nodeOrigin:M,rfId:K,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:te,connectionRadius:pe,isValidConnection:V,nodeDragThreshold:me})=>{const{setNodes:he,setEdges:ve,setDefaultNodesAndEdges:Se,setMinZoom:k,setMaxZoom:L,setTranslateExtent:ne,setNodeExtent:le,reset:J}=be(hN,Je),q=Xe();return E.useEffect(()=>{const H=r==null?void 0:r.map(oe=>({...oe,...D}));return Se(n,H),()=>{J()}},[]),_e("defaultEdgeOptions",D,q.setState),_e("connectionMode",P,q.setState),_e("onConnect",s,q.setState),_e("onConnectStart",o,q.setState),_e("onConnectEnd",i,q.setState),_e("onClickConnectStart",l,q.setState),_e("onClickConnectEnd",a,q.setState),_e("nodesDraggable",u,q.setState),_e("nodesConnectable",c,q.setState),_e("nodesFocusable",d,q.setState),_e("edgesFocusable",f,q.setState),_e("edgesUpdatable",m,q.setState),_e("elementsSelectable",w,q.setState),_e("elevateNodesOnSelect",v,q.setState),_e("snapToGrid",R,q.setState),_e("snapGrid",A,q.setState),_e("onNodesChange",g,q.setState),_e("onEdgesChange",_,q.setState),_e("connectOnClick",B,q.setState),_e("fitViewOnInit",U,q.setState),_e("fitViewOnInitOptions",Q,q.setState),_e("onNodesDelete",z,q.setState),_e("onEdgesDelete",y,q.setState),_e("onNodeDrag",I,q.setState),_e("onNodeDragStart",N,q.setState),_e("onNodeDragStop",O,q.setState),_e("onSelectionDrag",C,q.setState),_e("onSelectionDragStart",S,q.setState),_e("onSelectionDragStop",b,q.setState),_e("noPanClassName",j,q.setState),_e("nodeOrigin",M,q.setState),_e("rfId",K,q.setState),_e("autoPanOnConnect",Y,q.setState),_e("autoPanOnNodeDrag",ee,q.setState),_e("onError",te,q.setState),_e("connectionRadius",pe,q.setState),_e("isValidConnection",V,q.setState),_e("nodeDragThreshold",me,q.setState),Nr(e,he),Nr(t,ve),Nr(x,k),Nr(T,L),Nr($,ne),Nr(p,le),null},dp={display:"none"},gN={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dy="react-flow__node-desc",fy="react-flow__edge-desc",yN="react-flow__aria-live",_N=e=>e.ariaLiveMessage;function vN({rfId:e}){const t=be(_N);return G.createElement("div",{id:`${yN}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gN},t)}function xN({rfId:e,disableKeyboardA11y:t}){return G.createElement(G.Fragment,null,G.createElement("div",{id:`${dy}-${e}`,style:dp},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),G.createElement("div",{id:`${fy}-${e}`,style:dp},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&G.createElement(vN,{rfId:e}))}var To=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,r]=E.useState(!1),s=E.useRef(!1),o=E.useRef(new Set([])),[i,l]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return E.useEffect(()=>{const a=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||a;if(e!==null){const c=m=>{if(s.current=m.ctrlKey||m.metaKey||m.shiftKey,(!s.current||s.current&&!t.actInsideInputWithModifier)&&Gu(m))return!1;const x=pp(m.code,l);o.current.add(m[x]),fp(i,o.current,!1)&&(m.preventDefault(),r(!0))},d=m=>{if((!s.current||s.current&&!t.actInsideInputWithModifier)&&Gu(m))return!1;const x=pp(m.code,l);fp(i,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(m[x]),m.key==="Meta"&&o.current.clear(),s.current=!1},f=()=>{o.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function fp(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function pp(e,t){return t.includes(e)?"code":"key"}function py(e,t,n,r){var l,a;const s=e.parentNode||e.parentId;if(!s)return n;const o=t.get(s),i=dr(o,r);return py(o,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((l=o[Ue])==null?void 0:l.z)??0)>(n.z??0)?((a=o[Ue])==null?void 0:a.z)??0:n.z??0},r)}function hy(e,t,n){e.forEach(r=>{var o;const s=r.parentNode||r.parentId;if(s&&!e.has(s))throw new Error(`Parent node ${s} not found`);if(s||n!=null&&n[r.id]){const{x:i,y:l,z:a}=py(r,e,{...r.position,z:((o=r[Ue])==null?void 0:o.z)??0},t);r.positionAbsolute={x:i,y:l},r[Ue].z=a,n!=null&&n[r.id]&&(r[Ue].isParent=!0)}})}function Ca(e,t,n,r){const s=new Map,o={},i=r?1e3:0;return e.forEach(l=>{var m;const a=(Rt(l.zIndex)?l.zIndex:0)+(l.selected?i:0),u=t.get(l.id),c={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},d=l.parentNode||l.parentId;d&&(o[d]=!0);const f=(u==null?void 0:u.type)&&(u==null?void 0:u.type)!==l.type;Object.defineProperty(c,Ue,{enumerable:!1,value:{handleBounds:f||(m=u==null?void 0:u[Ue])==null?void 0:m.handleBounds,z:a}}),s.set(l.id,c)}),hy(s,n,o),s}function my(e,t={}){const{getNodes:n,width:r,height:s,minZoom:o,maxZoom:i,d3Zoom:l,d3Selection:a,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(l&&a&&(f||!t.initial)){const v=n().filter(T=>{var g;const p=t.includeHiddenNodes?T.width&&T.height:!T.hidden;return(g=t.nodes)!=null&&g.length?p&&t.nodes.some(_=>_.id===T.id):p}),x=v.every(T=>T.width&&T.height);if(v.length>0&&x){const T=Hl(v,d),{x:p,y:g,zoom:_}=ey(T,r,s,t.minZoom??o,t.maxZoom??i,t.padding??.1),w=hn.translate(p,g).scale(_);return typeof t.duration=="number"&&t.duration>0?l.transform(tr(a,t.duration),w):l.transform(a,w),!0}}return!1}function wN(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Ue]:r[Ue],selected:n.selected})}),new Map(t)}function SN(e,t){return t.map(n=>{const r=e.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function ii({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:s,edges:o,onNodesChange:i,onEdgesChange:l,hasDefaultNodes:a,hasDefaultEdges:u}=n();e!=null&&e.length&&(a&&r({nodeInternals:wN(e,s)}),i==null||i(e)),t!=null&&t.length&&(u&&r({edges:SN(t,o)}),l==null||l(t))}const Tr=()=>{},EN={zoomIn:Tr,zoomOut:Tr,zoomTo:Tr,getZoom:()=>1,setViewport:Tr,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Tr,fitBounds:Tr,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},NN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),TN=()=>{const e=Xe(),{d3Zoom:t,d3Selection:n}=be(NN,Je);return E.useMemo(()=>n&&t?{zoomIn:s=>t.scaleBy(tr(n,s==null?void 0:s.duration),1.2),zoomOut:s=>t.scaleBy(tr(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,o)=>t.scaleTo(tr(n,o==null?void 0:o.duration),s),getZoom:()=>e.getState().transform[2],setViewport:(s,o)=>{const[i,l,a]=e.getState().transform,u=hn.translate(s.x??i,s.y??l).scale(s.zoom??a);t.transform(tr(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[s,o,i]=e.getState().transform;return{x:s,y:o,zoom:i}},fitView:s=>my(e.getState,s),setCenter:(s,o,i)=>{const{width:l,height:a,maxZoom:u}=e.getState(),c=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:u,d=l/2-s*c,f=a/2-o*c,m=hn.translate(d,f).scale(c);t.transform(tr(n,i==null?void 0:i.duration),m)},fitBounds:(s,o)=>{const{width:i,height:l,minZoom:a,maxZoom:u}=e.getState(),{x:c,y:d,zoom:f}=ey(s,i,l,a,u,(o==null?void 0:o.padding)??.1),m=hn.translate(c,d).scale(f);t.transform(tr(n,o==null?void 0:o.duration),m)},project:s=>{const{transform:o,snapToGrid:i,snapGrid:l}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Xu(s,o,i,l)},screenToFlowPosition:s=>{const{transform:o,snapToGrid:i,snapGrid:l,domNode:a}=e.getState();if(!a)return s;const{x:u,y:c}=a.getBoundingClientRect(),d={x:s.x-u,y:s.y-c};return Xu(d,o,i,l)},flowToScreenPosition:s=>{const{transform:o,domNode:i}=e.getState();if(!i)return s;const{x:l,y:a}=i.getBoundingClientRect(),u=Zg(s,o);return{x:u.x+l,y:u.y+a}},viewportInitialized:!0}:EN,[t,n])};function dd(){const e=TN(),t=Xe(),n=E.useCallback(()=>t.getState().getNodes().map(x=>({...x})),[]),r=E.useCallback(x=>t.getState().nodeInternals.get(x),[]),s=E.useCallback(()=>{const{edges:x=[]}=t.getState();return x.map(T=>({...T}))},[]),o=E.useCallback(x=>{const{edges:T=[]}=t.getState();return T.find(p=>p.id===x)},[]),i=E.useCallback(x=>{const{getNodes:T,setNodes:p,hasDefaultNodes:g,onNodesChange:_}=t.getState(),w=T(),P=typeof x=="function"?x(w):x;if(g)p(P);else if(_){const A=P.length===0?w.map(R=>({type:"remove",id:R.id})):P.map(R=>({item:R,type:"reset"}));_(A)}},[]),l=E.useCallback(x=>{const{edges:T=[],setEdges:p,hasDefaultEdges:g,onEdgesChange:_}=t.getState(),w=typeof x=="function"?x(T):x;if(g)p(w);else if(_){const P=w.length===0?T.map(A=>({type:"remove",id:A.id})):w.map(A=>({item:A,type:"reset"}));_(P)}},[]),a=E.useCallback(x=>{const T=Array.isArray(x)?x:[x],{getNodes:p,setNodes:g,hasDefaultNodes:_,onNodesChange:w}=t.getState();if(_){const A=[...p(),...T];g(A)}else if(w){const P=T.map(A=>({item:A,type:"add"}));w(P)}},[]),u=E.useCallback(x=>{const T=Array.isArray(x)?x:[x],{edges:p=[],setEdges:g,hasDefaultEdges:_,onEdgesChange:w}=t.getState();if(_)g([...p,...T]);else if(w){const P=T.map(A=>({item:A,type:"add"}));w(P)}},[]),c=E.useCallback(()=>{const{getNodes:x,edges:T=[],transform:p}=t.getState(),[g,_,w]=p;return{nodes:x().map(P=>({...P})),edges:T.map(P=>({...P})),viewport:{x:g,y:_,zoom:w}}},[]),d=E.useCallback(({nodes:x,edges:T})=>{const{nodeInternals:p,getNodes:g,edges:_,hasDefaultNodes:w,hasDefaultEdges:P,onNodesDelete:A,onEdgesDelete:R,onNodesChange:$,onEdgesChange:B}=t.getState(),D=(x||[]).map(I=>I.id),U=(T||[]).map(I=>I.id),Q=g().reduce((I,N)=>{const O=N.parentNode||N.parentId,C=!D.includes(N.id)&&O&&I.find(b=>b.id===O);return(typeof N.deletable=="boolean"?N.deletable:!0)&&(D.includes(N.id)||C)&&I.push(N),I},[]),z=_.filter(I=>typeof I.deletable=="boolean"?I.deletable:!0),y=z.filter(I=>U.includes(I.id));if(Q||y){const I=Jg(Q,z),N=[...y,...I],O=N.reduce((C,S)=>(C.includes(S.id)||C.push(S.id),C),[]);if((P||w)&&(P&&t.setState({edges:_.filter(C=>!O.includes(C.id))}),w&&(Q.forEach(C=>{p.delete(C.id)}),t.setState({nodeInternals:new Map(p)}))),O.length>0&&(R==null||R(N),B&&B(O.map(C=>({id:C,type:"remove"})))),Q.length>0&&(A==null||A(Q),$)){const C=Q.map(S=>({id:S.id,type:"remove"}));$(C)}}},[]),f=E.useCallback(x=>{const T=VE(x),p=T?null:t.getState().nodeInternals.get(x.id);return!T&&!p?[null,null,T]:[T?x:sp(p),p,T]},[]),m=E.useCallback((x,T=!0,p)=>{const[g,_,w]=f(x);return g?(p||t.getState().getNodes()).filter(P=>{if(!w&&(P.id===_.id||!P.positionAbsolute))return!1;const A=sp(P),R=Vu(A,g);return T&&R>0||R>=g.width*g.height}):[]},[]),v=E.useCallback((x,T,p=!0)=>{const[g]=f(x);if(!g)return!1;const _=Vu(g,T);return p&&_>0||_>=g.width*g.height},[]);return E.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:s,getEdge:o,setNodes:i,setEdges:l,addNodes:a,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:m,isNodeIntersecting:v}),[e,n,r,s,o,i,l,a,u,c,d,m,v])}const IN={actInsideInputWithModifier:!1};var CN=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Xe(),{deleteElements:r}=dd(),s=To(e,IN),o=To(t);E.useEffect(()=>{if(s){const{edges:i,getNodes:l}=n.getState(),a=l().filter(c=>c.selected),u=i.filter(c=>c.selected);r({nodes:a,edges:u}),n.setState({nodesSelectionActive:!1})}},[s]),E.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function kN(e){const t=Xe();E.useEffect(()=>{let n;const r=()=>{var o,i;if(!e.current)return;const s=rd(e.current);(s.height===0||s.width===0)&&((i=(o=t.getState()).onError)==null||i.call(o,"004",xn.error004())),t.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const fd={position:"absolute",width:"100%",height:"100%",top:0,left:0},PN=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,li=e=>({x:e.x,y:e.y,zoom:e.k}),Ir=(e,t)=>e.target.closest(`.${t}`),hp=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mp=e=>{const t=e.ctrlKey&&hl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},bN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),AN=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:o=!0,panOnScroll:i=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=lr.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:m,minZoom:v,maxZoom:x,zoomActivationKeyCode:T,preventScrolling:p=!0,children:g,noWheelClassName:_,noPanClassName:w})=>{const P=E.useRef(),A=Xe(),R=E.useRef(!1),$=E.useRef(!1),B=E.useRef(null),D=E.useRef({x:0,y:0,zoom:0}),{d3Zoom:U,d3Selection:Q,d3ZoomHandler:z,userSelectionActive:y}=be(bN,Je),I=To(T),N=E.useRef(0),O=E.useRef(!1),C=E.useRef();return kN(B),E.useEffect(()=>{if(B.current){const S=B.current.getBoundingClientRect(),b=Fg().scaleExtent([v,x]).translateExtent(m),j=bt(B.current).call(b),M=hn.translate(f.x,f.y).scale(hs(f.zoom,v,x)),K=[[0,0],[S.width,S.height]],Y=b.constrain()(M,K,m);b.transform(j,Y),b.wheelDelta(mp),A.setState({d3Zoom:b,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:B.current.closest(".react-flow")})}},[]),E.useEffect(()=>{Q&&U&&(i&&!I&&!y?Q.on("wheel.zoom",S=>{if(Ir(S,_))return!1;S.preventDefault(),S.stopImmediatePropagation();const b=Q.property("__zoom").k||1;if(S.ctrlKey&&o){const V=Ft(S),me=mp(S),he=b*Math.pow(2,me);U.scaleTo(Q,he,V,S);return}const j=S.deltaMode===1?20:1;let M=a===lr.Vertical?0:S.deltaX*j,K=a===lr.Horizontal?0:S.deltaY*j;!hl()&&S.shiftKey&&a!==lr.Vertical&&(M=S.deltaY*j,K=0),U.translateBy(Q,-(M/b)*l,-(K/b)*l,{internal:!0});const Y=li(Q.property("__zoom")),{onViewportChangeStart:ee,onViewportChange:te,onViewportChangeEnd:pe}=A.getState();clearTimeout(C.current),O.current||(O.current=!0,t==null||t(S,Y),ee==null||ee(Y)),O.current&&(e==null||e(S,Y),te==null||te(Y),C.current=setTimeout(()=>{n==null||n(S,Y),pe==null||pe(Y),O.current=!1},150))},{passive:!1}):typeof z<"u"&&Q.on("wheel.zoom",function(S,b){if(!p&&S.type==="wheel"&&!S.ctrlKey||Ir(S,_))return null;S.preventDefault(),z.call(this,S,b)},{passive:!1}))},[y,i,a,Q,U,z,I,o,p,_,t,e,n]),E.useEffect(()=>{U&&U.on("start",S=>{var M,K;if(!S.sourceEvent||S.sourceEvent.internal)return null;N.current=(M=S.sourceEvent)==null?void 0:M.button;const{onViewportChangeStart:b}=A.getState(),j=li(S.transform);R.current=!0,D.current=j,((K=S.sourceEvent)==null?void 0:K.type)==="mousedown"&&A.setState({paneDragging:!0}),b==null||b(j),t==null||t(S.sourceEvent,j)})},[U,t]),E.useEffect(()=>{U&&(y&&!R.current?U.on("zoom",null):y||U.on("zoom",S=>{var j;const{onViewportChange:b}=A.getState();if(A.setState({transform:[S.transform.x,S.transform.y,S.transform.k]}),$.current=!!(r&&hp(d,N.current??0)),(e||b)&&!((j=S.sourceEvent)!=null&&j.internal)){const M=li(S.transform);b==null||b(M),e==null||e(S.sourceEvent,M)}}))},[y,U,e,d,r]),E.useEffect(()=>{U&&U.on("end",S=>{if(!S.sourceEvent||S.sourceEvent.internal)return null;const{onViewportChangeEnd:b}=A.getState();if(R.current=!1,A.setState({paneDragging:!1}),r&&hp(d,N.current??0)&&!$.current&&r(S.sourceEvent),$.current=!1,(n||b)&&PN(D.current,S.transform)){const j=li(S.transform);D.current=j,clearTimeout(P.current),P.current=setTimeout(()=>{b==null||b(j),n==null||n(S.sourceEvent,j)},i?150:0)}})},[U,i,d,n,r]),E.useEffect(()=>{U&&U.filter(S=>{const b=I||s,j=o&&S.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&S.button===1&&S.type==="mousedown"&&(Ir(S,"react-flow__node")||Ir(S,"react-flow__edge")))return!0;if(!d&&!b&&!i&&!u&&!o||y||!u&&S.type==="dblclick"||Ir(S,_)&&S.type==="wheel"||Ir(S,w)&&(S.type!=="wheel"||i&&S.type==="wheel"&&!I)||!o&&S.ctrlKey&&S.type==="wheel"||!b&&!i&&!j&&S.type==="wheel"||!d&&(S.type==="mousedown"||S.type==="touchstart")||Array.isArray(d)&&!d.includes(S.button)&&S.type==="mousedown")return!1;const M=Array.isArray(d)&&d.includes(S.button)||!S.button||S.button<=1;return(!S.ctrlKey||S.type==="wheel")&&M})},[y,U,s,o,i,u,d,c,I]),G.createElement("div",{className:"react-flow__renderer",ref:B,style:fd},g)},RN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function MN(){const{userSelectionActive:e,userSelectionRect:t}=be(RN,Je);return e&&t?G.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function gp(e,t){const n=t.parentNode||t.parentId,r=e.find(s=>s.id===n);if(r){const s=t.position.x+t.width-r.width,o=t.position.y+t.height-r.height;if(s>0||o>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),o>0&&(r.style.height+=o),t.position.x<0){const i=Math.abs(t.position.x);r.position.x=r.position.x-i,r.style.width+=i,t.position.x=0}if(t.position.y<0){const i=Math.abs(t.position.y);r.position.y=r.position.y-i,r.style.height+=i,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function ON(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,s)=>{const o=e.filter(l=>l.id===s.id);if(o.length===0)return r.push(s),r;const i={...s};for(const l of o)if(l)switch(l.type){case"select":{i.selected=l.selected;break}case"position":{typeof l.position<"u"&&(i.position=l.position),typeof l.positionAbsolute<"u"&&(i.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(i.dragging=l.dragging),i.expandParent&&gp(r,i);break}case"dimensions":{typeof l.dimensions<"u"&&(i.width=l.dimensions.width,i.height=l.dimensions.height),typeof l.updateStyle<"u"&&(i.style={...i.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(i.resizing=l.resizing),i.expandParent&&gp(r,i);break}case"remove":return r}return r.push(i),r},n)}function LN(e,t){return ON(e,t)}const Pn=(e,t)=>({id:e,type:"select",selected:t});function Vr(e,t){return e.reduce((n,r)=>{const s=t.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Pn(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Pn(r.id,!1))),n},[])}const ka=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},$N=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),gy=E.memo(({isSelecting:e,selectionMode:t=No.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:o,onPaneContextMenu:i,onPaneScroll:l,onPaneMouseEnter:a,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=E.useRef(null),m=Xe(),v=E.useRef(0),x=E.useRef(0),T=E.useRef(),{userSelectionActive:p,elementsSelectable:g,dragging:_}=be($N,Je),w=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),v.current=0,x.current=0},P=z=>{o==null||o(z),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},A=z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){z.preventDefault();return}i==null||i(z)},R=l?z=>l(z):void 0,$=z=>{const{resetSelectedElements:y,domNode:I}=m.getState();if(T.current=I==null?void 0:I.getBoundingClientRect(),!g||!e||z.button!==0||z.target!==f.current||!T.current)return;const{x:N,y:O}=Hn(z,T.current);y(),m.setState({userSelectionRect:{width:0,height:0,startX:N,startY:O,x:N,y:O}}),r==null||r(z)},B=z=>{const{userSelectionRect:y,nodeInternals:I,edges:N,transform:O,onNodesChange:C,onEdgesChange:S,nodeOrigin:b,getNodes:j}=m.getState();if(!e||!T.current||!y)return;m.setState({userSelectionActive:!0,nodesSelectionActive:!1});const M=Hn(z,T.current),K=y.startX??0,Y=y.startY??0,ee={...y,x:M.xhe.id),me=pe.map(he=>he.id);if(v.current!==me.length){v.current=me.length;const he=Vr(te,me);he.length&&(C==null||C(he))}if(x.current!==V.length){x.current=V.length;const he=Vr(N,V);he.length&&(S==null||S(he))}m.setState({userSelectionRect:ee})},D=z=>{if(z.button!==0)return;const{userSelectionRect:y}=m.getState();!p&&y&&z.target===f.current&&(P==null||P(z)),m.setState({nodesSelectionActive:v.current>0}),w(),s==null||s(z)},U=z=>{p&&(m.setState({nodesSelectionActive:v.current>0}),s==null||s(z)),w()},Q=g&&(e||p);return G.createElement("div",{className:rt(["react-flow__pane",{dragging:_,selection:e}]),onClick:Q?void 0:ka(P,f),onContextMenu:ka(A,f),onWheel:ka(R,f),onMouseEnter:Q?void 0:a,onMouseDown:Q?$:void 0,onMouseMove:Q?B:u,onMouseUp:Q?D:void 0,onMouseLeave:Q?U:c,ref:f,style:fd},d,G.createElement(MN,null))});gy.displayName="Pane";function yy(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const r=t.get(n);return r?r.selected?!0:yy(r,t):!1}function yp(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function jN(e,t,n,r){return Array.from(e.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!yy(s,e))&&(s.draggable||t&&typeof s.draggable>"u")).map(s=>{var o,i;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=s.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((i=s.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}})}function BN(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function _y(e,t,n,r,s=[0,0],o){const i=BN(e,e.extent||r);let l=i;const a=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(a&&e.width&&e.height){const d=n.get(a),{x:f,y:m}=dr(d,s).positionAbsolute;l=d&&Rt(f)&&Rt(m)&&Rt(d.width)&&Rt(d.height)?[[f+e.width*s[0],m+e.height*s[1]],[f+d.width-e.width+e.width*s[0],m+d.height-e.height+e.height*s[1]]]:l}else o==null||o("005",xn.error005()),l=i;else if(e.extent&&a&&e.extent!=="parent"){const d=n.get(a),{x:f,y:m}=dr(d,s).positionAbsolute;l=[[e.extent[0][0]+f,e.extent[0][1]+m],[e.extent[1][0]+f,e.extent[1][1]+m]]}let u={x:0,y:0};if(a){const d=n.get(a);u=dr(d,s).positionAbsolute}const c=l&&l!=="parent"?sd(t,l):t;return{position:{x:c.x-u.x,y:c.y-u.y},positionAbsolute:c}}function Pa({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[e?r.find(s=>s.id===e):r[0],r]}const _p=(e,t,n,r)=>{const s=t.querySelectorAll(e);if(!s||!s.length)return null;const o=Array.from(s),i=t.getBoundingClientRect(),l={x:i.width*r[0],y:i.height*r[1]};return o.map(a=>{const u=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(u.left-i.left-l.x)/n,y:(u.top-i.top-l.y)/n,...rd(a)}})};function bs(e,t,n){return n===void 0?n:r=>{const s=t().nodeInternals.get(e);s&&n(r,{...s})}}function Zu({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:i,nodeInternals:l,onError:a}=t.getState(),u=l.get(e);if(!u){a==null||a("012",xn.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):s([e])}function FN(){const e=Xe();return E.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:o}=e.getState(),i=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,a={x:(i-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:o?s[0]*Math.round(a.x/s[0]):a.x,ySnapped:o?s[1]*Math.round(a.y/s[1]):a.y,...a}},[])}function ba(e){return(t,n,r)=>e==null?void 0:e(t,r)}function vy({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,selectNodesOnDrag:i}){const l=Xe(),[a,u]=E.useState(!1),c=E.useRef([]),d=E.useRef({x:null,y:null}),f=E.useRef(0),m=E.useRef(null),v=E.useRef({x:0,y:0}),x=E.useRef(null),T=E.useRef(!1),p=E.useRef(!1),g=E.useRef(!1),_=FN();return E.useEffect(()=>{if(e!=null&&e.current){const w=bt(e.current),P=({x:$,y:B})=>{const{nodeInternals:D,onNodeDrag:U,onSelectionDrag:Q,updateNodePositions:z,nodeExtent:y,snapGrid:I,snapToGrid:N,nodeOrigin:O,onError:C}=l.getState();d.current={x:$,y:B};let S=!1,b={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&y){const M=Hl(c.current,O);b=Eo(M)}if(c.current=c.current.map(M=>{const K={x:$-M.distance.x,y:B-M.distance.y};N&&(K.x=I[0]*Math.round(K.x/I[0]),K.y=I[1]*Math.round(K.y/I[1]));const Y=[[y[0][0],y[0][1]],[y[1][0],y[1][1]]];c.current.length>1&&y&&!M.extent&&(Y[0][0]=M.positionAbsolute.x-b.x+y[0][0],Y[1][0]=M.positionAbsolute.x+(M.width??0)-b.x2+y[1][0],Y[0][1]=M.positionAbsolute.y-b.y+y[0][1],Y[1][1]=M.positionAbsolute.y+(M.height??0)-b.y2+y[1][1]);const ee=_y(M,K,D,Y,O,C);return S=S||M.position.x!==ee.position.x||M.position.y!==ee.position.y,M.position=ee.position,M.positionAbsolute=ee.positionAbsolute,M}),!S)return;z(c.current,!0,!0),u(!0);const j=s?U:ba(Q);if(j&&x.current){const[M,K]=Pa({nodeId:s,dragItems:c.current,nodeInternals:D});j(x.current,M,K)}},A=()=>{if(!m.current)return;const[$,B]=Dg(v.current,m.current);if($!==0||B!==0){const{transform:D,panBy:U}=l.getState();d.current.x=(d.current.x??0)-$/D[2],d.current.y=(d.current.y??0)-B/D[2],U({x:$,y:B})&&P(d.current)}f.current=requestAnimationFrame(A)},R=$=>{var O;const{nodeInternals:B,multiSelectionActive:D,nodesDraggable:U,unselectNodesAndEdges:Q,onNodeDragStart:z,onSelectionDragStart:y}=l.getState();p.current=!0;const I=s?z:ba(y);(!i||!o)&&!D&&s&&((O=B.get(s))!=null&&O.selected||Q()),s&&o&&i&&Zu({id:s,store:l,nodeRef:e});const N=_($);if(d.current=N,c.current=jN(B,U,N,s),I&&c.current){const[C,S]=Pa({nodeId:s,dragItems:c.current,nodeInternals:B});I($.sourceEvent,C,S)}};if(t)w.on(".drag",null);else{const $=Xw().on("start",B=>{const{domNode:D,nodeDragThreshold:U}=l.getState();U===0&&R(B),g.current=!1;const Q=_(B);d.current=Q,m.current=(D==null?void 0:D.getBoundingClientRect())||null,v.current=Hn(B.sourceEvent,m.current)}).on("drag",B=>{var z,y;const D=_(B),{autoPanOnNodeDrag:U,nodeDragThreshold:Q}=l.getState();if(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1&&(g.current=!0),!g.current){if(!T.current&&p.current&&U&&(T.current=!0,A()),!p.current){const I=D.xSnapped-(((z=d==null?void 0:d.current)==null?void 0:z.x)??0),N=D.ySnapped-(((y=d==null?void 0:d.current)==null?void 0:y.y)??0);Math.sqrt(I*I+N*N)>Q&&R(B)}(d.current.x!==D.xSnapped||d.current.y!==D.ySnapped)&&c.current&&p.current&&(x.current=B.sourceEvent,v.current=Hn(B.sourceEvent,m.current),P(D))}}).on("end",B=>{if(!(!p.current||g.current)&&(u(!1),T.current=!1,p.current=!1,cancelAnimationFrame(f.current),c.current)){const{updateNodePositions:D,nodeInternals:U,onNodeDragStop:Q,onSelectionDragStop:z}=l.getState(),y=s?Q:ba(z);if(D(c.current,!1,!1),y){const[I,N]=Pa({nodeId:s,dragItems:c.current,nodeInternals:U});y(B.sourceEvent,I,N)}}}).filter(B=>{const D=B.target;return!B.button&&(!n||!yp(D,`.${n}`,e))&&(!r||yp(D,r,e))});return w.call($),()=>{w.on(".drag",null)}}}},[e,t,n,r,o,l,s,i,_]),a}function xy(){const e=Xe();return E.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:o,getNodes:i,snapToGrid:l,snapGrid:a,onError:u,nodesDraggable:c}=e.getState(),d=i().filter(g=>g.selected&&(g.draggable||c&&typeof g.draggable>"u")),f=l?a[0]:5,m=l?a[1]:5,v=n.isShiftPressed?4:1,x=n.x*f*v,T=n.y*m*v,p=d.map(g=>{if(g.positionAbsolute){const _={x:g.positionAbsolute.x+x,y:g.positionAbsolute.y+T};l&&(_.x=a[0]*Math.round(_.x/a[0]),_.y=a[1]*Math.round(_.y/a[1]));const{positionAbsolute:w,position:P}=_y(g,_,r,s,void 0,u);g.position=P,g.positionAbsolute=w}return g});o(p,!0,!1)},[])}const ns={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var As=e=>{const t=({id:n,type:r,data:s,xPos:o,yPos:i,xPosOrigin:l,yPosOrigin:a,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:m,onContextMenu:v,onDoubleClick:x,style:T,className:p,isDraggable:g,isSelectable:_,isConnectable:w,isFocusable:P,selectNodesOnDrag:A,sourcePosition:R,targetPosition:$,hidden:B,resizeObserver:D,dragHandle:U,zIndex:Q,isParent:z,noDragClassName:y,noPanClassName:I,initialized:N,disableKeyboardA11y:O,ariaLabel:C,rfId:S,hasHandleBounds:b})=>{const j=Xe(),M=E.useRef(null),K=E.useRef(null),Y=E.useRef(R),ee=E.useRef($),te=E.useRef(r),pe=_||g||c||d||f||m,V=xy(),me=bs(n,j.getState,d),he=bs(n,j.getState,f),ve=bs(n,j.getState,m),Se=bs(n,j.getState,v),k=bs(n,j.getState,x),L=J=>{const{nodeDragThreshold:q}=j.getState();if(_&&(!A||!g||q>0)&&Zu({id:n,store:j,nodeRef:M}),c){const H=j.getState().nodeInternals.get(n);H&&c(J,{...H})}},ne=J=>{if(!Gu(J)&&!O)if(Vg.includes(J.key)&&_){const q=J.key==="Escape";Zu({id:n,store:j,unselect:q,nodeRef:M})}else g&&u&&Object.prototype.hasOwnProperty.call(ns,J.key)&&(j.setState({ariaLiveMessage:`Moved selected node ${J.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~i}`}),V({x:ns[J.key].x,y:ns[J.key].y,isShiftPressed:J.shiftKey}))};E.useEffect(()=>()=>{K.current&&(D==null||D.unobserve(K.current),K.current=null)},[]),E.useEffect(()=>{if(M.current&&!B){const J=M.current;(!N||!b||K.current!==J)&&(K.current&&(D==null||D.unobserve(K.current)),D==null||D.observe(J),K.current=J)}},[B,N,b]),E.useEffect(()=>{const J=te.current!==r,q=Y.current!==R,H=ee.current!==$;M.current&&(J||q||H)&&(J&&(te.current=r),q&&(Y.current=R),H&&(ee.current=$),j.getState().updateNodeDimensions([{id:n,nodeElement:M.current,forceUpdate:!0}]))},[n,r,R,$]);const le=vy({nodeRef:M,disabled:B||!g,noDragClassName:y,handleSelector:U,nodeId:n,isSelectable:_,selectNodesOnDrag:A});return B?null:G.createElement("div",{className:rt(["react-flow__node",`react-flow__node-${r}`,{[I]:g},p,{selected:u,selectable:_,parent:z,dragging:le}]),ref:M,style:{zIndex:Q,transform:`translate(${l}px,${a}px)`,pointerEvents:pe?"all":"none",visibility:N?"visible":"hidden",...T},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:he,onMouseLeave:ve,onContextMenu:Se,onClick:L,onDoubleClick:k,onKeyDown:P?ne:void 0,tabIndex:P?0:void 0,role:P?"button":void 0,"aria-describedby":O?void 0:`${dy}-${S}`,"aria-label":C},G.createElement(qE,{value:n},G.createElement(e,{id:n,data:s,type:r,xPos:o,yPos:i,selected:u,isConnectable:w,sourcePosition:R,targetPosition:$,dragging:le,dragHandle:U,zIndex:Q})))};return t.displayName="NodeWrapper",E.memo(t)};const zN=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Hl(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function DN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Xe(),{width:s,height:o,x:i,y:l,transformString:a,userSelectionActive:u}=be(zN,Je),c=xy(),d=E.useRef(null);if(E.useEffect(()=>{var v;n||(v=d.current)==null||v.focus({preventScroll:!0})},[n]),vy({nodeRef:d}),u||!s||!o)return null;const f=e?v=>{const x=r.getState().getNodes().filter(T=>T.selected);e(v,x)}:void 0,m=v=>{Object.prototype.hasOwnProperty.call(ns,v.key)&&c({x:ns[v.key].x,y:ns[v.key].y,isShiftPressed:v.shiftKey})};return G.createElement("div",{className:rt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a}},G.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m,style:{width:s,height:o,top:l,left:i}}))}var UN=E.memo(DN);const HN=e=>e.nodesSelectionActive,wy=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,deleteKeyCode:l,onMove:a,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:m,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:T,panActivationKeyCode:p,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:w,zoomOnPinch:P,panOnScroll:A,panOnScrollSpeed:R,panOnScrollMode:$,zoomOnDoubleClick:B,panOnDrag:D,defaultViewport:U,translateExtent:Q,minZoom:z,maxZoom:y,preventScrolling:I,onSelectionContextMenu:N,noWheelClassName:O,noPanClassName:C,disableKeyboardA11y:S})=>{const b=be(HN),j=To(d),M=To(p),K=M||D,Y=M||A,ee=j||f&&K!==!0;return CN({deleteKeyCode:l,multiSelectionKeyCode:T}),G.createElement(AN,{onMove:a,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:_,zoomOnScroll:w,zoomOnPinch:P,panOnScroll:Y,panOnScrollSpeed:R,panOnScrollMode:$,zoomOnDoubleClick:B,panOnDrag:!j&&K,defaultViewport:U,translateExtent:Q,minZoom:z,maxZoom:y,zoomActivationKeyCode:g,preventScrolling:I,noWheelClassName:O,noPanClassName:C},G.createElement(gy,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,panOnDrag:K,isSelecting:!!ee,selectionMode:m},e,b&&G.createElement(UN,{onSelectionContextMenu:N,noPanClassName:C,disableKeyboardA11y:S})))};wy.displayName="FlowRenderer";var WN=E.memo(wy);function VN(e){return be(E.useCallback(n=>e?qg(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function GN(e){const t={input:As(e.input||ly),default:As(e.default||Qu),output:As(e.output||uy),group:As(e.group||cd)},n={},r=Object.keys(e).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,o)=>(s[o]=As(e[o]||Qu),s),n);return{...t,...r}}const YN=({x:e,y:t,width:n,height:r,origin:s})=>!n||!r?{x:e,y:t}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:e,y:t}:{x:e-n*s[0],y:t-r*s[1]},KN=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Sy=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:o,onError:i}=be(KN,Je),l=VN(e.onlyRenderVisibleElements),a=E.useRef(),u=E.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(m=>({id:m.target.getAttribute("data-id"),nodeElement:m.target,forceUpdate:!0}));o(f)});return a.current=c,c},[]);return E.useEffect(()=>()=>{var c;(c=a==null?void 0:a.current)==null||c.disconnect()},[]),G.createElement("div",{className:"react-flow__nodes",style:fd},l.map(c=>{var P,A,R;let d=c.type||"default";e.nodeTypes[d]||(i==null||i("003",xn.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,m=!!(c.draggable||t&&typeof c.draggable>"u"),v=!!(c.selectable||s&&typeof c.selectable>"u"),x=!!(c.connectable||n&&typeof c.connectable>"u"),T=!!(c.focusable||r&&typeof c.focusable>"u"),p=e.nodeExtent?sd(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,g=(p==null?void 0:p.x)??0,_=(p==null?void 0:p.y)??0,w=YN({x:g,y:_,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return G.createElement(f,{key:c.id,id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||ie.Bottom,targetPosition:c.targetPosition||ie.Top,hidden:c.hidden,xPos:g,yPos:_,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:m,isSelectable:v,isConnectable:x,isFocusable:T,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((P=c[Ue])==null?void 0:P.z)??0,isParent:!!((A=c[Ue])!=null&&A.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!((R=c[Ue])!=null&&R.handleBounds)})}))};Sy.displayName="NodeRenderer";var XN=E.memo(Sy);const QN=(e,t,n)=>n===ie.Left?e-t:n===ie.Right?e+t:e,ZN=(e,t,n)=>n===ie.Top?e-t:n===ie.Bottom?e+t:e,vp="react-flow__edgeupdater",xp=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:i,type:l})=>G.createElement("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:i,className:rt([vp,`${vp}-${l}`]),cx:QN(t,r,e),cy:ZN(n,r,e),r,stroke:"transparent",fill:"transparent"}),qN=()=>!0;var Cr=e=>{const t=({id:n,className:r,type:s,data:o,onClick:i,onEdgeDoubleClick:l,selected:a,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:x,style:T,source:p,target:g,sourceX:_,sourceY:w,targetX:P,targetY:A,sourcePosition:R,targetPosition:$,elementsSelectable:B,hidden:D,sourceHandleId:U,targetHandleId:Q,onContextMenu:z,onMouseEnter:y,onMouseMove:I,onMouseLeave:N,reconnectRadius:O,onReconnect:C,onReconnectStart:S,onReconnectEnd:b,markerEnd:j,markerStart:M,rfId:K,ariaLabel:Y,isFocusable:ee,isReconnectable:te,pathOptions:pe,interactionWidth:V,disableKeyboardA11y:me})=>{const he=E.useRef(null),[ve,Se]=E.useState(!1),[k,L]=E.useState(!1),ne=Xe(),le=E.useMemo(()=>`url('#${Ku(M,K)}')`,[M,K]),J=E.useMemo(()=>`url('#${Ku(j,K)}')`,[j,K]);if(D)return null;const q=we=>{var Ce;const{edges:ue,addSelectedEdges:ge,unselectNodesAndEdges:Te,multiSelectionActive:ke}=ne.getState(),ye=ue.find(Ge=>Ge.id===n);ye&&(B&&(ne.setState({nodesSelectionActive:!1}),ye.selected&&ke?(Te({nodes:[],edges:[ye]}),(Ce=he.current)==null||Ce.blur()):ge([n])),i&&i(we,ye))},H=Ps(n,ne.getState,l),oe=Ps(n,ne.getState,z),W=Ps(n,ne.getState,y),re=Ps(n,ne.getState,I),ae=Ps(n,ne.getState,N),F=(we,ue)=>{if(we.button!==0)return;const{edges:ge,isValidConnection:Te}=ne.getState(),ke=ue?g:p,ye=(ue?Q:U)||null,Ce=ue?"target":"source",Ge=Te||qN,Wl=ue,_s=ge.find(Xn=>Xn.id===n);L(!0),S==null||S(we,_s,Ce);const Vl=Xn=>{L(!1),b==null||b(Xn,_s,Ce)};ry({event:we,handleId:ye,nodeId:ke,onConnect:Xn=>C==null?void 0:C(_s,Xn),isTarget:Wl,getState:ne.getState,setState:ne.setState,isValidConnection:Ge,edgeUpdaterType:Ce,onReconnectEnd:Vl})},X=we=>F(we,!0),Z=we=>F(we,!1),de=()=>Se(!0),ce=()=>Se(!1),Ne=!B&&!i,Ae=we=>{var ue;if(!me&&Vg.includes(we.key)&&B){const{unselectNodesAndEdges:ge,addSelectedEdges:Te,edges:ke}=ne.getState();we.key==="Escape"?((ue=he.current)==null||ue.blur(),ge({edges:[ke.find(Ce=>Ce.id===n)]})):Te([n])}};return G.createElement("g",{className:rt(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:a,animated:u,inactive:Ne,updating:ve}]),onClick:q,onDoubleClick:H,onContextMenu:oe,onMouseEnter:W,onMouseMove:re,onMouseLeave:ae,onKeyDown:ee?Ae:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${p} to ${g}`,"aria-describedby":ee?`${fy}-${K}`:void 0,ref:he},!k&&G.createElement(e,{id:n,source:p,target:g,selected:a,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:x,data:o,style:T,sourceX:_,sourceY:w,targetX:P,targetY:A,sourcePosition:R,targetPosition:$,sourceHandleId:U,targetHandleId:Q,markerStart:le,markerEnd:J,pathOptions:pe,interactionWidth:V}),te&&G.createElement(G.Fragment,null,(te==="source"||te===!0)&&G.createElement(xp,{position:R,centerX:_,centerY:w,radius:O,onMouseDown:X,onMouseEnter:de,onMouseOut:ce,type:"source"}),(te==="target"||te===!0)&&G.createElement(xp,{position:$,centerX:P,centerY:A,radius:O,onMouseDown:Z,onMouseEnter:de,onMouseOut:ce,type:"target"})))};return t.displayName="EdgeWrapper",E.memo(t)};function JN(e){const t={default:Cr(e.default||ml),straight:Cr(e.bezier||ld),step:Cr(e.step||id),smoothstep:Cr(e.step||Ul),simplebezier:Cr(e.simplebezier||od)},n={},r=Object.keys(e).filter(s=>!["default","bezier"].includes(s)).reduce((s,o)=>(s[o]=Cr(e[o]||ml),s),n);return{...t,...r}}function wp(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,s=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,i=(n==null?void 0:n.height)||t.height;switch(e){case ie.Top:return{x:r+o/2,y:s};case ie.Right:return{x:r+o,y:s+i/2};case ie.Bottom:return{x:r+o/2,y:s+i};case ie.Left:return{x:r,y:s+i/2}}}function Sp(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const eT=(e,t,n,r,s,o)=>{const i=wp(n,e,t),l=wp(o,r,s);return{sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}};function tT({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:o,width:i,height:l,transform:a}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+s),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Eo({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:i/a[2],height:l/a[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function Ep(e){var r,s,o,i,l;const t=((r=e==null?void 0:e[Ue])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)||0,y:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const nT=[{level:0,isMaxLevel:!0,edges:[]}];function rT(e,t,n=!1){let r=-1;const s=e.reduce((i,l)=>{var c,d;const a=Rt(l.zIndex);let u=a?l.zIndex:0;if(n){const f=t.get(l.target),m=t.get(l.source),v=l.selected||(f==null?void 0:f.selected)||(m==null?void 0:m.selected),x=Math.max(((c=m==null?void 0:m[Ue])==null?void 0:c.z)||0,((d=f==null?void 0:f[Ue])==null?void 0:d.z)||0,1e3);u=(a?l.zIndex:0)+(v?x:0)}return i[u]?i[u].push(l):i[u]=[l],r=u>r?u:r,i},{}),o=Object.entries(s).map(([i,l])=>{const a=+i;return{edges:l,level:a,isMaxLevel:a===r}});return o.length===0?nT:o}function sT(e,t,n){const r=be(E.useCallback(s=>e?s.edges.filter(o=>{const i=t.get(o.source),l=t.get(o.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&tT({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[e,t]));return rT(r,t,n)}const oT=({color:e="none",strokeWidth:t=1})=>G.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),iT=({color:e="none",strokeWidth:t=1})=>G.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Np={[xr.Arrow]:oT,[xr.ArrowClosed]:iT};function lT(e){const t=Xe();return E.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(Np,e)?Np[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",xn.error009(e)),null)},[e])}const aT=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:i,orient:l="auto-start-reverse"})=>{const a=lT(t);return a?G.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:l,refX:"0",refY:"0"},G.createElement(a,{color:n,strokeWidth:i})):null},uT=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((s,o)=>([o.markerStart,o.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const l=Ku(i,t);r.includes(l)||(s.push({id:l,color:i.color||e,...i}),r.push(l))}}),s),[]).sort((s,o)=>s.id.localeCompare(o.id))},Ey=({defaultColor:e,rfId:t})=>{const n=be(E.useCallback(uT({defaultColor:e,rfId:t}),[e,t]),(r,s)=>!(r.length!==s.length||r.some((o,i)=>o.id!==s[i].id)));return G.createElement("defs",null,n.map(r=>G.createElement(aT,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};Ey.displayName="MarkerDefinitions";var cT=E.memo(Ey);const dT=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Ny=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:o,onEdgeContextMenu:i,onEdgeMouseEnter:l,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:c,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:v,reconnectRadius:x,children:T,disableKeyboardA11y:p})=>{const{edgesFocusable:g,edgesUpdatable:_,elementsSelectable:w,width:P,height:A,connectionMode:R,nodeInternals:$,onError:B}=be(dT,Je),D=sT(t,$,n);return P?G.createElement(G.Fragment,null,D.map(({level:U,edges:Q,isMaxLevel:z})=>G.createElement("svg",{key:U,style:{zIndex:U},width:P,height:A,className:"react-flow__edges react-flow__container"},z&&G.createElement(cT,{defaultColor:e,rfId:r}),G.createElement("g",null,Q.map(y=>{const[I,N,O]=Ep($.get(y.source)),[C,S,b]=Ep($.get(y.target));if(!O||!b)return null;let j=y.type||"default";s[j]||(B==null||B("011",xn.error011(j)),j="default");const M=s[j]||s.default,K=R===vr.Strict?S.target:(S.target??[]).concat(S.source??[]),Y=Sp(N.source,y.sourceHandle),ee=Sp(K,y.targetHandle),te=(Y==null?void 0:Y.position)||ie.Bottom,pe=(ee==null?void 0:ee.position)||ie.Top,V=!!(y.focusable||g&&typeof y.focusable>"u"),me=y.reconnectable||y.updatable,he=typeof f<"u"&&(me||_&&typeof me>"u");if(!Y||!ee)return B==null||B("008",xn.error008(Y,y)),null;const{sourceX:ve,sourceY:Se,targetX:k,targetY:L}=eT(I,Y,te,C,ee,pe);return G.createElement(M,{key:y.id,id:y.id,className:rt([y.className,o]),type:j,data:y.data,selected:!!y.selected,animated:!!y.animated,hidden:!!y.hidden,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,style:y.style,source:y.source,target:y.target,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerEnd:y.markerEnd,markerStart:y.markerStart,sourceX:ve,sourceY:Se,targetX:k,targetY:L,sourcePosition:te,targetPosition:pe,elementsSelectable:w,onContextMenu:i,onMouseEnter:l,onMouseMove:a,onMouseLeave:u,onClick:c,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:v,reconnectRadius:x,rfId:r,ariaLabel:y.ariaLabel,isFocusable:V,isReconnectable:he,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth,disableKeyboardA11y:p})})))),T):null};Ny.displayName="EdgeRenderer";var fT=E.memo(Ny);const pT=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function hT({children:e}){const t=be(pT);return G.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function mT(e){const t=dd(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const gT={[ie.Left]:ie.Right,[ie.Right]:ie.Left,[ie.Top]:ie.Bottom,[ie.Bottom]:ie.Top},Ty=({nodeId:e,handleType:t,style:n,type:r=Rn.Bezier,CustomComponent:s,connectionStatus:o})=>{var A,R,$;const{fromNode:i,handleId:l,toX:a,toY:u,connectionMode:c}=be(E.useCallback(B=>({fromNode:B.nodeInternals.get(e),handleId:B.connectionHandleId,toX:(B.connectionPosition.x-B.transform[0])/B.transform[2],toY:(B.connectionPosition.y-B.transform[1])/B.transform[2],connectionMode:B.connectionMode}),[e]),Je),d=(A=i==null?void 0:i[Ue])==null?void 0:A.handleBounds;let f=d==null?void 0:d[t];if(c===vr.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!i||!f)return null;const m=l?f.find(B=>B.id===l):f[0],v=m?m.x+m.width/2:(i.width??0)/2,x=m?m.y+m.height/2:i.height??0,T=(((R=i.positionAbsolute)==null?void 0:R.x)??0)+v,p=((($=i.positionAbsolute)==null?void 0:$.y)??0)+x,g=m==null?void 0:m.position,_=g?gT[g]:null;if(!g||!_)return null;if(s)return G.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:i,fromHandle:m,fromX:T,fromY:p,toX:a,toY:u,fromPosition:g,toPosition:_,connectionStatus:o});let w="";const P={sourceX:T,sourceY:p,sourcePosition:g,targetX:a,targetY:u,targetPosition:_};return r===Rn.Bezier?[w]=Qg(P):r===Rn.Step?[w]=Yu({...P,borderRadius:0}):r===Rn.SmoothStep?[w]=Yu(P):r===Rn.SimpleBezier?[w]=Xg(P):w=`M${T},${p} ${a},${u}`,G.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};Ty.displayName="ConnectionLine";const yT=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function _T({containerStyle:e,style:t,type:n,component:r}){const{nodeId:s,handleType:o,nodesConnectable:i,width:l,height:a,connectionStatus:u}=be(yT,Je);return!(s&&o&&l&&i)?null:G.createElement("svg",{style:e,width:l,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},G.createElement("g",{className:rt(["react-flow__connection",u])},G.createElement(Ty,{nodeId:s,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})))}function Tp(e,t){return E.useRef(null),Xe(),E.useMemo(()=>t(e),[e])}const Iy=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:o,onNodeClick:i,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:v,onSelectionStart:x,onSelectionEnd:T,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:_,connectionLineContainerStyle:w,selectionKeyCode:P,selectionOnDrag:A,selectionMode:R,multiSelectionKeyCode:$,panActivationKeyCode:B,zoomActivationKeyCode:D,deleteKeyCode:U,onlyRenderVisibleElements:Q,elementsSelectable:z,selectNodesOnDrag:y,defaultViewport:I,translateExtent:N,minZoom:O,maxZoom:C,preventScrolling:S,defaultMarkerColor:b,zoomOnScroll:j,zoomOnPinch:M,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:te,panOnDrag:pe,onPaneClick:V,onPaneMouseEnter:me,onPaneMouseMove:he,onPaneMouseLeave:ve,onPaneScroll:Se,onPaneContextMenu:k,onEdgeContextMenu:L,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:q,onReconnectStart:H,onReconnectEnd:oe,reconnectRadius:W,noDragClassName:re,noWheelClassName:ae,noPanClassName:F,elevateEdgesOnSelect:X,disableKeyboardA11y:Z,nodeOrigin:de,nodeExtent:ce,rfId:Ne})=>{const Ae=Tp(e,GN),we=Tp(t,JN);return mT(o),G.createElement(WN,{onPaneClick:V,onPaneMouseEnter:me,onPaneMouseMove:he,onPaneMouseLeave:ve,onPaneContextMenu:k,onPaneScroll:Se,deleteKeyCode:U,selectionKeyCode:P,selectionOnDrag:A,selectionMode:R,onSelectionStart:x,onSelectionEnd:T,multiSelectionKeyCode:$,panActivationKeyCode:B,zoomActivationKeyCode:D,elementsSelectable:z,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:j,zoomOnPinch:M,zoomOnDoubleClick:te,panOnScroll:K,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:pe,defaultViewport:I,translateExtent:N,minZoom:O,maxZoom:C,onSelectionContextMenu:v,preventScrolling:S,noDragClassName:re,noWheelClassName:ae,noPanClassName:F,disableKeyboardA11y:Z},G.createElement(hT,null,G.createElement(fT,{edgeTypes:we,onEdgeClick:l,onEdgeDoubleClick:u,onlyRenderVisibleElements:Q,onEdgeContextMenu:L,onEdgeMouseEnter:ne,onEdgeMouseMove:le,onEdgeMouseLeave:J,onReconnect:q,onReconnectStart:H,onReconnectEnd:oe,reconnectRadius:W,defaultMarkerColor:b,noPanClassName:F,elevateEdgesOnSelect:!!X,disableKeyboardA11y:Z,rfId:Ne},G.createElement(_T,{style:g,type:p,component:_,containerStyle:w})),G.createElement("div",{className:"react-flow__edgelabel-renderer"}),G.createElement(XN,{nodeTypes:Ae,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,selectNodesOnDrag:y,onlyRenderVisibleElements:Q,noPanClassName:F,noDragClassName:re,disableKeyboardA11y:Z,nodeOrigin:de,nodeExtent:ce,rfId:Ne})))};Iy.displayName="GraphView";var vT=E.memo(Iy);const qu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],En={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:qu,nodeExtent:qu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:vr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:GE,isValidConnection:void 0},xT=()=>lx((e,t)=>({...En,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:o}=t();e({nodeInternals:Ca(n,r,s,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",o=typeof r<"u",i=s?Ca(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:i,edges:o?r:[],hasDefaultNodes:s,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:o,fitViewOnInitDone:i,fitViewOnInitOptions:l,domNode:a,nodeOrigin:u}=t(),c=a==null?void 0:a.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),m=n.reduce((x,T)=>{const p=s.get(T.id);if(p!=null&&p.hidden)s.set(p.id,{...p,[Ue]:{...p[Ue],handleBounds:void 0}});else if(p){const g=rd(T.nodeElement);!!(g.width&&g.height&&(p.width!==g.width||p.height!==g.height||T.forceUpdate))&&(s.set(p.id,{...p,[Ue]:{...p[Ue],handleBounds:{source:_p(".source",T.nodeElement,f,u),target:_p(".target",T.nodeElement,f,u)}},...g}),x.push({id:p.id,type:"dimensions",dimensions:g}))}return x},[]);hy(s,u);const v=i||o&&!i&&my(t,{initial:!0,...l});e({nodeInternals:new Map(s),fitViewOnInitDone:v}),(m==null?void 0:m.length)>0&&(r==null||r(m))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:o}=t(),i=n.map(l=>{const a={id:l.id,type:"position",dragging:s};return r&&(a.positionAbsolute=l.positionAbsolute,a.position=l.position),a});o(i)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:o,nodeOrigin:i,getNodes:l,elevateNodesOnSelect:a}=t();if(n!=null&&n.length){if(o){const u=LN(n,l()),c=Ca(u,s,i,a);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let i,l=null;r?i=n.map(a=>Pn(a,!0)):(i=Vr(o(),n),l=Vr(s,[])),ii({changedNodes:i,changedEdges:l,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=t();let i,l=null;r?i=n.map(a=>Pn(a,!0)):(i=Vr(s,n),l=Vr(o(),[])),ii({changedNodes:l,changedEdges:i,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:o}=t(),i=n||o(),l=r||s,a=i.map(c=>(c.selected=!1,Pn(c.id,!1))),u=l.map(c=>Pn(c.id,!1));ii({changedNodes:a,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=t();r==null||r.scaleExtent([n,s]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=t();r==null||r.scaleExtent([s,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(l=>l.selected).map(l=>Pn(l.id,!1)),i=n.filter(l=>l.selected).map(l=>Pn(l.id,!1));ii({changedNodes:o,changedEdges:i,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(s=>{s.positionAbsolute=sd(s.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:o,d3Zoom:i,d3Selection:l,translateExtent:a}=t();if(!i||!l||!n.x&&!n.y)return!1;const u=hn.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[s,o]],d=i==null?void 0:i.constrain()(u,c,a);return i.transform(l,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:En.connectionNodeId,connectionHandleId:En.connectionHandleId,connectionHandleType:En.connectionHandleType,connectionStatus:En.connectionStatus,connectionStartHandle:En.connectionStartHandle,connectionEndHandle:En.connectionEndHandle}),reset:()=>e({...En})}),Object.is),Cy=({children:e})=>{const t=E.useRef(null);return t.current||(t.current=xT()),G.createElement(FE,{value:t.current},e)};Cy.displayName="ReactFlowProvider";const ky=({children:e})=>E.useContext(Dl)?G.createElement(G.Fragment,null,e):G.createElement(Cy,null,e);ky.displayName="ReactFlowWrapper";const wT={input:ly,default:Qu,output:uy,group:cd},ST={default:ml,straight:ld,step:id,smoothstep:Ul,simplebezier:od},ET=[0,0],NT=[15,15],TT={x:0,y:0,zoom:1},IT={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Py=E.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o=wT,edgeTypes:i=ST,onNodeClick:l,onEdgeClick:a,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:m,onConnectStart:v,onConnectEnd:x,onClickConnectStart:T,onClickConnectEnd:p,onNodeMouseEnter:g,onNodeMouseMove:_,onNodeMouseLeave:w,onNodeContextMenu:P,onNodeDoubleClick:A,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:B,onNodesDelete:D,onEdgesDelete:U,onSelectionChange:Q,onSelectionDragStart:z,onSelectionDrag:y,onSelectionDragStop:I,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:C,connectionMode:S=vr.Strict,connectionLineType:b=Rn.Bezier,connectionLineStyle:j,connectionLineComponent:M,connectionLineContainerStyle:K,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:te=!1,selectionMode:pe=No.Full,panActivationKeyCode:V="Space",multiSelectionKeyCode:me=hl()?"Meta":"Control",zoomActivationKeyCode:he=hl()?"Meta":"Control",snapToGrid:ve=!1,snapGrid:Se=NT,onlyRenderVisibleElements:k=!1,selectNodesOnDrag:L=!0,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,nodeOrigin:q=ET,edgesFocusable:H,edgesUpdatable:oe,elementsSelectable:W,defaultViewport:re=TT,minZoom:ae=.5,maxZoom:F=2,translateExtent:X=qu,preventScrolling:Z=!0,nodeExtent:de,defaultMarkerColor:ce="#b1b1b7",zoomOnScroll:Ne=!0,zoomOnPinch:Ae=!0,panOnScroll:we=!1,panOnScrollSpeed:ue=.5,panOnScrollMode:ge=lr.Free,zoomOnDoubleClick:Te=!0,panOnDrag:ke=!0,onPaneClick:ye,onPaneMouseEnter:Ce,onPaneMouseMove:Ge,onPaneMouseLeave:Wl,onPaneScroll:_s,onPaneContextMenu:Vl,children:pd,onEdgeContextMenu:Xn,onEdgeDoubleClick:Oy,onEdgeMouseEnter:Ly,onEdgeMouseMove:$y,onEdgeMouseLeave:jy,onEdgeUpdate:By,onEdgeUpdateStart:Fy,onEdgeUpdateEnd:zy,onReconnect:Dy,onReconnectStart:Uy,onReconnectEnd:Hy,reconnectRadius:Wy=10,edgeUpdaterRadius:Vy=10,onNodesChange:Gy,onEdgesChange:Yy,noDragClassName:Ky="nodrag",noWheelClassName:Xy="nowheel",noPanClassName:hd="nopan",fitView:Qy=!1,fitViewOptions:Zy,connectOnClick:qy=!0,attributionPosition:Jy,proOptions:e0,defaultEdgeOptions:t0,elevateNodesOnSelect:n0=!0,elevateEdgesOnSelect:r0=!1,disableKeyboardA11y:md=!1,autoPanOnConnect:s0=!0,autoPanOnNodeDrag:o0=!0,connectionRadius:i0=20,isValidConnection:l0,onError:a0,style:u0,id:gd,nodeDragThreshold:c0,...d0},f0)=>{const Gl=gd||"1";return G.createElement("div",{...d0,style:{...u0,...IT},ref:f0,className:rt(["react-flow",s]),"data-testid":"rf__wrapper",id:gd},G.createElement(ky,null,G.createElement(vT,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:l,onEdgeClick:a,onNodeMouseEnter:g,onNodeMouseMove:_,onNodeMouseLeave:w,onNodeContextMenu:P,onNodeDoubleClick:A,nodeTypes:o,edgeTypes:i,connectionLineType:b,connectionLineStyle:j,connectionLineComponent:M,connectionLineContainerStyle:K,selectionKeyCode:ee,selectionOnDrag:te,selectionMode:pe,deleteKeyCode:Y,multiSelectionKeyCode:me,panActivationKeyCode:V,zoomActivationKeyCode:he,onlyRenderVisibleElements:k,selectNodesOnDrag:L,defaultViewport:re,translateExtent:X,minZoom:ae,maxZoom:F,preventScrolling:Z,zoomOnScroll:Ne,zoomOnPinch:Ae,zoomOnDoubleClick:Te,panOnScroll:we,panOnScrollSpeed:ue,panOnScrollMode:ge,panOnDrag:ke,onPaneClick:ye,onPaneMouseEnter:Ce,onPaneMouseMove:Ge,onPaneMouseLeave:Wl,onPaneScroll:_s,onPaneContextMenu:Vl,onSelectionContextMenu:N,onSelectionStart:O,onSelectionEnd:C,onEdgeContextMenu:Xn,onEdgeDoubleClick:Oy,onEdgeMouseEnter:Ly,onEdgeMouseMove:$y,onEdgeMouseLeave:jy,onReconnect:Dy??By,onReconnectStart:Uy??Fy,onReconnectEnd:Hy??zy,reconnectRadius:Wy??Vy,defaultMarkerColor:ce,noDragClassName:Ky,noWheelClassName:Xy,noPanClassName:hd,elevateEdgesOnSelect:r0,rfId:Gl,disableKeyboardA11y:md,nodeOrigin:q,nodeExtent:de}),G.createElement(mN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:v,onConnectEnd:x,onClickConnectStart:T,onClickConnectEnd:p,nodesDraggable:ne,nodesConnectable:le,nodesFocusable:J,edgesFocusable:H,edgesUpdatable:oe,elementsSelectable:W,elevateNodesOnSelect:n0,minZoom:ae,maxZoom:F,nodeExtent:de,onNodesChange:Gy,onEdgesChange:Yy,snapToGrid:ve,snapGrid:Se,connectionMode:S,translateExtent:X,connectOnClick:qy,defaultEdgeOptions:t0,fitView:Qy,fitViewOptions:Zy,onNodesDelete:D,onEdgesDelete:U,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:B,onSelectionDrag:y,onSelectionDragStart:z,onSelectionDragStop:I,noPanClassName:hd,nodeOrigin:q,rfId:Gl,autoPanOnConnect:s0,autoPanOnNodeDrag:o0,onError:a0,connectionRadius:i0,isValidConnection:l0,nodeDragThreshold:c0}),G.createElement(pN,{onSelectionChange:Q}),pd,G.createElement(DE,{proOptions:e0,position:Jy}),G.createElement(xN,{rfId:Gl,disableKeyboardA11y:md})))});Py.displayName="ReactFlow";const by=({id:e,x:t,y:n,width:r,height:s,style:o,color:i,strokeColor:l,strokeWidth:a,className:u,borderRadius:c,shapeRendering:d,onClick:f,selected:m})=>{const{background:v,backgroundColor:x}=o||{},T=i||v||x;return G.createElement("rect",{className:rt(["react-flow__minimap-node",{selected:m},u]),x:t,y:n,rx:c,ry:c,width:r,height:s,fill:T,stroke:l,strokeWidth:a,shapeRendering:d,onClick:f?p=>f(p,e):void 0})};by.displayName="MiniMapNode";var CT=E.memo(by);const kT=e=>e.nodeOrigin,PT=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Aa=e=>e instanceof Function?e:()=>e;function bT({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:o=CT,onClick:i}){const l=be(PT,Je),a=be(kT),u=Aa(t),c=Aa(e),d=Aa(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return G.createElement(G.Fragment,null,l.map(m=>{const{x:v,y:x}=dr(m,a).positionAbsolute;return G.createElement(o,{key:m.id,x:v,y:x,width:m.width,height:m.height,style:m.style,selected:m.selected,className:d(m),color:u(m),borderRadius:r,strokeColor:c(m),strokeWidth:s,shapeRendering:f,onClick:i,id:m.id})}))}var AT=E.memo(bT);const RT=200,MT=150,OT=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?WE(Hl(t,e.nodeOrigin),n):n,rfId:e.rfId}},LT="react-flow__minimap-desc";function Ay({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:a="rgb(240, 240, 240, 0.6)",maskStrokeColor:u="none",maskStrokeWidth:c=1,position:d="bottom-right",onClick:f,onNodeClick:m,pannable:v=!1,zoomable:x=!1,ariaLabel:T="React Flow mini map",inversePan:p=!1,zoomStep:g=10,offsetScale:_=5}){const w=Xe(),P=E.useRef(null),{boundingRect:A,viewBB:R,rfId:$}=be(OT,Je),B=(e==null?void 0:e.width)??RT,D=(e==null?void 0:e.height)??MT,U=A.width/B,Q=A.height/D,z=Math.max(U,Q),y=z*B,I=z*D,N=_*z,O=A.x-(y-A.width)/2-N,C=A.y-(I-A.height)/2-N,S=y+N*2,b=I+N*2,j=`${LT}-${$}`,M=E.useRef(0);M.current=z,E.useEffect(()=>{if(P.current){const ee=bt(P.current),te=me=>{const{transform:he,d3Selection:ve,d3Zoom:Se}=w.getState();if(me.sourceEvent.type!=="wheel"||!ve||!Se)return;const k=-me.sourceEvent.deltaY*(me.sourceEvent.deltaMode===1?.05:me.sourceEvent.deltaMode?1:.002)*g,L=he[2]*Math.pow(2,k);Se.scaleTo(ve,L)},pe=me=>{const{transform:he,d3Selection:ve,d3Zoom:Se,translateExtent:k,width:L,height:ne}=w.getState();if(me.sourceEvent.type!=="mousemove"||!ve||!Se)return;const le=M.current*Math.max(1,he[2])*(p?-1:1),J={x:he[0]-me.sourceEvent.movementX*le,y:he[1]-me.sourceEvent.movementY*le},q=[[0,0],[L,ne]],H=hn.translate(J.x,J.y).scale(he[2]),oe=Se.constrain()(H,q,k);Se.transform(ve,oe)},V=Fg().on("zoom",v?pe:null).on("zoom.wheel",x?te:null);return ee.call(V),()=>{ee.on("zoom",null)}}},[v,x,p,g]);const K=f?ee=>{const te=Ft(ee);f(ee,{x:te[0],y:te[1]})}:void 0,Y=m?(ee,te)=>{const pe=w.getState().nodeInternals.get(te);m(ee,pe)}:void 0;return G.createElement(nd,{position:d,style:e,className:rt(["react-flow__minimap",t]),"data-testid":"rf__minimap"},G.createElement("svg",{width:B,height:D,viewBox:`${O} ${C} ${S} ${b}`,role:"img","aria-labelledby":j,ref:P,onClick:K},T&&G.createElement("title",{id:j},T),G.createElement(AT,{onClick:Y,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:i,nodeComponent:l}),G.createElement("path",{className:"react-flow__minimap-mask",d:`M${O-N},${C-N}h${S+N*2}v${b+N*2}h${-S-N*2}z + M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fill:a,fillRule:"evenodd",stroke:u,strokeWidth:c,pointerEvents:"none"})))}Ay.displayName="MiniMap";var $T=E.memo(Ay);function jT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},G.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function BT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},G.createElement("path",{d:"M0 0h32v4.2H0z"}))}function FT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},G.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function zT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function DT(){return G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},G.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Gr=({children:e,className:t,...n})=>G.createElement("button",{type:"button",className:rt(["react-flow__controls-button",t]),...n},e);Gr.displayName="ControlButton";const UT=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Ry=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:i,onFitView:l,onInteractiveChange:a,className:u,children:c,position:d="bottom-left"})=>{const f=Xe(),[m,v]=E.useState(!1),{isInteractive:x,minZoomReached:T,maxZoomReached:p}=be(UT,Je),{zoomIn:g,zoomOut:_,fitView:w}=dd();if(E.useEffect(()=>{v(!0)},[]),!m)return null;const P=()=>{g(),o==null||o()},A=()=>{_(),i==null||i()},R=()=>{w(s),l==null||l()},$=()=>{f.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),a==null||a(!x)};return G.createElement(nd,{className:rt(["react-flow__controls",u]),position:d,style:e,"data-testid":"rf__controls"},t&&G.createElement(G.Fragment,null,G.createElement(Gr,{onClick:P,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},G.createElement(jT,null)),G.createElement(Gr,{onClick:A,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:T},G.createElement(BT,null))),n&&G.createElement(Gr,{className:"react-flow__controls-fitview",onClick:R,title:"fit view","aria-label":"fit view"},G.createElement(FT,null)),r&&G.createElement(Gr,{className:"react-flow__controls-interactive",onClick:$,title:"toggle interactivity","aria-label":"toggle interactivity"},x?G.createElement(DT,null):G.createElement(zT,null)),c)};Ry.displayName="Controls";var HT=E.memo(Ry),Vt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Vt||(Vt={}));function WT({color:e,dimensions:t,lineWidth:n}){return G.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function VT({color:e,radius:t}){return G.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const GT={[Vt.Dots]:"#91919a",[Vt.Lines]:"#eee",[Vt.Cross]:"#e2e2e2"},YT={[Vt.Dots]:1,[Vt.Lines]:1,[Vt.Cross]:6},KT=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function My({id:e,variant:t=Vt.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=2,color:i,style:l,className:a}){const u=E.useRef(null),{transform:c,patternId:d}=be(KT,Je),f=i||GT[t],m=r||YT[t],v=t===Vt.Dots,x=t===Vt.Cross,T=Array.isArray(n)?n:[n,n],p=[T[0]*c[2]||1,T[1]*c[2]||1],g=m*c[2],_=x?[g,g]:p,w=v?[g/o,g/o]:[_[0]/o,_[1]/o];return G.createElement("svg",{className:rt(["react-flow__background",a]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:u,"data-testid":"rf__background"},G.createElement("pattern",{id:d+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${w[0]},-${w[1]})`},v?G.createElement(VT,{color:f,radius:g/o}):G.createElement(WT,{dimensions:_,color:f,lineWidth:s})),G.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${d+e})`}))}My.displayName="Background";var XT=E.memo(My);const Ra=320,Ma=120,Ip=["#94a3b8","#60a5fa","#22d3ee","#34d399"],QT=["rgba(226, 232, 240, 0.28)","rgba(219, 234, 254, 0.28)","rgba(207, 250, 254, 0.28)","rgba(209, 250, 229, 0.24)"],ZT=88,qT=120,JT=72,e2=58,Qe=100,ze=30,nr=96,Oa=22,La=6,Cp=10,t2=20,kp=240,ai=300,$a=168,ja=74,Pp=58,Rs=48,n2=87,r2=26,s2=30,o2=.36,i2=240,l2=.35,a2=1.8,u2=Qe*2+nr+60;function c2(e,t,n){const r=Math.min(176,Math.max(104,e.length*7.4)),s=Math.min(112,Math.max(66,n(t).length*6.1+14));return r+s+n2+r2}function d2(e,t,n){const r=Math.min(220,Math.max(96,e.length*8)),s=Math.min(122,Math.max(66,n(t).length*6.1+14));return r+s+s2}function ui(e,t,n,r){return e<=0?r:e*t+Math.max(0,e-1)*n+r}function ci(e,t=40){return e.length<=t?e:`${e.slice(0,Math.max(1,t-1))}…`}function Ju(e){const t=je(e),n=t.split("/");return n.length<=3?t:`${n[n.length-2]}/${n[n.length-1]}`}function Ms(e){const t=e.split(".");return t[t.length-1]||e}function Xt(e,t){const n=e.trim().length>0?e.trim():Ju(t),r=n.split("/");return r.length>0?r[r.length-1]??n:n}function it(e){if(!e)return null;const t=e.replace(/^builtins\./,""),n=t.split("."),r=n.length>0?n[n.length-1]:t;return r.length<=16?r:`${r.slice(0,15)}…`}function Ba(e){return e.collectionKind!==null&&e.direction==="unknown"}function di(e){return`stream:${e}`}function f2(...e){return Math.max(1,e.reduce((t,n)=>t+(n.length>0?1:0),0))}function Ai(e){const t=e.split("/");return t.length<=2?e:t.slice(Math.max(0,t.length-3)).join("/")}function Fa(e,t,n){return[e,t,n].join(` `)}function Nn(e,t){const n=[e.address];return e.msgType&&n.push(`Message Type: ${e.msgType}`),t==="collection"&&e.collectionKind==="topic"&&n.push("Collection Topic"),t==="collection"&&e.collectionKind==="relay"&&n.push("Collection Relay"),n.join(` -`)}function kr(e,t,n){return n==="collection"&&e.collectionKind?"mono topology-stream-label is-collection":`mono topology-stream-label ${t}`}function Pr(e,t,n,r){return n==="collection"&&e.collectionKind?e.collectionKind==="topic"?t==="is-output"?{border:r?"1px solid #fb923c":"1px solid #f28e2b",background:r?"#2e1f10":"#fff1dd",color:r?"#fed7aa":"#8a4f10",borderRadius:999}:t==="is-input"?{border:r?"1px solid #f59e0b":"1px solid #f6a44d",background:r?"#2a2115":"#fff8ef",color:r?"#fdba74":"#8a4f10",borderRadius:999}:{border:r?"1px solid #fb923c":"1px solid #f8b66f",background:r?"#2a2115":"#fff8ef",color:r?"#fdba74":"#8a4f10",borderRadius:999}:t==="is-output"?{border:r?"1px solid #d8b4fe":"1px solid #b07aa1",background:r?"#2a1d3a":"#f8eef5",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:t==="is-input"?{border:r?"1px solid #c084fc":"1px solid #c194b7",background:r?"#251b33":"#fbf3f8",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:{border:r?"1px solid #d8b4fe":"1px solid #b07aa1",background:r?"#2a1d3a":"#f8eef5",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:{border:t==="is-input"?r?"1px solid #818cf8":"1px solid #c7d2fe":t==="is-output"?r?"1px solid #22d3ee":"1px solid #7dd3fc":r?"1px solid #4b5563":"1px solid #cbd5e1",background:t==="is-input"?r?"#1d2644":"#eef2ff":t==="is-output"?r?"#0f2e37":"#ecfeff":r?"#182235":"#f8fafc",color:r?"#dbeafe":"#1e293b",borderRadius:t==="is-unknown"?8:999}}function Yr(e){return e.trim().toUpperCase().replace(/^INPUT_/,"").replace(/^OUTPUT_/,"").replace(/^TOPIC_/,"")}function f2(e){const t=new Set,n=new Map,r=new Map;for(const s of e){t.add(s.address);const o=je(s.address);n.set(o,s.address),r.set(Yr(s.name),s.address),r.set(Yr(Xt(s.name,s.address)),s.address),r.set(Yr(o),s.address);const i=o.split("/").pop();i&&r.set(Yr(i),s.address)}return{addressSet:t,withoutEndpointMap:n,normalizedNameMap:r}}function di(e,t){if(!e)return null;if(t.addressSet.has(e))return e;if(t.withoutEndpointMap.has(e))return t.withoutEndpointMap.get(e)??null;const n=e.split(":")[0];if(t.withoutEndpointMap.has(n))return t.withoutEndpointMap.get(n)??null;const r=Yr(e);if(t.normalizedNameMap.has(r))return t.normalizedNameMap.get(r)??null;const s=Yr(n.split("/").pop()??"");if(t.normalizedNameMap.has(s))return t.normalizedNameMap.get(s)??null;for(const o of t.addressSet)if(o.startsWith(`${e}:`)||o.startsWith(`${n}:`))return o;return null}function p2(e){return typeof e=="object"&&e!==null&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)}function h2(e){if(!Array.isArray(e.nodes)||!Array.isArray(e.edges))return!1;const t=new Set;for(const n of e.nodes)if(!n||typeof n.id!="string"||n.id.length===0||t.has(n.id)||(t.add(n.id),!p2(n.position)))return!1;for(const n of e.nodes)if(typeof n.parentNode=="string"&&!t.has(n.parentNode))return!1;for(const n of e.edges)if(!n||typeof n.source!="string"||typeof n.target!="string"||!t.has(n.source)||!t.has(n.target))return!1;return!0}function m2(e,t,n,r,s,o){var ve,Se;const i=r==="orthogonal"?"step":r==="smooth"?"smoothstep":"default",{units:l,collections:a}=Kc(e),u=Al(a),c=bu(l,a,n),d=new Map,f=new Map;for(const k of c){const L=l.get(k);if(L){d.set(k,L);continue}const ne=a.get(k);ne&&f.set(k,ne)}const m=new Set(d.keys()),v=new Set(f.keys()),x=Rl(a),T=n?a.get(n)??null:null,p=T?`scope:${T.address}`:null,g=T?T.streams.filter(La):[],_=new Map(g.map(k=>[ci(k.address),k])),w=new Map,P=new Map;for(const k of l.values())for(const L of k.streams)w.set(L.address,k.address),w.set(je(L.address),k.address);for(const k of a.values())for(const L of k.streams)P.set(L.address,k.address),P.set(je(L.address),k.address);for(const[k,L]of u.collectionByInternalTopic.entries())P.set(k,L);const A=new Map;for(const k of l.values())for(const L of k.streams)A.set(L.address,L.address),A.set(je(L.address),L.address);for(const k of a.values())for(const L of k.streams)A.set(L.address,L.address),A.set(je(L.address),L.address);for(const[k,L]of u.endpointByInternalTopic.entries())A.set(k,L);const R=k=>A.get(k)??A.get(je(k))??k,$=[];for(const[k,L]of Object.entries(e.graph))for(const ne of L){const le=R(k),J=R(ne);le!==J&&$.push({from:le,to:J})}const B=new Map,D=(k,L)=>{B.set(k,L),B.set(je(k),L)};for(const k of d.values())for(const L of k.streams)D(L.address,{ownerId:`unit:${k.address}`,ownerKind:"unit"});for(const k of f.values())for(const L of k.streams)D(L.address,{ownerId:`collection:${k.address}`,ownerKind:"collection"});for(const k of g)D(k.address,{ownerId:ci(k.address),ownerKind:"scope_collection_stream"});const U=new Set(B.keys()),Q=$.filter(k=>U.has(k.from)||U.has(k.to)),z=new Set(U);for(const k of Q)z.add(k.from),z.add(k.to);const y=new Set,I=new Map;for(const k of d.values()){const L=`unit:${k.address}`;y.add(L),I.set(L,k.name)}for(const k of f.values()){const L=`collection:${k.address}`;y.add(L),I.set(L,k.name)}for(const k of g){const L=ci(k.address);y.add(L),I.set(L,Xt(k.name,k.address))}for(const k of z){if(B.has(k))continue;const L=P.get(k),ne=w.get(k);if(L&&v.has(L)){D(k,{ownerId:`collection:${L}`,ownerKind:"collection"});continue}if(ne&&m.has(ne)){D(k,{ownerId:`unit:${ne}`,ownerKind:"unit"});continue}if(T&&p&&(L&&Au(L,T.address,x)||ne&&Au(ne,T.address,x))){D(k,{ownerId:p,ownerKind:"scope_collection"});continue}const le=ne??L??null;if(le){let q=x.get(le)??null;for(;q;){if(v.has(q)){D(k,{ownerId:`collection:${q}`,ownerKind:"collection_proxy"});break}q=x.get(q)??null}if(B.has(k))continue}const J=`orphan:${k}`;D(k,{ownerId:J,ownerKind:"orphan"}),y.add(J),I.set(J,Qu(k))}const N=[],O=new Set;for(const k of Q){const L=(ve=B.get(k.from))==null?void 0:ve.ownerId,ne=(Se=B.get(k.to))==null?void 0:Se.ownerId;if(!L||!ne||L===ne||!y.has(L)||!y.has(ne))continue;const le=`${L}->${ne}`;O.has(le)||(O.add(le),N.push({from:L,to:ne}))}const C=Array.from(y).sort((k,L)=>{const ne=I.get(k)??k,le=I.get(L)??L;return ne.localeCompare(le)}),S=r1(C,N),b=new Map;for(const k of C){const L=S.get(k)??0,ne=b.get(L);ne?ne.push(k):b.set(L,[k])}const j=new Map;for(const k of d.values()){const L=k.streams.filter(X=>X.direction==="input").length,ne=k.streams.filter(X=>X.direction==="output").length,le=k.streams.filter(X=>X.direction==="unknown").length,J=k.tasks.length,q=Math.max(1,L,ne,J,le),H=c2(k.name,k.componentType,Ms),oe=ai(q,Qe,Ra,22),W=ai(J,nr,Cp,e2),re=t==="lr"?Math.max(a2,H):Math.max(220,H,oe,W);if(t==="lr"){const X=Math.max(1,L,ne,J),Z=Math.max(126,Rs+16+X*30+(le>0?ze+12:0)+12);j.set(`unit:${k.address}`,{width:re,height:Z});continue}const ae=Math.max(1,(L>0?1:0)+(J>0?1:0)+(le>0?1:0)+(ne>0?1:0)),F=Math.max(216,Rs+18+ae*ze+Math.max(0,ae-1)*12+16);j.set(`unit:${k.address}`,{width:re,height:F})}for(const k of f.values()){const L=k.streams.filter(Z=>Z.direction==="input"),ne=k.streams.filter(Z=>Z.direction==="output"),le=k.streams.filter(La),J=L.length,q=ne.length,H=le.length,oe=d2(L,le,ne),W=Math.max(1,J,q,H),re=Math.max(t==="lr"?li:300,ai(W,Qe,Ra,22)),ae=u2(k.name,k.componentType,Ms),F=Math.max(re,ae),X=t==="lr"?Math.max(124,Oa+16+Math.max(1,J,H,q)*30+12):Math.max(176,Oa+18+oe*ze+Math.max(0,oe-1)*12+16);j.set(`collection:${k.address}`,{width:F,height:X})}for(const k of g)j.set(ci(k.address),{width:Qe,height:ze});for(const k of C)j.has(k)||j.set(k,{width:kp,height:74});const M=new Map,K=Array.from(b.keys()).sort((k,L)=>k-L);if(t==="tb"){let k=28;for(const L of K){const ne=b.get(L)??[];let le=24,J=0;for(const q of ne){const H=j.get(q)??{width:Pa,height:ba};M.set(q,{x:le,y:k}),le+=H.width+qT,J=Math.max(J,H.height)}k+=J+QT}}else{let k=24;for(const L of K){const ne=b.get(L)??[];let le=28,J=0;for(const q of ne){const H=j.get(q)??{width:Pa,height:ba};M.set(q,{x:k,y:le}),le+=H.height+JT,J=Math.max(J,H.width)}k+=J+ZT}}const Y=[],ee=[],te={stroke:s?"#8fa3bc":"#475569",strokeWidth:1.5},pe={type:xr.ArrowClosed,width:12,height:12,color:s?"#8fa3bc":"#475569"};function V(k,L,ne,le,J,q,H,oe){if(ne.length===0)return;const W=L.width-22,re=ne.length*Qe,ae=ne.length>1?Math.max(6,Math.min(16,Math.floor((W-re)/(ne.length-1)))):0,F=re+ae*Math.max(0,ne.length-1),X=11+Math.max(0,Math.floor((W-F)/2));ne.forEach((Z,de)=>{const ce=Pr(Z,J,q,s),Ne=X+de*(Qe+ae);oe.push({id:`stream:${Z.address}`,parentNode:k,extent:"parent",draggable:!1,data:{label:h.jsxs("span",{className:kr(Z,J,q),title:Nn(Z,q),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(Z.name,Z.address)}),it(Z.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(Z.msgType),"]"]}):null]})},position:{x:Ne,y:le},sourcePosition:H==="tb"?ie.Bottom:ie.Right,targetPosition:H==="tb"?ie.Top:ie.Left,style:{width:Qe,height:ze,borderRadius:ce.borderRadius,border:ce.border,background:ce.background,color:ce.color,fontSize:8,padding:"0 6px"}})})}if(T&&p){const k=C.filter(ue=>ue.startsWith("unit:")||ue.startsWith("collection:")||_.has(ue));let L=24,ne=32,le=24+li,J=32+Ma;if(k.length>0){L=Number.POSITIVE_INFINITY,ne=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(const ue of k){const ge=M.get(ue),Te=j.get(ue);!ge||!Te||(L=Math.min(L,ge.x),ne=Math.min(ne,ge.y),le=Math.max(le,ge.x+Te.width),J=Math.max(J,ge.y+Te.height))}(!Number.isFinite(L)||!Number.isFinite(ne))&&(L=24,ne=32,le=24+li,J=32+Ma)}const q=T.streams.filter(ue=>ue.direction==="input"),H=T.streams.filter(ue=>ue.direction==="output"),oe=Math.max(1,q.length,H.length),W=ai(oe,Qe,Ra,24),re=q.length>0,ae=H.length>0,F=t==="lr"?72:76,X=t==="lr"?108:64,Z=28,de=t==="lr"?Math.max(X,F+Math.max(1,q.length,H.length)*30+8):Math.max(X,F+(re?ze+8:0)),ce=t==="tb"?ae?Math.max(Pp,ze+20):20:Pp,Ne=Math.max(0,J-ne),Ae={x:L-Z,y:ne-de},we={width:Math.max(360,le-L+Z*2,W+Z*2),height:Math.max(180,Ne+de+ce)};if(k.length>0){const ue=(L+le)/2,ge=Ae.x+Z,Te=Ae.x+we.width-Z,ke=(ge+Te)/2,ye=Math.round(ke-ue);if(ye!==0)for(const Ce of k){const Ge=M.get(Ce);Ge&&M.set(Ce,{x:Ge.x+ye,y:Ge.y})}}if(Y.push({id:p,position:Ae,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"topology-collection-label topology-collection-label--scope",title:$a(T.name,T.address,T.componentType),children:[h.jsxs("span",{className:"topology-title-row topology-title-row--collection",children:[h.jsxs("span",{className:"topology-title-row",children:[h.jsx("strong",{children:T.name}),h.jsx("span",{className:"topology-unit-type",title:T.componentType,children:Ms(T.componentType)})]}),h.jsx("button",{type:"button","data-scope-up":"true",className:"topology-collection-scope-up-btn nodrag nopan",title:"Go up one scope","aria-label":`Go up from ${T.name}`,onPointerDown:ue=>{ue.stopPropagation()},onMouseDown:ue=>{ue.stopPropagation()},onClick:ue=>{var ge;ue.stopPropagation(),(ge=o==null?void 0:o.goUpFromScope)==null||ge.call(o,T.address)},children:"↑ Up"})]}),h.jsx("span",{className:"mono",children:bi(T.address)})]})},style:{width:we.width,height:we.height,border:`2px dashed ${s?"#4b647e":Ip[0]}`,borderRadius:14,background:s?"rgba(15, 23, 42, 0.45)":"rgba(226, 232, 240, 0.24)",color:s?"#e2e8f0":"#0f172a",padding:10,zIndex:-1},draggable:!1,selectable:!1}),t==="lr"){const Te=Math.max(1,q.length,H.length)*30,ke=Math.max(F,de-Te-8);q.forEach((ye,Ce)=>{const Ge=Pr(ye,"is-input","collection",s);Y.push({id:`stream:${ye.address}`,parentNode:p,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(ye,"is-input","collection"),title:Nn(ye,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ye.name,ye.address)}),it(ye.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ye.msgType),"]"]}):null]})},position:{x:12,y:ke+Ce*30},style:{width:Qe,height:ze,borderRadius:Ge.borderRadius,border:Ge.border,background:Ge.background,color:Ge.color,padding:"0 6px"}})}),H.forEach((ye,Ce)=>{const Ge=Pr(ye,"is-output","collection",s);Y.push({id:`stream:${ye.address}`,parentNode:p,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(ye,"is-output","collection"),title:Nn(ye,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ye.name,ye.address)}),it(ye.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ye.msgType),"]"]}):null]})},position:{x:we.width-Qe-12,y:ke+Ce*30},style:{width:Qe,height:ze,borderRadius:Ge.borderRadius,border:Ge.border,background:Ge.background,color:Ge.color,padding:"0 6px"}})})}else{const ue=F,ge=de+Ne,Te=Math.min(we.height-ze-10,ge+Math.max(6,Math.floor((ce-ze)/2)));V(p,we,q,ue,"is-input","collection",t,Y),V(p,we,H,Te,"is-output","collection",t,Y)}for(const ue of k){const ge=_.get(ue);if(!ge)continue;const Te=M.get(ue);if(!Te)continue;const ke=Pr(ge,"is-unknown","collection",s);Y.push({id:ue,parentNode:p,extent:"parent",draggable:!1,data:{label:h.jsxs("span",{className:kr(ge,"is-unknown","collection"),title:Nn(ge,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ge.name,ge.address)}),it(ge.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ge.msgType),"]"]}):null]})},position:{x:Te.x-Ae.x,y:Te.y-Ae.y},sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,style:{width:Qe,height:ze,borderRadius:ke.borderRadius,border:ke.border,background:ke.background,color:ke.color,fontSize:8,padding:"0 6px"}})}}for(const k of f.values()){const L=`collection:${k.address}`,ne=M.get(L)??{x:0,y:0},le=j.get(L)??{width:li,height:Ma};Y.push({id:L,position:ne,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"topology-collection-label",title:$a(k.name,k.address,k.componentType),children:[h.jsxs("span",{className:"topology-title-row topology-title-row--collection",children:[h.jsxs("span",{className:"topology-title-row",children:[h.jsx("strong",{children:k.name}),h.jsx("span",{className:"topology-unit-type",title:k.componentType,children:Ms(k.componentType)})]}),h.jsx("button",{type:"button","data-open-collection":"true",className:"topology-collection-open-btn nodrag nopan",title:"Open collection scope","aria-label":`Open ${k.name} scope`,onPointerDown:oe=>{oe.stopPropagation()},onMouseDown:oe=>{oe.stopPropagation()},onClick:oe=>{var W;oe.stopPropagation(),(W=o==null?void 0:o.openCollectionScope)==null||W.call(o,k.address)},children:"Open"})]}),h.jsx("span",{className:"mono",children:bi(k.address)})]})},style:{width:le.width,height:le.height,border:`2px dashed ${s?"#4f8ccf":Ip[1]}`,borderRadius:12,background:s?"rgba(30, 58, 95, 0.34)":XT[1],color:s?"#e2e8f0":"#0f172a",padding:10}});const J=k.streams.filter(oe=>oe.direction==="input"),q=k.streams.filter(oe=>oe.direction==="output"),H=k.streams.filter(La);if(t==="lr"){const W=Oa+6;J.forEach((re,ae)=>{const F=Pr(re,"is-input","collection",s);Y.push({id:`stream:${re.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(re,"is-input","collection"),title:Nn(re,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(re.name,re.address)}),it(re.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(re.msgType),"]"]}):null]})},position:{x:10,y:W+ae*30},style:{width:Qe,height:ze,borderRadius:F.borderRadius,border:F.border,background:F.background,color:F.color,padding:"0 6px"}})}),q.forEach((re,ae)=>{const F=Pr(re,"is-output","collection",s);Y.push({id:`stream:${re.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(re,"is-output","collection"),title:Nn(re,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(re.name,re.address)}),it(re.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(re.msgType),"]"]}):null]})},position:{x:le.width-Qe-10,y:W+ae*30},style:{width:Qe,height:ze,borderRadius:F.borderRadius,border:F.border,background:F.background,color:F.color,padding:"0 6px"}})}),V(L,le,H,W,"is-unknown","collection",t,Y)}else{const W=Math.max(86+ze+10,le.height-ze-12),re=Math.min(W-ze-12,Math.floor((86+W)/2));V(L,le,J,86,"is-input","collection",t,Y),V(L,le,H,re,"is-unknown","collection",t,Y),V(L,le,q,W,"is-output","collection",t,Y)}}for(const k of d.values()){const L=`unit:${k.address}`,ne=M.get(L)??{x:0,y:0},le=j.get(L)??{width:Pa,height:ba},J=k.streams.filter(re=>re.direction==="input"),q=k.streams.filter(re=>re.direction==="output"),H=k.streams.filter(re=>re.direction==="unknown"),oe=new Set(k.streams.map(re=>re.address)),W=f2(k.streams);if(Y.push({id:L,position:ne,data:{label:h.jsxs("div",{className:"topology-unit-label",children:[h.jsxs("span",{className:"topology-title-row",title:$a(k.name,k.address,k.componentType),children:[h.jsx("strong",{children:k.name}),h.jsx("span",{className:"topology-unit-type",title:k.componentType,children:Ms(k.componentType)})]}),h.jsx("span",{className:"mono topology-unit-address",title:k.address,children:ui(bi(k.address),34)})]})},style:{width:le.width,height:le.height,border:s?"1px solid #3b82f6":"1px solid #93c5fd",borderRadius:12,background:s?"#0f1f35":"#f8fbff",padding:10}}),t==="lr"){const re=Rs+6;J.forEach((ae,F)=>{Y.push({id:`stream:${ae.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:"mono topology-stream-label is-input",title:Nn(ae,"unit"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ae.name,ae.address)}),it(ae.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ae.msgType),"]"]}):null]})},position:{x:10,y:re+F*30},style:{width:Qe,height:ze,borderRadius:999,border:s?"1px solid #818cf8":"1px solid #c7d2fe",background:s?"#1d2644":"#eef2ff",padding:"0 6px"}})}),q.forEach((ae,F)=>{Y.push({id:`stream:${ae.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:"mono topology-stream-label is-output",title:Nn(ae,"unit"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ae.name,ae.address)}),it(ae.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ae.msgType),"]"]}):null]})},position:{x:le.width-Qe-10,y:re+F*30},style:{width:Qe,height:ze,borderRadius:999,border:s?"1px solid #22d3ee":"1px solid #7dd3fc",background:s?"#0f2e37":"#ecfeff",padding:"0 6px"}})}),k.tasks.forEach((ae,F)=>{const X=`task:${k.address}:${ae.name}`,Z=di(ae.subscribes,W),de=Array.from(new Set(ae.publishes.map(ce=>di(ce,W)).filter(ce=>ce!==null)));Y.push({id:X,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsx("span",{className:"mono topology-task-label",title:ae.name,children:ui(ae.name,15)})},position:{x:Math.floor((le.width-nr)/2),y:re+F*30+4},style:{width:nr,height:Aa,borderRadius:999,border:s?"1px solid #41536c":"1px solid #dbe2ea",background:s?"#1a273a":"#f1f5f9",padding:"0 6px"}}),Z&&oe.has(Z)&&ee.push({id:`edge:internal:${k.address}:${ae.name}:sub`,source:`stream:${Z}`,target:X,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te});for(const ce of de)oe.has(ce)&&ee.push({id:`edge:internal:${k.address}:${ae.name}:${ce}`,source:X,target:`stream:${ce}`,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te})}),H.length>0&&V(L,le,H,le.height-ze-8,"is-unknown","unit",t,Y)}else{const re=Rs+ze+12,ae=le.height-ze-12,F=ae-8,X=re+Math.max(0,Math.floor((F-re-Aa)/2));V(L,le,J,Rs+2,"is-input","unit",t,Y),V(L,le,q,ae,"is-output","unit",t,Y),H.length>0&&V(L,le,H,X+28,"is-unknown","unit",t,Y);const Z=k.tasks.length,de=le.width-20,ce=Z*nr,Ne=Z>1?Math.max(Cp,Math.min(22,Math.floor((de-ce)/(Z-1)))):0,Ae=ce+Ne*Math.max(0,Z-1),we=10+Math.max(0,Math.floor((de-Ae)/2));k.tasks.forEach((ue,ge)=>{const Te=`task:${k.address}:${ue.name}`,ke=di(ue.subscribes,W),ye=Array.from(new Set(ue.publishes.map(Ce=>di(Ce,W)).filter(Ce=>Ce!==null)));Y.push({id:Te,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Bottom,targetPosition:ie.Top,data:{label:h.jsx("span",{className:"mono topology-task-label",title:ue.name,children:ui(ue.name,15)})},position:{x:we+ge*(nr+Ne),y:X},style:{width:nr,height:Aa,borderRadius:999,border:s?"1px solid #41536c":"1px solid #dbe2ea",background:s?"#1a273a":"#f1f5f9",padding:"0 6px"}}),ke&&oe.has(ke)&&ee.push({id:`edge:internal:${k.address}:tb:${ue.name}:sub`,source:`stream:${ke}`,target:Te,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te});for(const Ce of ye)oe.has(Ce)&&ee.push({id:`edge:internal:${k.address}:tb:${ue.name}:${Ce}`,source:Te,target:`stream:${Ce}`,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te})})}}for(const k of z){const L=B.get(k);if(L&&L.ownerKind!=="orphan")continue;const ne=`orphan:${k}`,le=M.get(ne)??{x:0,y:0};Y.push({id:`stream:${k}`,position:le,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"mono topology-orphan-label",children:[h.jsx("strong",{children:Qu(k)}),h.jsx("span",{children:ui(k,54)})]})},style:{width:kp,border:s?"1px solid #41536c":"1px solid #dbe2ea",borderRadius:10,background:s?"#111c2e":"#ffffff",padding:6}})}const me=k=>{const L=B.get(k);return L?L.ownerKind==="unit"||L.ownerKind==="collection"||L.ownerKind==="scope_collection"||L.ownerKind==="orphan"?`stream:${k}`:L.ownerId:`stream:${k}`},he=k=>{var L;return((L=B.get(k))==null?void 0:L.ownerId)??null};for(const k of Q){const L=me(k.from),ne=me(k.to);if(L===ne)continue;const le=he(k.from),J=he(k.to);if(!(le&&J&&le===J&&le.startsWith("scope:"))&&!(le&&J&&le===J&&le.startsWith("collection:"))){if(le&&J&&le===J&&le.startsWith("unit:")){const q=d.get(le.slice(5));if(q&&q.tasks.length>0)continue}ee.push({id:`edge:${k.from}->${k.to}`,source:L,target:ne,type:i,zIndex:1,markerEnd:{type:xr.ArrowClosed,width:12,height:12,color:s?"#8fa3bc":"#64748b"},style:{stroke:s?"#8fa3bc":"#64748b",strokeWidth:1.2}})}}return{nodes:Y,edges:ee}}function g2(e){const t=new Map;if(!e)return t;for(const r of e.units.values())for(const s of r.streams)t.set(s.address,s.address),t.set(je(s.address),s.address);for(const r of e.collections.values())for(const s of r.streams)t.set(s.address,s.address),t.set(je(s.address),s.address);const n=Al(e.collections);for(const[r,s]of n.endpointByInternalTopic.entries())t.set(r,s);return t}function y2(e,t){const n=new Set;for(const r of e){const s=t.get(r)??t.get(je(r))??null;s&&(n.add(s),n.add(je(s)))}return n}function _2(e,t,n){if(!e||t.size===0)return t;const r=new Map;for(const[l,a]of Object.entries(e.graph)){const u=n.get(l)??n.get(je(l))??l,c=r.get(u)??[];for(const d of a){const f=n.get(d)??n.get(je(d))??d;c.push(f)}r.set(u,c)}const s=new Set,o=Array.from(t);for(;o.length>0;){const l=o.shift();if(!l||s.has(l))continue;s.add(l);const a=r.get(l)??[];for(const u of a)s.has(u)||o.push(u)}const i=new Set;for(const l of s)i.add(l),i.add(je(l));return i}function v2(e,t){if(t.size===0||e.edges.length===0)return e;const n=a=>{if(!a)return!1;const u=je(a);return t.has(a)||t.has(u)},r=new Map;e.edges.forEach((a,u)=>{const c=r.get(a.source);c?c.push(u):r.set(a.source,[u])});const s=new Set,o=new Set,i=[],l=a=>{o.has(a)||(o.add(a),i.push(a))};for(e.edges.forEach((a,u)=>{const c=a.source.startsWith("stream:")?a.source.slice(7):null,d=x2(a.id);n(c??d)&&(s.add(u),l(a.target))});i.length>0;){const a=i.shift();if(!a)continue;const u=r.get(a);if(!(!u||u.length===0))for(const c of u)s.has(c)||(s.add(c),l(e.edges[c].target))}return s.size===0?e:{nodes:e.nodes,edges:e.edges.map((a,u)=>{if(!s.has(u)||typeof a.className=="string"&&a.className.includes("topology-internal-edge"))return a;const d=typeof a.markerEnd=="object"&&a.markerEnd!==null?{...a.markerEnd,color:"#2563eb"}:{type:xr.ArrowClosed,width:12,height:12,color:"#2563eb"};return{...a,animated:!0,markerEnd:d,style:{...a.style??{},stroke:"#2563eb",strokeWidth:1.7}}})}}function x2(e){if(!e.startsWith("edge:")||e.startsWith("edge:internal:"))return null;const t=e.slice(5),n=t.indexOf("->");if(n<=0)return null;const r=t.slice(0,n);return r.length>0?r:null}function w2(e){const t=new Map;if(!e)return t;for(const n of e.units.values())for(const r of n.streams){const s={direction:r.direction,unitAddress:n.address};t.set(r.address,s),t.set(je(r.address),s)}return t}function S2(e){const t=new Map;if(!e)return t;const n=(r,s)=>{const o=s.split(":").slice(1).join(":");o.length>0&&!t.has(o)&&t.set(o,r)};for(const r of e.units.values())for(const s of r.streams)n(r.address,s.address);for(const r of e.collections.values())for(const s of r.streams)n(r.address,s.address);return t}function E2(e,t,n){if(!e)return null;const{topic:r,endpointToken:s}=bl(n);let o=-1,i=null;const l=(a,u,c)=>{const d=N2(t,u,c,r,s);d>o&&(o=d,i=a)};for(const a of e.units.values())for(const u of a.streams)l(a.address,u.address,u.direction);for(const a of e.collections.values())for(const u of a.streams)l(a.address,u.address,u.direction);return o>0?i:null}function N2(e,t,n,r,s){if(e==="publisher"&&n!=="output"||e==="subscriber"&&n!=="input")return-1;let o=0;const i=je(t);return r.length>0&&(i===r?o+=12:t.startsWith(`${r}:`)?o+=8:t.includes(r)&&(o+=2)),s.length>0&&(t.endsWith(`:${s}`)?o+=14:t.includes(s)&&(o+=7)),o}function T2(e,t,n){if(e.kind!=="publisher"&&e.kind!=="subscriber")return null;const r=e.streamAddress.split(":").slice(1).join(":");return e.unitAddress??t.get(r)??n(e.kind,e.streamAddress)??null}function I2(e,t,n,r){if(e.kind==="unit")return`unit:${e.unitAddress}`;if(e.kind==="collection")return`collection:${e.collectionAddress}`;if(t&&(r!=null&&r.units.has(t)))return`unit:${t}`;if(t&&(r!=null&&r.collections.has(t)))return`collection:${t}`;const s=e.streamAddress;if(!s)return null;const o=s.split(":").slice(1).join(":"),i=s.split(":")[0]??"",l=n.nodes.find(a=>{if(!a.id.startsWith("stream:"))return!1;const u=a.id.slice(7);return u.includes(o)||u.startsWith(i)});return(l==null?void 0:l.id)??null}function C2({autoFocusOnSelection:e,focusSelection:t,focusRequestId:n,flowInitTick:r,flowInstanceRef:s,flowData:o,topologyComponents:i,activeScope:l,parentCollectionByAddress:a,componentAddressByEndpointId:u,componentAddressByStreamSelection:c,setScopeCollectionAddress:d}){const f=E.useRef(0),m=E.useRef(null),v=E.useRef(null);E.useEffect(()=>{if(!e||!t||n<=0||f.current===n||!s.current)return;const T=T2(t,u,c),p=t.kind==="unit"?t.unitAddress:t.kind==="collection"?t.collectionAddress:T;if(p&&i){const P=a.get(p)??null;if(P!==l){m.current=n,d(P);return}}const g=I2(t,T,o,i);if(!g||!o.nodes.some(P=>P.id===g))return;const _=()=>{const P=s.current;if(!P){v.current=null;return}P.fitView({nodes:[{id:g}],padding:s2,duration:o2,minZoom:i2,maxZoom:l2}),f.current=n,m.current=null,v.current=null};if(m.current===n){if(v.current===n)return;v.current=n,requestAnimationFrame(()=>{requestAnimationFrame(_)});return}_()},[l,e,u,c,o,r,n,t,s,a,d,i])}function k2(e){return Object.values(e).reduce((t,n)=>t+n.length,0)}function P2({graphSnapshot:e,profilingSnapshot:t=null,recentEvents:n,immersive:r=!1,showLegend:s=!0,showMiniMap:o=!0,darkMode:i=!1,defaultLayout:l="tb",edgeConnectorStyle:a="curved",autoFitOnLayoutScopeChange:u=!0,autoFocusOnSelection:c=!0,focusSelection:d=null,focusRequestId:f=0,onEntitySelect:m}){var oe;const v=E.useRef(null),x=E.useRef(null),T=E.useRef(new Map),p=E.useRef(""),g=E.useRef(null),_=E.useRef(new Map),[w,P]=E.useState(!1),[A,R]=E.useState(0),[$,B]=E.useState(null),[D,U]=E.useState([]),Q=l;E.useEffect(()=>{if(!t){_.current=new Map,U([]);return}const W=_.current,re=new Map,ae=new Set;for(const Z of Object.values(t)){const de=Z.process_id;for(const ce of Object.values(Z.publishers)){const Ne=typeof ce.messages_published_total=="number"&&Number.isFinite(ce.messages_published_total)?ce.messages_published_total:0,Ae=`${de}:${ce.endpoint_id}`,we=W.get(Ae);we!==void 0&&Ne>we&&ae.add(`${ce.topic}:${ce.endpoint_id}`),re.set(Ae,Ne)}}_.current=re;const F=Array.from(ae).sort(),X=F.join("|");X!==p.current&&(p.current=X,U(F))},[t]);const z=E.useMemo(()=>e?Kc(e):null,[e]),y=E.useMemo(()=>z?Rl(z.collections):new Map,[z]),I=E.useMemo(()=>z?s1(z.collections,$):[],[z,$]),N=E.useMemo(()=>w2(z),[z]),O=E.useMemo(()=>S2(z),[z]),C=E.useMemo(()=>(W,re)=>E2(z,W,re),[z]),S=E.useMemo(()=>g2(z),[z]),b=E.useMemo(()=>y2(D,S),[D,S]),j=E.useMemo(()=>_2(e,b,S),[b,S,e]),M=I.length>0?I[I.length-1]:null,K=E.useCallback(W=>{z!=null&&z.collections.has(W)&&B(W)},[z]),Y=E.useCallback(W=>{B(y.get(W)??null)},[y]),ee=`${Q}:${M??"root"}`,te=E.useMemo(()=>e?m2(e,Q,M,a,i,{openCollectionScope:K,goUpFromScope:Y}):{nodes:[],edges:[]},[e,Q,M,a,i,K,Y]),pe=E.useMemo(()=>{if(te.nodes.length===0)return T.current.delete(ee),te;if(h2(te))return T.current.set(ee,te),te;const W=T.current.get(ee);return W&&W.nodes.length>0?W:te},[te,ee]),V=E.useMemo(()=>v2(pe,j),[j,pe]),me=W=>{W.startsWith("collection:")&&K(W.slice(11))},he=W=>{if(W.startsWith("unit:")){m==null||m({kind:"unit",unitAddress:W.slice(5)});return}if(W.startsWith("collection:")){m==null||m({kind:"collection",collectionAddress:W.slice(11)});return}if(W.startsWith("stream:")){const re=W.slice(7),ae=N.get(re)??N.get(je(re));if(!ae){m==null||m(null);return}if(ae.direction==="output"){m==null||m({kind:"publisher",streamAddress:re,unitAddress:ae.unitAddress});return}if(ae.direction==="input"){m==null||m({kind:"subscriber",streamAddress:re,unitAddress:ae.unitAddress});return}}m==null||m(null)};if(E.useEffect(()=>{!z||!$||z.collections.has($)||B(null)},[$,z]),E.useEffect(()=>{if(!z||!e){g.current=null;return}const W=bu(z.units,z.collections,null),re=W.length===1?W[0]:null,ae=re!==null&&i1(e,z.units,z.collections,re),F=re!==null&&z.collections.has(re)&&o1(re,z.units,z.collections)&&!ae,X=`${W.slice().sort().join("|")}::${F?"ready":"wait"}`;g.current!==X&&(g.current=X,$===null&&(!F||!re||B(re)))},[e,$,z]),E.useEffect(()=>{if(!z||!$)return;bu(z.units,z.collections,$).length===0&&B(null)},[$,z]),C2({autoFocusOnSelection:c,focusSelection:d,focusRequestId:f,flowInitTick:A,flowInstanceRef:x,flowData:pe,topologyComponents:z,activeScope:M,parentCollectionByAddress:y,componentAddressByEndpointId:O,componentAddressByStreamSelection:C,setScopeCollectionAddress:B}),E.useEffect(()=>{const W=()=>{var F;const re=((F=v.current)==null?void 0:F.closest(".dashboard-layout"))??v.current,ae=document.fullscreenElement;if(!re||!ae){P(!1);return}P(ae===re||ae.contains(re))};return document.addEventListener("fullscreenchange",W),()=>{document.removeEventListener("fullscreenchange",W)}},[]),!e)return r?h.jsx("section",{className:"topology-immersive",children:h.jsx("div",{className:"topology-empty-state",children:h.jsx("p",{children:"Waiting for initial snapshot..."})})}):h.jsx(tl,{title:"Topology",subtitle:"Live graph, process ownership, and edge changes",children:h.jsx("div",{className:"placeholder",children:h.jsx("p",{children:"Waiting for initial snapshot..."})})});const ve=Object.keys(e.graph).length,Se=k2(e.graph),k=Object.keys(e.sessions).length,L=Object.values(e.processes),ne=((oe=v.current)==null?void 0:oe.closest(".dashboard-layout"))??v.current??document.documentElement,le=async()=>{if(ne)try{document.fullscreenElement?await document.exitFullscreen():await ne.requestFullscreen()}catch{}},J=h.jsxs("div",{className:"topology-flow-toolbar",children:[h.jsx("span",{className:"topology-flow-toolbar__label",children:"Scope"}),h.jsx("button",{type:"button",className:`topology-layout-btn ${M?"":"is-active"}`,onClick:()=>B(null),children:"Root"}),h.jsx("button",{type:"button",className:"topology-layout-btn",disabled:!M,onClick:()=>{M&&B(y.get(M)??null)},children:"Up"}),I.length>0?h.jsx("span",{className:"topology-scope-sep",children:"|"}):null,I.length>0?h.jsx("span",{className:"topology-scope-trail",children:I.map((W,re)=>{const ae=z==null?void 0:z.collections.get(W),F=(ae==null?void 0:ae.name)??bi(W),X=ae?[ae.name,ae.address,ae.componentType].join(` -`):W,Z=re===I.length-1;return h.jsxs("span",{className:"topology-scope-segment",children:[Z?h.jsx("span",{className:"topology-scope-tail",title:X,children:F}):h.jsx("button",{type:"button",className:"topology-scope-chip",title:X,onClick:()=>B(W),children:F}),Z?null:h.jsx("span",{className:"topology-scope-slash",children:"/"})]},`scope-${W}`)})}):null]}),q=h.jsxs("div",{className:"topology-viewport-legend","aria-label":"Topology legend",children:[h.jsx("span",{className:"topology-viewport-legend__title",children:"Legend"}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-collection"}),"Collection"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-input"}),"Subscriber"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-output"}),"Publisher"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-topic"}),"Collection Topic"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-relay"}),"Collection Relay"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-task"}),"Task"]})]}),H=h.jsxs(h.Fragment,{children:[r?null:J,h.jsxs("div",{className:`topology-flow-shell ${r?"is-immersive":""} ${i?"is-dark":""}`,ref:v,children:[r?h.jsx("div",{className:"topology-viewport-top-controls",children:J}):null,r&&s?h.jsx("div",{className:"topology-viewport-bottom-dock",children:q}):null,r||!s?null:q,h.jsxs(ky,{nodes:V.nodes,edges:V.edges,fitView:!0,fitViewOptions:{padding:.18,minZoom:.4},minZoom:.2,maxZoom:2.4,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onInit:W=>{x.current=W,R(re=>re+1)},onPaneClick:()=>m==null?void 0:m(null),onNodeClick:(W,re)=>{if(re.id.startsWith("scope:")){const ae=W.target,F=ae==null?void 0:ae.closest('[data-scope-up="true"]');if(F){if(!F.disabled){const X=re.id.slice(6);Y(X)}return}}if(re.id.startsWith("collection:")){const ae=W.target;if(ae!=null&&ae.closest('[data-open-collection="true"]')){me(re.id);return}m==null||m({kind:"collection",collectionAddress:re.id.slice(11)});return}he(re.id)},proOptions:{hideAttribution:!0},children:[h.jsx(KT,{color:i?"#243244":"#d5deea",gap:24}),o?h.jsx(LT,{pannable:!0,zoomable:!0,maskColor:i?"rgba(2, 6, 23, 0.72)":"rgba(15, 23, 42, 0.10)",style:{background:i?"#0e1728":"#f8fafc",border:i?"1px solid #334155":"1px solid #dbe2ea",borderRadius:8},nodeColor:W=>W.id.startsWith("collection:")?i?"#1d4f79":"#dbeafe":W.id.startsWith("unit:")?i?"#1e3a62":"#bfdbfe":i?"#334155":"#cbd5e1"}):null,h.jsx(UT,{showFitView:!1,showInteractive:!1,children:h.jsx(Gr,{className:"topology-control-btn",title:w?"Exit fullscreen":"Enter fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",onClick:()=>{le()},children:"⛶"})})]},u?`topology-flow-${Q}-${M??"root"}`:"topology-flow-stable")]})]});return r?h.jsx("section",{className:"topology-immersive",children:H}):h.jsxs(tl,{title:"Topology",subtitle:"Low-level publisher/subscriber wiring with optional metadata overlays",children:[h.jsxs("div",{className:"stats-grid",children:[h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Topics"}),h.jsx("strong",{children:ve})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Edges"}),h.jsx("strong",{children:Se})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Sessions"}),h.jsx("strong",{children:k})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Processes"}),h.jsx("strong",{children:L.length})]})]}),H,h.jsxs("div",{className:"panel-section",children:[h.jsx("h3",{children:"Process Ownership"}),L.length===0?h.jsx("p",{className:"muted",children:"No process ownership in current snapshot."}):h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Process ID"}),h.jsx("th",{children:"PID"}),h.jsx("th",{children:"Host"}),h.jsx("th",{children:"Units"})]})}),h.jsx("tbody",{children:L.map(W=>h.jsxs("tr",{children:[h.jsx("td",{className:"mono",children:W.process_id.slice(0,8)}),h.jsx("td",{children:W.pid??"-"}),h.jsx("td",{children:W.host??"-"}),h.jsx("td",{children:W.units.length})]},W.process_id))})]})]}),h.jsxs("div",{className:"panel-section",children:[h.jsx("h3",{children:"Recent Topology Changes"}),n.length===0?h.jsx("p",{className:"muted",children:"No topology events received yet."}):h.jsx("ul",{className:"event-list",children:n.slice(0,8).map(W=>h.jsxs("li",{className:"event-item",children:[h.jsx("span",{className:"event-pill",children:W.data.event_type}),h.jsxs("span",{className:"mono",children:["seq ",W.data.seq]}),h.jsx("span",{children:W.data.changed_topics.length>0?W.data.changed_topics.join(", "):"No topic list"})]},`topo-${W.data.seq}`))})]})]})}function Ve(e,t,n,r=!0){return{repr_value:n,structured_value:n,settings_schema:null,serialized_present:!0,patchable:r,patch_error:null,component_type:t,component_name:e}}function rn(e,t,n,r={},s={}){return{process_id:e,pid:t,host:"fixture-host",window_seconds:2,timestamp:1711111111,publishers:r,subscribers:s}}function bp(e,t,n){return{endpoint_id:e,topic:t,messages_published_total:n.messagesPublishedTotal??n.messagesPublishedWindow*10,messages_published_window:n.messagesPublishedWindow,publish_rate_hz_window:n.publishRateHzWindow,inflight_messages_current:n.inflightCurrent??0,num_buffers:n.numBuffers??8,timestamp:n.timestamp??1711111111}}function Ap(e,t,n){return{endpoint_id:e,topic:t,messages_received_total:n.messagesReceivedTotal??n.messagesReceivedWindow*10,messages_received_window:n.messagesReceivedWindow,channel_kind_last:n.channelKindLast??"fifo",timestamp:n.timestamp??1711111111}}function Ut(e,t="builtins.str"){return{address:e,msg_type:t,leaky:!1}}function qt(e,t,n="builtins.str"){return{address:e,msg_type:n,host:"127.0.0.1",port:t}}function ct(e,t,n){return{name:e,subscribes:t,publishes:n}}function $e(e){return String(e).padStart(2,"0")}const sn={name:"root-scope-navigation",health:{status:"ok",graph_session_active:!0,graph_address:"127.0.0.1:25978"},snapshot:{snapshot:{graph:{"SYSTEM/PING_TOPIC":["GLOBAL_PING_TOPIC"]},edge_owners:[],sessions:{"fixture-session":{edges:[{from_topic:"SYSTEM/PING_TOPIC",to_topic:"GLOBAL_PING_TOPIC"}],metadata:{components:{SYSTEM:{name:"SYSTEM",component_type:"fixture.TestSystem",children:["SYSTEM/PING"],topics:{PING:{address:"SYSTEM/PING_TOPIC",msg_type:"builtins.str"}}},"SYSTEM/PING":{name:"PING",component_type:"fixture.MessageGenerator",streams:{OUTPUT:{address:"SYSTEM/PING_TOPIC:ping-output-endpoint",msg_type:"builtins.str",host:"127.0.0.1",port:9001}},tasks:[{name:"emit",subscribes:null,publishes:["SYSTEM/PING_TOPIC"]}]}}}}},processes:{"fixture-process":{process_id:"fixture-process",pid:4201,host:"fixture-host",units:["SYSTEM/PING"]}}},settings:{SYSTEM:Ve("SYSTEM","fixture.TestSystem",{enabled:!0}),"SYSTEM/PING":Ve("PING","fixture.MessageGenerator",{rate_hz:10,message:"ping",timeout_s:"Infinity"})},profiling:{"fixture-process":rn("fixture-process",4201,["SYSTEM/PING"],{"SYSTEM/PING_TOPIC:ping-output-endpoint":{endpoint_id:"ping-output-endpoint",topic:"SYSTEM/PING_TOPIC",messages_published_total:120,messages_published_window:20,publish_rate_hz_window:10,inflight_messages_current:1,num_buffers:8,timestamp:1711111111},"SYSTEM/PING/INPUT_SETTINGS:ping-settings-endpoint":{endpoint_id:"ping-settings-endpoint",topic:"SYSTEM/PING/INPUT_SETTINGS",messages_published_total:1,messages_published_window:0,publish_rate_hz_window:0,inflight_messages_current:0,num_buffers:8,timestamp:1711111111}})}}},b2={name:"wide-fanout",health:sn.health,snapshot:{snapshot:{graph:{"STRESS/SOURCE_A":["STRESS/FANOUT_1","STRESS/FANOUT_2","STRESS/FANOUT_3","STRESS/FANOUT_4","STRESS/FANOUT_5","STRESS/FANOUT_6"],"STRESS/SOURCE_B":["STRESS/FANOUT_1","STRESS/FANOUT_2"],"STRESS/FANOUT_1":["STRESS/SINK_1"],"STRESS/FANOUT_2":["STRESS/SINK_2"],"STRESS/FANOUT_3":["STRESS/SINK_3"],"STRESS/FANOUT_4":["STRESS/SINK_4"],"STRESS/FANOUT_5":["STRESS/SINK_5"],"STRESS/FANOUT_6":["STRESS/SINK_6"]},edge_owners:[],sessions:{"wide-session":{edges:[],metadata:{components:{STRESS:{name:"STRESS",component_type:"fixture.StressCollection",children:["STRESS/AGGREGATOR","STRESS/SINK_1","STRESS/SINK_2","STRESS/SINK_3","STRESS/SINK_4","STRESS/SINK_5","STRESS/SINK_6"]},"STRESS/AGGREGATOR":{name:"AGGREGATOR",component_type:"fixture.AggregatorUnit",streams:{INPUT_ALPHA:{address:"STRESS/SOURCE_A:input-alpha",msg_type:"builtins.str",leaky:!1},INPUT_BETA:{address:"STRESS/SOURCE_B:input-beta",msg_type:"builtins.str",leaky:!1},OUTPUT_1:{address:"STRESS/FANOUT_1:fanout-1",msg_type:"builtins.str",host:"127.0.0.1",port:9101},OUTPUT_2:{address:"STRESS/FANOUT_2:fanout-2",msg_type:"builtins.str",host:"127.0.0.1",port:9102},OUTPUT_3:{address:"STRESS/FANOUT_3:fanout-3",msg_type:"builtins.str",host:"127.0.0.1",port:9103},OUTPUT_4:{address:"STRESS/FANOUT_4:fanout-4",msg_type:"builtins.str",host:"127.0.0.1",port:9104},OUTPUT_5:{address:"STRESS/FANOUT_5:fanout-5",msg_type:"builtins.str",host:"127.0.0.1",port:9105},OUTPUT_6:{address:"STRESS/FANOUT_6:fanout-6",msg_type:"builtins.str",host:"127.0.0.1",port:9106}},tasks:[{name:"normalize_payload",subscribes:"STRESS/SOURCE_A",publishes:["STRESS/FANOUT_1","STRESS/FANOUT_2"]},{name:"deduplicate_messages",subscribes:"STRESS/SOURCE_B",publishes:["STRESS/FANOUT_3","STRESS/FANOUT_4"]},{name:"route_priority_messages",subscribes:"STRESS/SOURCE_A",publishes:["STRESS/FANOUT_5","STRESS/FANOUT_6"]}]},...Object.fromEntries(Array.from({length:6},(e,t)=>{const n=t+1;return[`STRESS/SINK_${n}`,{name:`SINK_${n}`,component_type:"fixture.DebugOutput",streams:{INPUT:{address:`STRESS/FANOUT_${n}:sink-${n}`,msg_type:"builtins.str",leaky:!1}},tasks:[{name:"on_message",subscribes:`STRESS/FANOUT_${n}`,publishes:[]}]}]}))}}}},processes:{"wide-process":{process_id:"wide-process",pid:4301,host:"fixture-host",units:["STRESS/AGGREGATOR","STRESS/SINK_1","STRESS/SINK_2","STRESS/SINK_3","STRESS/SINK_4","STRESS/SINK_5","STRESS/SINK_6"]}}},settings:{STRESS:Ve("STRESS","fixture.StressCollection",{mode:"stress"}),"STRESS/AGGREGATOR":Ve("AGGREGATOR","fixture.AggregatorUnit",{batch_size:64,strategy:"spread"})},profiling:{"wide-process":rn("wide-process",4301)}}},A2={name:"long-labels",health:sn.health,snapshot:{snapshot:{graph:{"LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME":["LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME"]},edge_owners:[],sessions:{"long-session":{edges:[],metadata:{components:{LONG_SCOPE:{name:"EXTRAORDINARILY_VERBOSE_COLLECTION_NAME_FOR_LAYOUT_TESTING",component_type:"fixture.deep.namespace.ExtremelyLongCollectionComponentType",children:["LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME"]},"LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME":{name:"COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME",component_type:"fixture.deep.namespace.componenttypes.ExceptionallyLongComponentTypeName",streams:{OUTPUT_WITH_A_LONG_NAME:{address:"LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME:publisher-endpoint-with-a-very-long-token",msg_type:"fixtures.messages.ReallyLongStructuredMessageTypeName",host:"127.0.0.1",port:9201},INPUT_WITH_A_LONG_NAME:{address:"LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME:subscriber-endpoint-with-a-very-long-token",msg_type:"fixtures.messages.ReallyLongStructuredMessageTypeName",leaky:!1}},tasks:[{name:"task_with_a_surprisingly_long_name_for_a_single_render_chip",subscribes:"LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME",publishes:["LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME"]}]}}}}},processes:{"long-process":{process_id:"long-process",pid:4401,host:"fixture-host",units:["LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME"]}}},settings:{LONG_SCOPE:Ve("EXTRAORDINARILY_VERBOSE_COLLECTION_NAME_FOR_LAYOUT_TESTING","fixture.deep.namespace.ExtremelyLongCollectionComponentType",{debug_mode_enabled:!0}),"LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME":Ve("COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME","fixture.deep.namespace.componenttypes.ExceptionallyLongComponentTypeName",{default_payload:"the_quick_brown_fox_jumps_over_the_lazy_dog_repeatedly_to_stress_text_overflow"})},profiling:{"long-process":rn("long-process",4401)}}},R2={name:"semantic-stream-names",health:sn.health,snapshot:{snapshot:{graph:{"SIN/OUTPUT_SIGNAL_TOPIC":["SIN/WAVEFORM_TOPIC"]},edge_owners:[],sessions:{"semantic-stream-session":{edges:[],metadata:{components:{SIN:{name:"SIN",component_type:"fixture.LFO",streams:{INPUT_SIGNAL:Ut("SIN/INPUT_SIGNAL_TOPIC:sin-input-signal","fixtures.array.AxisArray"),INPUT_SETTINGS:Ut("SIN/INPUT_SETTINGS_TOPIC:sin-input-settings","fixtures.config.LFOSettings"),OUTPUT_SIGNAL:qt("SIN/OUTPUT_SIGNAL_TOPIC:sin-output-signal",9211,"fixtures.array.AxisArray")},tasks:[ct("on_signal","SIN/INPUT_SIGNAL_TOPIC",[]),ct("on_settings","SIN/INPUT_SETTINGS_TOPIC",[]),ct("generate",null,["SIN/OUTPUT_SIGNAL_TOPIC"])]}}}}},processes:{"semantic-stream-process":{process_id:"semantic-stream-process",pid:4451,host:"fixture-host",units:["SIN"]}}},settings:{SIN:Ve("SIN","fixture.LFO",{freq:1.5,update_rate:60})},profiling:{"semantic-stream-process":rn("semantic-stream-process",4451)}}},Qn=Array.from({length:6},(e,t)=>`TRACE_LAB/SPARSE_SUB_${$e(t+1)}`),Zn=Array.from({length:8},(e,t)=>`TRACE_LAB/DENSE_SUB_${$e(t+1)}`),M2={name:"profiling-trace-rates",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries([["TRACE_LAB/SPARSE_TOPIC",Qn.map((e,t)=>`TRACE_LAB/SPARSE_SUB_${$e(t+1)}_TOPIC`)],["TRACE_LAB/DENSE_TOPIC",Zn.map((e,t)=>`TRACE_LAB/DENSE_SUB_${$e(t+1)}_TOPIC`)]]),edge_owners:[],sessions:{"trace-session":{edges:[],metadata:{components:{TRACE_LAB:{name:"TRACE_LAB",component_type:"fixture.TraceLabCollection",children:["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn]},"TRACE_LAB/SPARSE_PUB":{name:"SPARSE_PUB",component_type:"fixture.TracePublisherUnit",streams:{OUTPUT:qt("TRACE_LAB/SPARSE_TOPIC:sparse-publisher-endpoint",9901)},tasks:[ct("publish_sparse",null,["TRACE_LAB/SPARSE_TOPIC"])]},"TRACE_LAB/DENSE_PUB":{name:"DENSE_PUB",component_type:"fixture.TracePublisherUnit",streams:{OUTPUT:qt("TRACE_LAB/DENSE_TOPIC:dense-publisher-endpoint",9902)},tasks:[ct("publish_dense",null,["TRACE_LAB/DENSE_TOPIC"])]},...Object.fromEntries(Qn.map((e,t)=>{const n=$e(t+1);return[e,{name:`SPARSE_SUB_${n}`,component_type:"fixture.TraceSubscriberUnit",streams:{INPUT:Ut(`TRACE_LAB/SPARSE_SUB_${n}_TOPIC:sparse-subscriber-${n}`)},tasks:[ct(`consume_sparse_${n}`,`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,[])]}]})),...Object.fromEntries(Zn.map((e,t)=>{const n=$e(t+1);return[e,{name:`DENSE_SUB_${n}`,component_type:"fixture.TraceSubscriberUnit",streams:{INPUT:Ut(`TRACE_LAB/DENSE_SUB_${n}_TOPIC:dense-subscriber-${n}`)},tasks:[ct(`consume_dense_${n}`,`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,[])]}]}))}}}},processes:{"trace-process":{process_id:"trace-process",pid:5001,host:"fixture-host",units:["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn]}}},settings:{TRACE_LAB:Ve("TRACE_LAB","fixture.TraceLabCollection",{trace_enabled:!0}),"TRACE_LAB/SPARSE_PUB":Ve("SPARSE_PUB","fixture.TracePublisherUnit",{publish_rate_hz:1}),"TRACE_LAB/DENSE_PUB":Ve("DENSE_PUB","fixture.TracePublisherUnit",{publish_rate_hz:60})},profiling:{"trace-process":rn("trace-process",5001,["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn],{"TRACE_LAB/SPARSE_TOPIC:sparse-publisher-endpoint":bp("sparse-publisher-endpoint","TRACE_LAB/SPARSE_TOPIC",{messagesPublishedWindow:2,publishRateHzWindow:1,numBuffers:4}),"TRACE_LAB/DENSE_TOPIC:dense-publisher-endpoint":bp("dense-publisher-endpoint","TRACE_LAB/DENSE_TOPIC",{messagesPublishedWindow:120,publishRateHzWindow:60,inflightCurrent:2,numBuffers:16})},{...Object.fromEntries(Qn.map((e,t)=>{const n=$e(t+1);return[`TRACE_LAB/SPARSE_SUB_${n}_TOPIC:sparse-subscriber-${n}`,Ap(`sparse-subscriber-${n}`,`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,{messagesReceivedWindow:2,channelKindLast:t%2===0?"fifo":"shared_memory"})]})),...Object.fromEntries(Zn.map((e,t)=>{const n=$e(t+1);return[`TRACE_LAB/DENSE_SUB_${n}_TOPIC:dense-subscriber-${n}`,Ap(`dense-subscriber-${n}`,`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,{messagesReceivedWindow:120,channelKindLast:t<3?"tcp":t%2===0?"fifo":"shared_memory"})]}))})}},traceScenarios:[{processId:"trace-process",publisherEndpointId:"sparse-publisher-endpoint",publisherTopic:"TRACE_LAB/SPARSE_TOPIC",eventIntervalMs:140,samplesPerTick:1,timestampStepNs:1e9,publishDeltaNsBase:94e7,publishDeltaNsJitter:12e7,subscribers:Qn.map((e,t)=>{const n=$e(t+1);return{endpointId:`sparse-subscriber-${n}`,topic:`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,leaseTimeNsBase:7e6+t*8e5,userSpanNsBase:25e5+t*24e4}})},{processId:"trace-process",publisherEndpointId:"dense-publisher-endpoint",publisherTopic:"TRACE_LAB/DENSE_TOPIC",eventIntervalMs:100,samplesPerTick:12,timestampStepNs:16666667,publishDeltaNsBase:164e5,publishDeltaNsJitter:24e5,subscribers:Zn.map((e,t)=>{const n=$e(t+1);return{endpointId:`dense-subscriber-${n}`,topic:`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,leaseTimeNsBase:13e5+t*14e4,userSpanNsBase:92e4+t*11e4}})}]},O2={name:"nested-collections",health:sn.health,snapshot:{snapshot:{graph:{"LAB/PIPELINE/ROOT_TOPIC":["LAB/PIPELINE/INNER/INNER_TOPIC"],"LAB/PIPELINE/INNER/INNER_TOPIC":["LAB/PIPELINE/LEAF_TOPIC"]},edge_owners:[],sessions:{"nested-session":{edges:[],metadata:{components:{LAB:{name:"LAB",component_type:"fixture.RootCollection",children:["LAB/PIPELINE"]},"LAB/PIPELINE":{name:"PIPELINE",component_type:"fixture.PipelineCollection",children:["LAB/PIPELINE/SOURCE","LAB/PIPELINE/INNER"],topics:{ROOT_TOPIC:{address:"LAB/PIPELINE/ROOT_TOPIC",msg_type:"builtins.str"}}},"LAB/PIPELINE/INNER":{name:"INNER",component_type:"fixture.InnerCollection",children:["LAB/PIPELINE/INNER/SINK"],topics:{INNER_TOPIC:{address:"LAB/PIPELINE/INNER/INNER_TOPIC",msg_type:"builtins.str"}}},"LAB/PIPELINE/SOURCE":{name:"SOURCE",component_type:"fixture.SourceUnit",streams:{OUTPUT:{address:"LAB/PIPELINE/ROOT_TOPIC:source-output",msg_type:"builtins.str",host:"127.0.0.1",port:9301}},tasks:[{name:"emit_root_topic",subscribes:null,publishes:["LAB/PIPELINE/ROOT_TOPIC"]}]},"LAB/PIPELINE/INNER/SINK":{name:"SINK",component_type:"fixture.SinkUnit",streams:{INPUT:{address:"LAB/PIPELINE/INNER/INNER_TOPIC:inner-input",msg_type:"builtins.str",leaky:!1},OUTPUT:{address:"LAB/PIPELINE/LEAF_TOPIC:leaf-output",msg_type:"builtins.str",host:"127.0.0.1",port:9302}},tasks:[{name:"relay_nested_topic",subscribes:"LAB/PIPELINE/INNER/INNER_TOPIC",publishes:["LAB/PIPELINE/LEAF_TOPIC"]}]},"CONTROL/PROBE":{name:"PROBE",component_type:"fixture.RootProbe",streams:{OUTPUT:{address:"CONTROL/PROBE_TOPIC:probe-output",msg_type:"builtins.str",host:"127.0.0.1",port:9303}},tasks:[{name:"probe_root_scope",subscribes:null,publishes:["CONTROL/PROBE_TOPIC"]}]}}}}},processes:{"nested-process":{process_id:"nested-process",pid:4501,host:"fixture-host",units:["LAB/PIPELINE/SOURCE","LAB/PIPELINE/INNER/SINK","CONTROL/PROBE"]}}},settings:{LAB:Ve("LAB","fixture.RootCollection",{enabled:!0}),"LAB/PIPELINE":Ve("PIPELINE","fixture.PipelineCollection",{stage_count:2}),"LAB/PIPELINE/INNER":Ve("INNER","fixture.InnerCollection",{nested:!0})},profiling:{"nested-process":rn("nested-process",4501)}}},L2={name:"orphan-streams",health:sn.health,snapshot:{snapshot:{graph:{"ORPHAN/INPUT_TOPIC":["SYSTEM/PROCESS_TOPIC"],"SYSTEM/PROCESS_TOPIC":["ORPHAN/OUTPUT_TOPIC"]},edge_owners:[],sessions:{"orphan-session":{edges:[],metadata:{components:{"SYSTEM/PROCESSOR":{name:"PROCESSOR",component_type:"fixture.ProcessorUnit",streams:{INPUT:{address:"SYSTEM/PROCESS_TOPIC:processor-input",msg_type:"builtins.str",leaky:!1},OUTPUT:{address:"SYSTEM/PROCESS_TOPIC:processor-output",msg_type:"builtins.str",host:"127.0.0.1",port:9401}},tasks:[{name:"transform_orphan_stream",subscribes:"SYSTEM/PROCESS_TOPIC",publishes:["SYSTEM/PROCESS_TOPIC"]}]}}}}},processes:{"orphan-process":{process_id:"orphan-process",pid:4601,host:"fixture-host",units:["SYSTEM/PROCESSOR"]}}},settings:{"SYSTEM/PROCESSOR":Ve("PROCESSOR","fixture.ProcessorUnit",{amplify:2})},profiling:{"orphan-process":rn("orphan-process",4601)}}},br=12,$2={name:"dense-unit-layout",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries(Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`MATRIX/IN_${n}_TOPIC`,[`MATRIX/OUT_${n}_TOPIC`]]})),edge_owners:[],sessions:{"dense-unit-session":{edges:[],metadata:{components:{MATRIX:{name:"MATRIX",component_type:"fixture.MatrixCollection",children:["MATRIX/ROUTER"]},"MATRIX/ROUTER":{name:"ROUTER",component_type:"fixture.DenseRouter",streams:Object.fromEntries([...Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`INPUT_${n}`,Ut(`MATRIX/IN_${n}_TOPIC:router-input-${n}`)]}),...Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`OUTPUT_${n}`,qt(`MATRIX/OUT_${n}_TOPIC:router-output-${n}`,9500+t)]})]),tasks:Array.from({length:br},(e,t)=>{const n=$e(t+1);return ct(`route_lane_${n}`,`MATRIX/IN_${n}_TOPIC`,[`MATRIX/OUT_${n}_TOPIC`])})}}}}},processes:{"dense-unit-process":{process_id:"dense-unit-process",pid:4701,host:"fixture-host",units:["MATRIX/ROUTER"]}}},settings:{MATRIX:Ve("MATRIX","fixture.MatrixCollection",{lanes:br}),"MATRIX/ROUTER":Ve("ROUTER","fixture.DenseRouter",{lanes:br,parallelism:4})},profiling:{"dense-unit-process":rn("dense-unit-process",4701)}}},an=12,fi=Array.from({length:an},(e,t)=>`MEGA/SRC_${$e(t+1)}`),pi=Array.from({length:an},(e,t)=>`MEGA/SINK_${$e(t+1)}`),j2={name:"massive-fanout",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries([...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`MEGA/SRC_${n}_TOPIC`,[`MEGA/HUB_IN_${n}_TOPIC`]]}),...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`MEGA/HUB_OUT_${n}_TOPIC`,[`MEGA/SINK_${n}_IN_TOPIC`]]})]),edge_owners:[],sessions:{"mega-session":{edges:[],metadata:{components:{MEGA:{name:"MEGA",component_type:"fixture.MegaScope",children:[...fi,"MEGA/HUB",...pi]},...Object.fromEntries(fi.map((e,t)=>{const n=$e(t+1);return[e,{name:`SRC_${n}`,component_type:"fixture.SourceUnit",streams:{OUTPUT:qt(`MEGA/SRC_${n}_TOPIC:source-output-${n}`,9600+t)},tasks:[ct(`emit_lane_${n}`,null,[`MEGA/SRC_${n}_TOPIC`])]}]})),"MEGA/HUB":{name:"HUB",component_type:"fixture.HubRouter",streams:Object.fromEntries([...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`INPUT_${n}`,Ut(`MEGA/HUB_IN_${n}_TOPIC:hub-input-${n}`)]}),...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`OUTPUT_${n}`,qt(`MEGA/HUB_OUT_${n}_TOPIC:hub-output-${n}`,9700+t)]})]),tasks:Array.from({length:an},(e,t)=>{const n=$e(t+1);return ct(`fanout_lane_${n}`,`MEGA/HUB_IN_${n}_TOPIC`,[`MEGA/HUB_OUT_${n}_TOPIC`])})},...Object.fromEntries(pi.map((e,t)=>{const n=$e(t+1);return[e,{name:`SINK_${n}`,component_type:"fixture.SinkUnit",streams:{INPUT:Ut(`MEGA/SINK_${n}_IN_TOPIC:sink-input-${n}`)},tasks:[ct(`consume_lane_${n}`,`MEGA/SINK_${n}_IN_TOPIC`,[])]}]}))}}}},processes:{"mega-process":{process_id:"mega-process",pid:4801,host:"fixture-host",units:[...fi,"MEGA/HUB",...pi]}}},settings:{MEGA:Ve("MEGA","fixture.MegaScope",{lanes:an}),"MEGA/HUB":Ve("HUB","fixture.HubRouter",{lanes:an,fanout_mode:"parallel"})},profiling:{"mega-process":rn("mega-process",4801,[...fi,"MEGA/HUB",...pi])}}},B2={name:"cyclic-feedback",health:sn.health,snapshot:{snapshot:{graph:{"ALPHA/OUT_TOPIC":["BETA/IN_TOPIC"],"BETA/OUT_TOPIC":["GAMMA/IN_TOPIC"],"GAMMA/OUT_TOPIC":["ALPHA/IN_TOPIC"],"GAMMA/AUDIT_TOPIC":["MONITOR/IN_TOPIC"]},edge_owners:[],sessions:{"cycle-session":{edges:[],metadata:{components:{ALPHA:{name:"ALPHA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("ALPHA/IN_TOPIC:alpha-input"),OUTPUT:qt("ALPHA/OUT_TOPIC:alpha-output",9801)},tasks:[ct("forward_alpha","ALPHA/IN_TOPIC",["ALPHA/OUT_TOPIC"])]},BETA:{name:"BETA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("BETA/IN_TOPIC:beta-input"),OUTPUT:qt("BETA/OUT_TOPIC:beta-output",9802)},tasks:[ct("forward_beta","BETA/IN_TOPIC",["BETA/OUT_TOPIC"])]},GAMMA:{name:"GAMMA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("GAMMA/IN_TOPIC:gamma-input"),OUTPUT:qt("GAMMA/OUT_TOPIC:gamma-output",9803),OUTPUT_AUDIT:qt("GAMMA/AUDIT_TOPIC:gamma-audit",9804)},tasks:[ct("fanout_gamma","GAMMA/IN_TOPIC",["GAMMA/OUT_TOPIC","GAMMA/AUDIT_TOPIC"])]},MONITOR:{name:"MONITOR",component_type:"fixture.MonitorUnit",streams:{INPUT:Ut("MONITOR/IN_TOPIC:monitor-input")},tasks:[ct("observe_cycle","MONITOR/IN_TOPIC",[])]}}}}},processes:{"cycle-process":{process_id:"cycle-process",pid:4901,host:"fixture-host",units:["ALPHA","BETA","GAMMA","MONITOR"]}}},settings:{ALPHA:Ve("ALPHA","fixture.FeedbackStage",{gain:1}),GAMMA:Ve("GAMMA","fixture.FeedbackStage",{audit_enabled:!0})},profiling:{"cycle-process":rn("cycle-process",4901)}}},F2={"root-scope-navigation":sn,"wide-fanout":b2,"long-labels":A2,"semantic-stream-names":R2,"profiling-trace-rates":M2,"nested-collections":O2,"orphan-streams":L2,"dense-unit-layout":$2,"massive-fanout":j2,"cyclic-feedback":B2};function z2(e){return e?F2[e]??null:null}const D2=120,U2=250,H2=1e3,W2=.05,V2=5e3,G2=60;function Ar(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Y2(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("fixture")}function K2(e,t,n){const r=t.split(".").filter(i=>i.length>0);if(r.length===0)return n;const s=e&&typeof e=="object"&&!Array.isArray(e)?Ar(e):{};let o=s;return r.forEach((i,l)=>{if(l===r.length-1){o[i]=n;return}const u=o[i],c=u&&typeof u=="object"&&!Array.isArray(u)?{...u}:{};o[i]=c,o=c}),s}function Rp(e,t){return t}function X2(e,t,n){return Math.min(n,Math.max(t,e))}function Q2(e){const t=Rp(void 0,W2),n=Math.max(1,Math.trunc(Rp(void 0,V2))),r=new URLSearchParams({profiling_interval:t.toString(),profiling_max_samples:n.toString()}).toString(),s=e.includes("?")?"&":"?";return`${e}${s}${r}`}function Z2(){const e=window.location.protocol==="https:"?"wss":"ws";return Q2(`${e}://${window.location.host}/ws/events`)}async function Mp(e){const t=e.includes("?")?"&":"?",n=`${e}${t}_ts=${Date.now()}`,r=await fetch(n,{cache:"no-store",headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(!r.ok)throw new Error(`${e} failed (${r.status})`);return await r.json()}async function Op(e,t){const n=e.includes("?")?"&":"?",r=`${e}${n}_ts=${Date.now()}`,s=await fetch(r,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json","Cache-Control":"no-cache",Pragma:"no-cache"},body:JSON.stringify(t)});if(!s.ok){let o=`${e} failed (${s.status})`;try{const i=await s.json();typeof i.detail=="string"&&i.detail.length>0&&(o=i.detail)}catch{}throw new Error(o)}return await s.json()}function Lp(e){return typeof e=="object"&&e!==null}function q2(e){return Lp(e)?typeof e.kind=="string"&&Lp(e.data):!1}function J2(e){const[t,n]=E.useState(null),[r,s]=E.useState(null),[o,i]=E.useState(null),[l,a]=E.useState([]),[u,c]=E.useState("connecting"),[d,f]=E.useState(null),[m,v]=E.useState(null),x=Math.round(X2(((e==null?void 0:e.snapshotPollSeconds)??2)*1e3,500,3e4)),T=E.useMemo(()=>z2(Y2()),[]),p=E.useRef(null),g=E.useRef(null),_=E.useRef(new Map),w=E.useRef(new Map),P=E.useRef(new Map),A=E.useCallback(I=>{const N=_.current.get(I);N!==void 0&&(window.clearInterval(N),_.current.delete(I))},[]),R=E.useCallback(()=>{for(const I of _.current.values())window.clearInterval(I);_.current.clear(),w.current.clear(),P.current.clear()},[]),$=E.useCallback(async()=>{if(T){const N=Ar(T.snapshot);s(N),v(Date.now());return}const I=await Mp("/api/snapshot");s(I),v(Date.now())},[T]),B=E.useCallback(async()=>{if(T){n(Ar(T.health));return}const I=await Mp("/api/health");n(I)},[T]);E.useEffect(()=>{if(T)return R(),n(Ar(T.health)),s(Ar(T.snapshot)),i(null),a([]),c("open"),f(null),v(Date.now()),()=>{R()}},[R,T]);const D=E.useCallback(()=>{p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{$().catch(I=>{const N=I instanceof Error?I.message:"Snapshot refresh failed.";f(N)}),p.current=null},U2)},[$]);E.useEffect(()=>{T||(B().catch(I=>{const N=I instanceof Error?I.message:"Health check failed.";f(N)}),$().catch(I=>{const N=I instanceof Error?I.message:"Initial snapshot failed.";f(N)}))},[T,B,$]),E.useEffect(()=>{if(T)return;const I=window.setInterval(()=>{$().catch(N=>{const O=N instanceof Error?N.message:"Snapshot poll failed.";f(O)})},x);return()=>{window.clearInterval(I)}},[T,$,x]),E.useEffect(()=>{if(T)return;let I=!1,N=null;const O=()=>{I||(c("connecting"),N=new WebSocket(Z2()),N.onopen=()=>{I||(c("open"),f(null))},N.onmessage=C=>{let S=null;try{S=JSON.parse(C.data)}catch{return}if(!q2(S))return;const b=S;a(j=>[b,...j].slice(0,D2)),b.kind==="topology.changed"&&D(),b.kind==="settings.changed"&&s(j=>{if(!j)return j;const M=b,K=j.settings[M.data.component_address]??null,Y={...j.settings,[M.data.component_address]:{...M.data.value,patchable:(K==null?void 0:K.patchable)??!1,patch_error:(K==null?void 0:K.patch_error)??null,component_type:(K==null?void 0:K.component_type)??null,component_name:(K==null?void 0:K.component_name)??null}};return{...j,settings:Y}}),b.kind==="profiling.trace"&&i(b),b.kind==="system.error"&&f(b.data.message)},N.onerror=()=>{I||c("closed")},N.onclose=()=>{I||(c("closed"),g.current=window.setTimeout(()=>{O()},H2))})};return O(),()=>{I=!0,N!==null&&N.close(),g.current!==null&&window.clearTimeout(g.current),p.current!==null&&window.clearTimeout(p.current)}},[T,D]);const U=E.useMemo(()=>l.filter(I=>I.kind==="topology.changed"),[l]),Q=E.useCallback(async()=>{try{await $()}catch(I){const N=I instanceof Error?I.message:"Snapshot refresh failed.";f(N)}},[$]),z=E.useCallback(async(I,N,O,C=2)=>{if(T){let j=null;return s(M=>{if(!M)return M;const K=M.settings[I];if(!K)return M;const Y=K.structured_value??K.repr_value,ee=K2(Y,N,O);return j={...K,structured_value:ee,repr_value:ee},{...M,settings:{...M.settings,[I]:j}}}),v(Date.now()),{component_address:I,field_path:N,updated_value:j??Ar(T.snapshot.settings[I])}}const S=encodeURIComponent(I),b=await Op(`/api/settings/${S}/field`,{field_path:N,value:O,timeout:C});return s(j=>{if(!j)return j;const M=j.settings[b.component_address]??null;return{...j,settings:{...j.settings,[b.component_address]:{...b.updated_value,patchable:(M==null?void 0:M.patchable)??!0,patch_error:(M==null?void 0:M.patch_error)??null,component_type:(M==null?void 0:M.component_type)??null,component_name:(M==null?void 0:M.component_name)??null}}}}),v(Date.now()),b},[T]),y=E.useCallback(async I=>{if(T){const N=`${I.process_id}:${I.publisher_endpoint_id??"*"}`;if(!I.enabled){if(I.publisher_endpoint_id)A(N);else for(const S of Array.from(_.current.keys()))S.startsWith(`${I.process_id}:`)&&A(S);return{process_id:I.process_id,unit_address:"",enabled:!1,control:{fixture:!0,metrics:I.metrics??[]}}}const O=I.publisher_topic??I.subscriber_topic,C=(T.traceScenarios??[]).find(S=>S.processId===I.process_id&&S.publisherEndpointId===I.publisher_endpoint_id&&S.publisherTopic===O);if(C){A(N),P.current.has(N)||P.current.set(N,Date.now()*1e6),w.current.has(N)||w.current.set(N,0);const S=()=>{const j=P.current.get(N)??Date.now()*1e6,M=w.current.get(N)??0,K=[],Y=new Set(I.metrics??[]),ee=Y.size===0||Y.has("publish_delta_ns"),te=Y.size===0||Y.has("lease_time_ns"),pe=Y.size===0||Y.has("user_span_ns");for(let V=0;V=9466848e5&&e<=41024448e5?e:e>=946684800&&e<=4102444800?e*1e3:null}function lI(e){return e.toLowerCase().includes("collection")}function aI(e){if(e.kind==="unit")return{kind:"unit",unitAddress:e.unitAddress};if(e.kind==="collection")return{kind:"collection",collectionAddress:e.collectionAddress};const t=e1(e.streamAddress);return{kind:e.kind,unitAddress:e.unitAddress,endpointId:t.endpointId,topic:t.topic}}function uI(e,t){var r;const n=((r=t==null?void 0:t[e])==null?void 0:r.component_type)??"";return lI(n)?{kind:"collection",collectionAddress:e}:{kind:"unit",unitAddress:e}}function cI(e){return(e==null?void 0:e.kind)==="unit"?e.unitAddress:(e==null?void 0:e.kind)==="collection"?e.collectionAddress:null}function dI(e){if(!e||typeof e!="object")return xt;const t=e,n=typeof t.snapshotPollSeconds=="number"&&Number.isFinite(t.snapshotPollSeconds)?Math.min(30,Math.max(.5,t.snapshotPollSeconds)):xt.snapshotPollSeconds,r=typeof t.inspectorWidthPx=="number"&&Number.isFinite(t.inspectorWidthPx)?Ju(t.inspectorWidthPx):xt.inspectorWidthPx,s=t.traceMetricsPreset==="publish+lease"||t.traceMetricsPreset==="publish"||t.traceMetricsPreset==="publish+lease+user"?t.traceMetricsPreset:xt.traceMetricsPreset,o=t.edgeConnectorStyle==="orthogonal"||t.edgeConnectorStyle==="smooth"||t.edgeConnectorStyle==="curved"?t.edgeConnectorStyle:xt.edgeConnectorStyle;return{snapshotPollSeconds:n,themeMode:t.themeMode==="dark"?"dark":"light",topologyDefaultLayout:t.topologyDefaultLayout==="lr"?"lr":"tb",edgeConnectorStyle:o,showLegend:typeof t.showLegend=="boolean"?t.showLegend:xt.showLegend,showMiniMap:typeof t.showMiniMap=="boolean"?t.showMiniMap:xt.showMiniMap,traceMetricsPreset:s,autoFitOnLayoutScopeChange:typeof t.autoFitOnLayoutScopeChange=="boolean"?t.autoFitOnLayoutScopeChange:xt.autoFitOnLayoutScopeChange,autoFocusOnInspectorSelection:typeof t.autoFocusOnInspectorSelection=="boolean"?t.autoFocusOnInspectorSelection:xt.autoFocusOnInspectorSelection,showSettingsChannels:typeof t.showSettingsChannels=="boolean"?t.showSettingsChannels:xt.showSettingsChannels,inspectorWidthPx:r}}function fI(e,t,n){const r=[],s=[];return e==="closed"?r.push("WebSocket disconnected"):e==="connecting"&&s.push("WebSocket connecting"),t===null?s.push("Graph health pending"):t||r.push("Graph session inactive"),n&&r.push(n),r.length>0?{tone:"err",tooltip:r.join(" · ")}:s.length>0?{tone:"warn",tooltip:s.join(" · ")}:{tone:"ok",tooltip:"Connected: GraphServer reachable, WebSocket open, session active."}}function pI(){const[e,t]=E.useState(null),[n,r]=E.useState(!1),[s,o]=E.useState(0),[i,l]=E.useState(0),[a,u]=E.useState(!1),[c,d]=E.useState(!0),[f,m]=E.useState(!1),[v,x]=E.useState(null),[T,p]=E.useState(0),[g,_]=E.useState(null),[w,P]=E.useState(null),[A,R]=E.useState(0),[$,B]=E.useState(null),D=E.useRef(null),[U,Q]=E.useState(()=>{try{const H=window.localStorage.getItem($p);return H?dI(JSON.parse(H)):xt}catch{return xt}});E.useEffect(()=>{window.localStorage.setItem($p,JSON.stringify(U))},[U]);const{health:z,snapshot:y,latestTraceEvent:I,connectionState:N,error:O,lastSnapshotUpdateMs:C,topologyEvents:S,patchSettingField:b,setProfilingTraceControl:j}=J2({snapshotPollSeconds:U.snapshotPollSeconds}),M=E.useMemo(()=>{let H=0;for(const oe of Object.values((y==null?void 0:y.profiling)??{}))if(typeof oe.timestamp=="number"&&Number.isFinite(oe.timestamp)){const W=iI(oe.timestamp);W!==null&&(H=Math.max(H,W))}return H<=0?C:H},[C,y==null?void 0:y.profiling]),K=z!=null&&z.graph_address&&z.graph_address.length>0?z.graph_address:oI,Y=M?new Date(M).toLocaleTimeString():"n/a",ee=E.useMemo(()=>fI(N,(z==null?void 0:z.graph_session_active)??null,O),[N,z==null?void 0:z.graph_session_active,O]),te=E.useMemo(()=>U.traceMetricsPreset==="publish"?["publish_delta_ns"]:U.traceMetricsPreset==="publish+lease"?["publish_delta_ns","lease_time_ns"]:["publish_delta_ns","lease_time_ns","user_span_ns"],[U.traceMetricsPreset]),pe=$??U.inspectorWidthPx,V=E.useMemo(()=>({"--inspector-width":`${pe}px`}),[pe]),me=H=>{if(P(null),!H){t(null);return}m(!1);const oe=aI(H);oe.kind==="unit"||oe.kind==="collection"?(d(!1),l(W=>W+1),oe.kind==="unit"&&o(W=>W+1)):(u(!1),o(W=>W+1)),t(oe)},he=H=>{P(H),R(oe=>oe+1)},ve=H=>{Q(oe=>({...oe,inspectorWidthPx:Ju(H)}))},Se=H=>{H.button===0&&(H.preventDefault(),H.currentTarget.setPointerCapture(H.pointerId),D.current={pointerX:H.clientX,widthPx:U.inspectorWidthPx},B(U.inspectorWidthPx))},k=H=>{const oe=D.current;oe&&B(Ju(oe.widthPx+(oe.pointerX-H.clientX)))},L=H=>{D.current&&(D.current=null,H.currentTarget.hasPointerCapture(H.pointerId)&&H.currentTarget.releasePointerCapture(H.pointerId),$!==null&&ve($),B(null))},ne=H=>{const oe=H.key==="ArrowLeft"?jp:H.key==="ArrowRight"?-jp:0;if(oe!==0){H.preventDefault(),ve(U.inspectorWidthPx+oe);return}(H.key==="Home"||H.key==="End")&&(H.preventDefault(),ve(H.key==="Home"?qu:Zu))},le=()=>{p(H=>H+1),x(null)},J=()=>{if(a){u(!1);return}if(c){u(!0),d(!1);return}u(!0)},q=()=>{if(c){d(!1);return}if(a){d(!0),u(!1);return}d(!0)};return h.jsxs("div",{className:`dashboard-layout is-comfortable ${f?"is-inspector-collapsed ":""}${$===null?"":"is-resizing-inspector "}${U.themeMode==="dark"?"is-dark":""}`,style:V,children:[h.jsxs("aside",{className:"dashboard-inspector dashboard-inspector--pinned",children:[f?null:h.jsx("div",{className:"inspector-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector","aria-valuemin":Zu,"aria-valuemax":qu,"aria-valuenow":pe,tabIndex:0,onPointerDown:Se,onPointerMove:k,onPointerUp:L,onPointerCancel:L,onKeyDown:ne,onDoubleClick:()=>ve(xt.inspectorWidthPx)}),h.jsxs("div",{className:`dashboard-inspector__body ${a?"is-publishers-collapsed ":""}${c?"is-settings-collapsed":""}`,children:[h.jsxs("section",{className:"inspector-section inspector-section--split",children:[h.jsxs("header",{className:"inspector-section__header",children:[h.jsx("span",{children:"Publishers"}),h.jsx("button",{type:"button",className:"inspector-section__collapse-btn",onClick:J,children:a?"Expand":"Collapse"})]}),a?null:h.jsx("div",{className:"inspector-section__content inspector-section__content--scroll",children:h.jsx(E1,{graphSnapshot:(y==null?void 0:y.snapshot)??null,profilingSnapshot:(y==null?void 0:y.profiling)??null,latestTraceEvent:I,setProfilingTraceControl:j,darkMode:U.themeMode==="dark",focusPublisherEndpointId:(e==null?void 0:e.kind)==="publisher"?e.endpointId:null,focusPublisherTopic:(e==null?void 0:e.kind)==="publisher"?e.topic:null,focusSubscriberEndpointId:(e==null?void 0:e.kind)==="subscriber"?e.endpointId:null,focusUnitAddress:(e==null?void 0:e.kind)==="unit"?e.unitAddress:null,focusActionId:s,showSettingsChannels:U.showSettingsChannels,hideFilters:!1,defaultTraceMetrics:te,traceDockHost:g,onTraceDockStateChange:x,traceCloseSignal:T,onPublisherSelect:H=>{t({kind:"publisher",unitAddress:H.unitAddress,endpointId:H.endpointId,topic:H.topic}),he({kind:"publisher",streamAddress:`${H.topic}:${H.endpointId}`,unitAddress:H.unitAddress})},onSubscriberSelect:H=>{t({kind:"subscriber",unitAddress:H.unitAddress,endpointId:H.endpointId,topic:H.topic}),he({kind:"subscriber",streamAddress:`${H.topic}:${H.endpointId}`,unitAddress:H.unitAddress})}})})]}),h.jsxs("section",{className:"inspector-section inspector-section--split",children:[h.jsxs("header",{className:"inspector-section__header",children:[h.jsx("span",{children:"Settings"}),h.jsx("button",{type:"button",className:"inspector-section__collapse-btn",onClick:q,children:c?"Expand":"Collapse"})]}),c?null:h.jsx("div",{className:"inspector-section__content inspector-section__content--scroll",children:h.jsx(O1,{settings:(y==null?void 0:y.settings)??null,patchSettingField:b,focusComponentAddress:cI(e),focusActionId:i,onComponentSelect:H=>{if(!H){t(null);return}l(W=>W+1);const oe=uI(H,y==null?void 0:y.settings);t(oe),he(oe.kind==="collection"?{kind:"collection",collectionAddress:oe.collectionAddress}:{kind:"unit",unitAddress:oe.unitAddress})}})})]})]})]}),h.jsxs("div",{className:"dashboard-main",children:[h.jsxs("div",{className:"dashboard-viewport",children:[h.jsx(P2,{graphSnapshot:(y==null?void 0:y.snapshot)??null,profilingSnapshot:(y==null?void 0:y.profiling)??null,recentEvents:S,immersive:!0,showLegend:U.showLegend,showMiniMap:U.showMiniMap,darkMode:U.themeMode==="dark",defaultLayout:U.topologyDefaultLayout,edgeConnectorStyle:U.edgeConnectorStyle,autoFitOnLayoutScopeChange:U.autoFitOnLayoutScopeChange,autoFocusOnSelection:U.autoFocusOnInspectorSelection,focusSelection:w,focusRequestId:A,onEntitySelect:me}),h.jsxs("section",{className:"dashboard-brand-card",children:[h.jsx("span",{className:`dashboard-health-dot is-${ee.tone}`,title:ee.tooltip,"aria-label":ee.tooltip}),h.jsx("img",{src:eI,alt:"ezmsg",className:"dashboard-brand-logo-image"}),h.jsx("div",{className:"dashboard-brand-card__title-row",children:h.jsx("h1",{className:"mono",children:"ezmsg-dashboard"})}),h.jsxs("p",{className:"dashboard-brand-card__meta-line",children:[h.jsxs("span",{className:"mono",children:["GraphServer ",K]}),h.jsx("span",{children:"·"}),h.jsxs("span",{className:"mono",children:["Snapshot ",Y]})]})]}),h.jsxs("div",{className:"dashboard-floating-control-dock","aria-label":"Viewport shortcuts",children:[h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-shortcut-btn",onClick:()=>Q(H=>({...H,topologyDefaultLayout:H.topologyDefaultLayout==="lr"?"tb":"lr"})),title:U.topologyDefaultLayout==="lr"?"Topology layout: left-to-right":"Topology layout: top-to-bottom","aria-label":U.topologyDefaultLayout==="lr"?"Topology layout left-to-right":"Topology layout top-to-bottom",children:U.topologyDefaultLayout==="lr"?h.jsx(sI,{}):h.jsx(rI,{})}),h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-shortcut-btn",onClick:()=>Q(H=>({...H,themeMode:H.themeMode==="dark"?"light":"dark"})),title:U.themeMode==="dark"?"Theme: dark":"Theme: light","aria-label":U.themeMode==="dark"?"Theme dark":"Theme light",children:U.themeMode==="dark"?h.jsx(nI,{}):h.jsx(tI,{})}),h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-gear-btn",onClick:()=>r(!0),title:"Global Settings","aria-label":"Global Settings",children:"⚙"})]}),h.jsx("button",{type:"button",className:`topology-layout-btn dashboard-floating-inspector-btn ${f?"is-collapsed":""}`.trim(),onClick:()=>m(H=>!H),title:f?"Show Inspector":"Hide Inspector","aria-label":f?"Show Inspector":"Hide Inspector",children:f?"«":"»"}),n?h.jsx("div",{className:"dashboard-modal-backdrop",onClick:()=>r(!1),children:h.jsxs("section",{className:"dashboard-modal",onClick:H=>H.stopPropagation(),children:[h.jsxs("header",{className:"dashboard-modal__header",children:[h.jsx("h2",{children:"Global Settings"}),h.jsx("button",{type:"button",className:"topology-layout-btn",onClick:()=>r(!1),children:"Close"})]}),h.jsxs("div",{className:"dashboard-modal__body",children:[h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Snapshot Poll Frequency (seconds)"}),h.jsx("input",{type:"number",min:.5,max:30,step:.5,value:U.snapshotPollSeconds,onChange:H=>{const oe=Number.parseFloat(H.target.value);Number.isFinite(oe)&&Q(W=>({...W,snapshotPollSeconds:Math.max(.5,Math.min(30,oe))}))}})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Theme"}),h.jsxs("select",{value:U.themeMode,onChange:H=>Q(oe=>({...oe,themeMode:H.target.value==="dark"?"dark":"light"})),children:[h.jsx("option",{value:"light",children:"Light"}),h.jsx("option",{value:"dark",children:"Dark"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Default Topology Layout"}),h.jsxs("select",{value:U.topologyDefaultLayout,onChange:H=>Q(oe=>({...oe,topologyDefaultLayout:H.target.value==="lr"?"lr":"tb"})),children:[h.jsx("option",{value:"tb",children:"Top to Bottom"}),h.jsx("option",{value:"lr",children:"Left to Right"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Edge Connector Type"}),h.jsxs("select",{value:U.edgeConnectorStyle,onChange:H=>Q(oe=>({...oe,edgeConnectorStyle:H.target.value==="orthogonal"||H.target.value==="smooth"?H.target.value:"curved"})),children:[h.jsx("option",{value:"curved",children:"Curved (Bezier)"}),h.jsx("option",{value:"orthogonal",children:"Orthogonal (Step)"}),h.jsx("option",{value:"smooth",children:"Smooth Step"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Default Trace Metrics"}),h.jsxs("select",{value:U.traceMetricsPreset,onChange:H=>Q(oe=>({...oe,traceMetricsPreset:H.target.value==="publish"||H.target.value==="publish+lease"?H.target.value:"publish+lease+user"})),children:[h.jsx("option",{value:"publish+lease+user",children:"Publish + Lease + User"}),h.jsx("option",{value:"publish+lease",children:"Publish + Lease"}),h.jsx("option",{value:"publish",children:"Publish Only"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Inspector Width (px)"}),h.jsx("input",{type:"number",min:360,max:900,step:10,value:U.inspectorWidthPx,onChange:H=>{const oe=Number.parseInt(H.target.value,10);Number.isFinite(oe)&&Q(W=>({...W,inspectorWidthPx:Math.max(360,Math.min(900,oe))}))}})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showSettingsChannels,onChange:H=>Q(oe=>({...oe,showSettingsChannels:H.target.checked}))}),h.jsx("span",{children:"Show settings channels in Publishers (debug)"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.autoFocusOnInspectorSelection,onChange:H=>Q(oe=>({...oe,autoFocusOnInspectorSelection:H.target.checked}))}),h.jsx("span",{children:"Auto-focus topology on inspector selection"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.autoFitOnLayoutScopeChange,onChange:H=>Q(oe=>({...oe,autoFitOnLayoutScopeChange:H.target.checked}))}),h.jsx("span",{children:"Auto-fit on layout/scope change"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showLegend,onChange:H=>Q(oe=>({...oe,showLegend:H.target.checked}))}),h.jsx("span",{children:"Show legend"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showMiniMap,onChange:H=>Q(oe=>({...oe,showMiniMap:H.target.checked}))}),h.jsx("span",{children:"Show minimap"})]})]})]})}):null]}),v!=null&&v.active?h.jsxs("section",{className:"trace-dock",children:[h.jsxs("header",{className:"trace-dock__header",children:[h.jsx("div",{className:"trace-dock__title-wrap",children:h.jsx("h3",{children:"Realtime Profiling Trace"})}),h.jsxs("div",{className:"trace-dock__actions",children:[h.jsx("span",{className:`trace-status ${v.status==="capturing"?"is-live":""}`,children:v.status}),h.jsx("button",{type:"button",className:"topology-layout-btn trace-dock__close-btn",onClick:le,title:"Close trace","aria-label":"Close trace",children:"✕"})]})]}),h.jsx("div",{className:"trace-dock__body",children:h.jsx("div",{className:"trace-dock__host",ref:_})})]}):null]})]})}ja.createRoot(document.getElementById("root")).render(h.jsx(G.StrictMode,{children:h.jsx(pI,{})})); +`)}function kr(e,t,n){return n==="collection"&&e.collectionKind?"mono topology-stream-label is-collection":`mono topology-stream-label ${t}`}function Pr(e,t,n,r){return n==="collection"&&e.collectionKind?e.collectionKind==="topic"?t==="is-output"?{border:r?"1px solid #fb923c":"1px solid #f28e2b",background:r?"#2e1f10":"#fff1dd",color:r?"#fed7aa":"#8a4f10",borderRadius:999}:t==="is-input"?{border:r?"1px solid #f59e0b":"1px solid #f6a44d",background:r?"#2a2115":"#fff8ef",color:r?"#fdba74":"#8a4f10",borderRadius:999}:{border:r?"1px solid #fb923c":"1px solid #f8b66f",background:r?"#2a2115":"#fff8ef",color:r?"#fdba74":"#8a4f10",borderRadius:999}:t==="is-output"?{border:r?"1px solid #d8b4fe":"1px solid #b07aa1",background:r?"#2a1d3a":"#f8eef5",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:t==="is-input"?{border:r?"1px solid #c084fc":"1px solid #c194b7",background:r?"#251b33":"#fbf3f8",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:{border:r?"1px solid #d8b4fe":"1px solid #b07aa1",background:r?"#2a1d3a":"#f8eef5",color:r?"#e9d5ff":"#6f3f66",borderRadius:999}:{border:t==="is-input"?r?"1px solid #818cf8":"1px solid #c7d2fe":t==="is-output"?r?"1px solid #22d3ee":"1px solid #7dd3fc":r?"1px solid #4b5563":"1px solid #cbd5e1",background:t==="is-input"?r?"#1d2644":"#eef2ff":t==="is-output"?r?"#0f2e37":"#ecfeff":r?"#182235":"#f8fafc",color:r?"#dbeafe":"#1e293b",borderRadius:t==="is-unknown"?8:999}}function Yr(e){return e.trim().toUpperCase().replace(/^INPUT_/,"").replace(/^OUTPUT_/,"").replace(/^TOPIC_/,"")}function p2(e){const t=new Set,n=new Map,r=new Map;for(const s of e){t.add(s.address);const o=je(s.address);n.set(o,s.address),r.set(Yr(s.name),s.address),r.set(Yr(Xt(s.name,s.address)),s.address),r.set(Yr(o),s.address);const i=o.split("/").pop();i&&r.set(Yr(i),s.address)}return{addressSet:t,withoutEndpointMap:n,normalizedNameMap:r}}function fi(e,t){if(!e)return null;if(t.addressSet.has(e))return e;if(t.withoutEndpointMap.has(e))return t.withoutEndpointMap.get(e)??null;const n=e.split(":")[0];if(t.withoutEndpointMap.has(n))return t.withoutEndpointMap.get(n)??null;const r=Yr(e);if(t.normalizedNameMap.has(r))return t.normalizedNameMap.get(r)??null;const s=Yr(n.split("/").pop()??"");if(t.normalizedNameMap.has(s))return t.normalizedNameMap.get(s)??null;for(const o of t.addressSet)if(o.startsWith(`${e}:`)||o.startsWith(`${n}:`))return o;return null}function h2(e){return typeof e=="object"&&e!==null&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)}function m2(e){if(!Array.isArray(e.nodes)||!Array.isArray(e.edges))return!1;const t=new Set;for(const n of e.nodes)if(!n||typeof n.id!="string"||n.id.length===0||t.has(n.id)||(t.add(n.id),!h2(n.position)))return!1;for(const n of e.nodes)if(typeof n.parentNode=="string"&&!t.has(n.parentNode))return!1;for(const n of e.edges)if(!n||typeof n.source!="string"||typeof n.target!="string"||!t.has(n.source)||!t.has(n.target))return!1;return!0}function g2(e,t,n,r,s,o){var ve,Se;const i=r==="orthogonal"?"step":r==="smooth"?"smoothstep":"default",{units:l,collections:a}=Kc(e),u=Ol(a),c=Mu(l,a,n),d=new Map,f=new Map;for(const k of c){const L=l.get(k);if(L){d.set(k,L);continue}const ne=a.get(k);ne&&f.set(k,ne)}const m=new Set(d.keys()),v=new Set(f.keys()),x=Ll(a),T=n?a.get(n)??null:null,p=T?`scope:${T.address}`:null,g=T?T.streams.filter(Ba):[],_=new Map(g.map(k=>[di(k.address),k])),w=new Map,P=new Map;for(const k of l.values())for(const L of k.streams)w.set(L.address,k.address),w.set(je(L.address),k.address);for(const k of a.values())for(const L of k.streams)P.set(L.address,k.address),P.set(je(L.address),k.address);for(const[k,L]of u.collectionByInternalTopic.entries())P.set(k,L);const A=new Map;for(const k of l.values())for(const L of k.streams)A.set(L.address,L.address),A.set(je(L.address),L.address);for(const k of a.values())for(const L of k.streams)A.set(L.address,L.address),A.set(je(L.address),L.address);for(const[k,L]of u.endpointByInternalTopic.entries())A.set(k,L);const R=k=>A.get(k)??A.get(je(k))??k,$=[];for(const[k,L]of Object.entries(e.graph))for(const ne of L){const le=R(k),J=R(ne);le!==J&&$.push({from:le,to:J})}const B=new Map,D=(k,L)=>{B.set(k,L),B.set(je(k),L)};for(const k of d.values())for(const L of k.streams)D(L.address,{ownerId:`unit:${k.address}`,ownerKind:"unit"});for(const k of f.values())for(const L of k.streams)D(L.address,{ownerId:`collection:${k.address}`,ownerKind:"collection"});for(const k of g)D(k.address,{ownerId:di(k.address),ownerKind:"scope_collection_stream"});const U=new Set(B.keys()),Q=$.filter(k=>U.has(k.from)||U.has(k.to)),z=new Set(U);for(const k of Q)z.add(k.from),z.add(k.to);const y=new Set,I=new Map;for(const k of d.values()){const L=`unit:${k.address}`;y.add(L),I.set(L,k.name)}for(const k of f.values()){const L=`collection:${k.address}`;y.add(L),I.set(L,k.name)}for(const k of g){const L=di(k.address);y.add(L),I.set(L,Xt(k.name,k.address))}for(const k of z){if(B.has(k))continue;const L=P.get(k),ne=w.get(k);if(L&&v.has(L)){D(k,{ownerId:`collection:${L}`,ownerKind:"collection"});continue}if(ne&&m.has(ne)){D(k,{ownerId:`unit:${ne}`,ownerKind:"unit"});continue}if(T&&p&&(L&&Ou(L,T.address,x)||ne&&Ou(ne,T.address,x))){D(k,{ownerId:p,ownerKind:"scope_collection"});continue}const le=ne??L??null;if(le){let q=x.get(le)??null;for(;q;){if(v.has(q)){D(k,{ownerId:`collection:${q}`,ownerKind:"collection_proxy"});break}q=x.get(q)??null}if(B.has(k))continue}const J=`orphan:${k}`;D(k,{ownerId:J,ownerKind:"orphan"}),y.add(J),I.set(J,Ju(k))}const N=[],O=new Set;for(const k of Q){const L=(ve=B.get(k.from))==null?void 0:ve.ownerId,ne=(Se=B.get(k.to))==null?void 0:Se.ownerId;if(!L||!ne||L===ne||!y.has(L)||!y.has(ne))continue;const le=`${L}->${ne}`;O.has(le)||(O.add(le),N.push({from:L,to:ne}))}const C=Array.from(y).sort((k,L)=>{const ne=I.get(k)??k,le=I.get(L)??L;return ne.localeCompare(le)}),S=s1(C,N),b=new Map;for(const k of C){const L=S.get(k)??0,ne=b.get(L);ne?ne.push(k):b.set(L,[k])}const j=new Map;for(const k of d.values()){const L=k.streams.filter(X=>X.direction==="input").length,ne=k.streams.filter(X=>X.direction==="output").length,le=k.streams.filter(X=>X.direction==="unknown").length,J=k.tasks.length,q=Math.max(1,L,ne,J,le),H=d2(k.name,k.componentType,Ms),oe=ui(q,Qe,La,22),W=ui(J,nr,Cp,t2),re=t==="lr"?Math.max(u2,H):Math.max(220,H,oe,W);if(t==="lr"){const X=Math.max(1,L,ne,J),Z=Math.max(126,Rs+16+X*30+(le>0?ze+12:0)+12);j.set(`unit:${k.address}`,{width:re,height:Z});continue}const ae=Math.max(1,(L>0?1:0)+(J>0?1:0)+(le>0?1:0)+(ne>0?1:0)),F=Math.max(216,Rs+18+ae*ze+Math.max(0,ae-1)*12+16);j.set(`unit:${k.address}`,{width:re,height:F})}for(const k of f.values()){const L=k.streams.filter(Z=>Z.direction==="input"),ne=k.streams.filter(Z=>Z.direction==="output"),le=k.streams.filter(Ba),J=L.length,q=ne.length,H=le.length,oe=f2(L,le,ne),W=Math.max(1,J,q,H),re=Math.max(t==="lr"?ai:300,ui(W,Qe,La,22)),ae=c2(k.name,k.componentType,Ms),F=Math.max(re,ae),X=t==="lr"?Math.max(124,ja+16+Math.max(1,J,H,q)*30+12):Math.max(176,ja+18+oe*ze+Math.max(0,oe-1)*12+16);j.set(`collection:${k.address}`,{width:F,height:X})}for(const k of g)j.set(di(k.address),{width:Qe,height:ze});for(const k of C)j.has(k)||j.set(k,{width:kp,height:74});const M=new Map,K=Array.from(b.keys()).sort((k,L)=>k-L);if(t==="tb"){let k=28;for(const L of K){const ne=b.get(L)??[];let le=24,J=0;for(const q of ne){const H=j.get(q)??{width:Ra,height:Ma};M.set(q,{x:le,y:k}),le+=H.width+JT,J=Math.max(J,H.height)}k+=J+ZT}}else{let k=24;for(const L of K){const ne=b.get(L)??[];let le=28,J=0;for(const q of ne){const H=j.get(q)??{width:Ra,height:Ma};M.set(q,{x:k,y:le}),le+=H.height+e2,J=Math.max(J,H.width)}k+=J+qT}}const Y=[],ee=[],te={stroke:s?"#8fa3bc":"#475569",strokeWidth:1.5},pe={type:xr.ArrowClosed,width:12,height:12,color:s?"#8fa3bc":"#475569"};function V(k,L,ne,le,J,q,H,oe){if(ne.length===0)return;const W=L.width-22,re=ne.length*Qe,ae=ne.length>1?Math.max(6,Math.min(16,Math.floor((W-re)/(ne.length-1)))):0,F=re+ae*Math.max(0,ne.length-1),X=11+Math.max(0,Math.floor((W-F)/2));ne.forEach((Z,de)=>{const ce=Pr(Z,J,q,s),Ne=X+de*(Qe+ae);oe.push({id:`stream:${Z.address}`,parentNode:k,extent:"parent",draggable:!1,data:{label:h.jsxs("span",{className:kr(Z,J,q),title:Nn(Z,q),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(Z.name,Z.address)}),it(Z.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(Z.msgType),"]"]}):null]})},position:{x:Ne,y:le},sourcePosition:H==="tb"?ie.Bottom:ie.Right,targetPosition:H==="tb"?ie.Top:ie.Left,style:{width:Qe,height:ze,borderRadius:ce.borderRadius,border:ce.border,background:ce.background,color:ce.color,fontSize:8,padding:"0 6px"}})})}if(T&&p){const k=C.filter(ue=>ue.startsWith("unit:")||ue.startsWith("collection:")||_.has(ue));let L=24,ne=32,le=24+ai,J=32+$a;if(k.length>0){L=Number.POSITIVE_INFINITY,ne=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(const ue of k){const ge=M.get(ue),Te=j.get(ue);!ge||!Te||(L=Math.min(L,ge.x),ne=Math.min(ne,ge.y),le=Math.max(le,ge.x+Te.width),J=Math.max(J,ge.y+Te.height))}(!Number.isFinite(L)||!Number.isFinite(ne))&&(L=24,ne=32,le=24+ai,J=32+$a)}const q=T.streams.filter(ue=>ue.direction==="input"),H=T.streams.filter(ue=>ue.direction==="output"),oe=Math.max(1,q.length,H.length),W=ui(oe,Qe,La,24),re=q.length>0,ae=H.length>0,F=t==="lr"?72:76,X=t==="lr"?108:64,Z=28,de=t==="lr"?Math.max(X,F+Math.max(1,q.length,H.length)*30+8):Math.max(X,F+(re?ze+8:0)),ce=t==="tb"?ae?Math.max(Pp,ze+20):20:Pp,Ne=Math.max(0,J-ne),Ae={x:L-Z,y:ne-de},we={width:Math.max(360,le-L+Z*2,W+Z*2),height:Math.max(180,Ne+de+ce)};if(k.length>0){const ue=(L+le)/2,ge=Ae.x+Z,Te=Ae.x+we.width-Z,ke=(ge+Te)/2,ye=Math.round(ke-ue);if(ye!==0)for(const Ce of k){const Ge=M.get(Ce);Ge&&M.set(Ce,{x:Ge.x+ye,y:Ge.y})}}if(Y.push({id:p,position:Ae,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"topology-collection-label topology-collection-label--scope",title:Fa(T.name,T.address,T.componentType),children:[h.jsxs("span",{className:"topology-title-row topology-title-row--collection",children:[h.jsxs("span",{className:"topology-title-row",children:[h.jsx("strong",{children:T.name}),h.jsx("span",{className:"topology-unit-type",title:T.componentType,children:Ms(T.componentType)})]}),h.jsx("button",{type:"button","data-scope-up":"true",className:"topology-collection-scope-up-btn nodrag nopan",title:"Go up one scope","aria-label":`Go up from ${T.name}`,onPointerDown:ue=>{ue.stopPropagation()},onMouseDown:ue=>{ue.stopPropagation()},onClick:ue=>{var ge;ue.stopPropagation(),(ge=o==null?void 0:o.goUpFromScope)==null||ge.call(o,T.address)},children:"↑ Up"})]}),h.jsx("span",{className:"mono",children:Ai(T.address)})]})},style:{width:we.width,height:we.height,border:`2px dashed ${s?"#4b647e":Ip[0]}`,borderRadius:14,background:s?"rgba(15, 23, 42, 0.45)":"rgba(226, 232, 240, 0.24)",color:s?"#e2e8f0":"#0f172a",padding:10,zIndex:-1},draggable:!1,selectable:!1}),t==="lr"){const Te=Math.max(1,q.length,H.length)*30,ke=Math.max(F,de-Te-8);q.forEach((ye,Ce)=>{const Ge=Pr(ye,"is-input","collection",s);Y.push({id:`stream:${ye.address}`,parentNode:p,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(ye,"is-input","collection"),title:Nn(ye,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ye.name,ye.address)}),it(ye.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ye.msgType),"]"]}):null]})},position:{x:12,y:ke+Ce*30},style:{width:Qe,height:ze,borderRadius:Ge.borderRadius,border:Ge.border,background:Ge.background,color:Ge.color,padding:"0 6px"}})}),H.forEach((ye,Ce)=>{const Ge=Pr(ye,"is-output","collection",s);Y.push({id:`stream:${ye.address}`,parentNode:p,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(ye,"is-output","collection"),title:Nn(ye,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ye.name,ye.address)}),it(ye.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ye.msgType),"]"]}):null]})},position:{x:we.width-Qe-12,y:ke+Ce*30},style:{width:Qe,height:ze,borderRadius:Ge.borderRadius,border:Ge.border,background:Ge.background,color:Ge.color,padding:"0 6px"}})})}else{const ue=F,ge=de+Ne,Te=Math.min(we.height-ze-10,ge+Math.max(6,Math.floor((ce-ze)/2)));V(p,we,q,ue,"is-input","collection",t,Y),V(p,we,H,Te,"is-output","collection",t,Y)}for(const ue of k){const ge=_.get(ue);if(!ge)continue;const Te=M.get(ue);if(!Te)continue;const ke=Pr(ge,"is-unknown","collection",s);Y.push({id:ue,parentNode:p,extent:"parent",draggable:!1,data:{label:h.jsxs("span",{className:kr(ge,"is-unknown","collection"),title:Nn(ge,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ge.name,ge.address)}),it(ge.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ge.msgType),"]"]}):null]})},position:{x:Te.x-Ae.x,y:Te.y-Ae.y},sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,style:{width:Qe,height:ze,borderRadius:ke.borderRadius,border:ke.border,background:ke.background,color:ke.color,fontSize:8,padding:"0 6px"}})}}for(const k of f.values()){const L=`collection:${k.address}`,ne=M.get(L)??{x:0,y:0},le=j.get(L)??{width:ai,height:$a};Y.push({id:L,position:ne,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"topology-collection-label",title:Fa(k.name,k.address,k.componentType),children:[h.jsxs("span",{className:"topology-title-row topology-title-row--collection",children:[h.jsxs("span",{className:"topology-title-row",children:[h.jsx("strong",{children:k.name}),h.jsx("span",{className:"topology-unit-type",title:k.componentType,children:Ms(k.componentType)})]}),h.jsx("button",{type:"button","data-open-collection":"true",className:"topology-collection-open-btn nodrag nopan",title:"Open collection scope","aria-label":`Open ${k.name} scope`,onPointerDown:oe=>{oe.stopPropagation()},onMouseDown:oe=>{oe.stopPropagation()},onClick:oe=>{var W;oe.stopPropagation(),(W=o==null?void 0:o.openCollectionScope)==null||W.call(o,k.address)},children:"Open"})]}),h.jsx("span",{className:"mono",children:Ai(k.address)})]})},style:{width:le.width,height:le.height,border:`2px dashed ${s?"#4f8ccf":Ip[1]}`,borderRadius:12,background:s?"rgba(30, 58, 95, 0.34)":QT[1],color:s?"#e2e8f0":"#0f172a",padding:10}});const J=k.streams.filter(oe=>oe.direction==="input"),q=k.streams.filter(oe=>oe.direction==="output"),H=k.streams.filter(Ba);if(t==="lr"){const W=ja+6;J.forEach((re,ae)=>{const F=Pr(re,"is-input","collection",s);Y.push({id:`stream:${re.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(re,"is-input","collection"),title:Nn(re,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(re.name,re.address)}),it(re.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(re.msgType),"]"]}):null]})},position:{x:10,y:W+ae*30},style:{width:Qe,height:ze,borderRadius:F.borderRadius,border:F.border,background:F.background,color:F.color,padding:"0 6px"}})}),q.forEach((re,ae)=>{const F=Pr(re,"is-output","collection",s);Y.push({id:`stream:${re.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:kr(re,"is-output","collection"),title:Nn(re,"collection"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(re.name,re.address)}),it(re.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(re.msgType),"]"]}):null]})},position:{x:le.width-Qe-10,y:W+ae*30},style:{width:Qe,height:ze,borderRadius:F.borderRadius,border:F.border,background:F.background,color:F.color,padding:"0 6px"}})}),V(L,le,H,W,"is-unknown","collection",t,Y)}else{const W=Math.max(86+ze+10,le.height-ze-12),re=Math.min(W-ze-12,Math.floor((86+W)/2));V(L,le,J,86,"is-input","collection",t,Y),V(L,le,H,re,"is-unknown","collection",t,Y),V(L,le,q,W,"is-output","collection",t,Y)}}for(const k of d.values()){const L=`unit:${k.address}`,ne=M.get(L)??{x:0,y:0},le=j.get(L)??{width:Ra,height:Ma},J=k.streams.filter(re=>re.direction==="input"),q=k.streams.filter(re=>re.direction==="output"),H=k.streams.filter(re=>re.direction==="unknown"),oe=new Set(k.streams.map(re=>re.address)),W=p2(k.streams);if(Y.push({id:L,position:ne,data:{label:h.jsxs("div",{className:"topology-unit-label",children:[h.jsxs("span",{className:"topology-title-row",title:Fa(k.name,k.address,k.componentType),children:[h.jsx("strong",{children:k.name}),h.jsx("span",{className:"topology-unit-type",title:k.componentType,children:Ms(k.componentType)})]}),h.jsx("span",{className:"mono topology-unit-address",title:k.address,children:ci(Ai(k.address),34)})]})},style:{width:le.width,height:le.height,border:s?"1px solid #3b82f6":"1px solid #93c5fd",borderRadius:12,background:s?"#0f1f35":"#f8fbff",padding:10}}),t==="lr"){const re=Rs+6;J.forEach((ae,F)=>{Y.push({id:`stream:${ae.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:"mono topology-stream-label is-input",title:Nn(ae,"unit"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ae.name,ae.address)}),it(ae.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ae.msgType),"]"]}):null]})},position:{x:10,y:re+F*30},style:{width:Qe,height:ze,borderRadius:999,border:s?"1px solid #818cf8":"1px solid #c7d2fe",background:s?"#1d2644":"#eef2ff",padding:"0 6px"}})}),q.forEach((ae,F)=>{Y.push({id:`stream:${ae.address}`,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsxs("span",{className:"mono topology-stream-label is-output",title:Nn(ae,"unit"),children:[h.jsx("span",{className:"topology-stream-name",children:Xt(ae.name,ae.address)}),it(ae.msgType)?h.jsxs("span",{className:"topology-stream-type",children:["[",it(ae.msgType),"]"]}):null]})},position:{x:le.width-Qe-10,y:re+F*30},style:{width:Qe,height:ze,borderRadius:999,border:s?"1px solid #22d3ee":"1px solid #7dd3fc",background:s?"#0f2e37":"#ecfeff",padding:"0 6px"}})}),k.tasks.forEach((ae,F)=>{const X=`task:${k.address}:${ae.name}`,Z=fi(ae.subscribes,W),de=Array.from(new Set(ae.publishes.map(ce=>fi(ce,W)).filter(ce=>ce!==null)));Y.push({id:X,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Right,targetPosition:ie.Left,data:{label:h.jsx("span",{className:"mono topology-task-label",title:ae.name,children:ci(ae.name,15)})},position:{x:Math.floor((le.width-nr)/2),y:re+F*30+4},style:{width:nr,height:Oa,borderRadius:999,border:s?"1px solid #41536c":"1px solid #dbe2ea",background:s?"#1a273a":"#f1f5f9",padding:"0 6px"}}),Z&&oe.has(Z)&&ee.push({id:`edge:internal:${k.address}:${ae.name}:sub`,source:`stream:${Z}`,target:X,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te});for(const ce of de)oe.has(ce)&&ee.push({id:`edge:internal:${k.address}:${ae.name}:${ce}`,source:X,target:`stream:${ce}`,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te})}),H.length>0&&V(L,le,H,le.height-ze-8,"is-unknown","unit",t,Y)}else{const re=Rs+ze+12,ae=le.height-ze-12,F=ae-8,X=re+Math.max(0,Math.floor((F-re-Oa)/2));V(L,le,J,Rs+2,"is-input","unit",t,Y),V(L,le,q,ae,"is-output","unit",t,Y),H.length>0&&V(L,le,H,X+28,"is-unknown","unit",t,Y);const Z=k.tasks.length,de=le.width-20,ce=Z*nr,Ne=Z>1?Math.max(Cp,Math.min(22,Math.floor((de-ce)/(Z-1)))):0,Ae=ce+Ne*Math.max(0,Z-1),we=10+Math.max(0,Math.floor((de-Ae)/2));k.tasks.forEach((ue,ge)=>{const Te=`task:${k.address}:${ue.name}`,ke=fi(ue.subscribes,W),ye=Array.from(new Set(ue.publishes.map(Ce=>fi(Ce,W)).filter(Ce=>Ce!==null)));Y.push({id:Te,parentNode:L,extent:"parent",draggable:!1,sourcePosition:ie.Bottom,targetPosition:ie.Top,data:{label:h.jsx("span",{className:"mono topology-task-label",title:ue.name,children:ci(ue.name,15)})},position:{x:we+ge*(nr+Ne),y:X},style:{width:nr,height:Oa,borderRadius:999,border:s?"1px solid #41536c":"1px solid #dbe2ea",background:s?"#1a273a":"#f1f5f9",padding:"0 6px"}}),ke&&oe.has(ke)&&ee.push({id:`edge:internal:${k.address}:tb:${ue.name}:sub`,source:`stream:${ke}`,target:Te,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te});for(const Ce of ye)oe.has(Ce)&&ee.push({id:`edge:internal:${k.address}:tb:${ue.name}:${Ce}`,source:Te,target:`stream:${Ce}`,type:i,zIndex:20,className:"topology-internal-edge",markerEnd:pe,style:te})})}}for(const k of z){const L=B.get(k);if(L&&L.ownerKind!=="orphan")continue;const ne=`orphan:${k}`,le=M.get(ne)??{x:0,y:0};Y.push({id:`stream:${k}`,position:le,sourcePosition:t==="tb"?ie.Bottom:ie.Right,targetPosition:t==="tb"?ie.Top:ie.Left,data:{label:h.jsxs("div",{className:"mono topology-orphan-label",children:[h.jsx("strong",{children:Ju(k)}),h.jsx("span",{children:ci(k,54)})]})},style:{width:kp,border:s?"1px solid #41536c":"1px solid #dbe2ea",borderRadius:10,background:s?"#111c2e":"#ffffff",padding:6}})}const me=k=>{const L=B.get(k);return L?L.ownerKind==="unit"||L.ownerKind==="collection"||L.ownerKind==="scope_collection"||L.ownerKind==="orphan"?`stream:${k}`:L.ownerId:`stream:${k}`},he=k=>{var L;return((L=B.get(k))==null?void 0:L.ownerId)??null};for(const k of Q){const L=me(k.from),ne=me(k.to);if(L===ne)continue;const le=he(k.from),J=he(k.to);if(!(le&&J&&le===J&&le.startsWith("scope:"))&&!(le&&J&&le===J&&le.startsWith("collection:"))){if(le&&J&&le===J&&le.startsWith("unit:")){const q=d.get(le.slice(5));if(q&&q.tasks.length>0)continue}ee.push({id:`edge:${k.from}->${k.to}`,source:L,target:ne,type:i,zIndex:1,markerEnd:{type:xr.ArrowClosed,width:12,height:12,color:s?"#8fa3bc":"#64748b"},style:{stroke:s?"#8fa3bc":"#64748b",strokeWidth:1.2}})}}return{nodes:Y,edges:ee}}function y2(e){const t=new Map;if(!e)return t;for(const r of e.units.values())for(const s of r.streams)t.set(s.address,s.address),t.set(je(s.address),s.address);for(const r of e.collections.values())for(const s of r.streams)t.set(s.address,s.address),t.set(je(s.address),s.address);const n=Ol(e.collections);for(const[r,s]of n.endpointByInternalTopic.entries())t.set(r,s);return t}function _2(e,t){const n=new Set;for(const r of e){const s=t.get(r)??t.get(je(r))??null;s&&(n.add(s),n.add(je(s)))}return n}function v2(e,t,n){if(!e||t.size===0)return t;const r=new Map;for(const[l,a]of Object.entries(e.graph)){const u=n.get(l)??n.get(je(l))??l,c=r.get(u)??[];for(const d of a){const f=n.get(d)??n.get(je(d))??d;c.push(f)}r.set(u,c)}const s=new Set,o=Array.from(t);for(;o.length>0;){const l=o.shift();if(!l||s.has(l))continue;s.add(l);const a=r.get(l)??[];for(const u of a)s.has(u)||o.push(u)}const i=new Set;for(const l of s)i.add(l),i.add(je(l));return i}function x2(e,t){if(t.size===0||e.edges.length===0)return e;const n=a=>{if(!a)return!1;const u=je(a);return t.has(a)||t.has(u)},r=new Map;e.edges.forEach((a,u)=>{const c=r.get(a.source);c?c.push(u):r.set(a.source,[u])});const s=new Set,o=new Set,i=[],l=a=>{o.has(a)||(o.add(a),i.push(a))};for(e.edges.forEach((a,u)=>{const c=a.source.startsWith("stream:")?a.source.slice(7):null,d=w2(a.id);n(c??d)&&(s.add(u),l(a.target))});i.length>0;){const a=i.shift();if(!a)continue;const u=r.get(a);if(!(!u||u.length===0))for(const c of u)s.has(c)||(s.add(c),l(e.edges[c].target))}return s.size===0?e:{nodes:e.nodes,edges:e.edges.map((a,u)=>{if(!s.has(u)||typeof a.className=="string"&&a.className.includes("topology-internal-edge"))return a;const d=typeof a.markerEnd=="object"&&a.markerEnd!==null?{...a.markerEnd,color:"#2563eb"}:{type:xr.ArrowClosed,width:12,height:12,color:"#2563eb"};return{...a,animated:!0,markerEnd:d,style:{...a.style??{},stroke:"#2563eb",strokeWidth:1.7}}})}}function w2(e){if(!e.startsWith("edge:")||e.startsWith("edge:internal:"))return null;const t=e.slice(5),n=t.indexOf("->");if(n<=0)return null;const r=t.slice(0,n);return r.length>0?r:null}function S2(e){const t=new Map;if(!e)return t;for(const n of e.units.values())for(const r of n.streams){const s={direction:r.direction,unitAddress:n.address};t.set(r.address,s),t.set(je(r.address),s)}return t}function E2(e){const t=new Map;if(!e)return t;const n=(r,s)=>{const o=s.split(":").slice(1).join(":");o.length>0&&!t.has(o)&&t.set(o,r)};for(const r of e.units.values())for(const s of r.streams)n(r.address,s.address);for(const r of e.collections.values())for(const s of r.streams)n(r.address,s.address);return t}function N2(e,t,n){if(!e)return null;const{topic:r,endpointToken:s}=Ml(n);let o=-1,i=null;const l=(a,u,c)=>{const d=T2(t,u,c,r,s);d>o&&(o=d,i=a)};for(const a of e.units.values())for(const u of a.streams)l(a.address,u.address,u.direction);for(const a of e.collections.values())for(const u of a.streams)l(a.address,u.address,u.direction);return o>0?i:null}function T2(e,t,n,r,s){if(e==="publisher"&&n!=="output"||e==="subscriber"&&n!=="input")return-1;let o=0;const i=je(t);return r.length>0&&(i===r?o+=12:t.startsWith(`${r}:`)?o+=8:t.includes(r)&&(o+=2)),s.length>0&&(t.endsWith(`:${s}`)?o+=14:t.includes(s)&&(o+=7)),o}function I2(e,t,n){if(e.kind!=="publisher"&&e.kind!=="subscriber")return null;const r=e.streamAddress.split(":").slice(1).join(":");return e.unitAddress??t.get(r)??n(e.kind,e.streamAddress)??null}function C2(e,t,n,r){if(e.kind==="unit")return`unit:${e.unitAddress}`;if(e.kind==="collection")return`collection:${e.collectionAddress}`;if(t&&(r!=null&&r.units.has(t)))return`unit:${t}`;if(t&&(r!=null&&r.collections.has(t)))return`collection:${t}`;const s=e.streamAddress;if(!s)return null;const o=s.split(":").slice(1).join(":"),i=s.split(":")[0]??"",l=n.nodes.find(a=>{if(!a.id.startsWith("stream:"))return!1;const u=a.id.slice(7);return u.includes(o)||u.startsWith(i)});return(l==null?void 0:l.id)??null}function k2({autoFocusOnSelection:e,focusSelection:t,focusRequestId:n,flowInitTick:r,flowInstanceRef:s,flowData:o,topologyComponents:i,activeScope:l,parentCollectionByAddress:a,componentAddressByEndpointId:u,componentAddressByStreamSelection:c,setScopeCollectionAddress:d}){const f=E.useRef(0),m=E.useRef(null),v=E.useRef(null);E.useEffect(()=>{if(!e||!t||n<=0||f.current===n||!s.current)return;const T=I2(t,u,c),p=t.kind==="unit"?t.unitAddress:t.kind==="collection"?t.collectionAddress:T;if(p&&i){const P=a.get(p)??null;if(P!==l){m.current=n,d(P);return}}const g=C2(t,T,o,i);if(!g||!o.nodes.some(P=>P.id===g))return;const _=()=>{const P=s.current;if(!P){v.current=null;return}P.fitView({nodes:[{id:g}],padding:o2,duration:i2,minZoom:l2,maxZoom:a2}),f.current=n,m.current=null,v.current=null};if(m.current===n){if(v.current===n)return;v.current=n,requestAnimationFrame(()=>{requestAnimationFrame(_)});return}_()},[l,e,u,c,o,r,n,t,s,a,d,i])}function P2(e){return Object.values(e).reduce((t,n)=>t+n.length,0)}function b2({graphSnapshot:e,profilingSnapshot:t=null,recentEvents:n,immersive:r=!1,showLegend:s=!0,showMiniMap:o=!0,darkMode:i=!1,defaultLayout:l="tb",edgeConnectorStyle:a="curved",autoFitOnLayoutScopeChange:u=!0,autoFocusOnSelection:c=!0,focusSelection:d=null,focusRequestId:f=0,onEntitySelect:m}){var oe;const v=E.useRef(null),x=E.useRef(null),T=E.useRef(new Map),p=E.useRef(""),g=E.useRef(null),_=E.useRef(new Map),[w,P]=E.useState(!1),[A,R]=E.useState(0),[$,B]=E.useState(null),[D,U]=E.useState([]),Q=l;E.useEffect(()=>{if(!t){_.current=new Map,U([]);return}const W=_.current,re=new Map,ae=new Set;for(const Z of Object.values(t)){const de=Z.process_id;for(const ce of Object.values(Z.publishers)){const Ne=typeof ce.messages_published_total=="number"&&Number.isFinite(ce.messages_published_total)?ce.messages_published_total:0,Ae=`${de}:${ce.endpoint_id}`,we=W.get(Ae);we!==void 0&&Ne>we&&ae.add(`${ce.topic}:${ce.endpoint_id}`),re.set(Ae,Ne)}}_.current=re;const F=Array.from(ae).sort(),X=F.join("|");X!==p.current&&(p.current=X,U(F))},[t]);const z=E.useMemo(()=>e?Kc(e):null,[e]),y=E.useMemo(()=>z?Ll(z.collections):new Map,[z]),I=E.useMemo(()=>z?o1(z.collections,$):[],[z,$]),N=E.useMemo(()=>S2(z),[z]),O=E.useMemo(()=>E2(z),[z]),C=E.useMemo(()=>(W,re)=>N2(z,W,re),[z]),S=E.useMemo(()=>y2(z),[z]),b=E.useMemo(()=>_2(D,S),[D,S]),j=E.useMemo(()=>v2(e,b,S),[b,S,e]),M=I.length>0?I[I.length-1]:null,K=E.useCallback(W=>{z!=null&&z.collections.has(W)&&B(W)},[z]),Y=E.useCallback(W=>{B(y.get(W)??null)},[y]),ee=`${Q}:${M??"root"}`,te=E.useMemo(()=>e?g2(e,Q,M,a,i,{openCollectionScope:K,goUpFromScope:Y}):{nodes:[],edges:[]},[e,Q,M,a,i,K,Y]),pe=E.useMemo(()=>{if(te.nodes.length===0)return T.current.delete(ee),te;if(m2(te))return T.current.set(ee,te),te;const W=T.current.get(ee);return W&&W.nodes.length>0?W:te},[te,ee]),V=E.useMemo(()=>x2(pe,j),[j,pe]),me=W=>{W.startsWith("collection:")&&K(W.slice(11))},he=W=>{if(W.startsWith("unit:")){m==null||m({kind:"unit",unitAddress:W.slice(5)});return}if(W.startsWith("collection:")){m==null||m({kind:"collection",collectionAddress:W.slice(11)});return}if(W.startsWith("stream:")){const re=W.slice(7),ae=N.get(re)??N.get(je(re));if(!ae){m==null||m(null);return}if(ae.direction==="output"){m==null||m({kind:"publisher",streamAddress:re,unitAddress:ae.unitAddress});return}if(ae.direction==="input"){m==null||m({kind:"subscriber",streamAddress:re,unitAddress:ae.unitAddress});return}}m==null||m(null)};if(E.useEffect(()=>{!z||!$||z.collections.has($)||B(null)},[$,z]),E.useEffect(()=>{if(!z||!e){g.current=null;return}const W=Mu(z.units,z.collections,null),re=W.length===1?W[0]:null,ae=re!==null&&l1(e,z.units,z.collections,re),F=re!==null&&z.collections.has(re)&&i1(re,z.units,z.collections)&&!ae,X=`${W.slice().sort().join("|")}::${F?"ready":"wait"}`;g.current!==X&&(g.current=X,$===null&&(!F||!re||B(re)))},[e,$,z]),E.useEffect(()=>{if(!z||!$)return;Mu(z.units,z.collections,$).length===0&&B(null)},[$,z]),k2({autoFocusOnSelection:c,focusSelection:d,focusRequestId:f,flowInitTick:A,flowInstanceRef:x,flowData:pe,topologyComponents:z,activeScope:M,parentCollectionByAddress:y,componentAddressByEndpointId:O,componentAddressByStreamSelection:C,setScopeCollectionAddress:B}),E.useEffect(()=>{const W=()=>{var F;const re=((F=v.current)==null?void 0:F.closest(".dashboard-layout"))??v.current,ae=document.fullscreenElement;if(!re||!ae){P(!1);return}P(ae===re||ae.contains(re))};return document.addEventListener("fullscreenchange",W),()=>{document.removeEventListener("fullscreenchange",W)}},[]),!e)return r?h.jsx("section",{className:"topology-immersive",children:h.jsx("div",{className:"topology-empty-state",children:h.jsx("p",{children:"Waiting for initial snapshot..."})})}):h.jsx(sl,{title:"Topology",subtitle:"Live graph, process ownership, and edge changes",children:h.jsx("div",{className:"placeholder",children:h.jsx("p",{children:"Waiting for initial snapshot..."})})});const ve=Object.keys(e.graph).length,Se=P2(e.graph),k=Object.keys(e.sessions).length,L=Object.values(e.processes),ne=((oe=v.current)==null?void 0:oe.closest(".dashboard-layout"))??v.current??document.documentElement,le=async()=>{if(ne)try{document.fullscreenElement?await document.exitFullscreen():await ne.requestFullscreen()}catch{}},J=h.jsxs("div",{className:"topology-flow-toolbar",children:[h.jsx("span",{className:"topology-flow-toolbar__label",children:"Scope"}),h.jsx("button",{type:"button",className:`topology-layout-btn ${M?"":"is-active"}`,onClick:()=>B(null),children:"Root"}),h.jsx("button",{type:"button",className:"topology-layout-btn",disabled:!M,onClick:()=>{M&&B(y.get(M)??null)},children:"Up"}),I.length>0?h.jsx("span",{className:"topology-scope-sep",children:"|"}):null,I.length>0?h.jsx("span",{className:"topology-scope-trail",children:I.map((W,re)=>{const ae=z==null?void 0:z.collections.get(W),F=(ae==null?void 0:ae.name)??Ai(W),X=ae?[ae.name,ae.address,ae.componentType].join(` +`):W,Z=re===I.length-1;return h.jsxs("span",{className:"topology-scope-segment",children:[Z?h.jsx("span",{className:"topology-scope-tail",title:X,children:F}):h.jsx("button",{type:"button",className:"topology-scope-chip",title:X,onClick:()=>B(W),children:F}),Z?null:h.jsx("span",{className:"topology-scope-slash",children:"/"})]},`scope-${W}`)})}):null]}),q=h.jsxs("div",{className:"topology-viewport-legend","aria-label":"Topology legend",children:[h.jsx("span",{className:"topology-viewport-legend__title",children:"Legend"}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-collection"}),"Collection"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-input"}),"Subscriber"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-output"}),"Publisher"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-topic"}),"Collection Topic"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-relay"}),"Collection Relay"]}),h.jsxs("span",{className:"topology-viewport-legend__item",children:[h.jsx("i",{className:"topology-viewport-legend__swatch is-task"}),"Task"]})]}),H=h.jsxs(h.Fragment,{children:[r?null:J,h.jsxs("div",{className:`topology-flow-shell ${r?"is-immersive":""} ${i?"is-dark":""}`,ref:v,children:[r?h.jsx("div",{className:"topology-viewport-top-controls",children:J}):null,r&&s?h.jsx("div",{className:"topology-viewport-bottom-dock",children:q}):null,r||!s?null:q,h.jsxs(Py,{nodes:V.nodes,edges:V.edges,fitView:!0,fitViewOptions:{padding:.18,minZoom:.4},minZoom:.2,maxZoom:2.4,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onInit:W=>{x.current=W,R(re=>re+1)},onPaneClick:()=>m==null?void 0:m(null),onNodeClick:(W,re)=>{if(re.id.startsWith("scope:")){const ae=W.target,F=ae==null?void 0:ae.closest('[data-scope-up="true"]');if(F){if(!F.disabled){const X=re.id.slice(6);Y(X)}return}}if(re.id.startsWith("collection:")){const ae=W.target;if(ae!=null&&ae.closest('[data-open-collection="true"]')){me(re.id);return}m==null||m({kind:"collection",collectionAddress:re.id.slice(11)});return}he(re.id)},proOptions:{hideAttribution:!0},children:[h.jsx(XT,{color:i?"#243244":"#d5deea",gap:24}),o?h.jsx($T,{pannable:!0,zoomable:!0,maskColor:i?"rgba(2, 6, 23, 0.72)":"rgba(15, 23, 42, 0.10)",style:{background:i?"#0e1728":"#f8fafc",border:i?"1px solid #334155":"1px solid #dbe2ea",borderRadius:8},nodeColor:W=>W.id.startsWith("collection:")?i?"#1d4f79":"#dbeafe":W.id.startsWith("unit:")?i?"#1e3a62":"#bfdbfe":i?"#334155":"#cbd5e1"}):null,h.jsx(HT,{showFitView:!1,showInteractive:!1,children:h.jsx(Gr,{className:"topology-control-btn",title:w?"Exit fullscreen":"Enter fullscreen","aria-label":w?"Exit fullscreen":"Enter fullscreen",onClick:()=>{le()},children:"⛶"})})]},u?`topology-flow-${Q}-${M??"root"}`:"topology-flow-stable")]})]});return r?h.jsx("section",{className:"topology-immersive",children:H}):h.jsxs(sl,{title:"Topology",subtitle:"Low-level publisher/subscriber wiring with optional metadata overlays",children:[h.jsxs("div",{className:"stats-grid",children:[h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Topics"}),h.jsx("strong",{children:ve})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Edges"}),h.jsx("strong",{children:Se})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Sessions"}),h.jsx("strong",{children:k})]}),h.jsxs("article",{className:"stat-card",children:[h.jsx("span",{children:"Processes"}),h.jsx("strong",{children:L.length})]})]}),H,h.jsxs("div",{className:"panel-section",children:[h.jsx("h3",{children:"Process Ownership"}),L.length===0?h.jsx("p",{className:"muted",children:"No process ownership in current snapshot."}):h.jsxs("table",{className:"data-table",children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{children:"Process ID"}),h.jsx("th",{children:"PID"}),h.jsx("th",{children:"Host"}),h.jsx("th",{children:"Units"})]})}),h.jsx("tbody",{children:L.map(W=>h.jsxs("tr",{children:[h.jsx("td",{className:"mono",children:W.process_id.slice(0,8)}),h.jsx("td",{children:W.pid??"-"}),h.jsx("td",{children:W.host??"-"}),h.jsx("td",{children:W.units.length})]},W.process_id))})]})]}),h.jsxs("div",{className:"panel-section",children:[h.jsx("h3",{children:"Recent Topology Changes"}),n.length===0?h.jsx("p",{className:"muted",children:"No topology events received yet."}):h.jsx("ul",{className:"event-list",children:n.slice(0,8).map(W=>h.jsxs("li",{className:"event-item",children:[h.jsx("span",{className:"event-pill",children:W.data.event_type}),h.jsxs("span",{className:"mono",children:["seq ",W.data.seq]}),h.jsx("span",{children:W.data.changed_topics.length>0?W.data.changed_topics.join(", "):"No topic list"})]},`topo-${W.data.seq}`))})]})]})}function Ve(e,t,n,r=!0){return{repr_value:n,structured_value:n,settings_schema:null,serialized_present:!0,patchable:r,patch_error:null,component_type:t,component_name:e}}function rn(e,t,n,r={},s={}){return{process_id:e,pid:t,host:"fixture-host",window_seconds:2,timestamp:1711111111,publishers:r,subscribers:s}}function bp(e,t,n){return{endpoint_id:e,topic:t,messages_published_total:n.messagesPublishedTotal??n.messagesPublishedWindow*10,messages_published_window:n.messagesPublishedWindow,publish_rate_hz_window:n.publishRateHzWindow,inflight_messages_current:n.inflightCurrent??0,num_buffers:n.numBuffers??8,timestamp:n.timestamp??1711111111}}function Ap(e,t,n){return{endpoint_id:e,topic:t,messages_received_total:n.messagesReceivedTotal??n.messagesReceivedWindow*10,messages_received_window:n.messagesReceivedWindow,channel_kind_last:n.channelKindLast??"fifo",timestamp:n.timestamp??1711111111}}function Ut(e,t="builtins.str"){return{address:e,msg_type:t,leaky:!1}}function qt(e,t,n="builtins.str"){return{address:e,msg_type:n,host:"127.0.0.1",port:t}}function ct(e,t,n){return{name:e,subscribes:t,publishes:n}}function $e(e){return String(e).padStart(2,"0")}const sn={name:"root-scope-navigation",health:{status:"ok",graph_session_active:!0,graph_address:"127.0.0.1:25978"},snapshot:{snapshot:{graph:{"SYSTEM/PING_TOPIC":["GLOBAL_PING_TOPIC"]},edge_owners:[],sessions:{"fixture-session":{edges:[{from_topic:"SYSTEM/PING_TOPIC",to_topic:"GLOBAL_PING_TOPIC"}],metadata:{components:{SYSTEM:{name:"SYSTEM",component_type:"fixture.TestSystem",children:["SYSTEM/PING"],topics:{PING:{address:"SYSTEM/PING_TOPIC",msg_type:"builtins.str"}}},"SYSTEM/PING":{name:"PING",component_type:"fixture.MessageGenerator",streams:{OUTPUT:{address:"SYSTEM/PING_TOPIC:ping-output-endpoint",msg_type:"builtins.str",host:"127.0.0.1",port:9001}},tasks:[{name:"emit",subscribes:null,publishes:["SYSTEM/PING_TOPIC"]}]}}}}},processes:{"fixture-process":{process_id:"fixture-process",pid:4201,host:"fixture-host",units:["SYSTEM/PING"]}}},settings:{SYSTEM:Ve("SYSTEM","fixture.TestSystem",{enabled:!0}),"SYSTEM/PING":Ve("PING","fixture.MessageGenerator",{rate_hz:10,message:"ping",timeout_s:"Infinity"})},profiling:{"fixture-process":rn("fixture-process",4201,["SYSTEM/PING"],{"SYSTEM/PING_TOPIC:ping-output-endpoint":{endpoint_id:"ping-output-endpoint",topic:"SYSTEM/PING_TOPIC",messages_published_total:120,messages_published_window:20,publish_rate_hz_window:10,inflight_messages_current:1,num_buffers:8,timestamp:1711111111},"SYSTEM/PING/INPUT_SETTINGS:ping-settings-endpoint":{endpoint_id:"ping-settings-endpoint",topic:"SYSTEM/PING/INPUT_SETTINGS",messages_published_total:1,messages_published_window:0,publish_rate_hz_window:0,inflight_messages_current:0,num_buffers:8,timestamp:1711111111}})}}},A2={name:"wide-fanout",health:sn.health,snapshot:{snapshot:{graph:{"STRESS/SOURCE_A":["STRESS/FANOUT_1","STRESS/FANOUT_2","STRESS/FANOUT_3","STRESS/FANOUT_4","STRESS/FANOUT_5","STRESS/FANOUT_6"],"STRESS/SOURCE_B":["STRESS/FANOUT_1","STRESS/FANOUT_2"],"STRESS/FANOUT_1":["STRESS/SINK_1"],"STRESS/FANOUT_2":["STRESS/SINK_2"],"STRESS/FANOUT_3":["STRESS/SINK_3"],"STRESS/FANOUT_4":["STRESS/SINK_4"],"STRESS/FANOUT_5":["STRESS/SINK_5"],"STRESS/FANOUT_6":["STRESS/SINK_6"]},edge_owners:[],sessions:{"wide-session":{edges:[],metadata:{components:{STRESS:{name:"STRESS",component_type:"fixture.StressCollection",children:["STRESS/AGGREGATOR","STRESS/SINK_1","STRESS/SINK_2","STRESS/SINK_3","STRESS/SINK_4","STRESS/SINK_5","STRESS/SINK_6"]},"STRESS/AGGREGATOR":{name:"AGGREGATOR",component_type:"fixture.AggregatorUnit",streams:{INPUT_ALPHA:{address:"STRESS/SOURCE_A:input-alpha",msg_type:"builtins.str",leaky:!1},INPUT_BETA:{address:"STRESS/SOURCE_B:input-beta",msg_type:"builtins.str",leaky:!1},OUTPUT_1:{address:"STRESS/FANOUT_1:fanout-1",msg_type:"builtins.str",host:"127.0.0.1",port:9101},OUTPUT_2:{address:"STRESS/FANOUT_2:fanout-2",msg_type:"builtins.str",host:"127.0.0.1",port:9102},OUTPUT_3:{address:"STRESS/FANOUT_3:fanout-3",msg_type:"builtins.str",host:"127.0.0.1",port:9103},OUTPUT_4:{address:"STRESS/FANOUT_4:fanout-4",msg_type:"builtins.str",host:"127.0.0.1",port:9104},OUTPUT_5:{address:"STRESS/FANOUT_5:fanout-5",msg_type:"builtins.str",host:"127.0.0.1",port:9105},OUTPUT_6:{address:"STRESS/FANOUT_6:fanout-6",msg_type:"builtins.str",host:"127.0.0.1",port:9106}},tasks:[{name:"normalize_payload",subscribes:"STRESS/SOURCE_A",publishes:["STRESS/FANOUT_1","STRESS/FANOUT_2"]},{name:"deduplicate_messages",subscribes:"STRESS/SOURCE_B",publishes:["STRESS/FANOUT_3","STRESS/FANOUT_4"]},{name:"route_priority_messages",subscribes:"STRESS/SOURCE_A",publishes:["STRESS/FANOUT_5","STRESS/FANOUT_6"]}]},...Object.fromEntries(Array.from({length:6},(e,t)=>{const n=t+1;return[`STRESS/SINK_${n}`,{name:`SINK_${n}`,component_type:"fixture.DebugOutput",streams:{INPUT:{address:`STRESS/FANOUT_${n}:sink-${n}`,msg_type:"builtins.str",leaky:!1}},tasks:[{name:"on_message",subscribes:`STRESS/FANOUT_${n}`,publishes:[]}]}]}))}}}},processes:{"wide-process":{process_id:"wide-process",pid:4301,host:"fixture-host",units:["STRESS/AGGREGATOR","STRESS/SINK_1","STRESS/SINK_2","STRESS/SINK_3","STRESS/SINK_4","STRESS/SINK_5","STRESS/SINK_6"]}}},settings:{STRESS:Ve("STRESS","fixture.StressCollection",{mode:"stress"}),"STRESS/AGGREGATOR":Ve("AGGREGATOR","fixture.AggregatorUnit",{batch_size:64,strategy:"spread"})},profiling:{"wide-process":rn("wide-process",4301)}}},R2={name:"long-labels",health:sn.health,snapshot:{snapshot:{graph:{"LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME":["LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME"]},edge_owners:[],sessions:{"long-session":{edges:[],metadata:{components:{LONG_SCOPE:{name:"EXTRAORDINARILY_VERBOSE_COLLECTION_NAME_FOR_LAYOUT_TESTING",component_type:"fixture.deep.namespace.ExtremelyLongCollectionComponentType",children:["LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME"]},"LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME":{name:"COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME",component_type:"fixture.deep.namespace.componenttypes.ExceptionallyLongComponentTypeName",streams:{OUTPUT_WITH_A_LONG_NAME:{address:"LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME:publisher-endpoint-with-a-very-long-token",msg_type:"fixtures.messages.ReallyLongStructuredMessageTypeName",host:"127.0.0.1",port:9201},INPUT_WITH_A_LONG_NAME:{address:"LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME:subscriber-endpoint-with-a-very-long-token",msg_type:"fixtures.messages.ReallyLongStructuredMessageTypeName",leaky:!1}},tasks:[{name:"task_with_a_surprisingly_long_name_for_a_single_render_chip",subscribes:"LONG_SCOPE/ULTRA_VERBOSE_SUBSCRIBER_TOPIC_NAME",publishes:["LONG_SCOPE/EXTRAORDINARILY_VERBOSE_PUBLISHER_TOPIC_NAME"]}]}}}}},processes:{"long-process":{process_id:"long-process",pid:4401,host:"fixture-host",units:["LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME"]}}},settings:{LONG_SCOPE:Ve("EXTRAORDINARILY_VERBOSE_COLLECTION_NAME_FOR_LAYOUT_TESTING","fixture.deep.namespace.ExtremelyLongCollectionComponentType",{debug_mode_enabled:!0}),"LONG_SCOPE/COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME":Ve("COMPONENT_WITH_EXCEPTIONALLY_LONG_NAME","fixture.deep.namespace.componenttypes.ExceptionallyLongComponentTypeName",{default_payload:"the_quick_brown_fox_jumps_over_the_lazy_dog_repeatedly_to_stress_text_overflow"})},profiling:{"long-process":rn("long-process",4401)}}},M2={name:"semantic-stream-names",health:sn.health,snapshot:{snapshot:{graph:{"SIN/OUTPUT_SIGNAL_TOPIC":["SIN/WAVEFORM_TOPIC"]},edge_owners:[],sessions:{"semantic-stream-session":{edges:[],metadata:{components:{SIN:{name:"SIN",component_type:"fixture.LFO",streams:{INPUT_SIGNAL:Ut("SIN/INPUT_SIGNAL_TOPIC:sin-input-signal","fixtures.array.AxisArray"),INPUT_SETTINGS:Ut("SIN/INPUT_SETTINGS_TOPIC:sin-input-settings","fixtures.config.LFOSettings"),OUTPUT_SIGNAL:qt("SIN/OUTPUT_SIGNAL_TOPIC:sin-output-signal",9211,"fixtures.array.AxisArray")},tasks:[ct("on_signal","SIN/INPUT_SIGNAL_TOPIC",[]),ct("on_settings","SIN/INPUT_SETTINGS_TOPIC",[]),ct("generate",null,["SIN/OUTPUT_SIGNAL_TOPIC"])]}}}}},processes:{"semantic-stream-process":{process_id:"semantic-stream-process",pid:4451,host:"fixture-host",units:["SIN"]}}},settings:{SIN:Ve("SIN","fixture.LFO",{freq:1.5,update_rate:60})},profiling:{"semantic-stream-process":rn("semantic-stream-process",4451)}}},Qn=Array.from({length:6},(e,t)=>`TRACE_LAB/SPARSE_SUB_${$e(t+1)}`),Zn=Array.from({length:8},(e,t)=>`TRACE_LAB/DENSE_SUB_${$e(t+1)}`),O2={name:"profiling-trace-rates",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries([["TRACE_LAB/SPARSE_TOPIC",Qn.map((e,t)=>`TRACE_LAB/SPARSE_SUB_${$e(t+1)}_TOPIC`)],["TRACE_LAB/DENSE_TOPIC",Zn.map((e,t)=>`TRACE_LAB/DENSE_SUB_${$e(t+1)}_TOPIC`)]]),edge_owners:[],sessions:{"trace-session":{edges:[],metadata:{components:{TRACE_LAB:{name:"TRACE_LAB",component_type:"fixture.TraceLabCollection",children:["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn]},"TRACE_LAB/SPARSE_PUB":{name:"SPARSE_PUB",component_type:"fixture.TracePublisherUnit",streams:{OUTPUT:qt("TRACE_LAB/SPARSE_TOPIC:sparse-publisher-endpoint",9901)},tasks:[ct("publish_sparse",null,["TRACE_LAB/SPARSE_TOPIC"])]},"TRACE_LAB/DENSE_PUB":{name:"DENSE_PUB",component_type:"fixture.TracePublisherUnit",streams:{OUTPUT:qt("TRACE_LAB/DENSE_TOPIC:dense-publisher-endpoint",9902)},tasks:[ct("publish_dense",null,["TRACE_LAB/DENSE_TOPIC"])]},...Object.fromEntries(Qn.map((e,t)=>{const n=$e(t+1);return[e,{name:`SPARSE_SUB_${n}`,component_type:"fixture.TraceSubscriberUnit",streams:{INPUT:Ut(`TRACE_LAB/SPARSE_SUB_${n}_TOPIC:sparse-subscriber-${n}`)},tasks:[ct(`consume_sparse_${n}`,`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,[])]}]})),...Object.fromEntries(Zn.map((e,t)=>{const n=$e(t+1);return[e,{name:`DENSE_SUB_${n}`,component_type:"fixture.TraceSubscriberUnit",streams:{INPUT:Ut(`TRACE_LAB/DENSE_SUB_${n}_TOPIC:dense-subscriber-${n}`)},tasks:[ct(`consume_dense_${n}`,`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,[])]}]}))}}}},processes:{"trace-process":{process_id:"trace-process",pid:5001,host:"fixture-host",units:["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn]}}},settings:{TRACE_LAB:Ve("TRACE_LAB","fixture.TraceLabCollection",{trace_enabled:!0}),"TRACE_LAB/SPARSE_PUB":Ve("SPARSE_PUB","fixture.TracePublisherUnit",{publish_rate_hz:1}),"TRACE_LAB/DENSE_PUB":Ve("DENSE_PUB","fixture.TracePublisherUnit",{publish_rate_hz:60})},profiling:{"trace-process":rn("trace-process",5001,["TRACE_LAB/SPARSE_PUB","TRACE_LAB/DENSE_PUB",...Qn,...Zn],{"TRACE_LAB/SPARSE_TOPIC:sparse-publisher-endpoint":bp("sparse-publisher-endpoint","TRACE_LAB/SPARSE_TOPIC",{messagesPublishedWindow:2,publishRateHzWindow:1,numBuffers:4}),"TRACE_LAB/DENSE_TOPIC:dense-publisher-endpoint":bp("dense-publisher-endpoint","TRACE_LAB/DENSE_TOPIC",{messagesPublishedWindow:120,publishRateHzWindow:60,inflightCurrent:2,numBuffers:16})},{...Object.fromEntries(Qn.map((e,t)=>{const n=$e(t+1);return[`TRACE_LAB/SPARSE_SUB_${n}_TOPIC:sparse-subscriber-${n}`,Ap(`sparse-subscriber-${n}`,`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,{messagesReceivedWindow:2,channelKindLast:t%2===0?"fifo":"shared_memory"})]})),...Object.fromEntries(Zn.map((e,t)=>{const n=$e(t+1);return[`TRACE_LAB/DENSE_SUB_${n}_TOPIC:dense-subscriber-${n}`,Ap(`dense-subscriber-${n}`,`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,{messagesReceivedWindow:120,channelKindLast:t<3?"tcp":t%2===0?"fifo":"shared_memory"})]}))})}},traceScenarios:[{processId:"trace-process",publisherEndpointId:"sparse-publisher-endpoint",publisherTopic:"TRACE_LAB/SPARSE_TOPIC",eventIntervalMs:140,samplesPerTick:1,timestampStepNs:1e9,publishDeltaNsBase:94e7,publishDeltaNsJitter:12e7,subscribers:Qn.map((e,t)=>{const n=$e(t+1);return{endpointId:`sparse-subscriber-${n}`,topic:`TRACE_LAB/SPARSE_SUB_${n}_TOPIC`,leaseTimeNsBase:7e6+t*8e5,userSpanNsBase:25e5+t*24e4}})},{processId:"trace-process",publisherEndpointId:"dense-publisher-endpoint",publisherTopic:"TRACE_LAB/DENSE_TOPIC",eventIntervalMs:100,samplesPerTick:12,timestampStepNs:16666667,publishDeltaNsBase:164e5,publishDeltaNsJitter:24e5,subscribers:Zn.map((e,t)=>{const n=$e(t+1);return{endpointId:`dense-subscriber-${n}`,topic:`TRACE_LAB/DENSE_SUB_${n}_TOPIC`,leaseTimeNsBase:13e5+t*14e4,userSpanNsBase:92e4+t*11e4}})}]},L2={name:"nested-collections",health:sn.health,snapshot:{snapshot:{graph:{"LAB/PIPELINE/ROOT_TOPIC":["LAB/PIPELINE/INNER/INNER_TOPIC"],"LAB/PIPELINE/INNER/INNER_TOPIC":["LAB/PIPELINE/LEAF_TOPIC"]},edge_owners:[],sessions:{"nested-session":{edges:[],metadata:{components:{LAB:{name:"LAB",component_type:"fixture.RootCollection",children:["LAB/PIPELINE"]},"LAB/PIPELINE":{name:"PIPELINE",component_type:"fixture.PipelineCollection",children:["LAB/PIPELINE/SOURCE","LAB/PIPELINE/INNER"],topics:{ROOT_TOPIC:{address:"LAB/PIPELINE/ROOT_TOPIC",msg_type:"builtins.str"}}},"LAB/PIPELINE/INNER":{name:"INNER",component_type:"fixture.InnerCollection",children:["LAB/PIPELINE/INNER/SINK"],topics:{INNER_TOPIC:{address:"LAB/PIPELINE/INNER/INNER_TOPIC",msg_type:"builtins.str"}}},"LAB/PIPELINE/SOURCE":{name:"SOURCE",component_type:"fixture.SourceUnit",streams:{OUTPUT:{address:"LAB/PIPELINE/ROOT_TOPIC:source-output",msg_type:"builtins.str",host:"127.0.0.1",port:9301}},tasks:[{name:"emit_root_topic",subscribes:null,publishes:["LAB/PIPELINE/ROOT_TOPIC"]}]},"LAB/PIPELINE/INNER/SINK":{name:"SINK",component_type:"fixture.SinkUnit",streams:{INPUT:{address:"LAB/PIPELINE/INNER/INNER_TOPIC:inner-input",msg_type:"builtins.str",leaky:!1},OUTPUT:{address:"LAB/PIPELINE/LEAF_TOPIC:leaf-output",msg_type:"builtins.str",host:"127.0.0.1",port:9302}},tasks:[{name:"relay_nested_topic",subscribes:"LAB/PIPELINE/INNER/INNER_TOPIC",publishes:["LAB/PIPELINE/LEAF_TOPIC"]}]},"CONTROL/PROBE":{name:"PROBE",component_type:"fixture.RootProbe",streams:{OUTPUT:{address:"CONTROL/PROBE_TOPIC:probe-output",msg_type:"builtins.str",host:"127.0.0.1",port:9303}},tasks:[{name:"probe_root_scope",subscribes:null,publishes:["CONTROL/PROBE_TOPIC"]}]}}}}},processes:{"nested-process":{process_id:"nested-process",pid:4501,host:"fixture-host",units:["LAB/PIPELINE/SOURCE","LAB/PIPELINE/INNER/SINK","CONTROL/PROBE"]}}},settings:{LAB:Ve("LAB","fixture.RootCollection",{enabled:!0}),"LAB/PIPELINE":Ve("PIPELINE","fixture.PipelineCollection",{stage_count:2}),"LAB/PIPELINE/INNER":Ve("INNER","fixture.InnerCollection",{nested:!0})},profiling:{"nested-process":rn("nested-process",4501)}}},$2={name:"orphan-streams",health:sn.health,snapshot:{snapshot:{graph:{"ORPHAN/INPUT_TOPIC":["SYSTEM/PROCESS_TOPIC"],"SYSTEM/PROCESS_TOPIC":["ORPHAN/OUTPUT_TOPIC"]},edge_owners:[],sessions:{"orphan-session":{edges:[],metadata:{components:{"SYSTEM/PROCESSOR":{name:"PROCESSOR",component_type:"fixture.ProcessorUnit",streams:{INPUT:{address:"SYSTEM/PROCESS_TOPIC:processor-input",msg_type:"builtins.str",leaky:!1},OUTPUT:{address:"SYSTEM/PROCESS_TOPIC:processor-output",msg_type:"builtins.str",host:"127.0.0.1",port:9401}},tasks:[{name:"transform_orphan_stream",subscribes:"SYSTEM/PROCESS_TOPIC",publishes:["SYSTEM/PROCESS_TOPIC"]}]}}}}},processes:{"orphan-process":{process_id:"orphan-process",pid:4601,host:"fixture-host",units:["SYSTEM/PROCESSOR"]}}},settings:{"SYSTEM/PROCESSOR":Ve("PROCESSOR","fixture.ProcessorUnit",{amplify:2})},profiling:{"orphan-process":rn("orphan-process",4601)}}},br=12,j2={name:"dense-unit-layout",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries(Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`MATRIX/IN_${n}_TOPIC`,[`MATRIX/OUT_${n}_TOPIC`]]})),edge_owners:[],sessions:{"dense-unit-session":{edges:[],metadata:{components:{MATRIX:{name:"MATRIX",component_type:"fixture.MatrixCollection",children:["MATRIX/ROUTER"]},"MATRIX/ROUTER":{name:"ROUTER",component_type:"fixture.DenseRouter",streams:Object.fromEntries([...Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`INPUT_${n}`,Ut(`MATRIX/IN_${n}_TOPIC:router-input-${n}`)]}),...Array.from({length:br},(e,t)=>{const n=$e(t+1);return[`OUTPUT_${n}`,qt(`MATRIX/OUT_${n}_TOPIC:router-output-${n}`,9500+t)]})]),tasks:Array.from({length:br},(e,t)=>{const n=$e(t+1);return ct(`route_lane_${n}`,`MATRIX/IN_${n}_TOPIC`,[`MATRIX/OUT_${n}_TOPIC`])})}}}}},processes:{"dense-unit-process":{process_id:"dense-unit-process",pid:4701,host:"fixture-host",units:["MATRIX/ROUTER"]}}},settings:{MATRIX:Ve("MATRIX","fixture.MatrixCollection",{lanes:br}),"MATRIX/ROUTER":Ve("ROUTER","fixture.DenseRouter",{lanes:br,parallelism:4})},profiling:{"dense-unit-process":rn("dense-unit-process",4701)}}},an=12,pi=Array.from({length:an},(e,t)=>`MEGA/SRC_${$e(t+1)}`),hi=Array.from({length:an},(e,t)=>`MEGA/SINK_${$e(t+1)}`),B2={name:"massive-fanout",health:sn.health,snapshot:{snapshot:{graph:Object.fromEntries([...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`MEGA/SRC_${n}_TOPIC`,[`MEGA/HUB_IN_${n}_TOPIC`]]}),...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`MEGA/HUB_OUT_${n}_TOPIC`,[`MEGA/SINK_${n}_IN_TOPIC`]]})]),edge_owners:[],sessions:{"mega-session":{edges:[],metadata:{components:{MEGA:{name:"MEGA",component_type:"fixture.MegaScope",children:[...pi,"MEGA/HUB",...hi]},...Object.fromEntries(pi.map((e,t)=>{const n=$e(t+1);return[e,{name:`SRC_${n}`,component_type:"fixture.SourceUnit",streams:{OUTPUT:qt(`MEGA/SRC_${n}_TOPIC:source-output-${n}`,9600+t)},tasks:[ct(`emit_lane_${n}`,null,[`MEGA/SRC_${n}_TOPIC`])]}]})),"MEGA/HUB":{name:"HUB",component_type:"fixture.HubRouter",streams:Object.fromEntries([...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`INPUT_${n}`,Ut(`MEGA/HUB_IN_${n}_TOPIC:hub-input-${n}`)]}),...Array.from({length:an},(e,t)=>{const n=$e(t+1);return[`OUTPUT_${n}`,qt(`MEGA/HUB_OUT_${n}_TOPIC:hub-output-${n}`,9700+t)]})]),tasks:Array.from({length:an},(e,t)=>{const n=$e(t+1);return ct(`fanout_lane_${n}`,`MEGA/HUB_IN_${n}_TOPIC`,[`MEGA/HUB_OUT_${n}_TOPIC`])})},...Object.fromEntries(hi.map((e,t)=>{const n=$e(t+1);return[e,{name:`SINK_${n}`,component_type:"fixture.SinkUnit",streams:{INPUT:Ut(`MEGA/SINK_${n}_IN_TOPIC:sink-input-${n}`)},tasks:[ct(`consume_lane_${n}`,`MEGA/SINK_${n}_IN_TOPIC`,[])]}]}))}}}},processes:{"mega-process":{process_id:"mega-process",pid:4801,host:"fixture-host",units:[...pi,"MEGA/HUB",...hi]}}},settings:{MEGA:Ve("MEGA","fixture.MegaScope",{lanes:an}),"MEGA/HUB":Ve("HUB","fixture.HubRouter",{lanes:an,fanout_mode:"parallel"})},profiling:{"mega-process":rn("mega-process",4801,[...pi,"MEGA/HUB",...hi])}}},F2={name:"cyclic-feedback",health:sn.health,snapshot:{snapshot:{graph:{"ALPHA/OUT_TOPIC":["BETA/IN_TOPIC"],"BETA/OUT_TOPIC":["GAMMA/IN_TOPIC"],"GAMMA/OUT_TOPIC":["ALPHA/IN_TOPIC"],"GAMMA/AUDIT_TOPIC":["MONITOR/IN_TOPIC"]},edge_owners:[],sessions:{"cycle-session":{edges:[],metadata:{components:{ALPHA:{name:"ALPHA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("ALPHA/IN_TOPIC:alpha-input"),OUTPUT:qt("ALPHA/OUT_TOPIC:alpha-output",9801)},tasks:[ct("forward_alpha","ALPHA/IN_TOPIC",["ALPHA/OUT_TOPIC"])]},BETA:{name:"BETA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("BETA/IN_TOPIC:beta-input"),OUTPUT:qt("BETA/OUT_TOPIC:beta-output",9802)},tasks:[ct("forward_beta","BETA/IN_TOPIC",["BETA/OUT_TOPIC"])]},GAMMA:{name:"GAMMA",component_type:"fixture.FeedbackStage",streams:{INPUT:Ut("GAMMA/IN_TOPIC:gamma-input"),OUTPUT:qt("GAMMA/OUT_TOPIC:gamma-output",9803),OUTPUT_AUDIT:qt("GAMMA/AUDIT_TOPIC:gamma-audit",9804)},tasks:[ct("fanout_gamma","GAMMA/IN_TOPIC",["GAMMA/OUT_TOPIC","GAMMA/AUDIT_TOPIC"])]},MONITOR:{name:"MONITOR",component_type:"fixture.MonitorUnit",streams:{INPUT:Ut("MONITOR/IN_TOPIC:monitor-input")},tasks:[ct("observe_cycle","MONITOR/IN_TOPIC",[])]}}}}},processes:{"cycle-process":{process_id:"cycle-process",pid:4901,host:"fixture-host",units:["ALPHA","BETA","GAMMA","MONITOR"]}}},settings:{ALPHA:Ve("ALPHA","fixture.FeedbackStage",{gain:1}),GAMMA:Ve("GAMMA","fixture.FeedbackStage",{audit_enabled:!0})},profiling:{"cycle-process":rn("cycle-process",4901)}}},z2={"root-scope-navigation":sn,"wide-fanout":A2,"long-labels":R2,"semantic-stream-names":M2,"profiling-trace-rates":O2,"nested-collections":L2,"orphan-streams":$2,"dense-unit-layout":j2,"massive-fanout":B2,"cyclic-feedback":F2};function D2(e){return e?z2[e]??null:null}const U2=120,H2=250,W2=1e3,V2=.05,G2=5e3,Y2=60;function Ar(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function K2(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("fixture")}function X2(e,t,n){const r=t.split(".").filter(i=>i.length>0);if(r.length===0)return n;const s=e&&typeof e=="object"&&!Array.isArray(e)?Ar(e):{};let o=s;return r.forEach((i,l)=>{if(l===r.length-1){o[i]=n;return}const u=o[i],c=u&&typeof u=="object"&&!Array.isArray(u)?{...u}:{};o[i]=c,o=c}),s}function Rp(e,t){return t}function Q2(e,t,n){return Math.min(n,Math.max(t,e))}function Z2(e){const t=Rp(void 0,V2),n=Math.max(1,Math.trunc(Rp(void 0,G2))),r=new URLSearchParams({profiling_interval:t.toString(),profiling_max_samples:n.toString()}).toString(),s=e.includes("?")?"&":"?";return`${e}${s}${r}`}function q2(){const e=window.location.protocol==="https:"?"wss":"ws";return Z2(`${e}://${window.location.host}/ws/events`)}async function Mp(e){const t=e.includes("?")?"&":"?",n=`${e}${t}_ts=${Date.now()}`,r=await fetch(n,{cache:"no-store",headers:{"Cache-Control":"no-cache",Pragma:"no-cache"}});if(!r.ok)throw new Error(`${e} failed (${r.status})`);return await r.json()}async function Op(e,t){const n=e.includes("?")?"&":"?",r=`${e}${n}_ts=${Date.now()}`,s=await fetch(r,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json","Cache-Control":"no-cache",Pragma:"no-cache"},body:JSON.stringify(t)});if(!s.ok){let o=`${e} failed (${s.status})`;try{const i=await s.json();typeof i.detail=="string"&&i.detail.length>0&&(o=i.detail)}catch{}throw new Error(o)}return await s.json()}function Lp(e){return typeof e=="object"&&e!==null}function J2(e){return Lp(e)?typeof e.kind=="string"&&Lp(e.data):!1}function eI(e){const[t,n]=E.useState(null),[r,s]=E.useState(null),[o,i]=E.useState(null),[l,a]=E.useState([]),[u,c]=E.useState("connecting"),[d,f]=E.useState(null),[m,v]=E.useState(null),x=Math.round(Q2(((e==null?void 0:e.snapshotPollSeconds)??2)*1e3,500,3e4)),T=E.useMemo(()=>D2(K2()),[]),p=E.useRef(null),g=E.useRef(null),_=E.useRef(new Map),w=E.useRef(new Map),P=E.useRef(new Map),A=E.useCallback(I=>{const N=_.current.get(I);N!==void 0&&(window.clearInterval(N),_.current.delete(I))},[]),R=E.useCallback(()=>{for(const I of _.current.values())window.clearInterval(I);_.current.clear(),w.current.clear(),P.current.clear()},[]),$=E.useCallback(async()=>{if(T){const N=Ar(T.snapshot);s(N),v(Date.now());return}const I=await Mp("/api/snapshot");s(I),v(Date.now())},[T]),B=E.useCallback(async()=>{if(T){n(Ar(T.health));return}const I=await Mp("/api/health");n(I)},[T]);E.useEffect(()=>{if(T)return R(),n(Ar(T.health)),s(Ar(T.snapshot)),i(null),a([]),c("open"),f(null),v(Date.now()),()=>{R()}},[R,T]);const D=E.useCallback(()=>{p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{$().catch(I=>{const N=I instanceof Error?I.message:"Snapshot refresh failed.";f(N)}),p.current=null},H2)},[$]);E.useEffect(()=>{T||(B().catch(I=>{const N=I instanceof Error?I.message:"Health check failed.";f(N)}),$().catch(I=>{const N=I instanceof Error?I.message:"Initial snapshot failed.";f(N)}))},[T,B,$]),E.useEffect(()=>{if(T)return;const I=window.setInterval(()=>{$().catch(N=>{const O=N instanceof Error?N.message:"Snapshot poll failed.";f(O)})},x);return()=>{window.clearInterval(I)}},[T,$,x]),E.useEffect(()=>{if(T)return;let I=!1,N=null;const O=()=>{I||(c("connecting"),N=new WebSocket(q2()),N.onopen=()=>{I||(c("open"),f(null))},N.onmessage=C=>{let S=null;try{S=JSON.parse(C.data)}catch{return}if(!J2(S))return;const b=S;a(j=>[b,...j].slice(0,U2)),b.kind==="topology.changed"&&D(),b.kind==="settings.changed"&&s(j=>{if(!j)return j;const M=b,K=j.settings[M.data.component_address]??null,Y={...j.settings,[M.data.component_address]:{...M.data.value,patchable:(K==null?void 0:K.patchable)??!1,patch_error:(K==null?void 0:K.patch_error)??null,component_type:(K==null?void 0:K.component_type)??null,component_name:(K==null?void 0:K.component_name)??null}};return{...j,settings:Y}}),b.kind==="profiling.trace"&&i(b),b.kind==="system.error"&&f(b.data.message)},N.onerror=()=>{I||c("closed")},N.onclose=()=>{I||(c("closed"),g.current=window.setTimeout(()=>{O()},W2))})};return O(),()=>{I=!0,N!==null&&N.close(),g.current!==null&&window.clearTimeout(g.current),p.current!==null&&window.clearTimeout(p.current)}},[T,D]);const U=E.useMemo(()=>l.filter(I=>I.kind==="topology.changed"),[l]),Q=E.useCallback(async()=>{try{await $()}catch(I){const N=I instanceof Error?I.message:"Snapshot refresh failed.";f(N)}},[$]),z=E.useCallback(async(I,N,O,C=2)=>{if(T){let j=null;return s(M=>{if(!M)return M;const K=M.settings[I];if(!K)return M;const Y=K.structured_value??K.repr_value,ee=X2(Y,N,O);return j={...K,structured_value:ee,repr_value:ee},{...M,settings:{...M.settings,[I]:j}}}),v(Date.now()),{component_address:I,field_path:N,updated_value:j??Ar(T.snapshot.settings[I])}}const S=encodeURIComponent(I),b=await Op(`/api/settings/${S}/field`,{field_path:N,value:O,timeout:C});return s(j=>{if(!j)return j;const M=j.settings[b.component_address]??null;return{...j,settings:{...j.settings,[b.component_address]:{...b.updated_value,patchable:(M==null?void 0:M.patchable)??!0,patch_error:(M==null?void 0:M.patch_error)??null,component_type:(M==null?void 0:M.component_type)??null,component_name:(M==null?void 0:M.component_name)??null}}}}),v(Date.now()),b},[T]),y=E.useCallback(async I=>{if(T){const N=`${I.process_id}:${I.publisher_endpoint_id??"*"}`;if(!I.enabled){if(I.publisher_endpoint_id)A(N);else for(const S of Array.from(_.current.keys()))S.startsWith(`${I.process_id}:`)&&A(S);return{process_id:I.process_id,unit_address:"",enabled:!1,control:{fixture:!0,metrics:I.metrics??[]}}}const O=I.publisher_topic??I.subscriber_topic,C=(T.traceScenarios??[]).find(S=>S.processId===I.process_id&&S.publisherEndpointId===I.publisher_endpoint_id&&S.publisherTopic===O);if(C){A(N),P.current.has(N)||P.current.set(N,Date.now()*1e6),w.current.has(N)||w.current.set(N,0);const S=()=>{const j=P.current.get(N)??Date.now()*1e6,M=w.current.get(N)??0,K=[],Y=new Set(I.metrics??[]),ee=Y.size===0||Y.has("publish_delta_ns"),te=Y.size===0||Y.has("lease_time_ns"),pe=Y.size===0||Y.has("user_span_ns");for(let V=0;V"u"?Number.POSITIVE_INFINITY:window.innerWidth;return Math.max(Zs,e-lI)}function Mi(e){return Math.min(Ri(),Math.max(Zs,Math.round(e)))}function aI(e){return!Number.isFinite(e)||e<=0?null:e>=9466848e5&&e<=41024448e5?e:e>=946684800&&e<=4102444800?e*1e3:null}function uI(e){return e.toLowerCase().includes("collection")}function cI(e){if(e.kind==="unit")return{kind:"unit",unitAddress:e.unitAddress};if(e.kind==="collection")return{kind:"collection",collectionAddress:e.collectionAddress};const t=t1(e.streamAddress);return{kind:e.kind,unitAddress:e.unitAddress,endpointId:t.endpointId,topic:t.topic}}function dI(e,t){var r;const n=((r=t==null?void 0:t[e])==null?void 0:r.component_type)??"";return uI(n)?{kind:"collection",collectionAddress:e}:{kind:"unit",unitAddress:e}}function fI(e){return(e==null?void 0:e.kind)==="unit"?e.unitAddress:(e==null?void 0:e.kind)==="collection"?e.collectionAddress:null}function pI(e){if(!e||typeof e!="object")return xt;const t=e,n=typeof t.snapshotPollSeconds=="number"&&Number.isFinite(t.snapshotPollSeconds)?Math.min(30,Math.max(.5,t.snapshotPollSeconds)):xt.snapshotPollSeconds,r=typeof t.inspectorWidthPx=="number"&&Number.isFinite(t.inspectorWidthPx)?Mi(t.inspectorWidthPx):xt.inspectorWidthPx,s=t.traceMetricsPreset==="publish+lease"||t.traceMetricsPreset==="publish"||t.traceMetricsPreset==="publish+lease+user"?t.traceMetricsPreset:xt.traceMetricsPreset,o=t.edgeConnectorStyle==="orthogonal"||t.edgeConnectorStyle==="smooth"||t.edgeConnectorStyle==="curved"?t.edgeConnectorStyle:xt.edgeConnectorStyle;return{snapshotPollSeconds:n,themeMode:t.themeMode==="dark"?"dark":"light",topologyDefaultLayout:t.topologyDefaultLayout==="lr"?"lr":"tb",edgeConnectorStyle:o,showLegend:typeof t.showLegend=="boolean"?t.showLegend:xt.showLegend,showMiniMap:typeof t.showMiniMap=="boolean"?t.showMiniMap:xt.showMiniMap,traceMetricsPreset:s,autoFitOnLayoutScopeChange:typeof t.autoFitOnLayoutScopeChange=="boolean"?t.autoFitOnLayoutScopeChange:xt.autoFitOnLayoutScopeChange,autoFocusOnInspectorSelection:typeof t.autoFocusOnInspectorSelection=="boolean"?t.autoFocusOnInspectorSelection:xt.autoFocusOnInspectorSelection,showSettingsChannels:typeof t.showSettingsChannels=="boolean"?t.showSettingsChannels:xt.showSettingsChannels,inspectorWidthPx:r}}function hI(e,t,n){const r=[],s=[];return e==="closed"?r.push("WebSocket disconnected"):e==="connecting"&&s.push("WebSocket connecting"),t===null?s.push("Graph health pending"):t||r.push("Graph session inactive"),n&&r.push(n),r.length>0?{tone:"err",tooltip:r.join(" · ")}:s.length>0?{tone:"warn",tooltip:s.join(" · ")}:{tone:"ok",tooltip:"Connected: GraphServer reachable, WebSocket open, session active."}}function mI(){const[e,t]=E.useState(null),[n,r]=E.useState(!1),[s,o]=E.useState(0),[i,l]=E.useState(0),[a,u]=E.useState(!1),[c,d]=E.useState(!0),[f,m]=E.useState(!1),[v,x]=E.useState(null),[T,p]=E.useState(0),[g,_]=E.useState(null),[w,P]=E.useState(null),[A,R]=E.useState(0),[$,B]=E.useState(null),D=E.useRef(null),[U,Q]=E.useState(()=>{try{const H=window.localStorage.getItem($p);return H?pI(JSON.parse(H)):xt}catch{return xt}});E.useEffect(()=>{window.localStorage.setItem($p,JSON.stringify(U))},[U]);const{health:z,snapshot:y,latestTraceEvent:I,connectionState:N,error:O,lastSnapshotUpdateMs:C,topologyEvents:S,patchSettingField:b,setProfilingTraceControl:j}=eI({snapshotPollSeconds:U.snapshotPollSeconds}),M=E.useMemo(()=>{let H=0;for(const oe of Object.values((y==null?void 0:y.profiling)??{}))if(typeof oe.timestamp=="number"&&Number.isFinite(oe.timestamp)){const W=aI(oe.timestamp);W!==null&&(H=Math.max(H,W))}return H<=0?C:H},[C,y==null?void 0:y.profiling]),K=z!=null&&z.graph_address&&z.graph_address.length>0?z.graph_address:iI,Y=M?new Date(M).toLocaleTimeString():"n/a",ee=E.useMemo(()=>hI(N,(z==null?void 0:z.graph_session_active)??null,O),[N,z==null?void 0:z.graph_session_active,O]),te=E.useMemo(()=>U.traceMetricsPreset==="publish"?["publish_delta_ns"]:U.traceMetricsPreset==="publish+lease"?["publish_delta_ns","lease_time_ns"]:["publish_delta_ns","lease_time_ns","user_span_ns"],[U.traceMetricsPreset]),pe=$??U.inspectorWidthPx,V=E.useMemo(()=>({"--inspector-width":`${pe}px`}),[pe]),me=H=>{if(P(null),!H){t(null);return}m(!1);const oe=cI(H);oe.kind==="unit"||oe.kind==="collection"?(d(!1),l(W=>W+1),oe.kind==="unit"&&o(W=>W+1)):(u(!1),o(W=>W+1)),t(oe)},he=H=>{P(H),R(oe=>oe+1)},ve=H=>{Q(oe=>({...oe,inspectorWidthPx:Mi(H)}))},Se=H=>{H.button===0&&(H.preventDefault(),H.currentTarget.setPointerCapture(H.pointerId),D.current={pointerX:H.clientX,widthPx:U.inspectorWidthPx},B(U.inspectorWidthPx))},k=H=>{const oe=D.current;oe&&B(Mi(oe.widthPx+(oe.pointerX-H.clientX)))},L=H=>{D.current&&(D.current=null,H.currentTarget.hasPointerCapture(H.pointerId)&&H.currentTarget.releasePointerCapture(H.pointerId),$!==null&&ve($),B(null))},ne=H=>{const oe=H.key==="ArrowLeft"?jp:H.key==="ArrowRight"?-jp:0;if(oe!==0){H.preventDefault(),ve(U.inspectorWidthPx+oe);return}(H.key==="Home"||H.key==="End")&&(H.preventDefault(),ve(H.key==="Home"?Ri():Zs))},le=()=>{p(H=>H+1),x(null)},J=()=>{if(a){u(!1);return}if(c){u(!0),d(!1);return}u(!0)},q=()=>{if(c){d(!1);return}if(a){d(!0),u(!1);return}d(!0)};return h.jsxs("div",{className:`dashboard-layout is-comfortable ${f?"is-inspector-collapsed ":""}${$===null?"":"is-resizing-inspector "}${U.themeMode==="dark"?"is-dark":""}`,style:V,children:[h.jsxs("aside",{className:"dashboard-inspector dashboard-inspector--pinned",children:[f?null:h.jsx("div",{className:"inspector-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize inspector","aria-valuemin":Zs,"aria-valuemax":Ri(),"aria-valuenow":pe,tabIndex:0,onPointerDown:Se,onPointerMove:k,onPointerUp:L,onPointerCancel:L,onKeyDown:ne,onDoubleClick:()=>ve(xt.inspectorWidthPx)}),h.jsxs("div",{className:`dashboard-inspector__body ${a?"is-publishers-collapsed ":""}${c?"is-settings-collapsed":""}`,children:[h.jsxs("section",{className:"inspector-section inspector-section--split",children:[h.jsxs("header",{className:"inspector-section__header",children:[h.jsx("span",{children:"Publishers"}),h.jsx("button",{type:"button",className:"inspector-section__collapse-btn",onClick:J,children:a?"Expand":"Collapse"})]}),a?null:h.jsx("div",{className:"inspector-section__content inspector-section__content--scroll",children:h.jsx(b1,{graphSnapshot:(y==null?void 0:y.snapshot)??null,profilingSnapshot:(y==null?void 0:y.profiling)??null,latestTraceEvent:I,setProfilingTraceControl:j,darkMode:U.themeMode==="dark",focusPublisherEndpointId:(e==null?void 0:e.kind)==="publisher"?e.endpointId:null,focusPublisherTopic:(e==null?void 0:e.kind)==="publisher"?e.topic:null,focusSubscriberEndpointId:(e==null?void 0:e.kind)==="subscriber"?e.endpointId:null,focusUnitAddress:(e==null?void 0:e.kind)==="unit"?e.unitAddress:null,focusActionId:s,showSettingsChannels:U.showSettingsChannels,hideFilters:!1,defaultTraceMetrics:te,traceDockHost:g,onTraceDockStateChange:x,traceCloseSignal:T,onPublisherSelect:H=>{t({kind:"publisher",unitAddress:H.unitAddress,endpointId:H.endpointId,topic:H.topic}),he({kind:"publisher",streamAddress:`${H.topic}:${H.endpointId}`,unitAddress:H.unitAddress})},onSubscriberSelect:H=>{t({kind:"subscriber",unitAddress:H.unitAddress,endpointId:H.endpointId,topic:H.topic}),he({kind:"subscriber",streamAddress:`${H.topic}:${H.endpointId}`,unitAddress:H.unitAddress})}})})]}),h.jsxs("section",{className:"inspector-section inspector-section--split",children:[h.jsxs("header",{className:"inspector-section__header",children:[h.jsx("span",{children:"Settings"}),h.jsx("button",{type:"button",className:"inspector-section__collapse-btn",onClick:q,children:c?"Expand":"Collapse"})]}),c?null:h.jsx("div",{className:"inspector-section__content inspector-section__content--scroll",children:h.jsx(L1,{settings:(y==null?void 0:y.settings)??null,patchSettingField:b,focusComponentAddress:fI(e),focusActionId:i,onComponentSelect:H=>{if(!H){t(null);return}l(W=>W+1);const oe=dI(H,y==null?void 0:y.settings);t(oe),he(oe.kind==="collection"?{kind:"collection",collectionAddress:oe.collectionAddress}:{kind:"unit",unitAddress:oe.unitAddress})}})})]})]})]}),h.jsxs("div",{className:"dashboard-main",children:[h.jsxs("div",{className:"dashboard-viewport",children:[h.jsx(b2,{graphSnapshot:(y==null?void 0:y.snapshot)??null,profilingSnapshot:(y==null?void 0:y.profiling)??null,recentEvents:S,immersive:!0,showLegend:U.showLegend,showMiniMap:U.showMiniMap,darkMode:U.themeMode==="dark",defaultLayout:U.topologyDefaultLayout,edgeConnectorStyle:U.edgeConnectorStyle,autoFitOnLayoutScopeChange:U.autoFitOnLayoutScopeChange,autoFocusOnSelection:U.autoFocusOnInspectorSelection,focusSelection:w,focusRequestId:A,onEntitySelect:me}),h.jsxs("section",{className:"dashboard-brand-card",children:[h.jsx("span",{className:`dashboard-health-dot is-${ee.tone}`,title:ee.tooltip,"aria-label":ee.tooltip}),h.jsx("img",{src:tI,alt:"ezmsg",className:"dashboard-brand-logo-image"}),h.jsx("div",{className:"dashboard-brand-card__title-row",children:h.jsx("h1",{className:"mono",children:"ezmsg-dashboard"})}),h.jsxs("p",{className:"dashboard-brand-card__meta-line",children:[h.jsxs("span",{className:"mono",children:["GraphServer ",K]}),h.jsx("span",{children:"·"}),h.jsxs("span",{className:"mono",children:["Snapshot ",Y]})]})]}),h.jsxs("div",{className:"dashboard-floating-control-dock","aria-label":"Viewport shortcuts",children:[h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-shortcut-btn",onClick:()=>Q(H=>({...H,topologyDefaultLayout:H.topologyDefaultLayout==="lr"?"tb":"lr"})),title:U.topologyDefaultLayout==="lr"?"Topology layout: left-to-right":"Topology layout: top-to-bottom","aria-label":U.topologyDefaultLayout==="lr"?"Topology layout left-to-right":"Topology layout top-to-bottom",children:U.topologyDefaultLayout==="lr"?h.jsx(oI,{}):h.jsx(sI,{})}),h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-shortcut-btn",onClick:()=>Q(H=>({...H,themeMode:H.themeMode==="dark"?"light":"dark"})),title:U.themeMode==="dark"?"Theme: dark":"Theme: light","aria-label":U.themeMode==="dark"?"Theme dark":"Theme light",children:U.themeMode==="dark"?h.jsx(rI,{}):h.jsx(nI,{})}),h.jsx("button",{type:"button",className:"topology-layout-btn dashboard-floating-gear-btn",onClick:()=>r(!0),title:"Global Settings","aria-label":"Global Settings",children:"⚙"})]}),h.jsx("button",{type:"button",className:`topology-layout-btn dashboard-floating-inspector-btn ${f?"is-collapsed":""}`.trim(),onClick:()=>m(H=>!H),title:f?"Show Inspector":"Hide Inspector","aria-label":f?"Show Inspector":"Hide Inspector",children:f?"«":"»"}),n?h.jsx("div",{className:"dashboard-modal-backdrop",onClick:()=>r(!1),children:h.jsxs("section",{className:"dashboard-modal",onClick:H=>H.stopPropagation(),children:[h.jsxs("header",{className:"dashboard-modal__header",children:[h.jsx("h2",{children:"Global Settings"}),h.jsx("button",{type:"button",className:"topology-layout-btn",onClick:()=>r(!1),children:"Close"})]}),h.jsxs("div",{className:"dashboard-modal__body",children:[h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Snapshot Poll Frequency (seconds)"}),h.jsx("input",{type:"number",min:.5,max:30,step:.5,value:U.snapshotPollSeconds,onChange:H=>{const oe=Number.parseFloat(H.target.value);Number.isFinite(oe)&&Q(W=>({...W,snapshotPollSeconds:Math.max(.5,Math.min(30,oe))}))}})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Theme"}),h.jsxs("select",{value:U.themeMode,onChange:H=>Q(oe=>({...oe,themeMode:H.target.value==="dark"?"dark":"light"})),children:[h.jsx("option",{value:"light",children:"Light"}),h.jsx("option",{value:"dark",children:"Dark"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Default Topology Layout"}),h.jsxs("select",{value:U.topologyDefaultLayout,onChange:H=>Q(oe=>({...oe,topologyDefaultLayout:H.target.value==="lr"?"lr":"tb"})),children:[h.jsx("option",{value:"tb",children:"Top to Bottom"}),h.jsx("option",{value:"lr",children:"Left to Right"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Edge Connector Type"}),h.jsxs("select",{value:U.edgeConnectorStyle,onChange:H=>Q(oe=>({...oe,edgeConnectorStyle:H.target.value==="orthogonal"||H.target.value==="smooth"?H.target.value:"curved"})),children:[h.jsx("option",{value:"curved",children:"Curved (Bezier)"}),h.jsx("option",{value:"orthogonal",children:"Orthogonal (Step)"}),h.jsx("option",{value:"smooth",children:"Smooth Step"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Default Trace Metrics"}),h.jsxs("select",{value:U.traceMetricsPreset,onChange:H=>Q(oe=>({...oe,traceMetricsPreset:H.target.value==="publish"||H.target.value==="publish+lease"?H.target.value:"publish+lease+user"})),children:[h.jsx("option",{value:"publish+lease+user",children:"Publish + Lease + User"}),h.jsx("option",{value:"publish+lease",children:"Publish + Lease"}),h.jsx("option",{value:"publish",children:"Publish Only"})]})]}),h.jsxs("label",{className:"dashboard-setting-row",children:[h.jsx("span",{children:"Inspector Width (px)"}),h.jsx("input",{type:"number",min:Zs,max:Ri(),step:10,value:U.inspectorWidthPx,onChange:H=>{const oe=Number.parseInt(H.target.value,10);Number.isFinite(oe)&&Q(W=>({...W,inspectorWidthPx:Mi(oe)}))}})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showSettingsChannels,onChange:H=>Q(oe=>({...oe,showSettingsChannels:H.target.checked}))}),h.jsx("span",{children:"Show settings channels in Publishers (debug)"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.autoFocusOnInspectorSelection,onChange:H=>Q(oe=>({...oe,autoFocusOnInspectorSelection:H.target.checked}))}),h.jsx("span",{children:"Auto-focus topology on inspector selection"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.autoFitOnLayoutScopeChange,onChange:H=>Q(oe=>({...oe,autoFitOnLayoutScopeChange:H.target.checked}))}),h.jsx("span",{children:"Auto-fit on layout/scope change"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showLegend,onChange:H=>Q(oe=>({...oe,showLegend:H.target.checked}))}),h.jsx("span",{children:"Show legend"})]}),h.jsxs("label",{className:"dashboard-setting-toggle",children:[h.jsx("input",{type:"checkbox",checked:U.showMiniMap,onChange:H=>Q(oe=>({...oe,showMiniMap:H.target.checked}))}),h.jsx("span",{children:"Show minimap"})]})]})]})}):null]}),v!=null&&v.active?h.jsxs("section",{className:"trace-dock",children:[h.jsxs("header",{className:"trace-dock__header",children:[h.jsx("div",{className:"trace-dock__title-wrap",children:h.jsx("h3",{children:"Realtime Profiling Trace"})}),h.jsxs("div",{className:"trace-dock__actions",children:[h.jsx("span",{className:`trace-status ${v.status==="capturing"?"is-live":""}`,children:v.status}),h.jsx("button",{type:"button",className:"topology-layout-btn trace-dock__close-btn",onClick:le,title:"Close trace","aria-label":"Close trace",children:"✕"})]})]}),h.jsx("div",{className:"trace-dock__body",children:h.jsx("div",{className:"trace-dock__host",ref:_})})]}):null]})]})}za.createRoot(document.getElementById("root")).render(h.jsx(G.StrictMode,{children:h.jsx(mI,{})})); diff --git a/src/ezmsg/dashboard/_web/assets/index-CbvX57-3.css b/src/ezmsg/dashboard/_web/assets/index-CbvX57-3.css deleted file mode 100644 index 4492251..0000000 --- a/src/ezmsg/dashboard/_web/assets/index-CbvX57-3.css +++ /dev/null @@ -1 +0,0 @@ -.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:-webkit-grab;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;-webkit-animation:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:-webkit-grab;cursor:grab}.react-flow__node.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:-webkit-grab;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@-webkit-keyframes dashdraw{0%{stroke-dashoffset:10}}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}:root{font-family:Avenir Next,Segoe UI,sans-serif;color:#1f2933;background:radial-gradient(circle at top right,rgba(249,115,22,.18),transparent 45%),radial-gradient(circle at bottom left,rgba(15,23,42,.12),transparent 42%),#f8fafc}*{box-sizing:border-box}body{margin:0;min-height:100vh;color:inherit;background:inherit}#root{min-height:100vh}.dashboard-viewport{position:relative;width:100%;height:100%;overflow:hidden;background:radial-gradient(circle at top right,rgba(249,115,22,.14),transparent 38%),radial-gradient(circle at bottom left,rgba(30,64,175,.12),transparent 42%),#f8fafc}.dashboard-layout.is-dark{color:#dbe7f5}.dashboard-layout.is-dark .dashboard-viewport{background:radial-gradient(circle at top right,rgba(59,130,246,.16),transparent 38%),radial-gradient(circle at bottom left,rgba(20,184,166,.12),transparent 42%),#0b1220}.dashboard-layout.is-dark .dashboard-inspector,.dashboard-layout.is-dark .dashboard-inspector__body,.dashboard-layout.is-dark .inspector-section,.dashboard-layout.is-dark .inspector-section__content,.dashboard-layout.is-dark .trace-dock,.dashboard-layout.is-dark .dashboard-modal,.dashboard-layout.is-dark .dashboard-brand-card,.dashboard-layout.is-dark .topology-flow-toolbar,.dashboard-layout.is-dark .topology-viewport-legend{background:#0f172aeb;border-color:#334155;color:#dbe7f5}.dashboard-layout.is-dark .trace-dock__header{background:#0f172af2;border-bottom-color:#334155}.dashboard-layout.is-dark .dashboard-brand-card__title-row h1,.dashboard-layout.is-dark .topology-viewport-legend__title,.dashboard-layout.is-dark .inspector-section__header,.dashboard-layout.is-dark h2,.dashboard-layout.is-dark h3{color:#f8fafc}.dashboard-layout.is-dark .dashboard-brand-card__meta-line,.dashboard-layout.is-dark .trace-dock__meta,.dashboard-layout.is-dark .topology-viewport-legend__item,.dashboard-layout.is-dark .topology-flow-toolbar__label{color:#a9bdd6}.dashboard-layout.is-dark .topology-layout-btn,.dashboard-layout.is-dark input,.dashboard-layout.is-dark select,.dashboard-layout.is-dark textarea{background:#111b2f;color:#e2e8f0;border-color:#3b4b63}.dashboard-layout.is-dark .topology-layout-btn:hover:not(:disabled),.dashboard-layout.is-dark .topology-layout-btn:focus-visible{border-color:#60a5fa;background:#16243d}.dashboard-layout.is-dark .dashboard-modal-backdrop{background:#020617a3}.dashboard-layout.is-dark .topology-flow-shell.is-dark{background:#0b1220}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls{border-color:#334155;background:#0f172ae6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button{background:#0f172af2;color:#dbe7f5;border-color:#334155}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button svg{fill:currentColor;stroke:currentColor}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button path{fill:currentColor;stroke:currentColor}.trace-dock{border-top:1px solid #cbd5e1;background:#fffffff2;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);min-height:180px;max-height:min(52vh,560px);display:grid;grid-template-rows:auto minmax(0,1fr)}.trace-dock.is-collapsed{min-height:auto;max-height:none;grid-template-rows:auto}.trace-dock__header{display:flex;align-items:center;justify-content:space-between;gap:.6rem;border-bottom:1px solid #e2e8f0;padding:.4rem .6rem;background:#f8fafc}.trace-dock__title-wrap{min-width:0}.trace-dock__title-wrap h3{margin:0;font-size:.82rem;letter-spacing:.02em;text-transform:uppercase;color:#334155}.trace-dock__meta{margin:.14rem 0 0;font-size:.74rem;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.trace-dock__actions{display:inline-flex;align-items:center;gap:.45rem}.trace-dock__close-btn{min-width:1.9rem;padding:.12rem .5rem;font-size:.86rem;color:#334155}.trace-status{font-size:.74rem;border:1px solid #cbd5e1;border-radius:999px;padding:.1rem .45rem;color:#475569}.trace-status.is-live{color:#065f46;border-color:#86efac;background:#dcfce7}.trace-dock__body{min-height:0;overflow:auto;padding:.45rem .6rem .55rem}.trace-dock__host{min-height:220px}.trace-dock__empty{margin:0;font-size:.8rem}.trace-dock-trace{display:flex;flex-direction:column;gap:.35rem}.dashboard-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,var(--inspector-width, 500px));grid-template-rows:minmax(0,1fr);width:100vw;height:100vh;overflow:hidden}.dashboard-layout.is-inspector-collapsed{grid-template-columns:minmax(0,1fr) 0}.dashboard-layout.is-compact{font-size:.94em}.dashboard-layout>*{min-width:0;min-height:0}.dashboard-layout>.dashboard-main{grid-column:1;grid-row:1}.dashboard-layout>.dashboard-inspector--pinned{grid-column:2;grid-row:1}.dashboard-layout.is-inspector-collapsed>.dashboard-inspector--pinned{width:0;min-width:0;border-left:0;overflow:hidden;pointer-events:none}.dashboard-main{display:grid;grid-template-rows:minmax(0,1fr) auto;min-width:0;min-height:0}.dashboard-brand-card{position:absolute;top:.55rem;left:.6rem;z-index:22;width:fit-content;min-width:0;max-width:min(calc(100vw - 6rem),1000px);border:1px solid #cbd5e1;border-radius:12px;background:#fffffff0;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);padding:.36rem .5rem;display:inline-flex;align-items:center;flex-wrap:wrap;gap:.45rem;overflow:hidden}.dashboard-floating-control-dock{position:absolute;top:.55rem;right:.65rem;left:auto;z-index:23;display:inline-flex;align-items:center;gap:.35rem}.dashboard-floating-inspector-btn{position:absolute;top:50%;right:.65rem;left:auto;z-index:23;width:2.2rem;min-width:2.2rem;height:2.2rem;padding:0;border-radius:999px;font-size:1.1rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;transform:translateY(-50%)}.dashboard-floating-inspector-btn.is-collapsed{border-color:#60a5fa;background:#eff6ff;color:#1d4ed8}.dashboard-brand-card__title-row{display:inline-flex;align-items:center;gap:.3rem;min-width:0}.dashboard-brand-card__title-row h1{margin:0;font-size:.95rem;letter-spacing:.02em;color:#0f172a;line-height:1}.dashboard-brand-logo-image{width:1.15rem;height:1.15rem;object-fit:contain;border-radius:4px}.dashboard-health-dot{width:.6rem;height:.6rem;border-radius:999px;display:inline-block;border:1px solid #cbd5e1;box-shadow:0 0 0 2px #ffffffe6}.dashboard-health-dot.is-ok{background:#22c55e;border-color:#16a34a}.dashboard-health-dot.is-warn{background:#f59e0b;border-color:#d97706}.dashboard-health-dot.is-err{background:#ef4444;border-color:#dc2626}.dashboard-brand-card__meta-line{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;display:inline-flex;align-items:center;gap:.38rem;color:#475569;font-size:.77rem}.dashboard-modal-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;z-index:40;background:#0f172a38;display:flex;align-items:flex-start;justify-content:center;padding-top:3.2rem}.dashboard-modal{width:min(520px,calc(100vw - 2rem));border:1px solid #cbd5e1;border-radius:12px;background:#fff;box-shadow:0 22px 48px #0f172a40;overflow:hidden}.dashboard-modal__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;border-bottom:1px solid #e2e8f0;background:#f8fafc;padding:.58rem .72rem}.dashboard-modal__header h2{margin:0;font-size:.9rem}.dashboard-modal__body{display:flex;flex-direction:column;gap:.65rem;padding:.7rem .75rem .8rem}.dashboard-setting-row{display:flex;align-items:center;justify-content:space-between;gap:.7rem;font-size:.82rem}.dashboard-setting-row input,.dashboard-setting-row select{width:10.5rem;border:1px solid #cbd5e1;border-radius:8px;padding:.32rem .5rem;font:inherit;background:#fff}.dashboard-setting-toggle{display:inline-flex;align-items:center;gap:.5rem;font-size:.82rem;color:#334155}.dashboard-modal__suggestions{border-top:1px solid #e2e8f0;padding-top:.55rem}.dashboard-modal__suggestions p{margin:0 0 .35rem;font-size:.78rem;color:#334155;font-weight:600}.dashboard-modal__suggestions ul{margin:0;padding-left:1.1rem;color:#475569;font-size:.78rem;line-height:1.45}.dashboard-inspector{position:absolute;top:0;right:0;z-index:25;height:100vh;width:min(520px,44vw);border-left:1px solid #cbd5e1;background:#f8fafcf5;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);display:flex;flex-direction:column;transform:translate(100%);opacity:0;pointer-events:none;transition:transform .18s ease,opacity .18s ease}.dashboard-inspector--pinned{position:relative;top:0;right:auto;width:100%;height:100%;border-left:0;border-right:0;border-left:1px solid #cbd5e1;transform:none;opacity:1;pointer-events:auto;transition:none}.inspector-resize-handle{position:absolute;top:0;bottom:0;left:-3px;width:7px;z-index:26;cursor:col-resize;touch-action:none;background:transparent;transition:background .12s ease}.inspector-resize-handle:hover,.inspector-resize-handle:focus-visible,.dashboard-layout.is-resizing-inspector .inspector-resize-handle{background:#6ea8fe;outline:none}.dashboard-layout.is-dark .inspector-resize-handle:hover,.dashboard-layout.is-dark .inspector-resize-handle:focus-visible,.dashboard-layout.is-dark.is-resizing-inspector .inspector-resize-handle{background:#4f7fd4}.dashboard-layout.is-resizing-inspector{cursor:col-resize;-webkit-user-select:none;user-select:none}.dashboard-inspector__body{flex:1;min-height:0;overflow:hidden;padding:.5rem;display:grid;grid-template-rows:minmax(0,1fr) minmax(0,1fr);gap:.5rem}.dashboard-inspector__body.is-publishers-collapsed{grid-template-rows:auto minmax(0,1fr)}.dashboard-inspector__body.is-settings-collapsed{grid-template-rows:minmax(0,1fr) auto}.dashboard-inspector__body.is-publishers-collapsed.is-settings-collapsed{grid-template-rows:auto auto}.dashboard-inspector__body .panel{margin:0}.inspector-section{border:1px solid #dbe2ea;border-radius:10px;background:#ffffffe6;overflow:hidden}.inspector-section--split{min-height:0;display:flex;flex-direction:column}.inspector-section+.inspector-section{margin-top:0}.inspector-section__header{display:flex;align-items:center;justify-content:space-between;gap:.45rem;font-size:.82rem;font-weight:700;color:#0f172a;padding:.42rem .55rem;border-bottom:1px solid #e2e8f0;background:#f8fafc}.inspector-section__collapse-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#475569;font:inherit;font-size:.72rem;padding:.1rem .48rem;cursor:pointer}.inspector-section__content{padding:.5rem;container-type:inline-size}.inspector-section__content--scroll{min-height:0;overflow:auto;padding:.45rem}.app-shell{max-width:1280px;margin:0 auto;padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.app-header{display:flex;flex-direction:column;gap:.2rem}.app-header h1{margin:0;font-size:2rem;letter-spacing:.02em}.app-header p{margin:0;color:#4b5563}.status-row{margin-top:.8rem;display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}.status-pill{border-radius:999px;padding:.25rem .65rem;font-size:.8rem;font-weight:700;border:1px solid #d1d5db}.status-pill.is-open{color:#065f46;background:#d1fae5;border-color:#6ee7b7}.status-pill.is-connecting{color:#9a3412;background:#ffedd5;border-color:#fdba74}.status-pill.is-closed{color:#7f1d1d;background:#fee2e2;border-color:#fca5a5}.refresh-btn{border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:.35rem .7rem;font:inherit;cursor:pointer}.refresh-btn:hover{border-color:#94a3b8}.snapshot-time{font-size:.78rem;color:#475569}.error-text{margin:.6rem 0 0;color:#b91c1c;font-size:.9rem}.timestamp{margin-top:.4rem;font-size:.85rem;color:#6b7280}.panel-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}.panel{grid-column:span 12;border:1px solid #d1d5db;border-radius:14px;padding:1rem;background:#ffffffe6;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.panel__header h2{margin:0;font-size:1.1rem}.panel__header p{margin:.25rem 0 0;color:#4b5563;font-size:.92rem}.panel__body{margin-top:.8rem;display:flex;flex-direction:column;gap:.8rem}.panel.panel--headerless .panel__body{margin-top:0}.placeholder p{margin:0 0 .5rem;font-weight:600}.placeholder ul{margin:0;padding-left:1.25rem;line-height:1.6}.stats-grid{display:grid;gap:.6rem;grid-template-columns:repeat(2,minmax(0,1fr))}.stat-card{border:1px solid #d1d5db;border-radius:10px;background:#fff;padding:.7rem;display:flex;flex-direction:column;gap:.3rem}.stat-card span{color:#475569;font-size:.8rem}.stat-card strong{font-size:1.15rem}.panel-section h3{margin:0 0 .5rem;font-size:.9rem;letter-spacing:.02em;text-transform:uppercase;color:#334155}.data-table{width:100%;border-collapse:collapse;font-size:.86rem}.data-table th,.data-table td{border-bottom:1px solid #e5e7eb;text-align:left;padding:.45rem .3rem;vertical-align:top}.data-table th{font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;color:#475569}.mono{font-family:SF Mono,Menlo,Monaco,monospace}.muted{margin:0;color:#64748b}.event-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:.4rem}.event-item{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;border:1px solid #e2e8f0;border-radius:8px;padding:.4rem .6rem;background:#fff;font-size:.84rem}.event-pill{font-size:.72rem;border-radius:999px;border:1px solid #fde68a;color:#78350f;background:#fef3c7;font-weight:700;padding:.15rem .5rem}.topology-flow-shell{position:relative;border:1px solid #dbe2ea;border-radius:12px;overflow:hidden;background:#fff;height:640px}.topology-immersive{position:absolute;top:0;right:0;bottom:0;left:0;padding:0;display:flex;flex-direction:column;gap:0}.topology-empty-state{border:1px solid #dbe2ea;border-radius:12px;background:#ffffffe6;padding:.8rem;color:#475569}.topology-flow-shell.is-immersive{border:0;border-radius:0;flex:1;min-height:0;height:auto}.topology-viewport-bottom-dock{position:absolute;left:3.15rem;bottom:.9rem;z-index:11;display:inline-flex;flex-direction:column;align-items:flex-start;gap:.22rem}.topology-viewport-bottom-dock .topology-viewport-legend{position:static;padding:.2rem .38rem}.topology-viewport-top-controls{position:absolute;left:.6rem;top:3.02rem;z-index:12}.topology-viewport-top-controls .topology-flow-toolbar{border:1px solid #d1d9e5;border-radius:10px;background:#fffffff0;padding:.2rem .38rem;gap:.26rem}.topology-flow-shell:fullscreen{height:100vh;border-radius:0}.topology-flow-shell:-webkit-full-screen{height:100vh;border-radius:0}.topology-flow-shell .react-flow__renderer{background:#f8fafc}.topology-viewport-legend{position:absolute;top:.55rem;left:.55rem;z-index:10;display:inline-flex;flex-wrap:wrap;align-items:center;gap:.25rem .55rem;border:1px solid #d1d9e5;border-radius:10px;background:#fffffff0;padding:.3rem .45rem;font-size:.68rem;color:#475569}.topology-viewport-legend__title{font-weight:700;color:#334155;margin-right:.15rem}.topology-viewport-legend__item{display:inline-flex;align-items:center;gap:.3rem;line-height:1;white-space:nowrap}.topology-viewport-legend__swatch{width:.55rem;height:.55rem;border-radius:999px;display:inline-block}.topology-viewport-legend__swatch.is-input{border:1px solid #c7d2fe;background:#eef2ff}.topology-viewport-legend__swatch.is-collection{border:1px solid #94a3b8;background:#e2e8f0}.topology-viewport-legend__swatch.is-output{border:1px solid #7dd3fc;background:#ecfeff}.topology-viewport-legend__swatch.is-topic{border:1px solid #f28e2b;background:#fff1dd}.topology-viewport-legend__swatch.is-relay{border:1px solid #b07aa1;background:#f8eef5}.topology-viewport-legend__swatch.is-task{border:1px solid #dbe2ea;background:#f1f5f9}.topology-flow-toolbar{display:flex;align-items:center;gap:.45rem;flex-wrap:wrap}.topology-flow-toolbar__label{font-size:.74rem;color:#475569;font-weight:600}.topology-layout-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#475569;font-size:.72rem;padding:.2rem .6rem;cursor:pointer}.topology-layout-btn.is-active{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff;font-weight:600}.topology-layout-btn:disabled{opacity:.48;cursor:default}.dashboard-floating-gear-btn.topology-layout-btn,.dashboard-floating-shortcut-btn.topology-layout-btn{width:2.2rem;min-width:2.2rem;height:2.2rem;padding:0;border-radius:999px;font-size:1.1rem;line-height:1;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.dashboard-floating-shortcut-btn svg{width:1rem;height:1rem;display:block}.topology-control-btn{font-size:.88rem;line-height:1}.topology-scope-trail{display:inline-flex;align-items:center;gap:.1rem;flex-wrap:wrap}.topology-scope-sep{font-size:.76rem;color:#64748b;margin:0 .15rem}.topology-scope-segment{display:inline-flex;align-items:center;gap:.16rem}.topology-scope-slash{color:#94a3b8;font-size:.75rem}.topology-scope-chip{border:1px solid #d1d9e5;border-radius:999px;background:#fff;color:#64748b;font-size:.68rem;padding:.1rem .48rem;cursor:pointer;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.topology-scope-tail{color:#1e293b;font-size:.72rem;font-weight:700;padding:.1rem;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-flow-shell .react-flow__handle{opacity:0;width:2px;height:2px;border:0}.topology-flow-shell .react-flow__edge.topology-internal-edge .react-flow__edge-path{stroke-opacity:.95}.topology-unit-label{display:flex;flex-direction:column;gap:.03rem;font-size:.66rem;color:#334155;width:100%;align-items:flex-start;text-align:left}.topology-title-row{display:inline-flex;align-items:center;gap:.34rem;min-width:0;max-width:100%}.topology-title-row--collection{width:100%;align-items:center;justify-content:space-between;gap:.5rem}.topology-title-row--collection>.topology-title-row{flex:1 1 auto;min-width:0}.topology-title-row--collection>.topology-title-row strong{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-title-row--collection>.topology-title-row .topology-unit-type{flex:0 0 auto}.topology-unit-label strong{font-size:.78rem;line-height:1;letter-spacing:.01em;color:#0f172a;flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-unit-label>.topology-title-row .topology-unit-type{transform:translateY(-.04rem)}.topology-unit-type{display:inline-flex;align-items:center;width:fit-content;max-width:min(100%,11.5rem);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;border:1px solid #dbe2ea;border-radius:999px;padding:.04rem .34rem;color:#475569;background:#f1f5f9;font-size:.56rem;line-height:1}.topology-unit-address{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.54rem;color:#64748b;letter-spacing:.01em;margin-top:-.02rem}.topology-stream-label{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;gap:0}.topology-stream-name{display:block;line-height:1;text-transform:uppercase;letter-spacing:.03em;font-size:.54rem;max-width:100%;overflow:hidden;text-overflow:ellipsis}.topology-stream-type{display:block;line-height:1;font-size:.46rem;letter-spacing:.01em;text-transform:none;opacity:.92;max-width:100%;overflow:hidden;text-overflow:ellipsis}.topology-stream-label.is-input{color:#3730a3}.topology-stream-label.is-output{color:#0f766e}.topology-stream-label.is-unknown{color:#334155}.topology-stream-label.is-collection{color:inherit}.topology-task-label{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.52rem;color:#6b7280;letter-spacing:.008em;font-weight:500}.topology-collection-label{display:flex;flex-direction:column;gap:.06rem;font-size:.68rem;align-items:flex-start}.topology-collection-label strong{font-size:.72rem}.topology-collection-label .mono{line-height:1.1}.topology-collection-open-btn,.topology-collection-scope-up-btn{border-radius:999px;font:inherit;font-size:.62rem;font-weight:600;padding:.16rem .58rem;min-height:1.5rem;min-width:4.4rem;cursor:pointer;line-height:1.1;white-space:nowrap;flex:0 0 auto;-webkit-user-select:none;user-select:none}.topology-collection-open-btn{border:1px solid #93c5fd;background:#eff6ff;color:#1d4ed8}.topology-collection-scope-up-btn{border:1px solid #94a3b8;background:#f8fafc;color:#334155}.topology-collection-scope-up-btn:hover:not(:disabled){border-color:#64748b;background:#eef2f7}.topology-collection-scope-up-btn:disabled{opacity:.52;cursor:default}.topology-collection-open-btn:hover{border-color:#60a5fa;background:#dbeafe}.topology-collection-label--scope{gap:.2rem}.topology-orphan-label{display:flex;flex-direction:column;gap:.2rem;font-size:.68rem;color:#334155}.topology-orphan-label strong{font-size:.74rem;color:#0f172a}.publisher-list{display:flex;flex-direction:column;gap:.55rem}.publisher-row{border:1px solid #dbe2ea;border-radius:12px;background:#fff;overflow:hidden}.publisher-row.activity-idle{border-color:#cbd5e1}.publisher-row.activity-active{border-color:#86efac}.publisher-row.activity-backpressure{border-color:#fca5a5}.publisher-row__toggle{width:100%;border:0;background:transparent;text-align:left;padding:.65rem;cursor:pointer}.publisher-row__top{display:flex;justify-content:space-between;align-items:flex-start;gap:.6rem}.publisher-row__identity{display:flex;align-items:start;gap:.45rem;min-width:0}.publisher-row__identity-text{min-width:0}.publisher-row__identity p{margin:0}.publisher-topic{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.publisher-topic{font-size:1.06rem;line-height:1.2}.publisher-row__metrics{margin-top:.5rem;display:grid;grid-template-columns:repeat(4,minmax(72px,1fr));gap:.5rem}.publisher-row__metrics div{display:flex;flex-direction:column;gap:.2rem}.publisher-row__metrics span{color:#64748b;font-size:.73rem}.publisher-row__metrics strong{font-size:.9rem}.publisher-caret{color:#334155;font-size:1rem;line-height:1;padding-top:.1rem}.publisher-row__details{border-top:1px solid #e2e8f0;background:#f8fafc;padding:.65rem;display:flex;flex-direction:column;gap:.7rem}.publisher-kpis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.55rem}.mini-kpi{border:1px solid #dbe2ea;border-radius:9px;background:#fff;padding:.55rem;display:flex;flex-direction:column;gap:.25rem}.mini-kpi span{color:#64748b;font-size:.74rem}.mini-kpi strong{font-size:.92rem}.publisher-trace-button{width:100%;border:1px solid #15803d;border-radius:9px;background:linear-gradient(180deg,#22c55e,#16a34a);color:#fff;font:inherit;font-size:.9rem;font-weight:700;letter-spacing:.01em;padding:.5rem .65rem;display:inline-flex;align-items:center;justify-content:center;gap:.42rem;cursor:pointer;margin-bottom:.45rem}.publisher-trace-button.is-stop{border-color:#b91c1c;background:linear-gradient(180deg,#ef4444,#dc2626)}.publisher-trace-button:disabled{border-color:#94a3b8;background:#94a3b8;cursor:default}.publisher-trace-button__icon{font-size:.72rem;line-height:1}.publisher-detail-line{display:flex;justify-content:space-between;align-items:center;gap:.7rem;flex-wrap:wrap}.subscriber-item__detail .publisher-detail-line{margin-top:.45rem}.publisher-endpoint{display:flex;flex-direction:column;gap:.18rem;min-width:220px;flex:1}.publisher-endpoint span{color:#64748b;font-size:.74rem}.publisher-endpoint code{font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.timing-trace{display:flex;flex-direction:column;gap:.35rem}.timing-trace__controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.4rem .55rem}.timing-trace__controls-left{display:inline-flex;align-items:center;gap:.35rem;flex-wrap:wrap;min-width:0}.timing-trace__controls-right{display:inline-flex;align-items:center;gap:.35rem;flex-wrap:nowrap;justify-content:flex-end;margin-left:auto}.timing-trace__axis-input{display:inline-flex;align-items:center;gap:.3rem;font-size:.72rem;color:#475569}.timing-trace__axis-input--ymax{margin-left:.15rem}.timing-trace__axis-input input{width:4.8rem;border:1px solid #cbd5e1;border-radius:6px;padding:.18rem .35rem;font-size:.74rem;font-family:Avenir Next,Segoe UI,sans-serif}.timing-trace__axis-input input:disabled{background:#f1f5f9;color:#94a3b8}.timing-trace__mode-toggle{display:inline-flex;align-items:center;border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#334155;font-size:.72rem;line-height:1;padding:.2rem .55rem;cursor:pointer}.timing-trace__mode-toggle.is-auto{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff}.timing-trace__mode-toggle-label{min-width:2.6rem;text-align:center}.timing-trace__canvas{width:100%;height:320px;display:block;border-radius:8px;border:1px solid #d7e2ee;background:linear-gradient(180deg,#f8fbff,#f1f6fc);box-shadow:inset 0 1px #ffffffbf}.timing-trace__legend{display:flex;flex-wrap:wrap;gap:.5rem .75rem}.timing-trace__legend-item{display:inline-flex;align-items:center;gap:.35rem;font-size:.72rem;color:#475569}.timing-trace__legend-item.is-static{opacity:.95;padding:.12rem .08rem .12rem 0}.timing-trace__legend-toggle{border:1px solid #cbd5e1;border-radius:999px;background:#fff;cursor:pointer;padding:.12rem .5rem;font-size:.72rem;line-height:1.2;font-family:inherit;opacity:.75}.timing-trace__legend-toggle.is-active{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff;opacity:1}.timing-trace__legend-item i{width:.55rem;height:.55rem;border-radius:999px;display:inline-block}.trace-metric-list{display:flex;flex-direction:column;gap:.45rem}.trace-metric-card{border:1px solid #dbe2ea;border-radius:8px;background:#fff;padding:.45rem}.trace-metric-card__header{display:flex;flex-wrap:wrap;gap:.5rem;font-size:.76rem;color:#334155}.trace-sparkline{margin-top:.35rem;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(4px,1fr);align-items:end;gap:2px;min-height:40px}.trace-sparkline span{background:linear-gradient(180deg,#2563eb,#60a5fa);border-radius:2px 2px 0 0;min-height:4px}.trace-channel-kinds{margin:.35rem 0 0;font-size:.74rem;color:#475569}.subscriber-section-header{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin-bottom:.45rem}.subscriber-section-header h3{margin:0}.subscriber-filter-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;padding:.25rem .55rem;font:inherit;font-size:.74rem;cursor:pointer;color:#334155}.subscriber-filter-btn.is-active{border-color:#16a34a;background:#dcfce7;color:#166534;font-weight:600}.subscriber-list{display:flex;flex-direction:column;gap:.45rem}.subscriber-item{border:1px solid #dbe2ea;border-radius:10px;background:#fff;overflow:hidden}.subscriber-item.is-expanded{border-color:#93c5fd}.subscriber-item__summary{cursor:pointer;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem;align-items:start;padding:.45rem .55rem;border:0;background:#fff;text-align:left;width:100%;font:inherit}.subscriber-item__identity p{margin:0}.subscriber-item__identity{min-width:0}.subscriber-topic-short{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.subscriber-topic-with-color{display:flex;align-items:center;gap:.4rem;max-width:100%;min-width:0}.subscriber-trace-dot{width:.55rem;height:.55rem;border-radius:999px;flex:0 0 auto;display:inline-block}.subscriber-topic-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.subscriber-item__metrics{display:flex;align-items:center;gap:.55rem}.subscriber-item__metrics span{display:flex;flex-direction:column;align-items:flex-end;gap:.1rem}.subscriber-item__metrics em{font-style:normal;font-size:.68rem;color:#64748b}.subscriber-item__metrics strong{font-size:.8rem}.subscriber-item__detail{border-top:1px solid #e2e8f0;background:#f8fafc;padding:.45rem .55rem}.subscriber-item__detail dl{margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.4rem .8rem}.subscriber-item__detail dt{margin:0;font-size:.7rem;color:#64748b;text-transform:uppercase;letter-spacing:.03em}.subscriber-item__detail dd{margin:.1rem 0 0;font-size:.82rem;word-break:break-word}.subscriber-item__detail-row-full{grid-column:1 / -1}.settings-component-list{display:flex;flex-direction:column;gap:.55rem}.settings-search input{width:100%;border:1px solid #cbd5e1;border-radius:8px;padding:.32rem .46rem;font:inherit;font-size:.8rem;background:#fff}.settings-component-row{border:1px solid #dbe2ea;border-radius:12px;background:#fff;overflow:hidden}.settings-component-row.is-expanded{border-color:#93c5fd}.settings-component-row__toggle{width:100%;border:0;background:#fff;text-align:left;cursor:pointer;font:inherit;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.6rem;padding:.45rem .55rem}.settings-component-row__identity{min-width:0;display:flex;flex-direction:column;gap:.1rem}.settings-component-row__heading{display:flex;align-items:center;gap:.4rem;min-width:0}.settings-component-title{margin:0;font-size:.82rem;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-component-address{margin:0;font-size:.74rem;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-component-row__meta{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto}.settings-access{border:1px solid #d1d5db;border-radius:999px;padding:.08rem .42rem;font-size:.66rem;text-transform:uppercase;letter-spacing:.03em}.settings-access.is-patchable{color:#166534;background:#dcfce7;border-color:#86efac}.settings-access.is-readonly{color:#475569;background:#f1f5f9;border-color:#cbd5e1}.settings-detail{border-top:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;padding:.5rem;margin:0 .45rem .45rem}.settings-detail h3{margin:0;font-size:.82rem;color:#0f172a}.settings-detail__heading{display:flex;align-items:center;gap:.45rem;margin-bottom:.25rem}.settings-type{display:inline-block;font-size:.72rem;border-radius:999px;border:1px solid #bfdbfe;background:#eff6ff;color:#1d4ed8;font-weight:700;padding:.1rem .45rem;width:fit-content;flex:0 1 auto;min-width:0;max-width:min(100%,14rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-fields{display:flex;flex-direction:column;gap:.45rem;max-height:440px;overflow:auto;padding-right:.2rem}.settings-field-row{border:1px solid #dbe2ea;border-radius:10px;background:#fff;padding:.45rem}.settings-field-row.is-disabled{background:#f1f5f9;border-color:#d0dae5}.settings-field-row__meta{display:flex;flex-direction:column;gap:.2rem}.settings-field-row__meta label{font-size:.76rem}.settings-field-row__control{margin-top:.32rem;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.34rem;align-items:start}.settings-field-row__control.is-boolean{align-items:center}.settings-field-row__control input,.settings-field-row__control textarea,.settings-field-row__control select{border:1px solid #d1d5db;border-radius:7px;padding:.25rem .38rem;font-size:.79rem;font:inherit;background:#fff;width:100%}.settings-field-row__control textarea{min-height:60px;resize:vertical}.settings-field-row__control button{border:1px solid #2563eb;border-radius:7px;background:#2563eb;color:#fff;font:inherit;font-size:.78rem;font-weight:700;padding:.24rem .48rem;cursor:pointer;min-width:3.5rem}.settings-field-row__control button:disabled{background:#94a3b8;border-color:#94a3b8;cursor:default}.settings-field-row__control input:disabled,.settings-field-row__control textarea:disabled,.settings-field-row__control select:disabled{background:#e5ebf3;color:#64748b}.patch-checkbox{display:flex;flex-direction:row;align-items:center;gap:.45rem;margin-top:0;min-height:2rem;justify-self:start}.patch-checkbox input[type=checkbox]{width:auto;min-width:0;margin:0;padding:0;border:none;border-radius:0;background:transparent;accent-color:#2563eb}.patch-checkbox span{white-space:nowrap}.patch-status{font-size:.8rem;margin-top:.35rem}.patch-status.ok{color:#065f46}.patch-status.err{color:#b91c1c}.dashboard-layout.is-dark .dashboard-inspector{border-left-color:#314155;background:#0c1526}.dashboard-layout.is-dark .dashboard-inspector__body{background:#0c1526}.dashboard-layout.is-dark .inspector-section{border-color:#34465e;background:#132035}.dashboard-layout.is-dark .inspector-section__header{border-bottom-color:#34465e;background:#16263e;color:#e6edf8}.dashboard-layout.is-dark .inspector-section__collapse-btn{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .dashboard-modal__header{border-bottom-color:#34465e;background:#16263e}.dashboard-layout.is-dark .dashboard-setting-row,.dashboard-layout.is-dark .dashboard-setting-toggle{color:#d7e4f5}.dashboard-layout.is-dark .inspector-section__content{background:#132035}.dashboard-layout.is-dark .panel{border-color:#34465e;background:#132035;color:#e6edf8}.dashboard-layout.is-dark .panel__header p,.dashboard-layout.is-dark .panel-section,.dashboard-layout.is-dark .panel-section h3{color:#b6c7dd}.dashboard-layout.is-dark .publisher-row,.dashboard-layout.is-dark .subscriber-item,.dashboard-layout.is-dark .settings-component-row,.dashboard-layout.is-dark .trace-metric-card,.dashboard-layout.is-dark .mini-kpi,.dashboard-layout.is-dark .settings-field-row{border-color:#3a4d66;background:#17263d;color:#e6edf8}.dashboard-layout.is-dark .publisher-row.activity-idle{border-color:#3a4d66}.dashboard-layout.is-dark .publisher-row.activity-active{border-color:#4ade80}.dashboard-layout.is-dark .publisher-row.activity-backpressure{border-color:#f87171}.dashboard-layout.is-dark .publisher-row__toggle{color:#e6edf8}.dashboard-layout.is-dark .publisher-row__details,.dashboard-layout.is-dark .subscriber-item__detail,.dashboard-layout.is-dark .settings-detail{border-top-color:#34465e;background:#1a2a44}.dashboard-layout.is-dark .settings-component-row__toggle,.dashboard-layout.is-dark .subscriber-item__summary{background:#17263d;color:#e6edf8}.dashboard-layout.is-dark .publisher-row__metrics span,.dashboard-layout.is-dark .publisher-endpoint span,.dashboard-layout.is-dark .settings-component-address,.dashboard-layout.is-dark .subscriber-item__metrics em,.dashboard-layout.is-dark .subscriber-item__detail dt,.dashboard-layout.is-dark .timing-trace__legend-item,.dashboard-layout.is-dark .timing-trace__axis-input,.dashboard-layout.is-dark .muted{color:#9eb2cb}.dashboard-layout.is-dark .timing-trace__canvas{border-color:#1e293b;background:#0f172a;box-shadow:none}.dashboard-layout.is-dark .settings-access.is-readonly{color:#c2d0e3;background:#1b2a42;border-color:#4a5f7e}.dashboard-layout.is-dark .settings-access.is-patchable{color:#c9f4db;background:#153829;border-color:#22c55e}.dashboard-layout.is-dark .settings-type{background:#173258;border-color:#3b82f6;color:#bfdbfe}.dashboard-layout.is-dark .settings-field-row.is-disabled{background:#1a2740;border-color:#415573}.dashboard-layout.is-dark .settings-search input,.dashboard-layout.is-dark .settings-field-row__control input,.dashboard-layout.is-dark .settings-field-row__control textarea,.dashboard-layout.is-dark .settings-field-row__control select{background:#0f1d32;border-color:#405775;color:#e6edf8}.dashboard-layout.is-dark .settings-search input::placeholder,.dashboard-layout.is-dark input::placeholder,.dashboard-layout.is-dark textarea::placeholder{color:#7388a6}.dashboard-layout.is-dark .settings-field-row__control button:disabled,.dashboard-layout.is-dark .publisher-trace-button:disabled{background:#4b5f7a;border-color:#4b5f7a;color:#d8e2f1}.dashboard-layout.is-dark .timing-trace__axis-input input:disabled{background:#1b2a42;border-color:#4a5f7e;color:#9eb2cb}.dashboard-layout.is-dark .timing-trace__mode-toggle{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .timing-trace__mode-toggle.is-auto{border-color:#60a5fa;background:#173258;color:#bfdbfe}.dashboard-layout.is-dark .timing-trace__legend-toggle{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .timing-trace__legend-toggle.is-active{border-color:#60a5fa;background:#173258;color:#bfdbfe}.dashboard-layout.is-dark .trace-status.is-live{color:#c9f4db;border-color:#22c55e;background:#153829}.dashboard-layout.is-dark .subscriber-filter-btn{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .subscriber-filter-btn.is-active{border-color:#22c55e;background:#153829;color:#c9f4db}.dashboard-layout.is-dark .topology-flow-shell .react-flow__renderer{background:#0b1220}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__edge .react-flow__edge-path{stroke:#7c93b1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__edge.animated .react-flow__edge-path{stroke:#3b82f6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-label,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-orphan-label{color:#b8c9de}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-orphan-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-scope-tail{color:#ecf3ff}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-address,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label .mono{color:#8fa4c1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-type{border-color:#425a77;background:#1d2d45;color:#c6d7ec}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-task-label{color:#c4d3e6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-input{color:#c7d2fe}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-output{color:#99f6e4}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-unknown{color:#cbd5e1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-open-btn{border-color:#60a5fa;background:#163a63;color:#bfdbfe}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-scope-up-btn{border-color:#4b647e;background:#17283f;color:#c6d7ec}.dashboard-layout.is-dark .topology-scope-sep{color:#8fa4c1}.dashboard-layout.is-dark .topology-scope-slash{color:#6f86a4}.dashboard-layout.is-dark .topology-scope-chip{border-color:#4a5f7e;background:#1b2a42;color:#c6d7ec}.dashboard-layout.is-dark .topology-scope-chip:hover{border-color:#60a5fa;background:#193152}.dashboard-layout.is-dark .topology-scope-tail{color:#e6edf8}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-collection{border-color:#4b647e;background:#223248}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-input{border-color:#818cf8;background:#1d2644}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-output{border-color:#22d3ee;background:#0f2e37}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-topic{border-color:#fb923c;background:#2e1f10}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-relay{border-color:#d8b4fe;background:#2a1d3a}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-task{border-color:#425a77;background:#1d2d45}.dashboard-layout.is-dark .dashboard-floating-inspector-btn.is-collapsed{border-color:#60a5fa;background:#173258;color:#bfdbfe}@container (max-width: 440px){.publisher-row__metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.publisher-kpis{grid-template-columns:1fr}.subscriber-section-header{align-items:flex-start;flex-direction:column}.subscriber-item__summary{grid-template-columns:1fr}.subscriber-item__metrics{justify-content:flex-start;flex-wrap:wrap}.subscriber-item__metrics span{align-items:flex-start}.settings-field-row__control{grid-template-columns:1fr}.settings-field-row__control.is-boolean{align-items:start}.settings-field-row__control button{width:100%}.settings-field-row__control.is-boolean .patch-checkbox{min-height:0}}@container (max-width: 360px){.settings-component-row__toggle{grid-template-columns:1fr}.settings-component-row__meta{justify-content:space-between}}@media (min-width: 900px){.panel:nth-of-type(1){grid-column:span 7}.panel:nth-of-type(2){grid-column:span 5}.panel:nth-of-type(3){grid-column:span 12}}@media (max-width: 900px){.publisher-row__metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.publisher-kpis,.subscriber-item__summary{grid-template-columns:1fr}.subscriber-item__metrics{justify-content:flex-start;flex-wrap:wrap}.subscriber-item__metrics span{align-items:flex-start}.subscriber-item__detail dl{grid-template-columns:1fr}} diff --git a/src/ezmsg/dashboard/_web/assets/index-D2HkN7I-.css b/src/ezmsg/dashboard/_web/assets/index-D2HkN7I-.css new file mode 100644 index 0000000..95ede63 --- /dev/null +++ b/src/ezmsg/dashboard/_web/assets/index-D2HkN7I-.css @@ -0,0 +1 @@ +.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:-webkit-grab;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;-webkit-animation:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;-webkit-animation:dashdraw .5s linear infinite;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:-webkit-grab;cursor:grab}.react-flow__node.dragging{cursor:-webkit-grabbing;cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:-webkit-grab;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@-webkit-keyframes dashdraw{0%{stroke-dashoffset:10}}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}:root{font-family:Avenir Next,Segoe UI,sans-serif;color:#1f2933;background:radial-gradient(circle at top right,rgba(249,115,22,.18),transparent 45%),radial-gradient(circle at bottom left,rgba(15,23,42,.12),transparent 42%),#f8fafc}*{box-sizing:border-box}body{margin:0;min-height:100vh;color:inherit;background:inherit}#root{min-height:100vh}.dashboard-viewport{position:relative;width:100%;height:100%;overflow:hidden;background:radial-gradient(circle at top right,rgba(249,115,22,.14),transparent 38%),radial-gradient(circle at bottom left,rgba(30,64,175,.12),transparent 42%),#f8fafc}.dashboard-layout.is-dark{color:#dbe7f5}.dashboard-layout.is-dark .dashboard-viewport{background:radial-gradient(circle at top right,rgba(59,130,246,.16),transparent 38%),radial-gradient(circle at bottom left,rgba(20,184,166,.12),transparent 42%),#0b1220}.dashboard-layout.is-dark .dashboard-inspector,.dashboard-layout.is-dark .dashboard-inspector__body,.dashboard-layout.is-dark .inspector-section,.dashboard-layout.is-dark .inspector-section__content,.dashboard-layout.is-dark .trace-dock,.dashboard-layout.is-dark .dashboard-modal,.dashboard-layout.is-dark .dashboard-brand-card,.dashboard-layout.is-dark .topology-flow-toolbar,.dashboard-layout.is-dark .topology-viewport-legend{background:#0f172aeb;border-color:#334155;color:#dbe7f5}.dashboard-layout.is-dark .trace-dock__header{background:#0f172af2;border-bottom-color:#334155}.dashboard-layout.is-dark .dashboard-brand-card__title-row h1,.dashboard-layout.is-dark .topology-viewport-legend__title,.dashboard-layout.is-dark .inspector-section__header,.dashboard-layout.is-dark h2,.dashboard-layout.is-dark h3{color:#f8fafc}.dashboard-layout.is-dark .dashboard-brand-card__meta-line,.dashboard-layout.is-dark .trace-dock__meta,.dashboard-layout.is-dark .topology-viewport-legend__item,.dashboard-layout.is-dark .topology-flow-toolbar__label{color:#a9bdd6}.dashboard-layout.is-dark .topology-layout-btn,.dashboard-layout.is-dark input,.dashboard-layout.is-dark select,.dashboard-layout.is-dark textarea{background:#111b2f;color:#e2e8f0;border-color:#3b4b63}.dashboard-layout.is-dark .topology-layout-btn:hover:not(:disabled),.dashboard-layout.is-dark .topology-layout-btn:focus-visible{border-color:#60a5fa;background:#16243d}.dashboard-layout.is-dark .dashboard-modal-backdrop{background:#020617a3}.dashboard-layout.is-dark .topology-flow-shell.is-dark{background:#0b1220}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls{border-color:#334155;background:#0f172ae6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button{background:#0f172af2;color:#dbe7f5;border-color:#334155}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button svg{fill:currentColor;stroke:currentColor}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__controls button path{fill:currentColor;stroke:currentColor}.trace-dock{border-top:1px solid #cbd5e1;background:#fffffff2;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);min-height:180px;max-height:min(52vh,560px);display:grid;grid-template-rows:auto minmax(0,1fr)}.trace-dock.is-collapsed{min-height:auto;max-height:none;grid-template-rows:auto}.trace-dock__header{display:flex;align-items:center;justify-content:space-between;gap:.6rem;border-bottom:1px solid #e2e8f0;padding:.4rem .6rem;background:#f8fafc}.trace-dock__title-wrap{min-width:0}.trace-dock__title-wrap h3{margin:0;font-size:.82rem;letter-spacing:.02em;text-transform:uppercase;color:#334155}.trace-dock__meta{margin:.14rem 0 0;font-size:.74rem;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.trace-dock__actions{display:inline-flex;align-items:center;gap:.45rem}.trace-dock__close-btn{min-width:1.9rem;padding:.12rem .5rem;font-size:.86rem;color:#334155}.trace-status{font-size:.74rem;border:1px solid #cbd5e1;border-radius:999px;padding:.1rem .45rem;color:#475569}.trace-status.is-live{color:#065f46;border-color:#86efac;background:#dcfce7}.trace-dock__body{min-height:0;overflow:auto;padding:.45rem .6rem .55rem}.trace-dock__host{min-height:220px}.trace-dock__empty{margin:0;font-size:.8rem}.trace-dock-trace{display:flex;flex-direction:column;gap:.35rem}.dashboard-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,min(var(--inspector-width, 500px),calc(100vw - 480px)));grid-template-rows:minmax(0,1fr);width:100vw;height:100vh;overflow:hidden}.dashboard-layout.is-inspector-collapsed{grid-template-columns:minmax(0,1fr) 0}.dashboard-layout.is-compact{font-size:.94em}.dashboard-layout>*{min-width:0;min-height:0}.dashboard-layout>.dashboard-main{grid-column:1;grid-row:1}.dashboard-layout>.dashboard-inspector--pinned{grid-column:2;grid-row:1}.dashboard-layout.is-inspector-collapsed>.dashboard-inspector--pinned{width:0;min-width:0;border-left:0;overflow:hidden;pointer-events:none}.dashboard-main{display:grid;grid-template-rows:minmax(0,1fr) auto;min-width:0;min-height:0}.dashboard-brand-card{position:absolute;top:.55rem;left:.6rem;z-index:22;width:fit-content;min-width:0;max-width:min(calc(100vw - 6rem),1000px);border:1px solid #cbd5e1;border-radius:12px;background:#fffffff0;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);padding:.36rem .5rem;display:inline-flex;align-items:center;flex-wrap:wrap;gap:.45rem;overflow:hidden}.dashboard-floating-control-dock{position:absolute;top:.55rem;right:.65rem;left:auto;z-index:23;display:inline-flex;align-items:center;gap:.35rem}.dashboard-floating-inspector-btn{position:absolute;top:50%;right:.65rem;left:auto;z-index:23;width:2.2rem;min-width:2.2rem;height:2.2rem;padding:0;border-radius:999px;font-size:1.1rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;transform:translateY(-50%)}.dashboard-floating-inspector-btn.is-collapsed{border-color:#60a5fa;background:#eff6ff;color:#1d4ed8}.dashboard-brand-card__title-row{display:inline-flex;align-items:center;gap:.3rem;min-width:0}.dashboard-brand-card__title-row h1{margin:0;font-size:.95rem;letter-spacing:.02em;color:#0f172a;line-height:1}.dashboard-brand-logo-image{width:1.15rem;height:1.15rem;object-fit:contain;border-radius:4px}.dashboard-health-dot{width:.6rem;height:.6rem;border-radius:999px;display:inline-block;border:1px solid #cbd5e1;box-shadow:0 0 0 2px #ffffffe6}.dashboard-health-dot.is-ok{background:#22c55e;border-color:#16a34a}.dashboard-health-dot.is-warn{background:#f59e0b;border-color:#d97706}.dashboard-health-dot.is-err{background:#ef4444;border-color:#dc2626}.dashboard-brand-card__meta-line{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;display:inline-flex;align-items:center;gap:.38rem;color:#475569;font-size:.77rem}.dashboard-modal-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;z-index:40;background:#0f172a38;display:flex;align-items:flex-start;justify-content:center;padding-top:3.2rem}.dashboard-modal{width:min(520px,calc(100vw - 2rem));border:1px solid #cbd5e1;border-radius:12px;background:#fff;box-shadow:0 22px 48px #0f172a40;overflow:hidden}.dashboard-modal__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;border-bottom:1px solid #e2e8f0;background:#f8fafc;padding:.58rem .72rem}.dashboard-modal__header h2{margin:0;font-size:.9rem}.dashboard-modal__body{display:flex;flex-direction:column;gap:.65rem;padding:.7rem .75rem .8rem}.dashboard-setting-row{display:flex;align-items:center;justify-content:space-between;gap:.7rem;font-size:.82rem}.dashboard-setting-row input,.dashboard-setting-row select{width:10.5rem;border:1px solid #cbd5e1;border-radius:8px;padding:.32rem .5rem;font:inherit;background:#fff}.dashboard-setting-toggle{display:inline-flex;align-items:center;gap:.5rem;font-size:.82rem;color:#334155}.dashboard-modal__suggestions{border-top:1px solid #e2e8f0;padding-top:.55rem}.dashboard-modal__suggestions p{margin:0 0 .35rem;font-size:.78rem;color:#334155;font-weight:600}.dashboard-modal__suggestions ul{margin:0;padding-left:1.1rem;color:#475569;font-size:.78rem;line-height:1.45}.dashboard-inspector{position:absolute;top:0;right:0;z-index:25;height:100vh;width:min(520px,44vw);border-left:1px solid #cbd5e1;background:#f8fafcf5;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);display:flex;flex-direction:column;transform:translate(100%);opacity:0;pointer-events:none;transition:transform .18s ease,opacity .18s ease}.dashboard-inspector--pinned{position:relative;top:0;right:auto;width:100%;height:100%;border-left:0;border-right:0;border-left:1px solid #cbd5e1;transform:none;opacity:1;pointer-events:auto;transition:none}.inspector-resize-handle{position:absolute;top:0;bottom:0;left:-3px;width:7px;z-index:26;cursor:col-resize;touch-action:none;background:transparent;transition:background .12s ease}.inspector-resize-handle:hover,.inspector-resize-handle:focus-visible,.dashboard-layout.is-resizing-inspector .inspector-resize-handle{background:#6ea8fe;outline:none}.dashboard-layout.is-dark .inspector-resize-handle:hover,.dashboard-layout.is-dark .inspector-resize-handle:focus-visible,.dashboard-layout.is-dark.is-resizing-inspector .inspector-resize-handle{background:#4f7fd4}.dashboard-layout.is-resizing-inspector{cursor:col-resize;-webkit-user-select:none;user-select:none}.dashboard-inspector__body{flex:1;min-height:0;overflow:hidden;padding:.5rem;display:grid;grid-template-rows:minmax(0,1fr) minmax(0,1fr);gap:.5rem}.dashboard-inspector__body.is-publishers-collapsed{grid-template-rows:auto minmax(0,1fr)}.dashboard-inspector__body.is-settings-collapsed{grid-template-rows:minmax(0,1fr) auto}.dashboard-inspector__body.is-publishers-collapsed.is-settings-collapsed{grid-template-rows:auto auto}.dashboard-inspector__body .panel{margin:0}.inspector-section{border:1px solid #dbe2ea;border-radius:10px;background:#ffffffe6;overflow:hidden}.inspector-section--split{min-height:0;display:flex;flex-direction:column}.inspector-section+.inspector-section{margin-top:0}.inspector-section__header{display:flex;align-items:center;justify-content:space-between;gap:.45rem;font-size:.82rem;font-weight:700;color:#0f172a;padding:.42rem .55rem;border-bottom:1px solid #e2e8f0;background:#f8fafc}.inspector-section__collapse-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#475569;font:inherit;font-size:.72rem;padding:.1rem .48rem;cursor:pointer}.inspector-section__content{padding:.5rem;container-type:inline-size}.inspector-section__content--scroll{min-height:0;overflow:auto;padding:.45rem}.app-shell{max-width:1280px;margin:0 auto;padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.app-header{display:flex;flex-direction:column;gap:.2rem}.app-header h1{margin:0;font-size:2rem;letter-spacing:.02em}.app-header p{margin:0;color:#4b5563}.status-row{margin-top:.8rem;display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}.status-pill{border-radius:999px;padding:.25rem .65rem;font-size:.8rem;font-weight:700;border:1px solid #d1d5db}.status-pill.is-open{color:#065f46;background:#d1fae5;border-color:#6ee7b7}.status-pill.is-connecting{color:#9a3412;background:#ffedd5;border-color:#fdba74}.status-pill.is-closed{color:#7f1d1d;background:#fee2e2;border-color:#fca5a5}.refresh-btn{border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:.35rem .7rem;font:inherit;cursor:pointer}.refresh-btn:hover{border-color:#94a3b8}.snapshot-time{font-size:.78rem;color:#475569}.error-text{margin:.6rem 0 0;color:#b91c1c;font-size:.9rem}.timestamp{margin-top:.4rem;font-size:.85rem;color:#6b7280}.panel-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}.panel{grid-column:span 12;border:1px solid #d1d5db;border-radius:14px;padding:1rem;background:#ffffffe6;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.panel__header h2{margin:0;font-size:1.1rem}.panel__header p{margin:.25rem 0 0;color:#4b5563;font-size:.92rem}.panel__body{margin-top:.8rem;display:flex;flex-direction:column;gap:.8rem}.panel.panel--headerless .panel__body{margin-top:0}.placeholder p{margin:0 0 .5rem;font-weight:600}.placeholder ul{margin:0;padding-left:1.25rem;line-height:1.6}.stats-grid{display:grid;gap:.6rem;grid-template-columns:repeat(2,minmax(0,1fr))}.stat-card{border:1px solid #d1d5db;border-radius:10px;background:#fff;padding:.7rem;display:flex;flex-direction:column;gap:.3rem}.stat-card span{color:#475569;font-size:.8rem}.stat-card strong{font-size:1.15rem}.panel-section h3{margin:0 0 .5rem;font-size:.9rem;letter-spacing:.02em;text-transform:uppercase;color:#334155}.data-table{width:100%;border-collapse:collapse;font-size:.86rem}.data-table th,.data-table td{border-bottom:1px solid #e5e7eb;text-align:left;padding:.45rem .3rem;vertical-align:top}.data-table th{font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;color:#475569}.mono{font-family:SF Mono,Menlo,Monaco,monospace}.muted{margin:0;color:#64748b}.event-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:.4rem}.event-item{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;border:1px solid #e2e8f0;border-radius:8px;padding:.4rem .6rem;background:#fff;font-size:.84rem}.event-pill{font-size:.72rem;border-radius:999px;border:1px solid #fde68a;color:#78350f;background:#fef3c7;font-weight:700;padding:.15rem .5rem}.topology-flow-shell{position:relative;border:1px solid #dbe2ea;border-radius:12px;overflow:hidden;background:#fff;height:640px}.topology-immersive{position:absolute;top:0;right:0;bottom:0;left:0;padding:0;display:flex;flex-direction:column;gap:0}.topology-empty-state{border:1px solid #dbe2ea;border-radius:12px;background:#ffffffe6;padding:.8rem;color:#475569}.topology-flow-shell.is-immersive{border:0;border-radius:0;flex:1;min-height:0;height:auto}.topology-viewport-bottom-dock{position:absolute;left:3.15rem;bottom:.9rem;z-index:11;display:inline-flex;flex-direction:column;align-items:flex-start;gap:.22rem}.topology-viewport-bottom-dock .topology-viewport-legend{position:static;padding:.2rem .38rem}.topology-viewport-top-controls{position:absolute;left:.6rem;top:3.02rem;z-index:12}.topology-viewport-top-controls .topology-flow-toolbar{border:1px solid #d1d9e5;border-radius:10px;background:#fffffff0;padding:.2rem .38rem;gap:.26rem}.topology-flow-shell:fullscreen{height:100vh;border-radius:0}.topology-flow-shell:-webkit-full-screen{height:100vh;border-radius:0}.topology-flow-shell .react-flow__renderer{background:#f8fafc}.topology-viewport-legend{position:absolute;top:.55rem;left:.55rem;z-index:10;display:inline-flex;flex-wrap:wrap;align-items:center;gap:.25rem .55rem;border:1px solid #d1d9e5;border-radius:10px;background:#fffffff0;padding:.3rem .45rem;font-size:.68rem;color:#475569}.topology-viewport-legend__title{font-weight:700;color:#334155;margin-right:.15rem}.topology-viewport-legend__item{display:inline-flex;align-items:center;gap:.3rem;line-height:1;white-space:nowrap}.topology-viewport-legend__swatch{width:.55rem;height:.55rem;border-radius:999px;display:inline-block}.topology-viewport-legend__swatch.is-input{border:1px solid #c7d2fe;background:#eef2ff}.topology-viewport-legend__swatch.is-collection{border:1px solid #94a3b8;background:#e2e8f0}.topology-viewport-legend__swatch.is-output{border:1px solid #7dd3fc;background:#ecfeff}.topology-viewport-legend__swatch.is-topic{border:1px solid #f28e2b;background:#fff1dd}.topology-viewport-legend__swatch.is-relay{border:1px solid #b07aa1;background:#f8eef5}.topology-viewport-legend__swatch.is-task{border:1px solid #dbe2ea;background:#f1f5f9}.topology-flow-toolbar{display:flex;align-items:center;gap:.45rem;flex-wrap:wrap}.topology-flow-toolbar__label{font-size:.74rem;color:#475569;font-weight:600}.topology-layout-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#475569;font-size:.72rem;padding:.2rem .6rem;cursor:pointer}.topology-layout-btn.is-active{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff;font-weight:600}.topology-layout-btn:disabled{opacity:.48;cursor:default}.dashboard-floating-gear-btn.topology-layout-btn,.dashboard-floating-shortcut-btn.topology-layout-btn{width:2.2rem;min-width:2.2rem;height:2.2rem;padding:0;border-radius:999px;font-size:1.1rem;line-height:1;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.dashboard-floating-shortcut-btn svg{width:1rem;height:1rem;display:block}.topology-control-btn{font-size:.88rem;line-height:1}.topology-scope-trail{display:inline-flex;align-items:center;gap:.1rem;flex-wrap:wrap}.topology-scope-sep{font-size:.76rem;color:#64748b;margin:0 .15rem}.topology-scope-segment{display:inline-flex;align-items:center;gap:.16rem}.topology-scope-slash{color:#94a3b8;font-size:.75rem}.topology-scope-chip{border:1px solid #d1d9e5;border-radius:999px;background:#fff;color:#64748b;font-size:.68rem;padding:.1rem .48rem;cursor:pointer;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.topology-scope-tail{color:#1e293b;font-size:.72rem;font-weight:700;padding:.1rem;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-flow-shell .react-flow__handle{opacity:0;width:2px;height:2px;border:0}.topology-flow-shell .react-flow__edge.topology-internal-edge .react-flow__edge-path{stroke-opacity:.95}.topology-unit-label{display:flex;flex-direction:column;gap:.03rem;font-size:.66rem;color:#334155;width:100%;align-items:flex-start;text-align:left}.topology-title-row{display:inline-flex;align-items:center;gap:.34rem;min-width:0;max-width:100%}.topology-title-row--collection{width:100%;align-items:center;justify-content:space-between;gap:.5rem}.topology-title-row--collection>.topology-title-row{flex:1 1 auto;min-width:0}.topology-title-row--collection>.topology-title-row strong{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-title-row--collection>.topology-title-row .topology-unit-type{flex:0 0 auto}.topology-unit-label strong{font-size:.78rem;line-height:1;letter-spacing:.01em;color:#0f172a;flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topology-unit-label>.topology-title-row .topology-unit-type{transform:translateY(-.04rem)}.topology-unit-type{display:inline-flex;align-items:center;width:fit-content;max-width:min(100%,11.5rem);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;border:1px solid #dbe2ea;border-radius:999px;padding:.04rem .34rem;color:#475569;background:#f1f5f9;font-size:.56rem;line-height:1}.topology-unit-address{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.54rem;color:#64748b;letter-spacing:.01em;margin-top:-.02rem}.topology-stream-label{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;gap:0}.topology-stream-name{display:block;line-height:1;text-transform:uppercase;letter-spacing:.03em;font-size:.54rem;max-width:100%;overflow:hidden;text-overflow:ellipsis}.topology-stream-type{display:block;line-height:1;font-size:.46rem;letter-spacing:.01em;text-transform:none;opacity:.92;max-width:100%;overflow:hidden;text-overflow:ellipsis}.topology-stream-label.is-input{color:#3730a3}.topology-stream-label.is-output{color:#0f766e}.topology-stream-label.is-unknown{color:#334155}.topology-stream-label.is-collection{color:inherit}.topology-task-label{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.52rem;color:#6b7280;letter-spacing:.008em;font-weight:500}.topology-collection-label{display:flex;flex-direction:column;gap:.06rem;font-size:.68rem;align-items:flex-start}.topology-collection-label strong{font-size:.72rem}.topology-collection-label .mono{line-height:1.1}.topology-collection-open-btn,.topology-collection-scope-up-btn{border-radius:999px;font:inherit;font-size:.62rem;font-weight:600;padding:.16rem .58rem;min-height:1.5rem;min-width:4.4rem;cursor:pointer;line-height:1.1;white-space:nowrap;flex:0 0 auto;-webkit-user-select:none;user-select:none}.topology-collection-open-btn{border:1px solid #93c5fd;background:#eff6ff;color:#1d4ed8}.topology-collection-scope-up-btn{border:1px solid #94a3b8;background:#f8fafc;color:#334155}.topology-collection-scope-up-btn:hover:not(:disabled){border-color:#64748b;background:#eef2f7}.topology-collection-scope-up-btn:disabled{opacity:.52;cursor:default}.topology-collection-open-btn:hover{border-color:#60a5fa;background:#dbeafe}.topology-collection-label--scope{gap:.2rem}.topology-orphan-label{display:flex;flex-direction:column;gap:.2rem;font-size:.68rem;color:#334155}.topology-orphan-label strong{font-size:.74rem;color:#0f172a}.publisher-list{display:flex;flex-direction:column;gap:.55rem}.publisher-row{border:1px solid #dbe2ea;border-radius:12px;background:#fff;overflow:hidden}.publisher-row.activity-idle{border-color:#cbd5e1}.publisher-row.activity-active{border-color:#86efac}.publisher-row.activity-backpressure{border-color:#fca5a5}.publisher-row__toggle{width:100%;border:0;background:transparent;text-align:left;padding:.65rem;cursor:pointer}.publisher-row__top{display:flex;justify-content:space-between;align-items:flex-start;gap:.6rem}.publisher-row__identity{display:flex;align-items:start;gap:.45rem;min-width:0}.publisher-row__identity-text{min-width:0}.publisher-row__identity p{margin:0}.publisher-topic{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.publisher-topic{font-size:1.06rem;line-height:1.2}.publisher-row__metrics{margin-top:.5rem;display:grid;grid-template-columns:repeat(4,minmax(72px,1fr));gap:.5rem}.publisher-row__metrics div{display:flex;flex-direction:column;gap:.2rem}.publisher-row__metrics span{color:#64748b;font-size:.73rem}.publisher-row__metrics strong{font-size:.9rem}.publisher-caret{color:#334155;font-size:1rem;line-height:1;padding-top:.1rem}.publisher-row__details{border-top:1px solid #e2e8f0;background:#f8fafc;padding:.65rem;display:flex;flex-direction:column;gap:.7rem}.publisher-kpis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.55rem}.mini-kpi{border:1px solid #dbe2ea;border-radius:9px;background:#fff;padding:.55rem;display:flex;flex-direction:column;gap:.25rem}.mini-kpi span{color:#64748b;font-size:.74rem}.mini-kpi strong{font-size:.92rem}.publisher-trace-button{width:100%;border:1px solid #15803d;border-radius:9px;background:linear-gradient(180deg,#22c55e,#16a34a);color:#fff;font:inherit;font-size:.9rem;font-weight:700;letter-spacing:.01em;padding:.5rem .65rem;display:inline-flex;align-items:center;justify-content:center;gap:.42rem;cursor:pointer;margin-bottom:.45rem}.publisher-trace-button.is-stop{border-color:#b91c1c;background:linear-gradient(180deg,#ef4444,#dc2626)}.publisher-trace-button:disabled{border-color:#94a3b8;background:#94a3b8;cursor:default}.publisher-trace-button__icon{font-size:.72rem;line-height:1}.publisher-detail-line{display:flex;justify-content:space-between;align-items:center;gap:.7rem;flex-wrap:wrap}.subscriber-item__detail .publisher-detail-line{margin-top:.45rem}.publisher-endpoint{display:flex;flex-direction:column;gap:.18rem;min-width:220px;flex:1}.publisher-endpoint span{color:#64748b;font-size:.74rem}.publisher-endpoint code{font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.timing-trace{display:flex;flex-direction:column;gap:.35rem}.timing-trace__controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.4rem .55rem}.timing-trace__controls-left{display:inline-flex;align-items:center;gap:.35rem;flex-wrap:wrap;min-width:0}.timing-trace__controls-right{display:inline-flex;align-items:center;gap:.35rem;flex-wrap:nowrap;justify-content:flex-end;margin-left:auto}.timing-trace__axis-input{display:inline-flex;align-items:center;gap:.3rem;font-size:.72rem;color:#475569}.timing-trace__axis-input--ymax{margin-left:.15rem}.timing-trace__axis-input input{width:4.8rem;border:1px solid #cbd5e1;border-radius:6px;padding:.18rem .35rem;font-size:.74rem;font-family:Avenir Next,Segoe UI,sans-serif}.timing-trace__axis-input input:disabled{background:#f1f5f9;color:#94a3b8}.timing-trace__mode-toggle{display:inline-flex;align-items:center;border:1px solid #cbd5e1;border-radius:999px;background:#fff;color:#334155;font-size:.72rem;line-height:1;padding:.2rem .55rem;cursor:pointer}.timing-trace__mode-toggle.is-auto{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff}.timing-trace__mode-toggle-label{min-width:2.6rem;text-align:center}.timing-trace__canvas{width:100%;height:320px;display:block;border-radius:8px;border:1px solid #d7e2ee;background:linear-gradient(180deg,#f8fbff,#f1f6fc);box-shadow:inset 0 1px #ffffffbf}.timing-trace__legend{display:flex;flex-wrap:wrap;gap:.5rem .75rem}.timing-trace__legend-item{display:inline-flex;align-items:center;gap:.35rem;font-size:.72rem;color:#475569}.timing-trace__legend-item.is-static{opacity:.95;padding:.12rem .08rem .12rem 0}.timing-trace__legend-toggle{border:1px solid #cbd5e1;border-radius:999px;background:#fff;cursor:pointer;padding:.12rem .5rem;font-size:.72rem;line-height:1.2;font-family:inherit;opacity:.75}.timing-trace__legend-toggle.is-active{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff;opacity:1}.timing-trace__legend-item i{width:.55rem;height:.55rem;border-radius:999px;display:inline-block}.trace-metric-list{display:flex;flex-direction:column;gap:.45rem}.trace-metric-card{border:1px solid #dbe2ea;border-radius:8px;background:#fff;padding:.45rem}.trace-metric-card__header{display:flex;flex-wrap:wrap;gap:.5rem;font-size:.76rem;color:#334155}.trace-sparkline{margin-top:.35rem;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(4px,1fr);align-items:end;gap:2px;min-height:40px}.trace-sparkline span{background:linear-gradient(180deg,#2563eb,#60a5fa);border-radius:2px 2px 0 0;min-height:4px}.trace-channel-kinds{margin:.35rem 0 0;font-size:.74rem;color:#475569}.subscriber-section-header{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin-bottom:.45rem}.subscriber-section-header h3{margin:0}.subscriber-filter-btn{border:1px solid #cbd5e1;border-radius:999px;background:#fff;padding:.25rem .55rem;font:inherit;font-size:.74rem;cursor:pointer;color:#334155}.subscriber-filter-btn.is-active{border-color:#16a34a;background:#dcfce7;color:#166534;font-weight:600}.subscriber-list{display:flex;flex-direction:column;gap:.45rem}.subscriber-item{border:1px solid #dbe2ea;border-radius:10px;background:#fff;overflow:hidden}.subscriber-item.is-expanded{border-color:#93c5fd}.subscriber-item__summary{cursor:pointer;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem;align-items:start;padding:.45rem .55rem;border:0;background:#fff;text-align:left;width:100%;font:inherit}.subscriber-item__identity p{margin:0}.subscriber-item__identity{min-width:0}.subscriber-topic-short{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.subscriber-topic-with-color{display:flex;align-items:center;gap:.4rem;max-width:100%;min-width:0}.subscriber-trace-dot{width:.55rem;height:.55rem;border-radius:999px;flex:0 0 auto;display:inline-block}.subscriber-topic-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.subscriber-item__metrics{display:flex;align-items:center;gap:.55rem}.subscriber-item__metrics span{display:flex;flex-direction:column;align-items:flex-end;gap:.1rem}.subscriber-item__metrics em{font-style:normal;font-size:.68rem;color:#64748b}.subscriber-item__metrics strong{font-size:.8rem}.subscriber-item__detail{border-top:1px solid #e2e8f0;background:#f8fafc;padding:.45rem .55rem}.subscriber-item__detail dl{margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.4rem .8rem}.subscriber-item__detail dt{margin:0;font-size:.7rem;color:#64748b;text-transform:uppercase;letter-spacing:.03em}.subscriber-item__detail dd{margin:.1rem 0 0;font-size:.82rem;word-break:break-word}.subscriber-item__detail-row-full{grid-column:1 / -1}.settings-component-list{display:flex;flex-direction:column;gap:.55rem}.settings-search input{width:100%;border:1px solid #cbd5e1;border-radius:8px;padding:.32rem .46rem;font:inherit;font-size:.8rem;background:#fff}.settings-component-row{border:1px solid #dbe2ea;border-radius:12px;background:#fff;overflow:hidden}.settings-component-row.is-expanded{border-color:#93c5fd}.settings-component-row__toggle{width:100%;border:0;background:#fff;text-align:left;cursor:pointer;font:inherit;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.6rem;padding:.45rem .55rem}.settings-component-row__identity{min-width:0;display:flex;flex-direction:column;gap:.1rem}.settings-component-row__heading{display:flex;align-items:center;gap:.4rem;min-width:0}.settings-component-title{margin:0;font-size:.82rem;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-component-address{margin:0;font-size:.74rem;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-component-row__meta{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto}.settings-access{border:1px solid #d1d5db;border-radius:999px;padding:.08rem .42rem;font-size:.66rem;text-transform:uppercase;letter-spacing:.03em}.settings-access.is-patchable{color:#166534;background:#dcfce7;border-color:#86efac}.settings-access.is-readonly{color:#475569;background:#f1f5f9;border-color:#cbd5e1}.settings-detail{border-top:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;padding:.5rem;margin:0 .45rem .45rem}.settings-detail h3{margin:0;font-size:.82rem;color:#0f172a}.settings-detail__heading{display:flex;align-items:center;gap:.45rem;margin-bottom:.25rem}.settings-type{display:inline-block;font-size:.72rem;border-radius:999px;border:1px solid #bfdbfe;background:#eff6ff;color:#1d4ed8;font-weight:700;padding:.1rem .45rem;width:fit-content;flex:0 1 auto;min-width:0;max-width:min(100%,14rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.settings-fields{display:flex;flex-direction:column;gap:.45rem;max-height:440px;overflow:auto;padding-right:.2rem}.settings-field-row{border:1px solid #dbe2ea;border-radius:10px;background:#fff;padding:.45rem}.settings-field-row.is-disabled{background:#f1f5f9;border-color:#d0dae5}.settings-field-row__meta{display:flex;flex-direction:column;gap:.2rem}.settings-field-row__meta label{font-size:.76rem}.settings-field-row__control{margin-top:.32rem;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.34rem;align-items:start}.settings-field-row__control.is-boolean{align-items:center}.settings-field-row__control input,.settings-field-row__control textarea,.settings-field-row__control select{border:1px solid #d1d5db;border-radius:7px;padding:.25rem .38rem;font-size:.79rem;font:inherit;background:#fff;width:100%}.settings-field-row__control textarea{min-height:60px;resize:vertical}.settings-field-row__control button{border:1px solid #2563eb;border-radius:7px;background:#2563eb;color:#fff;font:inherit;font-size:.78rem;font-weight:700;padding:.24rem .48rem;cursor:pointer;min-width:3.5rem}.settings-field-row__control button:disabled{background:#94a3b8;border-color:#94a3b8;cursor:default}.settings-field-row__control input:disabled,.settings-field-row__control textarea:disabled,.settings-field-row__control select:disabled{background:#e5ebf3;color:#64748b}.patch-checkbox{display:flex;flex-direction:row;align-items:center;gap:.45rem;margin-top:0;min-height:2rem;justify-self:start}.patch-checkbox input[type=checkbox]{width:auto;min-width:0;margin:0;padding:0;border:none;border-radius:0;background:transparent;accent-color:#2563eb}.patch-checkbox span{white-space:nowrap}.patch-status{font-size:.8rem;margin-top:.35rem}.patch-status.ok{color:#065f46}.patch-status.err{color:#b91c1c}.dashboard-layout.is-dark .dashboard-inspector{border-left-color:#314155;background:#0c1526}.dashboard-layout.is-dark .dashboard-inspector__body{background:#0c1526}.dashboard-layout.is-dark .inspector-section{border-color:#34465e;background:#132035}.dashboard-layout.is-dark .inspector-section__header{border-bottom-color:#34465e;background:#16263e;color:#e6edf8}.dashboard-layout.is-dark .inspector-section__collapse-btn{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .dashboard-modal__header{border-bottom-color:#34465e;background:#16263e}.dashboard-layout.is-dark .dashboard-setting-row,.dashboard-layout.is-dark .dashboard-setting-toggle{color:#d7e4f5}.dashboard-layout.is-dark .inspector-section__content{background:#132035}.dashboard-layout.is-dark .panel{border-color:#34465e;background:#132035;color:#e6edf8}.dashboard-layout.is-dark .panel__header p,.dashboard-layout.is-dark .panel-section,.dashboard-layout.is-dark .panel-section h3{color:#b6c7dd}.dashboard-layout.is-dark .publisher-row,.dashboard-layout.is-dark .subscriber-item,.dashboard-layout.is-dark .settings-component-row,.dashboard-layout.is-dark .trace-metric-card,.dashboard-layout.is-dark .mini-kpi,.dashboard-layout.is-dark .settings-field-row{border-color:#3a4d66;background:#17263d;color:#e6edf8}.dashboard-layout.is-dark .publisher-row.activity-idle{border-color:#3a4d66}.dashboard-layout.is-dark .publisher-row.activity-active{border-color:#4ade80}.dashboard-layout.is-dark .publisher-row.activity-backpressure{border-color:#f87171}.dashboard-layout.is-dark .publisher-row__toggle{color:#e6edf8}.dashboard-layout.is-dark .publisher-row__details,.dashboard-layout.is-dark .subscriber-item__detail,.dashboard-layout.is-dark .settings-detail{border-top-color:#34465e;background:#1a2a44}.dashboard-layout.is-dark .settings-component-row__toggle,.dashboard-layout.is-dark .subscriber-item__summary{background:#17263d;color:#e6edf8}.dashboard-layout.is-dark .publisher-row__metrics span,.dashboard-layout.is-dark .publisher-endpoint span,.dashboard-layout.is-dark .settings-component-address,.dashboard-layout.is-dark .subscriber-item__metrics em,.dashboard-layout.is-dark .subscriber-item__detail dt,.dashboard-layout.is-dark .timing-trace__legend-item,.dashboard-layout.is-dark .timing-trace__axis-input,.dashboard-layout.is-dark .muted{color:#9eb2cb}.dashboard-layout.is-dark .timing-trace__canvas{border-color:#1e293b;background:#0f172a;box-shadow:none}.dashboard-layout.is-dark .settings-access.is-readonly{color:#c2d0e3;background:#1b2a42;border-color:#4a5f7e}.dashboard-layout.is-dark .settings-access.is-patchable{color:#c9f4db;background:#153829;border-color:#22c55e}.dashboard-layout.is-dark .settings-type{background:#173258;border-color:#3b82f6;color:#bfdbfe}.dashboard-layout.is-dark .settings-field-row.is-disabled{background:#1a2740;border-color:#415573}.dashboard-layout.is-dark .settings-search input,.dashboard-layout.is-dark .settings-field-row__control input,.dashboard-layout.is-dark .settings-field-row__control textarea,.dashboard-layout.is-dark .settings-field-row__control select{background:#0f1d32;border-color:#405775;color:#e6edf8}.dashboard-layout.is-dark .settings-search input::placeholder,.dashboard-layout.is-dark input::placeholder,.dashboard-layout.is-dark textarea::placeholder{color:#7388a6}.dashboard-layout.is-dark .settings-field-row__control button:disabled,.dashboard-layout.is-dark .publisher-trace-button:disabled{background:#4b5f7a;border-color:#4b5f7a;color:#d8e2f1}.dashboard-layout.is-dark .timing-trace__axis-input input:disabled{background:#1b2a42;border-color:#4a5f7e;color:#9eb2cb}.dashboard-layout.is-dark .timing-trace__mode-toggle{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .timing-trace__mode-toggle.is-auto{border-color:#60a5fa;background:#173258;color:#bfdbfe}.dashboard-layout.is-dark .timing-trace__legend-toggle{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .timing-trace__legend-toggle.is-active{border-color:#60a5fa;background:#173258;color:#bfdbfe}.dashboard-layout.is-dark .trace-status.is-live{color:#c9f4db;border-color:#22c55e;background:#153829}.dashboard-layout.is-dark .subscriber-filter-btn{border-color:#4a5f7e;background:#1b2a42;color:#d2dded}.dashboard-layout.is-dark .subscriber-filter-btn.is-active{border-color:#22c55e;background:#153829;color:#c9f4db}.dashboard-layout.is-dark .topology-flow-shell .react-flow__renderer{background:#0b1220}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__edge .react-flow__edge-path{stroke:#7c93b1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .react-flow__edge.animated .react-flow__edge-path{stroke:#3b82f6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-label,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-orphan-label{color:#b8c9de}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-orphan-label strong,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-scope-tail{color:#ecf3ff}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-address,.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-label .mono{color:#8fa4c1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-unit-type{border-color:#425a77;background:#1d2d45;color:#c6d7ec}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-task-label{color:#c4d3e6}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-input{color:#c7d2fe}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-output{color:#99f6e4}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-stream-label.is-unknown{color:#cbd5e1}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-open-btn{border-color:#60a5fa;background:#163a63;color:#bfdbfe}.dashboard-layout.is-dark .topology-flow-shell.is-dark .topology-collection-scope-up-btn{border-color:#4b647e;background:#17283f;color:#c6d7ec}.dashboard-layout.is-dark .topology-scope-sep{color:#8fa4c1}.dashboard-layout.is-dark .topology-scope-slash{color:#6f86a4}.dashboard-layout.is-dark .topology-scope-chip{border-color:#4a5f7e;background:#1b2a42;color:#c6d7ec}.dashboard-layout.is-dark .topology-scope-chip:hover{border-color:#60a5fa;background:#193152}.dashboard-layout.is-dark .topology-scope-tail{color:#e6edf8}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-collection{border-color:#4b647e;background:#223248}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-input{border-color:#818cf8;background:#1d2644}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-output{border-color:#22d3ee;background:#0f2e37}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-topic{border-color:#fb923c;background:#2e1f10}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-relay{border-color:#d8b4fe;background:#2a1d3a}.dashboard-layout.is-dark .topology-viewport-legend__swatch.is-task{border-color:#425a77;background:#1d2d45}.dashboard-layout.is-dark .dashboard-floating-inspector-btn.is-collapsed{border-color:#60a5fa;background:#173258;color:#bfdbfe}@container (max-width: 440px){.publisher-row__metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.publisher-kpis{grid-template-columns:1fr}.subscriber-section-header{align-items:flex-start;flex-direction:column}.subscriber-item__summary{grid-template-columns:1fr}.subscriber-item__metrics{justify-content:flex-start;flex-wrap:wrap}.subscriber-item__metrics span{align-items:flex-start}.settings-field-row__control{grid-template-columns:1fr}.settings-field-row__control.is-boolean{align-items:start}.settings-field-row__control button{width:100%}.settings-field-row__control.is-boolean .patch-checkbox{min-height:0}}@container (max-width: 360px){.settings-component-row__toggle{grid-template-columns:1fr}.settings-component-row__meta{justify-content:space-between}}@media (min-width: 900px){.panel:nth-of-type(1){grid-column:span 7}.panel:nth-of-type(2){grid-column:span 5}.panel:nth-of-type(3){grid-column:span 12}}@media (max-width: 900px){.publisher-row__metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.publisher-kpis,.subscriber-item__summary{grid-template-columns:1fr}.subscriber-item__metrics{justify-content:flex-start;flex-wrap:wrap}.subscriber-item__metrics span{align-items:flex-start}.subscriber-item__detail dl{grid-template-columns:1fr}} diff --git a/src/ezmsg/dashboard/_web/index.html b/src/ezmsg/dashboard/_web/index.html index 5399200..b8b2d72 100644 --- a/src/ezmsg/dashboard/_web/index.html +++ b/src/ezmsg/dashboard/_web/index.html @@ -5,8 +5,8 @@ ezmsg-dashboard - - + +