diff --git a/README.md b/README.md new file mode 100644 index 0000000..74ca794 --- /dev/null +++ b/README.md @@ -0,0 +1,161 @@ +# Semantic Visualizer + +A React + Vite bundle that draws a semantic model (concepts, properties, metrics, groups and the +relationships between them) with React Flow. Built into a single `dist/assets/index.js` and +`dist/assets/index.css` for embedding. + +```bash +npm ci +npm run dev # http://localhost:5173 renders public/sample.json + # http://localhost:5173/?sample=review renders public/sample-review.json with the diff UI +npm run build # dist/assets/index.{js,css} +``` + +## Mounting + +### Auto-mount (container attributes) + +Every `.semantic-visualizer` element with a `data-json-url` is mounted on `DOMContentLoaded` and on +each `htmx:load`. + +| Attribute | Default | Meaning | +|---|---|---| +| `data-json-url` | required | URL returning the graph JSON below (fetched with `credentials: same-origin`) | +| `data-height` | `400px` | CSS height applied to the container | +| `data-layout` | `force` | `force` (d3-force) or `tree` (hierarchy, groups off) | +| `data-show-minimap` | `false` | `true` shows the React Flow minimap | +| `data-locale` | detected | `en` or `de`; otherwise resolved from `?lang`, localStorage, navigator | +| `data-changes-only` | `false` | `true` opens on the elements that carry a diff (no effect when nothing does) | + +### `init(options)` + +For a host that has more to supply than a URL. Exported from the bundle: + +```js +import { init } from '/assets/semantic-visualizer/index.js'; + +const handle = init({ + container: '#graph', // selector or element + graphData, // { nodes, edges } — see the contract below + height: '340px', + locale: 'en', + layout: 'force', // or 'tree' + changesOnly: true, // open on what carries a diff + focus: 'customer', // externalId to centre and select on mount + onSelect: (externalId, node) => true, // return true to claim the click (see below) + storageKey: 'my-key', // optional; localStorage key for positions and toggles + showMiniMap: false, +}); + +handle.update({ graphData: nextGraph, focus: 'order', changesOnly: false }); +``` + +`onSelect` lets the host own what a click means. Returning `true` claims the click and withholds +the built-in detail panel for that element (the host is showing it itself); any other return hands +the click back and the panel opens. The element passed as `focus` is treated as claimed on mount. + +`update(next)` merges `graphData`, `focus`, `changesOnly` and `onSelect` into the stored options and +re-renders. `container`, `height`, `locale`, `layout`, `storageKey` and `showMiniMap` are fixed at +mount. `init` returns `null` when the container is not found. + +## Graph JSON contract + +```json +{ "nodes": [ ... ], "edges": [ ... ] } +``` + +### Node + +| Key | Type | Meaning | +|---|---|---| +| `id` | string | Unique within the graph; edges reference it | +| `type` | string | `entity`, `metric`, `property`, `shared_property`, `group` | +| `parentId` | string? | `id` of the enclosing group | +| `data` | object | See below | + +`data`: + +| Key | Type | Meaning | +|---|---|---| +| `label` | string | Display name | +| `externalId` | string? | Stable id; what `focus`, `onSelect` and the review correlate on | +| `link` | string? | Href for the label and the "open details" link in the panel | +| `description` | string? | Shown in the detail panel | +| `foreignNamespace` | string? | Set when the concept lives in another namespace; badged, and hidden past a threshold | +| `highlight` | boolean? | Search hit; also switches on the entity-relationship view when a property matches | +| `searchMatch` | boolean? | `false` marks a 1-hop neighbour included only as context | +| `properties` | Property[] | Rendered as rows in the entity-relationship view and the panel | +| `diff` | `add` \| `modify` \| `remove`? | What a pending change request does to this element; ring and badge on the node | +| `diffDetail` | DiffDetail? | What changed, for the panel | +| `changedPropertyCount` | number? | How many of its properties carry a diff when the concept itself does not; keeps it in the changes-only view | +| `evidence` | Evidence[]? | What the change cites | +| `evidenceMissing` | boolean? | Changed but cites nothing; marked on the node and in the panel | +| `overlaps` | Overlap[]? | Other pending change requests editing this element | +| `consumers` | Consumers? | What breaks if a removal goes ahead | +| `unresolved` | boolean? | Named by a relationship but present nowhere; drawn dashed and red | +| `removedBy` | `{ link }`? | With `unresolved`: the change request that removed it | +| `dimmed` | boolean? | Rendered faded. Set by the visualizer for context nodes; accepted as input too | + +### Property (`data.properties[]`) + +| Key | Type | Meaning | +|---|---|---| +| `name` | string | | +| `externalId` | string? | Stable id | +| `type` | string? | Data type, shown beside the name | +| `description` | string? | | +| `primaryKey` | boolean? | Key icon | +| `inherited` | boolean? | Listed separately, italic | +| `shared` | boolean? | Carried by several concepts; badged in the panel | +| `highlight` | boolean? | Search hit; the row is accented and auto-expanded | +| `diff` | `add` \| `modify` \| `remove`? | Rail, badge and strike-through on the row | +| `diffDetail` | DiffDetail? | Its `fields` render on the row in the panel | + +### Edge + +| Key | Type | Meaning | +|---|---|---| +| `id` | string | | +| `source`, `target` | string | Node ids | +| `label` | string | Drawn on the edge | +| `type` | string | Relationship type, e.g. `hasProperty`, `relatedTo`, `isA` | +| `externalId` | string? | Stable id | +| `diff` | `add` \| `modify` \| `remove`? | Coloured stroke; `remove` is dashed. Both ends count as changed for the changes-only view | +| `diffDetail` | DiffDetail? | Shown when the edge is clicked | +| `evidence`, `evidenceMissing` | | As on nodes | + +### DiffDetail + +```json +{ + "op": "add | modify | remove", + "impact": "structural | descriptive | cosmetic", + "fields": [ + { "field": "description", "before": "…", "after": "…", "base": "…", "impact": "descriptive" } + ] +} +``` + +`before`/`after` are rendered by shape: a boolean, a value from a small vocabulary (`status`, `kind`, +`element_type`, `better_when`) or a code-like field (`pattern`, `formula`, `iri`, `data_type`, +`extends`, `unit`) as a chip transition; a list as a set difference; a map (e.g. translations keyed +by locale) key by key; anything else as side-by-side prose. `base` is optional and, when present, +adds a third column showing the value the author wrote against (a conflict). Any value may arrive +decorated as `{ "display": "badge", "label", "color", "icon", "href" }` and is drawn as a badge; +`color` is a palette token (`red`, `orange`, `amber`, `yellow`, `green`, `teal`, `blue`, `indigo`, +`purple`, `pink`, `gray`), `icon` inline SVG, `href` a link back to the thing named. + +### Evidence, Overlap, Consumers + +```json +"evidence": [ { "quote": "…", "label": "docs/glossary.md", "resolvable": true } ], +"overlaps": [ { "changeRequestExternalId": "cr-17", "link": "/…", "teamName": "Fulfillment" } ], +"consumers": { + "total": 2, + "relationships": [ { "label": "reports", "namespace": "reporting", "link": "/…" } ], + "dataProducts": [ { "label": "Finance KPIs", "link": "/…" } ], + "dataContracts": [ { "label": "…", "link": "/…" } ] +} +``` + +`public/sample-review.json` exercises every key above. diff --git a/index.html b/index.html index b83e7f6..addbc11 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,16 @@
+ diff --git a/public/sample-review.json b/public/sample-review.json new file mode 100644 index 0000000..2891a1a --- /dev/null +++ b/public/sample-review.json @@ -0,0 +1,116 @@ +{ + "nodes": [ + { + "id": "1", + "type": "entity", + "data": { + "label": "Customer", + "externalId": "customer", + "link": "#", + "changedPropertyCount": 2, + "evidence": [ + { "quote": "Customers are segmented into loyalty tiers based on rolling 12-month spend.", "label": "docs/glossary.md" } + ], + "properties": [ + { "name": "customer_id", "externalId": "customer-id", "type": "string", "primaryKey": true }, + { "name": "email", "externalId": "customer-email", "type": "string", "shared": true }, + { + "name": "loyalty_tier", + "externalId": "loyalty-tier", + "type": "string", + "diff": "modify", + "diffDetail": { + "op": "modify", + "impact": "descriptive", + "fields": [ + { "field": "description", "before": "Loyalty tier.", "after": "Loyalty program segment assigned based on rolling 12-month spend.", "impact": "descriptive" }, + { "field": "status", "before": "draft", "after": "active", "impact": "cosmetic" } + ] + } + }, + { "name": "fax_number", "externalId": "fax-number", "type": "string", "diff": "remove", "diffDetail": { "op": "remove", "impact": "structural", "fields": [] } } + ] + } + }, + { + "id": "2", + "type": "entity", + "data": { + "label": "Order", + "externalId": "order", + "link": "#", + "overlaps": [ { "changeRequestExternalId": "cr-17", "link": "#", "teamName": "Fulfillment" } ], + "properties": [ + { "name": "order_id", "externalId": "order-id", "type": "string", "primaryKey": true }, + { "name": "order_date", "externalId": "order-date", "type": "date" } + ] + } + }, + { + "id": "3", + "type": "entity", + "data": { + "label": "Invoice", + "externalId": "invoice", + "link": "#", + "diff": "add", + "evidenceMissing": true, + "diffDetail": { + "op": "add", + "impact": "structural", + "fields": [ + { "field": "description", "before": null, "after": "A request for payment issued for one or more orders.", "impact": "descriptive" }, + { "field": "classification", "before": null, "after": { "display": "badge", "label": "Confidential", "color": "red" }, "impact": "structural" } + ] + }, + "properties": [ + { "name": "invoice_id", "externalId": "invoice-id", "type": "string", "primaryKey": true, "diff": "add" }, + { "name": "total", "externalId": "invoice-total", "type": "decimal", "diff": "add" } + ] + } + }, + { + "id": "4", + "type": "metric", + "data": { + "label": "Revenue", + "externalId": "revenue", + "link": "#", + "diff": "remove", + "diffDetail": { "op": "remove", "impact": "structural", "fields": [] }, + "consumers": { + "total": 2, + "dataProducts": [ { "label": "Finance KPIs", "link": "#" } ], + "relationships": [ { "label": "reports", "namespace": "reporting" } ] + }, + "properties": [ { "name": "amount", "externalId": "revenue-amount", "type": "decimal" } ] + } + }, + { + "id": "5", + "type": "entity", + "data": { + "label": "Product", + "externalId": "product", + "link": "#", + "foreignNamespace": "catalog", + "properties": [ { "name": "product_id", "externalId": "product-id", "type": "string", "primaryKey": true } ] + } + }, + { + "id": "6", + "type": "entity", + "data": { "label": "Warehouse", "externalId": "warehouse", "unresolved": true, "removedBy": { "link": "#" }, "properties": [] } + } + ], + "edges": [ + { "id": "e1", "source": "1", "target": "2", "label": "places", "type": "relatedTo" }, + { "id": "e2", "source": "2", "target": "4", "label": "measures", "type": "relatedTo", "diff": "remove", "diffDetail": { "op": "remove", "impact": "structural", "fields": [] } }, + { "id": "e3", "source": "2", "target": "5", "label": "orderedProduct", "type": "relatedTo" }, + { + "id": "e4", "source": "3", "target": "2", "label": "billedFor", "type": "relatedTo", "diff": "add", + "diffDetail": { "op": "add", "impact": "structural", "fields": [ { "field": "description", "before": null, "after": "The orders an invoice settles.", "impact": "descriptive" } ] } + }, + { "id": "e5", "source": "2", "target": "6", "label": "shipsFrom", "type": "relatedTo", "diff": "add", "diffDetail": { "op": "add", "impact": "structural", "fields": [] } } + ] +} diff --git a/src/App.jsx b/src/App.jsx index c1445fa..2d6bfba 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -9,6 +9,8 @@ import { Panel, MarkerType, useReactFlow, + useStore, + useStoreApi, useNodesState, useEdgesState, } from '@xyflow/react'; @@ -20,9 +22,12 @@ import FloatingEdge from './FloatingEdge'; import DetailPanel from './DetailPanel'; import NamespaceFilter from './NamespaceFilter'; import { GroupActionsContext } from './GroupActionsContext'; -import { toggleBtnStyle } from './toolbarStyles'; -import { zoomInIcon, zoomOutIcon, fitViewIcon, autoLayoutIcon, expandAllIcon, collapseAllIcon } from './controlIcons'; +import { + zoomInIcon, zoomOutIcon, fitViewIcon, autoLayoutIcon, expandAllIcon, collapseAllIcon, + changesOnlyIcon, groupsIcon, erdIcon, enlargeIcon, +} from './controlIcons'; import { loadLayout, savePositions, clearPositions, saveToggles } from './storage'; +import { DIFF_STYLES } from './diffStyles'; import '@xyflow/react/dist/style.css'; @@ -80,27 +85,43 @@ function toReactFlowElements(graphData) { edgeParallelData[e.id] = { index: pairAssigned[key]++, total: pairCounts[key] }; }); - const edges = graphData.edges.map((e) => ({ - id: e.id, - source: e.source, - target: e.target, - label: e.label, - type: 'floating', - data: { label: e.label, parallel: edgeParallelData[e.id] }, - style: { - stroke: '#94a3b8', - strokeWidth: 1.5, - }, - markerEnd: { - type: MarkerType.ArrowClosed, - color: '#94a3b8', - width: 14, - height: 14, - }, - labelStyle: { fontSize: 10, fill: '#64748b', fontWeight: 500 }, - labelBgStyle: { fill: '#fff', fillOpacity: 0.9 }, - labelBgPadding: [4, 2], - })); + const edges = graphData.edges.map((e) => { + // A relationship the change request touches is a change in its own right, and is listed as one + // in the proposed-changes list — so it has to be legible in the graph too, not just implied by + // the concepts it happens to connect. + const diff = DIFF_STYLES[e.diff]; + const stroke = diff ? diff.color : '#94a3b8'; + return { + id: e.id, + source: e.source, + target: e.target, + label: e.label, + type: 'floating', + data: { + label: e.label, parallel: edgeParallelData[e.id], externalId: e.externalId, + diff: e.diff, diffDetail: e.diffDetail, evidence: e.evidence, evidenceMissing: e.evidenceMissing, + }, + style: { + stroke, + strokeWidth: diff ? 2.5 : 1.5, + // A removed relationship still has both ends in the graph, so it can only be told apart + // from a surviving one by how it is drawn. + ...(e.diff === 'remove' ? { strokeDasharray: '6 4' } : {}), + }, + markerEnd: { + type: MarkerType.ArrowClosed, + color: stroke, + width: 14, + height: 14, + }, + labelStyle: diff + ? { fontSize: 11, fill: stroke, fontWeight: 700 } + : { fontSize: 10, fill: '#64748b', fontWeight: 500 }, + labelBgStyle: { fill: '#fff', fillOpacity: 0.9 }, + labelBgPadding: [4, 2], + zIndex: diff ? 5 : 0, + }; + }); return { nodes, edges }; } @@ -635,10 +656,37 @@ function applyCollapseTransform({ nodes, edges }, collapsedSet) { return { nodes: filteredNodes, edges: finalEdges }; } +// Toggle button style helper +/** + * A square icon button, stacked with its siblings down the edge of the canvas. + * + * Labels cost horizontal room the graph now needs — "Show as Entity-Relationship-Diagram" was wider + * than the canvas it sat on once the panels stopped overlapping it. A glyph cannot say "on" by + * itself, so the pressed state is carried by the button: filled, tinted and outlined, with the words + * still available as a title. + */ +const toggleBtnStyle = (active) => ({ + width: 32, + height: 32, + borderRadius: 6, + background: active ? '#eef2ff' : '#fff', + padding: 0, + color: active ? '#4f46e5' : '#4b5563', + boxShadow: '0 1px 2px 0 rgba(0,0,0,0.05)', + border: `1px solid ${active ? '#a5b4fc' : '#d1d5db'}`, + cursor: 'pointer', + display: 'inline-flex', + alignItems: 'center', + justifyContent: 'center', +}); + // Past this many foreign-namespace concepts the diagram is more borrowed than its own, so they // all start hidden and the namespace dropdown becomes the way back in. const FOREIGN_NAMESPACE_LIMIT = 10; +/** Sized here rather than in each glyph so the four stay on one grid. */ +const toolbarIconStyle = { width: 17, height: 17, display: 'block' }; + // Enlarge/shrink button function EnlargeButton({ customHeight, containerRef }) { const { t } = useTranslation(); @@ -662,19 +710,40 @@ function EnlargeButton({ customHeight, containerRef }) { }, [enlarged, customHeight, fitView, containerRef]); return ( - ); } -export default function App({ graphData, customHeight, layout, storageKey, showMiniMap }) { +export default function App({ + graphData, + customHeight, + layout, + storageKey, + showMiniMap, + changesOnly: changesOnlyProp, + focus, + onSelect, +}) { const { t } = useTranslation(); - const { fitView, getNodes, zoomIn, zoomOut } = useReactFlow(); + const { fitView, getNodes, zoomIn, zoomOut, setCenter, getViewport, getNodesBounds } = useReactFlow(); + const store = useStoreApi(); const containerRef = useRef(null); + const canvasRef = useRef(null); + // React Flow's own measurement, so centring is driven by the number it uses rather than a copy. + const flowWidth = useStore((state) => state.width); const [selectedNode, setSelectedNode] = useState(null); + // Whether the host took the last selection and is showing that element itself, in which case a + // panel here would be a second account of one thing. Set for the element the host focuses on + // arrival, too — otherwise every page load opens a panel nobody asked for. + const [panelClaimed, setPanelClaimed] = useState(true); + const [selectedEdge, setSelectedEdge] = useState(null); // Default to ERD mode when a property is highlighted — otherwise the highlight // (which lives inside an entity node's property list) wouldn't be visible. const hasHighlightedProperty = useMemo( @@ -692,6 +761,12 @@ export default function App({ graphData, customHeight, layout, storageKey, showM [graphData], ); const [showGroups, setShowGroups] = useState(initialToggles?.showGroups ?? false); + // Off unless the host asks: a review page opens on what is being reviewed, but an embed that merely + // renders a branch's graph should show the whole picture. Inert when there is no diff either way. + const [changesOnly, setChangesOnly] = useState(changesOnlyProp ?? false); + useEffect(() => { + if (changesOnlyProp !== undefined) setChangesOnly(changesOnlyProp); + }, [changesOnlyProp]); const [collapsedGroups, setCollapsedGroups] = useState( () => new Set(initialToggles?.collapsedGroups || []), ); @@ -736,6 +811,14 @@ export default function App({ graphData, customHeight, layout, storageKey, showM const [layoutSeed, setLayoutSeed] = useState(0); const isHierarchy = layout === 'tree'; const groupsActive = hasGroups && showGroups && !isHierarchy; + // A request whose only change is to a concept's own property marks no node and no edge — the + // property is not either. Without counting it the changes-only toggle disappears on exactly the + // request that needs it. + const hasDiff = useMemo( + () => graphData.nodes.some((n) => n.data?.diff || n.data?.changedPropertyCount > 0) || + graphData.edges.some((e) => e.diff), + [graphData], + ); const nodeTypes = showProperties && !isHierarchy ? entityNodeTypes : defaultNodeTypes; // Toggling produces a fresh Set so memoized consumers (layout, context) invalidate cleanly. @@ -848,7 +931,41 @@ export default function App({ graphData, customHeight, layout, storageKey, showM const filteredEdges = sourceData.edges.filter((e) => keepIds.has(e.source) && keepIds.has(e.target)); sourceData = { nodes: filteredNodes, edges: filteredEdges }; } + // Hide what the change request leaves alone — but keep whatever the changed concepts connect to. + // A concept shown alone says nothing about whether changing it is safe; its neighbours are what + // make a removal at a hub look different from a removal at a leaf. Neighbours come through + // dimmed, the treatment search context already uses. + if (changesOnly && hasDiff) { + // A concept whose only change is to one of its own properties carries no diff of its own — + // the property is not a node, so the change lands on the concept as a count. + const changedIds = new Set( + sourceData.nodes.filter((n) => n.data?.diff || n.data?.changedPropertyCount > 0).map((n) => n.id), + ); + // A relationship can change between two concepts that are themselves untouched. Both ends + // count as changed, or the only thing the request actually did would be filtered away. + sourceData.edges.forEach((e) => { + if (!e.diff) return; + changedIds.add(e.source); + changedIds.add(e.target); + }); + const neighbourIds = new Set(); + sourceData.edges.forEach((e) => { + if (changedIds.has(e.source)) neighbourIds.add(e.target); + if (changedIds.has(e.target)) neighbourIds.add(e.source); + }); + const filteredNodes = sourceData.nodes + .filter((n) => changedIds.has(n.id) || neighbourIds.has(n.id) || n.type === 'group') + .map((n) => (changedIds.has(n.id) || n.type === 'group' + ? n + : { ...n, data: { ...n.data, dimmed: true } })); + const keepIds = new Set(filteredNodes.map((n) => n.id)); + const filteredEdges = sourceData.edges.filter((e) => keepIds.has(e.source) && keepIds.has(e.target)); + sourceData = { nodes: filteredNodes, edges: filteredEdges }; + } if (showProperties && !isHierarchy) { + // Filters compose: this reads from whatever the step above produced, not from the original + // graph. Reading from graphData discarded the changes-only filter, so turning on the + // entity-relationship view silently put every unchanged concept back. const filteredNodes = sourceData.nodes.filter((n) => n.type !== 'shared_property'); const keepIds = new Set(filteredNodes.map((n) => n.id)); const filteredEdges = sourceData.edges.filter((e) => keepIds.has(e.source) && keepIds.has(e.target)); @@ -871,7 +988,7 @@ export default function App({ graphData, customHeight, layout, storageKey, showM if (isHierarchy) return treeLayout(rawNodes, rawEdges); if (groupsActive) return layoutWithGroups(rawNodes, rawEdges, { entityMode: showProperties, seed: layoutSeed }); return layoutElements(rawNodes, rawEdges, { entityMode: showProperties, seed: layoutSeed }); - }, [graphData, showProperties, isHierarchy, groupsActive, collapsedGroups, layoutSeed, hiddenNamespaces]); + }, [graphData, showProperties, isHierarchy, groupsActive, collapsedGroups, layoutSeed, changesOnly, hasDiff, hiddenNamespaces]); const adjacency = useMemo( () => buildAdjacency(layouted.edges), @@ -892,6 +1009,15 @@ export default function App({ graphData, customHeight, layout, storageKey, showM // they're never dimmed by search alone. Click-selection always wins over // search dimming so clicking a context node lets the user explore from it. const displayNodes = useMemo(() => { + // Selecting a relationship reduces the graph to the two concepts it joins — the pair is the + // whole subject of the panel. + if (selectedEdge) { + const ends = new Set([selectedEdge.source, selectedEdge.target]); + return layouted.nodes.map((node) => ({ + ...node, + data: { ...node.data, dimmed: !ends.has(node.id), selected: false }, + })); + } if (selectedNode) { const activeNodes = new Set([selectedNode.id]); (adjacency.neighborNodes[selectedNode.id] || new Set()).forEach((id) => activeNodes.add(id)); @@ -917,28 +1043,49 @@ export default function App({ graphData, customHeight, layout, storageKey, showM const shouldDim = isContainer || node.data?.searchMatch === false; return { ...node, data: { ...node.data, dimmed: shouldDim } }; }); - }, [layouted.nodes, selectedNode, adjacency]); + }, [layouted.nodes, selectedNode, selectedEdge, adjacency]); const displayEdges = useMemo(() => { + if (selectedEdge) { + return layouted.edges.map((edge) => { + if (edge.id === selectedEdge.id) { + return { ...edge, style: { ...edge.style, strokeWidth: 3.5 }, zIndex: 10 }; + } + return { + ...edge, + style: { ...edge.style, stroke: '#e2e8f0', strokeWidth: 1 }, + markerEnd: { type: MarkerType.ArrowClosed, color: '#e2e8f0', width: 14, height: 14 }, + data: { ...edge.data, dimmed: true }, + labelStyle: { fontSize: 10, fill: '#e2e8f0', fontWeight: 500 }, + labelBgStyle: { fill: '#fff', fillOpacity: 0.5 }, + zIndex: 0, + }; + }); + } if (selectedNode) { const activeEdges = adjacency.neighborEdges[selectedNode.id] || new Set(); return layouted.edges.map((edge) => { const active = activeEdges.has(edge.id); + // Selecting a concept must not erase the diff channel — a changed relationship keeps its + // own colour and only borrows the selection's emphasis. + const diff = DIFF_STYLES[edge.data?.diff]; + const activeStroke = diff ? diff.color : '#6366f1'; return { ...edge, style: { - stroke: active ? '#6366f1' : '#e2e8f0', + ...edge.style, + stroke: active ? activeStroke : '#e2e8f0', strokeWidth: active ? 2.5 : 1, }, markerEnd: { type: MarkerType.ArrowClosed, - color: active ? '#6366f1' : '#e2e8f0', + color: active ? activeStroke : '#e2e8f0', width: 14, height: 14, }, data: { ...edge.data, dimmed: !active }, labelStyle: active - ? { fontSize: 11, fill: '#4338ca', fontWeight: 600 } + ? { fontSize: 11, fill: diff ? activeStroke : '#4338ca', fontWeight: diff ? 700 : 600 } : { fontSize: 10, fill: '#e2e8f0', fontWeight: 500 }, labelBgStyle: active ? { fill: '#eef2ff', fillOpacity: 1 } @@ -947,6 +1094,20 @@ export default function App({ graphData, customHeight, layout, storageKey, showM }; }); } + // Changes only, with nothing selected: the diff is the subject and the neighbours are context, + // so a relationship the proposal does not touch reads as background. Without this the dimmed + // nodes were joined by full-strength lines and labels, which drew the eye to the context. + if (changesOnly && hasDiff) { + return layouted.edges.map((edge) => (edge.data?.diff ? edge : { + ...edge, + style: { ...edge.style, stroke: '#e2e8f0', strokeWidth: 1 }, + markerEnd: { type: MarkerType.ArrowClosed, color: '#e2e8f0', width: 14, height: 14 }, + data: { ...edge.data, dimmed: true }, + labelStyle: { fontSize: 10, fill: '#cbd5e1', fontWeight: 500 }, + labelBgStyle: { fill: '#fff', fillOpacity: 0.6 }, + zIndex: 0, + })); + } // Search context: dim edges where either endpoint is a non-match (the // server already drops context↔context edges, so what remains is // match↔match — kept full — and match↔context — dimmed). @@ -972,7 +1133,7 @@ export default function App({ graphData, customHeight, layout, storageKey, showM labelBgStyle: { fill: '#fff', fillOpacity: 0.5 }, }; }); - }, [layouted.edges, selectedNode, adjacency, layouted.nodes]); + }, [layouted.edges, selectedNode, selectedEdge, adjacency, layouted.nodes, changesOnly, hasDiff]); // Initial state: skip the saved-position overlay when mounting with a // filtered subgraph. HTMX morph re-mounts this component on each search @@ -1019,17 +1180,167 @@ export default function App({ graphData, customHeight, layout, storageKey, showM setEdges(displayEdges); } - const onNodeClick = useCallback((_event, node) => { - setSelectedNode((prev) => prev?.id === node.id ? null : node); + /** + * Bring the selected element to the middle of the canvas. + * + * Not the same job as getting a node out from under a panel, though one function used to do both — + * and removing the overlap took this with it. Selecting a card in the list has to move the canvas + * to it, because the reader's whole reason for clicking is to see where it sits; and opening the + * panel narrows the canvas, which shifts what is visible even when nothing is covering it. + */ + const focusNode = useCallback((node) => { + if (!node) return; + // With the lookup, so a node inside a group is measured where it actually sits. + const bounds = getNodesBounds([node], { nodeLookup: store.getState().nodeLookup }); + if (!bounds || !bounds.width) return; + setCenter(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, { + zoom: getViewport().zoom, + duration: 400, + }); + }, [getNodesBounds, getViewport, setCenter, store]); + + /** + * Centre on the selection, once, when React Flow knows how wide it is. + * + * Centring at click time computes against the canvas as it was: selecting the first change opens + * the detail panel and takes half the width, and React Flow measures itself asynchronously. The + * first attempt at this centred immediately and corrected afterwards, which is two pans for every + * click — a fast move and then a small step. + * + * Depending on React Flow's own width instead means the centring happens when the value it is + * computed from actually changes: once per selection, and once more only when the canvas really + * did resize under it. + */ + useEffect(() => { + if (selectedNode) focusNode(selectedNode); + }, [selectedNode, flowWidth, focusNode]); + + /** + * Centre on what the host says is being read. + * + * The graph is beside a page about one element, so it opens on that element rather than on the + * whole picture with the reader left to find it. Marked selected as well as centred: a node in the + * middle of a canvas is not obviously the subject unless it says so. + */ + const focusedRef = useRef(null); + useEffect(() => { + if (!focus || focusedRef.current === focus) return; + const node = getNodes().find((n) => n.data?.externalId === focus); + // Retried through `nodes` because the first render has none yet — and guarded by the ref because + // selecting one recomputes them, which without it is a loop that renders until React gives up. + if (!node) return; + focusedRef.current = focus; + // The host is already showing this one — that is why it asked for it to be centred. + setPanelClaimed(true); + setSelectedNode(node); + }, [focus, getNodes, nodes]); + + const onNodeClick = useCallback((event, node) => { + setSelectedEdge(null); + const deselecting = selectedNode?.id === node.id; + setSelectedNode(deselecting ? null : node); + + // A host may own what a click means — the review does, where picking a changed node is picking + // which change to read, and the page that shows it is not this component. Reported by stable id, + // the only identifier that means anything outside this process. + // + // Whether it owns *this* click is its answer, not a standing arrangement: a review has a page for + // the elements a proposal touches and none for the neighbours drawn around them. Handing an + // unclaimed click back is what lets the panel describe those, as it does anywhere else. + const claimed = Boolean(onSelect) && !deselecting && Boolean(node.data?.externalId) && + onSelect(node.data.externalId, node) === true; + setPanelClaimed(claimed); + }, [selectedNode, onSelect]); + + // A relationship is a change in its own right, so it has to be inspectable on its own — the panel + // is the only place a reviewer can see what a change request did to one. + const onEdgeClick = useCallback((_event, edge) => { + setSelectedNode(null); + setSelectedEdge((prev) => prev?.id === edge.id ? null : edge); }, []); const onPaneClick = useCallback(() => { setSelectedNode(null); + setSelectedEdge(null); }, []); + + // Kept together so the toolbar can live in its own row above the panels rather than under them. + const viewControls = ( + // Down the edge rather than across the top: the canvas is the scarce dimension once the panels + // sit beside it, and a column costs one icon's width instead of four buttons' worth. +
+ {/* Wider than the glyphs below it, and only present when the diagram actually reaches into + another namespace — which is why the column aligns to its right edge rather than + stretching every button to this one's width. */} + {foreignNamespaces.length > 0 && ( +
+ ); + return ( -
+ {/* A row, not a stack. The panels used to float over the canvas, which meant opening one hid the + element it was describing — and every fix for that (panning the node back into view, offsetting + the toolbar) was working around the overlap rather than removing it. Laid out side by side, the + graph keeps whatever width is left and nothing is ever underneath anything. */} +
+
@@ -1092,56 +1404,21 @@ export default function App({ graphData, customHeight, layout, storageKey, showM {showMiniMap && } - -
- {!isHierarchy && hasGroups && ( - - )} - {!isHierarchy && ( - - )} - {foreignNamespaces.length > 0 && ( -
-
+ {viewControls}
+
+ {/* Withheld only for the selections the host claimed — it answers those with its own account + of the element, and two of them side by side is one too many. */} setSelectedNode(null)} + onClose={() => { setSelectedNode(null); setSelectedEdge(null); }} />
diff --git a/src/DetailPanel.jsx b/src/DetailPanel.jsx index c191adb..21845a9 100644 --- a/src/DetailPanel.jsx +++ b/src/DetailPanel.jsx @@ -1,7 +1,79 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; +import { DIFF_STYLES } from './diffStyles'; import NamespaceBadge from './NamespaceBadge'; +// Impact is a separate channel from the diff op: how consequential a change is, independent of +// whether it adds, changes or removes. Ordered as the review order in the change request list. +const IMPACT_COLORS = { + structural: '#dc2626', // red-600 + descriptive: '#d97706', // amber-600 + cosmetic: '#64748b', // slate-500 +}; + +/** + * Half the canvas. A change is read here and merely located out there, so the panel is a working + * surface rather than a slot beside the picture — and being a share of the width rather than a + * pixel count, it stays that on any screen. + */ +const DETAIL_PANEL_SHARE = 0.5; + +// A column beside the canvas rather than over it. Opening it narrows the graph instead of hiding the +// part of it the reader just clicked, which is what the panning and the toolbar offset existed to +// paper over. +const panelStyle = { + width: `${DETAIL_PANEL_SHARE * 100}%`, + flexShrink: 0, + background: '#fff', + borderLeft: '1px solid #e5e7eb', + display: 'flex', + flexDirection: 'column', + overflow: 'hidden', +}; + +/** A body inside a stack flows to its full height; the panel around it is what scrolls. */ +const scrollerStyle = (stacked, extra = {}) => (stacked + ? { display: 'flex', flexDirection: 'column', ...extra } + : { flex: 1, overflow: 'auto', display: 'flex', flexDirection: 'column', ...extra }); + +const stackedBodyStyle = { + display: 'flex', + flexDirection: 'column', + flexShrink: 0, + borderBottom: '1px solid #e5e7eb', +}; + +const closeButtonStyle = { + background: 'none', + border: 'none', + cursor: 'pointer', + padding: 4, + color: '#9ca3af', + fontSize: 18, + lineHeight: 1, + flexShrink: 0, + marginLeft: 8, +}; + +const sectionHeaderStyle = { + padding: '10px 16px 6px', + fontSize: 11, + fontWeight: 600, + textTransform: 'uppercase', + letterSpacing: '0.05em', + color: '#9ca3af', + background: '#f9fafb', + borderBottom: '1px solid #e5e7eb', +}; + +const endpointStyle = { + padding: '2px 7px', + borderRadius: 4, + background: '#f1f5f9', + border: '1px solid #e2e8f0', + fontWeight: 600, +}; + const ACCENT_COLORS = { entity: '#3b82f6', property: '#22c55e', @@ -67,36 +139,30 @@ const KeyIcon = () => ( export default function DetailPanel({ node, + edge, + changesOnly, graphData, isCollapsed, onToggleCollapse, onCollapseOthers, onExpandAll, onClose, + stacked, }) { const { t } = useTranslation(); + if (edge) return ; if (!node) return null; const type = node.type || 'entity'; - const accentColor = ACCENT_COLORS[type] || ACCENT_COLORS.entity; + const diff = DIFF_STYLES[node.data.diff]; + // The diff owns the accent when there is one: what a reviewer needs to see first is that this + // element is part of the proposal, not which kind of concept it is. + const accentColor = diff ? diff.color : (ACCENT_COLORS[type] || ACCENT_COLORS.entity); const { label, description, link, foreignNamespace } = node.data; const isGroup = GROUP_TYPES.has(type); return ( -
+
{/* Accent bar */}
@@ -152,25 +218,36 @@ export default function DetailPanel({
)}
- + {onClose ? : null}
+ {/* Stated, not just chipped: a concept borrowed from another namespace is not this + namespace's to change, and that has to be unmissable before anyone reviews it. */} + {node.data.unresolved && ( +
+ {t('detail.unresolved')} + {node.data.removedBy && ( +
+ + {t('detail.unresolvedRemovedBy')} + +
+ )} +
+ )} + {description && (
) : ( - +
+ {/* What changed about it, then inside it, then around it — and only afterwards who says + so. Evidence sat between the relationships and the properties, splitting one account of + the change in half with a statement about its sourcing. */} + + + + + +
)}
); } -function EntityBody({ node }) { +function EdgePanel({ edge, graphData, onClose, stacked }) { + const { t } = useTranslation(); + // Selection can arrive either as a React Flow edge (clicked in the canvas, diff data nested under + // `data`) or as a raw graph edge (clicked in the related-changes list, diff data at the top level). + const detail = edge.data?.diffDetail ?? edge.diffDetail; + const diff = DIFF_STYLES[edge.data?.diff ?? edge.diff]; + const accentColor = diff ? diff.color : '#64748b'; + const nameOf = (id) => graphData?.nodes?.find((n) => n.id === id)?.data?.label || id; + + return ( +
+
+
+
+
+
+ {t('detail.type.relationship')} +
+
+ {edge.data?.label || edge.label} +
+
+ {onClose ? : null} +
+ + {/* The two ends are what a relationship is; naming them saves tracing the line back. */} +
+ {nameOf(edge.source)} + + {nameOf(edge.target)} +
+
+ +
+ + +
+
+ ); +} + +/** + * What the proposal cites for this element. + * + * A reviewer cannot verify forty generated concepts from knowledge. What they can do is read the + * quote and judge whether it says what the concept says — so the quote belongs on the element, not + * in a document somewhere else. An element changed with nothing cited is called out: absence of + * evidence is the thing worth noticing, and it is invisible unless stated. + */ +function EvidenceSection({ evidence, missing }) { + const { t } = useTranslation(); + const items = evidence || []; + if (items.length === 0 && !missing) return null; + + if (items.length === 0) { + return ( + // The heading names the section whether or not there is anything to worry about, so it is + // drawn like every other one. Only the warning is coloured, because only the warning is one. +
+
{t('detail.evidence.heading')}
+ {/* Full width, like every other row in the panel — inset in a card of its own, it read as a + floating notice rather than as this section's content. */} +
+ {t('detail.evidence.none')} +
+
+ ); + } + + return ( +
+
+ {t('detail.evidence.heading')} ({items.length}) +
+
+ {items.map((e, i) => ( +
+
+ {e.quote} +
+ {e.label && ( +
+ {e.label} +
+ )} + {e.resolvable === false && ( +
+ {t('detail.evidence.unresolvable')} +
+ )} +
+ ))} +
+
+ ); +} + +/** + * Other pending change requests editing this same element. + * + * Overlap is a risk, not a certainty: approving reshapes the others onto the new state and two edits + * to one concept often merge cleanly. What the reviewer needs is which concept is contested and a way + * to go and look, which is why this hangs off the element rather than sitting in a banner. + */ +function OverlapSection({ overlaps }) { + const { t } = useTranslation(); + if (!overlaps || overlaps.length === 0) return null; + + return ( +
+
+ {t('detail.overlap.heading')} ({overlaps.length}) +
+
+ {t('detail.overlap.description')} +
+ +
+ ); +} + +/** + * What breaks if this removal goes ahead — the consumers that do not get a vote on it. + * + * Deliberately here rather than in a table beside the graph: the removal and its cost are one fact, + * and separating them makes the reviewer join them up by hand. Approving is decided on this. + */ +function ConsumersSection({ consumers }) { + const { t } = useTranslation(); + if (!consumers || consumers.total === 0) return null; + + const groups = [ + ['relationship', consumers.relationships], + ['dataProduct', consumers.dataProducts], + ['dataContract', consumers.dataContracts], + ].filter(([, items]) => items && items.length > 0); + + return ( +
+
+ {t('detail.consumers.heading')} ({consumers.total}) +
+
+ {t('detail.consumers.description')} +
+ {groups.map(([kind, items]) => ( +
+
+ {t(`detail.consumers.${kind}`)} +
+ {items.map((item, i) => ( +
+ {item.link ? ( + e.currentTarget.style.textDecoration = 'underline'} + onMouseOut={(e) => e.currentTarget.style.textDecoration = 'none'}> + {item.label} + + ) : ( + {item.label} + )} + {item.namespace && ( + · {item.namespace} + )} +
+ ))} +
+ ))} +
+ ); +} + +/** + * What the proposal does to this element: the operation, how consequential it is, and each field + * that moves, rendered by the field's shape rather than as before/after prose. + */ +function DiffSection({ detail }) { + const { t } = useTranslation(); + if (!detail) return null; + + const diff = DIFF_STYLES[detail.op] || DIFF_STYLES.modify; + const impactColor = IMPACT_COLORS[detail.impact] || IMPACT_COLORS.cosmetic; + + return ( +
+
+
+ + {diff.symbol} + {t(`detail.diff.op.${detail.op}`)} + + + {t(`detail.diff.impact.${detail.impact}`)} + +
+ +
+ {t(`detail.diff.summary.${detail.op}`)} +
+
+ + {detail.fields?.length > 0 && ( +
+ {detail.fields.map((f) => ( + + ))} +
+ )} +
+ ); +} + +function FieldChange({ change }) { + const { t } = useTranslation(); + const impactColor = IMPACT_COLORS[change.impact] || IMPACT_COLORS.cosmetic; + + return ( +
+
+ {change.field} +
+ +
+ ); +} + + +// --- Decorated values ------------------------------------------------------------------------ +// +// A host may know things about a value that this component cannot: that "Confidential" is a governed +// level with a colour and an icon of its own, that a tier outranks another. Rather than teach those +// concepts here, any value in a change may arrive as `{ display: 'badge', label, color, icon }` and +// is drawn as one wherever a plain value would have been — a field, a list item, a map entry. +// `color` is a palette token, `icon` inline SVG the host is trusted for, exactly as it is trusted +// for the labels beside it. + +const BADGE_PALETTE = { + red: ['#fef2f2', '#b91c1c', '#fecaca'], + orange: ['#fff7ed', '#c2410c', '#fed7aa'], + amber: ['#fffbeb', '#b45309', '#fde68a'], + yellow: ['#fefce8', '#854d0e', '#fef08a'], + green: ['#f0fdf4', '#15803d', '#bbf7d0'], + teal: ['#f0fdfa', '#0f766e', '#99f6e4'], + blue: ['#eff6ff', '#1d4ed8', '#bfdbfe'], + indigo: ['#eef2ff', '#4338ca', '#c7d2fe'], + purple: ['#faf5ff', '#7e22ce', '#e9d5ff'], + pink: ['#fdf2f8', '#be185d', '#fbcfe8'], + gray: ['#f9fafb', '#4b5563', '#e5e7eb'], +}; + +/** + * A decorated value the host can say more about than its text does. When it carries an `href` it is + * a way back to the thing itself — the level that says what "Confidential" obliges, the team taking + * ownership — which is exactly what a reviewer needs and cannot get from the word. + */ +function Decorated({ value, strike }) { + const linked = Boolean(value.href) && !strike; + // A badge is already a thing rather than a word, so it keeps its own colours and says it is + // clickable by being a badge. A plain value has nothing to go on, and hover is no help to someone + // who does not know there is anything to hover — so the link is underlined standing still. + const inner = value.display === 'badge' ? : ( + + {value.label} + + ); + if (!value.href) return inner; + return ( + { e.currentTarget.style.opacity = 0.75; }} + onMouseOut={(e) => { e.currentTarget.style.opacity = 1; }}> + {inner} + + ); +} + +function Badge({ badge, strike }) { + const [bg, fg, ring] = BADGE_PALETTE[(badge.color || 'gray').toLowerCase()] || BADGE_PALETTE.gray; + return ( + + {badge.icon ? ( + + ) : null} + {badge.label} + + ); +} + +// A translation key names a locale, and a flag is how the application shows one. +const LOCALE_FLAGS = { + de: '\u{1F1E9}\u{1F1EA}', fr: '\u{1F1EB}\u{1F1F7}', es: '\u{1F1EA}\u{1F1F8}', it: '\u{1F1EE}\u{1F1F9}', + nl: '\u{1F1F3}\u{1F1F1}', pt: '\u{1F1F5}\u{1F1F9}', pl: '\u{1F1F5}\u{1F1F1}', en: '\u{1F1EC}\u{1F1E7}', +}; + +/** `description@de` reads as a German description, not as a key with a suffix. */ +function TranslationKey({ name }) { + const at = name.lastIndexOf('@'); + if (at < 0) { + return ( + + {name} + + ); + } + const field = name.slice(0, at); + const locale = name.slice(at + 1).toLowerCase(); + return ( + // Room between the parts, not a line break: the flag, the tag and the field name ran together at + // 10.5px with three pixels between them, which is a spacing problem rather than a width one. + + + {LOCALE_FLAGS[locale] || '\u{1F310}'} + {locale.toUpperCase()} + + + {field} + + + ); +} + +// --- Field rendering, by shape --------------------------------------------------------------- +// +// A change is not always prose. A classification is one value from a small set, `required` is a +// state, `examples` is a set of items, and `custom_properties` holds translations keyed by locale. +// Rendering all of them as before-and-after paragraphs made the small changes hard to see and the +// map of translations unreadable — one struck-through block where the reviewer needed to know which +// locale moved. + +// OSI's own small vocabularies: one value out of a handful, which reads better as a chip than as a +// sentence. Governed values are not listed here — those arrive decorated and are recognised by shape. +const ENUM_FIELDS = new Set(['status', 'kind', 'element_type', 'better_when']); +const CODE_FIELDS = new Set(['pattern', 'formula', 'iri', 'data_type', 'extends', 'unit']); + +const isBlank = (v) => v === null || v === undefined || v === '' || (Array.isArray(v) && v.length === 0); +const isList = (v) => Array.isArray(v); +const isMap = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) && !v.display; +const isBool = (v) => typeof v === 'boolean'; +const isDecorated = (v) => v !== null && typeof v === 'object' && typeof v.display === 'string'; + +const chipStyle = (kind) => ({ + display: 'inline-block', + fontSize: 11.5, + padding: '1px 7px', + borderRadius: 4, + border: '1px solid', + marginRight: 4, + marginTop: 3, + ...(kind === 'add' + ? { color: '#15803d', borderColor: '#bbf7d0', background: '#f0fdf4' } + : kind === 'remove' + ? { color: '#b91c1c', borderColor: '#fecaca', background: '#fef2f2', textDecoration: 'line-through' } + : { color: '#374151', borderColor: '#e5e7eb', background: '#f9fafb' }), +}); + +/** One value as a chip, so a small vocabulary reads as a value rather than a sentence. */ +function Chip({ value, kind, mono }) { + const { t } = useTranslation(); + if (isDecorated(value)) return ; + if (isBlank(value)) { + return {t('detail.diff.unset')}; + } + return ( + + {String(value)} + + ); +} + +/** Old and new side by side. For one-of-a-few values, the arrow says more than two labelled rows. */ +function ChipTransition({ before, after, mono }) { + return ( +
+ + {/* The arrow travels with the value it points at. A long value wrapping to the next line + otherwise strands the arrow at the end of the previous one, and the pair stops reading + as one transition. */} + + + + +
+ ); +} + +/** A set difference: what stayed, what went, what arrived — rather than two printed lists. */ +function ListDiff({ before, after }) { + const key = (v) => (isDecorated(v) ? `d:${v.display}:${v.label}` : String(v)); + const b = (before || []).map(key); + const a = (after || []).map(key); + const byKey = new Map([...(before || []), ...(after || [])].map((v) => [key(v), v])); + const chip = (k, kind) => ; + const removed = b.filter((x) => !a.includes(x)); + const added = a.filter((x) => !b.includes(x)); + const kept = a.filter((x) => b.includes(x)); + return ( +
+ {kept.map((k) => chip(k, 'same'))} + {removed.map((k) => chip(k, 'remove'))} + {added.map((k) => chip(k, 'add'))} +
+ ); +} + +/** + * A map, key by key. Translations live here, and a reviewer's question is which locale changed — + * not what the whole map used to print as. + */ +function MapDiff({ before, after }) { + const b = isMap(before) ? before : {}; + const a = isMap(after) ? after : {}; + // `evidence` rides in custom_properties but has a section of its own above; showing the raw + // entry here would print the same citation twice, once unreadably. + const keys = [...new Set([...Object.keys(b), ...Object.keys(a)])].filter((k) => k !== 'evidence').sort(); + const moved = keys.filter((k) => JSON.stringify(b[k]) !== JSON.stringify(a[k])); + if (moved.length === 0) return null; + return ( +
+ {moved.map((k) => ( +
+ + {isBlank(b[k]) + ? + : isBlank(a[k]) + ? + : isDecorated(b[k]) || isDecorated(a[k]) + ? + : } +
+ ))} +
+ ); +} + +/** The original treatment, kept for what it suits: sentences. */ +function ProseDiff({ before, after, base }) { + const { t } = useTranslation(); + // Two sentences one above the other, each wrapped to four lines, are compared by memory. Side by + // side at the same width, the words that moved are the ones that do not line up. `auto-fit` drops + // back to one column where two would be too narrow to read, without anything measuring anything. + return ( +
+ {/* The version the author wrote against, shown only where the target has moved away from it. + Without it a conflict reads as an ordinary change that was refused for no reason. */} + {base !== undefined && base !== null && ( + + )} + + +
+ ); +} + +function ProseColumn({ label, value, color, strike }) { + const { t } = useTranslation(); + const isUnset = value === null || value === undefined || value === ''; + return ( +
+
+ {label} +
+
+ {isUnset ? t('detail.diff.unset') : String(value)} +
+
+ ); +} + +/** Picks the rendering from the value's shape, falling back to prose. */ +function FieldDiff({ field, before, after, base }) { + // A three-way situation is a diff of prose whatever the field's shape: the point is the third + // value, and chips side by side cannot say which of them the author never saw. + const threeWay = base !== undefined && base !== null; + if (!threeWay) { + if (isDecorated(before) || isDecorated(after)) return ; + if (isMap(before) || isMap(after)) return ; + if (isList(before) || isList(after)) return ; + if (isBool(before) || isBool(after)) return ; + if (ENUM_FIELDS.has(field)) return ; + } + if (!threeWay && CODE_FIELDS.has(field)) return ; + return ; +} + +function EntityBody({ node, changesOnly }) { const { t } = useTranslation(); const { description, properties = [] } = node.data; const ownProperties = properties.filter((p) => !p.inherited); const inheritedProperties = properties.filter((p) => p.inherited); return ( -
+
{ownProperties.length > 0 && ( - + )} {inheritedProperties.length > 0 && ( - + )} {properties.length === 0 && !description && (
@@ -395,37 +1082,32 @@ function MemberRow({ member }) { return row; } -function PropertySection({ title, properties, count, inherited }) { +function PropertySection({ title, properties, count, inherited, changesOnly }) { + const { t } = useTranslation(); + const changed = properties.filter((p) => p.diff); + const shown = changesOnly ? changed : properties; + if (shown.length === 0) return null; return (
-
- {title} ({count}) + {/* The total and how much of it moved: with fourteen properties and one change, the count is + what tells a reviewer whether they are looking at a rewrite or a typo. */} +
+ {title} ({count}{changed.length > 0 ? t('detail.propertiesChanged', { count: changed.length }) : ''})
- {properties.map((prop, i) => ( + {shown.map((prop, i) => (
+
)} + {/* A shared property is carried by several concepts, so a change to it reaches all of + them — which is exactly what a reviewer looking at one concept cannot otherwise see. */} + {prop.shared && ( + + {t('detail.shared')} + + )} {prop.primaryKey && } + {prop.diff && ( + + {DIFF_STYLES[prop.diff]?.label} + + )} +
+
+ {prop.description && ( +
+ {prop.description}
+ )} + {/* The property is what changed, so its before and after belong on its row — not one level + up on the concept, which did not change. */} + {prop.diffDetail?.fields?.length > 0 && ( +
+ {prop.diffDetail.fields.map((f) => ( +
+
+ {f.field} +
+ +
+ ))} +
+ )}
))}
diff --git a/src/EntityNode.jsx b/src/EntityNode.jsx index 913c723..273c31e 100644 --- a/src/EntityNode.jsx +++ b/src/EntityNode.jsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Handle, Position } from '@xyflow/react'; +import { DIFF_STYLES } from './diffStyles'; import NamespaceBadge from './NamespaceBadge'; const MAX_VISIBLE_PROPERTIES = 8; @@ -47,8 +48,9 @@ export default function EntityNode({ data, type }) { const icon = TYPE_ICONS[type] || TYPE_ICONS.entity; const hideProperties = data.hideProperties; const allProperties = hideProperties ? [] : (data.properties || []); - // Auto-expand if a highlighted property would otherwise be hidden behind "+N more". - const highlightHidden = allProperties.some((p, i) => p.highlight && i >= MAX_VISIBLE_PROPERTIES); + // Auto-expand if a highlighted or changed property would otherwise be hidden behind "+N more". + // A change a reviewer has to click to discover is a change they will approve without reading. + const highlightHidden = allProperties.some((p, i) => (p.highlight || p.diff) && i >= MAX_VISIBLE_PROPERTIES); const [expanded, setExpanded] = useState(highlightHidden); const hasMore = !expanded && allProperties.length > MAX_VISIBLE_PROPERTIES; const properties = hasMore ? allProperties.slice(0, MAX_VISIBLE_PROPERTIES) : allProperties; @@ -60,18 +62,44 @@ export default function EntityNode({ data, type }) { setExpanded((v) => !v); }; + // How a pending change request would affect this concept. Rendered as a ring and a corner label + // rather than by recolouring the node, so the type accent still reads: a reviewer needs to see + // *what* a concept is at the same time as what happens to it. + const diff = DIFF_STYLES[data.diff]; + // A concept can be untouched itself and still be where the change lands, when the request only + // edits one of its properties. The rows below say which one; this is what carries that across a + // graph, where rows are unreadable until you zoom in. + const changedProperties = data.changedPropertyCount || 0; + const ring = diff || (changedProperties > 0 ? DIFF_STYLES.modify : null); + const ringLabel = diff ? t(`node.diff.${data.diff}`) : t('node.propertiesChanged', { count: changedProperties }); + return (
+ {ring && ( +
{ringLabel}
+ )} @@ -114,7 +142,13 @@ export default function EntityNode({ data, type }) {
{properties.length > 0 ? ( <> - {properties.map((prop, i) => ( + {properties.map((prop, i) => { + // The rail and tint follow the diff colour rather than the property accent, so a + // changed property reads the same as a changed concept or relationship elsewhere in + // the graph. Search highlighting keeps the green accent it always had. + const propDiff = DIFF_STYLES[prop.diff]; + const rail = propDiff ? propDiff.color : prop.highlight ? ACCENT_COLORS.property : null; + return (
- {prop.type && ( + {propDiff ? ( + + {t(`detail.diff.op.${prop.diff}`)} + + ) : prop.type && ( {prop.type} @@ -150,7 +193,8 @@ export default function EntityNode({ data, type }) { {prop.primaryKey && }
- ))} + ); + })} {(hasMore || (expanded && allProperties.length > MAX_VISIBLE_PROPERTIES)) && (
+ {/* What a change request does to this concept, as a word after the name in the diff colour. + A concept untouched itself but with edited properties reads as edited too: without that + the node looks untouched and the request reads as empty. */} + {(diff || data.changedPropertyCount > 0) && ( + + {t(`node.diff.${diff ? data.diff : 'modify'}`)} + + )} + {/* Warnings after the name, on the right with the diff word, so the left of a pill is always + its icon and its name. */} + {/* Named by a relationship but present nowhere. Marked rather than hidden: a change request + pointing at a concept that does not exist cannot be applied, and silently dropping the edge + would show the reviewer an empty diff. */} + {data.unresolved && ( + + missing + + )} + {/* Another pending request edits this same element. Indigo rather than the diff or impact + colours: it is not a property of this change, it is a warning about a different one. */} + {data.overlaps?.length > 0 && ( + + {data.overlaps.length > 1 ? data.overlaps.length : '⇄'} + + )} + {/* How many things break if this removal goes ahead. On the node itself because it is the one + number that decides whether a removal is routine or serious, and a reviewer should not have + to open anything to see it. */} + {data.consumers?.total > 0 && ( + + + {data.consumers.total} + + )}
); } diff --git a/src/controlIcons.jsx b/src/controlIcons.jsx index a8939d1..a7b9e00 100644 --- a/src/controlIcons.jsx +++ b/src/controlIcons.jsx @@ -45,3 +45,44 @@ export const collapseAllIcon = ( ); + +// --- Toolbar toggles ----------------------------------------------------------------------------- +// +// Drawn in the same stroke language as the zoom and fit-view glyphs above, at 24×24 so they sit on +// the same grid. Each is a state rather than an action, so the button around it carries the pressed +// styling and a title — a glyph alone cannot say "on". + +/** Changes only: a funnel, the ordinary sign for showing a subset. */ +export const changesOnlyIcon = ( + + + +); + +/** Groups: nested containers. */ +export const groupsIcon = ( + + + + + +); + +/** Entity-relationship view: a table of rows, which is what the concepts become. */ +export const erdIcon = ( + + + + +); + +/** Enlarge: arrows pushing out to the corners. */ +export const enlargeIcon = ( + + + +); diff --git a/src/diffStyles.js b/src/diffStyles.js new file mode 100644 index 0000000..f7d721f --- /dev/null +++ b/src/diffStyles.js @@ -0,0 +1,11 @@ +// How a change request's proposed changes are marked up. Kept out of the node +// components because edges carry the same three states and must match them. +// +// Deliberately not a recolour of the element itself: colour already encodes +// concept type (entity/property/...), so diff state is a ring and a word on +// nodes, and stroke colour on edges — which have no type colour of their own. +export const DIFF_STYLES = { + add: { color: '#16a34a', label: 'added', symbol: '+' }, // green-600 + modify: { color: '#d97706', label: 'edited', symbol: '~' }, // amber-600 + remove: { color: '#dc2626', label: 'removed', symbol: '−' }, // red-600 +}; diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 37d775d..f6e56ef 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -21,6 +21,10 @@ "label": "Als Entity-Relationship-Diagramm anzeigen", "title": "Als Entity-Relationship-Diagramm anzeigen — Eigenschaften innerhalb der Konzept- und Metrik-Knoten darstellen" }, + "changesOnly": { + "label": "Nur Änderungen", + "title": "Nur die Konzepte und Beziehungen anzeigen, die dieser Change Request betrifft" + }, "namespaces": { "label": "Andere Namespaces", "title": "Konzepte aus anderen Namespaces ein- oder ausblenden", @@ -42,16 +46,71 @@ "entity": "Entität", "property": "Eigenschaft", "metric": "Metrik", - "group": "Gruppe" + "group": "Gruppe", + "relationship": "Beziehung" }, "expandThisGroup": "Diese Gruppe aufklappen", - "collapseThisGroup": "Diese Gruppe einklappen" + "collapseThisGroup": "Diese Gruppe einklappen", + "diff": { + "op": { + "add": "Hinzugefügt", + "modify": "Bearbeitet", + "remove": "Entfernt" + }, + "impact": { + "structural": "Strukturell", + "descriptive": "Beschreibend", + "cosmetic": "Kosmetisch" + }, + "impactHint": { + "structural": "Ändert die Bedeutung des Modells.", + "descriptive": "Ändert die Lesart des Modells, nicht seine Bedeutung.", + "cosmetic": "Nur die Formulierung." + }, + "summary": { + "add": "Existiert noch nicht. Mit der Freigabe dieses Requests wird es angelegt.", + "remove": "Mit der Freigabe dieses Requests wird es gelöscht.", + "modify": "Mit der Freigabe dieses Requests wird Folgendes übernommen." + }, + "before": "Aktuell", + "after": "Vorgeschlagen", + "unset": "nicht gesetzt", + "base": "Vorher" + }, + "consumers": { + "heading": "Bricht beim Entfernen", + "description": "Diese hängen von diesem Konzept ab und entscheiden diese Änderung nicht. Beim Entfernen bleiben ihre Referenzen kaputt.", + "relationship": "Beziehungen in anderen Namespaces", + "dataProduct": "Data Products", + "dataContract": "Data Contracts" + }, + "overlap": { + "heading": "Wird ebenfalls geändert", + "description": "Ein anderer offener Change Request bearbeitet dieses Element ebenfalls. Mit der Freigabe wird der andere auf den neuen Stand übertragen, was meist sauber zusammengeführt wird.", + "view": "Anderen Change Request ansehen" + }, + "unresolved": "Dieses Konzept existiert nicht. Eine Beziehung in diesem Change Request zeigt darauf, deshalb kann er so nicht angewendet werden.", + "unresolvedRemovedBy": "Change Request ansehen, der es entfernt hat", + "evidence": { + "heading": "Belege", + "none": "Diese Änderung zitiert nichts. Sie lässt sich gegen keine Quelle prüfen.", + "unresolvable": "Nicht erneut prüfbar — kein Repository, Pfad und Commit" + }, + "propertiesChanged": ", {{count}} geändert", + "shared": "geteilt" }, "node": { "noProperties": "Keine Eigenschaften", "group": "Gruppe", "expandGroup": "Gruppe aufklappen", "collapseGroup": "Gruppe einklappen", - "foreignNamespace": "Aus dem Namespace \"{{namespace}}\"" + "propertiesChanged_one": "{{count}} Eigenschaft geändert", + "propertiesChanged_other": "{{count}} Eigenschaften geändert", + "foreignNamespace": "Aus dem Namespace \"{{namespace}}\"", + "diff": { + "add": "hinzugefügt", + "modify": "bearbeitet", + "remove": "entfernt" + } } } diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 21c4610..ed813db 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -21,6 +21,10 @@ "label": "Show as Entity-Relationship-Diagram", "title": "Show as Entity-Relationship Diagram — render properties inside concept and metric nodes" }, + "changesOnly": { + "label": "Changes only", + "title": "Show only the concepts and relationships this change request touches" + }, "namespaces": { "label": "Other namespaces", "title": "Show or hide the concepts that come from other namespaces", @@ -42,16 +46,71 @@ "entity": "Entity", "property": "Property", "metric": "Metric", - "group": "Group" + "group": "Group", + "relationship": "Relationship" }, "expandThisGroup": "Expand this group", - "collapseThisGroup": "Collapse this group" + "collapseThisGroup": "Collapse this group", + "diff": { + "op": { + "add": "Added", + "modify": "Edited", + "remove": "Removed" + }, + "impact": { + "structural": "Structural", + "descriptive": "Descriptive", + "cosmetic": "Cosmetic" + }, + "impactHint": { + "structural": "Changes what the model means.", + "descriptive": "Changes how the model reads, not what it means.", + "cosmetic": "Wording only." + }, + "summary": { + "add": "Does not exist yet. Approving this request creates it.", + "remove": "Approving this request deletes it.", + "modify": "Approving this request applies the following." + }, + "before": "Now", + "after": "Proposed", + "unset": "not set", + "base": "Was" + }, + "consumers": { + "heading": "Breaks on removal", + "description": "These depend on this concept and do not decide this change. Removing it leaves their references broken.", + "relationship": "relationships in other namespaces", + "dataProduct": "data products", + "dataContract": "data contracts" + }, + "overlap": { + "heading": "Also being changed", + "description": "Another pending change request edits this element too. Approving this one reshapes the other onto the new state, which usually merges cleanly.", + "view": "View the other change request" + }, + "unresolved": "This concept does not exist. A relationship in this change request points at it, so the request cannot be applied as it stands.", + "unresolvedRemovedBy": "See the change request that removed it", + "evidence": { + "heading": "Evidence", + "none": "This change cites nothing. It cannot be checked against a source.", + "unresolvable": "Cannot be checked again — no repository, path and commit" + }, + "propertiesChanged": ", {{count}} changed", + "shared": "shared" }, "node": { "noProperties": "No properties", "group": "Group", "expandGroup": "Expand group", "collapseGroup": "Collapse group", - "foreignNamespace": "From the \"{{namespace}}\" namespace" + "propertiesChanged_one": "{{count}} property changed", + "propertiesChanged_other": "{{count}} properties changed", + "foreignNamespace": "From the \"{{namespace}}\" namespace", + "diff": { + "add": "added", + "modify": "edited", + "remove": "removed" + } } } diff --git a/src/index.css b/src/index.css index ee1f5d6..f1f8f3a 100644 --- a/src/index.css +++ b/src/index.css @@ -62,3 +62,10 @@ stroke: #888 !important; stroke-width: 2.5px !important; } + +/* Edge labels read as chips over the graph, so they belong above every edge layer. React Flow gives + each zIndex band its own SVG and leaves this container below the raised ones, which put a diff + edge's dashes through a neighbouring label. Pointer events stay off, so nothing else changes. */ +.react-flow__edgelabel-renderer { + z-index: 11; +} diff --git a/src/main.jsx b/src/main.jsx index 3168a35..a9c3647 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -26,6 +26,7 @@ function initElement(container) { const height = container.dataset.height || '400px'; const layout = container.dataset.layout || 'force'; const showMiniMap = container.dataset.showMinimap === 'true'; + const changesOnly = container.dataset.changesOnly === 'true'; if (!jsonUrl) return; @@ -41,7 +42,8 @@ function initElement(container) { createRoot(container).render( - + ); @@ -60,3 +62,69 @@ if (document.readyState === 'loading') { } document.addEventListener('htmx:load', mountAll); + +/** + * Explicit mount, for a host that has more to supply than a URL. + * + * Deliberately shaped like the data contract editor's `init({...})` rather than inventing a + * convention: entropy-data already embeds components that way, and a callback is what lets this stay + * ignorant of authentication and of the endpoint behind it. The auto-mount above is untouched, so the + * read-only embeds keep working without knowing this exists. + * + * @param {object} options + * @param {string|Element} options.container selector or element to mount into + * @param {object} options.graphData `{nodes, edges}`, e.g. from the namespace graph endpoint + * @param {boolean} [options.changesOnly] open showing only what carries a diff + * @param {string} [options.focus] external id to centre and select on mount + * @param {Function} [options.onSelect] `(externalId, node) => void` — the host owns what a + * click means; supplying this also withholds the built-in + * detail panel, so one click opens one account of an + * element rather than two + * @param {string} [options.locale] + * @param {string} [options.height] + * @returns {{ update: (next: object) => void } | null} `update` merges `graphData`, `focus`, + * `changesOnly` and `onSelect` into the options and re-renders; container, height, locale + * and layout are fixed at mount + */ +export function init(options) { + const container = typeof options.container === 'string' + ? document.querySelector(options.container) + : options.container; + if (!container) return null; + + const height = options.height || '600px'; + container.style.height = height; + // Everything that reaches for its own container does so via `.semantic-visualizer` — the enlarge + // button among them, which silently did nothing when mounted this way because `closest()` found no + // such ancestor. Marking it initialised too keeps the auto-mount from claiming it as well. + container.classList.add('semantic-visualizer'); + container.dataset.svInit = 'true'; + if (options.locale) i18n.changeLanguage(options.locale); + + const root = createRoot(container); + let current = { ...options }; + const render = () => root.render( + + + + + + ); + + render(); + return { + update: (next) => { + current = { ...current, ...next }; + render(); + }, + }; +} diff --git a/src/main/resources/static/assets/semantic-visualizer/index.css b/src/main/resources/static/assets/semantic-visualizer/index.css deleted file mode 100644 index ef01e9c..0000000 --- a/src/main/resources/static/assets/semantic-visualizer/index.css +++ /dev/null @@ -1 +0,0 @@ -.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.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__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray: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.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.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:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{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:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.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.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@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;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.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-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.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:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.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-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.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:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));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:var(--xy-resize-background-color, var(--xy-resize-background-color-default));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%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}#semantic-visualizer .react-flow__node{cursor:grab}#semantic-visualizer .react-flow__node:active{cursor:grabbing}#semantic-visualizer .react-flow__node.selected{outline:2px solid #6366f1;outline-offset:2px;border-radius:20px}#semantic-visualizer .react-flow__edge-textbg{rx:4}#semantic-visualizer .react-flow__edge.selected .react-flow__edge-path{stroke:#888!important;stroke-width:3px!important}#semantic-visualizer .react-flow__edge-path{cursor:pointer}#semantic-visualizer .react-flow__edge:hover .react-flow__edge-path{stroke:#888!important;stroke-width:2.5px!important}#semantic-visualizer .react-flow__controls-button{width:24px;height:24px}#semantic-visualizer .react-flow__controls-button svg{max-width:12px;max-height:12px} diff --git a/src/main/resources/static/assets/semantic-visualizer/index.js b/src/main/resources/static/assets/semantic-visualizer/index.js deleted file mode 100644 index f521f68..0000000 --- a/src/main/resources/static/assets/semantic-visualizer/index.js +++ /dev/null @@ -1,62 +0,0 @@ -function wp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Sa={exports:{}},ti={},_a={exports:{}},ke={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ud;function Wm(){if(Ud)return ke;Ud=1;var t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=m&&M[m]||M["@@iterator"],typeof M=="function"?M:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,_={};function w(M,R,te){this.props=M,this.context=R,this.refs=_,this.updater=te||x}w.prototype.isReactComponent={},w.prototype.setState=function(M,R){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,R,"setState")},w.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function k(){}k.prototype=w.prototype;function P(M,R,te){this.props=M,this.context=R,this.refs=_,this.updater=te||x}var N=P.prototype=new k;N.constructor=P,S(N,w.prototype),N.isPureReactComponent=!0;var C=Array.isArray,j=Object.prototype.hasOwnProperty,D={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function B(M,R,te){var re,le={},ue=null,ae=null;if(R!=null)for(re in R.ref!==void 0&&(ae=R.ref),R.key!==void 0&&(ue=""+R.key),R)j.call(R,re)&&!H.hasOwnProperty(re)&&(le[re]=R[re]);var ee=arguments.length-2;if(ee===1)le.children=te;else if(1>>1,R=T[M];if(0>>1;Mu(le,V))ueu(ae,le)?(T[M]=ae,T[ue]=V,M=ue):(T[M]=le,T[re]=V,M=re);else if(ueu(ae,V))T[M]=ae,T[ue]=V,M=ue;else break e}}return L}function u(T,L){var V=T.sortIndex-L.sortIndex;return V!==0?V:T.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();t.unstable_now=function(){return c.now()-d}}var p=[],g=[],v=1,m=null,y=3,x=!1,S=!1,_=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(T){for(var L=i(g);L!==null;){if(L.callback===null)s(g);else if(L.startTime<=T)s(g),L.sortIndex=L.expirationTime,r(p,L);else break;L=i(g)}}function C(T){if(_=!1,N(T),!S)if(i(p)!==null)S=!0,F(j);else{var L=i(g);L!==null&&Y(C,L.startTime-T)}}function j(T,L){S=!1,_&&(_=!1,k(B),B=-1),x=!0;var V=y;try{for(N(L),m=i(p);m!==null&&(!(m.expirationTime>L)||T&&!W());){var M=m.callback;if(typeof M=="function"){m.callback=null,y=m.priorityLevel;var R=M(m.expirationTime<=L);L=t.unstable_now(),typeof R=="function"?m.callback=R:m===i(p)&&s(p),N(L)}else s(p);m=i(p)}if(m!==null)var te=!0;else{var re=i(g);re!==null&&Y(C,re.startTime-L),te=!1}return te}finally{m=null,y=V,x=!1}}var D=!1,H=null,B=-1,X=5,J=-1;function W(){return!(t.unstable_now()-JT||125M?(T.sortIndex=V,r(g,T),i(p)===null&&T===i(g)&&(_?(k(B),B=-1):_=!0,Y(C,V-M))):(T.sortIndex=R,r(p,T),S||x||(S=!0,F(j))),T},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(T){var L=y;return function(){var V=y;y=L;try{return T.apply(this,arguments)}finally{y=V}}}})(Na)),Na}var Kd;function Qm(){return Kd||(Kd=1,ka.exports=Xm()),ka.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Gd;function Km(){if(Gd)return ht;Gd=1;var t=vi(),r=Qm();function i(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,g=/^[: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]*$/,v={},m={};function y(e){return p.call(m,e)?!0:p.call(v,e)?!1:g.test(e)?m[e]=!0:(v[e]=!0,!1)}function x(e,n,o,l){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return l?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function S(e,n,o,l){if(n===null||typeof n>"u"||x(e,n,o,l))return!0;if(l)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function _(e,n,o,l,f,h,E){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=l,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=E}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){w[e]=new _(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];w[n]=new _(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){w[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){w[e]=new _(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){w[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){w[e]=new _(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){w[e]=new _(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){w[e]=new _(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){w[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function P(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 n=e.replace(k,P);w[n]=new _(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(k,P);w[n]=new _(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(k,P);w[n]=new _(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){w[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),w.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){w[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function N(e,n,o,l){var f=w.hasOwnProperty(n)?w[n]:null;(f!==null?f.type!==0:l||!(2I||f[E]!==h[I]){var $=` -`+f[E].replace(" at new "," at ");return e.displayName&&$.includes("")&&($=$.replace("",e.displayName)),$}while(1<=E&&0<=I);break}}}finally{te=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?R(e):""}function le(e){switch(e.tag){case 5:return R(e.type);case 16:return R("Lazy");case 13:return R("Suspense");case 19:return R("SuspenseList");case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(e.type,!0),e;default:return""}}function ue(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 H:return"Fragment";case D:return"Portal";case X:return"Profiler";case B:return"StrictMode";case Z:return"Suspense";case z:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case W:return(e.displayName||"Context")+".Consumer";case J:return(e._context.displayName||"Context")+".Provider";case U:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case b:return n=e.displayName||null,n!==null?n:ue(e.type)||"Memo";case F:n=e._payload,e=e._init;try{return ue(e(n))}catch{}}return null}function ae(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(n);case 8:return n===B?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function ee(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ce(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function we(e){var n=ce(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),l=""+e[n];if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(E){l=""+E,h.call(this,E)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(E){l=""+E},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function _e(e){e._valueTracker||(e._valueTracker=we(e))}function Se(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var o=n.getValue(),l="";return e&&(l=ce(e)?e.checked?"true":"false":e.value),e=l,e!==o?(n.setValue(e),!0):!1}function ye(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 Ce(e,n){var o=n.checked;return V({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Te(e,n){var o=n.defaultValue==null?"":n.defaultValue,l=n.checked!=null?n.checked:n.defaultChecked;o=ee(n.value!=null?n.value:o),e._wrapperState={initialChecked:l,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Me(e,n){n=n.checked,n!=null&&N(e,"checked",n,!1)}function We(e,n){Me(e,n);var o=ee(n.value),l=n.type;if(o!=null)l==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?gt(e,n.type,o):n.hasOwnProperty("defaultValue")&>(e,n.type,ee(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function At(e,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var l=n.type;if(!(l!=="submit"&&l!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,o||n===e.value||(e.value=n),e.defaultValue=n}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function gt(e,n,o){(n!=="number"||ye(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var mt=Array.isArray;function kt(e,n,o,l){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=Yn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function on(e,n){if(n){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=n;return}}e.textContent=n}var Xn={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},zl=["Webkit","ms","Moz","O"];Object.keys(Xn).forEach(function(e){zl.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Xn[n]=Xn[e]})});function zi(e,n,o){return n==null||typeof n=="boolean"||n===""?"":o||typeof n!="number"||n===0||Xn.hasOwnProperty(e)&&Xn[e]?(""+n).trim():n+"px"}function Ii(e,n){e=e.style;for(var o in n)if(n.hasOwnProperty(o)){var l=o.indexOf("--")===0,f=zi(o,n[o],l);o==="float"&&(o="cssFloat"),l?e.setProperty(o,f):e[o]=f}}var Il=V({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 co(e,n){if(n){if(Il[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(i(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(i(61))}if(n.style!=null&&typeof n.style!="object")throw Error(i(62))}}function fo(e,n){if(e.indexOf("-")===-1)return typeof n.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 ho=null;function po(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var go=null,xn=null,wn=null;function Ti(e){if(e=Ho(e)){if(typeof go!="function")throw Error(i(280));var n=e.stateNode;n&&(n=ls(n),go(e.stateNode,e.type,n))}}function Ai(e){xn?wn?wn.push(e):wn=[e]:xn=e}function Li(){if(xn){var e=xn,n=wn;if(wn=xn=null,Ti(e),n)for(e=0;e>>=0,e===0?32:31-(Hl(e)/Vl|0)|0}var Er=64,kr=4194304;function bt(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 Nr(e,n){var o=e.pendingLanes;if(o===0)return 0;var l=0,f=e.suspendedLanes,h=e.pingedLanes,E=o&268435455;if(E!==0){var I=E&~f;I!==0?l=bt(I):(h&=E,h!==0&&(l=bt(h)))}else E=o&~f,E!==0?l=bt(E):h!==0&&(l=bt(h));if(l===0)return 0;if(n!==0&&n!==l&&(n&f)===0&&(f=l&-l,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((l&4)!==0&&(l|=o&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=l;0o;o++)n.push(e);return n}function qn(e,n,o){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-yt(n),e[n]=o}function bi(e,n){var o=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0=To),$c=" ",jc=!1;function Oc(e,n){switch(e){case"keyup":return Og.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zr=!1;function Hg(e,n){switch(e){case"compositionend":return Fc(n);case"keypress":return n.which!==32?null:(jc=!0,$c);case"textInput":return e=n.data,e===$c&&jc?null:e;default:return null}}function Vg(e,n){if(zr)return e==="compositionend"||!tu&&Oc(e,n)?(e=Ic(),Gi=Kl=Nn=null,zr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:o,offset:n-e};e=l}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Yc(o)}}function Qc(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Qc(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Kc(){for(var e=window,n=ye();n instanceof e.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)e=n.contentWindow;else break;n=ye(e.document)}return n}function ou(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Gg(e){var n=Kc(),o=e.focusedElem,l=e.selectionRange;if(n!==o&&o&&o.ownerDocument&&Qc(o.ownerDocument.documentElement,o)){if(l!==null&&ou(o)){if(n=l.start,e=l.end,e===void 0&&(e=n),"selectionStart"in o)o.selectionStart=n,o.selectionEnd=Math.min(e,o.value.length);else if(e=(n=o.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=o.textContent.length,h=Math.min(l.start,f);l=l.end===void 0?h:Math.min(l.end,f),!e.extend&&h>l&&(f=l,l=h,h=f),f=Xc(o,h);var E=Xc(o,l);f&&E&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==E.node||e.focusOffset!==E.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>l?(e.addRange(n),e.extend(E.node,E.offset)):(n.setEnd(E.node,E.offset),e.addRange(n)))}}for(n=[],e=o;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Ir=null,iu=null,Do=null,su=!1;function Gc(e,n,o){var l=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;su||Ir==null||Ir!==ye(l)||(l=Ir,"selectionStart"in l&&ou(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Do&&Ro(Do,l)||(Do=l,l=os(iu,"onSelect"),0Dr||(e.current=vu[Dr],vu[Dr]=null,Dr--)}function Ae(e,n){Dr++,vu[Dr]=e.current,e.current=n}var zn={},Je=Pn(zn),ut=Pn(!1),er=zn;function $r(e,n){var o=e.type.contextTypes;if(!o)return zn;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===n)return l.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in o)f[h]=n[h];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function at(e){return e=e.childContextTypes,e!=null}function us(){Re(ut),Re(Je)}function df(e,n,o){if(Je.current!==zn)throw Error(i(168));Ae(Je,n),Ae(ut,o)}function hf(e,n,o){var l=e.stateNode;if(n=n.childContextTypes,typeof l.getChildContext!="function")return o;l=l.getChildContext();for(var f in l)if(!(f in n))throw Error(i(108,ae(e)||"Unknown",f));return V({},o,l)}function as(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||zn,er=Je.current,Ae(Je,e),Ae(ut,ut.current),!0}function pf(e,n,o){var l=e.stateNode;if(!l)throw Error(i(169));o?(e=hf(e,n,er),l.__reactInternalMemoizedMergedChildContext=e,Re(ut),Re(Je),Ae(Je,e)):Re(ut),Ae(ut,o)}var ln=null,cs=!1,xu=!1;function gf(e){ln===null?ln=[e]:ln.push(e)}function um(e){cs=!0,gf(e)}function In(){if(!xu&&ln!==null){xu=!0;var e=0,n=Ie;try{var o=ln;for(Ie=1;e>=E,f-=E,un=1<<32-yt(n)+f|o<Ee?(Ge=xe,xe=null):Ge=xe.sibling;var ze=ne(Q,xe,K[Ee],se);if(ze===null){xe===null&&(xe=Ge);break}e&&xe&&ze.alternate===null&&n(Q,xe),O=h(ze,O,Ee),ve===null?ge=ze:ve.sibling=ze,ve=ze,xe=Ge}if(Ee===K.length)return o(Q,xe),$e&&nr(Q,Ee),ge;if(xe===null){for(;EeEe?(Ge=xe,xe=null):Ge=xe.sibling;var Fn=ne(Q,xe,ze.value,se);if(Fn===null){xe===null&&(xe=Ge);break}e&&xe&&Fn.alternate===null&&n(Q,xe),O=h(Fn,O,Ee),ve===null?ge=Fn:ve.sibling=Fn,ve=Fn,xe=Ge}if(ze.done)return o(Q,xe),$e&&nr(Q,Ee),ge;if(xe===null){for(;!ze.done;Ee++,ze=K.next())ze=ie(Q,ze.value,se),ze!==null&&(O=h(ze,O,Ee),ve===null?ge=ze:ve.sibling=ze,ve=ze);return $e&&nr(Q,Ee),ge}for(xe=l(Q,xe);!ze.done;Ee++,ze=K.next())ze=fe(xe,Q,Ee,ze.value,se),ze!==null&&(e&&ze.alternate!==null&&xe.delete(ze.key===null?Ee:ze.key),O=h(ze,O,Ee),ve===null?ge=ze:ve.sibling=ze,ve=ze);return e&&xe.forEach(function(Bm){return n(Q,Bm)}),$e&&nr(Q,Ee),ge}function Be(Q,O,K,se){if(typeof K=="object"&&K!==null&&K.type===H&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case j:e:{for(var ge=K.key,ve=O;ve!==null;){if(ve.key===ge){if(ge=K.type,ge===H){if(ve.tag===7){o(Q,ve.sibling),O=f(ve,K.props.children),O.return=Q,Q=O;break e}}else if(ve.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===F&&Sf(ge)===ve.type){o(Q,ve.sibling),O=f(ve,K.props),O.ref=Vo(Q,ve,K),O.return=Q,Q=O;break e}o(Q,ve);break}else n(Q,ve);ve=ve.sibling}K.type===H?(O=cr(K.props.children,Q.mode,se,K.key),O.return=Q,Q=O):(se=Os(K.type,K.key,K.props,null,Q.mode,se),se.ref=Vo(Q,O,K),se.return=Q,Q=se)}return E(Q);case D:e:{for(ve=K.key;O!==null;){if(O.key===ve)if(O.tag===4&&O.stateNode.containerInfo===K.containerInfo&&O.stateNode.implementation===K.implementation){o(Q,O.sibling),O=f(O,K.children||[]),O.return=Q,Q=O;break e}else{o(Q,O);break}else n(Q,O);O=O.sibling}O=ma(K,Q.mode,se),O.return=Q,Q=O}return E(Q);case F:return ve=K._init,Be(Q,O,ve(K._payload),se)}if(mt(K))return he(Q,O,K,se);if(L(K))return pe(Q,O,K,se);ps(Q,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,O!==null&&O.tag===6?(o(Q,O.sibling),O=f(O,K),O.return=Q,Q=O):(o(Q,O),O=ga(K,Q.mode,se),O.return=Q,Q=O),E(Q)):o(Q,O)}return Be}var Hr=_f(!0),Ef=_f(!1),gs=Pn(null),ms=null,Vr=null,Nu=null;function Cu(){Nu=Vr=ms=null}function Mu(e){var n=gs.current;Re(gs),e._currentValue=n}function Pu(e,n,o){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===o)break;e=e.return}}function Br(e,n){ms=e,Nu=Vr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(ct=!0),e.firstContext=null)}function Pt(e){var n=e._currentValue;if(Nu!==e)if(e={context:e,memoizedValue:n,next:null},Vr===null){if(ms===null)throw Error(i(308));Vr=e,ms.dependencies={lanes:0,firstContext:e}}else Vr=Vr.next=e;return n}var rr=null;function zu(e){rr===null?rr=[e]:rr.push(e)}function kf(e,n,o,l){var f=n.interleaved;return f===null?(o.next=o,zu(n)):(o.next=f.next,f.next=o),n.interleaved=o,cn(e,l)}function cn(e,n){e.lanes|=n;var o=e.alternate;for(o!==null&&(o.lanes|=n),o=e,e=e.return;e!==null;)e.childLanes|=n,o=e.alternate,o!==null&&(o.childLanes|=n),o=e,e=e.return;return o.tag===3?o.stateNode:null}var Tn=!1;function Iu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function fn(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function An(e,n,o){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Pe&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,cn(e,o)}return f=l.interleaved,f===null?(n.next=n,zu(l)):(n.next=f.next,f.next=n),l.interleaved=n,cn(e,o)}function ys(e,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194240)!==0)){var l=n.lanes;l&=e.pendingLanes,o|=l,n.lanes=o,Ul(e,o)}}function Cf(e,n){var o=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,o===l)){var f=null,h=null;if(o=o.firstBaseUpdate,o!==null){do{var E={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};h===null?f=h=E:h=h.next=E,o=o.next}while(o!==null);h===null?f=h=n:h=h.next=n}else f=h=n;o={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,effects:l.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=n:e.next=n,o.lastBaseUpdate=n}function vs(e,n,o,l){var f=e.updateQueue;Tn=!1;var h=f.firstBaseUpdate,E=f.lastBaseUpdate,I=f.shared.pending;if(I!==null){f.shared.pending=null;var $=I,G=$.next;$.next=null,E===null?h=G:E.next=G,E=$;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,I=oe.lastBaseUpdate,I!==E&&(I===null?oe.firstBaseUpdate=G:I.next=G,oe.lastBaseUpdate=$))}if(h!==null){var ie=f.baseState;E=0,oe=G=$=null,I=h;do{var ne=I.lane,fe=I.eventTime;if((l&ne)===ne){oe!==null&&(oe=oe.next={eventTime:fe,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var he=e,pe=I;switch(ne=n,fe=o,pe.tag){case 1:if(he=pe.payload,typeof he=="function"){ie=he.call(fe,ie,ne);break e}ie=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=pe.payload,ne=typeof he=="function"?he.call(fe,ie,ne):he,ne==null)break e;ie=V({},ie,ne);break e;case 2:Tn=!0}}I.callback!==null&&I.lane!==0&&(e.flags|=64,ne=f.effects,ne===null?f.effects=[I]:ne.push(I))}else fe={eventTime:fe,lane:ne,tag:I.tag,payload:I.payload,callback:I.callback,next:null},oe===null?(G=oe=fe,$=ie):oe=oe.next=fe,E|=ne;if(I=I.next,I===null){if(I=f.shared.pending,I===null)break;ne=I,I=ne.next,ne.next=null,f.lastBaseUpdate=ne,f.shared.pending=null}}while(!0);if(oe===null&&($=ie),f.baseState=$,f.firstBaseUpdate=G,f.lastBaseUpdate=oe,n=f.shared.interleaved,n!==null){f=n;do E|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);sr|=E,e.lanes=E,e.memoizedState=ie}}function Mf(e,n,o){if(e=n.effects,n.effects=null,e!==null)for(n=0;no?o:4,e(!0);var l=Du.transition;Du.transition={};try{e(!1),n()}finally{Ie=o,Du.transition=l}}function Yf(){return zt().memoizedState}function dm(e,n,o){var l=$n(e);if(o={lane:l,action:o,hasEagerState:!1,eagerState:null,next:null},Xf(e))Qf(n,o);else if(o=kf(e,n,o,l),o!==null){var f=ot();Ot(o,e,l,f),Kf(o,n,l)}}function hm(e,n,o){var l=$n(e),f={lane:l,action:o,hasEagerState:!1,eagerState:null,next:null};if(Xf(e))Qf(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var E=n.lastRenderedState,I=h(E,o);if(f.hasEagerState=!0,f.eagerState=I,Lt(I,E)){var $=n.interleaved;$===null?(f.next=f,zu(n)):(f.next=$.next,$.next=f),n.interleaved=f;return}}catch{}finally{}o=kf(e,n,f,l),o!==null&&(f=ot(),Ot(o,e,l,f),Kf(o,n,l))}}function Xf(e){var n=e.alternate;return e===He||n!==null&&n===He}function Qf(e,n){bo=Ss=!0;var o=e.pending;o===null?n.next=n:(n.next=o.next,o.next=n),e.pending=n}function Kf(e,n,o){if((o&4194240)!==0){var l=n.lanes;l&=e.pendingLanes,o|=l,n.lanes=o,Ul(e,o)}}var ks={readContext:Pt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},pm={readContext:Pt,useCallback:function(e,n){return Qt().memoizedState=[e,n===void 0?null:n],e},useContext:Pt,useEffect:Of,useImperativeHandle:function(e,n,o){return o=o!=null?o.concat([e]):null,_s(4194308,4,Vf.bind(null,n,e),o)},useLayoutEffect:function(e,n){return _s(4194308,4,e,n)},useInsertionEffect:function(e,n){return _s(4,2,e,n)},useMemo:function(e,n){var o=Qt();return n=n===void 0?null:n,e=e(),o.memoizedState=[e,n],e},useReducer:function(e,n,o){var l=Qt();return n=o!==void 0?o(n):n,l.memoizedState=l.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},l.queue=e,e=e.dispatch=dm.bind(null,He,e),[l.memoizedState,e]},useRef:function(e){var n=Qt();return e={current:e},n.memoizedState=e},useState:$f,useDebugValue:Bu,useDeferredValue:function(e){return Qt().memoizedState=e},useTransition:function(){var e=$f(!1),n=e[0];return e=fm.bind(null,e[1]),Qt().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,o){var l=He,f=Qt();if($e){if(o===void 0)throw Error(i(407));o=o()}else{if(o=n(),Ke===null)throw Error(i(349));(ir&30)!==0||Tf(l,n,o)}f.memoizedState=o;var h={value:o,getSnapshot:n};return f.queue=h,Of(Lf.bind(null,l,h,e),[e]),l.flags|=2048,Qo(9,Af.bind(null,l,h,o,n),void 0,null),o},useId:function(){var e=Qt(),n=Ke.identifierPrefix;if($e){var o=an,l=un;o=(l&~(1<<32-yt(l)-1)).toString(32)+o,n=":"+n+"R"+o,o=Yo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=E.createElement(o,{is:l.is}):(e=E.createElement(o),o==="select"&&(E=e,l.multiple?E.multiple=!0:l.size&&(E.size=l.size))):e=E.createElementNS(e,o),e[Yt]=n,e[Fo]=l,gd(e,n,!1,!1),n.stateNode=e;e:{switch(E=fo(o,l),o){case"dialog":Le("cancel",e),Le("close",e),f=l;break;case"iframe":case"object":case"embed":Le("load",e),f=l;break;case"video":case"audio":for(f=0;f<$o.length;f++)Le($o[f],e);f=l;break;case"source":Le("error",e),f=l;break;case"img":case"image":case"link":Le("error",e),Le("load",e),f=l;break;case"details":Le("toggle",e),f=l;break;case"input":Te(e,l),f=Ce(e,l),Le("invalid",e);break;case"option":f=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},f=V({},l,{value:void 0}),Le("invalid",e);break;case"textarea":vn(e,l),f=tn(e,l),Le("invalid",e);break;default:f=l}co(o,f),I=f;for(h in I)if(I.hasOwnProperty(h)){var $=I[h];h==="style"?Ii(e,$):h==="dangerouslySetInnerHTML"?($=$?$.__html:void 0,$!=null&&Pi(e,$)):h==="children"?typeof $=="string"?(o!=="textarea"||$!=="")&&on(e,$):typeof $=="number"&&on(e,""+$):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(u.hasOwnProperty(h)?$!=null&&h==="onScroll"&&Le("scroll",e):$!=null&&N(e,h,$,E))}switch(o){case"input":_e(e),At(e,l,!1);break;case"textarea":_e(e),bn(e);break;case"option":l.value!=null&&e.setAttribute("value",""+ee(l.value));break;case"select":e.multiple=!!l.multiple,h=l.value,h!=null?kt(e,!!l.multiple,h,!1):l.defaultValue!=null&&kt(e,!!l.multiple,l.defaultValue,!0);break;default:typeof f.onClick=="function"&&(e.onclick=ss)}switch(o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return tt(n),null;case 6:if(e&&n.stateNode!=null)yd(e,n,e.memoizedProps,l);else{if(typeof l!="string"&&n.stateNode===null)throw Error(i(166));if(o=or(Uo.current),or(Xt.current),hs(n)){if(l=n.stateNode,o=n.memoizedProps,l[Yt]=n,(h=l.nodeValue!==o)&&(e=xt,e!==null))switch(e.tag){case 3:is(l.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&is(l.nodeValue,o,(e.mode&1)!==0)}h&&(n.flags|=4)}else l=(o.nodeType===9?o:o.ownerDocument).createTextNode(l),l[Yt]=n,n.stateNode=l}return tt(n),null;case 13:if(Re(Fe),l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($e&&wt!==null&&(n.mode&1)!==0&&(n.flags&128)===0)wf(),Fr(),n.flags|=98560,h=!1;else if(h=hs(n),l!==null&&l.dehydrated!==null){if(e===null){if(!h)throw Error(i(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Yt]=n}else Fr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;tt(n),h=!1}else Rt!==null&&(ca(Rt),Rt=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=o,n):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(Fe.current&1)!==0?Xe===0&&(Xe=3):ha())),n.updateQueue!==null&&(n.flags|=4),tt(n),null);case 4:return Wr(),Ju(e,n),e===null&&jo(n.stateNode.containerInfo),tt(n),null;case 10:return Mu(n.type._context),tt(n),null;case 17:return at(n.type)&&us(),tt(n),null;case 19:if(Re(Fe),h=n.memoizedState,h===null)return tt(n),null;if(l=(n.flags&128)!==0,E=h.rendering,E===null)if(l)Ko(h,!1);else{if(Xe!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(E=xs(e),E!==null){for(n.flags|=128,Ko(h,!1),l=E.updateQueue,l!==null&&(n.updateQueue=l,n.flags|=4),n.subtreeFlags=0,l=o,o=n.child;o!==null;)h=o,e=l,h.flags&=14680066,E=h.alternate,E===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=E.childLanes,h.lanes=E.lanes,h.child=E.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=E.memoizedProps,h.memoizedState=E.memoizedState,h.updateQueue=E.updateQueue,h.type=E.type,e=E.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return Ae(Fe,Fe.current&1|2),n.child}e=e.sibling}h.tail!==null&&Oe()>Xr&&(n.flags|=128,l=!0,Ko(h,!1),n.lanes=4194304)}else{if(!l)if(e=xs(E),e!==null){if(n.flags|=128,l=!0,o=e.updateQueue,o!==null&&(n.updateQueue=o,n.flags|=4),Ko(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!$e)return tt(n),null}else 2*Oe()-h.renderingStartTime>Xr&&o!==1073741824&&(n.flags|=128,l=!0,Ko(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(o=h.last,o!==null?o.sibling=E:n.child=E,h.last=E)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=Oe(),n.sibling=null,o=Fe.current,Ae(Fe,l?o&1|2:o&1),n):(tt(n),null);case 22:case 23:return da(),l=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(n.flags|=8192),l&&(n.mode&1)!==0?(St&1073741824)!==0&&(tt(n),n.subtreeFlags&6&&(n.flags|=8192)):tt(n),null;case 24:return null;case 25:return null}throw Error(i(156,n.tag))}function _m(e,n){switch(Su(n),n.tag){case 1:return at(n.type)&&us(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Wr(),Re(ut),Re(Je),Ru(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Au(n),null;case 13:if(Re(Fe),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(i(340));Fr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Re(Fe),null;case 4:return Wr(),null;case 10:return Mu(n.type._context),null;case 22:case 23:return da(),null;case 24:return null;default:return null}}var Ps=!1,nt=!1,Em=typeof WeakSet=="function"?WeakSet:Set,de=null;function br(e,n){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(l){Ve(e,n,l)}else o.current=null}function ea(e,n,o){try{o()}catch(l){Ve(e,n,l)}}var vd=!1;function km(e,n){if(du=Qi,e=Kc(),ou(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var E=0,I=-1,$=-1,G=0,oe=0,ie=e,ne=null;t:for(;;){for(var fe;ie!==o||f!==0&&ie.nodeType!==3||(I=E+f),ie!==h||l!==0&&ie.nodeType!==3||($=E+l),ie.nodeType===3&&(E+=ie.nodeValue.length),(fe=ie.firstChild)!==null;)ne=ie,ie=fe;for(;;){if(ie===e)break t;if(ne===o&&++G===f&&(I=E),ne===h&&++oe===l&&($=E),(fe=ie.nextSibling)!==null)break;ie=ne,ne=ie.parentNode}ie=fe}o=I===-1||$===-1?null:{start:I,end:$}}else o=null}o=o||{start:0,end:0}}else o=null;for(hu={focusedElem:e,selectionRange:o},Qi=!1,de=n;de!==null;)if(n=de,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,de=e;else for(;de!==null;){n=de;try{var he=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(he!==null){var pe=he.memoizedProps,Be=he.memoizedState,Q=n.stateNode,O=Q.getSnapshotBeforeUpdate(n.elementType===n.type?pe:Dt(n.type,pe),Be);Q.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var K=n.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(se){Ve(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,de=e;break}de=n.return}return he=vd,vd=!1,he}function Go(e,n,o){var l=n.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var f=l=l.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&ea(n,o,h)}f=f.next}while(f!==l)}}function zs(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var l=o.create;o.destroy=l()}o=o.next}while(o!==n)}}function ta(e){var n=e.ref;if(n!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof n=="function"?n(e):n.current=e}}function xd(e){var n=e.alternate;n!==null&&(e.alternate=null,xd(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[Yt],delete n[Fo],delete n[yu],delete n[sm],delete n[lm])),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 wd(e){return e.tag===5||e.tag===3||e.tag===4}function Sd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wd(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 na(e,n,o){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?o.nodeType===8?o.parentNode.insertBefore(e,n):o.insertBefore(e,n):(o.nodeType===8?(n=o.parentNode,n.insertBefore(e,o)):(n=o,n.appendChild(e)),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=ss));else if(l!==4&&(e=e.child,e!==null))for(na(e,n,o),e=e.sibling;e!==null;)na(e,n,o),e=e.sibling}function ra(e,n,o){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?o.insertBefore(e,n):o.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(ra(e,n,o),e=e.sibling;e!==null;)ra(e,n,o),e=e.sibling}var Ze=null,$t=!1;function Ln(e,n,o){for(o=o.child;o!==null;)_d(e,n,o),o=o.sibling}function _d(e,n,o){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(Zn,o)}catch{}switch(o.tag){case 5:nt||br(o,n);case 6:var l=Ze,f=$t;Ze=null,Ln(e,n,o),Ze=l,$t=f,Ze!==null&&($t?(e=Ze,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):Ze.removeChild(o.stateNode));break;case 18:Ze!==null&&($t?(e=Ze,o=o.stateNode,e.nodeType===8?mu(e.parentNode,o):e.nodeType===1&&mu(e,o),Po(e)):mu(Ze,o.stateNode));break;case 4:l=Ze,f=$t,Ze=o.stateNode.containerInfo,$t=!0,Ln(e,n,o),Ze=l,$t=f;break;case 0:case 11:case 14:case 15:if(!nt&&(l=o.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){f=l=l.next;do{var h=f,E=h.destroy;h=h.tag,E!==void 0&&((h&2)!==0||(h&4)!==0)&&ea(o,n,E),f=f.next}while(f!==l)}Ln(e,n,o);break;case 1:if(!nt&&(br(o,n),l=o.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=o.memoizedProps,l.state=o.memoizedState,l.componentWillUnmount()}catch(I){Ve(o,n,I)}Ln(e,n,o);break;case 21:Ln(e,n,o);break;case 22:o.mode&1?(nt=(l=nt)||o.memoizedState!==null,Ln(e,n,o),nt=l):Ln(e,n,o);break;default:Ln(e,n,o)}}function Ed(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new Em),n.forEach(function(l){var f=Lm.bind(null,e,l);o.has(l)||(o.add(l),l.then(f,f))})}}function jt(e,n){var o=n.deletions;if(o!==null)for(var l=0;lf&&(f=E),l&=~h}if(l=f,l=Oe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Cm(l/1960))-l,10e?16:e,Dn===null)var l=!1;else{if(e=Dn,Dn=null,Rs=0,(Pe&6)!==0)throw Error(i(331));var f=Pe;for(Pe|=4,de=e.current;de!==null;){var h=de,E=h.child;if((de.flags&16)!==0){var I=h.deletions;if(I!==null){for(var $=0;$Oe()-sa?ur(e,0):ia|=o),dt(e,n)}function $d(e,n){n===0&&((e.mode&1)===0?n=1:(n=kr,kr<<=1,(kr&130023424)===0&&(kr=4194304)));var o=ot();e=cn(e,n),e!==null&&(qn(e,n,o),dt(e,o))}function Am(e){var n=e.memoizedState,o=0;n!==null&&(o=n.retryLane),$d(e,o)}function Lm(e,n){var o=0;switch(e.tag){case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(o=f.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(i(314))}l!==null&&l.delete(n),$d(e,o)}var jd;jd=function(e,n,o){if(e!==null)if(e.memoizedProps!==n.pendingProps||ut.current)ct=!0;else{if((e.lanes&o)===0&&(n.flags&128)===0)return ct=!1,wm(e,n,o);ct=(e.flags&131072)!==0}else ct=!1,$e&&(n.flags&1048576)!==0&&mf(n,ds,n.index);switch(n.lanes=0,n.tag){case 2:var l=n.type;Ms(e,n),e=n.pendingProps;var f=$r(n,Je.current);Br(n,o),f=ju(null,n,l,e,f,o);var h=Ou();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,at(l)?(h=!0,as(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Iu(n),f.updater=Ns,n.stateNode=f,f._reactInternals=n,Uu(n,l,e,o),n=Qu(null,n,l,!0,h,o)):(n.tag=0,$e&&h&&wu(n),rt(null,n,f,o),n=n.child),n;case 16:l=n.elementType;e:{switch(Ms(e,n),e=n.pendingProps,f=l._init,l=f(l._payload),n.type=l,f=n.tag=Dm(l),e=Dt(l,e),f){case 0:n=Xu(null,n,l,e,o);break e;case 1:n=ad(null,n,l,e,o);break e;case 11:n=od(null,n,l,e,o);break e;case 14:n=id(null,n,l,Dt(l.type,e),o);break e}throw Error(i(306,l,""))}return n;case 0:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:Dt(l,f),Xu(e,n,l,f,o);case 1:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:Dt(l,f),ad(e,n,l,f,o);case 3:e:{if(cd(n),e===null)throw Error(i(387));l=n.pendingProps,h=n.memoizedState,f=h.element,Nf(e,n),vs(n,l,null,o);var E=n.memoizedState;if(l=E.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=Ur(Error(i(423)),n),n=fd(e,n,l,o,f);break e}else if(l!==f){f=Ur(Error(i(424)),n),n=fd(e,n,l,o,f);break e}else for(wt=Mn(n.stateNode.containerInfo.firstChild),xt=n,$e=!0,Rt=null,o=Ef(n,null,l,o),n.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Fr(),l===f){n=dn(e,n,o);break e}rt(e,n,l,o)}n=n.child}return n;case 5:return Pf(n),e===null&&Eu(n),l=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,E=f.children,pu(l,f)?E=null:h!==null&&pu(l,h)&&(n.flags|=32),ud(e,n),rt(e,n,E,o),n.child;case 6:return e===null&&Eu(n),null;case 13:return dd(e,n,o);case 4:return Tu(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=Hr(n,null,l,o):rt(e,n,l,o),n.child;case 11:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:Dt(l,f),od(e,n,l,f,o);case 7:return rt(e,n,n.pendingProps,o),n.child;case 8:return rt(e,n,n.pendingProps.children,o),n.child;case 12:return rt(e,n,n.pendingProps.children,o),n.child;case 10:e:{if(l=n.type._context,f=n.pendingProps,h=n.memoizedProps,E=f.value,Ae(gs,l._currentValue),l._currentValue=E,h!==null)if(Lt(h.value,E)){if(h.children===f.children&&!ut.current){n=dn(e,n,o);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var I=h.dependencies;if(I!==null){E=h.child;for(var $=I.firstContext;$!==null;){if($.context===l){if(h.tag===1){$=fn(-1,o&-o),$.tag=2;var G=h.updateQueue;if(G!==null){G=G.shared;var oe=G.pending;oe===null?$.next=$:($.next=oe.next,oe.next=$),G.pending=$}}h.lanes|=o,$=h.alternate,$!==null&&($.lanes|=o),Pu(h.return,o,n),I.lanes|=o;break}$=$.next}}else if(h.tag===10)E=h.type===n.type?null:h.child;else if(h.tag===18){if(E=h.return,E===null)throw Error(i(341));E.lanes|=o,I=E.alternate,I!==null&&(I.lanes|=o),Pu(E,o,n),E=h.sibling}else E=h.child;if(E!==null)E.return=h;else for(E=h;E!==null;){if(E===n){E=null;break}if(h=E.sibling,h!==null){h.return=E.return,E=h;break}E=E.return}h=E}rt(e,n,f.children,o),n=n.child}return n;case 9:return f=n.type,l=n.pendingProps.children,Br(n,o),f=Pt(f),l=l(f),n.flags|=1,rt(e,n,l,o),n.child;case 14:return l=n.type,f=Dt(l,n.pendingProps),f=Dt(l.type,f),id(e,n,l,f,o);case 15:return sd(e,n,n.type,n.pendingProps,o);case 17:return l=n.type,f=n.pendingProps,f=n.elementType===l?f:Dt(l,f),Ms(e,n),n.tag=1,at(l)?(e=!0,as(n)):e=!1,Br(n,o),Zf(n,l,f),Uu(n,l,f,o),Qu(null,n,l,!0,e,o);case 19:return pd(e,n,o);case 22:return ld(e,n,o)}throw Error(i(156,n.tag))};function Od(e,n){return Fi(e,n)}function Rm(e,n,o,l){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tt(e,n,o,l){return new Rm(e,n,o,l)}function pa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dm(e){if(typeof e=="function")return pa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===U)return 11;if(e===b)return 14}return 2}function On(e,n){var o=e.alternate;return o===null?(o=Tt(e.tag,n,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=n,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,n=e.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function Os(e,n,o,l,f,h){var E=2;if(l=e,typeof e=="function")pa(e)&&(E=1);else if(typeof e=="string")E=5;else e:switch(e){case H:return cr(o.children,f,h,n);case B:E=8,f|=8;break;case X:return e=Tt(12,o,n,f|2),e.elementType=X,e.lanes=h,e;case Z:return e=Tt(13,o,n,f),e.elementType=Z,e.lanes=h,e;case z:return e=Tt(19,o,n,f),e.elementType=z,e.lanes=h,e;case Y:return Fs(o,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J:E=10;break e;case W:E=9;break e;case U:E=11;break e;case b:E=14;break e;case F:E=16,l=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return n=Tt(E,o,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function cr(e,n,o,l){return e=Tt(7,e,l,n),e.lanes=o,e}function Fs(e,n,o,l){return e=Tt(22,e,l,n),e.elementType=Y,e.lanes=o,e.stateNode={isHidden:!1},e}function ga(e,n,o){return e=Tt(6,e,null,n),e.lanes=o,e}function ma(e,n,o){return n=Tt(4,e.children!==null?e.children:[],e.key,n),n.lanes=o,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function $m(e,n,o,l,f){this.tag=n,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=Eo(0),this.expirationTimes=Eo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Eo(0),this.identifierPrefix=l,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function ya(e,n,o,l,f,h,E,I,$){return e=new $m(e,n,o,I,$),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Tt(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:l,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Iu(h),e}function jm(e,n,o){var l=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Ea.exports=Km(),Ea.exports}var qd;function Gm(){if(qd)return Ys;qd=1;var t=Sp();return Ys.createRoot=t.createRoot,Ys.hydrateRoot=t.hydrateRoot,Ys}var Zm=Gm();function be(t){if(typeof t=="string"||typeof t=="number")return""+t;let r="";if(Array.isArray(t))for(let i=0,s;i{}};function xi(){for(var t=0,r=arguments.length,i={},s;t=0&&(s=i.slice(u+1),i=i.slice(0,u)),i&&!r.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:s}})}il.prototype=xi.prototype={constructor:il,on:function(t,r){var i=this._,s=Jm(t+"",i),u,a=-1,c=s.length;if(arguments.length<2){for(;++a0)for(var i=new Array(u),s=0,u,a;s=0&&(r=t.slice(0,i))!=="xmlns"&&(t=t.slice(i+1)),eh.hasOwnProperty(r)?{space:eh[r],local:t}:t}function ty(t){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===Fa&&r.documentElement.namespaceURI===Fa?r.createElement(t):r.createElementNS(i,t)}}function ny(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function _p(t){var r=wl(t);return(r.local?ny:ty)(r)}function ry(){}function tc(t){return t==null?ry:function(){return this.querySelector(t)}}function oy(t){typeof t!="function"&&(t=tc(t));for(var r=this._groups,i=r.length,s=new Array(i),u=0;u=N&&(N=P+1);!(j=w[N])&&++N=0;)(c=s[u])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function zy(t){t||(t=Iy);function r(m,y){return m&&y?t(m.__data__,y.__data__):!m-!y}for(var i=this._groups,s=i.length,u=new Array(s),a=0;ar?1:t>=r?0:NaN}function Ty(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Ay(){return Array.from(this)}function Ly(){for(var t=this._groups,r=0,i=t.length;r1?this.each((r==null?Uy:typeof r=="function"?Yy:by)(t,r,i??"")):to(this.node(),t)}function to(t,r){return t.style.getPropertyValue(r)||Mp(t).getComputedStyle(t,null).getPropertyValue(r)}function Qy(t){return function(){delete this[t]}}function Ky(t,r){return function(){this[t]=r}}function Gy(t,r){return function(){var i=r.apply(this,arguments);i==null?delete this[t]:this[t]=i}}function Zy(t,r){return arguments.length>1?this.each((r==null?Qy:typeof r=="function"?Gy:Ky)(t,r)):this.node()[t]}function Pp(t){return t.trim().split(/^|\s+/)}function nc(t){return t.classList||new zp(t)}function zp(t){this._node=t,this._names=Pp(t.getAttribute("class")||"")}zp.prototype={add:function(t){var r=this._names.indexOf(t);r<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var r=this._names.indexOf(t);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ip(t,r){for(var i=nc(t),s=-1,u=r.length;++s=0&&(i=r.slice(s+1),r=r.slice(0,s)),{type:r,name:i}})}function Nv(t){return function(){var r=this.__on;if(r){for(var i=0,s=-1,u=r.length,a;i()=>t;function Ha(t,{sourceEvent:r,subject:i,target:s,identifier:u,active:a,x:c,y:d,dx:p,dy:g,dispatch:v}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:u,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:p,enumerable:!0,configurable:!0},dy:{value:g,enumerable:!0,configurable:!0},_:{value:v}})}Ha.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Dv(t){return!t.ctrlKey&&!t.button}function $v(){return this.parentNode}function jv(t,r){return r??{x:t.x,y:t.y}}function Ov(){return navigator.maxTouchPoints||"ontouchstart"in this}function $p(){var t=Dv,r=$v,i=jv,s=Ov,u={},a=xi("start","drag","end"),c=0,d,p,g,v,m=0;function y(C){C.on("mousedown.drag",x).filter(s).on("touchstart.drag",w).on("touchmove.drag",k,Rv).on("touchend.drag touchcancel.drag",P).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(C,j){if(!(v||!t.call(this,C,j))){var D=N(this,r.call(this,C,j),C,j,"mouse");D&&(_t(C.view).on("mousemove.drag",S,ai).on("mouseup.drag",_,ai),Rp(C.view),Ca(C),g=!1,d=C.clientX,p=C.clientY,D("start",C))}}function S(C){if(Jr(C),!g){var j=C.clientX-d,D=C.clientY-p;g=j*j+D*D>m}u.mouse("drag",C)}function _(C){_t(C.view).on("mousemove.drag mouseup.drag",null),Dp(C.view,g),Jr(C),u.mouse("end",C)}function w(C,j){if(t.call(this,C,j)){var D=C.changedTouches,H=r.call(this,C,j),B=D.length,X,J;for(X=0;X>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):i===8?Qs(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):i===4?Qs(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=Hv.exec(t))?new pt(r[1],r[2],r[3],1):(r=Vv.exec(t))?new pt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=Bv.exec(t))?Qs(r[1],r[2],r[3],r[4]):(r=Wv.exec(t))?Qs(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=Uv.exec(t))?lh(r[1],r[2]/100,r[3]/100,1):(r=bv.exec(t))?lh(r[1],r[2]/100,r[3]/100,r[4]):th.hasOwnProperty(t)?oh(th[t]):t==="transparent"?new pt(NaN,NaN,NaN,0):null}function oh(t){return new pt(t>>16&255,t>>8&255,t&255,1)}function Qs(t,r,i,s){return s<=0&&(t=r=i=NaN),new pt(t,r,i,s)}function Qv(t){return t instanceof Si||(t=gr(t)),t?(t=t.rgb(),new pt(t.r,t.g,t.b,t.opacity)):new pt}function Va(t,r,i,s){return arguments.length===1?Qv(t):new pt(t,r,i,s??1)}function pt(t,r,i,s){this.r=+t,this.g=+r,this.b=+i,this.opacity=+s}rc(pt,Va,jp(Si,{brighter(t){return t=t==null?fl:Math.pow(fl,t),new pt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new pt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pt(hr(this.r),hr(this.g),hr(this.b),dl(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:ih,formatHex:ih,formatHex8:Kv,formatRgb:sh,toString:sh}));function ih(){return`#${dr(this.r)}${dr(this.g)}${dr(this.b)}`}function Kv(){return`#${dr(this.r)}${dr(this.g)}${dr(this.b)}${dr((isNaN(this.opacity)?1:this.opacity)*255)}`}function sh(){const t=dl(this.opacity);return`${t===1?"rgb(":"rgba("}${hr(this.r)}, ${hr(this.g)}, ${hr(this.b)}${t===1?")":`, ${t})`}`}function dl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function hr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function dr(t){return t=hr(t),(t<16?"0":"")+t.toString(16)}function lh(t,r,i,s){return s<=0?t=r=i=NaN:i<=0||i>=1?t=r=NaN:r<=0&&(t=NaN),new Ht(t,r,i,s)}function Op(t){if(t instanceof Ht)return new Ht(t.h,t.s,t.l,t.opacity);if(t instanceof Si||(t=gr(t)),!t)return new Ht;if(t instanceof Ht)return t;t=t.rgb();var r=t.r/255,i=t.g/255,s=t.b/255,u=Math.min(r,i,s),a=Math.max(r,i,s),c=NaN,d=a-u,p=(a+u)/2;return d?(r===a?c=(i-s)/d+(i0&&p<1?0:c,new Ht(c,d,p,t.opacity)}function Gv(t,r,i,s){return arguments.length===1?Op(t):new Ht(t,r,i,s??1)}function Ht(t,r,i,s){this.h=+t,this.s=+r,this.l=+i,this.opacity=+s}rc(Ht,Gv,jp(Si,{brighter(t){return t=t==null?fl:Math.pow(fl,t),new Ht(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new Ht(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,r=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,s=i+(i<.5?i:1-i)*r,u=2*i-s;return new pt(Ma(t>=240?t-240:t+120,u,s),Ma(t,u,s),Ma(t<120?t+240:t-120,u,s),this.opacity)},clamp(){return new Ht(uh(this.h),Ks(this.s),Ks(this.l),dl(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 t=dl(this.opacity);return`${t===1?"hsl(":"hsla("}${uh(this.h)}, ${Ks(this.s)*100}%, ${Ks(this.l)*100}%${t===1?")":`, ${t})`}`}}));function uh(t){return t=(t||0)%360,t<0?t+360:t}function Ks(t){return Math.max(0,Math.min(1,t||0))}function Ma(t,r,i){return(t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r)*255}const oc=t=>()=>t;function Zv(t,r){return function(i){return t+i*r}}function qv(t,r,i){return t=Math.pow(t,i),r=Math.pow(r,i)-t,i=1/i,function(s){return Math.pow(t+s*r,i)}}function Jv(t){return(t=+t)==1?Fp:function(r,i){return i-r?qv(r,i,t):oc(isNaN(r)?i:r)}}function Fp(t,r){var i=r-t;return i?Zv(t,i):oc(isNaN(t)?r:t)}const hl=(function t(r){var i=Jv(r);function s(u,a){var c=i((u=Va(u)).r,(a=Va(a)).r),d=i(u.g,a.g),p=i(u.b,a.b),g=Fp(u.opacity,a.opacity);return function(v){return u.r=c(v),u.g=d(v),u.b=p(v),u.opacity=g(v),u+""}}return s.gamma=t,s})(1);function e1(t,r){r||(r=[]);var i=t?Math.min(r.length,t.length):0,s=r.slice(),u;return function(a){for(u=0;ui&&(a=r.slice(i,a),d[c]?d[c]+=a:d[++c]=a),(s=s[0])===(u=u[0])?d[c]?d[c]+=u:d[++c]=u:(d[++c]=null,p.push({i:c,x:Gt(s,u)})),i=Pa.lastIndex;return i180?v+=360:v-g>180&&(g+=360),y.push({i:m.push(u(m)+"rotate(",null,s)-2,x:Gt(g,v)})):v&&m.push(u(m)+"rotate("+v+s)}function d(g,v,m,y){g!==v?y.push({i:m.push(u(m)+"skewX(",null,s)-2,x:Gt(g,v)}):v&&m.push(u(m)+"skewX("+v+s)}function p(g,v,m,y,x,S){if(g!==m||v!==y){var _=x.push(u(x)+"scale(",null,",",null,")");S.push({i:_-4,x:Gt(g,m)},{i:_-2,x:Gt(v,y)})}else(m!==1||y!==1)&&x.push(u(x)+"scale("+m+","+y+")")}return function(g,v){var m=[],y=[];return g=t(g),v=t(v),a(g.translateX,g.translateY,v.translateX,v.translateY,m,y),c(g.rotate,v.rotate,m,y),d(g.skewX,v.skewX,m,y),p(g.scaleX,g.scaleY,v.scaleX,v.scaleY,m,y),g=v=null,function(x){for(var S=-1,_=y.length,w;++S<_;)m[(w=y[S]).i]=w.x(x);return m.join("")}}}var a1=Bp(l1,"px, ","px)","deg)"),c1=Bp(u1,", ",")",")"),f1=1e-12;function ch(t){return((t=Math.exp(t))+1/t)/2}function d1(t){return((t=Math.exp(t))-1/t)/2}function h1(t){return((t=Math.exp(2*t))-1)/(t+1)}const sl=(function t(r,i,s){function u(a,c){var d=a[0],p=a[1],g=a[2],v=c[0],m=c[1],y=c[2],x=v-d,S=m-p,_=x*x+S*S,w,k;if(_=0&&t._call.call(void 0,r),t=t._next;--no}function fh(){mr=(gl=di.now())+Sl,no=ii=0;try{g1()}finally{no=0,y1(),mr=0}}function m1(){var t=di.now(),r=t-gl;r>Wp&&(Sl-=r,gl=t)}function y1(){for(var t,r=pl,i,s=1/0;r;)r._call?(s>r._time&&(s=r._time),t=r,r=r._next):(i=r._next,r._next=null,r=t?t._next=i:pl=i);si=t,Ua(s)}function Ua(t){if(!no){ii&&(ii=clearTimeout(ii));var r=t-mr;r>24?(t<1/0&&(ii=setTimeout(fh,t-di.now()-Sl)),ni&&(ni=clearInterval(ni))):(ni||(gl=di.now(),ni=setInterval(m1,Wp)),no=1,Up(fh))}}function dh(t,r,i){var s=new ml;return r=r==null?0:+r,s.restart(u=>{s.stop(),t(u+r)},r,i),s}var v1=xi("start","end","cancel","interrupt"),x1=[],bp=0,hh=1,ba=2,ll=3,ph=4,Ya=5,ul=6;function _l(t,r,i,s,u,a){var c=t.__transition;if(!c)t.__transition={};else if(i in c)return;w1(t,i,{name:r,index:s,group:u,on:v1,tween:x1,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:bp})}function lc(t,r){var i=Wt(t,r);if(i.state>bp)throw new Error("too late; already scheduled");return i}function en(t,r){var i=Wt(t,r);if(i.state>ll)throw new Error("too late; already running");return i}function Wt(t,r){var i=t.__transition;if(!i||!(i=i[r]))throw new Error("transition not found");return i}function w1(t,r,i){var s=t.__transition,u;s[r]=i,i.timer=sc(a,0,i.time);function a(g){i.state=hh,i.timer.restart(c,i.delay,i.time),i.delay<=g&&c(g-i.delay)}function c(g){var v,m,y,x;if(i.state!==hh)return p();for(v in s)if(x=s[v],x.name===i.name){if(x.state===ll)return dh(c);x.state===ph?(x.state=ul,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete s[v]):+vba&&s.state=0&&(r=r.slice(0,i)),!r||r==="start"})}function G1(t,r,i){var s,u,a=K1(r)?lc:en;return function(){var c=a(this,t),d=c.on;d!==s&&(u=(s=d).copy()).on(r,i),c.on=u}}function Z1(t,r){var i=this._id;return arguments.length<2?Wt(this.node(),i).on.on(t):this.each(G1(i,t,r))}function q1(t){return function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==t)return;r&&r.removeChild(this)}}function J1(){return this.on("end.remove",q1(this._id))}function ex(t){var r=this._name,i=this._id;typeof t!="function"&&(t=tc(t));for(var s=this._groups,u=s.length,a=new Array(u),c=0;c()=>t;function Nx(t,{sourceEvent:r,target:i,transform:s,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:u}})}function gn(t,r,i){this.k=t,this.x=r,this.y=i}gn.prototype={constructor:gn,scale:function(t){return t===1?this:new gn(this.k*t,this.x,this.y)},translate:function(t,r){return t===0&r===0?this:new gn(this.k,this.x+this.k*t,this.y+this.k*r)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var El=new gn(1,0,0);Kp.prototype=gn.prototype;function Kp(t){for(;!t.__zoom;)if(!(t=t.parentNode))return El;return t.__zoom}function za(t){t.stopImmediatePropagation()}function ri(t){t.preventDefault(),t.stopImmediatePropagation()}function Cx(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Mx(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function gh(){return this.__zoom||El}function Px(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function zx(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ix(t,r,i){var s=t.invertX(r[0][0])-i[0][0],u=t.invertX(r[1][0])-i[1][0],a=t.invertY(r[0][1])-i[0][1],c=t.invertY(r[1][1])-i[1][1];return t.translate(u>s?(s+u)/2:Math.min(0,s)||Math.max(0,u),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function Gp(){var t=Cx,r=Mx,i=Ix,s=Px,u=zx,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,p=sl,g=xi("start","zoom","end"),v,m,y,x=500,S=150,_=0,w=10;function k(z){z.property("__zoom",gh).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",J).filter(u).on("touchstart.zoom",W).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",Z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,b,F,Y){var T=z.selection?z.selection():z;T.property("__zoom",gh),z!==T?j(z,b,F,Y):T.interrupt().each(function(){D(this,arguments).event(Y).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},k.scaleBy=function(z,b,F,Y){k.scaleTo(z,function(){var T=this.__zoom.k,L=typeof b=="function"?b.apply(this,arguments):b;return T*L},F,Y)},k.scaleTo=function(z,b,F,Y){k.transform(z,function(){var T=r.apply(this,arguments),L=this.__zoom,V=F==null?C(T):typeof F=="function"?F.apply(this,arguments):F,M=L.invert(V),R=typeof b=="function"?b.apply(this,arguments):b;return i(N(P(L,R),V,M),T,c)},F,Y)},k.translateBy=function(z,b,F,Y){k.transform(z,function(){return i(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof F=="function"?F.apply(this,arguments):F),r.apply(this,arguments),c)},null,Y)},k.translateTo=function(z,b,F,Y,T){k.transform(z,function(){var L=r.apply(this,arguments),V=this.__zoom,M=Y==null?C(L):typeof Y=="function"?Y.apply(this,arguments):Y;return i(El.translate(M[0],M[1]).scale(V.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof F=="function"?-F.apply(this,arguments):-F),L,c)},Y,T)};function P(z,b){return b=Math.max(a[0],Math.min(a[1],b)),b===z.k?z:new gn(b,z.x,z.y)}function N(z,b,F){var Y=b[0]-F[0]*z.k,T=b[1]-F[1]*z.k;return Y===z.x&&T===z.y?z:new gn(z.k,Y,T)}function C(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function j(z,b,F,Y){z.on("start.zoom",function(){D(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(Y).end()}).tween("zoom",function(){var T=this,L=arguments,V=D(T,L).event(Y),M=r.apply(T,L),R=F==null?C(M):typeof F=="function"?F.apply(T,L):F,te=Math.max(M[1][0]-M[0][0],M[1][1]-M[0][1]),re=T.__zoom,le=typeof b=="function"?b.apply(T,L):b,ue=p(re.invert(R).concat(te/re.k),le.invert(R).concat(te/le.k));return function(ae){if(ae===1)ae=le;else{var ee=ue(ae),ce=te/ee[2];ae=new gn(ce,R[0]-ee[0]*ce,R[1]-ee[1]*ce)}V.zoom(null,ae)}})}function D(z,b,F){return!F&&z.__zooming||new H(z,b)}function H(z,b){this.that=z,this.args=b,this.active=0,this.sourceEvent=null,this.extent=r.apply(z,b),this.taps=0}H.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,b){return this.mouse&&z!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var b=_t(this.that).datum();g.call(z,this.that,new Nx(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:g}),b)}};function B(z,...b){if(!t.apply(this,arguments))return;var F=D(this,b).event(z),Y=this.__zoom,T=Math.max(a[0],Math.min(a[1],Y.k*Math.pow(2,s.apply(this,arguments)))),L=Ft(z);if(F.wheel)(F.mouse[0][0]!==L[0]||F.mouse[0][1]!==L[1])&&(F.mouse[1]=Y.invert(F.mouse[0]=L)),clearTimeout(F.wheel);else{if(Y.k===T)return;F.mouse=[L,Y.invert(L)],al(this),F.start()}ri(z),F.wheel=setTimeout(V,S),F.zoom("mouse",i(N(P(Y,T),F.mouse[0],F.mouse[1]),F.extent,c));function V(){F.wheel=null,F.end()}}function X(z,...b){if(y||!t.apply(this,arguments))return;var F=z.currentTarget,Y=D(this,b,!0).event(z),T=_t(z.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",te,!0),L=Ft(z,F),V=z.clientX,M=z.clientY;Rp(z.view),za(z),Y.mouse=[L,this.__zoom.invert(L)],al(this),Y.start();function R(re){if(ri(re),!Y.moved){var le=re.clientX-V,ue=re.clientY-M;Y.moved=le*le+ue*ue>_}Y.event(re).zoom("mouse",i(N(Y.that.__zoom,Y.mouse[0]=Ft(re,F),Y.mouse[1]),Y.extent,c))}function te(re){T.on("mousemove.zoom mouseup.zoom",null),Dp(re.view,Y.moved),ri(re),Y.event(re).end()}}function J(z,...b){if(t.apply(this,arguments)){var F=this.__zoom,Y=Ft(z.changedTouches?z.changedTouches[0]:z,this),T=F.invert(Y),L=F.k*(z.shiftKey?.5:2),V=i(N(P(F,L),Y,T),r.apply(this,b),c);ri(z),d>0?_t(this).transition().duration(d).call(j,V,Y,z):_t(this).call(k.transform,V,Y,z)}}function W(z,...b){if(t.apply(this,arguments)){var F=z.touches,Y=F.length,T=D(this,b,z.changedTouches.length===Y).event(z),L,V,M,R;for(za(z),V=0;V"[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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:r,sourceHandle:i,targetHandle:s})=>`Couldn't create edge for ${t} handle id: "${t==="source"?i:s}", edge id: ${r}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},hi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Zp=["Enter"," ","Escape"],qp={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:r,y:i})=>`Moved selected node ${t}. New position, x: ${r}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ro;(function(t){t.Strict="strict",t.Loose="loose"})(ro||(ro={}));var pr;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(pr||(pr={}));var pi;(function(t){t.Partial="partial",t.Full="full"})(pi||(pi={}));const Jp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Bn;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Bn||(Bn={}));var oo;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(oo||(oo={}));var me;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(me||(me={}));const mh={[me.Left]:me.Right,[me.Right]:me.Left,[me.Top]:me.Bottom,[me.Bottom]:me.Top};function e0(t){return t===null?null:t?"valid":"invalid"}const t0=t=>"id"in t&&"source"in t&&"target"in t,Tx=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),ac=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),_i=(t,r=[0,0])=>{const{width:i,height:s}=yn(t),u=t.origin??r,a=i*u[0],c=s*u[1];return{x:t.position.x-a,y:t.position.y-c}},Ax=(t,r={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const i=t.reduce((s,u)=>{const a=typeof u=="string";let c=!r.nodeLookup&&!a?u:void 0;r.nodeLookup&&(c=a?r.nodeLookup.get(u):ac(u)?u:r.nodeLookup.get(u.id));const d=c?yl(c,r.nodeOrigin):{x:0,y:0,x2:0,y2:0};return kl(s,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Nl(i)},Ei=(t,r={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return t.forEach(u=>{(r.filter===void 0||r.filter(u))&&(i=kl(i,yl(u)),s=!0)}),s?Nl(i):{x:0,y:0,width:0,height:0}},cc=(t,r,[i,s,u]=[0,0,1],a=!1,c=!1)=>{const d={...Ni(r,[i,s,u]),width:r.width/u,height:r.height/u},p=[];for(const g of t.values()){const{measured:v,selectable:m=!0,hidden:y=!1}=g;if(c&&!m||y)continue;const x=v.width??g.width??g.initialWidth??null,S=v.height??g.height??g.initialHeight??null,_=gi(d,so(g)),w=(x??0)*(S??0),k=a&&_>0;(!g.internals.handleBounds||k||_>=w||g.dragging)&&p.push(g)}return p},Lx=(t,r)=>{const i=new Set;return t.forEach(s=>{i.add(s.id)}),r.filter(s=>i.has(s.source)||i.has(s.target))};function Rx(t,r){const i=new Map,s=r!=null&&r.nodes?new Set(r.nodes.map(u=>u.id)):null;return t.forEach(u=>{u.measured.width&&u.measured.height&&((r==null?void 0:r.includeHiddenNodes)||!u.hidden)&&(!s||s.has(u.id))&&i.set(u.id,u)}),i}async function Dx({nodes:t,width:r,height:i,panZoom:s,minZoom:u,maxZoom:a},c){if(t.size===0)return Promise.resolve(!0);const d=Rx(t,c),p=Ei(d),g=fc(p,r,i,(c==null?void 0:c.minZoom)??u,(c==null?void 0:c.maxZoom)??a,(c==null?void 0:c.padding)??.1);return await s.setViewport(g,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),Promise.resolve(!0)}function n0({nodeId:t,nextPosition:r,nodeLookup:i,nodeOrigin:s=[0,0],nodeExtent:u,onError:a}){const c=i.get(t),d=c.parentId?i.get(c.parentId):void 0,{x:p,y:g}=d?d.internals.positionAbsolute:{x:0,y:0},v=c.origin??s;let m=c.extent||u;if(c.extent==="parent"&&!c.expandParent)if(!d)a==null||a("005",Jt.error005());else{const x=d.measured.width,S=d.measured.height;x&&S&&(m=[[p,g],[p+x,g+S]])}else d&&lo(c.extent)&&(m=[[c.extent[0][0]+p,c.extent[0][1]+g],[c.extent[1][0]+p,c.extent[1][1]+g]]);const y=lo(m)?yr(r,m,c.measured):r;return(c.measured.width===void 0||c.measured.height===void 0)&&(a==null||a("015",Jt.error015())),{position:{x:y.x-p+(c.measured.width??0)*v[0],y:y.y-g+(c.measured.height??0)*v[1]},positionAbsolute:y}}async function $x({nodesToRemove:t=[],edgesToRemove:r=[],nodes:i,edges:s,onBeforeDelete:u}){const a=new Set(t.map(y=>y.id)),c=[];for(const y of i){if(y.deletable===!1)continue;const x=a.has(y.id),S=!x&&y.parentId&&c.find(_=>_.id===y.parentId);(x||S)&&c.push(y)}const d=new Set(r.map(y=>y.id)),p=s.filter(y=>y.deletable!==!1),v=Lx(c,p);for(const y of p)d.has(y.id)&&!v.find(S=>S.id===y.id)&&v.push(y);if(!u)return{edges:v,nodes:c};const m=await u({nodes:c,edges:v});return typeof m=="boolean"?m?{edges:v,nodes:c}:{edges:[],nodes:[]}:m}const io=(t,r=0,i=1)=>Math.min(Math.max(t,r),i),yr=(t={x:0,y:0},r,i)=>({x:io(t.x,r[0][0],r[1][0]-((i==null?void 0:i.width)??0)),y:io(t.y,r[0][1],r[1][1]-((i==null?void 0:i.height)??0))});function r0(t,r,i){const{width:s,height:u}=yn(i),{x:a,y:c}=i.internals.positionAbsolute;return yr(t,[[a,c],[a+s,c+u]],r)}const yh=(t,r,i)=>ti?-io(Math.abs(t-i),1,r)/r:0,o0=(t,r,i=15,s=40)=>{const u=yh(t.x,s,r.width-s)*i,a=yh(t.y,s,r.height-s)*i;return[u,a]},kl=(t,r)=>({x:Math.min(t.x,r.x),y:Math.min(t.y,r.y),x2:Math.max(t.x2,r.x2),y2:Math.max(t.y2,r.y2)}),Xa=({x:t,y:r,width:i,height:s})=>({x:t,y:r,x2:t+i,y2:r+s}),Nl=({x:t,y:r,x2:i,y2:s})=>({x:t,y:r,width:i-t,height:s-r}),so=(t,r=[0,0])=>{var u,a;const{x:i,y:s}=ac(t)?t.internals.positionAbsolute:_i(t,r);return{x:i,y:s,width:((u=t.measured)==null?void 0:u.width)??t.width??t.initialWidth??0,height:((a=t.measured)==null?void 0:a.height)??t.height??t.initialHeight??0}},yl=(t,r=[0,0])=>{var u,a;const{x:i,y:s}=ac(t)?t.internals.positionAbsolute:_i(t,r);return{x:i,y:s,x2:i+(((u=t.measured)==null?void 0:u.width)??t.width??t.initialWidth??0),y2:s+(((a=t.measured)==null?void 0:a.height)??t.height??t.initialHeight??0)}},i0=(t,r)=>Nl(kl(Xa(t),Xa(r))),gi=(t,r)=>{const i=Math.max(0,Math.min(t.x+t.width,r.x+r.width)-Math.max(t.x,r.x)),s=Math.max(0,Math.min(t.y+t.height,r.y+r.height)-Math.max(t.y,r.y));return Math.ceil(i*s)},vh=t=>Vt(t.width)&&Vt(t.height)&&Vt(t.x)&&Vt(t.y),Vt=t=>!isNaN(t)&&isFinite(t),jx=(t,r)=>{},ki=(t,r=[1,1])=>({x:r[0]*Math.round(t.x/r[0]),y:r[1]*Math.round(t.y/r[1])}),Ni=({x:t,y:r},[i,s,u],a=!1,c=[1,1])=>{const d={x:(t-i)/u,y:(r-s)/u};return a?ki(d,c):d},vl=({x:t,y:r},[i,s,u])=>({x:t*u+i,y:r*u+s});function Kr(t,r){if(typeof t=="number")return Math.floor((r-r/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(i)}if(typeof t=="string"&&t.endsWith("%")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(r*i*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ox(t,r,i){if(typeof t=="string"||typeof t=="number"){const s=Kr(t,i),u=Kr(t,r);return{top:s,right:u,bottom:s,left:u,x:u*2,y:s*2}}if(typeof t=="object"){const s=Kr(t.top??t.y??0,i),u=Kr(t.bottom??t.y??0,i),a=Kr(t.left??t.x??0,r),c=Kr(t.right??t.x??0,r);return{top:s,right:c,bottom:u,left:a,x:a+c,y:s+u}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Fx(t,r,i,s,u,a){const{x:c,y:d}=vl(t,[r,i,s]),{x:p,y:g}=vl({x:t.x+t.width,y:t.y+t.height},[r,i,s]),v=u-p,m=a-g;return{left:Math.floor(c),top:Math.floor(d),right:Math.floor(v),bottom:Math.floor(m)}}const fc=(t,r,i,s,u,a)=>{const c=Ox(a,r,i),d=(r-c.x)/t.width,p=(i-c.y)/t.height,g=Math.min(d,p),v=io(g,s,u),m=t.x+t.width/2,y=t.y+t.height/2,x=r/2-m*v,S=i/2-y*v,_=Fx(t,x,S,v,r,i),w={left:Math.min(_.left-c.left,0),top:Math.min(_.top-c.top,0),right:Math.min(_.right-c.right,0),bottom:Math.min(_.bottom-c.bottom,0)};return{x:x-w.left+w.right,y:S-w.top+w.bottom,zoom:v}},mi=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function lo(t){return t!=null&&t!=="parent"}function yn(t){var r,i;return{width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}}function s0(t){var r,i;return(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth)!==void 0&&(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight)!==void 0}function l0(t,r={width:0,height:0},i,s,u){const a={...t},c=s.get(i);if(c){const d=c.origin||u;a.x+=c.internals.positionAbsolute.x-(r.width??0)*d[0],a.y+=c.internals.positionAbsolute.y-(r.height??0)*d[1]}return a}function xh(t,r){if(t.size!==r.size)return!1;for(const i of t)if(!r.has(i))return!1;return!0}function Hx(){let t,r;return{promise:new Promise((s,u)=>{t=s,r=u}),resolve:t,reject:r}}function Vx(t){return{...qp,...t||{}}}function ui(t,{snapGrid:r=[0,0],snapToGrid:i=!1,transform:s,containerBounds:u}){const{x:a,y:c}=Bt(t),d=Ni({x:a-((u==null?void 0:u.left)??0),y:c-((u==null?void 0:u.top)??0)},s),{x:p,y:g}=i?ki(d,r):d;return{xSnapped:p,ySnapped:g,...d}}const dc=t=>({width:t.offsetWidth,height:t.offsetHeight}),u0=t=>{var r;return((r=t==null?void 0:t.getRootNode)==null?void 0:r.call(t))||(window==null?void 0:window.document)},Bx=["INPUT","SELECT","TEXTAREA"];function a0(t){var s,u;const r=((u=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:u[0])||t.target;return(r==null?void 0:r.nodeType)!==1?!1:Bx.includes(r.nodeName)||r.hasAttribute("contenteditable")||!!r.closest(".nokey")}const c0=t=>"clientX"in t,Bt=(t,r)=>{var a,c;const i=c0(t),s=i?t.clientX:(a=t.touches)==null?void 0:a[0].clientX,u=i?t.clientY:(c=t.touches)==null?void 0:c[0].clientY;return{x:s-((r==null?void 0:r.left)??0),y:u-((r==null?void 0:r.top)??0)}},wh=(t,r,i,s,u)=>{const a=r.querySelectorAll(`.${t}`);return!a||!a.length?null:Array.from(a).map(c=>{const d=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:t,nodeId:u,position:c.getAttribute("data-handlepos"),x:(d.left-i.left)/s,y:(d.top-i.top)/s,...dc(c)}})};function f0({sourceX:t,sourceY:r,targetX:i,targetY:s,sourceControlX:u,sourceControlY:a,targetControlX:c,targetControlY:d}){const p=t*.125+u*.375+c*.375+i*.125,g=r*.125+a*.375+d*.375+s*.125,v=Math.abs(p-t),m=Math.abs(g-r);return[p,g,v,m]}function qs(t,r){return t>=0?.5*t:r*25*Math.sqrt(-t)}function Sh({pos:t,x1:r,y1:i,x2:s,y2:u,c:a}){switch(t){case me.Left:return[r-qs(r-s,a),i];case me.Right:return[r+qs(s-r,a),i];case me.Top:return[r,i-qs(i-u,a)];case me.Bottom:return[r,i+qs(u-i,a)]}}function d0({sourceX:t,sourceY:r,sourcePosition:i=me.Bottom,targetX:s,targetY:u,targetPosition:a=me.Top,curvature:c=.25}){const[d,p]=Sh({pos:i,x1:t,y1:r,x2:s,y2:u,c}),[g,v]=Sh({pos:a,x1:s,y1:u,x2:t,y2:r,c}),[m,y,x,S]=f0({sourceX:t,sourceY:r,targetX:s,targetY:u,sourceControlX:d,sourceControlY:p,targetControlX:g,targetControlY:v});return[`M${t},${r} C${d},${p} ${g},${v} ${s},${u}`,m,y,x,S]}function h0({sourceX:t,sourceY:r,targetX:i,targetY:s}){const u=Math.abs(i-t)/2,a=i0}const bx=({source:t,sourceHandle:r,target:i,targetHandle:s})=>`xy-edge__${t}${r||""}-${i}${s||""}`,Yx=(t,r)=>r.some(i=>i.source===t.source&&i.target===t.target&&(i.sourceHandle===t.sourceHandle||!i.sourceHandle&&!t.sourceHandle)&&(i.targetHandle===t.targetHandle||!i.targetHandle&&!t.targetHandle)),Xx=(t,r,i={})=>{if(!t.source||!t.target)return r;const s=i.getEdgeId||bx;let u;return t0(t)?u={...t}:u={...t,id:s(t)},Yx(u,r)?r:(u.sourceHandle===null&&delete u.sourceHandle,u.targetHandle===null&&delete u.targetHandle,r.concat(u))};function p0({sourceX:t,sourceY:r,targetX:i,targetY:s}){const[u,a,c,d]=h0({sourceX:t,sourceY:r,targetX:i,targetY:s});return[`M ${t},${r}L ${i},${s}`,u,a,c,d]}const _h={[me.Left]:{x:-1,y:0},[me.Right]:{x:1,y:0},[me.Top]:{x:0,y:-1},[me.Bottom]:{x:0,y:1}},Qx=({source:t,sourcePosition:r=me.Bottom,target:i})=>r===me.Left||r===me.Right?t.xMath.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2));function Kx({source:t,sourcePosition:r=me.Bottom,target:i,targetPosition:s=me.Top,center:u,offset:a,stepPosition:c}){const d=_h[r],p=_h[s],g={x:t.x+d.x*a,y:t.y+d.y*a},v={x:i.x+p.x*a,y:i.y+p.y*a},m=Qx({source:g,sourcePosition:r,target:v}),y=m.x!==0?"x":"y",x=m[y];let S=[],_,w;const k={x:0,y:0},P={x:0,y:0},[,,N,C]=h0({sourceX:t.x,sourceY:t.y,targetX:i.x,targetY:i.y});if(d[y]*p[y]===-1){y==="x"?(_=u.x??g.x+(v.x-g.x)*c,w=u.y??(g.y+v.y)/2):(_=u.x??(g.x+v.x)/2,w=u.y??g.y+(v.y-g.y)*c);const B=[{x:_,y:g.y},{x:_,y:v.y}],X=[{x:g.x,y:w},{x:v.x,y:w}];d[y]===x?S=y==="x"?B:X:S=y==="x"?X:B}else{const B=[{x:g.x,y:v.y}],X=[{x:v.x,y:g.y}];if(y==="x"?S=d.x===x?X:B:S=d.y===x?B:X,r===s){const z=Math.abs(t[y]-i[y]);if(z<=a){const b=Math.min(a-1,a-z);d[y]===x?k[y]=(g[y]>t[y]?-1:1)*b:P[y]=(v[y]>i[y]?-1:1)*b}}if(r!==s){const z=y==="x"?"y":"x",b=d[y]===p[z],F=g[z]>v[z],Y=g[z]=Z?(_=(J.x+W.x)/2,w=S[0].y):(_=S[0].x,w=(J.y+W.y)/2)}const j={x:g.x+k.x,y:g.y+k.y},D={x:v.x+P.x,y:v.y+P.y};return[[t,...j.x!==S[0].x||j.y!==S[0].y?[j]:[],...S,...D.x!==S[S.length-1].x||D.y!==S[S.length-1].y?[D]:[],i],_,w,N,C]}function Gx(t,r,i,s){const u=Math.min(Eh(t,r)/2,Eh(r,i)/2,s),{x:a,y:c}=r;if(t.x===a&&a===i.x||t.y===c&&c===i.y)return`L${a} ${c}`;if(t.y===c){const g=t.xi.id===r):t[0])||null}function Ka(t,r){return t?typeof t=="string"?t:`${r?`${r}__`:""}${Object.keys(t).sort().map(s=>`${s}=${t[s]}`).join("&")}`:""}function qx(t,{id:r,defaultColor:i,defaultMarkerStart:s,defaultMarkerEnd:u}){const a=new Set;return t.reduce((c,d)=>([d.markerStart||s,d.markerEnd||u].forEach(p=>{if(p&&typeof p=="object"){const g=Ka(p,r);a.has(g)||(c.push({id:g,color:p.color||i,...p}),a.add(g))}}),c),[]).sort((c,d)=>c.id.localeCompare(d.id))}const g0=1e3,Jx=10,hc={nodeOrigin:[0,0],nodeExtent:hi,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ew={...hc,checkEquality:!0};function pc(t,r){const i={...t};for(const s in r)r[s]!==void 0&&(i[s]=r[s]);return i}function tw(t,r,i){const s=pc(hc,i);for(const u of t.values())if(u.parentId)mc(u,t,r,s);else{const a=_i(u,s.nodeOrigin),c=lo(u.extent)?u.extent:s.nodeExtent,d=yr(a,c,yn(u));u.internals.positionAbsolute=d}}function nw(t,r){if(!t.handles)return t.measured?r==null?void 0:r.internals.handleBounds:void 0;const i=[],s=[];for(const u of t.handles){const a={id:u.id,width:u.width??1,height:u.height??1,nodeId:t.id,x:u.x,y:u.y,position:u.position,type:u.type};u.type==="source"?i.push(a):u.type==="target"&&s.push(a)}return{source:i,target:s}}function gc(t){return t==="manual"}function Ga(t,r,i,s={}){var v,m;const u=pc(ew,s),a={i:0},c=new Map(r),d=u!=null&&u.elevateNodesOnSelect&&!gc(u.zIndexMode)?g0:0;let p=t.length>0,g=!1;r.clear(),i.clear();for(const y of t){let x=c.get(y.id);if(u.checkEquality&&y===(x==null?void 0:x.internals.userNode))r.set(y.id,x);else{const S=_i(y,u.nodeOrigin),_=lo(y.extent)?y.extent:u.nodeExtent,w=yr(S,_,yn(y));x={...u.defaults,...y,measured:{width:(v=y.measured)==null?void 0:v.width,height:(m=y.measured)==null?void 0:m.height},internals:{positionAbsolute:w,handleBounds:nw(y,x),z:m0(y,d,u.zIndexMode),userNode:y}},r.set(y.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(p=!1),y.parentId&&mc(x,r,i,s,a),g||(g=y.selected??!1)}return{nodesInitialized:p,hasSelectedNodes:g}}function rw(t,r){if(!t.parentId)return;const i=r.get(t.parentId);i?i.set(t.id,t):r.set(t.parentId,new Map([[t.id,t]]))}function mc(t,r,i,s,u){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:d,zIndexMode:p}=pc(hc,s),g=t.parentId,v=r.get(g);if(!v){console.warn(`Parent node ${g} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}rw(t,i),u&&!v.parentId&&v.internals.rootParentIndex===void 0&&p==="auto"&&(v.internals.rootParentIndex=++u.i,v.internals.z=v.internals.z+u.i*Jx),u&&v.internals.rootParentIndex!==void 0&&(u.i=v.internals.rootParentIndex);const m=a&&!gc(p)?g0:0,{x:y,y:x,z:S}=ow(t,v,c,d,m,p),{positionAbsolute:_}=t.internals,w=y!==_.x||x!==_.y;(w||S!==t.internals.z)&&r.set(t.id,{...t,internals:{...t.internals,positionAbsolute:w?{x:y,y:x}:_,z:S}})}function m0(t,r,i){const s=Vt(t.zIndex)?t.zIndex:0;return gc(i)?s:s+(t.selected?r:0)}function ow(t,r,i,s,u,a){const{x:c,y:d}=r.internals.positionAbsolute,p=yn(t),g=_i(t,i),v=lo(t.extent)?yr(g,t.extent,p):g;let m=yr({x:c+v.x,y:d+v.y},s,p);t.extent==="parent"&&(m=r0(m,p,r));const y=m0(t,u,a),x=r.internals.z??0;return{x:m.x,y:m.y,z:x>=y?x+1:y}}function yc(t,r,i,s=[0,0]){var c;const u=[],a=new Map;for(const d of t){const p=r.get(d.parentId);if(!p)continue;const g=((c=a.get(d.parentId))==null?void 0:c.expandedRect)??so(p),v=i0(g,d.rect);a.set(d.parentId,{expandedRect:v,parent:p})}return a.size>0&&a.forEach(({expandedRect:d,parent:p},g)=>{var N;const v=p.internals.positionAbsolute,m=yn(p),y=p.origin??s,x=d.x0||S>0||k||P)&&(u.push({id:g,type:"position",position:{x:p.position.x-x+k,y:p.position.y-S+P}}),(N=i.get(g))==null||N.forEach(C=>{t.some(j=>j.id===C.id)||u.push({id:C.id,type:"position",position:{x:C.position.x+x,y:C.position.y+S}})})),(m.width0){const x=yc(y,r,i,u);g.push(...x)}return{changes:g,updatedInternals:p}}async function sw({delta:t,panZoom:r,transform:i,translateExtent:s,width:u,height:a}){if(!r||!t.x&&!t.y)return Promise.resolve(!1);const c=await r.setViewportConstrained({x:i[0]+t.x,y:i[1]+t.y,zoom:i[2]},[[0,0],[u,a]],s),d=!!c&&(c.x!==i[0]||c.y!==i[1]||c.k!==i[2]);return Promise.resolve(d)}function Mh(t,r,i,s,u,a){let c=u;const d=s.get(c)||new Map;s.set(c,d.set(i,r)),c=`${u}-${t}`;const p=s.get(c)||new Map;if(s.set(c,p.set(i,r)),a){c=`${u}-${t}-${a}`;const g=s.get(c)||new Map;s.set(c,g.set(i,r))}}function y0(t,r,i){t.clear(),r.clear();for(const s of i){const{source:u,target:a,sourceHandle:c=null,targetHandle:d=null}=s,p={edgeId:s.id,source:u,target:a,sourceHandle:c,targetHandle:d},g=`${u}-${c}--${a}-${d}`,v=`${a}-${d}--${u}-${c}`;Mh("source",p,v,t,u,c),Mh("target",p,g,t,a,d),r.set(s.id,s)}}function v0(t,r){if(!t.parentId)return!1;const i=r.get(t.parentId);return i?i.selected?!0:v0(i,r):!1}function Ph(t,r,i){var u;let s=t;do{if((u=s==null?void 0:s.matches)!=null&&u.call(s,r))return!0;if(s===i)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function lw(t,r,i,s){const u=new Map;for(const[a,c]of t)if((c.selected||c.id===s)&&(!c.parentId||!v0(c,t))&&(c.draggable||r&&typeof c.draggable>"u")){const d=t.get(a);d&&u.set(a,{id:a,position:d.position||{x:0,y:0},distance:{x:i.x-d.internals.positionAbsolute.x,y:i.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return u}function Ia({nodeId:t,dragItems:r,nodeLookup:i,dragging:s=!0}){var c,d,p;const u=[];for(const[g,v]of r){const m=(c=i.get(g))==null?void 0:c.internals.userNode;m&&u.push({...m,position:v.position,dragging:s})}if(!t)return[u[0],u];const a=(d=i.get(t))==null?void 0:d.internals.userNode;return[a?{...a,position:((p=r.get(t))==null?void 0:p.position)||a.position,dragging:s}:u[0],u]}function uw({dragItems:t,snapGrid:r,x:i,y:s}){const u=t.values().next().value;if(!u)return null;const a={x:i-u.distance.x,y:s-u.distance.y},c=ki(a,r);return{x:c.x-a.x,y:c.y-a.y}}function aw({onNodeMouseDown:t,getStoreItems:r,onDragStart:i,onDrag:s,onDragStop:u}){let a={x:null,y:null},c=0,d=new Map,p=!1,g={x:0,y:0},v=null,m=!1,y=null,x=!1,S=!1,_=null;function w({noDragClassName:P,handleSelector:N,domNode:C,isSelectable:j,nodeId:D,nodeClickDistance:H=0}){y=_t(C);function B({x:U,y:Z}){const{nodeLookup:z,nodeExtent:b,snapGrid:F,snapToGrid:Y,nodeOrigin:T,onNodeDrag:L,onSelectionDrag:V,onError:M,updateNodePositions:R}=r();a={x:U,y:Z};let te=!1;const re=d.size>1,le=re&&b?Xa(Ei(d)):null,ue=re&&Y?uw({dragItems:d,snapGrid:F,x:U,y:Z}):null;for(const[ae,ee]of d){if(!z.has(ae))continue;let ce={x:U-ee.distance.x,y:Z-ee.distance.y};Y&&(ce=ue?{x:Math.round(ce.x+ue.x),y:Math.round(ce.y+ue.y)}:ki(ce,F));let we=null;if(re&&b&&!ee.extent&&le){const{positionAbsolute:ye}=ee.internals,Ce=ye.x-le.x+b[0][0],Te=ye.x+ee.measured.width-le.x2+b[1][0],Me=ye.y-le.y+b[0][1],We=ye.y+ee.measured.height-le.y2+b[1][1];we=[[Ce,Me],[Te,We]]}const{position:_e,positionAbsolute:Se}=n0({nodeId:ae,nextPosition:ce,nodeLookup:z,nodeExtent:we||b,nodeOrigin:T,onError:M});te=te||ee.position.x!==_e.x||ee.position.y!==_e.y,ee.position=_e,ee.internals.positionAbsolute=Se}if(S=S||te,!!te&&(R(d,!0),_&&(s||L||!D&&V))){const[ae,ee]=Ia({nodeId:D,dragItems:d,nodeLookup:z});s==null||s(_,d,ae,ee),L==null||L(_,ae,ee),D||V==null||V(_,ee)}}async function X(){if(!v)return;const{transform:U,panBy:Z,autoPanSpeed:z,autoPanOnNodeDrag:b}=r();if(!b){p=!1,cancelAnimationFrame(c);return}const[F,Y]=o0(g,v,z);(F!==0||Y!==0)&&(a.x=(a.x??0)-F/U[2],a.y=(a.y??0)-Y/U[2],await Z({x:F,y:Y})&&B(a)),c=requestAnimationFrame(X)}function J(U){var re;const{nodeLookup:Z,multiSelectionActive:z,nodesDraggable:b,transform:F,snapGrid:Y,snapToGrid:T,selectNodesOnDrag:L,onNodeDragStart:V,onSelectionDragStart:M,unselectNodesAndEdges:R}=r();m=!0,(!L||!j)&&!z&&D&&((re=Z.get(D))!=null&&re.selected||R()),j&&L&&D&&(t==null||t(D));const te=ui(U.sourceEvent,{transform:F,snapGrid:Y,snapToGrid:T,containerBounds:v});if(a=te,d=lw(Z,b,te,D),d.size>0&&(i||V||!D&&M)){const[le,ue]=Ia({nodeId:D,dragItems:d,nodeLookup:Z});i==null||i(U.sourceEvent,d,le,ue),V==null||V(U.sourceEvent,le,ue),D||M==null||M(U.sourceEvent,ue)}}const W=$p().clickDistance(H).on("start",U=>{const{domNode:Z,nodeDragThreshold:z,transform:b,snapGrid:F,snapToGrid:Y}=r();v=(Z==null?void 0:Z.getBoundingClientRect())||null,x=!1,S=!1,_=U.sourceEvent,z===0&&J(U),a=ui(U.sourceEvent,{transform:b,snapGrid:F,snapToGrid:Y,containerBounds:v}),g=Bt(U.sourceEvent,v)}).on("drag",U=>{const{autoPanOnNodeDrag:Z,transform:z,snapGrid:b,snapToGrid:F,nodeDragThreshold:Y,nodeLookup:T}=r(),L=ui(U.sourceEvent,{transform:z,snapGrid:b,snapToGrid:F,containerBounds:v});if(_=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||D&&!T.has(D))&&(x=!0),!x){if(!p&&Z&&m&&(p=!0,X()),!m){const V=Bt(U.sourceEvent,v),M=V.x-g.x,R=V.y-g.y;Math.sqrt(M*M+R*R)>Y&&J(U)}(a.x!==L.xSnapped||a.y!==L.ySnapped)&&d&&m&&(g=Bt(U.sourceEvent,v),B(L))}}).on("end",U=>{if(!(!m||x)&&(p=!1,m=!1,cancelAnimationFrame(c),d.size>0)){const{nodeLookup:Z,updateNodePositions:z,onNodeDragStop:b,onSelectionDragStop:F}=r();if(S&&(z(d,!1),S=!1),u||b||!D&&F){const[Y,T]=Ia({nodeId:D,dragItems:d,nodeLookup:Z,dragging:!1});u==null||u(U.sourceEvent,d,Y,T),b==null||b(U.sourceEvent,Y,T),D||F==null||F(U.sourceEvent,T)}}}).filter(U=>{const Z=U.target;return!U.button&&(!P||!Ph(Z,`.${P}`,C))&&(!N||Ph(Z,N,C))});y.call(W)}function k(){y==null||y.on(".drag",null)}return{update:w,destroy:k}}function cw(t,r,i){const s=[],u={x:t.x-i,y:t.y-i,width:i*2,height:i*2};for(const a of r.values())gi(u,so(a))>0&&s.push(a);return s}const fw=250;function dw(t,r,i,s){var d,p;let u=[],a=1/0;const c=cw(t,i,r+fw);for(const g of c){const v=[...((d=g.internals.handleBounds)==null?void 0:d.source)??[],...((p=g.internals.handleBounds)==null?void 0:p.target)??[]];for(const m of v){if(s.nodeId===m.nodeId&&s.type===m.type&&s.id===m.id)continue;const{x:y,y:x}=vr(g,m,m.position,!0),S=Math.sqrt(Math.pow(y-t.x,2)+Math.pow(x-t.y,2));S>r||(S1){const g=s.type==="source"?"target":"source";return u.find(v=>v.type===g)??u[0]}return u[0]}function x0(t,r,i,s,u,a=!1){var g,v,m;const c=s.get(t);if(!c)return null;const d=u==="strict"?(g=c.internals.handleBounds)==null?void 0:g[r]:[...((v=c.internals.handleBounds)==null?void 0:v.source)??[],...((m=c.internals.handleBounds)==null?void 0:m.target)??[]],p=(i?d==null?void 0:d.find(y=>y.id===i):d==null?void 0:d[0])??null;return p&&a?{...p,...vr(c,p,p.position,!0)}:p}function w0(t,r){return t||(r!=null&&r.classList.contains("target")?"target":r!=null&&r.classList.contains("source")?"source":null)}function hw(t,r){let i=null;return r?i=!0:t&&!r&&(i=!1),i}const S0=()=>!0;function pw(t,{connectionMode:r,connectionRadius:i,handleId:s,nodeId:u,edgeUpdaterType:a,isTarget:c,domNode:d,nodeLookup:p,lib:g,autoPanOnConnect:v,flowId:m,panBy:y,cancelConnection:x,onConnectStart:S,onConnect:_,onConnectEnd:w,isValidConnection:k=S0,onReconnectEnd:P,updateConnection:N,getTransform:C,getFromHandle:j,autoPanSpeed:D,dragThreshold:H=1,handleDomNode:B}){const X=u0(t.target);let J=0,W;const{x:U,y:Z}=Bt(t),z=w0(a,B),b=d==null?void 0:d.getBoundingClientRect();let F=!1;if(!b||!z)return;const Y=x0(u,z,s,p,r);if(!Y)return;let T=Bt(t,b),L=!1,V=null,M=!1,R=null;function te(){if(!v||!b)return;const[_e,Se]=o0(T,b,D);y({x:_e,y:Se}),J=requestAnimationFrame(te)}const re={...Y,nodeId:u,type:z,position:Y.position},le=p.get(u);let ae={inProgress:!0,isValid:null,from:vr(le,re,me.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:le,to:T,toHandle:null,toPosition:mh[re.position],toNode:null,pointer:T};function ee(){F=!0,N(ae),S==null||S(t,{nodeId:u,handleId:s,handleType:z})}H===0&&ee();function ce(_e){if(!F){const{x:We,y:At}=Bt(_e),gt=We-U,mt=At-Z;if(!(gt*gt+mt*mt>H*H))return;ee()}if(!j()||!re){we(_e);return}const Se=C();T=Bt(_e,b),W=dw(Ni(T,Se,!1,[1,1]),i,p,re),L||(te(),L=!0);const ye=_0(_e,{handle:W,connectionMode:r,fromNodeId:u,fromHandleId:s,fromType:c?"target":"source",isValidConnection:k,doc:X,lib:g,flowId:m,nodeLookup:p});R=ye.handleDomNode,V=ye.connection,M=hw(!!W,ye.isValid);const Ce=p.get(u),Te=Ce?vr(Ce,re,me.Left,!0):ae.from,Me={...ae,from:Te,isValid:M,to:ye.toHandle&&M?vl({x:ye.toHandle.x,y:ye.toHandle.y},Se):T,toHandle:ye.toHandle,toPosition:M&&ye.toHandle?ye.toHandle.position:mh[re.position],toNode:ye.toHandle?p.get(ye.toHandle.nodeId):null,pointer:T};N(Me),ae=Me}function we(_e){if(!("touches"in _e&&_e.touches.length>0)){if(F){(W||R)&&V&&M&&(_==null||_(V));const{inProgress:Se,...ye}=ae,Ce={...ye,toPosition:ae.toHandle?ae.toPosition:null};w==null||w(_e,Ce),a&&(P==null||P(_e,Ce))}x(),cancelAnimationFrame(J),L=!1,M=!1,V=null,R=null,X.removeEventListener("mousemove",ce),X.removeEventListener("mouseup",we),X.removeEventListener("touchmove",ce),X.removeEventListener("touchend",we)}}X.addEventListener("mousemove",ce),X.addEventListener("mouseup",we),X.addEventListener("touchmove",ce),X.addEventListener("touchend",we)}function _0(t,{handle:r,connectionMode:i,fromNodeId:s,fromHandleId:u,fromType:a,doc:c,lib:d,flowId:p,isValidConnection:g=S0,nodeLookup:v}){const m=a==="target",y=r?c.querySelector(`.${d}-flow__handle[data-id="${p}-${r==null?void 0:r.nodeId}-${r==null?void 0:r.id}-${r==null?void 0:r.type}"]`):null,{x,y:S}=Bt(t),_=c.elementFromPoint(x,S),w=_!=null&&_.classList.contains(`${d}-flow__handle`)?_:y,k={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const P=w0(void 0,w),N=w.getAttribute("data-nodeid"),C=w.getAttribute("data-handleid"),j=w.classList.contains("connectable"),D=w.classList.contains("connectableend");if(!N||!P)return k;const H={source:m?N:s,sourceHandle:m?C:u,target:m?s:N,targetHandle:m?u:C};k.connection=H;const X=j&&D&&(i===ro.Strict?m&&P==="source"||!m&&P==="target":N!==s||C!==u);k.isValid=X&&g(H),k.toHandle=x0(N,P,C,v,i,!0)}return k}const Za={onPointerDown:pw,isValid:_0};function gw({domNode:t,panZoom:r,getTransform:i,getViewScale:s}){const u=_t(t);function a({translateExtent:d,width:p,height:g,zoomStep:v=1,pannable:m=!0,zoomable:y=!0,inversePan:x=!1}){const S=N=>{if(N.sourceEvent.type!=="wheel"||!r)return;const C=i(),j=N.sourceEvent.ctrlKey&&mi()?10:1,D=-N.sourceEvent.deltaY*(N.sourceEvent.deltaMode===1?.05:N.sourceEvent.deltaMode?1:.002)*v,H=C[2]*Math.pow(2,D*j);r.scaleTo(H)};let _=[0,0];const w=N=>{(N.sourceEvent.type==="mousedown"||N.sourceEvent.type==="touchstart")&&(_=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY])},k=N=>{const C=i();if(N.sourceEvent.type!=="mousemove"&&N.sourceEvent.type!=="touchmove"||!r)return;const j=[N.sourceEvent.clientX??N.sourceEvent.touches[0].clientX,N.sourceEvent.clientY??N.sourceEvent.touches[0].clientY],D=[j[0]-_[0],j[1]-_[1]];_=j;const H=s()*Math.max(C[2],Math.log(C[2]))*(x?-1:1),B={x:C[0]-D[0]*H,y:C[1]-D[1]*H},X=[[0,0],[p,g]];r.setViewportConstrained({x:B.x,y:B.y,zoom:C[2]},X,d)},P=Gp().on("start",w).on("zoom",m?k:null).on("zoom.wheel",y?S:null);u.call(P,{})}function c(){u.on("zoom",null)}return{update:a,destroy:c,pointer:Ft}}const Cl=t=>({x:t.x,y:t.y,zoom:t.k}),Ta=({x:t,y:r,zoom:i})=>El.translate(t,r).scale(i),Gr=(t,r)=>t.target.closest(`.${r}`),E0=(t,r)=>r===2&&Array.isArray(t)&&t.includes(2),mw=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Aa=(t,r=0,i=mw,s=()=>{})=>{const u=typeof r=="number"&&r>0;return u||s(),u?t.transition().duration(r).ease(i).on("end",s):t},k0=t=>{const r=t.ctrlKey&&mi()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*r};function yw({zoomPanValues:t,noWheelClassName:r,d3Selection:i,d3Zoom:s,panOnScrollMode:u,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:d,onPanZoom:p,onPanZoomEnd:g}){return v=>{if(Gr(v,r))return v.ctrlKey&&v.preventDefault(),!1;v.preventDefault(),v.stopImmediatePropagation();const m=i.property("__zoom").k||1;if(v.ctrlKey&&c){const w=Ft(v),k=k0(v),P=m*Math.pow(2,k);s.scaleTo(i,P,w,v);return}const y=v.deltaMode===1?20:1;let x=u===pr.Vertical?0:v.deltaX*y,S=u===pr.Horizontal?0:v.deltaY*y;!mi()&&v.shiftKey&&u!==pr.Vertical&&(x=v.deltaY*y,S=0),s.translateBy(i,-(x/m)*a,-(S/m)*a,{internal:!0});const _=Cl(i.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(p==null||p(v,_),t.panScrollTimeout=setTimeout(()=>{g==null||g(v,_),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,d==null||d(v,_))}}function vw({noWheelClassName:t,preventScrolling:r,d3ZoomHandler:i}){return function(s,u){const a=s.type==="wheel",c=!r&&a&&!s.ctrlKey,d=Gr(s,t);if(s.ctrlKey&&a&&d&&s.preventDefault(),c||d)return null;s.preventDefault(),i.call(this,s,u)}}function xw({zoomPanValues:t,onDraggingChange:r,onPanZoomStart:i}){return s=>{var a,c,d;if((a=s.sourceEvent)!=null&&a.internal)return;const u=Cl(s.transform);t.mouseButton=((c=s.sourceEvent)==null?void 0:c.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=u,((d=s.sourceEvent)==null?void 0:d.type)==="mousedown"&&r(!0),i&&(i==null||i(s.sourceEvent,u))}}function ww({zoomPanValues:t,panOnDrag:r,onPaneContextMenu:i,onTransformChange:s,onPanZoom:u}){return a=>{var c,d;t.usedRightMouseButton=!!(i&&E0(r,t.mouseButton??0)),(c=a.sourceEvent)!=null&&c.sync||s([a.transform.x,a.transform.y,a.transform.k]),u&&!((d=a.sourceEvent)!=null&&d.internal)&&(u==null||u(a.sourceEvent,Cl(a.transform)))}}function Sw({zoomPanValues:t,panOnDrag:r,panOnScroll:i,onDraggingChange:s,onPanZoomEnd:u,onPaneContextMenu:a}){return c=>{var d;if(!((d=c.sourceEvent)!=null&&d.internal)&&(t.isZoomingOrPanning=!1,a&&E0(r,t.mouseButton??0)&&!t.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),t.usedRightMouseButton=!1,s(!1),u)){const p=Cl(c.transform);t.prevViewport=p,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{u==null||u(c.sourceEvent,p)},i?150:0)}}}function _w({zoomActivationKeyPressed:t,zoomOnScroll:r,zoomOnPinch:i,panOnDrag:s,panOnScroll:u,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:d,noPanClassName:p,lib:g,connectionInProgress:v}){return m=>{var w;const y=t||r,x=i&&m.ctrlKey,S=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(Gr(m,`${g}-flow__node`)||Gr(m,`${g}-flow__edge`)))return!0;if(!s&&!y&&!u&&!a&&!i||c||v&&!S||Gr(m,d)&&S||Gr(m,p)&&(!S||u&&S&&!t)||!i&&m.ctrlKey&&S)return!1;if(!i&&m.type==="touchstart"&&((w=m.touches)==null?void 0:w.length)>1)return m.preventDefault(),!1;if(!y&&!u&&!x&&S||!s&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(s)&&!s.includes(m.button)&&m.type==="mousedown")return!1;const _=Array.isArray(s)&&s.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||S)&&_}}function Ew({domNode:t,minZoom:r,maxZoom:i,translateExtent:s,viewport:u,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:d,onDraggingChange:p}){const g={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=t.getBoundingClientRect(),m=Gp().scaleExtent([r,i]).translateExtent(s),y=_t(t).call(m);P({x:u.x,y:u.y,zoom:io(u.zoom,r,i)},[[0,0],[v.width,v.height]],s);const x=y.on("wheel.zoom"),S=y.on("dblclick.zoom");m.wheelDelta(k0);function _(W,U){return y?new Promise(Z=>{m==null||m.interpolate((U==null?void 0:U.interpolate)==="linear"?li:sl).transform(Aa(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>Z(!0)),W)}):Promise.resolve(!1)}function w({noWheelClassName:W,noPanClassName:U,onPaneContextMenu:Z,userSelectionActive:z,panOnScroll:b,panOnDrag:F,panOnScrollMode:Y,panOnScrollSpeed:T,preventScrolling:L,zoomOnPinch:V,zoomOnScroll:M,zoomOnDoubleClick:R,zoomActivationKeyPressed:te,lib:re,onTransformChange:le,connectionInProgress:ue,paneClickDistance:ae,selectionOnDrag:ee}){z&&!g.isZoomingOrPanning&&k();const ce=b&&!te&&!z;m.clickDistance(ee?1/0:!Vt(ae)||ae<0?0:ae);const we=ce?yw({zoomPanValues:g,noWheelClassName:W,d3Selection:y,d3Zoom:m,panOnScrollMode:Y,panOnScrollSpeed:T,zoomOnPinch:V,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:d}):vw({noWheelClassName:W,preventScrolling:L,d3ZoomHandler:x});if(y.on("wheel.zoom",we,{passive:!1}),!z){const Se=xw({zoomPanValues:g,onDraggingChange:p,onPanZoomStart:c});m.on("start",Se);const ye=ww({zoomPanValues:g,panOnDrag:F,onPaneContextMenu:!!Z,onPanZoom:a,onTransformChange:le});m.on("zoom",ye);const Ce=Sw({zoomPanValues:g,panOnDrag:F,panOnScroll:b,onPaneContextMenu:Z,onPanZoomEnd:d,onDraggingChange:p});m.on("end",Ce)}const _e=_w({zoomActivationKeyPressed:te,panOnDrag:F,zoomOnScroll:M,panOnScroll:b,zoomOnDoubleClick:R,zoomOnPinch:V,userSelectionActive:z,noPanClassName:U,noWheelClassName:W,lib:re,connectionInProgress:ue});m.filter(_e),R?y.on("dblclick.zoom",S):y.on("dblclick.zoom",null)}function k(){m.on("zoom",null)}async function P(W,U,Z){const z=Ta(W),b=m==null?void 0:m.constrain()(z,U,Z);return b&&await _(b),new Promise(F=>F(b))}async function N(W,U){const Z=Ta(W);return await _(Z,U),new Promise(z=>z(Z))}function C(W){if(y){const U=Ta(W),Z=y.property("__zoom");(Z.k!==W.zoom||Z.x!==W.x||Z.y!==W.y)&&(m==null||m.transform(y,U,null,{sync:!0}))}}function j(){const W=y?Kp(y.node()):{x:0,y:0,k:1};return{x:W.x,y:W.y,zoom:W.k}}function D(W,U){return y?new Promise(Z=>{m==null||m.interpolate((U==null?void 0:U.interpolate)==="linear"?li:sl).scaleTo(Aa(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>Z(!0)),W)}):Promise.resolve(!1)}function H(W,U){return y?new Promise(Z=>{m==null||m.interpolate((U==null?void 0:U.interpolate)==="linear"?li:sl).scaleBy(Aa(y,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>Z(!0)),W)}):Promise.resolve(!1)}function B(W){m==null||m.scaleExtent(W)}function X(W){m==null||m.translateExtent(W)}function J(W){const U=!Vt(W)||W<0?0:W;m==null||m.clickDistance(U)}return{update:w,destroy:k,setViewport:N,setViewportConstrained:P,getViewport:j,scaleTo:D,scaleBy:H,setScaleExtent:B,setTranslateExtent:X,syncViewport:C,setClickDistance:J}}var uo;(function(t){t.Line="line",t.Handle="handle"})(uo||(uo={}));function kw({width:t,prevWidth:r,height:i,prevHeight:s,affectsX:u,affectsY:a}){const c=t-r,d=i-s,p=[c>0?1:c<0?-1:0,d>0?1:d<0?-1:0];return c&&u&&(p[0]=p[0]*-1),d&&a&&(p[1]=p[1]*-1),p}function zh(t){const r=t.includes("right")||t.includes("left"),i=t.includes("bottom")||t.includes("top"),s=t.includes("left"),u=t.includes("top");return{isHorizontal:r,isVertical:i,affectsX:s,affectsY:u}}function Hn(t,r){return Math.max(0,r-t)}function Vn(t,r){return Math.max(0,t-r)}function Js(t,r,i){return Math.max(0,r-t,t-i)}function Ih(t,r){return t?!r:r}function Nw(t,r,i,s,u,a,c,d){let{affectsX:p,affectsY:g}=r;const{isHorizontal:v,isVertical:m}=r,y=v&&m,{xSnapped:x,ySnapped:S}=i,{minWidth:_,maxWidth:w,minHeight:k,maxHeight:P}=s,{x:N,y:C,width:j,height:D,aspectRatio:H}=t;let B=Math.floor(v?x-t.pointerX:0),X=Math.floor(m?S-t.pointerY:0);const J=j+(p?-B:B),W=D+(g?-X:X),U=-a[0]*j,Z=-a[1]*D;let z=Js(J,_,w),b=Js(W,k,P);if(c){let T=0,L=0;p&&B<0?T=Hn(N+B+U,c[0][0]):!p&&B>0&&(T=Vn(N+J+U,c[1][0])),g&&X<0?L=Hn(C+X+Z,c[0][1]):!g&&X>0&&(L=Vn(C+W+Z,c[1][1])),z=Math.max(z,T),b=Math.max(b,L)}if(d){let T=0,L=0;p&&B>0?T=Vn(N+B,d[0][0]):!p&&B<0&&(T=Hn(N+J,d[1][0])),g&&X>0?L=Vn(C+X,d[0][1]):!g&&X<0&&(L=Hn(C+W,d[1][1])),z=Math.max(z,T),b=Math.max(b,L)}if(u){if(v){const T=Js(J/H,k,P)*H;if(z=Math.max(z,T),c){let L=0;!p&&!g||p&&!g&&y?L=Vn(C+Z+J/H,c[1][1])*H:L=Hn(C+Z+(p?B:-B)/H,c[0][1])*H,z=Math.max(z,L)}if(d){let L=0;!p&&!g||p&&!g&&y?L=Hn(C+J/H,d[1][1])*H:L=Vn(C+(p?B:-B)/H,d[0][1])*H,z=Math.max(z,L)}}if(m){const T=Js(W*H,_,w)/H;if(b=Math.max(b,T),c){let L=0;!p&&!g||g&&!p&&y?L=Vn(N+W*H+U,c[1][0])/H:L=Hn(N+(g?X:-X)*H+U,c[0][0])/H,b=Math.max(b,L)}if(d){let L=0;!p&&!g||g&&!p&&y?L=Hn(N+W*H,d[1][0])/H:L=Vn(N+(g?X:-X)*H,d[0][0])/H,b=Math.max(b,L)}}}X=X+(X<0?b:-b),B=B+(B<0?z:-z),u&&(y?J>W*H?X=(Ih(p,g)?-B:B)/H:B=(Ih(p,g)?-X:X)*H:v?(X=B/H,g=p):(B=X*H,p=g));const F=p?N+B:N,Y=g?C+X:C;return{width:j+(p?-B:B),height:D+(g?-X:X),x:a[0]*B*(p?-1:1)+F,y:a[1]*X*(g?-1:1)+Y}}const N0={width:0,height:0,x:0,y:0},Cw={...N0,pointerX:0,pointerY:0,aspectRatio:1};function Mw(t){return[[0,0],[t.measured.width,t.measured.height]]}function Pw(t,r,i){const s=r.position.x+t.position.x,u=r.position.y+t.position.y,a=t.measured.width??0,c=t.measured.height??0,d=i[0]*a,p=i[1]*c;return[[s-d,u-p],[s+a-d,u+c-p]]}function zw({domNode:t,nodeId:r,getStoreItems:i,onChange:s,onEnd:u}){const a=_t(t);let c={controlDirection:zh("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function d({controlPosition:g,boundaries:v,keepAspectRatio:m,resizeDirection:y,onResizeStart:x,onResize:S,onResizeEnd:_,shouldResize:w}){let k={...N0},P={...Cw};c={boundaries:v,resizeDirection:y,keepAspectRatio:m,controlDirection:zh(g)};let N,C=null,j=[],D,H,B,X=!1;const J=$p().on("start",W=>{const{nodeLookup:U,transform:Z,snapGrid:z,snapToGrid:b,nodeOrigin:F,paneDomNode:Y}=i();if(N=U.get(r),!N)return;C=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:T,ySnapped:L}=ui(W.sourceEvent,{transform:Z,snapGrid:z,snapToGrid:b,containerBounds:C});k={width:N.measured.width??0,height:N.measured.height??0,x:N.position.x??0,y:N.position.y??0},P={...k,pointerX:T,pointerY:L,aspectRatio:k.width/k.height},D=void 0,N.parentId&&(N.extent==="parent"||N.expandParent)&&(D=U.get(N.parentId),H=D&&N.extent==="parent"?Mw(D):void 0),j=[],B=void 0;for(const[V,M]of U)if(M.parentId===r&&(j.push({id:V,position:{...M.position},extent:M.extent}),M.extent==="parent"||M.expandParent)){const R=Pw(M,N,M.origin??F);B?B=[[Math.min(R[0][0],B[0][0]),Math.min(R[0][1],B[0][1])],[Math.max(R[1][0],B[1][0]),Math.max(R[1][1],B[1][1])]]:B=R}x==null||x(W,{...k})}).on("drag",W=>{const{transform:U,snapGrid:Z,snapToGrid:z,nodeOrigin:b}=i(),F=ui(W.sourceEvent,{transform:U,snapGrid:Z,snapToGrid:z,containerBounds:C}),Y=[];if(!N)return;const{x:T,y:L,width:V,height:M}=k,R={},te=N.origin??b,{width:re,height:le,x:ue,y:ae}=Nw(P,c.controlDirection,F,c.boundaries,c.keepAspectRatio,te,H,B),ee=re!==V,ce=le!==M,we=ue!==T&&ee,_e=ae!==L&&ce;if(!we&&!_e&&!ee&&!ce)return;if((we||_e||te[0]===1||te[1]===1)&&(R.x=we?ue:k.x,R.y=_e?ae:k.y,k.x=R.x,k.y=R.y,j.length>0)){const Te=ue-T,Me=ae-L;for(const We of j)We.position={x:We.position.x-Te+te[0]*(re-V),y:We.position.y-Me+te[1]*(le-M)},Y.push(We)}if((ee||ce)&&(R.width=ee&&(!c.resizeDirection||c.resizeDirection==="horizontal")?re:k.width,R.height=ce&&(!c.resizeDirection||c.resizeDirection==="vertical")?le:k.height,k.width=R.width,k.height=R.height),D&&N.expandParent){const Te=te[0]*(R.width??0);R.x&&R.x{X&&(_==null||_(W,{...k}),u==null||u({...k}),X=!1)});a.call(J)}function p(){a.on(".drag",null)}return{update:d,destroy:p}}var La={exports:{}},Ra={},Da={exports:{}},$a={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Th;function Iw(){if(Th)return $a;Th=1;var t=vi();function r(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var i=typeof Object.is=="function"?Object.is:r,s=t.useState,u=t.useEffect,a=t.useLayoutEffect,c=t.useDebugValue;function d(m,y){var x=y(),S=s({inst:{value:x,getSnapshot:y}}),_=S[0].inst,w=S[1];return a(function(){_.value=x,_.getSnapshot=y,p(_)&&w({inst:_})},[m,x,y]),u(function(){return p(_)&&w({inst:_}),m(function(){p(_)&&w({inst:_})})},[m]),c(x),x}function p(m){var y=m.getSnapshot;m=m.value;try{var x=y();return!i(m,x)}catch{return!0}}function g(m,y){return y()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:d;return $a.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:v,$a}var Ah;function Tw(){return Ah||(Ah=1,Da.exports=Iw()),Da.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Lh;function Aw(){if(Lh)return Ra;Lh=1;var t=vi(),r=Tw();function i(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var s=typeof Object.is=="function"?Object.is:i,u=r.useSyncExternalStore,a=t.useRef,c=t.useEffect,d=t.useMemo,p=t.useDebugValue;return Ra.useSyncExternalStoreWithSelector=function(g,v,m,y,x){var S=a(null);if(S.current===null){var _={hasValue:!1,value:null};S.current=_}else _=S.current;S=d(function(){function k(D){if(!P){if(P=!0,N=D,D=y(D),x!==void 0&&_.hasValue){var H=_.value;if(x(H,D))return C=H}return C=D}if(H=C,s(N,D))return H;var B=y(D);return x!==void 0&&x(H,B)?(N=D,H):(N=D,C=B)}var P=!1,N,C,j=m===void 0?null:m;return[function(){return k(v())},j===null?void 0:function(){return k(j())}]},[v,m,y,x]);var w=u(g,S[0],S[1]);return c(function(){_.hasValue=!0,_.value=w},[w]),p(w),w},Ra}var Rh;function Lw(){return Rh||(Rh=1,La.exports=Aw()),La.exports}var Rw=Lw();const Dw=wp(Rw),$w={},Dh=t=>{let r;const i=new Set,s=(v,m)=>{const y=typeof v=="function"?v(r):v;if(!Object.is(y,r)){const x=r;r=m??(typeof y!="object"||y===null)?y:Object.assign({},r,y),i.forEach(S=>S(r,x))}},u=()=>r,p={setState:s,getState:u,getInitialState:()=>g,subscribe:v=>(i.add(v),()=>i.delete(v)),destroy:()=>{($w?"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."),i.clear()}},g=r=t(s,u,p);return p},jw=t=>t?Dh(t):Dh,{useDebugValue:Ow}=Ym,{useSyncExternalStoreWithSelector:Fw}=Dw,Hw=t=>t;function C0(t,r=Hw,i){const s=Fw(t.subscribe,t.getState,t.getServerState||t.getInitialState,r,i);return Ow(s),s}const $h=(t,r)=>{const i=jw(t),s=(u,a=r)=>C0(i,u,a);return Object.assign(s,i),s},Vw=(t,r)=>t?$h(t,r):$h;function De(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[s,u]of t)if(!Object.is(u,r.get(s)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const s of t)if(!r.has(s))return!1;return!0}const i=Object.keys(t);if(i.length!==Object.keys(r).length)return!1;for(const s of i)if(!Object.prototype.hasOwnProperty.call(r,s)||!Object.is(t[s],r[s]))return!1;return!0}var Bw=Sp();const Ml=q.createContext(null),Ww=Ml.Provider,M0=Jt.error001();function Ne(t,r){const i=q.useContext(Ml);if(i===null)throw new Error(M0);return C0(i,t,r)}function je(){const t=q.useContext(Ml);if(t===null)throw new Error(M0);return q.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const jh={display:"none"},Uw={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},P0="react-flow__node-desc",z0="react-flow__edge-desc",bw="react-flow__aria-live",Yw=t=>t.ariaLiveMessage,Xw=t=>t.ariaLabelConfig;function Qw({rfId:t}){const r=Ne(Yw);return A.jsx("div",{id:`${bw}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Uw,children:r})}function Kw({rfId:t,disableKeyboardA11y:r}){const i=Ne(Xw);return A.jsxs(A.Fragment,{children:[A.jsx("div",{id:`${P0}-${t}`,style:jh,children:r?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),A.jsx("div",{id:`${z0}-${t}`,style:jh,children:i["edge.a11yDescription.default"]}),!r&&A.jsx(Qw,{rfId:t})]})}const Ci=q.forwardRef(({position:t="top-left",children:r,className:i,style:s,...u},a)=>{const c=`${t}`.split("-");return A.jsx("div",{className:be(["react-flow__panel",i,...c]),style:s,ref:a,...u,children:r})});Ci.displayName="Panel";function Gw({proOptions:t,position:r="bottom-right"}){return t!=null&&t.hideAttribution?null:A.jsx(Ci,{position:r,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:A.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Zw=t=>{const r=[],i=[];for(const[,s]of t.nodeLookup)s.selected&&r.push(s.internals.userNode);for(const[,s]of t.edgeLookup)s.selected&&i.push(s);return{selectedNodes:r,selectedEdges:i}},el=t=>t.id;function qw(t,r){return De(t.selectedNodes.map(el),r.selectedNodes.map(el))&&De(t.selectedEdges.map(el),r.selectedEdges.map(el))}function Jw({onSelectionChange:t}){const r=je(),{selectedNodes:i,selectedEdges:s}=Ne(Zw,qw);return q.useEffect(()=>{const u={nodes:i,edges:s};t==null||t(u),r.getState().onSelectionChangeHandlers.forEach(a=>a(u))},[i,s,t]),null}const e2=t=>!!t.onSelectionChangeHandlers;function t2({onSelectionChange:t}){const r=Ne(e2);return t||r?A.jsx(Jw,{onSelectionChange:t}):null}const qa=typeof window<"u"?q.useLayoutEffect:q.useEffect,I0=[0,0],n2={x:0,y:0,zoom:1},r2=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Oh=[...r2,"rfId"],o2=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),Fh={translateExtent:hi,nodeOrigin:I0,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function i2(t){const{setNodes:r,setEdges:i,setMinZoom:s,setMaxZoom:u,setTranslateExtent:a,setNodeExtent:c,reset:d,setDefaultNodesAndEdges:p}=Ne(o2,De),g=je();qa(()=>(p(t.defaultNodes,t.defaultEdges),()=>{v.current=Fh,d()}),[]);const v=q.useRef(Fh);return qa(()=>{for(const m of Oh){const y=t[m],x=v.current[m];y!==x&&(typeof t[m]>"u"||(m==="nodes"?r(y):m==="edges"?i(y):m==="minZoom"?s(y):m==="maxZoom"?u(y):m==="translateExtent"?a(y):m==="nodeExtent"?c(y):m==="ariaLabelConfig"?g.setState({ariaLabelConfig:Vx(y)}):m==="fitView"?g.setState({fitViewQueued:y}):m==="fitViewOptions"?g.setState({fitViewOptions:y}):g.setState({[m]:y})))}v.current=t},Oh.map(m=>t[m])),null}function Hh(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function s2(t){var s;const[r,i]=q.useState(t==="system"?null:t);return q.useEffect(()=>{if(t!=="system"){i(t);return}const u=Hh(),a=()=>i(u!=null&&u.matches?"dark":"light");return a(),u==null||u.addEventListener("change",a),()=>{u==null||u.removeEventListener("change",a)}},[t]),r!==null?r:(s=Hh())!=null&&s.matches?"dark":"light"}const Vh=typeof document<"u"?document:null;function yi(t=null,r={target:Vh,actInsideInputWithModifier:!0}){const[i,s]=q.useState(!1),u=q.useRef(!1),a=q.useRef(new Set([])),[c,d]=q.useMemo(()=>{if(t!==null){const g=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.replace("+",` -`).replace(` - -`,` -+`).split(` -`)),v=g.reduce((m,y)=>m.concat(...y),[]);return[g,v]}return[[],[]]},[t]);return q.useEffect(()=>{const p=(r==null?void 0:r.target)??Vh,g=(r==null?void 0:r.actInsideInputWithModifier)??!0;if(t!==null){const v=x=>{var w,k;if(u.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!u.current||u.current&&!g)&&a0(x))return!1;const _=Wh(x.code,d);if(a.current.add(x[_]),Bh(c,a.current,!1)){const P=((k=(w=x.composedPath)==null?void 0:w.call(x))==null?void 0:k[0])||x.target,N=(P==null?void 0:P.nodeName)==="BUTTON"||(P==null?void 0:P.nodeName)==="A";r.preventDefault!==!1&&(u.current||!N)&&x.preventDefault(),s(!0)}},m=x=>{const S=Wh(x.code,d);Bh(c,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(x[S]),x.key==="Meta"&&a.current.clear(),u.current=!1},y=()=>{a.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",v),p==null||p.addEventListener("keyup",m),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{p==null||p.removeEventListener("keydown",v),p==null||p.removeEventListener("keyup",m),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[t,s]),i}function Bh(t,r,i){return t.filter(s=>i||s.length===r.size).some(s=>s.every(u=>r.has(u)))}function Wh(t,r){return r.includes(t)?"code":"key"}const l2=()=>{const t=je();return q.useMemo(()=>({zoomIn:r=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1.2,r):Promise.resolve(!1)},zoomOut:r=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1/1.2,r):Promise.resolve(!1)},zoomTo:(r,i)=>{const{panZoom:s}=t.getState();return s?s.scaleTo(r,i):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(r,i)=>{const{transform:[s,u,a],panZoom:c}=t.getState();return c?(await c.setViewport({x:r.x??s,y:r.y??u,zoom:r.zoom??a},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[r,i,s]=t.getState().transform;return{x:r,y:i,zoom:s}},setCenter:async(r,i,s)=>t.getState().setCenter(r,i,s),fitBounds:async(r,i)=>{const{width:s,height:u,minZoom:a,maxZoom:c,panZoom:d}=t.getState(),p=fc(r,s,u,a,c,(i==null?void 0:i.padding)??.1);return d?(await d.setViewport(p,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(r,i={})=>{const{transform:s,snapGrid:u,snapToGrid:a,domNode:c}=t.getState();if(!c)return r;const{x:d,y:p}=c.getBoundingClientRect(),g={x:r.x-d,y:r.y-p},v=i.snapGrid??u,m=i.snapToGrid??a;return Ni(g,s,m,v)},flowToScreenPosition:r=>{const{transform:i,domNode:s}=t.getState();if(!s)return r;const{x:u,y:a}=s.getBoundingClientRect(),c=vl(r,i);return{x:c.x+u,y:c.y+a}}}),[])};function T0(t,r){const i=[],s=new Map,u=[];for(const a of t)if(a.type==="add"){u.push(a);continue}else if(a.type==="remove"||a.type==="replace")s.set(a.id,[a]);else{const c=s.get(a.id);c?c.push(a):s.set(a.id,[a])}for(const a of r){const c=s.get(a.id);if(!c){i.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){i.push({...c[0].item});continue}const d={...a};for(const p of c)u2(p,d);i.push(d)}return u.length&&u.forEach(a=>{a.index!==void 0?i.splice(a.index,0,{...a.item}):i.push({...a.item})}),i}function u2(t,r){switch(t.type){case"select":{r.selected=t.selected;break}case"position":{typeof t.position<"u"&&(r.position=t.position),typeof t.dragging<"u"&&(r.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(r.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(r.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(r.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(r.resizing=t.resizing);break}}}function A0(t,r){return T0(t,r)}function L0(t,r){return T0(t,r)}function fr(t,r){return{id:t,type:"select",selected:r}}function Zr(t,r=new Set,i=!1){const s=[];for(const[u,a]of t){const c=r.has(u);!(a.selected===void 0&&!c)&&a.selected!==c&&(i&&(a.selected=c),s.push(fr(a.id,c)))}return s}function Uh({items:t=[],lookup:r}){var u;const i=[],s=new Map(t.map(a=>[a.id,a]));for(const[a,c]of t.entries()){const d=r.get(c.id),p=((u=d==null?void 0:d.internals)==null?void 0:u.userNode)??d;p!==void 0&&p!==c&&i.push({id:c.id,item:c,type:"replace"}),p===void 0&&i.push({item:c,type:"add",index:a})}for(const[a]of r)s.get(a)===void 0&&i.push({id:a,type:"remove"});return i}function bh(t){return{id:t.id,type:"remove"}}const Yh=t=>Tx(t),a2=t=>t0(t);function R0(t){return q.forwardRef(t)}function Xh(t){const[r,i]=q.useState(BigInt(0)),[s]=q.useState(()=>c2(()=>i(u=>u+BigInt(1))));return qa(()=>{const u=s.get();u.length&&(t(u),s.reset())},[r]),s}function c2(t){let r=[];return{get:()=>r,reset:()=>{r=[]},push:i=>{r.push(i),t()}}}const D0=q.createContext(null);function f2({children:t}){const r=je(),i=q.useCallback(d=>{const{nodes:p=[],setNodes:g,hasDefaultNodes:v,onNodesChange:m,nodeLookup:y,fitViewQueued:x,onNodesChangeMiddlewareMap:S}=r.getState();let _=p;for(const k of d)_=typeof k=="function"?k(_):k;let w=Uh({items:_,lookup:y});for(const k of S.values())w=k(w);v&&g(_),w.length>0?m==null||m(w):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:k,nodes:P,setNodes:N}=r.getState();k&&N(P)})},[]),s=Xh(i),u=q.useCallback(d=>{const{edges:p=[],setEdges:g,hasDefaultEdges:v,onEdgesChange:m,edgeLookup:y}=r.getState();let x=p;for(const S of d)x=typeof S=="function"?S(x):S;v?g(x):m&&m(Uh({items:x,lookup:y}))},[]),a=Xh(u),c=q.useMemo(()=>({nodeQueue:s,edgeQueue:a}),[]);return A.jsx(D0.Provider,{value:c,children:t})}function d2(){const t=q.useContext(D0);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const h2=t=>!!t.panZoom;function Mi(){const t=l2(),r=je(),i=d2(),s=Ne(h2),u=q.useMemo(()=>{const a=m=>r.getState().nodeLookup.get(m),c=m=>{i.nodeQueue.push(m)},d=m=>{i.edgeQueue.push(m)},p=m=>{var k,P;const{nodeLookup:y,nodeOrigin:x}=r.getState(),S=Yh(m)?m:y.get(m.id),_=S.parentId?l0(S.position,S.measured,S.parentId,y,x):S.position,w={...S,position:_,width:((k=S.measured)==null?void 0:k.width)??S.width,height:((P=S.measured)==null?void 0:P.height)??S.height};return so(w)},g=(m,y,x={replace:!1})=>{c(S=>S.map(_=>{if(_.id===m){const w=typeof y=="function"?y(_):y;return x.replace&&Yh(w)?w:{..._,...w}}return _}))},v=(m,y,x={replace:!1})=>{d(S=>S.map(_=>{if(_.id===m){const w=typeof y=="function"?y(_):y;return x.replace&&a2(w)?w:{..._,...w}}return _}))};return{getNodes:()=>r.getState().nodes.map(m=>({...m})),getNode:m=>{var y;return(y=a(m))==null?void 0:y.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:m=[]}=r.getState();return m.map(y=>({...y}))},getEdge:m=>r.getState().edgeLookup.get(m),setNodes:c,setEdges:d,addNodes:m=>{const y=Array.isArray(m)?m:[m];i.nodeQueue.push(x=>[...x,...y])},addEdges:m=>{const y=Array.isArray(m)?m:[m];i.edgeQueue.push(x=>[...x,...y])},toObject:()=>{const{nodes:m=[],edges:y=[],transform:x}=r.getState(),[S,_,w]=x;return{nodes:m.map(k=>({...k})),edges:y.map(k=>({...k})),viewport:{x:S,y:_,zoom:w}}},deleteElements:async({nodes:m=[],edges:y=[]})=>{const{nodes:x,edges:S,onNodesDelete:_,onEdgesDelete:w,triggerNodeChanges:k,triggerEdgeChanges:P,onDelete:N,onBeforeDelete:C}=r.getState(),{nodes:j,edges:D}=await $x({nodesToRemove:m,edgesToRemove:y,nodes:x,edges:S,onBeforeDelete:C}),H=D.length>0,B=j.length>0;if(H){const X=D.map(bh);w==null||w(D),P(X)}if(B){const X=j.map(bh);_==null||_(j),k(X)}return(B||H)&&(N==null||N({nodes:j,edges:D})),{deletedNodes:j,deletedEdges:D}},getIntersectingNodes:(m,y=!0,x)=>{const S=vh(m),_=S?m:p(m),w=x!==void 0;return _?(x||r.getState().nodes).filter(k=>{const P=r.getState().nodeLookup.get(k.id);if(P&&!S&&(k.id===m.id||!P.internals.positionAbsolute))return!1;const N=so(w?k:P),C=gi(N,_);return y&&C>0||C>=N.width*N.height||C>=_.width*_.height}):[]},isNodeIntersecting:(m,y,x=!0)=>{const _=vh(m)?m:p(m);if(!_)return!1;const w=gi(_,y);return x&&w>0||w>=y.width*y.height||w>=_.width*_.height},updateNode:g,updateNodeData:(m,y,x={replace:!1})=>{g(m,S=>{const _=typeof y=="function"?y(S):y;return x.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},x)},updateEdge:v,updateEdgeData:(m,y,x={replace:!1})=>{v(m,S=>{const _=typeof y=="function"?y(S):y;return x.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},x)},getNodesBounds:m=>{const{nodeLookup:y,nodeOrigin:x}=r.getState();return Ax(m,{nodeLookup:y,nodeOrigin:x})},getHandleConnections:({type:m,id:y,nodeId:x})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${x}-${m}${y?`-${y}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:m,handleId:y,nodeId:x})=>{var S;return Array.from(((S=r.getState().connectionLookup.get(`${x}${m?y?`-${m}-${y}`:`-${m}`:""}`))==null?void 0:S.values())??[])},fitView:async m=>{const y=r.getState().fitViewResolver??Hx();return r.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:y}),i.nodeQueue.push(x=>[...x]),y.promise}}},[]);return q.useMemo(()=>({...u,...t,viewportInitialized:s}),[s])}const Qh=t=>t.selected,p2=typeof window<"u"?window:void 0;function g2({deleteKeyCode:t,multiSelectionKeyCode:r}){const i=je(),{deleteElements:s}=Mi(),u=yi(t,{actInsideInputWithModifier:!1}),a=yi(r,{target:p2});q.useEffect(()=>{if(u){const{edges:c,nodes:d}=i.getState();s({nodes:d.filter(Qh),edges:c.filter(Qh)}),i.setState({nodesSelectionActive:!1})}},[u]),q.useEffect(()=>{i.setState({multiSelectionActive:a})},[a])}function m2(t){const r=je();q.useEffect(()=>{const i=()=>{var u,a,c,d;if(!t.current||!(((a=(u=t.current).checkVisibility)==null?void 0:a.call(u))??!0))return!1;const s=dc(t.current);(s.height===0||s.width===0)&&((d=(c=r.getState()).onError)==null||d.call(c,"004",Jt.error004())),r.setState({width:s.width||500,height:s.height||500})};if(t.current){i(),window.addEventListener("resize",i);const s=new ResizeObserver(()=>i());return s.observe(t.current),()=>{window.removeEventListener("resize",i),s&&t.current&&s.unobserve(t.current)}}},[])}const Pl={position:"absolute",width:"100%",height:"100%",top:0,left:0},y2=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function v2({onPaneContextMenu:t,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:u=.5,panOnScrollMode:a=pr.Free,zoomOnDoubleClick:c=!0,panOnDrag:d=!0,defaultViewport:p,translateExtent:g,minZoom:v,maxZoom:m,zoomActivationKeyCode:y,preventScrolling:x=!0,children:S,noWheelClassName:_,noPanClassName:w,onViewportChange:k,isControlledViewport:P,paneClickDistance:N,selectionOnDrag:C}){const j=je(),D=q.useRef(null),{userSelectionActive:H,lib:B,connectionInProgress:X}=Ne(y2,De),J=yi(y),W=q.useRef();m2(D);const U=q.useCallback(Z=>{k==null||k({x:Z[0],y:Z[1],zoom:Z[2]}),P||j.setState({transform:Z})},[k,P]);return q.useEffect(()=>{if(D.current){W.current=Ew({domNode:D.current,minZoom:v,maxZoom:m,translateExtent:g,viewport:p,onDraggingChange:F=>j.setState(Y=>Y.paneDragging===F?Y:{paneDragging:F}),onPanZoomStart:(F,Y)=>{const{onViewportChangeStart:T,onMoveStart:L}=j.getState();L==null||L(F,Y),T==null||T(Y)},onPanZoom:(F,Y)=>{const{onViewportChange:T,onMove:L}=j.getState();L==null||L(F,Y),T==null||T(Y)},onPanZoomEnd:(F,Y)=>{const{onViewportChangeEnd:T,onMoveEnd:L}=j.getState();L==null||L(F,Y),T==null||T(Y)}});const{x:Z,y:z,zoom:b}=W.current.getViewport();return j.setState({panZoom:W.current,transform:[Z,z,b],domNode:D.current.closest(".react-flow")}),()=>{var F;(F=W.current)==null||F.destroy()}}},[]),q.useEffect(()=>{var Z;(Z=W.current)==null||Z.update({onPaneContextMenu:t,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:s,panOnScrollSpeed:u,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:d,zoomActivationKeyPressed:J,preventScrolling:x,noPanClassName:w,userSelectionActive:H,noWheelClassName:_,lib:B,onTransformChange:U,connectionInProgress:X,selectionOnDrag:C,paneClickDistance:N})},[t,r,i,s,u,a,c,d,J,x,w,H,_,B,U,X,C,N]),A.jsx("div",{className:"react-flow__renderer",ref:D,style:Pl,children:S})}const x2=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function w2(){const{userSelectionActive:t,userSelectionRect:r}=Ne(x2,De);return t&&r?A.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}const ja=(t,r)=>i=>{i.target===r.current&&(t==null||t(i))},S2=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function _2({isSelecting:t,selectionKeyPressed:r,selectionMode:i=pi.Full,panOnDrag:s,paneClickDistance:u,selectionOnDrag:a,onSelectionStart:c,onSelectionEnd:d,onPaneClick:p,onPaneContextMenu:g,onPaneScroll:v,onPaneMouseEnter:m,onPaneMouseMove:y,onPaneMouseLeave:x,children:S}){const _=je(),{userSelectionActive:w,elementsSelectable:k,dragging:P,connectionInProgress:N}=Ne(S2,De),C=k&&(t||w),j=q.useRef(null),D=q.useRef(),H=q.useRef(new Set),B=q.useRef(new Set),X=q.useRef(!1),J=T=>{if(X.current||N){X.current=!1;return}p==null||p(T),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},W=T=>{if(Array.isArray(s)&&(s!=null&&s.includes(2))){T.preventDefault();return}g==null||g(T)},U=v?T=>v(T):void 0,Z=T=>{X.current&&(T.stopPropagation(),X.current=!1)},z=T=>{var le,ue;const{domNode:L}=_.getState();if(D.current=L==null?void 0:L.getBoundingClientRect(),!D.current)return;const V=T.target===j.current;if(!V&&!!T.target.closest(".nokey")||!t||!(a&&V||r)||T.button!==0||!T.isPrimary)return;(ue=(le=T.target)==null?void 0:le.setPointerCapture)==null||ue.call(le,T.pointerId),X.current=!1;const{x:te,y:re}=Bt(T.nativeEvent,D.current);_.setState({userSelectionRect:{width:0,height:0,startX:te,startY:re,x:te,y:re}}),V||(T.stopPropagation(),T.preventDefault())},b=T=>{const{userSelectionRect:L,transform:V,nodeLookup:M,edgeLookup:R,connectionLookup:te,triggerNodeChanges:re,triggerEdgeChanges:le,defaultEdgeOptions:ue,resetSelectedElements:ae}=_.getState();if(!D.current||!L)return;const{x:ee,y:ce}=Bt(T.nativeEvent,D.current),{startX:we,startY:_e}=L;if(!X.current){const Me=r?0:u;if(Math.hypot(ee-we,ce-_e)<=Me)return;ae(),c==null||c(T)}X.current=!0;const Se={startX:we,startY:_e,x:eeMe.id)),B.current=new Set;const Te=(ue==null?void 0:ue.selectable)??!0;for(const Me of H.current){const We=te.get(Me);if(We)for(const{edgeId:At}of We.values()){const gt=R.get(At);gt&&(gt.selectable??Te)&&B.current.add(At)}}if(!xh(ye,H.current)){const Me=Zr(M,H.current,!0);re(Me)}if(!xh(Ce,B.current)){const Me=Zr(R,B.current);le(Me)}_.setState({userSelectionRect:Se,userSelectionActive:!0,nodesSelectionActive:!1})},F=T=>{var L,V;T.button===0&&((V=(L=T.target)==null?void 0:L.releasePointerCapture)==null||V.call(L,T.pointerId),!w&&T.target===j.current&&_.getState().userSelectionRect&&(J==null||J(T)),_.setState({userSelectionActive:!1,userSelectionRect:null}),X.current&&(d==null||d(T),_.setState({nodesSelectionActive:H.current.size>0})))},Y=s===!0||Array.isArray(s)&&s.includes(0);return A.jsxs("div",{className:be(["react-flow__pane",{draggable:Y,dragging:P,selection:t}]),onClick:C?void 0:ja(J,j),onContextMenu:ja(W,j),onWheel:ja(U,j),onPointerEnter:C?void 0:m,onPointerMove:C?b:y,onPointerUp:C?F:void 0,onPointerDownCapture:C?z:void 0,onClickCapture:C?Z:void 0,onPointerLeave:x,ref:j,style:Pl,children:[S,A.jsx(w2,{})]})}function Ja({id:t,store:r,unselect:i=!1,nodeRef:s}){const{addSelectedNodes:u,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:d,onError:p}=r.getState(),g=d.get(t);if(!g){p==null||p("012",Jt.error012(t));return}r.setState({nodesSelectionActive:!1}),g.selected?(i||g.selected&&c)&&(a({nodes:[g],edges:[]}),requestAnimationFrame(()=>{var v;return(v=s==null?void 0:s.current)==null?void 0:v.blur()})):u([t])}function $0({nodeRef:t,disabled:r=!1,noDragClassName:i,handleSelector:s,nodeId:u,isSelectable:a,nodeClickDistance:c}){const d=je(),[p,g]=q.useState(!1),v=q.useRef();return q.useEffect(()=>{v.current=aw({getStoreItems:()=>d.getState(),onNodeMouseDown:m=>{Ja({id:m,store:d,nodeRef:t})},onDragStart:()=>{g(!0)},onDragStop:()=>{g(!1)}})},[]),q.useEffect(()=>{if(!(r||!t.current||!v.current))return v.current.update({noDragClassName:i,handleSelector:s,domNode:t.current,isSelectable:a,nodeId:u,nodeClickDistance:c}),()=>{var m;(m=v.current)==null||m.destroy()}},[i,s,r,a,t,u,c]),p}const E2=t=>r=>r.selected&&(r.draggable||t&&typeof r.draggable>"u");function j0(){const t=je();return q.useCallback(i=>{const{nodeExtent:s,snapToGrid:u,snapGrid:a,nodesDraggable:c,onError:d,updateNodePositions:p,nodeLookup:g,nodeOrigin:v}=t.getState(),m=new Map,y=E2(c),x=u?a[0]:5,S=u?a[1]:5,_=i.direction.x*x*i.factor,w=i.direction.y*S*i.factor;for(const[,k]of g){if(!y(k))continue;let P={x:k.internals.positionAbsolute.x+_,y:k.internals.positionAbsolute.y+w};u&&(P=ki(P,a));const{position:N,positionAbsolute:C}=n0({nodeId:k.id,nextPosition:P,nodeLookup:g,nodeExtent:s,nodeOrigin:v,onError:d});k.position=N,k.internals.positionAbsolute=C,m.set(k.id,k)}p(m)},[])}const vc=q.createContext(null),k2=vc.Provider;vc.Consumer;const O0=()=>q.useContext(vc),N2=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),C2=(t,r,i)=>s=>{const{connectionClickStartHandle:u,connectionMode:a,connection:c}=s,{fromHandle:d,toHandle:p,isValid:g}=c,v=(p==null?void 0:p.nodeId)===t&&(p==null?void 0:p.id)===r&&(p==null?void 0:p.type)===i;return{connectingFrom:(d==null?void 0:d.nodeId)===t&&(d==null?void 0:d.id)===r&&(d==null?void 0:d.type)===i,connectingTo:v,clickConnecting:(u==null?void 0:u.nodeId)===t&&(u==null?void 0:u.id)===r&&(u==null?void 0:u.type)===i,isPossibleEndHandle:a===ro.Strict?(d==null?void 0:d.type)!==i:t!==(d==null?void 0:d.nodeId)||r!==(d==null?void 0:d.id),connectionInProcess:!!d,clickConnectionInProcess:!!u,valid:v&&g}};function M2({type:t="source",position:r=me.Top,isValidConnection:i,isConnectable:s=!0,isConnectableStart:u=!0,isConnectableEnd:a=!0,id:c,onConnect:d,children:p,className:g,onMouseDown:v,onTouchStart:m,...y},x){var b,F;const S=c||null,_=t==="target",w=je(),k=O0(),{connectOnClick:P,noPanClassName:N,rfId:C}=Ne(N2,De),{connectingFrom:j,connectingTo:D,clickConnecting:H,isPossibleEndHandle:B,connectionInProcess:X,clickConnectionInProcess:J,valid:W}=Ne(C2(k,S,t),De);k||(F=(b=w.getState()).onError)==null||F.call(b,"010",Jt.error010());const U=Y=>{const{defaultEdgeOptions:T,onConnect:L,hasDefaultEdges:V}=w.getState(),M={...T,...Y};if(V){const{edges:R,setEdges:te}=w.getState();te(Xx(M,R))}L==null||L(M),d==null||d(M)},Z=Y=>{if(!k)return;const T=c0(Y.nativeEvent);if(u&&(T&&Y.button===0||!T)){const L=w.getState();Za.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:_,handleId:S,nodeId:k,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...V)=>{var M,R;return(R=(M=w.getState()).onConnectEnd)==null?void 0:R.call(M,...V)},updateConnection:L.updateConnection,onConnect:U,isValidConnection:i||((...V)=>{var M,R;return((R=(M=w.getState()).isValidConnection)==null?void 0:R.call(M,...V))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}T?v==null||v(Y):m==null||m(Y)},z=Y=>{const{onClickConnectStart:T,onClickConnectEnd:L,connectionClickStartHandle:V,connectionMode:M,isValidConnection:R,lib:te,rfId:re,nodeLookup:le,connection:ue}=w.getState();if(!k||!V&&!u)return;if(!V){T==null||T(Y.nativeEvent,{nodeId:k,handleId:S,handleType:t}),w.setState({connectionClickStartHandle:{nodeId:k,type:t,id:S}});return}const ae=u0(Y.target),ee=i||R,{connection:ce,isValid:we}=Za.isValid(Y.nativeEvent,{handle:{nodeId:k,id:S,type:t},connectionMode:M,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:ee,flowId:re,doc:ae,lib:te,nodeLookup:le});we&&ce&&U(ce);const _e=structuredClone(ue);delete _e.inProgress,_e.toPosition=_e.toHandle?_e.toHandle.position:null,L==null||L(Y,_e),w.setState({connectionClickStartHandle:null})};return A.jsx("div",{"data-handleid":S,"data-nodeid":k,"data-handlepos":r,"data-id":`${C}-${k}-${S}-${t}`,className:be(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",N,g,{source:!_,target:_,connectable:s,connectablestart:u,connectableend:a,clickconnecting:H,connectingfrom:j,connectingto:D,valid:W,connectionindicator:s&&(!X||B)&&(X||J?a:u)}]),onMouseDown:Z,onTouchStart:Z,onClick:P?z:void 0,ref:x,...y,children:p})}const Zt=q.memo(R0(M2));function P2({data:t,isConnectable:r,sourcePosition:i=me.Bottom}){return A.jsxs(A.Fragment,{children:[t==null?void 0:t.label,A.jsx(Zt,{type:"source",position:i,isConnectable:r})]})}function z2({data:t,isConnectable:r,targetPosition:i=me.Top,sourcePosition:s=me.Bottom}){return A.jsxs(A.Fragment,{children:[A.jsx(Zt,{type:"target",position:i,isConnectable:r}),t==null?void 0:t.label,A.jsx(Zt,{type:"source",position:s,isConnectable:r})]})}function I2(){return null}function T2({data:t,isConnectable:r,targetPosition:i=me.Top}){return A.jsxs(A.Fragment,{children:[A.jsx(Zt,{type:"target",position:i,isConnectable:r}),t==null?void 0:t.label]})}const xl={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Kh={input:P2,default:z2,output:T2,group:I2};function A2(t){var r,i,s,u;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((r=t.style)==null?void 0:r.width),height:t.height??t.initialHeight??((i=t.style)==null?void 0:i.height)}:{width:t.width??((s=t.style)==null?void 0:s.width),height:t.height??((u=t.style)==null?void 0:u.height)}}const L2=t=>{const{width:r,height:i,x:s,y:u}=Ei(t.nodeLookup,{filter:a=>!!a.selected});return{width:Vt(r)?r:null,height:Vt(i)?i:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${s}px,${u}px)`}};function R2({onSelectionContextMenu:t,noPanClassName:r,disableKeyboardA11y:i}){const s=je(),{width:u,height:a,transformString:c,userSelectionActive:d}=Ne(L2,De),p=j0(),g=q.useRef(null);q.useEffect(()=>{var x;i||(x=g.current)==null||x.focus({preventScroll:!0})},[i]);const v=!d&&u!==null&&a!==null;if($0({nodeRef:g,disabled:!v}),!v)return null;const m=t?x=>{const S=s.getState().nodes.filter(_=>_.selected);t(x,S)}:void 0,y=x=>{Object.prototype.hasOwnProperty.call(xl,x.key)&&(x.preventDefault(),p({direction:xl[x.key],factor:x.shiftKey?4:1}))};return A.jsx("div",{className:be(["react-flow__nodesselection","react-flow__container",r]),style:{transform:c},children:A.jsx("div",{ref:g,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:i?void 0:-1,onKeyDown:i?void 0:y,style:{width:u,height:a}})})}const Gh=typeof window<"u"?window:void 0,D2=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function F0({children:t,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:s,onPaneMouseLeave:u,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:d,deleteKeyCode:p,selectionKeyCode:g,selectionOnDrag:v,selectionMode:m,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:w,elementsSelectable:k,zoomOnScroll:P,zoomOnPinch:N,panOnScroll:C,panOnScrollSpeed:j,panOnScrollMode:D,zoomOnDoubleClick:H,panOnDrag:B,defaultViewport:X,translateExtent:J,minZoom:W,maxZoom:U,preventScrolling:Z,onSelectionContextMenu:z,noWheelClassName:b,noPanClassName:F,disableKeyboardA11y:Y,onViewportChange:T,isControlledViewport:L}){const{nodesSelectionActive:V,userSelectionActive:M}=Ne(D2,De),R=yi(g,{target:Gh}),te=yi(_,{target:Gh}),re=te||B,le=te||C,ue=v&&re!==!0,ae=R||M||ue;return g2({deleteKeyCode:p,multiSelectionKeyCode:S}),A.jsx(v2,{onPaneContextMenu:a,elementsSelectable:k,zoomOnScroll:P,zoomOnPinch:N,panOnScroll:le,panOnScrollSpeed:j,panOnScrollMode:D,zoomOnDoubleClick:H,panOnDrag:!R&&re,defaultViewport:X,translateExtent:J,minZoom:W,maxZoom:U,zoomActivationKeyCode:w,preventScrolling:Z,noWheelClassName:b,noPanClassName:F,onViewportChange:T,isControlledViewport:L,paneClickDistance:d,selectionOnDrag:ue,children:A.jsxs(_2,{onSelectionStart:y,onSelectionEnd:x,onPaneClick:r,onPaneMouseEnter:i,onPaneMouseMove:s,onPaneMouseLeave:u,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:re,isSelecting:!!ae,selectionMode:m,selectionKeyPressed:R,paneClickDistance:d,selectionOnDrag:ue,children:[t,V&&A.jsx(R2,{onSelectionContextMenu:z,noPanClassName:F,disableKeyboardA11y:Y})]})})}F0.displayName="FlowRenderer";const $2=q.memo(F0),j2=t=>r=>t?cc(r.nodeLookup,{x:0,y:0,width:r.width,height:r.height},r.transform,!0).map(i=>i.id):Array.from(r.nodeLookup.keys());function O2(t){return Ne(q.useCallback(j2(t),[t]),De)}const F2=t=>t.updateNodeInternals;function H2(){const t=Ne(F2),[r]=q.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const s=new Map;i.forEach(u=>{const a=u.target.getAttribute("data-id");s.set(a,{id:a,nodeElement:u.target,force:!0})}),t(s)}));return q.useEffect(()=>()=>{r==null||r.disconnect()},[r]),r}function V2({node:t,nodeType:r,hasDimensions:i,resizeObserver:s}){const u=je(),a=q.useRef(null),c=q.useRef(null),d=q.useRef(t.sourcePosition),p=q.useRef(t.targetPosition),g=q.useRef(r),v=i&&!!t.internals.handleBounds;return q.useEffect(()=>{a.current&&!t.hidden&&(!v||c.current!==a.current)&&(c.current&&(s==null||s.unobserve(c.current)),s==null||s.observe(a.current),c.current=a.current)},[v,t.hidden]),q.useEffect(()=>()=>{c.current&&(s==null||s.unobserve(c.current),c.current=null)},[]),q.useEffect(()=>{if(a.current){const m=g.current!==r,y=d.current!==t.sourcePosition,x=p.current!==t.targetPosition;(m||y||x)&&(g.current=r,d.current=t.sourcePosition,p.current=t.targetPosition,u.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}},[t.id,r,t.sourcePosition,t.targetPosition]),a}function B2({id:t,onClick:r,onMouseEnter:i,onMouseMove:s,onMouseLeave:u,onContextMenu:a,onDoubleClick:c,nodesDraggable:d,elementsSelectable:p,nodesConnectable:g,nodesFocusable:v,resizeObserver:m,noDragClassName:y,noPanClassName:x,disableKeyboardA11y:S,rfId:_,nodeTypes:w,nodeClickDistance:k,onError:P}){const{node:N,internals:C,isParent:j}=Ne(ee=>{const ce=ee.nodeLookup.get(t),we=ee.parentLookup.has(t);return{node:ce,internals:ce.internals,isParent:we}},De);let D=N.type||"default",H=(w==null?void 0:w[D])||Kh[D];H===void 0&&(P==null||P("003",Jt.error003(D)),D="default",H=(w==null?void 0:w.default)||Kh.default);const B=!!(N.draggable||d&&typeof N.draggable>"u"),X=!!(N.selectable||p&&typeof N.selectable>"u"),J=!!(N.connectable||g&&typeof N.connectable>"u"),W=!!(N.focusable||v&&typeof N.focusable>"u"),U=je(),Z=s0(N),z=V2({node:N,nodeType:D,hasDimensions:Z,resizeObserver:m}),b=$0({nodeRef:z,disabled:N.hidden||!B,noDragClassName:y,handleSelector:N.dragHandle,nodeId:t,isSelectable:X,nodeClickDistance:k}),F=j0();if(N.hidden)return null;const Y=yn(N),T=A2(N),L=X||B||r||i||s||u,V=i?ee=>i(ee,{...C.userNode}):void 0,M=s?ee=>s(ee,{...C.userNode}):void 0,R=u?ee=>u(ee,{...C.userNode}):void 0,te=a?ee=>a(ee,{...C.userNode}):void 0,re=c?ee=>c(ee,{...C.userNode}):void 0,le=ee=>{const{selectNodesOnDrag:ce,nodeDragThreshold:we}=U.getState();X&&(!ce||!B||we>0)&&Ja({id:t,store:U,nodeRef:z}),r&&r(ee,{...C.userNode})},ue=ee=>{if(!(a0(ee.nativeEvent)||S)){if(Zp.includes(ee.key)&&X){const ce=ee.key==="Escape";Ja({id:t,store:U,unselect:ce,nodeRef:z})}else if(B&&N.selected&&Object.prototype.hasOwnProperty.call(xl,ee.key)){ee.preventDefault();const{ariaLabelConfig:ce}=U.getState();U.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:ee.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),F({direction:xl[ee.key],factor:ee.shiftKey?4:1})}}},ae=()=>{var Ce;if(S||!((Ce=z.current)!=null&&Ce.matches(":focus-visible")))return;const{transform:ee,width:ce,height:we,autoPanOnNodeFocus:_e,setCenter:Se}=U.getState();if(!_e)return;cc(new Map([[t,N]]),{x:0,y:0,width:ce,height:we},ee,!0).length>0||Se(N.position.x+Y.width/2,N.position.y+Y.height/2,{zoom:ee[2]})};return A.jsx("div",{className:be(["react-flow__node",`react-flow__node-${D}`,{[x]:B},N.className,{selected:N.selected,selectable:X,parent:j,draggable:B,dragging:b}]),ref:z,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:L?"all":"none",visibility:Z?"visible":"hidden",...N.style,...T},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:V,onMouseMove:M,onMouseLeave:R,onContextMenu:te,onClick:le,onDoubleClick:re,onKeyDown:W?ue:void 0,tabIndex:W?0:void 0,onFocus:W?ae:void 0,role:N.ariaRole??(W?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${P0}-${_}`,"aria-label":N.ariaLabel,...N.domAttributes,children:A.jsx(k2,{value:t,children:A.jsx(H,{id:t,data:N.data,type:D,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:N.selected??!1,selectable:X,draggable:B,deletable:N.deletable??!0,isConnectable:J,sourcePosition:N.sourcePosition,targetPosition:N.targetPosition,dragging:b,dragHandle:N.dragHandle,zIndex:C.z,parentId:N.parentId,...Y})})})}var W2=q.memo(B2);const U2=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function H0(t){const{nodesDraggable:r,nodesConnectable:i,nodesFocusable:s,elementsSelectable:u,onError:a}=Ne(U2,De),c=O2(t.onlyRenderVisibleElements),d=H2();return A.jsx("div",{className:"react-flow__nodes",style:Pl,children:c.map(p=>A.jsx(W2,{id:p,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:d,nodesDraggable:r,nodesConnectable:i,nodesFocusable:s,elementsSelectable:u,nodeClickDistance:t.nodeClickDistance,onError:a},p))})}H0.displayName="NodeRenderer";const b2=q.memo(H0);function Y2(t){return Ne(q.useCallback(i=>{if(!t)return i.edges.map(u=>u.id);const s=[];if(i.width&&i.height)for(const u of i.edges){const a=i.nodeLookup.get(u.source),c=i.nodeLookup.get(u.target);a&&c&&Ux({sourceNode:a,targetNode:c,width:i.width,height:i.height,transform:i.transform})&&s.push(u.id)}return s},[t]),De)}const X2=({color:t="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...t&&{stroke:t}};return A.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Q2=({color:t="none",strokeWidth:r=1})=>{const i={strokeWidth:r,...t&&{stroke:t,fill:t}};return A.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Zh={[oo.Arrow]:X2,[oo.ArrowClosed]:Q2};function K2(t){const r=je();return q.useMemo(()=>{var u,a;return Object.prototype.hasOwnProperty.call(Zh,t)?Zh[t]:((a=(u=r.getState()).onError)==null||a.call(u,"009",Jt.error009(t)),null)},[t])}const G2=({id:t,type:r,color:i,width:s=12.5,height:u=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:d="auto-start-reverse"})=>{const p=K2(r);return p?A.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${s}`,markerHeight:`${u}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:d,refX:"0",refY:"0",children:A.jsx(p,{color:i,strokeWidth:c})}):null},V0=({defaultColor:t,rfId:r})=>{const i=Ne(a=>a.edges),s=Ne(a=>a.defaultEdgeOptions),u=q.useMemo(()=>qx(i,{id:r,defaultColor:t,defaultMarkerStart:s==null?void 0:s.markerStart,defaultMarkerEnd:s==null?void 0:s.markerEnd}),[i,s,r,t]);return u.length?A.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:A.jsx("defs",{children:u.map(a=>A.jsx(G2,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};V0.displayName="MarkerDefinitions";var Z2=q.memo(V0);function B0({x:t,y:r,label:i,labelStyle:s,labelShowBg:u=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:d=2,children:p,className:g,...v}){const[m,y]=q.useState({x:1,y:0,width:0,height:0}),x=be(["react-flow__edge-textwrapper",g]),S=q.useRef(null);return q.useEffect(()=>{if(S.current){const _=S.current.getBBox();y({x:_.x,y:_.y,width:_.width,height:_.height})}},[i]),i?A.jsxs("g",{transform:`translate(${t-m.width/2} ${r-m.height/2})`,className:x,visibility:m.width?"visible":"hidden",...v,children:[u&&A.jsx("rect",{width:m.width+2*c[0],x:-c[0],y:-c[1],height:m.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:d,ry:d}),A.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:S,style:s,children:i}),p]}):null}B0.displayName="EdgeText";const q2=q.memo(B0);function ao({path:t,labelX:r,labelY:i,label:s,labelStyle:u,labelShowBg:a,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p,interactionWidth:g=20,...v}){return A.jsxs(A.Fragment,{children:[A.jsx("path",{...v,d:t,fill:"none",className:be(["react-flow__edge-path",v.className])}),g?A.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}):null,s&&Vt(r)&&Vt(i)?A.jsx(q2,{x:r,y:i,label:s,labelStyle:u,labelShowBg:a,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:p}):null]})}function qh({pos:t,x1:r,y1:i,x2:s,y2:u}){return t===me.Left||t===me.Right?[.5*(r+s),i]:[r,.5*(i+u)]}function W0({sourceX:t,sourceY:r,sourcePosition:i=me.Bottom,targetX:s,targetY:u,targetPosition:a=me.Top}){const[c,d]=qh({pos:i,x1:t,y1:r,x2:s,y2:u}),[p,g]=qh({pos:a,x1:s,y1:u,x2:t,y2:r}),[v,m,y,x]=f0({sourceX:t,sourceY:r,targetX:s,targetY:u,sourceControlX:c,sourceControlY:d,targetControlX:p,targetControlY:g});return[`M${t},${r} C${c},${d} ${p},${g} ${s},${u}`,v,m,y,x]}function U0(t){return q.memo(({id:r,sourceX:i,sourceY:s,targetX:u,targetY:a,sourcePosition:c,targetPosition:d,label:p,labelStyle:g,labelShowBg:v,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:x,style:S,markerEnd:_,markerStart:w,interactionWidth:k})=>{const[P,N,C]=W0({sourceX:i,sourceY:s,sourcePosition:c,targetX:u,targetY:a,targetPosition:d}),j=t.isInternal?void 0:r;return A.jsx(ao,{id:j,path:P,labelX:N,labelY:C,label:p,labelStyle:g,labelShowBg:v,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:x,style:S,markerEnd:_,markerStart:w,interactionWidth:k})})}const J2=U0({isInternal:!1}),b0=U0({isInternal:!0});J2.displayName="SimpleBezierEdge";b0.displayName="SimpleBezierEdgeInternal";function Y0(t){return q.memo(({id:r,sourceX:i,sourceY:s,targetX:u,targetY:a,label:c,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:m,style:y,sourcePosition:x=me.Bottom,targetPosition:S=me.Top,markerEnd:_,markerStart:w,pathOptions:k,interactionWidth:P})=>{const[N,C,j]=Qa({sourceX:i,sourceY:s,sourcePosition:x,targetX:u,targetY:a,targetPosition:S,borderRadius:k==null?void 0:k.borderRadius,offset:k==null?void 0:k.offset,stepPosition:k==null?void 0:k.stepPosition}),D=t.isInternal?void 0:r;return A.jsx(ao,{id:D,path:N,labelX:C,labelY:j,label:c,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:m,style:y,markerEnd:_,markerStart:w,interactionWidth:P})})}const X0=Y0({isInternal:!1}),Q0=Y0({isInternal:!0});X0.displayName="SmoothStepEdge";Q0.displayName="SmoothStepEdgeInternal";function K0(t){return q.memo(({id:r,...i})=>{var u;const s=t.isInternal?void 0:r;return A.jsx(X0,{...i,id:s,pathOptions:q.useMemo(()=>{var a;return{borderRadius:0,offset:(a=i.pathOptions)==null?void 0:a.offset}},[(u=i.pathOptions)==null?void 0:u.offset])})})}const eS=K0({isInternal:!1}),G0=K0({isInternal:!0});eS.displayName="StepEdge";G0.displayName="StepEdgeInternal";function Z0(t){return q.memo(({id:r,sourceX:i,sourceY:s,targetX:u,targetY:a,label:c,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:m,style:y,markerEnd:x,markerStart:S,interactionWidth:_})=>{const[w,k,P]=p0({sourceX:i,sourceY:s,targetX:u,targetY:a}),N=t.isInternal?void 0:r;return A.jsx(ao,{id:N,path:w,labelX:k,labelY:P,label:c,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:m,style:y,markerEnd:x,markerStart:S,interactionWidth:_})})}const tS=Z0({isInternal:!1}),q0=Z0({isInternal:!0});tS.displayName="StraightEdge";q0.displayName="StraightEdgeInternal";function J0(t){return q.memo(({id:r,sourceX:i,sourceY:s,targetX:u,targetY:a,sourcePosition:c=me.Bottom,targetPosition:d=me.Top,label:p,labelStyle:g,labelShowBg:v,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:x,style:S,markerEnd:_,markerStart:w,pathOptions:k,interactionWidth:P})=>{const[N,C,j]=d0({sourceX:i,sourceY:s,sourcePosition:c,targetX:u,targetY:a,targetPosition:d,curvature:k==null?void 0:k.curvature}),D=t.isInternal?void 0:r;return A.jsx(ao,{id:D,path:N,labelX:C,labelY:j,label:p,labelStyle:g,labelShowBg:v,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:x,style:S,markerEnd:_,markerStart:w,interactionWidth:P})})}const nS=J0({isInternal:!1}),eg=J0({isInternal:!0});nS.displayName="BezierEdge";eg.displayName="BezierEdgeInternal";const Jh={default:eg,straight:q0,step:G0,smoothstep:Q0,simplebezier:b0},ep={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},rS=(t,r,i)=>i===me.Left?t-r:i===me.Right?t+r:t,oS=(t,r,i)=>i===me.Top?t-r:i===me.Bottom?t+r:t,tp="react-flow__edgeupdater";function np({position:t,centerX:r,centerY:i,radius:s=10,onMouseDown:u,onMouseEnter:a,onMouseOut:c,type:d}){return A.jsx("circle",{onMouseDown:u,onMouseEnter:a,onMouseOut:c,className:be([tp,`${tp}-${d}`]),cx:rS(r,s,t),cy:oS(i,s,t),r:s,stroke:"transparent",fill:"transparent"})}function iS({isReconnectable:t,reconnectRadius:r,edge:i,sourceX:s,sourceY:u,targetX:a,targetY:c,sourcePosition:d,targetPosition:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:m,setReconnecting:y,setUpdateHover:x}){const S=je(),_=(C,j)=>{if(C.button!==0)return;const{autoPanOnConnect:D,domNode:H,connectionMode:B,connectionRadius:X,lib:J,onConnectStart:W,cancelConnection:U,nodeLookup:Z,rfId:z,panBy:b,updateConnection:F}=S.getState(),Y=j.type==="target",T=(M,R)=>{y(!1),m==null||m(M,i,j.type,R)},L=M=>g==null?void 0:g(i,M),V=(M,R)=>{y(!0),v==null||v(C,i,j.type),W==null||W(M,R)};Za.onPointerDown(C.nativeEvent,{autoPanOnConnect:D,connectionMode:B,connectionRadius:X,domNode:H,handleId:j.id,nodeId:j.nodeId,nodeLookup:Z,isTarget:Y,edgeUpdaterType:j.type,lib:J,flowId:z,cancelConnection:U,panBy:b,isValidConnection:(...M)=>{var R,te;return((te=(R=S.getState()).isValidConnection)==null?void 0:te.call(R,...M))??!0},onConnect:L,onConnectStart:V,onConnectEnd:(...M)=>{var R,te;return(te=(R=S.getState()).onConnectEnd)==null?void 0:te.call(R,...M)},onReconnectEnd:T,updateConnection:F,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},w=C=>_(C,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),k=C=>_(C,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),P=()=>x(!0),N=()=>x(!1);return A.jsxs(A.Fragment,{children:[(t===!0||t==="source")&&A.jsx(np,{position:d,centerX:s,centerY:u,radius:r,onMouseDown:w,onMouseEnter:P,onMouseOut:N,type:"source"}),(t===!0||t==="target")&&A.jsx(np,{position:p,centerX:a,centerY:c,radius:r,onMouseDown:k,onMouseEnter:P,onMouseOut:N,type:"target"})]})}function sS({id:t,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:s,onClick:u,onDoubleClick:a,onContextMenu:c,onMouseEnter:d,onMouseMove:p,onMouseLeave:g,reconnectRadius:v,onReconnect:m,onReconnectStart:y,onReconnectEnd:x,rfId:S,edgeTypes:_,noPanClassName:w,onError:k,disableKeyboardA11y:P}){let N=Ne(Se=>Se.edgeLookup.get(t));const C=Ne(Se=>Se.defaultEdgeOptions);N=C?{...C,...N}:N;let j=N.type||"default",D=(_==null?void 0:_[j])||Jh[j];D===void 0&&(k==null||k("011",Jt.error011(j)),j="default",D=(_==null?void 0:_.default)||Jh.default);const H=!!(N.focusable||r&&typeof N.focusable>"u"),B=typeof m<"u"&&(N.reconnectable||i&&typeof N.reconnectable>"u"),X=!!(N.selectable||s&&typeof N.selectable>"u"),J=q.useRef(null),[W,U]=q.useState(!1),[Z,z]=q.useState(!1),b=je(),{zIndex:F,sourceX:Y,sourceY:T,targetX:L,targetY:V,sourcePosition:M,targetPosition:R}=Ne(q.useCallback(Se=>{const ye=Se.nodeLookup.get(N.source),Ce=Se.nodeLookup.get(N.target);if(!ye||!Ce)return{zIndex:N.zIndex,...ep};const Te=Zx({id:t,sourceNode:ye,targetNode:Ce,sourceHandle:N.sourceHandle||null,targetHandle:N.targetHandle||null,connectionMode:Se.connectionMode,onError:k});return{zIndex:Wx({selected:N.selected,zIndex:N.zIndex,sourceNode:ye,targetNode:Ce,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...Te||ep}},[N.source,N.target,N.sourceHandle,N.targetHandle,N.selected,N.zIndex]),De),te=q.useMemo(()=>N.markerStart?`url('#${Ka(N.markerStart,S)}')`:void 0,[N.markerStart,S]),re=q.useMemo(()=>N.markerEnd?`url('#${Ka(N.markerEnd,S)}')`:void 0,[N.markerEnd,S]);if(N.hidden||Y===null||T===null||L===null||V===null)return null;const le=Se=>{var Me;const{addSelectedEdges:ye,unselectNodesAndEdges:Ce,multiSelectionActive:Te}=b.getState();X&&(b.setState({nodesSelectionActive:!1}),N.selected&&Te?(Ce({nodes:[],edges:[N]}),(Me=J.current)==null||Me.blur()):ye([t])),u&&u(Se,N)},ue=a?Se=>{a(Se,{...N})}:void 0,ae=c?Se=>{c(Se,{...N})}:void 0,ee=d?Se=>{d(Se,{...N})}:void 0,ce=p?Se=>{p(Se,{...N})}:void 0,we=g?Se=>{g(Se,{...N})}:void 0,_e=Se=>{var ye;if(!P&&Zp.includes(Se.key)&&X){const{unselectNodesAndEdges:Ce,addSelectedEdges:Te}=b.getState();Se.key==="Escape"?((ye=J.current)==null||ye.blur(),Ce({edges:[N]})):Te([t])}};return A.jsx("svg",{style:{zIndex:F},children:A.jsxs("g",{className:be(["react-flow__edge",`react-flow__edge-${j}`,N.className,w,{selected:N.selected,animated:N.animated,inactive:!X&&!u,updating:W,selectable:X}]),onClick:le,onDoubleClick:ue,onContextMenu:ae,onMouseEnter:ee,onMouseMove:ce,onMouseLeave:we,onKeyDown:H?_e:void 0,tabIndex:H?0:void 0,role:N.ariaRole??(H?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":N.ariaLabel===null?void 0:N.ariaLabel||`Edge from ${N.source} to ${N.target}`,"aria-describedby":H?`${z0}-${S}`:void 0,ref:J,...N.domAttributes,children:[!Z&&A.jsx(D,{id:t,source:N.source,target:N.target,type:N.type,selected:N.selected,animated:N.animated,selectable:X,deletable:N.deletable??!0,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,sourceX:Y,sourceY:T,targetX:L,targetY:V,sourcePosition:M,targetPosition:R,data:N.data,style:N.style,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerStart:te,markerEnd:re,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth}),B&&A.jsx(iS,{edge:N,isReconnectable:B,reconnectRadius:v,onReconnect:m,onReconnectStart:y,onReconnectEnd:x,sourceX:Y,sourceY:T,targetX:L,targetY:V,sourcePosition:M,targetPosition:R,setUpdateHover:U,setReconnecting:z})]})})}var lS=q.memo(sS);const uS=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function tg({defaultMarkerColor:t,onlyRenderVisibleElements:r,rfId:i,edgeTypes:s,noPanClassName:u,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:d,onEdgeMouseMove:p,onEdgeMouseLeave:g,onEdgeClick:v,reconnectRadius:m,onEdgeDoubleClick:y,onReconnectStart:x,onReconnectEnd:S,disableKeyboardA11y:_}){const{edgesFocusable:w,edgesReconnectable:k,elementsSelectable:P,onError:N}=Ne(uS,De),C=Y2(r);return A.jsxs("div",{className:"react-flow__edges",children:[A.jsx(Z2,{defaultColor:t,rfId:i}),C.map(j=>A.jsx(lS,{id:j,edgesFocusable:w,edgesReconnectable:k,elementsSelectable:P,noPanClassName:u,onReconnect:a,onContextMenu:c,onMouseEnter:d,onMouseMove:p,onMouseLeave:g,onClick:v,reconnectRadius:m,onDoubleClick:y,onReconnectStart:x,onReconnectEnd:S,rfId:i,onError:N,edgeTypes:s,disableKeyboardA11y:_},j))]})}tg.displayName="EdgeRenderer";const aS=q.memo(tg),cS=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function fS({children:t}){const r=Ne(cS);return A.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:r},children:t})}function dS(t){const r=Mi(),i=q.useRef(!1);q.useEffect(()=>{!i.current&&r.viewportInitialized&&t&&(setTimeout(()=>t(r),1),i.current=!0)},[t,r.viewportInitialized])}const hS=t=>{var r;return(r=t.panZoom)==null?void 0:r.syncViewport};function pS(t){const r=Ne(hS),i=je();return q.useEffect(()=>{t&&(r==null||r(t),i.setState({transform:[t.x,t.y,t.zoom]}))},[t,r]),null}function gS(t){return t.connection.inProgress?{...t.connection,to:Ni(t.connection.to,t.transform)}:{...t.connection}}function mS(t){return gS}function yS(t){const r=mS();return Ne(r,De)}const vS=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function xS({containerStyle:t,style:r,type:i,component:s}){const{nodesConnectable:u,width:a,height:c,isValid:d,inProgress:p}=Ne(vS,De);return!(a&&u&&p)?null:A.jsx("svg",{style:t,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:A.jsx("g",{className:be(["react-flow__connection",e0(d)]),children:A.jsx(ng,{style:r,type:i,CustomComponent:s,isValid:d})})})}const ng=({style:t,type:r=Bn.Bezier,CustomComponent:i,isValid:s})=>{const{inProgress:u,from:a,fromNode:c,fromHandle:d,fromPosition:p,to:g,toNode:v,toHandle:m,toPosition:y,pointer:x}=yS();if(!u)return;if(i)return A.jsx(i,{connectionLineType:r,connectionLineStyle:t,fromNode:c,fromHandle:d,fromX:a.x,fromY:a.y,toX:g.x,toY:g.y,fromPosition:p,toPosition:y,connectionStatus:e0(s),toNode:v,toHandle:m,pointer:x});let S="";const _={sourceX:a.x,sourceY:a.y,sourcePosition:p,targetX:g.x,targetY:g.y,targetPosition:y};switch(r){case Bn.Bezier:[S]=d0(_);break;case Bn.SimpleBezier:[S]=W0(_);break;case Bn.Step:[S]=Qa({..._,borderRadius:0});break;case Bn.SmoothStep:[S]=Qa(_);break;default:[S]=p0(_)}return A.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:t})};ng.displayName="ConnectionLine";const wS={};function rp(t=wS){q.useRef(t),je(),q.useEffect(()=>{},[t])}function SS(){je(),q.useRef(!1),q.useEffect(()=>{},[])}function rg({nodeTypes:t,edgeTypes:r,onInit:i,onNodeClick:s,onEdgeClick:u,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:d,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:v,onSelectionContextMenu:m,onSelectionStart:y,onSelectionEnd:x,connectionLineType:S,connectionLineStyle:_,connectionLineComponent:w,connectionLineContainerStyle:k,selectionKeyCode:P,selectionOnDrag:N,selectionMode:C,multiSelectionKeyCode:j,panActivationKeyCode:D,zoomActivationKeyCode:H,deleteKeyCode:B,onlyRenderVisibleElements:X,elementsSelectable:J,defaultViewport:W,translateExtent:U,minZoom:Z,maxZoom:z,preventScrolling:b,defaultMarkerColor:F,zoomOnScroll:Y,zoomOnPinch:T,panOnScroll:L,panOnScrollSpeed:V,panOnScrollMode:M,zoomOnDoubleClick:R,panOnDrag:te,onPaneClick:re,onPaneMouseEnter:le,onPaneMouseMove:ue,onPaneMouseLeave:ae,onPaneScroll:ee,onPaneContextMenu:ce,paneClickDistance:we,nodeClickDistance:_e,onEdgeContextMenu:Se,onEdgeMouseEnter:ye,onEdgeMouseMove:Ce,onEdgeMouseLeave:Te,reconnectRadius:Me,onReconnect:We,onReconnectStart:At,onReconnectEnd:gt,noDragClassName:mt,noWheelClassName:kt,noPanClassName:tn,disableKeyboardA11y:vn,nodeExtent:xr,rfId:bn,viewport:nn,onViewportChange:rn}){return rp(t),rp(r),SS(),dS(i),pS(nn),A.jsx($2,{onPaneClick:re,onPaneMouseEnter:le,onPaneMouseMove:ue,onPaneMouseLeave:ae,onPaneContextMenu:ce,onPaneScroll:ee,paneClickDistance:we,deleteKeyCode:B,selectionKeyCode:P,selectionOnDrag:N,selectionMode:C,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:j,panActivationKeyCode:D,zoomActivationKeyCode:H,elementsSelectable:J,zoomOnScroll:Y,zoomOnPinch:T,zoomOnDoubleClick:R,panOnScroll:L,panOnScrollSpeed:V,panOnScrollMode:M,panOnDrag:te,defaultViewport:W,translateExtent:U,minZoom:Z,maxZoom:z,onSelectionContextMenu:m,preventScrolling:b,noDragClassName:mt,noWheelClassName:kt,noPanClassName:tn,disableKeyboardA11y:vn,onViewportChange:rn,isControlledViewport:!!nn,children:A.jsxs(fS,{children:[A.jsx(aS,{edgeTypes:r,onEdgeClick:u,onEdgeDoubleClick:c,onReconnect:We,onReconnectStart:At,onReconnectEnd:gt,onlyRenderVisibleElements:X,onEdgeContextMenu:Se,onEdgeMouseEnter:ye,onEdgeMouseMove:Ce,onEdgeMouseLeave:Te,reconnectRadius:Me,defaultMarkerColor:F,noPanClassName:tn,disableKeyboardA11y:vn,rfId:bn}),A.jsx(xS,{style:_,type:S,component:w,containerStyle:k}),A.jsx("div",{className:"react-flow__edgelabel-renderer"}),A.jsx(b2,{nodeTypes:t,onNodeClick:s,onNodeDoubleClick:a,onNodeMouseEnter:d,onNodeMouseMove:p,onNodeMouseLeave:g,onNodeContextMenu:v,nodeClickDistance:_e,onlyRenderVisibleElements:X,noPanClassName:tn,noDragClassName:mt,disableKeyboardA11y:vn,nodeExtent:xr,rfId:bn}),A.jsx("div",{className:"react-flow__viewport-portal"})]})})}rg.displayName="GraphView";const _S=q.memo(rg),op=({nodes:t,edges:r,defaultNodes:i,defaultEdges:s,width:u,height:a,fitView:c,fitViewOptions:d,minZoom:p=.5,maxZoom:g=2,nodeOrigin:v,nodeExtent:m,zIndexMode:y="basic"}={})=>{const x=new Map,S=new Map,_=new Map,w=new Map,k=s??r??[],P=i??t??[],N=v??[0,0],C=m??hi;y0(_,w,k);const{nodesInitialized:j}=Ga(P,x,S,{nodeOrigin:N,nodeExtent:C,zIndexMode:y});let D=[0,0,1];if(c&&u&&a){const H=Ei(x,{filter:W=>!!((W.width||W.initialWidth)&&(W.height||W.initialHeight))}),{x:B,y:X,zoom:J}=fc(H,u,a,p,g,(d==null?void 0:d.padding)??.1);D=[B,X,J]}return{rfId:"1",width:u??0,height:a??0,transform:D,nodes:P,nodesInitialized:j,nodeLookup:x,parentLookup:S,edges:k,edgeLookup:w,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:s!==void 0,panZoom:null,minZoom:p,maxZoom:g,translateExtent:hi,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ro.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:d,fitViewResolver:null,connection:{...Jp},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jx,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:qp,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},ES=({nodes:t,edges:r,defaultNodes:i,defaultEdges:s,width:u,height:a,fitView:c,fitViewOptions:d,minZoom:p,maxZoom:g,nodeOrigin:v,nodeExtent:m,zIndexMode:y})=>Vw((x,S)=>{async function _(){const{nodeLookup:w,panZoom:k,fitViewOptions:P,fitViewResolver:N,width:C,height:j,minZoom:D,maxZoom:H}=S();k&&(await Dx({nodes:w,width:C,height:j,panZoom:k,minZoom:D,maxZoom:H},P),N==null||N.resolve(!0),x({fitViewResolver:null}))}return{...op({nodes:t,edges:r,width:u,height:a,fitView:c,fitViewOptions:d,minZoom:p,maxZoom:g,nodeOrigin:v,nodeExtent:m,defaultNodes:i,defaultEdges:s,zIndexMode:y}),setNodes:w=>{const{nodeLookup:k,parentLookup:P,nodeOrigin:N,elevateNodesOnSelect:C,fitViewQueued:j,zIndexMode:D,nodesSelectionActive:H}=S(),{nodesInitialized:B,hasSelectedNodes:X}=Ga(w,k,P,{nodeOrigin:N,nodeExtent:m,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:D}),J=H&&X;j&&B?(_(),x({nodes:w,nodesInitialized:B,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:J})):x({nodes:w,nodesInitialized:B,nodesSelectionActive:J})},setEdges:w=>{const{connectionLookup:k,edgeLookup:P}=S();y0(k,P,w),x({edges:w})},setDefaultNodesAndEdges:(w,k)=>{if(w){const{setNodes:P}=S();P(w),x({hasDefaultNodes:!0})}if(k){const{setEdges:P}=S();P(k),x({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:k,nodeLookup:P,parentLookup:N,domNode:C,nodeOrigin:j,nodeExtent:D,debug:H,fitViewQueued:B,zIndexMode:X}=S(),{changes:J,updatedInternals:W}=iw(w,P,N,C,j,D,X);W&&(tw(P,N,{nodeOrigin:j,nodeExtent:D,zIndexMode:X}),B?(_(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),(J==null?void 0:J.length)>0&&(H&&console.log("React Flow: trigger node changes",J),k==null||k(J)))},updateNodePositions:(w,k=!1)=>{const P=[];let N=[];const{nodeLookup:C,triggerNodeChanges:j,connection:D,updateConnection:H,onNodesChangeMiddlewareMap:B}=S();for(const[X,J]of w){const W=C.get(X),U=!!(W!=null&&W.expandParent&&(W!=null&&W.parentId)&&(J!=null&&J.position)),Z={id:X,type:"position",position:U?{x:Math.max(0,J.position.x),y:Math.max(0,J.position.y)}:J.position,dragging:k};if(W&&D.inProgress&&D.fromNode.id===W.id){const z=vr(W,D.fromHandle,me.Left,!0);H({...D,from:z})}U&&W.parentId&&P.push({id:X,parentId:W.parentId,rect:{...J.internals.positionAbsolute,width:J.measured.width??0,height:J.measured.height??0}}),N.push(Z)}if(P.length>0){const{parentLookup:X,nodeOrigin:J}=S(),W=yc(P,C,X,J);N.push(...W)}for(const X of B.values())N=X(N);j(N)},triggerNodeChanges:w=>{const{onNodesChange:k,setNodes:P,nodes:N,hasDefaultNodes:C,debug:j}=S();if(w!=null&&w.length){if(C){const D=A0(w,N);P(D)}j&&console.log("React Flow: trigger node changes",w),k==null||k(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:k,setEdges:P,edges:N,hasDefaultEdges:C,debug:j}=S();if(w!=null&&w.length){if(C){const D=L0(w,N);P(D)}j&&console.log("React Flow: trigger edge changes",w),k==null||k(w)}},addSelectedNodes:w=>{const{multiSelectionActive:k,edgeLookup:P,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:j}=S();if(k){const D=w.map(H=>fr(H,!0));C(D);return}C(Zr(N,new Set([...w]),!0)),j(Zr(P))},addSelectedEdges:w=>{const{multiSelectionActive:k,edgeLookup:P,nodeLookup:N,triggerNodeChanges:C,triggerEdgeChanges:j}=S();if(k){const D=w.map(H=>fr(H,!0));j(D);return}j(Zr(P,new Set([...w]))),C(Zr(N,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:k}={})=>{const{edges:P,nodes:N,nodeLookup:C,triggerNodeChanges:j,triggerEdgeChanges:D}=S(),H=w||N,B=k||P,X=[];for(const W of H){if(!W.selected)continue;const U=C.get(W.id);U&&(U.selected=!1),X.push(fr(W.id,!1))}const J=[];for(const W of B)W.selected&&J.push(fr(W.id,!1));j(X),D(J)},setMinZoom:w=>{const{panZoom:k,maxZoom:P}=S();k==null||k.setScaleExtent([w,P]),x({minZoom:w})},setMaxZoom:w=>{const{panZoom:k,minZoom:P}=S();k==null||k.setScaleExtent([P,w]),x({maxZoom:w})},setTranslateExtent:w=>{var k;(k=S().panZoom)==null||k.setTranslateExtent(w),x({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:k,triggerNodeChanges:P,triggerEdgeChanges:N,elementsSelectable:C}=S();if(!C)return;const j=k.reduce((H,B)=>B.selected?[...H,fr(B.id,!1)]:H,[]),D=w.reduce((H,B)=>B.selected?[...H,fr(B.id,!1)]:H,[]);P(j),N(D)},setNodeExtent:w=>{const{nodes:k,nodeLookup:P,parentLookup:N,nodeOrigin:C,elevateNodesOnSelect:j,nodeExtent:D,zIndexMode:H}=S();w[0][0]===D[0][0]&&w[0][1]===D[0][1]&&w[1][0]===D[1][0]&&w[1][1]===D[1][1]||(Ga(k,P,N,{nodeOrigin:C,nodeExtent:w,elevateNodesOnSelect:j,checkEquality:!1,zIndexMode:H}),x({nodeExtent:w}))},panBy:w=>{const{transform:k,width:P,height:N,panZoom:C,translateExtent:j}=S();return sw({delta:w,panZoom:C,transform:k,translateExtent:j,width:P,height:N})},setCenter:async(w,k,P)=>{const{width:N,height:C,maxZoom:j,panZoom:D}=S();if(!D)return Promise.resolve(!1);const H=typeof(P==null?void 0:P.zoom)<"u"?P.zoom:j;return await D.setViewport({x:N/2-w*H,y:C/2-k*H,zoom:H},{duration:P==null?void 0:P.duration,ease:P==null?void 0:P.ease,interpolate:P==null?void 0:P.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...Jp}})},updateConnection:w=>{x({connection:w})},reset:()=>x({...op()})}},Object.is);function og({initialNodes:t,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:u,initialHeight:a,initialMinZoom:c,initialMaxZoom:d,initialFitViewOptions:p,fitView:g,nodeOrigin:v,nodeExtent:m,zIndexMode:y,children:x}){const[S]=q.useState(()=>ES({nodes:t,edges:r,defaultNodes:i,defaultEdges:s,width:u,height:a,fitView:g,minZoom:c,maxZoom:d,fitViewOptions:p,nodeOrigin:v,nodeExtent:m,zIndexMode:y}));return A.jsx(Ww,{value:S,children:A.jsx(f2,{children:x})})}function kS({children:t,nodes:r,edges:i,defaultNodes:s,defaultEdges:u,width:a,height:c,fitView:d,fitViewOptions:p,minZoom:g,maxZoom:v,nodeOrigin:m,nodeExtent:y,zIndexMode:x}){return q.useContext(Ml)?A.jsx(A.Fragment,{children:t}):A.jsx(og,{initialNodes:r,initialEdges:i,defaultNodes:s,defaultEdges:u,initialWidth:a,initialHeight:c,fitView:d,initialFitViewOptions:p,initialMinZoom:g,initialMaxZoom:v,nodeOrigin:m,nodeExtent:y,zIndexMode:x,children:t})}const NS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function CS({nodes:t,edges:r,defaultNodes:i,defaultEdges:s,className:u,nodeTypes:a,edgeTypes:c,onNodeClick:d,onEdgeClick:p,onInit:g,onMove:v,onMoveStart:m,onMoveEnd:y,onConnect:x,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:k,onNodeMouseEnter:P,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:j,onNodeDoubleClick:D,onNodeDragStart:H,onNodeDrag:B,onNodeDragStop:X,onNodesDelete:J,onEdgesDelete:W,onDelete:U,onSelectionChange:Z,onSelectionDragStart:z,onSelectionDrag:b,onSelectionDragStop:F,onSelectionContextMenu:Y,onSelectionStart:T,onSelectionEnd:L,onBeforeDelete:V,connectionMode:M,connectionLineType:R=Bn.Bezier,connectionLineStyle:te,connectionLineComponent:re,connectionLineContainerStyle:le,deleteKeyCode:ue="Backspace",selectionKeyCode:ae="Shift",selectionOnDrag:ee=!1,selectionMode:ce=pi.Full,panActivationKeyCode:we="Space",multiSelectionKeyCode:_e=mi()?"Meta":"Control",zoomActivationKeyCode:Se=mi()?"Meta":"Control",snapToGrid:ye,snapGrid:Ce,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:Me,nodesDraggable:We,autoPanOnNodeFocus:At,nodesConnectable:gt,nodesFocusable:mt,nodeOrigin:kt=I0,edgesFocusable:tn,edgesReconnectable:vn,elementsSelectable:xr=!0,defaultViewport:bn=n2,minZoom:nn=.5,maxZoom:rn=2,translateExtent:Yn=hi,preventScrolling:Pi=!0,nodeExtent:on,defaultMarkerColor:Xn="#b1b1b7",zoomOnScroll:zl=!0,zoomOnPinch:zi=!0,panOnScroll:Ii=!1,panOnScrollSpeed:Il=.5,panOnScrollMode:co=pr.Free,zoomOnDoubleClick:fo=!0,panOnDrag:ho=!0,onPaneClick:po,onPaneMouseEnter:go,onPaneMouseMove:xn,onPaneMouseLeave:wn,onPaneScroll:Ti,onPaneContextMenu:Ai,paneClickDistance:Li=1,nodeClickDistance:Ri=0,children:Di,onReconnect:mo,onReconnectStart:$i,onReconnectEnd:Qn,onEdgeContextMenu:yo,onEdgeDoubleClick:Kn,onEdgeMouseEnter:Tl,onEdgeMouseMove:Gn,onEdgeMouseLeave:wr,reconnectRadius:Sr=10,onNodesChange:vo,onEdgesChange:Al,noDragClassName:Ll="nodrag",noWheelClassName:Rl="nowheel",noPanClassName:Ut="nopan",fitView:xo,fitViewOptions:wo,connectOnClick:Dl,attributionPosition:ji,proOptions:Oi,defaultEdgeOptions:Fi,elevateNodesOnSelect:Hi=!0,elevateEdgesOnSelect:$l=!1,disableKeyboardA11y:Vi=!1,autoPanOnConnect:Oe,autoPanOnNodeDrag:jl,autoPanSpeed:So,connectionRadius:Bi,isValidConnection:_r,onError:Ol,style:Wi,id:Zn,nodeDragThreshold:Nt,connectionDragThreshold:Fl,viewport:yt,onViewportChange:Hl,width:Vl,height:Bl,colorMode:Er="light",debug:kr,onScroll:bt,ariaLabelConfig:Nr,zIndexMode:Ui="basic",...Wl},_o){const Cr=Zn||"1",Eo=s2(Er),qn=q.useCallback(bi=>{bi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bt==null||bt(bi)},[bt]);return A.jsx("div",{"data-testid":"rf__wrapper",...Wl,onScroll:qn,style:{...Wi,...NS},ref:_o,className:be(["react-flow",u,Eo]),id:Zn,role:"application",children:A.jsxs(kS,{nodes:t,edges:r,width:Vl,height:Bl,fitView:xo,fitViewOptions:wo,minZoom:nn,maxZoom:rn,nodeOrigin:kt,nodeExtent:on,zIndexMode:Ui,children:[A.jsx(i2,{nodes:t,edges:r,defaultNodes:i,defaultEdges:s,onConnect:x,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:k,nodesDraggable:We,autoPanOnNodeFocus:At,nodesConnectable:gt,nodesFocusable:mt,edgesFocusable:tn,edgesReconnectable:vn,elementsSelectable:xr,elevateNodesOnSelect:Hi,elevateEdgesOnSelect:$l,minZoom:nn,maxZoom:rn,nodeExtent:on,onNodesChange:vo,onEdgesChange:Al,snapToGrid:ye,snapGrid:Ce,connectionMode:M,translateExtent:Yn,connectOnClick:Dl,defaultEdgeOptions:Fi,fitView:xo,fitViewOptions:wo,onNodesDelete:J,onEdgesDelete:W,onDelete:U,onNodeDragStart:H,onNodeDrag:B,onNodeDragStop:X,onSelectionDrag:b,onSelectionDragStart:z,onSelectionDragStop:F,onMove:v,onMoveStart:m,onMoveEnd:y,noPanClassName:Ut,nodeOrigin:kt,rfId:Cr,autoPanOnConnect:Oe,autoPanOnNodeDrag:jl,autoPanSpeed:So,onError:Ol,connectionRadius:Bi,isValidConnection:_r,selectNodesOnDrag:Me,nodeDragThreshold:Nt,connectionDragThreshold:Fl,onBeforeDelete:V,debug:kr,ariaLabelConfig:Nr,zIndexMode:Ui}),A.jsx(_S,{onInit:g,onNodeClick:d,onEdgeClick:p,onNodeMouseEnter:P,onNodeMouseMove:N,onNodeMouseLeave:C,onNodeContextMenu:j,onNodeDoubleClick:D,nodeTypes:a,edgeTypes:c,connectionLineType:R,connectionLineStyle:te,connectionLineComponent:re,connectionLineContainerStyle:le,selectionKeyCode:ae,selectionOnDrag:ee,selectionMode:ce,deleteKeyCode:ue,multiSelectionKeyCode:_e,panActivationKeyCode:we,zoomActivationKeyCode:Se,onlyRenderVisibleElements:Te,defaultViewport:bn,translateExtent:Yn,minZoom:nn,maxZoom:rn,preventScrolling:Pi,zoomOnScroll:zl,zoomOnPinch:zi,zoomOnDoubleClick:fo,panOnScroll:Ii,panOnScrollSpeed:Il,panOnScrollMode:co,panOnDrag:ho,onPaneClick:po,onPaneMouseEnter:go,onPaneMouseMove:xn,onPaneMouseLeave:wn,onPaneScroll:Ti,onPaneContextMenu:Ai,paneClickDistance:Li,nodeClickDistance:Ri,onSelectionContextMenu:Y,onSelectionStart:T,onSelectionEnd:L,onReconnect:mo,onReconnectStart:$i,onReconnectEnd:Qn,onEdgeContextMenu:yo,onEdgeDoubleClick:Kn,onEdgeMouseEnter:Tl,onEdgeMouseMove:Gn,onEdgeMouseLeave:wr,reconnectRadius:Sr,defaultMarkerColor:Xn,noDragClassName:Ll,noWheelClassName:Rl,noPanClassName:Ut,rfId:Cr,disableKeyboardA11y:Vi,nodeExtent:on,viewport:yt,onViewportChange:Hl}),A.jsx(t2,{onSelectionChange:Z}),Di,A.jsx(Gw,{proOptions:Oi,position:ji}),A.jsx(Kw,{rfId:Cr,disableKeyboardA11y:Vi})]})})}var MS=R0(CS);const PS=t=>{var r;return(r=t.domNode)==null?void 0:r.querySelector(".react-flow__edgelabel-renderer")};function ip({children:t}){const r=Ne(PS);return r?Bw.createPortal(t,r):null}function zS(t){const[r,i]=q.useState(t),s=q.useCallback(u=>i(a=>A0(u,a)),[]);return[r,i,s]}function IS(t){const[r,i]=q.useState(t),s=q.useCallback(u=>i(a=>L0(u,a)),[]);return[r,i,s]}function sp(t){return Ne(q.useCallback(i=>i.nodeLookup.get(t),[t]),De)}function TS({dimensions:t,lineWidth:r,variant:i,className:s}){return A.jsx("path",{strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:be(["react-flow__background-pattern",i,s])})}function AS({radius:t,className:r}){return A.jsx("circle",{cx:t,cy:t,r:t,className:be(["react-flow__background-pattern","dots",r])})}var Un;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Un||(Un={}));const LS={[Un.Dots]:1,[Un.Lines]:1,[Un.Cross]:6},RS=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function ig({id:t,variant:r=Un.Dots,gap:i=20,size:s,lineWidth:u=1,offset:a=0,color:c,bgColor:d,style:p,className:g,patternClassName:v}){const m=q.useRef(null),{transform:y,patternId:x}=Ne(RS,De),S=s||LS[r],_=r===Un.Dots,w=r===Un.Cross,k=Array.isArray(i)?i:[i,i],P=[k[0]*y[2]||1,k[1]*y[2]||1],N=S*y[2],C=Array.isArray(a)?a:[a,a],j=w?[N,N]:P,D=[C[0]*y[2]||1+j[0]/2,C[1]*y[2]||1+j[1]/2],H=`${x}${t||""}`;return A.jsxs("svg",{className:be(["react-flow__background",g]),style:{...p,...Pl,"--xy-background-color-props":d,"--xy-background-pattern-color-props":c},ref:m,"data-testid":"rf__background",children:[A.jsx("pattern",{id:H,x:y[0]%P[0],y:y[1]%P[1],width:P[0],height:P[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${D[0]},-${D[1]})`,children:_?A.jsx(AS,{radius:N/2,className:v}):A.jsx(TS,{dimensions:j,lineWidth:u,variant:r,className:v})}),A.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${H})`})]})}ig.displayName="Background";const DS=q.memo(ig);function $S(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:A.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function jS(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:A.jsx("path",{d:"M0 0h32v4.2H0z"})})}function OS(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:A.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function FS(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function HS(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function tl({children:t,className:r,...i}){return A.jsx("button",{type:"button",className:be(["react-flow__controls-button",r]),...i,children:t})}const VS=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function sg({style:t,showZoom:r=!0,showFitView:i=!0,showInteractive:s=!0,fitViewOptions:u,onZoomIn:a,onZoomOut:c,onFitView:d,onInteractiveChange:p,className:g,children:v,position:m="bottom-left",orientation:y="vertical","aria-label":x}){const S=je(),{isInteractive:_,minZoomReached:w,maxZoomReached:k,ariaLabelConfig:P}=Ne(VS,De),{zoomIn:N,zoomOut:C,fitView:j}=Mi(),D=()=>{N(),a==null||a()},H=()=>{C(),c==null||c()},B=()=>{j(u),d==null||d()},X=()=>{S.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),p==null||p(!_)},J=y==="horizontal"?"horizontal":"vertical";return A.jsxs(Ci,{className:be(["react-flow__controls",J,g]),position:m,style:t,"data-testid":"rf__controls","aria-label":x??P["controls.ariaLabel"],children:[r&&A.jsxs(A.Fragment,{children:[A.jsx(tl,{onClick:D,className:"react-flow__controls-zoomin",title:P["controls.zoomIn.ariaLabel"],"aria-label":P["controls.zoomIn.ariaLabel"],disabled:k,children:A.jsx($S,{})}),A.jsx(tl,{onClick:H,className:"react-flow__controls-zoomout",title:P["controls.zoomOut.ariaLabel"],"aria-label":P["controls.zoomOut.ariaLabel"],disabled:w,children:A.jsx(jS,{})})]}),i&&A.jsx(tl,{className:"react-flow__controls-fitview",onClick:B,title:P["controls.fitView.ariaLabel"],"aria-label":P["controls.fitView.ariaLabel"],children:A.jsx(OS,{})}),s&&A.jsx(tl,{className:"react-flow__controls-interactive",onClick:X,title:P["controls.interactive.ariaLabel"],"aria-label":P["controls.interactive.ariaLabel"],children:_?A.jsx(HS,{}):A.jsx(FS,{})}),v]})}sg.displayName="Controls";const BS=q.memo(sg);function WS({id:t,x:r,y:i,width:s,height:u,style:a,color:c,strokeColor:d,strokeWidth:p,className:g,borderRadius:v,shapeRendering:m,selected:y,onClick:x}){const{background:S,backgroundColor:_}=a||{},w=c||S||_;return A.jsx("rect",{className:be(["react-flow__minimap-node",{selected:y},g]),x:r,y:i,rx:v,ry:v,width:s,height:u,style:{fill:w,stroke:d,strokeWidth:p},shapeRendering:m,onClick:x?k=>x(k,t):void 0})}const US=q.memo(WS),bS=t=>t.nodes.map(r=>r.id),Oa=t=>t instanceof Function?t:()=>t;function YS({nodeStrokeColor:t,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:u,nodeComponent:a=US,onClick:c}){const d=Ne(bS,De),p=Oa(r),g=Oa(t),v=Oa(i),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return A.jsx(A.Fragment,{children:d.map(y=>A.jsx(QS,{id:y,nodeColorFunc:p,nodeStrokeColorFunc:g,nodeClassNameFunc:v,nodeBorderRadius:s,nodeStrokeWidth:u,NodeComponent:a,onClick:c,shapeRendering:m},y))})}function XS({id:t,nodeColorFunc:r,nodeStrokeColorFunc:i,nodeClassNameFunc:s,nodeBorderRadius:u,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:d,onClick:p}){const{node:g,x:v,y:m,width:y,height:x}=Ne(S=>{const _=S.nodeLookup.get(t);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const w=_.internals.userNode,{x:k,y:P}=_.internals.positionAbsolute,{width:N,height:C}=yn(w);return{node:w,x:k,y:P,width:N,height:C}},De);return!g||g.hidden||!s0(g)?null:A.jsx(d,{x:v,y:m,width:y,height:x,style:g.style,selected:!!g.selected,className:s(g),color:r(g),borderRadius:u,strokeColor:i(g),strokeWidth:a,shapeRendering:c,onClick:p,id:g.id})}const QS=q.memo(XS);var KS=q.memo(YS);const GS=200,ZS=150,qS=t=>!t.hidden,JS=t=>{const r={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:r,boundingRect:t.nodeLookup.size>0?i0(Ei(t.nodeLookup,{filter:qS}),r):r,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},e_="react-flow__minimap-desc";function lg({style:t,className:r,nodeStrokeColor:i,nodeColor:s,nodeClassName:u="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:d,bgColor:p,maskColor:g,maskStrokeColor:v,maskStrokeWidth:m,position:y="bottom-right",onClick:x,onNodeClick:S,pannable:_=!1,zoomable:w=!1,ariaLabel:k,inversePan:P,zoomStep:N=1,offsetScale:C=5}){const j=je(),D=q.useRef(null),{boundingRect:H,viewBB:B,rfId:X,panZoom:J,translateExtent:W,flowWidth:U,flowHeight:Z,ariaLabelConfig:z}=Ne(JS,De),b=(t==null?void 0:t.width)??GS,F=(t==null?void 0:t.height)??ZS,Y=H.width/b,T=H.height/F,L=Math.max(Y,T),V=L*b,M=L*F,R=C*L,te=H.x-(V-H.width)/2-R,re=H.y-(M-H.height)/2-R,le=V+R*2,ue=M+R*2,ae=`${e_}-${X}`,ee=q.useRef(0),ce=q.useRef();ee.current=L,q.useEffect(()=>{if(D.current&&J)return ce.current=gw({domNode:D.current,panZoom:J,getTransform:()=>j.getState().transform,getViewScale:()=>ee.current}),()=>{var ye;(ye=ce.current)==null||ye.destroy()}},[J]),q.useEffect(()=>{var ye;(ye=ce.current)==null||ye.update({translateExtent:W,width:U,height:Z,inversePan:P,pannable:_,zoomStep:N,zoomable:w})},[_,w,P,N,W,U,Z]);const we=x?ye=>{var Me;const[Ce,Te]=((Me=ce.current)==null?void 0:Me.pointer(ye))||[0,0];x(ye,{x:Ce,y:Te})}:void 0,_e=S?q.useCallback((ye,Ce)=>{const Te=j.getState().nodeLookup.get(Ce).internals.userNode;S(ye,Te)},[]):void 0,Se=k??z["minimap.ariaLabel"];return A.jsx(Ci,{position:y,style:{...t,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-stroke-color-props":typeof v=="string"?v:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*L:void 0,"--xy-minimap-node-background-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:be(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:A.jsxs("svg",{width:b,height:F,viewBox:`${te} ${re} ${le} ${ue}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ae,ref:D,onClick:we,children:[Se&&A.jsx("title",{id:ae,children:Se}),A.jsx(KS,{onClick:_e,nodeColor:s,nodeStrokeColor:i,nodeBorderRadius:a,nodeClassName:u,nodeStrokeWidth:c,nodeComponent:d}),A.jsx("path",{className:"react-flow__minimap-mask",d:`M${te-R},${re-R}h${le+R*2}v${ue+R*2}h${-le-R*2}z - M${B.x},${B.y}h${B.width}v${B.height}h${-B.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}lg.displayName="MiniMap";q.memo(lg);const t_=t=>r=>t?`${Math.max(1/r.transform[2],1)}`:void 0,n_={[uo.Line]:"right",[uo.Handle]:"bottom-right"};function r_({nodeId:t,position:r,variant:i=uo.Handle,className:s,style:u=void 0,children:a,color:c,minWidth:d=10,minHeight:p=10,maxWidth:g=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:y,autoScale:x=!0,shouldResize:S,onResizeStart:_,onResize:w,onResizeEnd:k}){const P=O0(),N=typeof t=="string"?t:P,C=je(),j=q.useRef(null),D=i===uo.Handle,H=Ne(q.useCallback(t_(D&&x),[D,x]),De),B=q.useRef(null),X=r??n_[i];q.useEffect(()=>{if(!(!j.current||!N))return B.current||(B.current=zw({domNode:j.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:W,transform:U,snapGrid:Z,snapToGrid:z,nodeOrigin:b,domNode:F}=C.getState();return{nodeLookup:W,transform:U,snapGrid:Z,snapToGrid:z,nodeOrigin:b,paneDomNode:F}},onChange:(W,U)=>{const{triggerNodeChanges:Z,nodeLookup:z,parentLookup:b,nodeOrigin:F}=C.getState(),Y=[],T={x:W.x,y:W.y},L=z.get(N);if(L&&L.expandParent&&L.parentId){const V=L.origin??F,M=W.width??L.measured.width??0,R=W.height??L.measured.height??0,te={id:L.id,parentId:L.parentId,rect:{width:M,height:R,...l0({x:W.x??L.position.x,y:W.y??L.position.y},{width:M,height:R},L.parentId,z,V)}},re=yc([te],z,b,F);Y.push(...re),T.x=W.x?Math.max(V[0]*M,W.x):void 0,T.y=W.y?Math.max(V[1]*R,W.y):void 0}if(T.x!==void 0&&T.y!==void 0){const V={id:N,type:"position",position:{...T}};Y.push(V)}if(W.width!==void 0&&W.height!==void 0){const M={id:N,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:W.width,height:W.height}};Y.push(M)}for(const V of U){const M={...V,type:"position"};Y.push(M)}Z(Y)},onEnd:({width:W,height:U})=>{const Z={id:N,type:"dimensions",resizing:!1,dimensions:{width:W,height:U}};C.getState().triggerNodeChanges([Z])}})),B.current.update({controlPosition:X,boundaries:{minWidth:d,minHeight:p,maxWidth:g,maxHeight:v},keepAspectRatio:m,resizeDirection:y,onResizeStart:_,onResize:w,onResizeEnd:k,shouldResize:S}),()=>{var W;(W=B.current)==null||W.destroy()}},[X,d,p,g,v,m,_,w,k,S]);const J=X.split("-");return A.jsx("div",{className:be(["react-flow__resize-control","nodrag",...J,i,s]),ref:j,style:{...u,scale:H,...c&&{[D?"backgroundColor":"borderColor"]:c}},children:a})}q.memo(r_);function o_(t,r){var i,s=1;t==null&&(t=0),r==null&&(r=0);function u(){var a,c=i.length,d,p=0,g=0;for(a=0;a=(m=(d+g)/2))?d=m:g=m,(w=i>=(y=(p+v)/2))?p=y:v=y,u=a,!(a=a[k=w<<1|_]))return u[k]=c,t;if(x=+t._x.call(null,a.data),S=+t._y.call(null,a.data),r===x&&i===S)return c.next=a,u?u[k]=c:t._root=c,t;do u=u?u[k]=new Array(4):t._root=new Array(4),(_=r>=(m=(d+g)/2))?d=m:g=m,(w=i>=(y=(p+v)/2))?p=y:v=y;while((k=w<<1|_)===(P=(S>=y)<<1|x>=m));return u[P]=a,u[k]=c,t}function s_(t){var r,i,s=t.length,u,a,c=new Array(s),d=new Array(s),p=1/0,g=1/0,v=-1/0,m=-1/0;for(i=0;iv&&(v=u),am&&(m=a));if(p>v||g>m)return this;for(this.cover(p,g).cover(v,m),i=0;it||t>=u||s>r||r>=a;)switch(g=(rv||(d=S.y0)>m||(p=S.x1)=k)<<1|t>=w)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-_],y[y.length-1-_]=S)}else{var P=t-+this._x.call(null,x.data),N=r-+this._y.call(null,x.data),C=P*P+N*N;if(C=(y=(c+p)/2))?c=y:p=y,(_=m>=(x=(d+g)/2))?d=x:g=x,r=i,!(i=i[w=_<<1|S]))return this;if(!i.length)break;(r[w+1&3]||r[w+2&3]||r[w+3&3])&&(s=r,k=w)}for(;i.data!==t;)if(u=i,!(i=i.next))return this;return(a=i.next)&&delete i.next,u?(a?u.next=a:delete u.next,this):r?(a?r[w]=a:delete r[w],(i=r[0]||r[1]||r[2]||r[3])&&i===(r[3]||r[2]||r[1]||r[0])&&!i.length&&(s?s[k]=i:this._root=i),this):(this._root=a,this)}function d_(t){for(var r=0,i=t.length;ry.index){var W=x-B.x-B.vx,U=S-B.y-B.vy,Z=W*W+U*U;Zx+J||DS+J||Hg.r&&(g.r=g[v].r)}function p(){if(r){var g,v=r.length,m;for(i=new Array(v),g=0;g[r(j,D,c),j])),C;for(w=0,d=new Array(k);w(t=(C_*t+M_)%ap)/ap}function z_(t){return t.x}function I_(t){return t.y}var T_=10,A_=Math.PI*(3-Math.sqrt(5));function L_(t){var r,i=1,s=.001,u=1-Math.pow(s,1/300),a=0,c=.6,d=new Map,p=sc(m),g=xi("tick","end"),v=P_();t==null&&(t=[]);function m(){y(),g.call("tick",r),i1?(w==null?d.delete(_):d.set(_,S(w)),r):d.get(_)},find:function(_,w,k){var P=0,N=t.length,C,j,D,H,B;for(k==null?k=1/0:k*=k,P=0;P1?(g.on(_,w),r):g.on(_)}}}function R_(){var t,r,i,s,u=st(-30),a,c=1,d=1/0,p=.81;function g(x){var S,_=t.length,w=xc(t,z_,I_).visitAfter(m);for(s=x,S=0;S<_;++S)r=t[S],w.visit(y)}function v(){if(t){var x,S=t.length,_;for(a=new Array(S),x=0;x=d)return;(x.data!==r||x.next)&&(k===0&&(k=Wn(i),C+=k*k),P===0&&(P=Wn(i),C+=P*P),CA.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:A.jsx("path",{d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})}),pp={visibility:"hidden",width:8,height:8};function gp({data:t,type:r}){const i=rl[r]||rl.entity,s=hp[r]||hp.entity,a=t.hideProperties?[]:t.properties||[],c=a.some((x,S)=>x.highlight&&S>=oi),[d,p]=q.useState(c),g=!d&&a.length>oi,v=g?a.slice(0,oi):a,m=a.length-oi;t.description;const y=x=>{x.stopPropagation(),p(S=>!S)};return A.jsxs("div",{style:{minWidth:220,borderRadius:6,overflow:"hidden",cursor:t.link?"pointer":"default",boxShadow:t.highlight?`0 0 0 2px ${i}, 0 0 12px ${i}40`:"0 1px 3px rgba(0,0,0,0.06)"},children:[A.jsx(Zt,{type:"target",position:me.Top,id:"top",style:pp}),A.jsx(Zt,{type:"source",position:me.Bottom,id:"bottom",style:pp}),A.jsx("div",{style:{height:6,background:i}}),A.jsxs("div",{style:{border:"3px solid #E9EEF4",borderTop:"none",borderRadius:"0 0 6px 6px",overflow:"hidden"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",background:"#E9EEF4",padding:"6px 10px",gap:6},children:[A.jsx("span",{style:{flexShrink:0,display:"flex"},children:s}),A.jsx("span",{style:{fontWeight:700,fontSize:14,color:"#111827",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})]}),A.jsx("div",{style:{background:"#fff"},children:v.length>0?A.jsxs(A.Fragment,{children:[v.map((x,S)=>A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"5px 10px",borderTop:"1px solid #E9EEF4",gap:8,background:x.highlight?`${rl.property}1a`:"transparent",boxShadow:x.highlight?`inset 3px 0 0 ${rl.property}`:"none"},children:[A.jsx("span",{style:{fontSize:13,fontWeight:x.highlight?700:500,color:x.inherited?"#9ca3af":"#111827",fontStyle:x.inherited?"italic":"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:x.name}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[x.type&&A.jsx("span",{style:{fontSize:11,color:"#9ca3af"},children:x.type}),x.primaryKey&&A.jsx(j_,{})]})]},S)),(g||d&&a.length>oi)&&A.jsx("div",{onClick:y,style:{padding:"4px 10px",borderTop:"1px solid #E9EEF4",fontSize:11,color:"#6366f1",textAlign:"center",cursor:"pointer",fontWeight:500},onMouseOver:x=>x.currentTarget.style.background="#f5f3ff",onMouseOut:x=>x.currentTarget.style.background="transparent",children:d?"show less":`+${m} more`})]}):A.jsx("div",{style:{padding:"6px 10px",fontSize:12,color:"#9ca3af",fontStyle:"italic",lineHeight:1.4},children:"No properties"})})]})]})}function mp(t){var s,u;const r=((s=t.measured)==null?void 0:s.width)??t.width??150,i=((u=t.measured)==null?void 0:u.height)??t.height??40;return{x:t.internals.positionAbsolute.x,y:t.internals.positionAbsolute.y,w:r,h:i,cx:t.internals.positionAbsolute.x+r/2,cy:t.internals.positionAbsolute.y+i/2}}function ol(t,r,i,s){const{cx:u,cy:a,w:c,h:d}=t,p=r-u,g=i-a;if(p===0&&g===0)return{x:u,y:a};const v=c/2+s,m=d/2+s,y=Math.abs(p)<.001?1/0:v/Math.abs(p),x=Math.abs(g)<.001?1/0:m/Math.abs(g),S=Math.min(y,x);return{x:u+p*S,y:a+g*S}}function O_(t,r,i,s){if(s<=1)return 0;const u=r.cx-t.cx,a=r.cy-t.cy,c=Math.sqrt(u*u+a*a)||1,d=Math.max(60,Math.min(c*.3,120));return(i-(s-1)/2)*d}function F_({id:t,source:r,target:i,label:s,style:u,data:a,markerEnd:c,labelStyle:d,labelBgStyle:p,labelBgPadding:g}){const v=sp(r),m=sp(i);if(!v||!m)return null;const y=mp(v),x=mp(m),S=(a==null?void 0:a.parallel)||{index:0,total:1},_=O_(y,x,S.index,S.total);if(_===0){const b=ol(y,x.cx,x.cy,2),F=ol(x,y.cx,y.cy,6),Y=`M ${b.x} ${b.y} L ${F.x} ${F.y}`,T=(b.x+F.x)/2,L=(b.y+F.y)/2;return A.jsxs(A.Fragment,{children:[A.jsx(ao,{id:t,path:Y,style:u,markerEnd:c}),s&&A.jsx(ip,{children:A.jsx("div",{style:yp(T,L,d,p,g),children:s})})]})}const w=(y.cx+x.cx)/2,k=(y.cy+x.cy)/2,P=r>i,N=P?y.cx-x.cx:x.cx-y.cx,C=P?y.cy-x.cy:x.cy-y.cy,j=Math.sqrt(N*N+C*C)||1,D=-C/j,H=N/j,B=w+D*_,X=k+H*_,J=ol(y,B,X,2),W=ol(x,B,X,6),U=`M ${J.x} ${J.y} Q ${B} ${X} ${W.x} ${W.y}`,Z=.25*J.x+.5*B+.25*W.x,z=.25*J.y+.5*X+.25*W.y;return A.jsxs(A.Fragment,{children:[A.jsx(ao,{id:t,path:U,style:u,markerEnd:c}),s&&A.jsx(ip,{children:A.jsx("div",{style:yp(Z,z,d,p,g),children:s})})]})}function yp(t,r,i,s,u){return{position:"absolute",transform:`translate(-50%, -50%) translate(${t}px, ${r}px)`,pointerEvents:"none",fontSize:(i==null?void 0:i.fontSize)??10,fontWeight:(i==null?void 0:i.fontWeight)??500,color:(i==null?void 0:i.fill)??"#64748b",background:(s==null?void 0:s.fill)??"#fff",opacity:(s==null?void 0:s.fillOpacity)??.9,padding:`${(u==null?void 0:u[1])??2}px ${(u==null?void 0:u[0])??4}px`,borderRadius:4}}const vp={entity:"#3b82f6",property:"#22c55e",shared_property:"#22c55e",metric:"#8b5cf6"},H_={entity:"Entity",property:"Property",shared_property:"Property",metric:"Metric"},V_=()=>A.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:A.jsx("path",{d:"M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"})});function B_({node:t,onClose:r}){if(!t)return null;const i=t.type||"entity",s=vp[i]||vp.entity,{label:u,description:a,link:c,properties:d=[]}=t.data,p=d.filter(v=>!v.inherited),g=d.filter(v=>v.inherited);return A.jsxs("div",{style:{position:"absolute",top:0,right:0,bottom:0,width:320,background:"#fff",borderLeft:"1px solid #e5e7eb",boxShadow:"-4px 0 12px rgba(0,0,0,0.08)",zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden"},children:[A.jsx("div",{style:{height:4,background:s,flexShrink:0}}),A.jsxs("div",{style:{padding:"16px 16px 12px",borderBottom:"1px solid #e5e7eb",flexShrink:0},children:[A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[A.jsxs("div",{style:{flex:1,minWidth:0},children:[A.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:s,marginBottom:4},children:H_[i]||"Entity"}),c?A.jsx("a",{href:c,style:{fontSize:16,fontWeight:700,color:"#111827",wordBreak:"break-word",textDecoration:"none",display:"block"},onMouseOver:v=>v.currentTarget.style.color=s,onMouseOut:v=>v.currentTarget.style.color="#111827",children:u}):A.jsx("div",{style:{fontSize:16,fontWeight:700,color:"#111827",wordBreak:"break-word"},children:u})]}),A.jsx("button",{onClick:r,style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#9ca3af",fontSize:18,lineHeight:1,flexShrink:0,marginLeft:8},title:"Close",children:"✕"})]}),a&&A.jsx("div",{style:{marginTop:8,fontSize:13,color:"#6b7280",lineHeight:1.5},children:a}),c&&A.jsx("a",{href:c,style:{display:"inline-flex",alignItems:"center",gap:4,marginTop:10,fontSize:12,fontWeight:500,color:s,textDecoration:"none"},onMouseOver:v=>v.currentTarget.style.textDecoration="underline",onMouseOut:v=>v.currentTarget.style.textDecoration="none",children:"Open details →"})]}),A.jsxs("div",{style:{flex:1,overflow:"auto",padding:"0"},children:[p.length>0&&A.jsx(xp,{title:"Properties",properties:p,count:p.length}),g.length>0&&A.jsx(xp,{title:"Inherited",properties:g,count:g.length,inherited:!0}),d.length===0&&!a&&A.jsx("div",{style:{padding:16,fontSize:13,color:"#9ca3af",textAlign:"center"},children:"No properties"})]})]})}function xp({title:t,properties:r,count:i,inherited:s}){return A.jsxs("div",{children:[A.jsxs("div",{style:{padding:"10px 16px 6px",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",background:"#f9fafb",borderBottom:"1px solid #e5e7eb"},children:[t," (",i,")"]}),r.map((u,a)=>A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"7px 16px",borderBottom:"1px solid #f3f4f6",gap:8},children:[A.jsx("span",{style:{fontSize:13,fontWeight:500,color:s?"#9ca3af":"#374151",fontStyle:s?"italic":"normal",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:u.name}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[u.type&&A.jsx("span",{style:{fontSize:11,color:"#9ca3af",background:"#f3f4f6",padding:"1px 6px",borderRadius:3},children:u.type}),u.primaryKey&&A.jsx(V_,{})]})]},a))]})}const W_={entity:qr,metric:qr,property:qr,shared_property:qr},U_={entity:gp,metric:gp,property:qr,shared_property:qr},b_={floating:F_};function Y_(t){const r={};t.edges.forEach(d=>{r[d.source]=(r[d.source]||0)+1,r[d.target]=(r[d.target]||0)+1});const i=t.nodes.map(d=>({id:d.id,type:d.type||"entity",position:{x:0,y:0},data:{...d.data,connections:r[d.id]||0}})),s={};t.edges.forEach(d=>{const p=[d.source,d.target].sort().join("::");s[p]=(s[p]||0)+1});const u={},a={};t.edges.forEach(d=>{const p=[d.source,d.target].sort().join("::");u[p]||(u[p]=0),a[d.id]={index:u[p]++,total:s[p]}});const c=t.edges.map(d=>({id:d.id,source:d.source,target:d.target,label:d.label,type:"floating",data:{label:d.label,parallel:a[d.id]},style:{stroke:"#94a3b8",strokeWidth:1.5},markerEnd:{type:oo.ArrowClosed,color:"#94a3b8",width:14,height:14},labelStyle:{fontSize:10,fill:"#64748b",fontWeight:500},labelBgStyle:{fill:"#fff",fillOpacity:.9},labelBgPadding:[4,2]}));return{nodes:i,edges:c}}function X_(t,r,i){const s=t.length;if(s===1)return{[t[0].id]:{x:0,y:0}};const u=s>50,a=i?-3e3:u?-1200:-500,c=i?450:u?250:200,d=i?200:u?80:90,p=Math.max(s*5,300),g=t.map((w,k)=>({id:w.id,x:Math.cos(2*Math.PI*k/s)*p,y:Math.sin(2*Math.PI*k/s)*p})),v=r.map(w=>({source:w.source,target:w.target})),m=R_().strength(a);u&&m.theta(1.2);const y=u?.08:.05,x=L_(g).force("link",N_(v).id(w=>w.id).distance(c).strength(u?.3:1)).force("charge",m).force("center",o_(0,0)).force("x",D_(0).strength(y)).force("y",$_(0).strength(y)).force("collide",E_(d)).alphaDecay(u?.04:.0228).stop(),S=u?250:300;for(let w=0;w{_[w.id]={x:isFinite(w.x)?w.x:k*100,y:isFinite(w.y)?w.y:k*100}}),_}function Q_(t,r,{entityMode:i=!1}={}){const s={};t.forEach(m=>{s[m.id]=[]}),r.forEach(m=>{s[m.source].push(m.target),s[m.target].push(m.source)});const u=new Set,a=[];t.forEach(m=>{if(u.has(m.id))return;const y=[],x=[m.id];for(;x.length;){const S=x.pop();u.has(S)||(u.add(S),y.push(S),s[S].forEach(_=>{u.has(_)||x.push(_)}))}a.push(y)}),a.sort((m,y)=>y.length-m.length);const c={};t.forEach(m=>{c[m.id]=m});const d=a.map(m=>{const y=new Set(m),x=m.map(C=>c[C]),S=r.filter(C=>y.has(C.source)&&y.has(C.target)),_=X_(x,S,i);let w=1/0,k=1/0,P=-1/0,N=-1/0;return m.forEach(C=>{w=Math.min(w,_[C].x),k=Math.min(k,_[C].y),P=Math.max(P,_[C].x),N=Math.max(N,_[C].y)}),m.forEach(C=>{_[C].x-=w,_[C].y-=k}),{ids:m,posById:_,width:P-w,height:N-k}}),p=i?300:150,g={};if(d.length===1){const m=d[0];m.ids.forEach(y=>{g[y]=m.posById[y]})}else{const m=d[0];m.ids.forEach(_=>{g[_]=m.posById[_]});let y=m.width+p*2,x=0,S=0;for(let _=1;_0&&x+w.height>m.height&&(y+=S+p*2,x=0,S=0),w.ids.forEach(k=>{g[k]={x:y+w.posById[k].x,y:x+w.posById[k].y}}),S=Math.max(S,w.width),x+=w.height+p}}return{nodes:t.map(m=>({...m,position:g[m.id]})),edges:r}}function K_(t,r){const i={},s={};r.forEach(x=>{i[x.target]||(i[x.target]=[]),i[x.target].push(x.source),s[x.source]=x.target});const u=t.filter(x=>!s[x.id]).map(x=>x.id);u.length===0&&t.length>0&&u.push(t[0].id);const a={},c=[],d=new Set,p=u.map(x=>({id:x,level:0}));for(u.forEach(x=>d.add(x));p.length>0;){const{id:x,level:S}=p.shift();a[x]=S,c.push(x),(i[x]||[]).forEach(w=>{d.has(w)||(d.add(w),p.push({id:w,level:S+1}))})}t.forEach(x=>{d.has(x.id)||(a[x.id]=0,c.push(x.id))});const g={};c.forEach(x=>{const S=a[x];g[S]||(g[S]=[]),g[S].push(x)});const v=250,m=120,y={};return Object.entries(g).forEach(([x,S])=>{const _=(S.length-1)*v;S.forEach((w,k)=>{y[w]={x:-_/2+k*v,y:parseInt(x)*m}})}),{nodes:t.map(x=>({...x,position:y[x.id]||{x:0,y:0}})),edges:r}}function G_(t){const r={},i={};return t.forEach(s=>{r[s.source]||(r[s.source]=new Set),r[s.target]||(r[s.target]=new Set),r[s.source].add(s.target),r[s.target].add(s.source),i[s.source]||(i[s.source]=new Set),i[s.target]||(i[s.target]=new Set),i[s.source].add(s.id),i[s.target].add(s.id)}),{neighborNodes:r,neighborEdges:i}}const ag=t=>({borderRadius:4,background:t?"#eef2ff":"#fff",padding:"4px 8px",fontSize:12,fontWeight:500,color:t?"#4f46e5":"#374151",boxShadow:"0 1px 2px 0 rgba(0,0,0,0.05)",border:`1px solid ${t?"#a5b4fc":"#d1d5db"}`,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:4});function Z_({customHeight:t,containerRef:r}){const{fitView:i}=Mi(),[s,u]=q.useState(!1),a=q.useCallback(()=>{var d;const c=(d=r.current)==null?void 0:d.closest(".semantic-visualizer");c&&(s?(c.style.height=t,u(!1)):(c.style.height="100vh",u(!0)),setTimeout(()=>{i(),c.scrollIntoView(!0)},0))},[s,t,i,r]);return A.jsx("button",{onClick:a,style:ag(!1),onMouseOver:c=>c.currentTarget.style.background="#f9fafb",onMouseOut:c=>c.currentTarget.style.background="#fff",children:s?"shrink":"enlarge"})}function q_({graphData:t,customHeight:r,layout:i}){const{fitView:s}=Mi(),u=q.useRef(null),[a,c]=q.useState(null),d=q.useMemo(()=>t.nodes.some(U=>{var Z;return(((Z=U.data)==null?void 0:Z.properties)||[]).some(z=>z.highlight)}),[t]),[p,g]=q.useState(d),v=i==="tree",m=p&&!v?U_:W_,y=q.useMemo(()=>{const U=p&&!v?(()=>{const b=t.nodes.filter(T=>T.type!=="shared_property"),F=new Set(b.map(T=>T.id)),Y=t.edges.filter(T=>F.has(T.source)&&F.has(T.target));return{nodes:b,edges:Y}})():t,{nodes:Z,edges:z}=Y_(U);return v?K_(Z,z):Q_(Z,z,{entityMode:p})},[t,p,v]),x=q.useMemo(()=>G_(y.edges),[y.edges]),S=q.useMemo(()=>{if(!a)return y.nodes;const U=new Set([a.id]);return(x.neighborNodes[a.id]||new Set).forEach(Z=>U.add(Z)),y.nodes.map(Z=>({...Z,data:{...Z.data,dimmed:!U.has(Z.id)}}))},[y.nodes,a,x]),_=q.useMemo(()=>{if(!a)return y.edges;const U=x.neighborEdges[a.id]||new Set;return y.edges.map(Z=>{const z=U.has(Z.id);return{...Z,style:{stroke:z?"#6366f1":"#e2e8f0",strokeWidth:z?2.5:1},markerEnd:{type:oo.ArrowClosed,color:z?"#6366f1":"#e2e8f0",width:14,height:14},data:{...Z.data,dimmed:!z},labelStyle:z?{fontSize:11,fill:"#4338ca",fontWeight:600}:{fontSize:10,fill:"#e2e8f0",fontWeight:500},labelBgStyle:z?{fill:"#eef2ff",fillOpacity:1}:{fill:"#fff",fillOpacity:.5},zIndex:z?10:0}})},[y.edges,a,x]),[w,k,P]=zS(S),[N,C,j]=IS(_),[D,H]=q.useState(y),[B,X]=q.useState(_);y!==D?(H(y),k(S),C(_),X(_)):_!==B&&(X(_),k(U=>U.map(Z=>{const z=S.find(b=>b.id===Z.id);return z?{...Z,data:z.data}:Z})),C(_));const J=q.useCallback((U,Z)=>{c(z=>(z==null?void 0:z.id)===Z.id?null:Z)},[]),W=q.useCallback(()=>{c(null)},[]);return A.jsxs("div",{ref:u,style:{width:"100%",height:"100%",position:"relative"},children:[A.jsxs(MS,{nodes:w,edges:N,onNodesChange:P,onEdgesChange:j,nodeTypes:m,edgeTypes:b_,fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},nodesDraggable:!0,nodesConnectable:!1,elementsSelectable:!0,panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,minZoom:.1,maxZoom:2,proOptions:{hideAttribution:!0},onNodeClick:J,onPaneClick:W,children:[A.jsx(DS,{color:"#e2e8f0",gap:20}),A.jsx(BS,{position:"bottom-left",showInteractive:!1}),A.jsx(Ci,{position:"top-right",children:A.jsxs("div",{style:{display:"flex",gap:6},children:[!v&&A.jsx("button",{onClick:()=>{g(U=>!U),setTimeout(()=>s({padding:.3,maxZoom:1}),0)},style:ag(p),onMouseOver:U=>{p||(U.currentTarget.style.background="#f9fafb")},onMouseOut:U=>{p||(U.currentTarget.style.background="#fff")},title:"Show as Entity-Relationship Diagram — render properties inside concept and metric nodes",children:"Show as Entity-Relationship-Diagram"}),A.jsx(Z_,{customHeight:r||"400px",containerRef:u})]})})]}),A.jsx(B_,{node:a,onClose:()=>c(null)})]})}function cg(t){if(t.dataset.svInit)return;if(t.offsetParent===null){const u=new MutationObserver(()=>{t.offsetParent!==null&&(u.disconnect(),cg(t))});u.observe(document.body,{attributes:!0,subtree:!0,attributeFilter:["style","class"]});return}const r=t.dataset.jsonUrl,i=t.dataset.height||"400px",s=t.dataset.layout||"force";r&&(t.dataset.svInit="true",fetch(r,{credentials:"same-origin"}).then(u=>u.json()).then(u=>{if(!u.nodes||u.nodes.length===0){delete t.dataset.svInit;return}t.style.height=i,Zm.createRoot(t).render(A.jsx(og,{children:A.jsx(q_,{graphData:u,customHeight:i,layout:s})}))}).catch(u=>{delete t.dataset.svInit,console.error("Semantic visualizer fetch error:",u)}))}function ec(){document.querySelectorAll(".semantic-visualizer").forEach(cg)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ec):ec();document.addEventListener("htmx:load",ec); diff --git a/src/toolbarStyles.js b/src/toolbarStyles.js index ad82101..1f14e2c 100644 --- a/src/toolbarStyles.js +++ b/src/toolbarStyles.js @@ -1,4 +1,5 @@ -// Shared look for the top-right toolbar buttons (App.jsx, NamespaceFilter.jsx). +// The labelled top-right toolbar button. App.jsx's own toggles are square glyphs with their own +// style; this is what a control that still carries words looks like beside them. export const toggleBtnStyle = (active) => ({ borderRadius: 4, background: active ? '#eef2ff' : '#fff', diff --git a/vite.config.js b/vite.config.js index 67494f2..8965be0 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,6 +9,10 @@ export default defineConfig({ emptyOutDir: true, rollupOptions: { input: resolve(__dirname, 'src/main.jsx'), + // An app build drops the entry's exports, since nothing inside the bundle uses them — which + // silently removed `init` and would have made `import { init }` fail in the browser, on the one + // page that needs it, with nothing failing at build time. The auto-mount still runs either way. + preserveEntrySignatures: 'exports-only', output: { entryFileNames: 'assets/index.js', assetFileNames: 'assets/index.css',