likec4 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, memo as memo$2, useSyncExternalStore, createRef, useDeferredValue, use, StrictMode } from "react";
3
+ import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, isValidElement, Component, memo as memo$2, useSyncExternalStore, createRef, useDeferredValue, StrictMode } from "react";
4
4
  import { createRoot } from "react-dom/client";
5
5
  import * as ReactDOM from "react-dom";
6
6
  import ReactDOM__default, { createPortal, flushSync } from "react-dom";
@@ -719,7 +719,7 @@ function useHovered() {
719
719
  const [hovered, setHovered] = useState(-1);
720
720
  return [hovered, { setHovered, resetHovered: () => setHovered(-1) }];
721
721
  }
722
- function clamp$5(value, min2, max2) {
722
+ function clamp$4(value, min2, max2) {
723
723
  return min2 === void 0 && max2 === void 0 ? value : min2 !== void 0 && max2 === void 0 ? Math.max(value, min2) : Math.min(min2 === void 0 && max2 !== void 0 ? value : Math.max(value, min2), max2);
724
724
  }
725
725
  function randomId(prefix2 = "mantine-") {
@@ -1060,8 +1060,8 @@ function useMergedRef(...refs) {
1060
1060
  }
1061
1061
  function clampUseMovePosition(position) {
1062
1062
  return {
1063
- x: clamp$5(position.x, 0, 1),
1064
- y: clamp$5(position.y, 0, 1)
1063
+ x: clamp$4(position.x, 0, 1),
1064
+ y: clamp$4(position.y, 0, 1)
1065
1065
  };
1066
1066
  }
1067
1067
  function useMove(onChange, handlers, dir = "ltr") {
@@ -1075,10 +1075,10 @@ function useMove(onChange, handlers, dir = "ltr") {
1075
1075
  node2.style.userSelect = "none";
1076
1076
  const rect = node2.getBoundingClientRect();
1077
1077
  if (rect.width && rect.height) {
1078
- const _x = clamp$5((x2 - rect.left) / rect.width, 0, 1);
1078
+ const _x = clamp$4((x2 - rect.left) / rect.width, 0, 1);
1079
1079
  onChange({
1080
1080
  x: dir === "ltr" ? _x : 1 - _x,
1081
- y: clamp$5((y2 - rect.top) / rect.height, 0, 1)
1081
+ y: clamp$4((y2 - rect.top) / rect.height, 0, 1)
1082
1082
  });
1083
1083
  }
1084
1084
  }
@@ -3400,7 +3400,7 @@ const min$1 = Math.min, max$1 = Math.max, round = Math.round, floor = Math.floor
3400
3400
  start: "end",
3401
3401
  end: "start"
3402
3402
  };
3403
- function clamp$4(start2, value, end) {
3403
+ function clamp$3(start2, value, end) {
3404
3404
  return max$1(start2, min$1(value, end));
3405
3405
  }
3406
3406
  function evaluate(value, param) {
@@ -3671,7 +3671,7 @@ const arrow$3 = (options) => ({
3671
3671
  }, axis = getAlignmentAxis(placement), length = getAxisLength(axis), arrowDimensions = await platform2.getDimensions(element), isYAxis = axis === "y", minProp = isYAxis ? "top" : "left", maxProp = isYAxis ? "bottom" : "right", clientProp = isYAxis ? "clientHeight" : "clientWidth", endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length], startDiff = coords[axis] - rects.reference[axis], arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
3672
3672
  let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
3673
3673
  (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) && (clientSize = elements.floating[clientProp] || rects.floating[length]);
3674
- const centerToReference = endDiff / 2 - startDiff / 2, largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1, minPadding = min$1(paddingObject[minProp], largestPossiblePadding), maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding), min$1$1 = minPadding, max2 = clientSize - arrowDimensions[length] - maxPadding, center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference, offset2 = clamp$4(min$1$1, center, max2), shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0, alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
3674
+ const centerToReference = endDiff / 2 - startDiff / 2, largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1, minPadding = min$1(paddingObject[minProp], largestPossiblePadding), maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding), min$1$1 = minPadding, max2 = clientSize - arrowDimensions[length] - maxPadding, center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference, offset2 = clamp$3(min$1$1, center, max2), shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0, alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
3675
3675
  return {
3676
3676
  [axis]: coords[axis] + alignmentOffset,
3677
3677
  data: {
@@ -3925,11 +3925,11 @@ const offset$3 = function(options) {
3925
3925
  let mainAxisCoord = coords[mainAxis], crossAxisCoord = coords[crossAxis];
3926
3926
  if (checkMainAxis) {
3927
3927
  const minSide = mainAxis === "y" ? "top" : "left", maxSide = mainAxis === "y" ? "bottom" : "right", min2 = mainAxisCoord + overflow[minSide], max2 = mainAxisCoord - overflow[maxSide];
3928
- mainAxisCoord = clamp$4(min2, mainAxisCoord, max2);
3928
+ mainAxisCoord = clamp$3(min2, mainAxisCoord, max2);
3929
3929
  }
3930
3930
  if (checkCrossAxis) {
3931
3931
  const minSide = crossAxis === "y" ? "top" : "left", maxSide = crossAxis === "y" ? "bottom" : "right", min2 = crossAxisCoord + overflow[minSide], max2 = crossAxisCoord - overflow[maxSide];
3932
- crossAxisCoord = clamp$4(min2, crossAxisCoord, max2);
3932
+ crossAxisCoord = clamp$3(min2, crossAxisCoord, max2);
3933
3933
  }
3934
3934
  const limitedCoords = limiter.fn({
3935
3935
  ...state,
@@ -5488,11 +5488,11 @@ function linearScale(input2, output) {
5488
5488
  return output[0] + ratio * (value - input2[0]);
5489
5489
  };
5490
5490
  }
5491
- function clamp$3(value, [min2, max2]) {
5491
+ function clamp$2(value, [min2, max2]) {
5492
5492
  return Math.min(max2, Math.max(min2, value));
5493
5493
  }
5494
5494
  function getThumbOffsetFromScroll(scrollPos, sizes2, dir = "ltr") {
5495
- const thumbSizePx = getThumbSize(sizes2), scrollbarPadding = sizes2.scrollbar.paddingStart + sizes2.scrollbar.paddingEnd, scrollbar = sizes2.scrollbar.size - scrollbarPadding, maxScrollPos = sizes2.content - sizes2.viewport, maxThumbPos = scrollbar - thumbSizePx, scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0], scrollWithoutMomentum = clamp$3(scrollPos, scrollClampRange);
5495
+ const thumbSizePx = getThumbSize(sizes2), scrollbarPadding = sizes2.scrollbar.paddingStart + sizes2.scrollbar.paddingEnd, scrollbar = sizes2.scrollbar.size - scrollbarPadding, maxScrollPos = sizes2.content - sizes2.viewport, maxThumbPos = scrollbar - thumbSizePx, scrollClampRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0], scrollWithoutMomentum = clamp$2(scrollPos, scrollClampRange);
5496
5496
  return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
5497
5497
  }
5498
5498
  function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes2, dir = "ltr") {
@@ -5945,7 +5945,7 @@ const defaultProps$1y = {
5945
5945
  {
5946
5946
  ...getStyles2("scrollbar"),
5947
5947
  orientation: "horizontal",
5948
- "data-hidden": type === "never" || !horizontalThumbVisible || void 0,
5948
+ "data-hidden": type === "never" || offsetScrollbars === "present" && !horizontalThumbVisible ? !0 : void 0,
5949
5949
  forceMount: !0,
5950
5950
  onMouseEnter: () => setScrollbarHovered(!0),
5951
5951
  onMouseLeave: () => setScrollbarHovered(!1),
@@ -5957,7 +5957,7 @@ const defaultProps$1y = {
5957
5957
  {
5958
5958
  ...getStyles2("scrollbar"),
5959
5959
  orientation: "vertical",
5960
- "data-hidden": type === "never" || !verticalThumbVisible || void 0,
5960
+ "data-hidden": type === "never" || offsetScrollbars === "present" && !verticalThumbVisible ? !0 : void 0,
5961
5961
  forceMount: !0,
5962
5962
  onMouseEnter: () => setScrollbarHovered(!0),
5963
5963
  onMouseLeave: () => setScrollbarHovered(!1),
@@ -10433,6 +10433,14 @@ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u"
10433
10433
  function getDefaultExportFromCjs(x2) {
10434
10434
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2.default : x2;
10435
10435
  }
10436
+ var useIsomorphicLayoutEffect_cjs = {}, hasRequiredUseIsomorphicLayoutEffect_cjs;
10437
+ function requireUseIsomorphicLayoutEffect_cjs() {
10438
+ return hasRequiredUseIsomorphicLayoutEffect_cjs || (hasRequiredUseIsomorphicLayoutEffect_cjs = 1, function(exports) {
10439
+ Object.defineProperty(exports, "__esModule", { value: !0 });
10440
+ var react = React__default, isClient = typeof document < "u", index2 = isClient ? react.useLayoutEffect : react.useEffect;
10441
+ exports.default = index2;
10442
+ }(useIsomorphicLayoutEffect_cjs)), useIsomorphicLayoutEffect_cjs;
10443
+ }
10436
10444
  var classes$f = { root: "m_6e45937b", loader: "m_e8eb006c", overlay: "m_df587f17" };
10437
10445
  const defaultProps$u = {
10438
10446
  transitionProps: { transition: "fade", duration: 0 },
@@ -11705,7 +11713,7 @@ const defaultProps$c = {
11705
11713
  });
11706
11714
  useEffect(() => {
11707
11715
  selectFirstOptionOnChange && combobox.selectFirstOption();
11708
- }, [selectFirstOptionOnChange, _value]), useEffect(() => {
11716
+ }, [selectFirstOptionOnChange, search]), useEffect(() => {
11709
11717
  value === null && handleSearchChange(""), typeof value == "string" && selectedOption && (previousSelectedOption?.value !== selectedOption.value || previousSelectedOption?.label !== selectedOption.label) && handleSearchChange(selectedOption.label);
11710
11718
  }, [value, selectedOption]);
11711
11719
  const clearButton = /* @__PURE__ */ jsx(
@@ -12157,11 +12165,15 @@ const defaultProps$a = {
12157
12165
  varsResolver: varsResolver$6,
12158
12166
  unstyled
12159
12167
  }), { dir } = useDirection(), [hovered, setHovered] = useState(!1), [_value, setValue] = useUncontrolled({
12160
- value: typeof value == "number" ? clamp$5(value, min2, max2) : value,
12161
- defaultValue: typeof defaultValue == "number" ? clamp$5(defaultValue, min2, max2) : defaultValue,
12162
- finalValue: clamp$5(0, min2, max2),
12168
+ value: typeof value == "number" ? clamp$4(value, min2, max2) : value,
12169
+ defaultValue: typeof defaultValue == "number" ? clamp$4(defaultValue, min2, max2) : defaultValue,
12170
+ finalValue: clamp$4(0, min2, max2),
12163
12171
  onChange
12164
- }), valueRef = useRef(_value), root2 = useRef(null), thumb = useRef(null), position = getPosition({ value: _value, min: min2, max: max2 }), scaledValue = scale2(_value), _label = typeof label2 == "function" ? label2(scaledValue) : label2, precision = _precision ?? getPrecision(step), handleChange = useCallback(
12172
+ }), valueRef = useRef(_value), onChangeEndRef = useRef(onChangeEnd);
12173
+ useEffect(() => {
12174
+ onChangeEndRef.current = onChangeEnd;
12175
+ }, [onChangeEnd]);
12176
+ const root2 = useRef(null), thumb = useRef(null), position = getPosition({ value: _value, min: min2, max: max2 }), scaledValue = scale2(_value), _label = typeof label2 == "function" ? label2(scaledValue) : label2, precision = _precision ?? getPrecision(step), handleChange = useCallback(
12165
12177
  ({ x: x2 }) => {
12166
12178
  if (!disabled) {
12167
12179
  const nextValue = getChangeValue({
@@ -12180,86 +12192,88 @@ const defaultProps$a = {
12180
12192
  }
12181
12193
  },
12182
12194
  [disabled, min2, max2, step, precision, setValue, marks, restrictToMarks]
12183
- ), { ref: container2, active } = useMove(
12184
- handleChange,
12185
- {
12186
- onScrubEnd: () => !disabled && onChangeEnd?.(
12187
- restrictToMarks && marks?.length ? findClosestNumber(
12188
- valueRef.current,
12189
- marks.map((mark) => mark.value)
12190
- ) : valueRef.current
12191
- )
12192
- },
12193
- dir
12195
+ ), handleScrubEnd = useCallback(() => {
12196
+ if (!disabled && onChangeEndRef.current) {
12197
+ const finalValue = restrictToMarks && marks?.length ? findClosestNumber(
12198
+ valueRef.current,
12199
+ marks.map((mark) => mark.value)
12200
+ ) : valueRef.current;
12201
+ onChangeEndRef.current(finalValue);
12202
+ }
12203
+ }, [disabled, marks, restrictToMarks]), { ref: container2, active } = useMove(handleChange, { onScrubEnd: handleScrubEnd }, dir), callOnChangeEnd = useCallback(
12204
+ (value2) => {
12205
+ !disabled && onChangeEndRef.current && onChangeEndRef.current(value2);
12206
+ },
12207
+ [disabled]
12194
12208
  ), handleTrackKeydownCapture = (event) => {
12195
12209
  if (!disabled)
12196
12210
  switch (event.key) {
12197
12211
  case "ArrowUp": {
12198
12212
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12199
12213
  const nextValue2 = getNextMarkValue(_value, marks);
12200
- setValue(nextValue2), onChangeEnd?.(nextValue2);
12214
+ setValue(nextValue2), callOnChangeEnd(nextValue2);
12201
12215
  break;
12202
12216
  }
12203
12217
  const nextValue = getFloatingValue(
12204
12218
  Math.min(Math.max(_value + step, min2), max2),
12205
12219
  precision
12206
12220
  );
12207
- setValue(nextValue), onChangeEnd?.(nextValue);
12221
+ setValue(nextValue), callOnChangeEnd(nextValue);
12208
12222
  break;
12209
12223
  }
12210
12224
  case "ArrowRight": {
12211
12225
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12212
12226
  const nextValue2 = dir === "rtl" ? getPreviousMarkValue(_value, marks) : getNextMarkValue(_value, marks);
12213
- setValue(nextValue2), onChangeEnd?.(nextValue2);
12227
+ setValue(nextValue2), callOnChangeEnd(nextValue2);
12214
12228
  break;
12215
12229
  }
12216
12230
  const nextValue = getFloatingValue(
12217
12231
  Math.min(Math.max(dir === "rtl" ? _value - step : _value + step, min2), max2),
12218
12232
  precision
12219
12233
  );
12220
- setValue(nextValue), onChangeEnd?.(nextValue);
12234
+ setValue(nextValue), callOnChangeEnd(nextValue);
12221
12235
  break;
12222
12236
  }
12223
12237
  case "ArrowDown": {
12224
12238
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12225
12239
  const nextValue2 = getPreviousMarkValue(_value, marks);
12226
- setValue(nextValue2), onChangeEnd?.(nextValue2);
12240
+ setValue(nextValue2), callOnChangeEnd(nextValue2);
12227
12241
  break;
12228
12242
  }
12229
12243
  const nextValue = getFloatingValue(
12230
12244
  Math.min(Math.max(_value - step, min2), max2),
12231
12245
  precision
12232
12246
  );
12233
- setValue(nextValue), onChangeEnd?.(nextValue);
12247
+ setValue(nextValue), callOnChangeEnd(nextValue);
12234
12248
  break;
12235
12249
  }
12236
12250
  case "ArrowLeft": {
12237
12251
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12238
12252
  const nextValue2 = dir === "rtl" ? getNextMarkValue(_value, marks) : getPreviousMarkValue(_value, marks);
12239
- setValue(nextValue2), onChangeEnd?.(nextValue2);
12253
+ setValue(nextValue2), callOnChangeEnd(nextValue2);
12240
12254
  break;
12241
12255
  }
12242
12256
  const nextValue = getFloatingValue(
12243
12257
  Math.min(Math.max(dir === "rtl" ? _value + step : _value - step, min2), max2),
12244
12258
  precision
12245
12259
  );
12246
- setValue(nextValue), onChangeEnd?.(nextValue);
12260
+ setValue(nextValue), callOnChangeEnd(nextValue);
12247
12261
  break;
12248
12262
  }
12249
12263
  case "Home": {
12250
12264
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12251
- setValue(getFirstMarkValue(marks)), onChangeEnd?.(getFirstMarkValue(marks));
12265
+ setValue(getFirstMarkValue(marks)), callOnChangeEnd(getFirstMarkValue(marks));
12252
12266
  break;
12253
12267
  }
12254
- setValue(min2), onChangeEnd?.(min2);
12268
+ setValue(min2), callOnChangeEnd(min2);
12255
12269
  break;
12256
12270
  }
12257
12271
  case "End": {
12258
12272
  if (event.preventDefault(), thumb.current?.focus(), restrictToMarks && marks) {
12259
- setValue(getLastMarkValue(marks)), onChangeEnd?.(getLastMarkValue(marks));
12273
+ setValue(getLastMarkValue(marks)), callOnChangeEnd(getLastMarkValue(marks));
12260
12274
  break;
12261
12275
  }
12262
- setValue(max2), onChangeEnd?.(max2);
12276
+ setValue(max2), callOnChangeEnd(max2);
12263
12277
  break;
12264
12278
  }
12265
12279
  }
@@ -12969,7 +12983,7 @@ function useTree({
12969
12983
  onNodeCollapse,
12970
12984
  onNodeExpand
12971
12985
  } = {}) {
12972
- const [data, setData] = useState([]), [expandedState, setExpandedState] = useState(initialExpandedState), [selectedState, setSelectedState] = useState(initialSelectedState), [checkedState, setCheckedState] = useState(initialCheckedState), [anchorNode, setAnchorNode] = useState(null), [hoveredNode, setHoveredNode] = useState(null), initialize = useCallback(
12986
+ const [data, setData] = useState([]), [expandedState, setExpandedState] = useState(initialExpandedState), [selectedState, setSelectedState] = useState(initialSelectedState), [checkedState, setCheckedState] = useState(initialCheckedState), [anchorNode, setAnchorNode] = useState(null), [hoveredNode, setHoveredNode2] = useState(null), initialize = useCallback(
12973
12987
  (_data) => {
12974
12988
  setExpandedState((current) => getInitialTreeExpandedState(current, _data, selectedState)), setCheckedState((current) => getInitialCheckedState(current, _data)), setData(_data);
12975
12989
  },
@@ -13058,7 +13072,7 @@ function useTree({
13058
13072
  clearSelected,
13059
13073
  setSelectedState,
13060
13074
  hoveredNode,
13061
- setHoveredNode,
13075
+ setHoveredNode: setHoveredNode2,
13062
13076
  getCheckedNodes: () => getAllCheckedNodes(data, checkedState).result,
13063
13077
  isNodeChecked: (value) => memoizedIsNodeChecked(value, data, checkedState),
13064
13078
  isNodeIndeterminate: (value) => memoizedIsNodeIndeterminate(value, data, checkedState)
@@ -17001,210 +17015,11 @@ const AnimatePresence = ({ children: children2, custom: custom5, initial = !0, o
17001
17015
  return jsx(PresenceChild, { isPresent, initial: !isInitialRender.current || initial ? void 0 : !1, custom: custom5, presenceAffectsLayout, mode, onExitComplete: isPresent ? void 0 : onExit, anchorX, children: child }, key2);
17002
17016
  }) });
17003
17017
  }, DeprecatedLayoutGroupContext = createContext(null);
17004
- function addUniqueItem(arr, item) {
17005
- arr.indexOf(item) === -1 && arr.push(item);
17006
- }
17007
- function removeItem(arr, item) {
17008
- const index2 = arr.indexOf(item);
17009
- index2 > -1 && arr.splice(index2, 1);
17010
- }
17011
- let invariant = () => {
17012
- };
17013
- const MotionGlobalConfig = {
17014
- useManualTiming: !1
17015
- };
17016
- // @__NO_SIDE_EFFECTS__
17017
- function memo(callback) {
17018
- let result;
17019
- return () => (result === void 0 && (result = callback()), result);
17020
- }
17021
- const noop$3 = /* @__NO_SIDE_EFFECTS__ */ (any) => any, progress = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
17022
- const toFromDifference = to - from;
17023
- return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
17024
- };
17025
- class SubscriptionManager {
17026
- constructor() {
17027
- this.subscriptions = [];
17028
- }
17029
- add(handler) {
17030
- return addUniqueItem(this.subscriptions, handler), () => removeItem(this.subscriptions, handler);
17031
- }
17032
- notify(a2, b2, c2) {
17033
- const numSubscriptions = this.subscriptions.length;
17034
- if (numSubscriptions)
17035
- if (numSubscriptions === 1)
17036
- this.subscriptions[0](a2, b2, c2);
17037
- else
17038
- for (let i2 = 0; i2 < numSubscriptions; i2++) {
17039
- const handler = this.subscriptions[i2];
17040
- handler && handler(a2, b2, c2);
17041
- }
17042
- }
17043
- getSize() {
17044
- return this.subscriptions.length;
17045
- }
17046
- clear() {
17047
- this.subscriptions.length = 0;
17048
- }
17049
- }
17050
- const secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (seconds) => seconds * 1e3, millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (milliseconds) => milliseconds / 1e3;
17051
- function velocityPerSecond(velocity, frameDuration) {
17052
- return frameDuration ? velocity * (1e3 / frameDuration) : 0;
17053
- }
17054
- const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
17055
- class GroupAnimation {
17056
- constructor(animations2) {
17057
- this.stop = () => this.runAll("stop"), this.animations = animations2.filter(Boolean);
17058
- }
17059
- get finished() {
17060
- return Promise.all(this.animations.map((animation) => animation.finished));
17061
- }
17062
- /**
17063
- * TODO: Filter out cancelled or stopped animations before returning
17064
- */
17065
- getAll(propName) {
17066
- return this.animations[0][propName];
17067
- }
17068
- setAll(propName, newValue) {
17069
- for (let i2 = 0; i2 < this.animations.length; i2++)
17070
- this.animations[i2][propName] = newValue;
17071
- }
17072
- attachTimeline(timeline, fallback) {
17073
- const subscriptions = this.animations.map((animation) => {
17074
- if (supportsScrollTimeline() && animation.attachTimeline)
17075
- return animation.attachTimeline(timeline);
17076
- if (typeof fallback == "function")
17077
- return fallback(animation);
17078
- });
17079
- return () => {
17080
- subscriptions.forEach((cancel, i2) => {
17081
- cancel && cancel(), this.animations[i2].stop();
17082
- });
17083
- };
17084
- }
17085
- get time() {
17086
- return this.getAll("time");
17087
- }
17088
- set time(time2) {
17089
- this.setAll("time", time2);
17090
- }
17091
- get speed() {
17092
- return this.getAll("speed");
17093
- }
17094
- set speed(speed) {
17095
- this.setAll("speed", speed);
17096
- }
17097
- get startTime() {
17098
- return this.getAll("startTime");
17099
- }
17100
- get duration() {
17101
- let max2 = 0;
17102
- for (let i2 = 0; i2 < this.animations.length; i2++)
17103
- max2 = Math.max(max2, this.animations[i2].duration);
17104
- return max2;
17105
- }
17106
- runAll(methodName) {
17107
- this.animations.forEach((controls) => controls[methodName]());
17108
- }
17109
- flatten() {
17110
- this.runAll("flatten");
17111
- }
17112
- play() {
17113
- this.runAll("play");
17114
- }
17115
- pause() {
17116
- this.runAll("pause");
17117
- }
17118
- cancel() {
17119
- this.runAll("cancel");
17120
- }
17121
- complete() {
17122
- this.runAll("complete");
17123
- }
17124
- }
17125
- class GroupAnimationWithThen extends GroupAnimation {
17126
- then(onResolve, _onReject) {
17127
- return this.finished.finally(onResolve).then(() => {
17128
- });
17129
- }
17130
- }
17131
- const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] == "number", supportsFlags = {};
17132
- function memoSupports(callback, supportsFlag) {
17133
- const memoized = /* @__PURE__ */ memo(callback);
17134
- return () => supportsFlags[supportsFlag] ?? memoized();
17135
- }
17136
- const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
17137
- try {
17138
- document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
17139
- } catch {
17140
- return !1;
17141
- }
17142
- return !0;
17143
- }, "linearEasing"), generateLinearEasing = (easing, duration, resolution = 10) => {
17144
- let points = "";
17145
- const numPoints = Math.max(Math.round(duration / resolution), 2);
17146
- for (let i2 = 0; i2 < numPoints; i2++)
17147
- points += easing(i2 / (numPoints - 1)) + ", ";
17148
- return `linear(${points.substring(0, points.length - 2)})`;
17149
- }, cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`, supportedWaapiEasing = {
17150
- linear: "linear",
17151
- ease: "ease",
17152
- easeIn: "ease-in",
17153
- easeOut: "ease-out",
17154
- easeInOut: "ease-in-out",
17155
- circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
17156
- circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
17157
- backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
17158
- backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
17159
- };
17160
- function mapEasingToNativeEasing(easing, duration) {
17161
- if (easing)
17162
- return typeof easing == "function" && supportsLinearEasing() ? generateLinearEasing(easing, duration) : isBezierDefinition(easing) ? cubicBezierAsString(easing) : Array.isArray(easing) ? easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[easing];
17163
- }
17164
- function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}, pseudoElement = void 0) {
17165
- const keyframeOptions = {
17166
- [valueName]: keyframes2
17167
- };
17168
- times && (keyframeOptions.offset = times);
17169
- const easing = mapEasingToNativeEasing(ease2, duration);
17170
- return Array.isArray(easing) && (keyframeOptions.easing = easing), element.animate(keyframeOptions, {
17171
- delay: delay2,
17172
- duration,
17173
- easing: Array.isArray(easing) ? "linear" : easing,
17174
- fill: "both",
17175
- iterations: repeat + 1,
17176
- direction: repeatType === "reverse" ? "alternate" : "normal",
17177
- pseudoElement
17178
- });
17179
- }
17180
- function isGenerator(type) {
17181
- return typeof type == "function" && "applyToOptions" in type;
17182
- }
17183
- function getValueTransition$1(transition, key2) {
17184
- return transition?.[key2] ?? transition?.default ?? transition;
17185
- }
17186
- const maxGeneratorDuration = 2e4;
17187
- function calcGeneratorDuration(generator) {
17188
- let duration = 0;
17189
- const timeStep = 50;
17190
- let state = generator.next(duration);
17191
- for (; !state.done && duration < maxGeneratorDuration; )
17192
- duration += timeStep, state = generator.next(duration);
17193
- return duration >= maxGeneratorDuration ? 1 / 0 : duration;
17194
- }
17195
- function createGeneratorEasing(options, scale2 = 100, createGenerator) {
17196
- const generator = createGenerator({ ...options, keyframes: [0, scale2] }), duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
17197
- return {
17198
- type: "keyframes",
17199
- ease: (progress2) => generator.next(duration * progress2).value / scale2,
17200
- duration: /* @__PURE__ */ millisecondsToSeconds(duration)
17201
- };
17202
- }
17203
- function isWaapiSupportedEasing(easing) {
17204
- return !!(typeof easing == "function" && supportsLinearEasing() || !easing || typeof easing == "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
17205
- }
17206
- function attachTimeline(animation, timeline) {
17207
- animation.timeline = timeline, animation.onfinish = null;
17018
+ function useIsMounted() {
17019
+ const isMounted = useRef(!1);
17020
+ return useIsomorphicLayoutEffect$2(() => (isMounted.current = !0, () => {
17021
+ isMounted.current = !1;
17022
+ }), []), isMounted;
17208
17023
  }
17209
17024
  const stepsOrder = [
17210
17025
  "read",
@@ -17258,7 +17073,9 @@ function createRenderStep(runNextFrame, stepName) {
17258
17073
  };
17259
17074
  return step;
17260
17075
  }
17261
- const maxElapsed = 40;
17076
+ const MotionGlobalConfig = {
17077
+ useManualTiming: !1
17078
+ }, maxElapsed = 40;
17262
17079
  function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
17263
17080
  let runNextFrame = !1, useDefaultElapsed = !0;
17264
17081
  const state = {
@@ -17279,321 +17096,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
17279
17096
  steps[stepsOrder[i2]].cancel(process2);
17280
17097
  }, state, steps };
17281
17098
  }
17282
- const { schedule: frame$1, cancel: cancelFrame, state: frameData, steps: frameSteps } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame < "u" ? requestAnimationFrame : noop$3, !0), { schedule: microtask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, !1);
17283
- let now$1;
17284
- function clearTime() {
17285
- now$1 = void 0;
17286
- }
17287
- const time = {
17288
- now: () => (now$1 === void 0 && time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now()), now$1),
17289
- set: (newTime) => {
17290
- now$1 = newTime, queueMicrotask(clearTime);
17291
- }
17292
- }, isDragging = {
17293
- x: !1,
17294
- y: !1
17295
- };
17296
- function isDragActive() {
17297
- return isDragging.x || isDragging.y;
17298
- }
17299
- function setDragLock(axis) {
17300
- return axis === "x" || axis === "y" ? isDragging[axis] ? null : (isDragging[axis] = !0, () => {
17301
- isDragging[axis] = !1;
17302
- }) : isDragging.x || isDragging.y ? null : (isDragging.x = isDragging.y = !0, () => {
17303
- isDragging.x = isDragging.y = !1;
17304
- });
17305
- }
17306
- function resolveElements(elementOrSelector, scope, selectorCache) {
17307
- if (elementOrSelector instanceof EventTarget)
17308
- return [elementOrSelector];
17309
- if (typeof elementOrSelector == "string") {
17310
- let root2 = document;
17311
- const elements = selectorCache?.[elementOrSelector] ?? root2.querySelectorAll(elementOrSelector);
17312
- return elements ? Array.from(elements) : [];
17313
- }
17314
- return Array.from(elementOrSelector);
17315
- }
17316
- function setupGesture(elementOrSelector, options) {
17317
- const elements = resolveElements(elementOrSelector), gestureAbortController = new AbortController(), eventOptions = {
17318
- passive: !0,
17319
- ...options,
17320
- signal: gestureAbortController.signal
17321
- };
17322
- return [elements, eventOptions, () => gestureAbortController.abort()];
17323
- }
17324
- function isValidHover(event) {
17325
- return !(event.pointerType === "touch" || isDragActive());
17326
- }
17327
- function hover(elementOrSelector, onHoverStart, options = {}) {
17328
- const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options), onPointerEnter = (enterEvent) => {
17329
- if (!isValidHover(enterEvent))
17330
- return;
17331
- const { target } = enterEvent, onHoverEnd = onHoverStart(target, enterEvent);
17332
- if (typeof onHoverEnd != "function" || !target)
17333
- return;
17334
- const onPointerLeave = (leaveEvent) => {
17335
- isValidHover(leaveEvent) && (onHoverEnd(leaveEvent), target.removeEventListener("pointerleave", onPointerLeave));
17336
- };
17337
- target.addEventListener("pointerleave", onPointerLeave, eventOptions);
17338
- };
17339
- return elements.forEach((element) => {
17340
- element.addEventListener("pointerenter", onPointerEnter, eventOptions);
17341
- }), cancel;
17342
- }
17343
- const isNodeOrChild = (parent, child) => child ? parent === child ? !0 : isNodeOrChild(parent, child.parentElement) : !1, isPrimaryPointer = (event) => event.pointerType === "mouse" ? typeof event.button != "number" || event.button <= 0 : event.isPrimary !== !1, focusableElements = /* @__PURE__ */ new Set([
17344
- "BUTTON",
17345
- "INPUT",
17346
- "SELECT",
17347
- "TEXTAREA",
17348
- "A"
17349
- ]);
17350
- function isElementKeyboardAccessible(element) {
17351
- return focusableElements.has(element.tagName) || element.tabIndex !== -1;
17352
- }
17353
- const isPressing = /* @__PURE__ */ new WeakSet();
17354
- function filterEvents(callback) {
17355
- return (event) => {
17356
- event.key === "Enter" && callback(event);
17357
- };
17358
- }
17359
- function firePointerEvent(target, type) {
17360
- target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: !0, bubbles: !0 }));
17361
- }
17362
- const enableKeyboardPress = (focusEvent, eventOptions) => {
17363
- const element = focusEvent.currentTarget;
17364
- if (!element)
17365
- return;
17366
- const handleKeydown = filterEvents(() => {
17367
- if (isPressing.has(element))
17368
- return;
17369
- firePointerEvent(element, "down");
17370
- const handleKeyup = filterEvents(() => {
17371
- firePointerEvent(element, "up");
17372
- }), handleBlur = () => firePointerEvent(element, "cancel");
17373
- element.addEventListener("keyup", handleKeyup, eventOptions), element.addEventListener("blur", handleBlur, eventOptions);
17374
- });
17375
- element.addEventListener("keydown", handleKeydown, eventOptions), element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
17376
- };
17377
- function isValidPressEvent(event) {
17378
- return isPrimaryPointer(event) && !isDragActive();
17379
- }
17380
- function press(targetOrSelector, onPressStart, options = {}) {
17381
- const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options), startPress = (startEvent) => {
17382
- const target = startEvent.currentTarget;
17383
- if (!isValidPressEvent(startEvent) || isPressing.has(target))
17384
- return;
17385
- isPressing.add(target);
17386
- const onPressEnd = onPressStart(target, startEvent), onPointerEnd = (endEvent, success) => {
17387
- window.removeEventListener("pointerup", onPointerUp), window.removeEventListener("pointercancel", onPointerCancel), !(!isValidPressEvent(endEvent) || !isPressing.has(target)) && (isPressing.delete(target), typeof onPressEnd == "function" && onPressEnd(endEvent, { success }));
17388
- }, onPointerUp = (upEvent) => {
17389
- onPointerEnd(upEvent, target === window || target === document || options.useGlobalTarget || isNodeOrChild(target, upEvent.target));
17390
- }, onPointerCancel = (cancelEvent) => {
17391
- onPointerEnd(cancelEvent, !1);
17392
- };
17393
- window.addEventListener("pointerup", onPointerUp, eventOptions), window.addEventListener("pointercancel", onPointerCancel, eventOptions);
17394
- };
17395
- return targets.forEach((target) => {
17396
- (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), target instanceof HTMLElement && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex") && (target.tabIndex = 0));
17397
- }), cancelEvents;
17398
- }
17399
- const MAX_VELOCITY_DELTA = 30, isFloat = (value) => !isNaN(parseFloat(value));
17400
- class MotionValue {
17401
- /**
17402
- * @param init - The initiating value
17403
- * @param config - Optional configuration options
17404
- *
17405
- * - `transformer`: A function to transform incoming values with.
17406
- */
17407
- constructor(init2, options = {}) {
17408
- this.version = "12.6.3", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v, render = !0) => {
17409
- const currentTime = time.now();
17410
- this.updatedAt !== currentTime && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(v), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), render && this.events.renderRequest && this.events.renderRequest.notify(this.current);
17411
- }, this.hasAnimated = !1, this.setCurrent(init2), this.owner = options.owner;
17412
- }
17413
- setCurrent(current) {
17414
- this.current = current, this.updatedAt = time.now(), this.canTrackVelocity === null && current !== void 0 && (this.canTrackVelocity = isFloat(this.current));
17415
- }
17416
- setPrevFrameValue(prevFrameValue = this.current) {
17417
- this.prevFrameValue = prevFrameValue, this.prevUpdatedAt = this.updatedAt;
17418
- }
17419
- /**
17420
- * Adds a function that will be notified when the `MotionValue` is updated.
17421
- *
17422
- * It returns a function that, when called, will cancel the subscription.
17423
- *
17424
- * When calling `onChange` inside a React component, it should be wrapped with the
17425
- * `useEffect` hook. As it returns an unsubscribe function, this should be returned
17426
- * from the `useEffect` function to ensure you don't add duplicate subscribers..
17427
- *
17428
- * ```jsx
17429
- * export const MyComponent = () => {
17430
- * const x = useMotionValue(0)
17431
- * const y = useMotionValue(0)
17432
- * const opacity = useMotionValue(1)
17433
- *
17434
- * useEffect(() => {
17435
- * function updateOpacity() {
17436
- * const maxXY = Math.max(x.get(), y.get())
17437
- * const newOpacity = transform(maxXY, [0, 100], [1, 0])
17438
- * opacity.set(newOpacity)
17439
- * }
17440
- *
17441
- * const unsubscribeX = x.on("change", updateOpacity)
17442
- * const unsubscribeY = y.on("change", updateOpacity)
17443
- *
17444
- * return () => {
17445
- * unsubscribeX()
17446
- * unsubscribeY()
17447
- * }
17448
- * }, [])
17449
- *
17450
- * return <motion.div style={{ x }} />
17451
- * }
17452
- * ```
17453
- *
17454
- * @param subscriber - A function that receives the latest value.
17455
- * @returns A function that, when called, will cancel this subscription.
17456
- *
17457
- * @deprecated
17458
- */
17459
- onChange(subscription) {
17460
- return this.on("change", subscription);
17461
- }
17462
- on(eventName, callback) {
17463
- this.events[eventName] || (this.events[eventName] = new SubscriptionManager());
17464
- const unsubscribe = this.events[eventName].add(callback);
17465
- return eventName === "change" ? () => {
17466
- unsubscribe(), frame$1.read(() => {
17467
- this.events.change.getSize() || this.stop();
17468
- });
17469
- } : unsubscribe;
17470
- }
17471
- clearListeners() {
17472
- for (const eventManagers in this.events)
17473
- this.events[eventManagers].clear();
17474
- }
17475
- /**
17476
- * Attaches a passive effect to the `MotionValue`.
17477
- */
17478
- attach(passiveEffect, stopPassiveEffect) {
17479
- this.passiveEffect = passiveEffect, this.stopPassiveEffect = stopPassiveEffect;
17480
- }
17481
- /**
17482
- * Sets the state of the `MotionValue`.
17483
- *
17484
- * @remarks
17485
- *
17486
- * ```jsx
17487
- * const x = useMotionValue(0)
17488
- * x.set(10)
17489
- * ```
17490
- *
17491
- * @param latest - Latest value to set.
17492
- * @param render - Whether to notify render subscribers. Defaults to `true`
17493
- *
17494
- * @public
17495
- */
17496
- set(v, render = !0) {
17497
- !render || !this.passiveEffect ? this.updateAndNotify(v, render) : this.passiveEffect(v, this.updateAndNotify);
17498
- }
17499
- setWithVelocity(prev, current, delta) {
17500
- this.set(current), this.prev = void 0, this.prevFrameValue = prev, this.prevUpdatedAt = this.updatedAt - delta;
17501
- }
17502
- /**
17503
- * Set the state of the `MotionValue`, stopping any active animations,
17504
- * effects, and resets velocity to `0`.
17505
- */
17506
- jump(v, endAnimation = !0) {
17507
- this.updateAndNotify(v), this.prev = v, this.prevUpdatedAt = this.prevFrameValue = void 0, endAnimation && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
17508
- }
17509
- /**
17510
- * Returns the latest state of `MotionValue`
17511
- *
17512
- * @returns - The latest state of `MotionValue`
17513
- *
17514
- * @public
17515
- */
17516
- get() {
17517
- return this.current;
17518
- }
17519
- /**
17520
- * @public
17521
- */
17522
- getPrevious() {
17523
- return this.prev;
17524
- }
17525
- /**
17526
- * Returns the latest velocity of `MotionValue`
17527
- *
17528
- * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
17529
- *
17530
- * @public
17531
- */
17532
- getVelocity() {
17533
- const currentTime = time.now();
17534
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA)
17535
- return 0;
17536
- const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
17537
- return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
17538
- }
17539
- /**
17540
- * Registers a new animation to control this `MotionValue`. Only one
17541
- * animation can drive a `MotionValue` at one time.
17542
- *
17543
- * ```jsx
17544
- * value.start()
17545
- * ```
17546
- *
17547
- * @param animation - A function that starts the provided animation
17548
- */
17549
- start(startAnimation) {
17550
- return this.stop(), new Promise((resolve) => {
17551
- this.hasAnimated = !0, this.animation = startAnimation(resolve), this.events.animationStart && this.events.animationStart.notify();
17552
- }).then(() => {
17553
- this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
17554
- });
17555
- }
17556
- /**
17557
- * Stop the currently active animation.
17558
- *
17559
- * @public
17560
- */
17561
- stop() {
17562
- this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
17563
- }
17564
- /**
17565
- * Returns `true` if this value is currently animating.
17566
- *
17567
- * @public
17568
- */
17569
- isAnimating() {
17570
- return !!this.animation;
17571
- }
17572
- clearAnimation() {
17573
- delete this.animation;
17574
- }
17575
- /**
17576
- * Destroy and clean up subscribers to this `MotionValue`.
17577
- *
17578
- * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
17579
- * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
17580
- * created a `MotionValue` via the `motionValue` function.
17581
- *
17582
- * @public
17583
- */
17584
- destroy() {
17585
- this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
17586
- }
17587
- }
17588
- function motionValue(init2, options) {
17589
- return new MotionValue(init2, options);
17590
- }
17591
- function useIsMounted() {
17592
- const isMounted = useRef(!1);
17593
- return useIsomorphicLayoutEffect$2(() => (isMounted.current = !0, () => {
17594
- isMounted.current = !1;
17595
- }), []), isMounted;
17596
- }
17099
+ const noop$3 = /* @__NO_SIDE_EFFECTS__ */ (any) => any, { schedule: frame$1, cancel: cancelFrame, state: frameData, steps: frameSteps } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame < "u" ? requestAnimationFrame : noop$3, !0);
17597
17100
  function useForceUpdate() {
17598
17101
  const isMounted = useIsMounted(), [forcedRenderCount, setForcedRenderCount] = useState(0), forceRender = useCallback(() => {
17599
17102
  isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
@@ -17797,7 +17300,7 @@ function useMotionRef(visualState, visualElement, externalRef) {
17797
17300
  [visualElement]
17798
17301
  );
17799
17302
  }
17800
- const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), optimizedAppearDataId = "framerAppearId", optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId), SwitchLayoutGroupContext = createContext({});
17303
+ const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), optimizedAppearDataId = "framerAppearId", optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId), SwitchLayoutGroupContext = createContext({}), { schedule: microtask } = /* @__PURE__ */ createRenderBatcher(queueMicrotask, !1);
17801
17304
  function useVisualElement(Component2, visualState, props, createVisualElement, ProjectionNodeConstructor) {
17802
17305
  const { visualElement: parent } = useContext(MotionContext), lazyContext = useContext(LazyContext), presenceContext = useContext(PresenceContext), reducedMotionConfig = useContext(MotionConfigContext).reducedMotion, visualElementRef = useRef(null);
17803
17306
  createVisualElement = createVisualElement || lazyContext.renderer, !visualElementRef.current && createVisualElement && (visualElementRef.current = createVisualElement(Component2, {
@@ -17824,7 +17327,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
17824
17327
  }), visualElement;
17825
17328
  }
17826
17329
  function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
17827
- const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot } = props;
17330
+ const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot, layoutCrossfade } = props;
17828
17331
  visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent)), visualElement.projection.setOptions({
17829
17332
  layoutId,
17830
17333
  layout: layout2,
@@ -17839,6 +17342,7 @@ function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor,
17839
17342
  */
17840
17343
  animationType: typeof layout2 == "string" ? layout2 : "both",
17841
17344
  initialPromotionConfig,
17345
+ crossfade: layoutCrossfade,
17842
17346
  layoutScroll,
17843
17347
  layoutRoot
17844
17348
  });
@@ -17847,6 +17351,8 @@ function getClosestProjectingNode(visualElement) {
17847
17351
  if (visualElement)
17848
17352
  return visualElement.options.allowProjection !== !1 ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
17849
17353
  }
17354
+ let invariant = () => {
17355
+ };
17850
17356
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component: Component2 }) {
17851
17357
  function MotionComponent(props, externalRef) {
17852
17358
  let MeasureLayout2;
@@ -17910,13 +17416,13 @@ const transformPropOrder = [
17910
17416
  function isForcedMotionValue(key2, { layout: layout2, layoutId }) {
17911
17417
  return transformProps.has(key2) || key2.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key2] || key2 === "opacity");
17912
17418
  }
17913
- const isMotionValue = (value) => !!(value && value.getVelocity), getValueAsType = (value, type) => type && typeof value == "number" ? type.transform(value) : value, clamp$2 = (min2, max2, v) => v > max2 ? max2 : v < min2 ? min2 : v, number = {
17419
+ const isMotionValue = (value) => !!(value && value.getVelocity), getValueAsType = (value, type) => type && typeof value == "number" ? type.transform(value) : value, clamp$1 = (min2, max2, v) => v > max2 ? max2 : v < min2 ? min2 : v, number = {
17914
17420
  test: (v) => typeof v == "number",
17915
17421
  parse: parseFloat,
17916
17422
  transform: (v) => v
17917
17423
  }, alpha = {
17918
17424
  ...number,
17919
- transform: (v) => clamp$2(0, 1, v)
17425
+ transform: (v) => clamp$1(0, 1, v)
17920
17426
  }, scale = {
17921
17427
  ...number,
17922
17428
  default: 1
@@ -18375,6 +17881,243 @@ const positionalKeys = /* @__PURE__ */ new Set([
18375
17881
  "bottom",
18376
17882
  ...transformPropOrder
18377
17883
  ]);
17884
+ let now$1;
17885
+ function clearTime() {
17886
+ now$1 = void 0;
17887
+ }
17888
+ const time = {
17889
+ now: () => (now$1 === void 0 && time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now()), now$1),
17890
+ set: (newTime) => {
17891
+ now$1 = newTime, queueMicrotask(clearTime);
17892
+ }
17893
+ };
17894
+ function addUniqueItem(arr, item) {
17895
+ arr.indexOf(item) === -1 && arr.push(item);
17896
+ }
17897
+ function removeItem(arr, item) {
17898
+ const index2 = arr.indexOf(item);
17899
+ index2 > -1 && arr.splice(index2, 1);
17900
+ }
17901
+ class SubscriptionManager {
17902
+ constructor() {
17903
+ this.subscriptions = [];
17904
+ }
17905
+ add(handler) {
17906
+ return addUniqueItem(this.subscriptions, handler), () => removeItem(this.subscriptions, handler);
17907
+ }
17908
+ notify(a2, b2, c2) {
17909
+ const numSubscriptions = this.subscriptions.length;
17910
+ if (numSubscriptions)
17911
+ if (numSubscriptions === 1)
17912
+ this.subscriptions[0](a2, b2, c2);
17913
+ else
17914
+ for (let i2 = 0; i2 < numSubscriptions; i2++) {
17915
+ const handler = this.subscriptions[i2];
17916
+ handler && handler(a2, b2, c2);
17917
+ }
17918
+ }
17919
+ getSize() {
17920
+ return this.subscriptions.length;
17921
+ }
17922
+ clear() {
17923
+ this.subscriptions.length = 0;
17924
+ }
17925
+ }
17926
+ function velocityPerSecond(velocity, frameDuration) {
17927
+ return frameDuration ? velocity * (1e3 / frameDuration) : 0;
17928
+ }
17929
+ const MAX_VELOCITY_DELTA = 30, isFloat = (value) => !isNaN(parseFloat(value));
17930
+ class MotionValue {
17931
+ /**
17932
+ * @param init - The initiating value
17933
+ * @param config - Optional configuration options
17934
+ *
17935
+ * - `transformer`: A function to transform incoming values with.
17936
+ */
17937
+ constructor(init2, options = {}) {
17938
+ this.version = "12.7.3", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (v, render = !0) => {
17939
+ const currentTime = time.now();
17940
+ this.updatedAt !== currentTime && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(v), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), render && this.events.renderRequest && this.events.renderRequest.notify(this.current);
17941
+ }, this.hasAnimated = !1, this.setCurrent(init2), this.owner = options.owner;
17942
+ }
17943
+ setCurrent(current) {
17944
+ this.current = current, this.updatedAt = time.now(), this.canTrackVelocity === null && current !== void 0 && (this.canTrackVelocity = isFloat(this.current));
17945
+ }
17946
+ setPrevFrameValue(prevFrameValue = this.current) {
17947
+ this.prevFrameValue = prevFrameValue, this.prevUpdatedAt = this.updatedAt;
17948
+ }
17949
+ /**
17950
+ * Adds a function that will be notified when the `MotionValue` is updated.
17951
+ *
17952
+ * It returns a function that, when called, will cancel the subscription.
17953
+ *
17954
+ * When calling `onChange` inside a React component, it should be wrapped with the
17955
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
17956
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
17957
+ *
17958
+ * ```jsx
17959
+ * export const MyComponent = () => {
17960
+ * const x = useMotionValue(0)
17961
+ * const y = useMotionValue(0)
17962
+ * const opacity = useMotionValue(1)
17963
+ *
17964
+ * useEffect(() => {
17965
+ * function updateOpacity() {
17966
+ * const maxXY = Math.max(x.get(), y.get())
17967
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
17968
+ * opacity.set(newOpacity)
17969
+ * }
17970
+ *
17971
+ * const unsubscribeX = x.on("change", updateOpacity)
17972
+ * const unsubscribeY = y.on("change", updateOpacity)
17973
+ *
17974
+ * return () => {
17975
+ * unsubscribeX()
17976
+ * unsubscribeY()
17977
+ * }
17978
+ * }, [])
17979
+ *
17980
+ * return <motion.div style={{ x }} />
17981
+ * }
17982
+ * ```
17983
+ *
17984
+ * @param subscriber - A function that receives the latest value.
17985
+ * @returns A function that, when called, will cancel this subscription.
17986
+ *
17987
+ * @deprecated
17988
+ */
17989
+ onChange(subscription) {
17990
+ return this.on("change", subscription);
17991
+ }
17992
+ on(eventName, callback) {
17993
+ this.events[eventName] || (this.events[eventName] = new SubscriptionManager());
17994
+ const unsubscribe = this.events[eventName].add(callback);
17995
+ return eventName === "change" ? () => {
17996
+ unsubscribe(), frame$1.read(() => {
17997
+ this.events.change.getSize() || this.stop();
17998
+ });
17999
+ } : unsubscribe;
18000
+ }
18001
+ clearListeners() {
18002
+ for (const eventManagers in this.events)
18003
+ this.events[eventManagers].clear();
18004
+ }
18005
+ /**
18006
+ * Attaches a passive effect to the `MotionValue`.
18007
+ */
18008
+ attach(passiveEffect, stopPassiveEffect) {
18009
+ this.passiveEffect = passiveEffect, this.stopPassiveEffect = stopPassiveEffect;
18010
+ }
18011
+ /**
18012
+ * Sets the state of the `MotionValue`.
18013
+ *
18014
+ * @remarks
18015
+ *
18016
+ * ```jsx
18017
+ * const x = useMotionValue(0)
18018
+ * x.set(10)
18019
+ * ```
18020
+ *
18021
+ * @param latest - Latest value to set.
18022
+ * @param render - Whether to notify render subscribers. Defaults to `true`
18023
+ *
18024
+ * @public
18025
+ */
18026
+ set(v, render = !0) {
18027
+ !render || !this.passiveEffect ? this.updateAndNotify(v, render) : this.passiveEffect(v, this.updateAndNotify);
18028
+ }
18029
+ setWithVelocity(prev, current, delta) {
18030
+ this.set(current), this.prev = void 0, this.prevFrameValue = prev, this.prevUpdatedAt = this.updatedAt - delta;
18031
+ }
18032
+ /**
18033
+ * Set the state of the `MotionValue`, stopping any active animations,
18034
+ * effects, and resets velocity to `0`.
18035
+ */
18036
+ jump(v, endAnimation = !0) {
18037
+ this.updateAndNotify(v), this.prev = v, this.prevUpdatedAt = this.prevFrameValue = void 0, endAnimation && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
18038
+ }
18039
+ /**
18040
+ * Returns the latest state of `MotionValue`
18041
+ *
18042
+ * @returns - The latest state of `MotionValue`
18043
+ *
18044
+ * @public
18045
+ */
18046
+ get() {
18047
+ return this.current;
18048
+ }
18049
+ /**
18050
+ * @public
18051
+ */
18052
+ getPrevious() {
18053
+ return this.prev;
18054
+ }
18055
+ /**
18056
+ * Returns the latest velocity of `MotionValue`
18057
+ *
18058
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
18059
+ *
18060
+ * @public
18061
+ */
18062
+ getVelocity() {
18063
+ const currentTime = time.now();
18064
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA)
18065
+ return 0;
18066
+ const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
18067
+ return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
18068
+ }
18069
+ /**
18070
+ * Registers a new animation to control this `MotionValue`. Only one
18071
+ * animation can drive a `MotionValue` at one time.
18072
+ *
18073
+ * ```jsx
18074
+ * value.start()
18075
+ * ```
18076
+ *
18077
+ * @param animation - A function that starts the provided animation
18078
+ */
18079
+ start(startAnimation) {
18080
+ return this.stop(), new Promise((resolve) => {
18081
+ this.hasAnimated = !0, this.animation = startAnimation(resolve), this.events.animationStart && this.events.animationStart.notify();
18082
+ }).then(() => {
18083
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
18084
+ });
18085
+ }
18086
+ /**
18087
+ * Stop the currently active animation.
18088
+ *
18089
+ * @public
18090
+ */
18091
+ stop() {
18092
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
18093
+ }
18094
+ /**
18095
+ * Returns `true` if this value is currently animating.
18096
+ *
18097
+ * @public
18098
+ */
18099
+ isAnimating() {
18100
+ return !!this.animation;
18101
+ }
18102
+ clearAnimation() {
18103
+ delete this.animation;
18104
+ }
18105
+ /**
18106
+ * Destroy and clean up subscribers to this `MotionValue`.
18107
+ *
18108
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
18109
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
18110
+ * created a `MotionValue` via the `motionValue` function.
18111
+ *
18112
+ * @public
18113
+ */
18114
+ destroy() {
18115
+ this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
18116
+ }
18117
+ }
18118
+ function motionValue(init2, options) {
18119
+ return new MotionValue(init2, options);
18120
+ }
18378
18121
  function setMotionValue(visualElement, key2, value) {
18379
18122
  visualElement.hasValue(key2) ? visualElement.getValue(key2).set(value) : visualElement.addValue(key2, motionValue(value));
18380
18123
  }
@@ -18394,6 +18137,10 @@ function addValueToWillChange(visualElement, key2) {
18394
18137
  const willChange = visualElement.getValue("willChange");
18395
18138
  if (isWillChangeMotionValue(willChange))
18396
18139
  return willChange.add(key2);
18140
+ if (!willChange && MotionGlobalConfig.WillChange) {
18141
+ const newWillChange = new MotionGlobalConfig.WillChange("auto");
18142
+ visualElement.addValue("willChange", newWillChange), newWillChange.add(key2);
18143
+ }
18397
18144
  }
18398
18145
  function getOptimisedAppearId(visualElement) {
18399
18146
  return visualElement.props[optimizedAppearDataAttribute];
@@ -18430,7 +18177,7 @@ const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){
18430
18177
  [cName]: parseFloat(c2),
18431
18178
  alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
18432
18179
  };
18433
- }, clampRgbUnit = (v) => clamp$2(0, 255, v), rgbUnit = {
18180
+ }, clampRgbUnit = (v) => clamp$1(0, 255, v), rgbUnit = {
18434
18181
  ...number,
18435
18182
  transform: (v) => Math.round(clampRgbUnit(v))
18436
18183
  }, rgba$1 = {
@@ -18783,6 +18530,9 @@ class DOMKeyframesResolver extends KeyframeResolver {
18783
18530
  const isAnimatable = (value, name) => name === "zIndex" ? !1 : !!(typeof value == "number" || Array.isArray(value) || typeof value == "string" && // It's animatable if we have a string
18784
18531
  (complex.test(value) || value === "0") && // And it contains numbers and/or colors
18785
18532
  !value.startsWith("url("));
18533
+ function isGenerator(type) {
18534
+ return typeof type == "function" && "applyToOptions" in type;
18535
+ }
18786
18536
  function hasKeyframesChanged(keyframes2) {
18787
18537
  const current = keyframes2[0];
18788
18538
  if (keyframes2.length === 1)
@@ -18996,10 +18746,10 @@ const springDefaults = {
18996
18746
  // in seconds
18997
18747
  minDamping: 0.05,
18998
18748
  maxDamping: 1
18999
- }, safeMin = 1e-3;
18749
+ }, secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (seconds) => seconds * 1e3, millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (milliseconds) => milliseconds / 1e3, safeMin = 1e-3;
19000
18750
  function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
19001
18751
  let envelope, derivative, dampingRatio = 1 - bounce;
19002
- dampingRatio = clamp$2(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio), duration = clamp$2(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration)), dampingRatio < 1 ? (envelope = (undampedFreq2) => {
18752
+ dampingRatio = clamp$1(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio), duration = clamp$1(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration)), dampingRatio < 1 ? (envelope = (undampedFreq2) => {
19003
18753
  const exponentialDecay = undampedFreq2 * dampingRatio, delta = exponentialDecay * duration, a2 = exponentialDecay - velocity, b2 = calcAngularFreq(undampedFreq2, dampingRatio), c2 = Math.exp(-delta);
19004
18754
  return safeMin - a2 / b2 * c2;
19005
18755
  }, derivative = (undampedFreq2) => {
@@ -19038,7 +18788,47 @@ function approximateRoot(envelope, derivative, initialGuess) {
19038
18788
  function calcAngularFreq(undampedFreq, dampingRatio) {
19039
18789
  return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
19040
18790
  }
19041
- const durationKeys = ["duration", "bounce"], physicsKeys = ["stiffness", "damping", "mass"];
18791
+ const maxGeneratorDuration = 2e4;
18792
+ function calcGeneratorDuration(generator) {
18793
+ let duration = 0;
18794
+ const timeStep = 50;
18795
+ let state = generator.next(duration);
18796
+ for (; !state.done && duration < maxGeneratorDuration; )
18797
+ duration += timeStep, state = generator.next(duration);
18798
+ return duration >= maxGeneratorDuration ? 1 / 0 : duration;
18799
+ }
18800
+ function createGeneratorEasing(options, scale2 = 100, createGenerator) {
18801
+ const generator = createGenerator({ ...options, keyframes: [0, scale2] }), duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
18802
+ return {
18803
+ type: "keyframes",
18804
+ ease: (progress2) => generator.next(duration * progress2).value / scale2,
18805
+ duration: /* @__PURE__ */ millisecondsToSeconds(duration)
18806
+ };
18807
+ }
18808
+ const supportsFlags = {};
18809
+ // @__NO_SIDE_EFFECTS__
18810
+ function memo(callback) {
18811
+ let result;
18812
+ return () => (result === void 0 && (result = callback()), result);
18813
+ }
18814
+ function memoSupports(callback, supportsFlag) {
18815
+ const memoized = /* @__PURE__ */ memo(callback);
18816
+ return () => supportsFlags[supportsFlag] ?? memoized();
18817
+ }
18818
+ const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
18819
+ try {
18820
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
18821
+ } catch {
18822
+ return !1;
18823
+ }
18824
+ return !0;
18825
+ }, "linearEasing"), generateLinearEasing = (easing, duration, resolution = 10) => {
18826
+ let points = "";
18827
+ const numPoints = Math.max(Math.round(duration / resolution), 2);
18828
+ for (let i2 = 0; i2 < numPoints; i2++)
18829
+ points += easing(i2 / (numPoints - 1)) + ", ";
18830
+ return `linear(${points.substring(0, points.length - 2)})`;
18831
+ }, durationKeys = ["duration", "bounce"], physicsKeys = ["stiffness", "damping", "mass"];
19042
18832
  function isSpringType(options, keys2) {
19043
18833
  return keys2.some((key2) => options[key2] !== void 0);
19044
18834
  }
@@ -19053,7 +18843,7 @@ function getSpringOptions(options) {
19053
18843
  };
19054
18844
  if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys))
19055
18845
  if (options.visualDuration) {
19056
- const visualDuration = options.visualDuration, root2 = 2 * Math.PI / (visualDuration * 1.2), stiffness = root2 * root2, damping = 2 * clamp$2(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
18846
+ const visualDuration = options.visualDuration, root2 = 2 * Math.PI / (visualDuration * 1.2), stiffness = root2 * root2, damping = 2 * clamp$1(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
19057
18847
  springOptions = {
19058
18848
  ...springOptions,
19059
18849
  mass: springDefaults.mass,
@@ -19157,7 +18947,7 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
19157
18947
  }
19158
18948
  };
19159
18949
  }
19160
- const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1), easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1), easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1), isEasingArray = (ease2) => Array.isArray(ease2) && typeof ease2[0] != "number", easingLookup = {
18950
+ const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1), easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1), easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1), isEasingArray = (ease2) => Array.isArray(ease2) && typeof ease2[0] != "number", isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] == "number", easingLookup = {
19161
18951
  linear: noop$3,
19162
18952
  easeIn,
19163
18953
  easeInOut,
@@ -19177,6 +18967,9 @@ const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1), easeOut = /* @__PURE_
19177
18967
  } else if (typeof definition == "string")
19178
18968
  return easingLookup[definition];
19179
18969
  return definition;
18970
+ }, progress = /* @__NO_SIDE_EFFECTS__ */ (from, to, value) => {
18971
+ const toFromDifference = to - from;
18972
+ return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
19180
18973
  };
19181
18974
  function createMixers(output, ease2, customMixer) {
19182
18975
  const mixers = [], mixerFactory = customMixer || mix, numMixers = output.length - 1;
@@ -19208,7 +19001,7 @@ function interpolate$1(input2, output, { clamp: isClamp = !0, ease: ease2, mixer
19208
19001
  const progressInRange = /* @__PURE__ */ progress(input2[i2], input2[i2 + 1], v);
19209
19002
  return mixers[i2](progressInRange);
19210
19003
  };
19211
- return isClamp ? (v) => interpolator(clamp$2(input2[0], input2[inputLength - 1], v)) : interpolator;
19004
+ return isClamp ? (v) => interpolator(clamp$1(input2[0], input2[inputLength - 1], v)) : interpolator;
19212
19005
  }
19213
19006
  function fillOffset(offset2, remaining) {
19214
19007
  const min2 = offset2[offset2.length - 1];
@@ -19318,7 +19111,7 @@ class MainThreadAnimation extends BaseAnimation {
19318
19111
  if (repeat) {
19319
19112
  const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
19320
19113
  let currentIteration = Math.floor(progress2), iterationProgress = progress2 % 1;
19321
- !iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), !!(currentIteration % 2) && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp$2(0, 1, iterationProgress) * resolvedDuration;
19114
+ !iterationProgress && progress2 >= 1 && (iterationProgress = 1), iterationProgress === 1 && currentIteration--, currentIteration = Math.min(currentIteration, repeat + 1), !!(currentIteration % 2) && (repeatType === "reverse" ? (iterationProgress = 1 - iterationProgress, repeatDelay && (iterationProgress -= repeatDelay / resolvedDuration)) : repeatType === "mirror" && (frameGenerator = mirroredGenerator)), elapsed = clamp$1(0, 1, iterationProgress) * resolvedDuration;
19322
19115
  }
19323
19116
  const state = isInDelayPhase ? { done: !1, value: keyframes2[0] } : frameGenerator.next(elapsed);
19324
19117
  mapPercentToKeyframes && (state.value = mapPercentToKeyframes(state.value));
@@ -19395,7 +19188,44 @@ const acceleratedValues = /* @__PURE__ */ new Set([
19395
19188
  // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
19396
19189
  // or until we implement support for linear() easing.
19397
19190
  // "background-color"
19398
- ]), supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")), sampleDelta = 10, maxDuration = 2e4;
19191
+ ]), supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate")), cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`, supportedWaapiEasing = {
19192
+ linear: "linear",
19193
+ ease: "ease",
19194
+ easeIn: "ease-in",
19195
+ easeOut: "ease-out",
19196
+ easeInOut: "ease-in-out",
19197
+ circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
19198
+ circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
19199
+ backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
19200
+ backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
19201
+ };
19202
+ function mapEasingToNativeEasing(easing, duration) {
19203
+ if (easing)
19204
+ return typeof easing == "function" && supportsLinearEasing() ? generateLinearEasing(easing, duration) : isBezierDefinition(easing) ? cubicBezierAsString(easing) : Array.isArray(easing) ? easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut) : supportedWaapiEasing[easing];
19205
+ }
19206
+ function startWaapiAnimation(element, valueName, keyframes2, { delay: delay2 = 0, duration = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}, pseudoElement = void 0) {
19207
+ const keyframeOptions = {
19208
+ [valueName]: keyframes2
19209
+ };
19210
+ times && (keyframeOptions.offset = times);
19211
+ const easing = mapEasingToNativeEasing(ease2, duration);
19212
+ return Array.isArray(easing) && (keyframeOptions.easing = easing), element.animate(keyframeOptions, {
19213
+ delay: delay2,
19214
+ duration,
19215
+ easing: Array.isArray(easing) ? "linear" : easing,
19216
+ fill: "both",
19217
+ iterations: repeat + 1,
19218
+ direction: repeatType === "reverse" ? "alternate" : "normal",
19219
+ pseudoElement
19220
+ });
19221
+ }
19222
+ function attachTimeline(animation, timeline) {
19223
+ animation.timeline = timeline, animation.onfinish = null;
19224
+ }
19225
+ function isWaapiSupportedEasing(easing) {
19226
+ return !!(typeof easing == "function" && supportsLinearEasing() || !easing || typeof easing == "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
19227
+ }
19228
+ const sampleDelta = 10, maxDuration = 2e4;
19399
19229
  function requiresPregeneratedKeyframes(options) {
19400
19230
  return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
19401
19231
  }
@@ -19604,6 +19434,86 @@ const underDampedSpring = {
19604
19434
  function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
19605
19435
  return !!Object.keys(transition).length;
19606
19436
  }
19437
+ function getValueTransition$1(transition, key2) {
19438
+ return transition?.[key2] ?? transition?.default ?? transition;
19439
+ }
19440
+ const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
19441
+ class GroupAnimation {
19442
+ constructor(animations2) {
19443
+ this.stop = () => this.runAll("stop"), this.animations = animations2.filter(Boolean);
19444
+ }
19445
+ get finished() {
19446
+ return Promise.all(this.animations.map((animation) => animation.finished));
19447
+ }
19448
+ /**
19449
+ * TODO: Filter out cancelled or stopped animations before returning
19450
+ */
19451
+ getAll(propName) {
19452
+ return this.animations[0][propName];
19453
+ }
19454
+ setAll(propName, newValue) {
19455
+ for (let i2 = 0; i2 < this.animations.length; i2++)
19456
+ this.animations[i2][propName] = newValue;
19457
+ }
19458
+ attachTimeline(timeline, fallback) {
19459
+ const subscriptions = this.animations.map((animation) => {
19460
+ if (supportsScrollTimeline() && animation.attachTimeline)
19461
+ return animation.attachTimeline(timeline);
19462
+ if (typeof fallback == "function")
19463
+ return fallback(animation);
19464
+ });
19465
+ return () => {
19466
+ subscriptions.forEach((cancel, i2) => {
19467
+ cancel && cancel(), this.animations[i2].stop();
19468
+ });
19469
+ };
19470
+ }
19471
+ get time() {
19472
+ return this.getAll("time");
19473
+ }
19474
+ set time(time2) {
19475
+ this.setAll("time", time2);
19476
+ }
19477
+ get speed() {
19478
+ return this.getAll("speed");
19479
+ }
19480
+ set speed(speed) {
19481
+ this.setAll("speed", speed);
19482
+ }
19483
+ get startTime() {
19484
+ return this.getAll("startTime");
19485
+ }
19486
+ get duration() {
19487
+ let max2 = 0;
19488
+ for (let i2 = 0; i2 < this.animations.length; i2++)
19489
+ max2 = Math.max(max2, this.animations[i2].duration);
19490
+ return max2;
19491
+ }
19492
+ runAll(methodName) {
19493
+ this.animations.forEach((controls) => controls[methodName]());
19494
+ }
19495
+ flatten() {
19496
+ this.runAll("flatten");
19497
+ }
19498
+ play() {
19499
+ this.runAll("play");
19500
+ }
19501
+ pause() {
19502
+ this.runAll("pause");
19503
+ }
19504
+ cancel() {
19505
+ this.runAll("cancel");
19506
+ }
19507
+ complete() {
19508
+ this.runAll("complete");
19509
+ }
19510
+ }
19511
+ class GroupAnimationWithThen extends GroupAnimation {
19512
+ then(onResolve, _onReject) {
19513
+ return this.finished.finally(onResolve).then(() => {
19514
+ });
19515
+ }
19516
+ }
19607
19517
  const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
19608
19518
  const valueTransition = getValueTransition$1(transition, name) || {}, delay2 = valueTransition.delay || transition.delay || 0;
19609
19519
  let { elapsed = 0 } = transition;
@@ -19919,6 +19829,7 @@ const animations = {
19919
19829
  function addDomEvent(target, eventName, handler, options = { passive: !0 }) {
19920
19830
  return target.addEventListener(eventName, handler, options), () => target.removeEventListener(eventName, handler);
19921
19831
  }
19832
+ const isPrimaryPointer = (event) => event.pointerType === "mouse" ? typeof event.button != "number" || event.button <= 0 : event.isPrimary !== !1;
19922
19833
  function extractEventInfo(event) {
19923
19834
  return {
19924
19835
  point: {
@@ -20160,7 +20071,7 @@ function calcViewportConstraints(layoutBox, constraintsBox) {
20160
20071
  function calcOrigin(source, target) {
20161
20072
  let origin = 0.5;
20162
20073
  const sourceLength = calcLength(source), targetLength = calcLength(target);
20163
- return targetLength > sourceLength ? origin = /* @__PURE__ */ progress(target.min, target.max - sourceLength, source.min) : sourceLength > targetLength && (origin = /* @__PURE__ */ progress(source.min, source.max - targetLength, target.min)), clamp$2(0, 1, origin);
20074
+ return targetLength > sourceLength ? origin = /* @__PURE__ */ progress(target.min, target.max - sourceLength, source.min) : sourceLength > targetLength && (origin = /* @__PURE__ */ progress(source.min, source.max - targetLength, target.min)), clamp$1(0, 1, origin);
20164
20075
  }
20165
20076
  function rebaseAxisConstraints(layout2, constraints) {
20166
20077
  const relativeConstraints = {};
@@ -20182,6 +20093,20 @@ function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
20182
20093
  function resolvePointElastic(dragElastic, label2) {
20183
20094
  return typeof dragElastic == "number" ? dragElastic : dragElastic[label2] || 0;
20184
20095
  }
20096
+ const isDragging = {
20097
+ x: !1,
20098
+ y: !1
20099
+ };
20100
+ function isDragActive() {
20101
+ return isDragging.x || isDragging.y;
20102
+ }
20103
+ function setDragLock(axis) {
20104
+ return axis === "x" || axis === "y" ? isDragging[axis] ? null : (isDragging[axis] = !0, () => {
20105
+ isDragging[axis] = !1;
20106
+ }) : isDragging.x || isDragging.y ? null : (isDragging.x = isDragging.y = !0, () => {
20107
+ isDragging.x = isDragging.y = !1;
20108
+ });
20109
+ }
20185
20110
  const elementDragControls = /* @__PURE__ */ new WeakMap();
20186
20111
  class VisualElementDragControls {
20187
20112
  constructor(visualElement) {
@@ -20580,12 +20505,7 @@ function delay(callback, timeout2) {
20580
20505
  }
20581
20506
  const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], numBorders = borders.length, asNumber = (value) => typeof value == "string" ? parseFloat(value) : value, isPx = (value) => typeof value == "number" || px.test(value);
20582
20507
  function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOnlyMember) {
20583
- shouldCrossfadeOpacity ? (target.opacity = mixNumber$1(
20584
- 0,
20585
- // TODO Reinstate this if only child
20586
- lead.opacity !== void 0 ? lead.opacity : 1,
20587
- easeCrossfadeIn(progress2)
20588
- ), target.opacityExit = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, 0, easeCrossfadeOut(progress2))) : isOnlyMember && (target.opacity = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2));
20508
+ shouldCrossfadeOpacity ? (target.opacity = mixNumber$1(0, lead.opacity ?? 1, easeCrossfadeIn(progress2)), target.opacityExit = mixNumber$1(follow.opacity ?? 1, 0, easeCrossfadeOut(progress2))) : isOnlyMember && (target.opacity = mixNumber$1(follow.opacity ?? 1, lead.opacity ?? 1, progress2));
20589
20509
  for (let i2 = 0; i2 < numBorders; i2++) {
20590
20510
  const borderLabel = `border${borders[i2]}Radius`;
20591
20511
  let followRadius = getRadius(follow, borderLabel), leadRadius = getRadius(lead, borderLabel);
@@ -20842,7 +20762,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
20842
20762
  }
20843
20763
  this.isUpdating || this.nodes.forEach(clearIsLayoutDirty), this.isUpdating = !1, this.nodes.forEach(resetTransformStyle), this.nodes.forEach(updateLayout), this.nodes.forEach(notifyLayoutUpdate), this.clearAllSnapshots();
20844
20764
  const now2 = time.now();
20845
- frameData.delta = clamp$2(0, 1e3 / 60, now2 - frameData.timestamp), frameData.timestamp = now2, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
20765
+ frameData.delta = clamp$1(0, 1e3 / 60, now2 - frameData.timestamp), frameData.timestamp = now2, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
20846
20766
  }
20847
20767
  didUpdate() {
20848
20768
  this.updateScheduled || (this.updateScheduled = !0, microtask.read(this.scheduleUpdate));
@@ -21309,6 +21229,43 @@ const DocumentProjectionNode = createProjectionNode({
21309
21229
  MeasureLayout
21310
21230
  }
21311
21231
  };
21232
+ function resolveElements(elementOrSelector, scope, selectorCache) {
21233
+ if (elementOrSelector instanceof EventTarget)
21234
+ return [elementOrSelector];
21235
+ if (typeof elementOrSelector == "string") {
21236
+ let root2 = document;
21237
+ const elements = selectorCache?.[elementOrSelector] ?? root2.querySelectorAll(elementOrSelector);
21238
+ return elements ? Array.from(elements) : [];
21239
+ }
21240
+ return Array.from(elementOrSelector);
21241
+ }
21242
+ function setupGesture(elementOrSelector, options) {
21243
+ const elements = resolveElements(elementOrSelector), gestureAbortController = new AbortController(), eventOptions = {
21244
+ passive: !0,
21245
+ ...options,
21246
+ signal: gestureAbortController.signal
21247
+ };
21248
+ return [elements, eventOptions, () => gestureAbortController.abort()];
21249
+ }
21250
+ function isValidHover(event) {
21251
+ return !(event.pointerType === "touch" || isDragActive());
21252
+ }
21253
+ function hover(elementOrSelector, onHoverStart, options = {}) {
21254
+ const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options), onPointerEnter = (enterEvent) => {
21255
+ if (!isValidHover(enterEvent))
21256
+ return;
21257
+ const { target } = enterEvent, onHoverEnd = onHoverStart(target, enterEvent);
21258
+ if (typeof onHoverEnd != "function" || !target)
21259
+ return;
21260
+ const onPointerLeave = (leaveEvent) => {
21261
+ isValidHover(leaveEvent) && (onHoverEnd(leaveEvent), target.removeEventListener("pointerleave", onPointerLeave));
21262
+ };
21263
+ target.addEventListener("pointerleave", onPointerLeave, eventOptions);
21264
+ };
21265
+ return elements.forEach((element) => {
21266
+ element.addEventListener("pointerenter", onPointerEnter, eventOptions);
21267
+ }), cancel;
21268
+ }
21312
21269
  function handleHoverEvent(node2, event, lifecycle) {
21313
21270
  const { props } = node2;
21314
21271
  node2.animationState && props.whileHover && node2.animationState.setActive("whileHover", lifecycle === "Start");
@@ -21345,6 +21302,62 @@ class FocusGesture extends Feature {
21345
21302
  unmount() {
21346
21303
  }
21347
21304
  }
21305
+ const isNodeOrChild = (parent, child) => child ? parent === child ? !0 : isNodeOrChild(parent, child.parentElement) : !1, focusableElements = /* @__PURE__ */ new Set([
21306
+ "BUTTON",
21307
+ "INPUT",
21308
+ "SELECT",
21309
+ "TEXTAREA",
21310
+ "A"
21311
+ ]);
21312
+ function isElementKeyboardAccessible(element) {
21313
+ return focusableElements.has(element.tagName) || element.tabIndex !== -1;
21314
+ }
21315
+ const isPressing = /* @__PURE__ */ new WeakSet();
21316
+ function filterEvents(callback) {
21317
+ return (event) => {
21318
+ event.key === "Enter" && callback(event);
21319
+ };
21320
+ }
21321
+ function firePointerEvent(target, type) {
21322
+ target.dispatchEvent(new PointerEvent("pointer" + type, { isPrimary: !0, bubbles: !0 }));
21323
+ }
21324
+ const enableKeyboardPress = (focusEvent, eventOptions) => {
21325
+ const element = focusEvent.currentTarget;
21326
+ if (!element)
21327
+ return;
21328
+ const handleKeydown = filterEvents(() => {
21329
+ if (isPressing.has(element))
21330
+ return;
21331
+ firePointerEvent(element, "down");
21332
+ const handleKeyup = filterEvents(() => {
21333
+ firePointerEvent(element, "up");
21334
+ }), handleBlur = () => firePointerEvent(element, "cancel");
21335
+ element.addEventListener("keyup", handleKeyup, eventOptions), element.addEventListener("blur", handleBlur, eventOptions);
21336
+ });
21337
+ element.addEventListener("keydown", handleKeydown, eventOptions), element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions);
21338
+ };
21339
+ function isValidPressEvent(event) {
21340
+ return isPrimaryPointer(event) && !isDragActive();
21341
+ }
21342
+ function press(targetOrSelector, onPressStart, options = {}) {
21343
+ const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options), startPress = (startEvent) => {
21344
+ const target = startEvent.currentTarget;
21345
+ if (!isValidPressEvent(startEvent) || isPressing.has(target))
21346
+ return;
21347
+ isPressing.add(target);
21348
+ const onPressEnd = onPressStart(target, startEvent), onPointerEnd = (endEvent, success) => {
21349
+ window.removeEventListener("pointerup", onPointerUp), window.removeEventListener("pointercancel", onPointerCancel), !(!isValidPressEvent(endEvent) || !isPressing.has(target)) && (isPressing.delete(target), typeof onPressEnd == "function" && onPressEnd(endEvent, { success }));
21350
+ }, onPointerUp = (upEvent) => {
21351
+ onPointerEnd(upEvent, target === window || target === document || options.useGlobalTarget || isNodeOrChild(target, upEvent.target));
21352
+ }, onPointerCancel = (cancelEvent) => {
21353
+ onPointerEnd(cancelEvent, !1);
21354
+ };
21355
+ window.addEventListener("pointerup", onPointerUp, eventOptions), window.addEventListener("pointercancel", onPointerCancel, eventOptions);
21356
+ };
21357
+ return targets.forEach((target) => {
21358
+ (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), target instanceof HTMLElement && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex") && (target.tabIndex = 0));
21359
+ }), cancelEvents;
21360
+ }
21348
21361
  function handlePressEvent(node2, event, lifecycle) {
21349
21362
  const { props } = node2;
21350
21363
  if (node2.current instanceof HTMLButtonElement && node2.current.disabled)
@@ -24711,18 +24724,18 @@ const errorMessages = {
24711
24724
  [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
24712
24725
  [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]
24713
24726
  ], elementSelectionKeys = ["Enter", " ", "Escape"];
24714
- var ConnectionMode$1;
24727
+ var ConnectionMode;
24715
24728
  (function(ConnectionMode2) {
24716
24729
  ConnectionMode2.Strict = "strict", ConnectionMode2.Loose = "loose";
24717
- })(ConnectionMode$1 || (ConnectionMode$1 = {}));
24718
- var PanOnScrollMode$1;
24730
+ })(ConnectionMode || (ConnectionMode = {}));
24731
+ var PanOnScrollMode;
24719
24732
  (function(PanOnScrollMode2) {
24720
24733
  PanOnScrollMode2.Free = "free", PanOnScrollMode2.Vertical = "vertical", PanOnScrollMode2.Horizontal = "horizontal";
24721
- })(PanOnScrollMode$1 || (PanOnScrollMode$1 = {}));
24722
- var SelectionMode$1;
24734
+ })(PanOnScrollMode || (PanOnScrollMode = {}));
24735
+ var SelectionMode;
24723
24736
  (function(SelectionMode2) {
24724
24737
  SelectionMode2.Partial = "partial", SelectionMode2.Full = "full";
24725
- })(SelectionMode$1 || (SelectionMode$1 = {}));
24738
+ })(SelectionMode || (SelectionMode = {}));
24726
24739
  const initialConnection = {
24727
24740
  inProgress: !1,
24728
24741
  isValid: null,
@@ -24735,44 +24748,44 @@ const initialConnection = {
24735
24748
  toPosition: null,
24736
24749
  toNode: null
24737
24750
  };
24738
- var ConnectionLineType$1;
24751
+ var ConnectionLineType;
24739
24752
  (function(ConnectionLineType2) {
24740
24753
  ConnectionLineType2.Bezier = "default", ConnectionLineType2.Straight = "straight", ConnectionLineType2.Step = "step", ConnectionLineType2.SmoothStep = "smoothstep", ConnectionLineType2.SimpleBezier = "simplebezier";
24741
- })(ConnectionLineType$1 || (ConnectionLineType$1 = {}));
24742
- var MarkerType$1;
24754
+ })(ConnectionLineType || (ConnectionLineType = {}));
24755
+ var MarkerType;
24743
24756
  (function(MarkerType2) {
24744
24757
  MarkerType2.Arrow = "arrow", MarkerType2.ArrowClosed = "arrowclosed";
24745
- })(MarkerType$1 || (MarkerType$1 = {}));
24746
- var Position$1;
24758
+ })(MarkerType || (MarkerType = {}));
24759
+ var Position;
24747
24760
  (function(Position2) {
24748
24761
  Position2.Left = "left", Position2.Top = "top", Position2.Right = "right", Position2.Bottom = "bottom";
24749
- })(Position$1 || (Position$1 = {}));
24762
+ })(Position || (Position = {}));
24750
24763
  const oppositePosition = {
24751
- [Position$1.Left]: Position$1.Right,
24752
- [Position$1.Right]: Position$1.Left,
24753
- [Position$1.Top]: Position$1.Bottom,
24754
- [Position$1.Bottom]: Position$1.Top
24764
+ [Position.Left]: Position.Right,
24765
+ [Position.Right]: Position.Left,
24766
+ [Position.Top]: Position.Bottom,
24767
+ [Position.Bottom]: Position.Top
24755
24768
  };
24756
24769
  function getConnectionStatus(isValid) {
24757
24770
  return isValid === null ? null : isValid ? "valid" : "invalid";
24758
24771
  }
24759
- const isEdgeBase = (element) => "id" in element && "source" in element && "target" in element, isNodeBase = (element) => "id" in element && "position" in element && !("source" in element) && !("target" in element), isInternalNodeBase$1 = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin$1 = (node2, nodeOrigin = [0, 0]) => {
24760
- const { width, height } = getNodeDimensions$1(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
24772
+ const isEdgeBase = (element) => "id" in element && "source" in element && "target" in element, isNodeBase = (element) => "id" in element && "position" in element && !("source" in element) && !("target" in element), isInternalNodeBase = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin = (node2, nodeOrigin = [0, 0]) => {
24773
+ const { width, height } = getNodeDimensions(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
24761
24774
  return {
24762
24775
  x: node2.position.x - offsetX,
24763
24776
  y: node2.position.y - offsetY
24764
24777
  };
24765
- }, getNodesBounds = (nodes, params = { nodeOrigin: [0, 0], nodeLookup: void 0 }) => {
24778
+ }, getNodesBounds = (nodes, params = { nodeOrigin: [0, 0] }) => {
24766
24779
  if (nodes.length === 0)
24767
24780
  return { x: 0, y: 0, width: 0, height: 0 };
24768
24781
  const box = nodes.reduce((currBox, nodeOrId) => {
24769
24782
  const isId = typeof nodeOrId == "string";
24770
24783
  let currentNode = !params.nodeLookup && !isId ? nodeOrId : void 0;
24771
- params.nodeLookup && (currentNode = isId ? params.nodeLookup.get(nodeOrId) : isInternalNodeBase$1(nodeOrId) ? nodeOrId : params.nodeLookup.get(nodeOrId.id));
24784
+ params.nodeLookup && (currentNode = isId ? params.nodeLookup.get(nodeOrId) : isInternalNodeBase(nodeOrId) ? nodeOrId : params.nodeLookup.get(nodeOrId.id));
24772
24785
  const nodeBox = currentNode ? nodeToBox(currentNode, params.nodeOrigin) : { x: 0, y: 0, x2: 0, y2: 0 };
24773
- return getBoundsOfBoxes$1(currBox, nodeBox);
24786
+ return getBoundsOfBoxes(currBox, nodeBox);
24774
24787
  }, { x: 1 / 0, y: 1 / 0, x2: -1 / 0, y2: -1 / 0 });
24775
- return boxToRect$1(box);
24788
+ return boxToRect(box);
24776
24789
  }, getInternalNodesBounds = (nodeLookup, params = {}) => {
24777
24790
  if (nodeLookup.size === 0)
24778
24791
  return { x: 0, y: 0, width: 0, height: 0 };
@@ -24780,9 +24793,9 @@ const isEdgeBase = (element) => "id" in element && "source" in element && "targe
24780
24793
  return nodeLookup.forEach((node2) => {
24781
24794
  if (params.filter === void 0 || params.filter(node2)) {
24782
24795
  const nodeBox = nodeToBox(node2);
24783
- box = getBoundsOfBoxes$1(box, nodeBox);
24796
+ box = getBoundsOfBoxes(box, nodeBox);
24784
24797
  }
24785
- }), boxToRect$1(box);
24798
+ }), boxToRect(box);
24786
24799
  }, getNodesInside = (nodes, rect, [tx, ty, tScale] = [0, 0, 1], partially = !1, excludeNonSelectableNodes = !1) => {
24787
24800
  const paneRect = {
24788
24801
  ...pointToRendererPoint(rect, [tx, ty, tScale]),
@@ -24793,7 +24806,7 @@ const isEdgeBase = (element) => "id" in element && "source" in element && "targe
24793
24806
  const { measured, selectable = !0, hidden: hidden2 = !1 } = node2;
24794
24807
  if (excludeNonSelectableNodes && !selectable || hidden2)
24795
24808
  continue;
24796
- const width = measured.width ?? node2.width ?? node2.initialWidth ?? null, height = measured.height ?? node2.height ?? node2.initialHeight ?? null, overlappingArea = getOverlappingArea(paneRect, nodeToRect$1(node2)), area = (width ?? 0) * (height ?? 0), partiallyVisible = partially && overlappingArea > 0;
24809
+ const width = measured.width ?? node2.width ?? node2.initialWidth ?? null, height = measured.height ?? node2.height ?? node2.initialHeight ?? null, overlappingArea = getOverlappingArea(paneRect, nodeToRect(node2)), area = (width ?? 0) * (height ?? 0), partiallyVisible = partially && overlappingArea > 0;
24797
24810
  (!node2.internals.handleBounds || partiallyVisible || overlappingArea >= area || node2.dragging) && visibleNodes.push(node2);
24798
24811
  }
24799
24812
  return visibleNodes;
@@ -24812,7 +24825,7 @@ function getFitViewNodes(nodeLookup, options) {
24812
24825
  async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom }, options) {
24813
24826
  if (nodes.size === 0)
24814
24827
  return Promise.resolve(!0);
24815
- const nodesToFit = getFitViewNodes(nodes, options), bounds = getInternalNodesBounds(nodesToFit), viewport = getViewportForBounds$1(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
24828
+ const nodesToFit = getFitViewNodes(nodes, options), bounds = getInternalNodesBounds(nodesToFit), viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
24816
24829
  return await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0);
24817
24830
  }
24818
24831
  function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError }) {
@@ -24863,37 +24876,37 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
24863
24876
  });
24864
24877
  return typeof onBeforeDeleteResult == "boolean" ? onBeforeDeleteResult ? { edges: matchingEdges, nodes: matchingNodes } : { edges: [], nodes: [] } : onBeforeDeleteResult;
24865
24878
  }
24866
- const clamp$1 = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
24867
- x: clamp$1(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
24868
- y: clamp$1(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
24879
+ const clamp = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
24880
+ x: clamp(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
24881
+ y: clamp(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
24869
24882
  });
24870
24883
  function clampPositionToParent(childPosition, childDimensions, parent) {
24871
- const { width: parentWidth, height: parentHeight } = getNodeDimensions$1(parent), { x: parentX, y: parentY } = parent.internals.positionAbsolute;
24884
+ const { width: parentWidth, height: parentHeight } = getNodeDimensions(parent), { x: parentX, y: parentY } = parent.internals.positionAbsolute;
24872
24885
  return clampPosition(childPosition, [
24873
24886
  [parentX, parentY],
24874
24887
  [parentX + parentWidth, parentY + parentHeight]
24875
24888
  ], childDimensions);
24876
24889
  }
24877
- const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp$1(Math.abs(value - min2), 1, min2) / min2 : value > max2 ? -clamp$1(Math.abs(value - max2), 1, min2) / min2 : 0, calcAutoPan = (pos, bounds, speed = 15, distance2 = 40) => {
24890
+ const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp(Math.abs(value - min2), 1, min2) / min2 : value > max2 ? -clamp(Math.abs(value - max2), 1, min2) / min2 : 0, calcAutoPan = (pos, bounds, speed = 15, distance2 = 40) => {
24878
24891
  const xMovement = calcAutoPanVelocity(pos.x, distance2, bounds.width - distance2) * speed, yMovement = calcAutoPanVelocity(pos.y, distance2, bounds.height - distance2) * speed;
24879
24892
  return [xMovement, yMovement];
24880
- }, getBoundsOfBoxes$1 = (box1, box2) => ({
24893
+ }, getBoundsOfBoxes = (box1, box2) => ({
24881
24894
  x: Math.min(box1.x, box2.x),
24882
24895
  y: Math.min(box1.y, box2.y),
24883
24896
  x2: Math.max(box1.x2, box2.x2),
24884
24897
  y2: Math.max(box1.y2, box2.y2)
24885
- }), rectToBox$1 = ({ x: x2, y: y2, width, height }) => ({
24898
+ }), rectToBox = ({ x: x2, y: y2, width, height }) => ({
24886
24899
  x: x2,
24887
24900
  y: y2,
24888
24901
  x2: x2 + width,
24889
24902
  y2: y2 + height
24890
- }), boxToRect$1 = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
24903
+ }), boxToRect = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
24891
24904
  x: x2,
24892
24905
  y: y2,
24893
24906
  width: x22 - x2,
24894
24907
  height: y22 - y2
24895
- }), nodeToRect$1 = (node2, nodeOrigin = [0, 0]) => {
24896
- const { x: x2, y: y2 } = isInternalNodeBase$1(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin$1(node2, nodeOrigin);
24908
+ }), nodeToRect = (node2, nodeOrigin = [0, 0]) => {
24909
+ const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
24897
24910
  return {
24898
24911
  x: x2,
24899
24912
  y: y2,
@@ -24901,14 +24914,14 @@ const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp$1(Math.a
24901
24914
  height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
24902
24915
  };
24903
24916
  }, nodeToBox = (node2, nodeOrigin = [0, 0]) => {
24904
- const { x: x2, y: y2 } = isInternalNodeBase$1(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin$1(node2, nodeOrigin);
24917
+ const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
24905
24918
  return {
24906
24919
  x: x2,
24907
24920
  y: y2,
24908
24921
  x2: x2 + (node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0),
24909
24922
  y2: y2 + (node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0)
24910
24923
  };
24911
- }, getBoundsOfRects$1 = (rect1, rect2) => boxToRect$1(getBoundsOfBoxes$1(rectToBox$1(rect1), rectToBox$1(rect2))), getOverlappingArea = (rectA, rectB) => {
24924
+ }, getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2))), getOverlappingArea = (rectA, rectB) => {
24912
24925
  const xOverlap = Math.max(0, Math.min(rectA.x + rectA.width, rectB.x + rectB.width) - Math.max(rectA.x, rectB.x)), yOverlap = Math.max(0, Math.min(rectA.y + rectA.height, rectB.y + rectB.height) - Math.max(rectA.y, rectB.y));
24913
24926
  return Math.ceil(xOverlap * yOverlap);
24914
24927
  }, isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y), isNumeric = (n2) => !isNaN(n2) && isFinite(n2), devWarn = (id2, message) => {
@@ -24921,11 +24934,11 @@ const calcAutoPanVelocity = (value, min2, max2) => value < min2 ? clamp$1(Math.a
24921
24934
  y: (y2 - ty) / tScale
24922
24935
  };
24923
24936
  return snapToGrid ? snapPosition(position, snapGrid) : position;
24924
- }, rendererPointToPoint$1 = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
24937
+ }, rendererPointToPoint = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
24925
24938
  x: x2 * tScale + tx,
24926
24939
  y: y2 * tScale + ty
24927
24940
  });
24928
- function parsePadding$1(padding, viewport) {
24941
+ function parsePadding(padding, viewport) {
24929
24942
  if (typeof padding == "number")
24930
24943
  return Math.floor(viewport - viewport / (1 + padding));
24931
24944
  if (typeof padding == "string" && padding.endsWith("px")) {
@@ -24940,9 +24953,9 @@ function parsePadding$1(padding, viewport) {
24940
24953
  }
24941
24954
  return console.error(`[React Flow] The padding value "${padding}" is invalid. Please provide a number or a string with a valid unit (px or %).`), 0;
24942
24955
  }
24943
- function parsePaddings$1(padding, width, height) {
24956
+ function parsePaddings(padding, width, height) {
24944
24957
  if (typeof padding == "string" || typeof padding == "number") {
24945
- const paddingY = parsePadding$1(padding, height), paddingX = parsePadding$1(padding, width);
24958
+ const paddingY = parsePadding(padding, height), paddingX = parsePadding(padding, width);
24946
24959
  return {
24947
24960
  top: paddingY,
24948
24961
  right: paddingX,
@@ -24953,13 +24966,13 @@ function parsePaddings$1(padding, width, height) {
24953
24966
  };
24954
24967
  }
24955
24968
  if (typeof padding == "object") {
24956
- const top = parsePadding$1(padding.top ?? padding.y ?? 0, height), bottom = parsePadding$1(padding.bottom ?? padding.y ?? 0, height), left = parsePadding$1(padding.left ?? padding.x ?? 0, width), right = parsePadding$1(padding.right ?? padding.x ?? 0, width);
24969
+ const top = parsePadding(padding.top ?? padding.y ?? 0, height), bottom = parsePadding(padding.bottom ?? padding.y ?? 0, height), left = parsePadding(padding.left ?? padding.x ?? 0, width), right = parsePadding(padding.right ?? padding.x ?? 0, width);
24957
24970
  return { top, right, bottom, left, x: left + right, y: top + bottom };
24958
24971
  }
24959
24972
  return { top: 0, right: 0, bottom: 0, left: 0, x: 0, y: 0 };
24960
24973
  }
24961
- function calculateAppliedPaddings$1(bounds, x2, y2, zoom2, width, height) {
24962
- const { x: left, y: top } = rendererPointToPoint$1(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint$1({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
24974
+ function calculateAppliedPaddings(bounds, x2, y2, zoom2, width, height) {
24975
+ const { x: left, y: top } = rendererPointToPoint(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
24963
24976
  return {
24964
24977
  left: Math.floor(left),
24965
24978
  top: Math.floor(top),
@@ -24967,8 +24980,8 @@ function calculateAppliedPaddings$1(bounds, x2, y2, zoom2, width, height) {
24967
24980
  bottom: Math.floor(bottom)
24968
24981
  };
24969
24982
  }
24970
- const getViewportForBounds$1 = (bounds, width, height, minZoom, maxZoom, padding) => {
24971
- const p2 = parsePaddings$1(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp$1(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings$1(bounds, x2, y2, clampedZoom, width, height), offset2 = {
24983
+ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
24984
+ const p2 = parsePaddings(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings(bounds, x2, y2, clampedZoom, width, height), offset2 = {
24972
24985
  left: Math.min(newPadding.left - p2.left, 0),
24973
24986
  top: Math.min(newPadding.top - p2.top, 0),
24974
24987
  right: Math.min(newPadding.right - p2.right, 0),
@@ -24979,11 +24992,11 @@ const getViewportForBounds$1 = (bounds, width, height, minZoom, maxZoom, padding
24979
24992
  y: y2 - offset2.top + offset2.bottom,
24980
24993
  zoom: clampedZoom
24981
24994
  };
24982
- }, isMacOs$1 = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
24995
+ }, isMacOs = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
24983
24996
  function isCoordinateExtent(extent) {
24984
24997
  return extent !== void 0 && extent !== "parent";
24985
24998
  }
24986
- function getNodeDimensions$1(node2) {
24999
+ function getNodeDimensions(node2) {
24987
25000
  return {
24988
25001
  width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
24989
25002
  height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
@@ -25045,41 +25058,41 @@ const isMouseEvent = (event) => "clientX" in event, getEventPosition = (event, b
25045
25058
  };
25046
25059
  });
25047
25060
  };
25048
- function getBezierEdgeCenter$1({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
25061
+ function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
25049
25062
  const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125, centerY2 = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125, offsetX = Math.abs(centerX - sourceX), offsetY = Math.abs(centerY2 - sourceY);
25050
25063
  return [centerX, centerY2, offsetX, offsetY];
25051
25064
  }
25052
- function calculateControlOffset$1(distance2, curvature) {
25065
+ function calculateControlOffset(distance2, curvature) {
25053
25066
  return distance2 >= 0 ? 0.5 * distance2 : curvature * 25 * Math.sqrt(-distance2);
25054
25067
  }
25055
- function getControlWithCurvature$1({ pos, x1, y1, x2, y2, c: c2 }) {
25068
+ function getControlWithCurvature({ pos, x1, y1, x2, y2, c: c2 }) {
25056
25069
  switch (pos) {
25057
- case Position$1.Left:
25058
- return [x1 - calculateControlOffset$1(x1 - x2, c2), y1];
25059
- case Position$1.Right:
25060
- return [x1 + calculateControlOffset$1(x2 - x1, c2), y1];
25061
- case Position$1.Top:
25062
- return [x1, y1 - calculateControlOffset$1(y1 - y2, c2)];
25063
- case Position$1.Bottom:
25064
- return [x1, y1 + calculateControlOffset$1(y2 - y1, c2)];
25065
- }
25066
- }
25067
- function getBezierPath$1({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top, curvature = 0.25 }) {
25068
- const [sourceControlX, sourceControlY] = getControlWithCurvature$1({
25070
+ case Position.Left:
25071
+ return [x1 - calculateControlOffset(x1 - x2, c2), y1];
25072
+ case Position.Right:
25073
+ return [x1 + calculateControlOffset(x2 - x1, c2), y1];
25074
+ case Position.Top:
25075
+ return [x1, y1 - calculateControlOffset(y1 - y2, c2)];
25076
+ case Position.Bottom:
25077
+ return [x1, y1 + calculateControlOffset(y2 - y1, c2)];
25078
+ }
25079
+ }
25080
+ function getBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
25081
+ const [sourceControlX, sourceControlY] = getControlWithCurvature({
25069
25082
  pos: sourcePosition,
25070
25083
  x1: sourceX,
25071
25084
  y1: sourceY,
25072
25085
  x2: targetX,
25073
25086
  y2: targetY,
25074
25087
  c: curvature
25075
- }), [targetControlX, targetControlY] = getControlWithCurvature$1({
25088
+ }), [targetControlX, targetControlY] = getControlWithCurvature({
25076
25089
  pos: targetPosition,
25077
25090
  x1: targetX,
25078
25091
  y1: targetY,
25079
25092
  x2: sourceX,
25080
25093
  y2: sourceY,
25081
25094
  c: curvature
25082
- }), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter$1({
25095
+ }), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
25083
25096
  sourceX,
25084
25097
  sourceY,
25085
25098
  targetX,
@@ -25108,7 +25121,7 @@ function getElevatedEdgeZIndex({ sourceNode, targetNode, selected: selected2 = !
25108
25121
  return zIndex + (edgeOrConnectedNodeSelected ? selectedZIndex : 0);
25109
25122
  }
25110
25123
  function isEdgeVisible({ sourceNode, targetNode, width, height, transform: transform2 }) {
25111
- const edgeBox = getBoundsOfBoxes$1(nodeToBox(sourceNode), nodeToBox(targetNode));
25124
+ const edgeBox = getBoundsOfBoxes(nodeToBox(sourceNode), nodeToBox(targetNode));
25112
25125
  edgeBox.x === edgeBox.x2 && (edgeBox.x2 += 1), edgeBox.y === edgeBox.y2 && (edgeBox.y2 += 1);
25113
25126
  const viewRect = {
25114
25127
  x: -transform2[0] / transform2[2],
@@ -25116,7 +25129,7 @@ function isEdgeVisible({ sourceNode, targetNode, width, height, transform: trans
25116
25129
  width: width / transform2[2],
25117
25130
  height: height / transform2[2]
25118
25131
  };
25119
- return getOverlappingArea(viewRect, boxToRect$1(edgeBox)) > 0;
25132
+ return getOverlappingArea(viewRect, boxToRect(edgeBox)) > 0;
25120
25133
  }
25121
25134
  const getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `xy-edge__${source}${sourceHandle || ""}-${target}${targetHandle || ""}`, connectionExists = (edge, edges) => edges.some((el) => el.source === edge.source && el.target === edge.target && (el.sourceHandle === edge.sourceHandle || !el.sourceHandle && !edge.sourceHandle) && (el.targetHandle === edge.targetHandle || !el.targetHandle && !edge.targetHandle)), addEdge = (edgeParams, edges) => {
25122
25135
  if (!edgeParams.source || !edgeParams.target)
@@ -25137,12 +25150,12 @@ function getStraightPath({ sourceX, sourceY, targetX, targetY }) {
25137
25150
  return [`M ${sourceX},${sourceY}L ${targetX},${targetY}`, labelX, labelY, offsetX, offsetY];
25138
25151
  }
25139
25152
  const handleDirections = {
25140
- [Position$1.Left]: { x: -1, y: 0 },
25141
- [Position$1.Right]: { x: 1, y: 0 },
25142
- [Position$1.Top]: { x: 0, y: -1 },
25143
- [Position$1.Bottom]: { x: 0, y: 1 }
25144
- }, getDirection = ({ source, sourcePosition = Position$1.Bottom, target }) => sourcePosition === Position$1.Left || sourcePosition === Position$1.Right ? source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 } : source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 }, distance = (a2, b2) => Math.sqrt(Math.pow(b2.x - a2.x, 2) + Math.pow(b2.y - a2.y, 2));
25145
- function getPoints({ source, sourcePosition = Position$1.Bottom, target, targetPosition = Position$1.Top, center, offset: offset2 }) {
25153
+ [Position.Left]: { x: -1, y: 0 },
25154
+ [Position.Right]: { x: 1, y: 0 },
25155
+ [Position.Top]: { x: 0, y: -1 },
25156
+ [Position.Bottom]: { x: 0, y: 1 }
25157
+ }, getDirection = ({ source, sourcePosition = Position.Bottom, target }) => sourcePosition === Position.Left || sourcePosition === Position.Right ? source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 } : source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 }, distance = (a2, b2) => Math.sqrt(Math.pow(b2.x - a2.x, 2) + Math.pow(b2.y - a2.y, 2));
25158
+ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset: offset2 }) {
25146
25159
  const sourceDir = handleDirections[sourcePosition], targetDir = handleDirections[targetPosition], sourceGapped = { x: source.x + sourceDir.x * offset2, y: source.y + sourceDir.y * offset2 }, targetGapped = { x: target.x + targetDir.x * offset2, y: target.y + targetDir.y * offset2 }, dir = getDirection({
25147
25160
  source: sourceGapped,
25148
25161
  sourcePosition,
@@ -25200,7 +25213,7 @@ function getBend(a2, b2, c2, size2) {
25200
25213
  const xDir = a2.x < c2.x ? 1 : -1, yDir = a2.y < c2.y ? -1 : 1;
25201
25214
  return `L ${x2},${y2 + bendSize * yDir}Q ${x2},${y2} ${x2 + bendSize * xDir},${y2}`;
25202
25215
  }
25203
- function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top, borderRadius: borderRadius2 = 5, centerX, centerY: centerY2, offset: offset2 = 20 }) {
25216
+ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius: borderRadius2 = 5, centerX, centerY: centerY2, offset: offset2 = 20 }) {
25204
25217
  const [points, labelX, labelY, offsetX, offsetY] = getPoints({
25205
25218
  source: { x: sourceX, y: sourceY },
25206
25219
  sourcePosition,
@@ -25223,7 +25236,7 @@ function getEdgePosition(params) {
25223
25236
  return null;
25224
25237
  const sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles), targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles), sourceHandle = getHandle$1(sourceHandleBounds?.source ?? [], params.sourceHandle), targetHandle = getHandle$1(
25225
25238
  // when connection type is loose we can define all handles as sources and connect source -> source
25226
- params.connectionMode === ConnectionMode$1.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
25239
+ params.connectionMode === ConnectionMode.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
25227
25240
  params.targetHandle
25228
25241
  );
25229
25242
  if (!sourceHandle || !targetHandle)
@@ -25232,7 +25245,7 @@ function getEdgePosition(params) {
25232
25245
  sourceHandle: params.sourceHandle,
25233
25246
  targetHandle: params.targetHandle
25234
25247
  })), null;
25235
- const sourcePosition = sourceHandle?.position || Position$1.Bottom, targetPosition = targetHandle?.position || Position$1.Top, source = getHandlePosition(sourceNode, sourceHandle, sourcePosition), target = getHandlePosition(targetNode, targetHandle, targetPosition);
25248
+ const sourcePosition = sourceHandle?.position || Position.Bottom, targetPosition = targetHandle?.position || Position.Top, source = getHandlePosition(sourceNode, sourceHandle, sourcePosition), target = getHandlePosition(targetNode, targetHandle, targetPosition);
25236
25249
  return {
25237
25250
  sourceX: source.x,
25238
25251
  sourceY: source.y,
@@ -25253,18 +25266,18 @@ function toHandleBounds(handles) {
25253
25266
  target
25254
25267
  };
25255
25268
  }
25256
- function getHandlePosition(node2, handle, fallbackPosition = Position$1.Left, center = !1) {
25257
- const x2 = (handle?.x ?? 0) + node2.internals.positionAbsolute.x, y2 = (handle?.y ?? 0) + node2.internals.positionAbsolute.y, { width, height } = handle ?? getNodeDimensions$1(node2);
25269
+ function getHandlePosition(node2, handle, fallbackPosition = Position.Left, center = !1) {
25270
+ const x2 = (handle?.x ?? 0) + node2.internals.positionAbsolute.x, y2 = (handle?.y ?? 0) + node2.internals.positionAbsolute.y, { width, height } = handle ?? getNodeDimensions(node2);
25258
25271
  if (center)
25259
25272
  return { x: x2 + width / 2, y: y2 + height / 2 };
25260
25273
  switch (handle?.position ?? fallbackPosition) {
25261
- case Position$1.Top:
25274
+ case Position.Top:
25262
25275
  return { x: x2 + width / 2, y: y2 };
25263
- case Position$1.Right:
25276
+ case Position.Right:
25264
25277
  return { x: x2 + width, y: y2 + height / 2 };
25265
- case Position$1.Bottom:
25278
+ case Position.Bottom:
25266
25279
  return { x: x2 + width / 2, y: y2 + height };
25267
- case Position$1.Left:
25280
+ case Position.Left:
25268
25281
  return { x: x2, y: y2 + height / 2 };
25269
25282
  }
25270
25283
  }
@@ -25291,16 +25304,16 @@ function getNodeToolbarTransform(nodeRect, viewport, position, offset2, align) {
25291
25304
  nodeRect.y * viewport.zoom + viewport.y - offset2
25292
25305
  ], shift2 = [-100 * alignmentOffset, -100];
25293
25306
  switch (position) {
25294
- case Position$1.Right:
25307
+ case Position.Right:
25295
25308
  pos = [
25296
25309
  (nodeRect.x + nodeRect.width) * viewport.zoom + viewport.x + offset2,
25297
25310
  (nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y
25298
25311
  ], shift2 = [0, -100 * alignmentOffset];
25299
25312
  break;
25300
- case Position$1.Bottom:
25313
+ case Position.Bottom:
25301
25314
  pos[1] = (nodeRect.y + nodeRect.height) * viewport.zoom + viewport.y + offset2, shift2[1] = 0;
25302
25315
  break;
25303
- case Position$1.Left:
25316
+ case Position.Left:
25304
25317
  pos = [
25305
25318
  nodeRect.x * viewport.zoom + viewport.x - offset2,
25306
25319
  (nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y
@@ -25330,7 +25343,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
25330
25343
  if (node2.parentId)
25331
25344
  updateChildNode(node2, nodeLookup, parentLookup, _options);
25332
25345
  else {
25333
- const positionWithOrigin = getNodePositionWithOrigin$1(node2, _options.nodeOrigin), extent = isCoordinateExtent(node2.extent) ? node2.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions$1(node2));
25346
+ const positionWithOrigin = getNodePositionWithOrigin(node2, _options.nodeOrigin), extent = isCoordinateExtent(node2.extent) ? node2.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(node2));
25334
25347
  node2.internals.positionAbsolute = clampedPosition;
25335
25348
  }
25336
25349
  }
@@ -25344,7 +25357,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options) {
25344
25357
  if (_options.checkEquality && userNode === internalNode?.internals.userNode)
25345
25358
  nodeLookup.set(userNode.id, internalNode);
25346
25359
  else {
25347
- const positionWithOrigin = getNodePositionWithOrigin$1(userNode, _options.nodeOrigin), extent = isCoordinateExtent(userNode.extent) ? userNode.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions$1(userNode));
25360
+ const positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin), extent = isCoordinateExtent(userNode.extent) ? userNode.extent : _options.nodeExtent, clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(userNode));
25348
25361
  internalNode = {
25349
25362
  ..._options.defaults,
25350
25363
  ...userNode,
@@ -25392,7 +25405,7 @@ function calculateZ(node2, selectedNodeZ) {
25392
25405
  return (isNumeric(node2.zIndex) ? node2.zIndex : 0) + (node2.selected ? selectedNodeZ : 0);
25393
25406
  }
25394
25407
  function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ) {
25395
- const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute, childDimensions = getNodeDimensions$1(childNode), positionWithOrigin = getNodePositionWithOrigin$1(childNode, nodeOrigin), clampedPosition = isCoordinateExtent(childNode.extent) ? clampPosition(positionWithOrigin, childNode.extent, childDimensions) : positionWithOrigin;
25408
+ const { x: parentX, y: parentY } = parentNode.internals.positionAbsolute, childDimensions = getNodeDimensions(childNode), positionWithOrigin = getNodePositionWithOrigin(childNode, nodeOrigin), clampedPosition = isCoordinateExtent(childNode.extent) ? clampPosition(positionWithOrigin, childNode.extent, childDimensions) : positionWithOrigin;
25396
25409
  let absolutePosition = clampPosition({ x: parentX + clampedPosition.x, y: parentY + clampedPosition.y }, nodeExtent, childDimensions);
25397
25410
  childNode.extent === "parent" && (absolutePosition = clampPositionToParent(absolutePosition, childDimensions, parentNode));
25398
25411
  const childZ = calculateZ(childNode, selectedNodeZ), parentZ = parentNode.internals.z ?? 0;
@@ -25408,11 +25421,11 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
25408
25421
  const parent = nodeLookup.get(child.parentId);
25409
25422
  if (!parent)
25410
25423
  continue;
25411
- const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect$1(parent), expandedRect = getBoundsOfRects$1(parentRect, child.rect);
25424
+ const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect(parent), expandedRect = getBoundsOfRects(parentRect, child.rect);
25412
25425
  parentExpansions.set(child.parentId, { expandedRect, parent });
25413
25426
  }
25414
25427
  return parentExpansions.size > 0 && parentExpansions.forEach(({ expandedRect, parent }, parentId) => {
25415
- const positionAbsolute = parent.internals.positionAbsolute, dimensions = getNodeDimensions$1(parent), origin = parent.origin ?? nodeOrigin, xChange = expandedRect.x < positionAbsolute.x ? Math.round(Math.abs(positionAbsolute.x - expandedRect.x)) : 0, yChange = expandedRect.y < positionAbsolute.y ? Math.round(Math.abs(positionAbsolute.y - expandedRect.y)) : 0, newWidth = Math.max(dimensions.width, Math.round(expandedRect.width)), newHeight = Math.max(dimensions.height, Math.round(expandedRect.height)), widthChange = (newWidth - dimensions.width) * origin[0], heightChange = (newHeight - dimensions.height) * origin[1];
25428
+ const positionAbsolute = parent.internals.positionAbsolute, dimensions = getNodeDimensions(parent), origin = parent.origin ?? nodeOrigin, xChange = expandedRect.x < positionAbsolute.x ? Math.round(Math.abs(positionAbsolute.x - expandedRect.x)) : 0, yChange = expandedRect.y < positionAbsolute.y ? Math.round(Math.abs(positionAbsolute.y - expandedRect.y)) : 0, newWidth = Math.max(dimensions.width, Math.round(expandedRect.width)), newHeight = Math.max(dimensions.height, Math.round(expandedRect.height)), widthChange = (newWidth - dimensions.width) * origin[0], heightChange = (newHeight - dimensions.height) * origin[1];
25416
25429
  (xChange > 0 || yChange > 0 || widthChange || heightChange) && (changes.push({
25417
25430
  id: parentId,
25418
25431
  type: "position",
@@ -25484,7 +25497,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
25484
25497
  }), node2.expandParent && node2.parentId && parentExpandChildren.push({
25485
25498
  id: node2.id,
25486
25499
  parentId: node2.parentId,
25487
- rect: nodeToRect$1(newNode, nodeOrigin)
25500
+ rect: nodeToRect(newNode, nodeOrigin)
25488
25501
  }));
25489
25502
  }
25490
25503
  }
@@ -25601,7 +25614,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
25601
25614
  let hasChange = !1, nodesBox = { x: 0, y: 0, x2: 0, y2: 0 };
25602
25615
  if (dragItems.size > 1 && nodeExtent) {
25603
25616
  const rect = getInternalNodesBounds(dragItems);
25604
- nodesBox = rectToBox$1(rect);
25617
+ nodesBox = rectToBox(rect);
25605
25618
  }
25606
25619
  for (const [id2, dragItem] of dragItems) {
25607
25620
  if (!nodeLookup.has(id2))
@@ -25710,7 +25723,7 @@ function getNodesWithinDistance(position, nodeLookup, distance2) {
25710
25723
  height: distance2 * 2
25711
25724
  };
25712
25725
  for (const node2 of nodeLookup.values())
25713
- getOverlappingArea(rect, nodeToRect$1(node2)) > 0 && nodes.push(node2);
25726
+ getOverlappingArea(rect, nodeToRect(node2)) > 0 && nodes.push(node2);
25714
25727
  return nodes;
25715
25728
  }
25716
25729
  const ADDITIONAL_DISTANCE = 250;
@@ -25773,7 +25786,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
25773
25786
  }, fromNodeInternal = nodeLookup.get(nodeId), newConnection = {
25774
25787
  inProgress: !0,
25775
25788
  isValid: null,
25776
- from: getHandlePosition(fromNodeInternal, fromHandle, Position$1.Left, !0),
25789
+ from: getHandlePosition(fromNodeInternal, fromHandle, Position.Left, !0),
25777
25790
  fromHandle,
25778
25791
  fromPosition: fromHandle.position,
25779
25792
  fromNode: fromNodeInternal,
@@ -25809,7 +25822,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
25809
25822
  // from stays the same
25810
25823
  ...previousConnection,
25811
25824
  isValid,
25812
- to: closestHandle && isValid ? rendererPointToPoint$1({ x: closestHandle.x, y: closestHandle.y }, transform2) : position,
25825
+ to: closestHandle && isValid ? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, transform2) : position,
25813
25826
  toHandle: result.toHandle,
25814
25827
  toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
25815
25828
  toNode: result.toHandle ? nodeLookup.get(result.toHandle.nodeId) : null
@@ -25844,7 +25857,7 @@ function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId
25844
25857
  targetHandle: isTarget ? fromHandleId : handleId
25845
25858
  };
25846
25859
  result.connection = connection;
25847
- const isValid = connectable && connectableEnd && (connectionMode === ConnectionMode$1.Strict ? isTarget && handleType === "source" || !isTarget && handleType === "target" : handleNodeId !== fromNodeId || handleId !== fromHandleId);
25860
+ const isValid = connectable && connectableEnd && (connectionMode === ConnectionMode.Strict ? isTarget && handleType === "source" || !isTarget && handleType === "target" : handleNodeId !== fromNodeId || handleId !== fromHandleId);
25848
25861
  result.isValid = isValid && isValidConnection(connection), result.toHandle = getHandle(handleNodeId, handleType, handleId, nodeLookup, connectionMode, !1);
25849
25862
  }
25850
25863
  return result;
@@ -25911,7 +25924,7 @@ const viewChanged = (prevViewport, eventViewport) => prevViewport.x !== eventVie
25911
25924
  const hasDuration = typeof duration == "number" && duration > 0;
25912
25925
  return hasDuration || onEnd(), hasDuration ? selection2.transition().duration(duration).on("end", onEnd) : selection2;
25913
25926
  }, wheelDelta = (event) => {
25914
- const factor = event.ctrlKey && isMacOs$1() ? 10 : 1;
25927
+ const factor = event.ctrlKey && isMacOs() ? 10 : 1;
25915
25928
  return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * factor;
25916
25929
  };
25917
25930
  function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection, d3Zoom, panOnScrollMode, panOnScrollSpeed, zoomOnPinch, onPanZoomStart, onPanZoom, onPanZoomEnd }) {
@@ -25926,8 +25939,8 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
25926
25939
  return;
25927
25940
  }
25928
25941
  const deltaNormalize = event.deltaMode === 1 ? 20 : 1;
25929
- let deltaX = panOnScrollMode === PanOnScrollMode$1.Vertical ? 0 : event.deltaX * deltaNormalize, deltaY = panOnScrollMode === PanOnScrollMode$1.Horizontal ? 0 : event.deltaY * deltaNormalize;
25930
- !isMacOs$1() && event.shiftKey && panOnScrollMode !== PanOnScrollMode$1.Vertical && (deltaX = event.deltaY * deltaNormalize, deltaY = 0), d3Zoom.translateBy(
25942
+ let deltaX = panOnScrollMode === PanOnScrollMode.Vertical ? 0 : event.deltaX * deltaNormalize, deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize;
25943
+ !isMacOs() && event.shiftKey && panOnScrollMode !== PanOnScrollMode.Vertical && (deltaX = event.deltaY * deltaNormalize, deltaY = 0), d3Zoom.translateBy(
25931
25944
  d3Selection,
25932
25945
  -(deltaX / currentZoom) * panOnScrollSpeed,
25933
25946
  -(deltaY / currentZoom) * panOnScrollSpeed,
@@ -26003,7 +26016,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
26003
26016
  setViewportConstrained({
26004
26017
  x: viewport.x,
26005
26018
  y: viewport.y,
26006
- zoom: clamp$1(viewport.zoom, minZoom, maxZoom)
26019
+ zoom: clamp(viewport.zoom, minZoom, maxZoom)
26007
26020
  }, [
26008
26021
  [0, 0],
26009
26022
  [bbox.width, bbox.height]
@@ -26127,10 +26140,10 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
26127
26140
  setClickDistance
26128
26141
  };
26129
26142
  }
26130
- var ResizeControlVariant$1;
26143
+ var ResizeControlVariant;
26131
26144
  (function(ResizeControlVariant2) {
26132
26145
  ResizeControlVariant2.Line = "line", ResizeControlVariant2.Handle = "handle";
26133
- })(ResizeControlVariant$1 || (ResizeControlVariant$1 = {}));
26146
+ })(ResizeControlVariant || (ResizeControlVariant = {}));
26134
26147
  function getResizeDirection({ width, prevWidth, height, prevHeight, affectsX, affectsY }) {
26135
26148
  const deltaWidth = width - prevWidth, deltaHeight = height - prevHeight, direction = [deltaWidth > 0 ? 1 : deltaWidth < 0 ? -1 : 0, deltaHeight > 0 ? 1 : deltaHeight < 0 ? -1 : 0];
26136
26149
  return deltaWidth && affectsX && (direction[0] = direction[0] * -1), deltaHeight && affectsY && (direction[1] = direction[1] * -1), direction;
@@ -26628,7 +26641,7 @@ const useViewportHelper = () => {
26628
26641
  }, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
26629
26642
  },
26630
26643
  fitBounds: async (bounds, options) => {
26631
- const { width, height, minZoom, maxZoom, panZoom } = store.getState(), viewport = getViewportForBounds$1(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
26644
+ const { width, height, minZoom, maxZoom, panZoom } = store.getState(), viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
26632
26645
  return panZoom ? (await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
26633
26646
  },
26634
26647
  screenToFlowPosition: (clientPosition, options = {}) => {
@@ -26645,7 +26658,7 @@ const useViewportHelper = () => {
26645
26658
  const { transform: transform2, domNode } = store.getState();
26646
26659
  if (!domNode)
26647
26660
  return flowPosition;
26648
- const { x: domX, y: domY } = domNode.getBoundingClientRect(), rendererPosition = rendererPointToPoint$1(flowPosition, transform2);
26661
+ const { x: domX, y: domY } = domNode.getBoundingClientRect(), rendererPosition = rendererPointToPoint(flowPosition, transform2);
26649
26662
  return {
26650
26663
  x: rendererPosition.x + domX,
26651
26664
  y: rendererPosition.y + domY
@@ -26814,7 +26827,7 @@ function useReactFlow() {
26814
26827
  width: nodeToUse.measured?.width ?? nodeToUse.width,
26815
26828
  height: nodeToUse.measured?.height ?? nodeToUse.height
26816
26829
  };
26817
- return nodeToRect$1(nodeWithPosition);
26830
+ return nodeToRect(nodeWithPosition);
26818
26831
  }, updateNode = (id2, nodeUpdate, options = { replace: !1 }) => {
26819
26832
  setNodes((prevNodes) => prevNodes.map((node2) => {
26820
26833
  if (node2.id === id2) {
@@ -26887,7 +26900,7 @@ function useReactFlow() {
26887
26900
  const internalNode = store.getState().nodeLookup.get(n2.id);
26888
26901
  if (internalNode && !isRect && (n2.id === nodeOrRect.id || !internalNode.internals.positionAbsolute))
26889
26902
  return !1;
26890
- const currNodeRect = nodeToRect$1(hasNodesOption ? n2 : internalNode), overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
26903
+ const currNodeRect = nodeToRect(hasNodesOption ? n2 : internalNode), overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
26891
26904
  return partially && overlappingArea > 0 || overlappingArea >= nodeRect.width * nodeRect.height;
26892
26905
  }) : [];
26893
26906
  },
@@ -26970,7 +26983,7 @@ const containerStyle = {
26970
26983
  userSelectionActive: s2.userSelectionActive,
26971
26984
  lib: s2.lib
26972
26985
  });
26973
- function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode$1.Free, zoomOnDoubleClick = !0, panOnDrag = !0, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = !0, children: children2, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
26986
+ function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = !0, children: children2, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
26974
26987
  const store = useStoreApi(), zoomPane = useRef(null), { userSelectionActive, lib: lib2 } = useStore$1(selector$j, shallow$1), zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode), panZoom = useRef();
26975
26988
  useResizeHandler(zoomPane);
26976
26989
  const onTransformChange = useCallback((transform2) => {
@@ -27064,7 +27077,7 @@ const wrapHandler = (handler, containerRef) => (event) => {
27064
27077
  connectionInProgress: s2.connection.inProgress,
27065
27078
  dragging: s2.paneDragging
27066
27079
  });
27067
- function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode$1.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
27080
+ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
27068
27081
  const store = useStoreApi(), { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore$1(selector$h, shallow$1), hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive), container2 = useRef(null), containerBounds = useRef(), selectedNodeIds = useRef(/* @__PURE__ */ new Set()), selectedEdgeIds = useRef(/* @__PURE__ */ new Set()), selectionInProgress = useRef(!1), selectionStarted = useRef(!1), onClick = (event) => {
27069
27082
  if (selectionInProgress.current || connectionInProgress) {
27070
27083
  selectionInProgress.current = !1;
@@ -27106,7 +27119,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode$
27106
27119
  width: Math.abs(mouseX - startX),
27107
27120
  height: Math.abs(mouseY - startY)
27108
27121
  }, prevSelectedNodeIds = selectedNodeIds.current, prevSelectedEdgeIds = selectedEdgeIds.current;
27109
- selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode$1.Partial, !0).map((node2) => node2.id)), selectedEdgeIds.current = /* @__PURE__ */ new Set();
27122
+ selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode.Partial, !0).map((node2) => node2.id)), selectedEdgeIds.current = /* @__PURE__ */ new Set();
27110
27123
  const edgesSelectable = defaultEdgeOptions?.selectable ?? !0;
27111
27124
  for (const nodeId of selectedNodeIds.current) {
27112
27125
  const connections = connectionLookup.get(nodeId);
@@ -27223,13 +27236,13 @@ const useNodeId = () => useContext(NodeIdContext), selector$g = (s2) => ({
27223
27236
  connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
27224
27237
  connectingTo,
27225
27238
  clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.id === handleId && clickHandle?.type === type,
27226
- isPossibleEndHandle: connectionMode === ConnectionMode$1.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
27239
+ isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
27227
27240
  connectionInProcess: !!fromHandle,
27228
27241
  clickConnectionInProcess: !!clickHandle,
27229
27242
  valid: connectingTo && isValid
27230
27243
  };
27231
27244
  };
27232
- function HandleComponent({ type = "source", position = Position$1.Top, isValidConnection, isConnectable = !0, isConnectableStart = !0, isConnectableEnd = !0, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
27245
+ function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = !0, isConnectableStart = !0, isConnectableEnd = !0, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
27233
27246
  const handleId = id2 || null, isTarget = type === "target", store = useStoreApi(), nodeId = useNodeId(), { connectOnClick, noPanClassName, rfId } = useStore$1(selector$g, shallow$1), { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore$1(connectingSelector(nodeId, handleId, type), shallow$1);
27234
27247
  nodeId || store.getState().onError?.("010", errorMessages.error010());
27235
27248
  const onConnectExtended = (params) => {
@@ -27325,16 +27338,16 @@ function HandleComponent({ type = "source", position = Position$1.Top, isValidCo
27325
27338
  ]), onMouseDown: onPointerDown2, onTouchStart: onPointerDown2, onClick: connectOnClick ? onClick : void 0, ref, ...rest, children: children2 });
27326
27339
  }
27327
27340
  const Handle = memo$2(fixedForwardRef(HandleComponent));
27328
- function InputNode({ data, isConnectable, sourcePosition = Position$1.Bottom }) {
27341
+ function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
27329
27342
  return jsxs(Fragment$1, { children: [data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
27330
27343
  }
27331
- function DefaultNode({ data, isConnectable, targetPosition = Position$1.Top, sourcePosition = Position$1.Bottom }) {
27344
+ function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom }) {
27332
27345
  return jsxs(Fragment$1, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
27333
27346
  }
27334
27347
  function GroupNode() {
27335
27348
  return null;
27336
27349
  }
27337
- function OutputNode({ data, isConnectable, targetPosition = Position$1.Top }) {
27350
+ function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
27338
27351
  return jsxs(Fragment$1, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label] });
27339
27352
  }
27340
27353
  const arrowKeyDiffs = {
@@ -27456,7 +27469,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
27456
27469
  }), moveSelectedNodes = useMoveSelectedNodes();
27457
27470
  if (node2.hidden)
27458
27471
  return null;
27459
- const nodeDimensions = getNodeDimensions$1(node2), inlineDimensions = getNodeInlineStyleDimensions(node2), hasPointerEvents = isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave, onMouseEnterHandler = onMouseEnter ? (event) => onMouseEnter(event, { ...internals.userNode }) : void 0, onMouseMoveHandler = onMouseMove ? (event) => onMouseMove(event, { ...internals.userNode }) : void 0, onMouseLeaveHandler = onMouseLeave ? (event) => onMouseLeave(event, { ...internals.userNode }) : void 0, onContextMenuHandler = onContextMenu ? (event) => onContextMenu(event, { ...internals.userNode }) : void 0, onDoubleClickHandler = onDoubleClick ? (event) => onDoubleClick(event, { ...internals.userNode }) : void 0, onSelectNodeHandler = (event) => {
27472
+ const nodeDimensions = getNodeDimensions(node2), inlineDimensions = getNodeInlineStyleDimensions(node2), hasPointerEvents = isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave, onMouseEnterHandler = onMouseEnter ? (event) => onMouseEnter(event, { ...internals.userNode }) : void 0, onMouseMoveHandler = onMouseMove ? (event) => onMouseMove(event, { ...internals.userNode }) : void 0, onMouseLeaveHandler = onMouseLeave ? (event) => onMouseLeave(event, { ...internals.userNode }) : void 0, onContextMenuHandler = onContextMenu ? (event) => onContextMenu(event, { ...internals.userNode }) : void 0, onDoubleClickHandler = onDoubleClick ? (event) => onDoubleClick(event, { ...internals.userNode }) : void 0, onSelectNodeHandler = (event) => {
27460
27473
  const { selectNodesOnDrag, nodeDragThreshold } = store.getState();
27461
27474
  isSelectable && (!selectNodesOnDrag || !isDraggable || nodeDragThreshold > 0) && handleNodeClick({
27462
27475
  id: id2,
@@ -27571,8 +27584,8 @@ const ArrowSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => jsx("polyli
27571
27584
  fill: color2,
27572
27585
  strokeWidth
27573
27586
  }, strokeLinecap: "round", strokeLinejoin: "round", points: "-5,-4 0,0 -5,4 -5,-4" }), MarkerSymbols = {
27574
- [MarkerType$1.Arrow]: ArrowSymbol,
27575
- [MarkerType$1.ArrowClosed]: ArrowClosedSymbol
27587
+ [MarkerType.Arrow]: ArrowSymbol,
27588
+ [MarkerType.ArrowClosed]: ArrowClosedSymbol
27576
27589
  };
27577
27590
  function useMarkerSymbol(type) {
27578
27591
  const store = useStoreApi();
@@ -27612,9 +27625,9 @@ function BaseEdge({ path, labelX, labelY, label: label2, labelStyle, labelShowBg
27612
27625
  return jsxs(Fragment$1, { children: [jsx("path", { ...props, d: path, fill: "none", className: cc(["react-flow__edge-path", props.className]) }), interactionWidth && jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }), label2 && isNumeric(labelX) && isNumeric(labelY) ? jsx(EdgeText, { x: labelX, y: labelY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius }) : null] });
27613
27626
  }
27614
27627
  function getControl({ pos, x1, y1, x2, y2 }) {
27615
- return pos === Position$1.Left || pos === Position$1.Right ? [0.5 * (x1 + x2), y1] : [x1, 0.5 * (y1 + y2)];
27628
+ return pos === Position.Left || pos === Position.Right ? [0.5 * (x1 + x2), y1] : [x1, 0.5 * (y1 + y2)];
27616
27629
  }
27617
- function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position$1.Bottom, targetX, targetY, targetPosition = Position$1.Top }) {
27630
+ function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top }) {
27618
27631
  const [sourceControlX, sourceControlY] = getControl({
27619
27632
  pos: sourcePosition,
27620
27633
  x1: sourceX,
@@ -27627,7 +27640,7 @@ function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position$1.Bot
27627
27640
  y1: targetY,
27628
27641
  x2: sourceX,
27629
27642
  y2: sourceY
27630
- }), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter$1({
27643
+ }), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
27631
27644
  sourceX,
27632
27645
  sourceY,
27633
27646
  targetX,
@@ -27646,7 +27659,7 @@ function getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position$1.Bot
27646
27659
  ];
27647
27660
  }
27648
27661
  function createSimpleBezierEdge(params) {
27649
- return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth }) => {
27662
+ return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth }) => {
27650
27663
  const [path, labelX, labelY] = getSimpleBezierPath({
27651
27664
  sourceX,
27652
27665
  sourceY,
@@ -27662,7 +27675,7 @@ const SimpleBezierEdge = createSimpleBezierEdge({ isInternal: !1 }), SimpleBezie
27662
27675
  SimpleBezierEdge.displayName = "SimpleBezierEdge";
27663
27676
  SimpleBezierEdgeInternal.displayName = "SimpleBezierEdgeInternal";
27664
27677
  function createSmoothStepEdge(params) {
27665
- return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, markerEnd, markerStart, pathOptions, interactionWidth }) => {
27678
+ return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, sourcePosition = Position.Bottom, targetPosition = Position.Top, markerEnd, markerStart, pathOptions, interactionWidth }) => {
27666
27679
  const [path, labelX, labelY] = getSmoothStepPath({
27667
27680
  sourceX,
27668
27681
  sourceY,
@@ -27698,8 +27711,8 @@ const StraightEdge = createStraightEdge({ isInternal: !1 }), StraightEdgeInterna
27698
27711
  StraightEdge.displayName = "StraightEdge";
27699
27712
  StraightEdgeInternal.displayName = "StraightEdgeInternal";
27700
27713
  function createBezierEdge(params) {
27701
- return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position$1.Bottom, targetPosition = Position$1.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, pathOptions, interactionWidth }) => {
27702
- const [path, labelX, labelY] = getBezierPath$1({
27714
+ return memo$2(({ id: id2, sourceX, sourceY, targetX, targetY, sourcePosition = Position.Bottom, targetPosition = Position.Top, label: label2, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, pathOptions, interactionWidth }) => {
27715
+ const [path, labelX, labelY] = getBezierPath({
27703
27716
  sourceX,
27704
27717
  sourceY,
27705
27718
  sourcePosition,
@@ -27727,7 +27740,7 @@ const builtinEdgeTypes = {
27727
27740
  targetY: null,
27728
27741
  sourcePosition: null,
27729
27742
  targetPosition: null
27730
- }, shiftX = (x2, shift2, position) => position === Position$1.Left ? x2 - shift2 : position === Position$1.Right ? x2 + shift2 : x2, shiftY = (y2, shift2, position) => position === Position$1.Top ? y2 - shift2 : position === Position$1.Bottom ? y2 + shift2 : y2, EdgeUpdaterClassName = "react-flow__edgeupdater";
27743
+ }, shiftX = (x2, shift2, position) => position === Position.Left ? x2 - shift2 : position === Position.Right ? x2 + shift2 : x2, shiftY = (y2, shift2, position) => position === Position.Top ? y2 - shift2 : position === Position.Bottom ? y2 + shift2 : y2, EdgeUpdaterClassName = "react-flow__edgeupdater";
27731
27744
  function EdgeAnchor({ position, centerX, centerY: centerY2, radius = 10, onMouseDown, onMouseEnter, onMouseOut, type }) {
27732
27745
  return jsx("circle", { onMouseDown, onMouseEnter, onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY2, radius, position), r: radius, stroke: "transparent", fill: "transparent" });
27733
27746
  }
@@ -27885,7 +27898,7 @@ function ConnectionLineWrapper({ containerStyle: containerStyle2, style: style2,
27885
27898
  const { nodesConnectable, width, height, isValid, inProgress } = useStore$1(selector$7, shallow$1);
27886
27899
  return !(width && nodesConnectable && inProgress) ? null : jsx("svg", { style: containerStyle2, width, height, className: "react-flow__connectionline react-flow__container", children: jsx("g", { className: cc(["react-flow__connection", getConnectionStatus(isValid)]), children: jsx(ConnectionLine, { style: style2, type, CustomComponent: component, isValid }) }) });
27887
27900
  }
27888
- const ConnectionLine = ({ style: style2, type = ConnectionLineType$1.Bezier, CustomComponent, isValid }) => {
27901
+ const ConnectionLine = ({ style: style2, type = ConnectionLineType.Bezier, CustomComponent, isValid }) => {
27889
27902
  const { inProgress, from, fromNode, fromHandle, fromPosition, to, toNode, toHandle, toPosition } = useConnection();
27890
27903
  if (!inProgress)
27891
27904
  return;
@@ -27901,19 +27914,19 @@ const ConnectionLine = ({ style: style2, type = ConnectionLineType$1.Bezier, Cus
27901
27914
  targetPosition: toPosition
27902
27915
  };
27903
27916
  switch (type) {
27904
- case ConnectionLineType$1.Bezier:
27905
- [path] = getBezierPath$1(pathParams);
27917
+ case ConnectionLineType.Bezier:
27918
+ [path] = getBezierPath(pathParams);
27906
27919
  break;
27907
- case ConnectionLineType$1.SimpleBezier:
27920
+ case ConnectionLineType.SimpleBezier:
27908
27921
  [path] = getSimpleBezierPath(pathParams);
27909
27922
  break;
27910
- case ConnectionLineType$1.Step:
27923
+ case ConnectionLineType.Step:
27911
27924
  [path] = getSmoothStepPath({
27912
27925
  ...pathParams,
27913
27926
  borderRadius: 0
27914
27927
  });
27915
27928
  break;
27916
- case ConnectionLineType$1.SmoothStep:
27929
+ case ConnectionLineType.SmoothStep:
27917
27930
  [path] = getSmoothStepPath(pathParams);
27918
27931
  break;
27919
27932
  default:
@@ -27946,7 +27959,7 @@ const GraphView = memo$2(GraphViewComponent), getInitialState = ({ nodes, edges,
27946
27959
  if (fitView && width && height) {
27947
27960
  const bounds = getInternalNodesBounds(nodeLookup, {
27948
27961
  filter: (node2) => !!((node2.width || node2.initialWidth) && (node2.height || node2.initialHeight))
27949
- }), { x: x2, y: y2, zoom: zoom2 } = getViewportForBounds$1(bounds, width, height, 0.5, 2, 0.1);
27962
+ }), { x: x2, y: y2, zoom: zoom2 } = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
27950
27963
  transform2 = [x2, y2, zoom2];
27951
27964
  }
27952
27965
  return {
@@ -27972,7 +27985,7 @@ const GraphView = memo$2(GraphViewComponent), getInitialState = ({ nodes, edges,
27972
27985
  nodesSelectionActive: !1,
27973
27986
  userSelectionActive: !1,
27974
27987
  userSelectionRect: null,
27975
- connectionMode: ConnectionMode$1.Strict,
27988
+ connectionMode: ConnectionMode.Strict,
27976
27989
  domNode: null,
27977
27990
  paneDragging: !1,
27978
27991
  noPanClassName: "nopan",
@@ -28192,7 +28205,7 @@ const wrapperStyle = {
28192
28205
  position: "relative",
28193
28206
  zIndex: 0
28194
28207
  };
28195
- function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType$1.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode$1.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs$1() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs$1() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode$1.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug: debug2, onScroll, ...rest }, ref) {
28208
+ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes: nodeTypes2, edgeTypes: edgeTypes2, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug: debug2, onScroll, ...rest }, ref) {
28196
28209
  const rfId = id2 || "1", colorModeClassName = useColorModeClass(colorMode), wrapperOnScroll = useCallback((e2) => {
28197
28210
  e2.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" }), onScroll?.(e2);
28198
28211
  }, [onScroll]);
@@ -28327,7 +28340,7 @@ function MiniMapNodes({
28327
28340
  }
28328
28341
  function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
28329
28342
  const { node: node2, x: x2, y: y2, width, height } = useStore$1((s2) => {
28330
- const { internals } = s2.nodeLookup.get(id2), node22 = internals.userNode, { x: x22, y: y22 } = internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions$1(node22);
28343
+ const { internals } = s2.nodeLookup.get(id2), node22 = internals.userNode, { x: x22, y: y22 } = internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions(node22);
28331
28344
  return {
28332
28345
  node: node22,
28333
28346
  x: x22,
@@ -28349,7 +28362,7 @@ const defaultWidth = 200, defaultHeight = 150, filterHidden = (node2) => !node2.
28349
28362
  };
28350
28363
  return {
28351
28364
  viewBB,
28352
- boundingRect: s2.nodeLookup.size > 0 ? getBoundsOfRects$1(getInternalNodesBounds(s2.nodeLookup, { filter: filterHidden }), viewBB) : viewBB,
28365
+ boundingRect: s2.nodeLookup.size > 0 ? getBoundsOfRects(getInternalNodesBounds(s2.nodeLookup, { filter: filterHidden }), viewBB) : viewBB,
28353
28366
  rfId: s2.rfId,
28354
28367
  panZoom: s2.panZoom,
28355
28368
  translateExtent: s2.translateExtent,
@@ -28427,8 +28440,8 @@ function MiniMapComponent({
28427
28440
  }
28428
28441
  MiniMapComponent.displayName = "MiniMap";
28429
28442
  memo$2(MiniMapComponent);
28430
- function ResizeControl({ nodeId, position, variant = ResizeControlVariant$1.Handle, className, style: style2 = {}, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, shouldResize, onResizeStart, onResize, onResizeEnd }) {
28431
- const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), defaultPosition = variant === ResizeControlVariant$1.Line ? "right" : "bottom-right", controlPosition = position ?? defaultPosition, resizer = useRef(null);
28443
+ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style: style2 = {}, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, shouldResize, onResizeStart, onResize, onResizeEnd }) {
28444
+ const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), defaultPosition = variant === ResizeControlVariant.Line ? "right" : "bottom-right", controlPosition = position ?? defaultPosition, resizer = useRef(null);
28432
28445
  useEffect(() => {
28433
28446
  if (!(!resizeControlRef.current || !id2))
28434
28447
  return resizer.current || (resizer.current = XYResizer({
@@ -28532,7 +28545,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant$1.Hand
28532
28545
  onResizeEnd,
28533
28546
  shouldResize
28534
28547
  ]);
28535
- const positionClassNames = controlPosition.split("-"), colorStyleProp = variant === ResizeControlVariant$1.Line ? "borderColor" : "backgroundColor", controlStyle = color2 ? { ...style2, [colorStyleProp]: color2 } : style2;
28548
+ const positionClassNames = controlPosition.split("-"), colorStyleProp = variant === ResizeControlVariant.Line ? "borderColor" : "backgroundColor", controlStyle = color2 ? { ...style2, [colorStyleProp]: color2 } : style2;
28536
28549
  return jsx("div", { className: cc(["react-flow__resize-control", "nodrag", ...positionClassNames, variant, className]), ref: resizeControlRef, style: controlStyle, children: children2 });
28537
28550
  }
28538
28551
  memo$2(ResizeControl);
@@ -28554,7 +28567,7 @@ const nodeEqualityFn = (a2, b2) => a2?.internals.positionAbsolute.x !== b2?.inte
28554
28567
  zoom: state.transform[2],
28555
28568
  selectedNodesCount: state.nodes.filter((node2) => node2.selected).length
28556
28569
  });
28557
- function NodeToolbar({ nodeId, children: children2, className, style: style2, isVisible, position = Position$1.Top, offset: offset2 = 10, align = "center", ...rest }) {
28570
+ function NodeToolbar({ nodeId, children: children2, className, style: style2, isVisible, position = Position.Top, offset: offset2 = 10, align = "center", ...rest }) {
28558
28571
  const contextNodeId = useNodeId(), nodesSelector2 = useCallback((state) => (Array.isArray(nodeId) ? nodeId : [nodeId || contextNodeId || ""]).reduce((res, id2) => {
28559
28572
  const node2 = state.nodeLookup.get(id2);
28560
28573
  return node2 && res.set(node2.id, node2), res;
@@ -28571,7 +28584,7 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
28571
28584
  }
28572
28585
  var s$2 = { done: !1, hasNext: !1 };
28573
28586
  function C(t2, ...o2) {
28574
- let n2 = t2, u2 = o2.map((e2) => "lazy" in e2 ? y$5(e2) : void 0), p2 = 0;
28587
+ let n2 = t2, u2 = o2.map((e2) => "lazy" in e2 ? y$4(e2) : void 0), p2 = 0;
28575
28588
  for (; p2 < o2.length; ) {
28576
28589
  if (u2[p2] === void 0 || !B(n2)) {
28577
28590
  let i2 = o2[p2];
@@ -28607,14 +28620,14 @@ function f$2(t2, o2, n2) {
28607
28620
  }
28608
28621
  return p2.hasNext && o2.push(u2), e2;
28609
28622
  }
28610
- function y$5(t2) {
28623
+ function y$4(t2) {
28611
28624
  let { lazy: o2, lazyArgs: n2 } = t2, u2 = o2(...n2);
28612
28625
  return Object.assign(u2, { isSingle: o2.single ?? !1, index: 0, items: [] });
28613
28626
  }
28614
28627
  function B(t2) {
28615
28628
  return typeof t2 == "string" || typeof t2 == "object" && t2 !== null && Symbol.iterator in t2;
28616
28629
  }
28617
- function y$4(t2, i2) {
28630
+ function y$3(t2, i2) {
28618
28631
  let a2 = i2.length - t2.length;
28619
28632
  if (a2 === 1) {
28620
28633
  let [n2, ...r2] = i2;
@@ -28640,7 +28653,7 @@ function r$6(...t2) {
28640
28653
  return u$7(Object.values, t2);
28641
28654
  }
28642
28655
  function i$8(...e2) {
28643
- return y$4(a$6, e2);
28656
+ return y$3(a$6, e2);
28644
28657
  }
28645
28658
  function a$6() {
28646
28659
  let e2 = /* @__PURE__ */ new Set();
@@ -28733,7 +28746,7 @@ function i$4(e2, o2) {
28733
28746
  for (let [r2, n2] of Object.entries(e2)) o2(n2, r2, e2) && (t2[r2] = n2);
28734
28747
  return t2;
28735
28748
  }
28736
- function y$3(...t2) {
28749
+ function y$2(...t2) {
28737
28750
  return u$7(f$1, t2);
28738
28751
  }
28739
28752
  function f$1(t2, e2) {
@@ -28846,7 +28859,7 @@ function u$3(n2, e2) {
28846
28859
  if (typeof n2 != "object" || typeof e2 != "object" || n2 === null || e2 === null || Object.getPrototypeOf(n2) !== Object.getPrototypeOf(e2)) return !1;
28847
28860
  if (Array.isArray(n2)) return l$1(n2, e2);
28848
28861
  if (n2 instanceof Map) return a$3(n2, e2);
28849
- if (n2 instanceof Set) return c$2(n2, e2);
28862
+ if (n2 instanceof Set) return c$1(n2, e2);
28850
28863
  if (n2 instanceof Date) return n2.getTime() === e2.getTime();
28851
28864
  if (n2 instanceof RegExp) return n2.toString() === e2.toString();
28852
28865
  if (Object.keys(n2).length !== Object.keys(e2).length) return !1;
@@ -28863,7 +28876,7 @@ function a$3(n2, e2) {
28863
28876
  for (let [r2, t2] of n2.entries()) if (!e2.has(r2) || !u$3(t2, e2.get(r2))) return !1;
28864
28877
  return !0;
28865
28878
  }
28866
- function c$2(n2, e2) {
28879
+ function c$1(n2, e2) {
28867
28880
  if (n2.size !== e2.size) return !1;
28868
28881
  let r2 = [...e2];
28869
28882
  for (let t2 of n2) {
@@ -28877,23 +28890,12 @@ function c$2(n2, e2) {
28877
28890
  return !0;
28878
28891
  }
28879
28892
  function j(...e2) {
28880
- return u$7(c$1, e2);
28893
+ return u$7(c, e2);
28881
28894
  }
28882
- function c$1(e2, u2) {
28895
+ function c(e2, u2) {
28883
28896
  for (let [t2, y2] of Object.entries(u2)) if (!Object.hasOwn(e2, t2) || !k(y2, e2[t2])) return !1;
28884
28897
  return !0;
28885
28898
  }
28886
- function c(...e2) {
28887
- return u$7(y$2, e2);
28888
- }
28889
- function y$2(e2, o2) {
28890
- let r2 = {};
28891
- for (let [a2, n2] of e2.entries()) {
28892
- let d2 = o2(n2, a2, e2);
28893
- r2[d2] = n2;
28894
- }
28895
- return r2;
28896
- }
28897
28899
  function i$2(...e2) {
28898
28900
  return u$7(a$2, e2);
28899
28901
  }
@@ -28985,70 +28987,64 @@ function useDebouncedEffect(callback, deps, delay2, maxWait = 0) {
28985
28987
  useEffect(useDebouncedCallback(callback, deps, delay2, maxWait), deps);
28986
28988
  }
28987
28989
  const { valueOf, toString: toString$1 } = Object.prototype, isEqual = (a2, b2) => {
28988
- if (a2 === b2)
28989
- return !0;
28990
- if (typeof a2 == "object" && typeof b2 == "object" && a2 && b2) {
28991
- if (a2.constructor !== b2.constructor)
28990
+ const visited = /* @__PURE__ */ new WeakMap(), inner2 = (a3, b3) => {
28991
+ if (a3 === b3)
28992
+ return !0;
28993
+ if (typeof a3 != "object" || typeof b3 != "object" || !a3 || !b3)
28994
+ return a3 !== a3 && b3 !== b3;
28995
+ if (Object.getPrototypeOf(a3) !== Object.getPrototypeOf(b3))
28992
28996
  return !1;
28993
- if (Array.isArray(a2)) {
28994
- const { length } = a2;
28995
- if (length !== b2.length)
28997
+ const { constructor } = a3;
28998
+ if (constructor === Date)
28999
+ return a3.getTime() === b3.getTime();
29000
+ if (constructor === RegExp)
29001
+ return a3.source === b3.source && a3.flags === b3.flags;
29002
+ if (constructor === Set) {
29003
+ if (a3.size !== b3.size)
28996
29004
  return !1;
28997
- for (let i2 = length; i2-- !== 0; )
28998
- if (!isEqual(a2[i2], b2[i2]))
29005
+ for (const value of a3)
29006
+ if (!b3.has(value))
28999
29007
  return !1;
29000
29008
  return !0;
29001
29009
  }
29002
- if (a2 instanceof RegExp)
29003
- return a2.source === b2.source && a2.flags === b2.flags;
29004
- if (a2 instanceof Date)
29005
- return a2.getTime() === b2.getTime();
29006
- if (a2 instanceof Map && b2 instanceof Map) {
29007
- if (a2.size !== b2.size)
29010
+ if (constructor === ArrayBuffer && (a3 = new DataView(a3), b3 = new DataView(b3)), constructor === DataView || ArrayBuffer.isView(a3)) {
29011
+ if (constructor !== DataView && (a3 = new DataView(a3.buffer), b3 = new DataView(b3.buffer)), a3.byteLength !== b3.byteLength)
29008
29012
  return !1;
29009
- for (const entry of a2)
29010
- if (!b2.has(entry[0]) || !isEqual(entry[1], b2.get(entry[0])))
29013
+ for (let i2 = a3.byteLength; i2-- !== 0; )
29014
+ if (a3.getUint8(i2) !== b3.getUint8(i2))
29011
29015
  return !1;
29012
29016
  return !0;
29013
29017
  }
29014
- if (a2 instanceof Set && b2 instanceof Set) {
29015
- if (a2.size !== b2.size)
29016
- return !1;
29017
- for (const value of a2)
29018
- if (!b2.has(value))
29019
- return !1;
29018
+ if (visited.has(a3) && visited.get(a3) === b3)
29020
29019
  return !0;
29021
- }
29022
- if (a2 instanceof DataView && b2 instanceof DataView) {
29023
- const { byteLength } = a2;
29024
- if (byteLength !== b2.byteLength)
29020
+ if (visited.set(a3, b3), constructor === Array) {
29021
+ if (a3.length !== b3.length)
29025
29022
  return !1;
29026
- for (let i2 = byteLength; i2-- !== 0; )
29027
- if (a2.getUint8(i2) !== b2.getUint8(i2))
29023
+ for (let i2 = a3.length; i2-- !== 0; )
29024
+ if (!inner2(a3[i2], b3[i2]))
29028
29025
  return !1;
29029
29026
  return !0;
29030
29027
  }
29031
- if (a2 instanceof ArrayBuffer && b2 instanceof ArrayBuffer && (a2 = new Uint8Array(a2), b2 = new Uint8Array(b2)), ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
29032
- const { length } = a2;
29033
- if (length !== b2.length)
29028
+ if (constructor === Map) {
29029
+ if (a3.size !== b3.size)
29034
29030
  return !1;
29035
- for (let i2 = length; i2-- !== 0; )
29036
- if (a2[i2] !== b2[i2])
29031
+ for (const entry of a3)
29032
+ if (!b3.has(entry[0]) || !inner2(entry[1], b3.get(entry[0])))
29037
29033
  return !1;
29038
29034
  return !0;
29039
29035
  }
29040
- if (a2.valueOf !== valueOf && typeof a2.valueOf == "function" && typeof b2.valueOf == "function")
29041
- return a2.valueOf() === b2.valueOf();
29042
- if (a2.toString !== toString$1 && typeof a2.toString == "function" && typeof b2.toString == "function")
29043
- return a2.toString() === b2.toString();
29044
- const aKeys = Object.keys(a2);
29036
+ if (a3.valueOf !== valueOf && typeof a3.valueOf == "function" && typeof b3.valueOf == "function")
29037
+ return a3.valueOf() === b3.valueOf();
29038
+ if (a3.toString !== toString$1 && typeof a3.toString == "function" && typeof b3.toString == "function")
29039
+ return a3.toString() === b3.toString();
29040
+ const aKeys = Object.keys(a3);
29045
29041
  let key2;
29046
29042
  for (let l2 = aKeys.length; l2-- !== 0; )
29047
- if (key2 = aKeys[l2], !((key2 === "_owner" || key2 === "__v" || key2 === "__o") && Object.hasOwn(a2, "$$typeof")) && (!Object.hasOwn(b2, key2) || !isEqual(a2[key2], b2[key2])))
29043
+ if (key2 = aKeys[l2], !Object.hasOwn(b3, key2) || !inner2(a3[key2], b3[key2]))
29048
29044
  return !1;
29049
- return Object.keys(b2).length === aKeys.length;
29050
- }
29051
- return a2 !== a2 && b2 !== b2;
29045
+ return Object.keys(b3).length === aKeys.length;
29046
+ };
29047
+ return inner2(a2, b2);
29052
29048
  };
29053
29049
  function useDeepCompareEffect(callback, deps, effectHook = useEffect, ...effectHookRestArgs) {
29054
29050
  useCustomCompareEffect(callback, deps, isEqual, effectHook, ...effectHookRestArgs);
@@ -29622,12 +29618,7 @@ let epoch = 0, atom = (initialValue) => {
29622
29618
  epoch++;
29623
29619
  let runListenerQueue = !listenerQueue.length;
29624
29620
  for (let listener of listeners)
29625
- listenerQueue.push(
29626
- listener,
29627
- $atom.value,
29628
- oldValue,
29629
- changedKey
29630
- );
29621
+ listenerQueue.push(listener, $atom.value, oldValue, changedKey);
29631
29622
  if (runListenerQueue) {
29632
29623
  for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER)
29633
29624
  listenerQueue[lqIndex](
@@ -29747,10 +29738,6 @@ function RootContainer({
29747
29738
  Box,
29748
29739
  {
29749
29740
  className: cx("likec4-root", className),
29750
- css: {
29751
- // '--likec4-background-color': 'mantine.colors.body',
29752
- // '--colors-likec4-background': 'var(--mantine-color-body)',
29753
- },
29754
29741
  ref,
29755
29742
  ...reduceGraphics && {
29756
29743
  "data-likec4-reduced-graphics": !0
@@ -29822,165 +29809,6 @@ const useXYStoreApi = useStoreApi, useXYInternalNode = useInternalNode, selectZo
29822
29809
  function useIsZoomTooSmall() {
29823
29810
  return useStore$1(selectZoom);
29824
29811
  }
29825
- var ConnectionMode;
29826
- (function(ConnectionMode2) {
29827
- ConnectionMode2.Strict = "strict", ConnectionMode2.Loose = "loose";
29828
- })(ConnectionMode || (ConnectionMode = {}));
29829
- var PanOnScrollMode;
29830
- (function(PanOnScrollMode2) {
29831
- PanOnScrollMode2.Free = "free", PanOnScrollMode2.Vertical = "vertical", PanOnScrollMode2.Horizontal = "horizontal";
29832
- })(PanOnScrollMode || (PanOnScrollMode = {}));
29833
- var SelectionMode;
29834
- (function(SelectionMode2) {
29835
- SelectionMode2.Partial = "partial", SelectionMode2.Full = "full";
29836
- })(SelectionMode || (SelectionMode = {}));
29837
- var ConnectionLineType;
29838
- (function(ConnectionLineType2) {
29839
- ConnectionLineType2.Bezier = "default", ConnectionLineType2.Straight = "straight", ConnectionLineType2.Step = "step", ConnectionLineType2.SmoothStep = "smoothstep", ConnectionLineType2.SimpleBezier = "simplebezier";
29840
- })(ConnectionLineType || (ConnectionLineType = {}));
29841
- var MarkerType;
29842
- (function(MarkerType2) {
29843
- MarkerType2.Arrow = "arrow", MarkerType2.ArrowClosed = "arrowclosed";
29844
- })(MarkerType || (MarkerType = {}));
29845
- var Position;
29846
- (function(Position2) {
29847
- Position2.Left = "left", Position2.Top = "top", Position2.Right = "right", Position2.Bottom = "bottom";
29848
- })(Position || (Position = {}));
29849
- Position.Left + "", Position.Right, Position.Right + "", Position.Left, Position.Top + "", Position.Bottom, Position.Bottom + "", Position.Top;
29850
- const isInternalNodeBase = (element) => "id" in element && "internals" in element && !("source" in element) && !("target" in element), getNodePositionWithOrigin = (node2, nodeOrigin = [0, 0]) => {
29851
- const { width, height } = getNodeDimensions(node2), origin = node2.origin ?? nodeOrigin, offsetX = width * origin[0], offsetY = height * origin[1];
29852
- return {
29853
- x: node2.position.x - offsetX,
29854
- y: node2.position.y - offsetY
29855
- };
29856
- }, clamp = (val, min2 = 0, max2 = 1) => Math.min(Math.max(val, min2), max2), getBoundsOfBoxes = (box1, box2) => ({
29857
- x: Math.min(box1.x, box2.x),
29858
- y: Math.min(box1.y, box2.y),
29859
- x2: Math.max(box1.x2, box2.x2),
29860
- y2: Math.max(box1.y2, box2.y2)
29861
- }), rectToBox = ({ x: x2, y: y2, width, height }) => ({
29862
- x: x2,
29863
- y: y2,
29864
- x2: x2 + width,
29865
- y2: y2 + height
29866
- }), boxToRect = ({ x: x2, y: y2, x2: x22, y2: y22 }) => ({
29867
- x: x2,
29868
- y: y2,
29869
- width: x22 - x2,
29870
- height: y22 - y2
29871
- }), nodeToRect = (node2, nodeOrigin = [0, 0]) => {
29872
- const { x: x2, y: y2 } = isInternalNodeBase(node2) ? node2.internals.positionAbsolute : getNodePositionWithOrigin(node2, nodeOrigin);
29873
- return {
29874
- x: x2,
29875
- y: y2,
29876
- width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
29877
- height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
29878
- };
29879
- }, getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2))), rendererPointToPoint = ({ x: x2, y: y2 }, [tx, ty, tScale]) => ({
29880
- x: x2 * tScale + tx,
29881
- y: y2 * tScale + ty
29882
- });
29883
- function parsePadding(padding, viewport) {
29884
- return Math.floor(viewport - viewport / (1 + padding));
29885
- }
29886
- function parsePaddings(padding, width, height) {
29887
- {
29888
- const paddingY = parsePadding(padding, height), paddingX = parsePadding(padding, width);
29889
- return {
29890
- top: paddingY,
29891
- right: paddingX,
29892
- bottom: paddingY,
29893
- left: paddingX,
29894
- x: paddingX * 2,
29895
- y: paddingY * 2
29896
- };
29897
- }
29898
- }
29899
- function calculateAppliedPaddings(bounds, x2, y2, zoom2, width, height) {
29900
- const { x: left, y: top } = rendererPointToPoint(bounds, [x2, y2, zoom2]), { x: boundRight, y: boundBottom } = rendererPointToPoint({ x: bounds.x + bounds.width, y: bounds.y + bounds.height }, [x2, y2, zoom2]), right = width - boundRight, bottom = height - boundBottom;
29901
- return {
29902
- left: Math.floor(left),
29903
- top: Math.floor(top),
29904
- right: Math.floor(right),
29905
- bottom: Math.floor(bottom)
29906
- };
29907
- }
29908
- const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding) => {
29909
- const p2 = parsePaddings(padding, width, height), xZoom = (width - p2.x) / bounds.width, yZoom = (height - p2.y) / bounds.height, zoom2 = Math.min(xZoom, yZoom), clampedZoom = clamp(zoom2, minZoom, maxZoom), boundsCenterX = bounds.x + bounds.width / 2, boundsCenterY = bounds.y + bounds.height / 2, x2 = width / 2 - boundsCenterX * clampedZoom, y2 = height / 2 - boundsCenterY * clampedZoom, newPadding = calculateAppliedPaddings(bounds, x2, y2, clampedZoom, width, height), offset2 = {
29910
- left: Math.min(newPadding.left - p2.left, 0),
29911
- top: Math.min(newPadding.top - p2.top, 0),
29912
- right: Math.min(newPadding.right - p2.right, 0),
29913
- bottom: Math.min(newPadding.bottom - p2.bottom, 0)
29914
- };
29915
- return {
29916
- x: x2 - offset2.left + offset2.right,
29917
- y: y2 - offset2.top + offset2.bottom,
29918
- zoom: clampedZoom
29919
- };
29920
- }, isMacOs = () => typeof navigator < "u" && navigator?.userAgent?.indexOf("Mac") >= 0;
29921
- function getNodeDimensions(node2) {
29922
- return {
29923
- width: node2.measured?.width ?? node2.width ?? node2.initialWidth ?? 0,
29924
- height: node2.measured?.height ?? node2.height ?? node2.initialHeight ?? 0
29925
- };
29926
- }
29927
- function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY }) {
29928
- const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125, centerY2 = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125, offsetX = Math.abs(centerX - sourceX), offsetY = Math.abs(centerY2 - sourceY);
29929
- return [centerX, centerY2, offsetX, offsetY];
29930
- }
29931
- function calculateControlOffset(distance2, curvature) {
29932
- return distance2 >= 0 ? 0.5 * distance2 : curvature * 25 * Math.sqrt(-distance2);
29933
- }
29934
- function getControlWithCurvature({ pos, x1, y1, x2, y2, c: c2 }) {
29935
- switch (pos) {
29936
- case Position.Left:
29937
- return [x1 - calculateControlOffset(x1 - x2, c2), y1];
29938
- case Position.Right:
29939
- return [x1 + calculateControlOffset(x2 - x1, c2), y1];
29940
- case Position.Top:
29941
- return [x1, y1 - calculateControlOffset(y1 - y2, c2)];
29942
- case Position.Bottom:
29943
- return [x1, y1 + calculateControlOffset(y2 - y1, c2)];
29944
- }
29945
- }
29946
- function getBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25 }) {
29947
- const [sourceControlX, sourceControlY] = getControlWithCurvature({
29948
- pos: sourcePosition,
29949
- x1: sourceX,
29950
- y1: sourceY,
29951
- x2: targetX,
29952
- y2: targetY,
29953
- c: curvature
29954
- }), [targetControlX, targetControlY] = getControlWithCurvature({
29955
- pos: targetPosition,
29956
- x1: targetX,
29957
- y1: targetY,
29958
- x2: sourceX,
29959
- y2: sourceY,
29960
- c: curvature
29961
- }), [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({
29962
- sourceX,
29963
- sourceY,
29964
- targetX,
29965
- targetY,
29966
- sourceControlX,
29967
- sourceControlY,
29968
- targetControlX,
29969
- targetControlY
29970
- });
29971
- return [
29972
- `M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`,
29973
- labelX,
29974
- labelY,
29975
- offsetX,
29976
- offsetY
29977
- ];
29978
- }
29979
- Position.Left + "", Position.Right + "", Position.Top + "", Position.Bottom + "";
29980
- var ResizeControlVariant;
29981
- (function(ResizeControlVariant2) {
29982
- ResizeControlVariant2.Line = "line", ResizeControlVariant2.Handle = "handle";
29983
- })(ResizeControlVariant || (ResizeControlVariant = {}));
29984
29812
  const { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
29985
29813
  function crt(v) {
29986
29814
  return v < 0 ? -pow(-v, 1 / 3) : pow(v, 1 / 3);
@@ -31108,8 +30936,8 @@ const cssTransparentBg = css({
31108
30936
  edgesFocusable: !1,
31109
30937
  nodesDraggable,
31110
30938
  nodeDragThreshold: 4,
31111
- nodeClickDistance: 1.9,
31112
- paneClickDistance: 1.9,
30939
+ nodeClickDistance: 3,
30940
+ paneClickDistance: 3,
31113
30941
  elevateNodesOnSelect: !1,
31114
30942
  selectNodesOnDrag: !1,
31115
30943
  onNodesChange,
@@ -31164,15 +30992,7 @@ const cssTransparentBg = css({
31164
30992
  const square = useStore$1(selectDimensions);
31165
30993
  return useUpdateEffect(onViewportResize, [square]), null;
31166
30994
  };
31167
- var xstateReact_cjs = {}, useIsomorphicLayoutEffect_cjs = {}, hasRequiredUseIsomorphicLayoutEffect_cjs;
31168
- function requireUseIsomorphicLayoutEffect_cjs() {
31169
- return hasRequiredUseIsomorphicLayoutEffect_cjs || (hasRequiredUseIsomorphicLayoutEffect_cjs = 1, function(exports) {
31170
- Object.defineProperty(exports, "__esModule", { value: !0 });
31171
- var react = React__default, isClient = typeof document < "u", index2 = isClient ? react.useLayoutEffect : react.useEffect;
31172
- exports.default = index2;
31173
- }(useIsomorphicLayoutEffect_cjs)), useIsomorphicLayoutEffect_cjs;
31174
- }
31175
- var xstate_cjs = {}, xstateActors_cjs = {}, raise60cebf03_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
30995
+ var xstateReact_cjs = {}, xstate_cjs = {}, xstateActors_cjs = {}, raise60cebf03_cjs = {}, xstateDev_cjs = {}, hasRequiredXstateDev_cjs;
31176
30996
  function requireXstateDev_cjs() {
31177
30997
  if (hasRequiredXstateDev_cjs) return xstateDev_cjs;
31178
30998
  hasRequiredXstateDev_cjs = 1, Object.defineProperty(xstateDev_cjs, "__esModule", { value: !0 });
@@ -34147,7 +33967,7 @@ function focusedBounds(params) {
34147
33967
  }
34148
33968
  const DiagramActorSafeContext = createContext(null);
34149
33969
  DiagramActorSafeContext.displayName = "DiagramActorSafeContext";
34150
- const useDiagramActorRef = () => {
33970
+ const DiagramActorContextProvider = DiagramActorSafeContext.Provider, useDiagramActorRef = () => {
34151
33971
  const ctx = useContext(DiagramActorSafeContext);
34152
33972
  if (ctx === null)
34153
33973
  throw new Error("DiagramActorRef is not provided");
@@ -34702,7 +34522,7 @@ const curveCatmullRomOpen = function custom4(alpha2) {
34702
34522
  return splitProps(props, actionBtnVariantKeys);
34703
34523
  },
34704
34524
  getVariantProps: actionBtnFn.getVariantProps
34705
- }), compoundActionBtn = cva({
34525
+ }), MotionButton = /* @__PURE__ */ createMinimalMotionComponent("button"), MotionDiv = /* @__PURE__ */ createMinimalMotionComponent("div"), compoundActionBtn = cva({
34706
34526
  base: {
34707
34527
  transitionDuration: "normal",
34708
34528
  "[data-compound-title-inverse] &": {
@@ -34753,7 +34573,7 @@ function CompoundActionButton({
34753
34573
  "compound-action"
34754
34574
  ),
34755
34575
  children: /* @__PURE__ */ jsx(
34756
- m$2.div,
34576
+ MotionDiv,
34757
34577
  {
34758
34578
  initial: !1,
34759
34579
  animate: {
@@ -34811,7 +34631,7 @@ function CompoundDetailsButton({
34811
34631
  ),
34812
34632
  onClick: stopPropagation$1,
34813
34633
  children: /* @__PURE__ */ jsx(
34814
- m$2.div,
34634
+ MotionDiv,
34815
34635
  {
34816
34636
  initial: !1,
34817
34637
  animate: {
@@ -35137,7 +34957,7 @@ function CompoundTitle({ id: id2, data }) {
35137
34957
  }
35138
34958
  );
35139
34959
  }
35140
- const isSame = (a2, b2) => Math.abs(a2 - b2) < 2.5, edgePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? !1, next.selected ?? !1) && deepEqual(prev.source, next.source) && deepEqual(prev.sourceHandleId ?? null, next.sourceHandleId ?? null) && deepEqual(prev.sourcePosition, next.sourcePosition) && deepEqual(prev.target, next.target) && deepEqual(prev.targetHandleId ?? null, next.targetHandleId ?? null) && deepEqual(prev.targetPosition, next.targetPosition) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.data, next.data);
34960
+ const isSame = (a2, b2) => Math.abs(a2 - b2) < 2.5, edgePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? !1, next.selected ?? !1) && deepEqual(prev.animated ?? !1, next.animated ?? !1) && deepEqual(prev.source, next.source) && deepEqual(prev.sourceHandleId ?? null, next.sourceHandleId ?? null) && deepEqual(prev.sourcePosition, next.sourcePosition) && deepEqual(prev.target, next.target) && deepEqual(prev.targetHandleId ?? null, next.targetHandleId ?? null) && deepEqual(prev.targetPosition, next.targetPosition) && isSame(prev.sourceX, next.sourceX) && isSame(prev.sourceY, next.sourceY) && isSame(prev.targetX, next.targetX) && isSame(prev.targetY, next.targetY) && deepEqual(prev.data, next.data);
35141
34961
  function customEdge(Edge) {
35142
34962
  return memo$2(Edge, edgePropsEqual);
35143
34963
  }
@@ -35197,7 +35017,7 @@ const isSelected$1 = ".react-flow__edge.selected", edgeStroke = "--xy-edge-strok
35197
35017
  fill: "[var(--xy-edge-stroke)]",
35198
35018
  stroke: "[var(--xy-edge-stroke)]"
35199
35019
  }), cssEdgePath = css({
35200
- fill: "[none]",
35020
+ fill: "[none!]",
35201
35021
  strokeDashoffset: 10,
35202
35022
  _noReduceGraphics: {
35203
35023
  transition: "stroke 130ms ease-out,stroke-width 130ms ease-out"
@@ -35413,6 +35233,9 @@ const translate = {
35413
35233
  padding: "0px"
35414
35234
  },
35415
35235
  labelContents: {
35236
+ display: "flex",
35237
+ flexDirection: "column",
35238
+ alignItems: "center",
35416
35239
  padding: "2px 5px 4px 0px"
35417
35240
  },
35418
35241
  labelText: {
@@ -35441,9 +35264,9 @@ function EdgeLabel({
35441
35264
  const stepNum = isStepEdgeId(id2) ? extractStep(id2) : null, classes2 = labelsva({
35442
35265
  isStepEdge: stepNum !== null
35443
35266
  });
35444
- return /* @__PURE__ */ jsxs(Box$1, { className: cx(classes2.root, className), ...rest, children: [
35445
- stepNum !== null && /* @__PURE__ */ jsx(Box$1, { className: classes2.stepNumber, children: stepNum }),
35446
- /* @__PURE__ */ jsxs(Box$1, { className: classes2.labelContents, children: [
35267
+ return /* @__PURE__ */ jsxs(Box, { className: cx(classes2.root, className), ...rest, children: [
35268
+ stepNum !== null && /* @__PURE__ */ jsx(Box, { className: classes2.stepNumber, children: stepNum }),
35269
+ /* @__PURE__ */ jsxs(Box, { className: classes2.labelContents, children: [
35447
35270
  n$5(label2) && /* @__PURE__ */ jsx(Text, { component: "div", className: classes2.labelText, lineClamp: 5, children: label2 }),
35448
35271
  n$5(technology2) && /* @__PURE__ */ jsx(Text, { component: "div", className: classes2.labelTechnology, children: "[ " + technology2 + " ]" }),
35449
35272
  children2
@@ -35732,18 +35555,20 @@ function arrowTypeToMarker(arrowType) {
35732
35555
  }
35733
35556
  }
35734
35557
  const EdgePath = forwardRef(({
35735
- id: id2,
35736
- data: {
35737
- line,
35738
- dir,
35739
- tail,
35740
- head
35558
+ edgeProps: {
35559
+ id: id2,
35560
+ data: {
35561
+ line,
35562
+ dir,
35563
+ tail,
35564
+ head
35565
+ },
35566
+ style: style2,
35567
+ interactionWidth
35741
35568
  },
35569
+ onEdgePointerDown,
35742
35570
  strokeWidth,
35743
- svgPath,
35744
- style: style2,
35745
- interactionWidth,
35746
- onEdgePointerDown
35571
+ svgPath
35747
35572
  }, svgPathRef) => {
35748
35573
  let markerStartName = arrowTypeToMarker(tail), markerEndName = arrowTypeToMarker(head ?? "normal");
35749
35574
  dir === "back" && ([markerStartName, markerEndName] = [markerEndName, markerStartName]);
@@ -35753,10 +35578,15 @@ const EdgePath = forwardRef(({
35753
35578
  /* @__PURE__ */ jsx(
35754
35579
  "path",
35755
35580
  {
35756
- className: cx("react-flow__edge-interaction", hideOnReducedGraphics),
35581
+ className: cx(
35582
+ "react-flow__edge-interaction",
35583
+ hideOnReducedGraphics,
35584
+ css({
35585
+ fill: "[none]",
35586
+ strokeOpacity: 0
35587
+ })
35588
+ ),
35757
35589
  d: svgPath,
35758
- fill: "none",
35759
- stroke: "transparent",
35760
35590
  strokeWidth: interactionWidth ?? 10
35761
35591
  }
35762
35592
  ),
@@ -35824,7 +35654,7 @@ function ElementActionButtons({
35824
35654
  return !buttons2.length || zoomTooSmall ? null : /* @__PURE__ */ jsx(Box$1, { className: container$4, children: /* @__PURE__ */ jsx(
35825
35655
  Box$1,
35826
35656
  {
35827
- component: m$2.div,
35657
+ component: MotionDiv,
35828
35658
  layoutRoot: !0,
35829
35659
  initial: !1,
35830
35660
  style: {
@@ -35841,8 +35671,7 @@ function ElementActionButtons({
35841
35671
  children: buttons2.map((button2, index2) => /* @__PURE__ */ jsx(
35842
35672
  ActionIcon$1,
35843
35673
  {
35844
- component: m$2.button,
35845
- layout: !0,
35674
+ component: MotionButton,
35846
35675
  className: actionBtn$1({}),
35847
35676
  initial: !1,
35848
35677
  whileTap: { scale: 1 },
@@ -35893,8 +35722,7 @@ function ElementDetailsButton({
35893
35722
  ActionIcon$1,
35894
35723
  {
35895
35724
  className: cx("nodrag nopan", actionBtn$1({ variant: "transparent" })),
35896
- component: m$2.button,
35897
- layout: !0,
35725
+ component: MotionButton,
35898
35726
  initial: !1,
35899
35727
  style: {
35900
35728
  originX: 0.45,
@@ -36008,7 +35836,7 @@ const ElementNodeContainer = forwardRef(({
36008
35836
  return /* @__PURE__ */ jsx(
36009
35837
  Box$1,
36010
35838
  {
36011
- component: m$2.div,
35839
+ component: MotionDiv,
36012
35840
  ref,
36013
35841
  className: cx(
36014
35842
  css({
@@ -36559,8 +36387,8 @@ const style = {
36559
36387
  left: "50%",
36560
36388
  visibility: "hidden"
36561
36389
  }, DefaultHandles = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [
36562
- /* @__PURE__ */ jsx(Handle, { type: "target", position: Position$1.Top, style }),
36563
- /* @__PURE__ */ jsx(Handle, { type: "source", position: Position$1.Bottom, style })
36390
+ /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style }),
36391
+ /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, style })
36564
36392
  ] });
36565
36393
  class VectorImpl {
36566
36394
  constructor(x2, y2) {
@@ -36918,7 +36746,7 @@ const stopPropagation = (e2) => e2.stopPropagation(), Tooltip$4 = Tooltip$5.with
36918
36746
  diagramEdge.relations,
36919
36747
  m((id2) => {
36920
36748
  try {
36921
- return likec4model.relationship(id2);
36749
+ return likec4model.findRelationship(id2);
36922
36750
  } catch (e2) {
36923
36751
  return console.error(
36924
36752
  `View is cached and likec4model missing relationship ${id2} from ${sourceNode.id} -> ${targetNode.id}`,
@@ -37241,7 +37069,7 @@ const curve = d3line().curve(curveCatmullRomOpen).x((d2) => d2.x).y((d2) => d2.y
37241
37069
  /* @__PURE__ */ jsx(
37242
37070
  EdgePath,
37243
37071
  {
37244
- ...props,
37072
+ edgeProps: props,
37245
37073
  svgPath: edgePath,
37246
37074
  ref: svgPathRef,
37247
37075
  ...enableEdgeEditing && {
@@ -37287,7 +37115,7 @@ const curve = d3line().curve(curveCatmullRomOpen).x((d2) => d2.x).y((d2) => d2.y
37287
37115
  cy: Math.round(p2.y),
37288
37116
  r: 3
37289
37117
  },
37290
- i2
37118
+ "controlPoints" + edgeId + "#" + i2
37291
37119
  ))
37292
37120
  }
37293
37121
  )
@@ -38402,10 +38230,13 @@ const useElementDetailsActorRef = () => {
38402
38230
  )
38403
38231
  ] })
38404
38232
  ] });
38233
+ }, setHoveredNode$3 = () => {
38405
38234
  }, TabPanelDeployments = memo$2(({ elementFqn }) => {
38406
38235
  const element = useLikeC4Model$1(!0).element(elementFqn), deployments = [...element.deployments()], tree = useTree({
38407
38236
  multiple: !1
38408
- }), data = useMemo(() => {
38237
+ });
38238
+ tree.setHoveredNode = setHoveredNode$3;
38239
+ const data = useMemo(() => {
38409
38240
  let roots = [], treeItems = /* @__PURE__ */ new Map();
38410
38241
  for (const instance of element.deployments()) {
38411
38242
  let instanceNode = {
@@ -38486,7 +38317,7 @@ const useElementDetailsActorRef = () => {
38486
38317
  }
38487
38318
  )
38488
38319
  );
38489
- }), ViewPadding = 0.1, RelationshipsBrowserActorContext = createContext(null);
38320
+ }), RelationshipsBrowserActorContext = createContext(null);
38490
38321
  function useRelationshipsBrowserActor() {
38491
38322
  return nonNullable(useContext(RelationshipsBrowserActorContext), "No RelationshipsBrowserActorContext");
38492
38323
  }
@@ -38580,13 +38411,12 @@ const RelationshipEdge$1 = customEdge((props) => {
38580
38411
  /* @__PURE__ */ jsx(
38581
38412
  EdgePath,
38582
38413
  {
38583
- ...edgeProps,
38414
+ edgeProps,
38584
38415
  svgPath,
38585
38416
  ...markOrange && {
38586
38417
  strokeWidth: 5
38587
38418
  }
38588
- },
38589
- id2
38419
+ }
38590
38420
  ),
38591
38421
  /* @__PURE__ */ jsx(
38592
38422
  EdgeLabelContainer,
@@ -38603,7 +38433,7 @@ const RelationshipEdge$1 = customEdge((props) => {
38603
38433
  children: label2
38604
38434
  }
38605
38435
  )
38606
- ] }, id2);
38436
+ ] });
38607
38437
  }), selectViewId = (s2) => s2.context.view.id;
38608
38438
  function useCurrentViewId() {
38609
38439
  const actorRef = useDiagramActorRef();
@@ -38667,7 +38497,7 @@ const ElementDetailsButtonWithHandler$1 = (props) => {
38667
38497
  }
38668
38498
  }
38669
38499
  );
38670
- }, ElementNode$1 = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { component: m$2.div, layoutId: props.id, nodeProps: props, children: [
38500
+ }, ElementNode$1 = customNode((props) => /* @__PURE__ */ jsxs(ElementNodeContainer, { component: MotionDiv, layoutId: props.id, nodeProps: props, children: [
38671
38501
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
38672
38502
  /* @__PURE__ */ jsx(ElementTitle, { ...props }),
38673
38503
  /* @__PURE__ */ jsx(ElementDetailsButtonWithHandler$1, { ...props }),
@@ -41432,6 +41262,7 @@ const node = css({
41432
41262
  enableSelectSubject: state.context.enableSelectSubject,
41433
41263
  enableChangeScope: state.context.enableChangeScope
41434
41264
  };
41265
+ }, setHoveredNode$2 = () => {
41435
41266
  }, SelectElement = memo$2(() => {
41436
41267
  const browser = useRelationshipsBrowser(), {
41437
41268
  subjectId,
@@ -41443,7 +41274,7 @@ const node = css({
41443
41274
  } = useRelationshipsBrowserState(selector2$1), root2 = useRef(null), viewport = useRef(null), subject = useLikeC4Model$1(!0).findElement(subjectId), data = useLikeC4ElementsTree(scope === "view" && viewId ? viewId : void 0), tree = useTree({
41444
41275
  multiple: !1
41445
41276
  });
41446
- return useEffect(() => {
41277
+ return tree.setHoveredNode = setHoveredNode$2, useEffect(() => {
41447
41278
  ancestorsFqn(subjectId).reverse().forEach((id2) => {
41448
41279
  tree.expand(id2);
41449
41280
  }), tree.select(subjectId);
@@ -41651,7 +41482,6 @@ const selector$4 = (state) => ({
41651
41482
  nodeTypes: nodeTypes$1,
41652
41483
  edgeTypes: edgeTypes$1,
41653
41484
  fitView: !1,
41654
- fitViewPadding: ViewPadding,
41655
41485
  onNodeClick: useCallbackRef((e2, node2) => {
41656
41486
  browser.send({ type: "xyflow.nodeClick", node: node2 });
41657
41487
  }),
@@ -42033,13 +41863,16 @@ const treeNodeLabel = css({
42033
41863
  }
42034
41864
  }), ElementLabel = ({
42035
41865
  element
42036
- }) => /* @__PURE__ */ jsx(Box$1, { className: elementLabel, children: /* @__PURE__ */ jsx(Text, { component: "div", fz: "sm", fw: "500", children: element.title }) });
41866
+ }) => /* @__PURE__ */ jsx(Box$1, { className: elementLabel, children: /* @__PURE__ */ jsx(Text, { component: "div", fz: "sm", fw: "500", children: element.title }) }), setHoveredNode$1 = () => {
41867
+ };
42037
41868
  function TabPanelStructure({
42038
41869
  element
42039
41870
  }) {
42040
41871
  const tree = useTree({
42041
41872
  multiple: !1
42042
- }), data = useMemo(() => {
41873
+ });
41874
+ tree.setHoveredNode = setHoveredNode$1;
41875
+ const data = useMemo(() => {
42043
41876
  let seq = 1;
42044
41877
  const messageNode = (label2) => ({
42045
41878
  label: label2,
@@ -42509,7 +42342,7 @@ function ElementDetails({
42509
42342
  })),
42510
42343
  shallowEqual
42511
42344
  );
42512
- return /* @__PURE__ */ jsx(ElementDetailsActorContext, { value: actorRef, children: /* @__PURE__ */ jsx(
42345
+ return /* @__PURE__ */ jsx(ElementDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(
42513
42346
  ElementDetailsCard,
42514
42347
  {
42515
42348
  onClose,
@@ -42605,7 +42438,7 @@ const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_leve
42605
42438
  );
42606
42439
  useEffect(() => {
42607
42440
  const cancel = (e2) => {
42608
- e2.preventDefault(), close();
42441
+ e2.preventDefault(), e2.stopPropagation(), close();
42609
42442
  };
42610
42443
  return dialogRef.current?.addEventListener("cancel", cancel, { capture: !0 }), () => {
42611
42444
  dialogRef.current?.removeEventListener("cancel", cancel, { capture: !0 });
@@ -42677,7 +42510,11 @@ var xstate_cjsExports = /* @__PURE__ */ requireXstate_cjs();
42677
42510
  function _update$1(current, update) {
42678
42511
  return update.map((next) => {
42679
42512
  const existing = current.find((n2) => n2.id === next.id);
42680
- return existing && existing.type === next.type && deepEqual(existing.hidden ?? !1, next.hidden ?? !1) && deepEqual(existing.source, next.source) && deepEqual(existing.sourceHandle ?? null, next.sourceHandle ?? null) && deepEqual(existing.target, next.target) && deepEqual(existing.targetHandle ?? null, next.targetHandle ?? null) && deepEqual(existing.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(existing.data, next.data) ? existing : next;
42513
+ return existing && deepEqual(existing.type, next.type) ? deepEqual(existing.hidden ?? !1, next.hidden ?? !1) && deepEqual(existing.source, next.source) && deepEqual(existing.sourceHandle ?? null, next.sourceHandle ?? null) && deepEqual(existing.target, next.target) && deepEqual(existing.targetHandle ?? null, next.targetHandle ?? null) && deepEqual(existing.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(existing.data, next.data) ? existing : {
42514
+ ...y$2(existing, ["hidden", "zIndex"]),
42515
+ ...next,
42516
+ data: next.data
42517
+ } : next;
42681
42518
  });
42682
42519
  }
42683
42520
  function updateEdges(current, update) {
@@ -42686,10 +42523,16 @@ function updateEdges(current, update) {
42686
42523
  function _update(current, updated) {
42687
42524
  return updated.map((update) => {
42688
42525
  const existing = current.find((n2) => n2.id === update.id);
42689
- if (existing) {
42526
+ if (existing && deepEqual(existing.type, update.type)) {
42690
42527
  const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
42691
- if (deepEqual(existing.type, update.type) && deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden ?? !1, update.hidden ?? !1) && deepEqual(existing.zIndex ?? 0, update.zIndex ?? 0) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data))
42692
- return existing;
42528
+ return deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.parentId ?? null, update.parentId ?? null) && deepEqual(existing.hidden ?? !1, update.hidden ?? !1) && deepEqual(existing.zIndex ?? 0, update.zIndex ?? 0) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data) ? existing : {
42529
+ ...y$2(existing, ["measured", "parentId", "hidden", "zIndex"]),
42530
+ ...update,
42531
+ // Force dimensions from update
42532
+ width: update.initialWidth,
42533
+ height: update.initialHeight,
42534
+ data: update.data
42535
+ };
42693
42536
  }
42694
42537
  return update;
42695
42538
  });
@@ -42697,6 +42540,12 @@ function _update(current, updated) {
42697
42540
  function updateNodes(current, update) {
42698
42541
  return n(update) ? _update(current, update) : (update = current, (current2) => _update(current2, update));
42699
42542
  }
42543
+ const ViewPadding = {
42544
+ top: "40px",
42545
+ bottom: "16px",
42546
+ left: "16px",
42547
+ right: "16px"
42548
+ };
42700
42549
  function viewToNodesEdge$1(view) {
42701
42550
  const xynodes = [], xyedges = [], nodeLookup = /* @__PURE__ */ new Map(), queue = Queue.from(view.nodes.reduce(
42702
42551
  (acc, node2) => (nodeLookup.set(node2.id, node2), node2.parent || acc.push({ node: node2, parent: null }), acc),
@@ -42718,7 +42567,6 @@ function viewToNodesEdge$1(view) {
42718
42567
  draggable: !1,
42719
42568
  selectable: !0,
42720
42569
  focusable: !0,
42721
- deletable: !1,
42722
42570
  position,
42723
42571
  zIndex: isCompound ? ZIndexes.Compound : ZIndexes.Element,
42724
42572
  style: {
@@ -42811,7 +42659,7 @@ function viewToNodesEdge$1(view) {
42811
42659
  zIndex: ZIndexes.Edge,
42812
42660
  // selectable: selectable,
42813
42661
  // hidden: !visiblePredicate(edge),
42814
- deletable: !1,
42662
+ // deletable: false,
42815
42663
  data: {
42816
42664
  sourceFqn: edge.sourceFqn,
42817
42665
  targetFqn: edge.targetFqn,
@@ -42861,7 +42709,7 @@ const findRootSubject = (nodes) => nodes.find(
42861
42709
  const nextSubjectCenter = {
42862
42710
  x: nextSubjectNode.position.x + (nextSubjectNode.initialWidth ?? 0) / 2,
42863
42711
  y: nextSubjectNode.position.y + (nextSubjectNode.initialHeight ?? 0) / 2
42864
- }, currentSubjectInternalNode = xyflow2.getInternalNode(currentSubjectNode.id), currentSubjectCenter = centerXYInternalNode(currentSubjectInternalNode), existingInternalNode = xyflow2.getInternalNode(existingNode.id), existingDimensions = getNodeDimensions(existingInternalNode), nested = /* @__PURE__ */ new Set();
42712
+ }, currentSubjectInternalNode = xyflow2.getInternalNode(currentSubjectNode.id), currentSubjectCenter = centerXYInternalNode(currentSubjectInternalNode), nested = /* @__PURE__ */ new Set();
42865
42713
  return currentNodes.forEach((n2) => {
42866
42714
  if (n2.id !== existingNode.id) {
42867
42715
  if (n2.data.column === "subjects") {
@@ -42879,10 +42727,10 @@ const findRootSubject = (nodes) => nodes.find(
42879
42727
  dimmed: n2.data.column === "subjects" ? "immediate" : !0
42880
42728
  }
42881
42729
  } : {
42882
- ...y$3(n2, ["parentId"]),
42730
+ ...y$2(n2, ["parentId"]),
42883
42731
  position: {
42884
- x: currentSubjectCenter.x - existingDimensions.width / 2,
42885
- y: currentSubjectCenter.y - existingDimensions.height / 2
42732
+ x: currentSubjectCenter.x - n2.initialWidth / 2,
42733
+ y: currentSubjectCenter.y - n2.initialHeight / 2
42886
42734
  },
42887
42735
  zIndex: ZIndexes.Max,
42888
42736
  hidden: !1,
@@ -42895,10 +42743,7 @@ const findRootSubject = (nodes) => nodes.find(
42895
42743
  type: "update.xydata",
42896
42744
  xynodes: currentNodes,
42897
42745
  xyedges: []
42898
- }), zoom2 = Math.min(
42899
- zoom2,
42900
- nextviewport.zoom
42901
- ), await delay$1(175), next.xynodes = next.xynodes.map(Base.setDimmed(!1)), signal.aborted || (await xyflow2.setCenter(currentSubjectCenter.x, currentSubjectCenter.y, { zoom: zoom2, duration: 350 }), await xyflow2.setCenter(nextSubjectCenter.x, nextSubjectCenter.y, { zoom: zoom2 })), updateXYData();
42746
+ }), await delay$1(120), next.xynodes = next.xynodes.map(Base.setDimmed(!1)), signal.aborted || (await xyflow2.setCenter(currentSubjectCenter.x, currentSubjectCenter.y, { zoom: zoom2, duration: 300 }), await xyflow2.setCenter(nextSubjectCenter.x, nextSubjectCenter.y, { zoom: zoom2 })), updateXYData();
42902
42747
  }), relationshipsBrowserLogic = xstate_cjsExports.setup({
42903
42748
  types: {
42904
42749
  context: {},
@@ -43148,7 +42993,7 @@ const findRootSubject = (nodes) => nodes.find(
43148
42993
  xynodes: event.output.xynodes,
43149
42994
  xyedges: event.output.xyedges,
43150
42995
  navigateFromNode: null
43151
- }), enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 50 });
42996
+ }), enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 50 });
43152
42997
  for (let i2 = 0; i2 < 6; i2++)
43153
42998
  enqueue.raise({ type: "xyflow.updateNodeInternals" }, { delay: 100 + i2 * 100 });
43154
42999
  })
@@ -43631,7 +43476,7 @@ const relationshipDetailsLogic = xstate_cjsExports.setup({
43631
43476
  invariant$2(xyflow2, "xyflow is not initialized"), invariant$2(xystore, "xystore is not initialized"), bounds ??= context2.bounds;
43632
43477
  const maxZoom = Math.max(xyflow2.getZoom(), 1);
43633
43478
  if (bounds) {
43634
- const { width, height } = xystore.getState(), viewport = getViewportForBounds$1(bounds, width, height, MinZoom, maxZoom, 0.1);
43479
+ const { width, height } = xystore.getState(), viewport = getViewportForBounds(bounds, width, height, MinZoom, maxZoom, 0.1);
43635
43480
  xyflow2.setViewport(viewport, duration > 0 ? { duration } : void 0);
43636
43481
  } else
43637
43482
  xyflow2.fitView({
@@ -44133,7 +43978,7 @@ const RelationshipEdge = customEdge((props) => {
44133
43978
  data: { navigateTo }
44134
43979
  } = props, [svgPath, labelX, labelY] = getBezierPath(props), diagram = useDiagram();
44135
43980
  return /* @__PURE__ */ jsxs(EdgeContainer, { ...props, children: [
44136
- /* @__PURE__ */ jsx(EdgePath, { ...props, svgPath }),
43981
+ /* @__PURE__ */ jsx(EdgePath, { edgeProps: props, svgPath }),
44137
43982
  /* @__PURE__ */ jsx(
44138
43983
  EdgeLabelContainer,
44139
43984
  {
@@ -44362,9 +44207,7 @@ const scrollArea$1 = css({
44362
44207
  edge,
44363
44208
  view
44364
44209
  }) => {
44365
- const browser = useRelationshipDetails(), viewport = useRef(null);
44366
- useMantinePortalProps(), useComputedColorScheme();
44367
- const edgeSource$1 = view.nodes.find((n2) => n2.id === edge.source), edgeTarget$1 = view.nodes.find((n2) => n2.id === edge.target), edges = view.edges.flatMap((edge2) => {
44210
+ const browser = useRelationshipDetails(), viewport = useRef(null), edgeSource$1 = view.nodes.find((n2) => n2.id === edge.source), edgeTarget$1 = view.nodes.find((n2) => n2.id === edge.target), edges = view.edges.flatMap((edge2) => {
44368
44211
  const source = view.nodes.find((n2) => n2.id === edge2.source), target = view.nodes.find((n2) => n2.id === edge2.target);
44369
44212
  return source && target ? {
44370
44213
  id: edge2.id,
@@ -44475,27 +44318,28 @@ function RelationshipDetails({ actorRef }) {
44475
44318
  return initialRef.current == null && (initialRef.current = {
44476
44319
  defaultNodes: [],
44477
44320
  defaultEdges: []
44478
- }), /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsxs(ReactFlowProvider, { ...initialRef.current, children: [
44479
- /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: !1, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(RelationshipDetailsInner, {}) }) }),
44480
- /* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {})
44481
- ] }) });
44321
+ }), /* @__PURE__ */ jsx(RelationshipDetailsActorContext.Provider, { value: actorRef, children: /* @__PURE__ */ jsx(ReactFlowProvider, { ...initialRef.current, children: /* @__PURE__ */ jsx(LayoutGroup, { id: actorRef.sessionId, inherit: !1, children: /* @__PURE__ */ jsxs(AnimatePresence, { children: [
44322
+ /* @__PURE__ */ jsx(RelationshipDetailsInner, {}, "xyflow"),
44323
+ /* @__PURE__ */ jsx(SyncRelationshipDetailsXYFlow, {}, "sync")
44324
+ ] }) }) }) });
44482
44325
  }
44483
44326
  const selectSubject = (state) => ({
44484
44327
  ...state.context.subject,
44485
44328
  viewId: state.context.viewId
44486
- });
44487
- function SyncRelationshipDetailsXYFlow() {
44329
+ }), SyncRelationshipDetailsXYFlow = memo$2(() => {
44488
44330
  const actor = useRelationshipDetailsActor(), subject = xstateReact_cjsExports.useSelector(actor, selectSubject, deepEqual), likec4model = useLikeC4Model$1(!0), view = likec4model.findView(subject.viewId) ?? null, data = useMemo(() => {
44489
44331
  let data2;
44490
- if ("edgeId" in subject) {
44332
+ if ("edgeId" in subject && n$5(subject.edgeId)) {
44491
44333
  invariant$2(view, `view ${subject.viewId} not found`);
44492
44334
  const edge = nonNullable(view.findEdge(subject.edgeId), `edge ${subject.edgeId} not found in ${subject.viewId}`);
44493
44335
  data2 = computeEdgeDetailsViewData([edge.id], view);
44494
- } else
44336
+ } else if (subject.source && subject.target)
44495
44337
  data2 = computeRelationshipDetailsViewData({
44496
44338
  source: likec4model.element(subject.source),
44497
44339
  target: likec4model.element(subject.target)
44498
44340
  });
44341
+ else
44342
+ return null;
44499
44343
  return layoutRelationshipDetails(data2, view);
44500
44344
  }, [
44501
44345
  subject,
@@ -44505,10 +44349,9 @@ function SyncRelationshipDetailsXYFlow() {
44505
44349
  return useEffect(() => {
44506
44350
  instance.viewportInitialized && actor.send({ type: "xyflow.init", instance, store });
44507
44351
  }, [store, instance.viewportInitialized, actor]), useEffect(() => {
44508
- actor.send({ type: "update.layoutData", data });
44352
+ data !== null && actor.send({ type: "update.layoutData", data });
44509
44353
  }, [data, actor]), null;
44510
- }
44511
- const selector$3 = ({ context: context2 }) => ({
44354
+ }), selector$3 = ({ context: context2 }) => ({
44512
44355
  // subject: context.subject,
44513
44356
  // view: state.context.view,
44514
44357
  initialized: context2.initialized.xydata && context2.initialized.xyflow,
@@ -44587,7 +44430,8 @@ const selector$3 = ({ context: context2 }) => ({
44587
44430
  const { subject, viewId } = useRelationshipDetailsState(topLeftPanelselector, deepEqual), view = useLikeC4Model$1(!0).findView(viewId);
44588
44431
  if (!view || !view.isDiagram())
44589
44432
  return null;
44590
- let edge = "edgeId" in subject ? view.findEdge(subject.edgeId) : ifind(view.edges(), (e2) => e2.source.element?.id === subject.source && e2.target.element?.id === subject.target) ?? ifind(view.edges(), (e2) => (e2.source.element?.id === subject.source || isAncestor(e2.source.element?.id ?? "--", subject.source)) && (e2.target.element?.id === subject.target || isAncestor(e2.target.element?.id ?? "", subject.target)));
44433
+ const edges = [...view.edges()];
44434
+ let edge = "edgeId" in subject && n$5(subject.edgeId) ? edges.find((e2) => e2.id === subject.edgeId) : f(edges, (e2) => e2.source.element?.id === subject.source && e2.target.element?.id === subject.target) || f(edges, (e2) => (e2.source.element?.id === subject.source || isAncestor(e2.source.element?.id ?? "--", subject.source ?? "__")) && (e2.target.element?.id === subject.target || isAncestor(e2.target.element?.id ?? "", subject.target ?? "__")));
44591
44435
  return edge ? /* @__PURE__ */ jsx(TopLeftPanelInner, { edge: edge.$edge, view: view.$view }) : null;
44592
44436
  }), TopLeftPanelInner = ({ edge, view }) => {
44593
44437
  const browser = useRelationshipDetails(), edgeId = edge.id, [historyEdgeId, historyOps, { history, current }] = useStateHistory(edge.id);
@@ -45063,17 +44907,17 @@ function useIsPickViewActive() {
45063
44907
  }
45064
44908
  function useCloseSearchAndNavigateTo() {
45065
44909
  const diagram = useDiagram(), close = useCloseSearch();
45066
- return useCallbackRef((viewId, fromElementFqn) => {
44910
+ return useCallback((viewId, fromElementFqn) => {
45067
44911
  close(() => {
45068
44912
  fromElementFqn ??= $pickView.get()?.elementFqn, setPickView(null);
45069
44913
  const fromNode = fromElementFqn ? diagram.getContext().view.nodes.find((n2) => DiagramNode.modelRef(n2) === fromElementFqn)?.id : void 0;
45070
- if (diagram.currentView.id === viewId && fromNode) {
45071
- diagram.focusNode(fromNode);
44914
+ if (diagram.currentView.id !== viewId) {
44915
+ diagram.navigateTo(viewId, fromNode);
45072
44916
  return;
45073
44917
  }
45074
- diagram.navigateTo(viewId, fromNode);
44918
+ fromNode && diagram.focusNode(fromNode);
45075
44919
  });
45076
- });
44920
+ }, [close, diagram]);
45077
44921
  }
45078
44922
  function stopAndPrevent(e2) {
45079
44923
  e2.stopPropagation(), e2.preventDefault();
@@ -45113,14 +44957,14 @@ css({
45113
44957
  opacity: 0.85
45114
44958
  }
45115
44959
  });
45116
- const NothingFound = () => /* @__PURE__ */ jsx(Box$1, { className: emptyBoX, children: "Nothing found" });
44960
+ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, children: "Nothing found" });
45117
44961
  function ViewsColumn() {
45118
44962
  const search = useNormalizedSearch();
45119
44963
  let views = [...useLikeC4Model$1(!0).views()];
45120
44964
  return search && (search.startsWith("kind:") ? views = [] : views = views.filter((view) => search.startsWith("#") ? view.tags.some((tag) => tag.toLocaleLowerCase().includes(search.slice(1))) : (view.title ?? "" + view.$view.description ?? "").toLocaleLowerCase().includes(search))), /* @__PURE__ */ jsxs(
45121
44965
  Stack,
45122
44966
  {
45123
- renderRoot: (props) => /* @__PURE__ */ jsx(m$2.div, { layout: !0, ...props }),
44967
+ renderRoot: (props) => /* @__PURE__ */ jsx(MotionDiv, { layout: !0, ...props }),
45124
44968
  gap: 8,
45125
44969
  "data-likec4-search-views": !0,
45126
44970
  onKeyDown: (e2) => {
@@ -45145,7 +44989,7 @@ function ViewsColumn() {
45145
44989
  }
45146
44990
  }
45147
44991
  ) }),
45148
- views.map((view, i2) => /* @__PURE__ */ jsx(m$2.div, { layoutId: `@view${view.id}`, children: /* @__PURE__ */ jsx(
44992
+ views.map((view, i2) => /* @__PURE__ */ jsx(MotionDiv, { layoutId: `@view${view.id}`, children: /* @__PURE__ */ jsx(
45149
44993
  ViewButton,
45150
44994
  {
45151
44995
  view,
@@ -45182,7 +45026,7 @@ function ViewButton({ className, view, loop = !1, search, ...props }) {
45182
45026
  }),
45183
45027
  children: [
45184
45028
  /* @__PURE__ */ jsx(ThemeIcon, { variant: "transparent", className: btn$2.icon, children: isDeploymentView(view) ? /* @__PURE__ */ jsx(IconStack2, { stroke: 1.8 }) : /* @__PURE__ */ jsx(IconZoomScan, { stroke: 1.8 }) }),
45185
- /* @__PURE__ */ jsxs(Box$1, { style: { flexGrow: 1 }, children: [
45029
+ /* @__PURE__ */ jsxs(Box, { style: { flexGrow: 1 }, children: [
45186
45030
  /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", align: "center", children: [
45187
45031
  /* @__PURE__ */ jsx(Highlight, { component: "div", highlight: search, className: btn$2.title, children: view.title || "untitled" }),
45188
45032
  isCurrentView && /* @__PURE__ */ jsx(Badge, { size: "xs", fz: 9, radius: "sm", children: "current" })
@@ -45204,17 +45048,12 @@ function ViewButton({ className, view, loop = !1, search, ...props }) {
45204
45048
  }
45205
45049
  const btn$1 = buttonsva();
45206
45050
  function ElementsColumn() {
45207
- const search = useNormalizedSearch(), model = useLikeC4Model$1(!0), {
45208
- all,
45209
- byid,
45210
- roots: data
45211
- } = useMemo(() => {
45051
+ const search = useNormalizedSearch(), model = useLikeC4Model$1(!0), data = useMemo(() => {
45212
45052
  const searchTerms = search.split(".");
45213
45053
  let elements;
45214
45054
  n$3(search) || search === "kind:" ? elements = model.elements() : elements = ifilter(model.elements(), (element) => search.startsWith("kind:") ? element.kind.toLocaleLowerCase().startsWith(search.slice(5)) : search.startsWith("#") ? element.tags.some((tag) => tag.toLocaleLowerCase().includes(search.slice(1))) : (element.title + " " + element.id + " " + (element.description ?? "")).toLocaleLowerCase().includes(search));
45215
- const { all: all2, roots } = C(
45216
- elements,
45217
- toArray(),
45055
+ const byid = {}, { all, roots } = C(
45056
+ [...elements],
45218
45057
  sortParentsFirst,
45219
45058
  l$4((acc, element) => {
45220
45059
  const treeItem = {
@@ -45223,7 +45062,9 @@ function ElementsColumn() {
45223
45062
  element,
45224
45063
  searchTerms,
45225
45064
  children: []
45226
- }, parent = acc.all.findLast((root2) => isAncestor(root2.value, treeItem.value));
45065
+ };
45066
+ byid[treeItem.value] = treeItem;
45067
+ const parent = acc.all.findLast((root2) => isAncestor(root2.value, treeItem.value));
45227
45068
  return parent ? (parent.children.push(treeItem), parent.children.length > 1 && parent.children.sort(sortByLabel)) : acc.roots.push(treeItem), acc.all.push(treeItem), acc;
45228
45069
  }, {
45229
45070
  all: [],
@@ -45231,64 +45072,74 @@ function ElementsColumn() {
45231
45072
  })
45232
45073
  );
45233
45074
  return {
45234
- all: all2,
45235
- byid: c(all2, p$2("value")),
45075
+ all,
45076
+ byid,
45236
45077
  roots: roots.sort(sortByLabel)
45237
45078
  };
45238
- }, [model, search]), tree = useTree({
45079
+ }, [model, search]), handleClick = useHandleElementSelection();
45080
+ return data.all.length === 0 ? /* @__PURE__ */ jsx(NothingFound, {}) : /* @__PURE__ */ jsx(ElementsTree, { data, handleClick });
45081
+ }
45082
+ const setHoveredNode = () => {
45083
+ };
45084
+ function ElementsTree({
45085
+ data: {
45086
+ all,
45087
+ byid,
45088
+ roots
45089
+ },
45090
+ handleClick
45091
+ }) {
45092
+ const tree = useTree({
45239
45093
  multiple: !1
45240
45094
  });
45241
- useEffect(() => {
45095
+ tree.setHoveredNode = setHoveredNode, useEffect(() => {
45242
45096
  tree.collapseAllNodes();
45243
45097
  for (const nd of all)
45244
45098
  nd.children.length > 0 && tree.expand(nd.value);
45245
45099
  }, [all]);
45246
- const handleClick = useHandleElementSelection();
45247
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
45248
- data.length === 0 && /* @__PURE__ */ jsx(NothingFound, {}),
45249
- /* @__PURE__ */ jsx(
45250
- Tree,
45251
- {
45252
- "data-likec4-search-elements": !0,
45253
- allowRangeSelection: !1,
45254
- clearSelectionOnOutsideClick: !0,
45255
- selectOnClick: !1,
45256
- tree,
45257
- data,
45258
- levelOffset: "lg",
45259
- classNames: {
45260
- root: treeRoot,
45261
- node: cx(focusable, treeNode),
45262
- label: treeLabel,
45263
- subtree: treeSubtree
45264
- },
45265
- onKeyDownCapture: (e2) => {
45266
- const target = e2.target, id2 = target.getAttribute("data-value"), node2 = !!id2 && byid[id2];
45267
- if (node2) {
45268
- if (e2.key === "ArrowUp") {
45269
- id2 === data[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput());
45270
- return;
45271
- }
45272
- if (e2.key === "ArrowRight") {
45273
- if (node2.children.length > 0 && tree.expandedState[id2] === !1)
45274
- return;
45275
- const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons = [...document.querySelectorAll(
45276
- `[data-likec4-search-views] .${focusable}`
45277
- )];
45278
- let view = viewButtons.length > 1 ? viewButtons.find((el, i2, all2) => centerY(el) > maxY || i2 === all2.length - 1) : null;
45279
- view ??= d(viewButtons), view && (stopAndPrevent(e2), view.focus());
45280
- return;
45281
- }
45282
- if (e2.key === " " || e2.key === "Enter") {
45283
- stopAndPrevent(e2), handleClick(node2.element);
45284
- return;
45285
- }
45286
- }
45287
- },
45288
- renderNode: ElementTreeNode
45100
+ const onKeyDownCapture = useCallbackRef((e2) => {
45101
+ const target = e2.target, id2 = target.getAttribute("data-value"), node2 = !!id2 && byid[id2];
45102
+ if (node2) {
45103
+ if (e2.key === "ArrowUp") {
45104
+ id2 === roots[0]?.value && (stopAndPrevent(e2), moveFocusToSearchInput());
45105
+ return;
45289
45106
  }
45290
- )
45291
- ] });
45107
+ if (e2.key === "ArrowRight") {
45108
+ if (node2.children.length > 0 && tree.expandedState[id2] === !1)
45109
+ return;
45110
+ const maxY = (e2.target.querySelector(".mantine-Tree-label") ?? target).getBoundingClientRect().y, viewButtons = [...document.querySelectorAll(
45111
+ `[data-likec4-search-views] .${focusable}`
45112
+ )];
45113
+ let view = viewButtons.length > 1 ? viewButtons.find((el, i2, all2) => centerY(el) > maxY || i2 === all2.length - 1) : null;
45114
+ view ??= d(viewButtons), view && (stopAndPrevent(e2), view.focus());
45115
+ return;
45116
+ }
45117
+ if (e2.key === " " || e2.key === "Enter") {
45118
+ stopAndPrevent(e2), handleClick(node2.element);
45119
+ return;
45120
+ }
45121
+ }
45122
+ });
45123
+ return /* @__PURE__ */ jsx(
45124
+ Tree,
45125
+ {
45126
+ "data-likec4-search-elements": !0,
45127
+ allowRangeSelection: !1,
45128
+ clearSelectionOnOutsideClick: !0,
45129
+ selectOnClick: !1,
45130
+ tree,
45131
+ data: roots,
45132
+ levelOffset: "lg",
45133
+ classNames: {
45134
+ root: treeRoot,
45135
+ node: cx(focusable, treeNode),
45136
+ label: treeLabel,
45137
+ subtree: treeSubtree
45138
+ },
45139
+ onKeyDownCapture,
45140
+ renderNode: ElementTreeNode
45141
+ }
45142
+ );
45292
45143
  }
45293
45144
  function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
45294
45145
  const { element, searchTerms } = node2, elementIcon$12 = IconOrShapeRenderer({
@@ -45300,7 +45151,7 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
45300
45151
  },
45301
45152
  className: cx(btn$1.icon, elementIcon)
45302
45153
  }), views = [...element.views()], handleClick = useHandleElementSelection(), key2 = `@tree.${node2.value}`;
45303
- return /* @__PURE__ */ jsxs(m$2.div, { layoutId: key2, ...elementProps, children: [
45154
+ return /* @__PURE__ */ jsxs(MotionDiv, { layoutId: key2, ...elementProps, children: [
45304
45155
  /* @__PURE__ */ jsx(
45305
45156
  ActionIcon$1,
45306
45157
  {
@@ -45327,7 +45178,7 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
45327
45178
  /* @__PURE__ */ jsxs(
45328
45179
  UnstyledButton,
45329
45180
  {
45330
- component: m$2.button,
45181
+ component: MotionButton,
45331
45182
  layout: !0,
45332
45183
  tabIndex: -1,
45333
45184
  className: clsx(btn$1.root, "group", "likec4-element-button"),
@@ -45361,11 +45212,11 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded }) {
45361
45212
  ]
45362
45213
  }
45363
45214
  )
45364
- ] }, key2);
45215
+ ] });
45365
45216
  }
45366
45217
  function useHandleElementSelection() {
45367
45218
  const navigateTo = useCloseSearchAndNavigateTo();
45368
- return useCallbackRef((element) => {
45219
+ return useCallback((element) => {
45369
45220
  const views = [...element.views()];
45370
45221
  if (views.length === 0)
45371
45222
  return;
@@ -45380,7 +45231,7 @@ function useHandleElementSelection() {
45380
45231
  scoped,
45381
45232
  others
45382
45233
  });
45383
- });
45234
+ }, [setPickView, navigateTo]);
45384
45235
  }
45385
45236
  const backdrop = css({
45386
45237
  position: "fixed",
@@ -45585,7 +45436,7 @@ function LikeC4SearchInput() {
45585
45436
  }
45586
45437
  );
45587
45438
  }
45588
- function LikeC4Search() {
45439
+ const LikeC4Search = memo$2(() => {
45589
45440
  const [searchOpened, searchOps] = useDisclosure(!1);
45590
45441
  useHotkeys([
45591
45442
  ["mod+k", () => searchOps.toggle(), {
@@ -45609,8 +45460,8 @@ function LikeC4Search() {
45609
45460
  }
45610
45461
  }
45611
45462
  ),
45612
- /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsx(RemoveScroll, { enabled: searchOpened, children: /* @__PURE__ */ jsx(AnimatePresence, { onExitComplete, children: searchOpened && /* @__PURE__ */ jsxs(Fragment$1, { children: [
45613
- /* @__PURE__ */ jsx(
45463
+ /* @__PURE__ */ jsx(Portal, { ...portalProps, reuseTargetNode: !0, children: /* @__PURE__ */ jsxs(AnimatePresence, { onExitComplete, children: [
45464
+ searchOpened && /* @__PURE__ */ jsx(
45614
45465
  m$2.div,
45615
45466
  {
45616
45467
  className: backdrop,
@@ -45618,24 +45469,25 @@ function LikeC4Search() {
45618
45469
  animate: {
45619
45470
  opacity: 1,
45620
45471
  transition: {
45621
- duration: 0.1
45472
+ duration: 0.13
45622
45473
  }
45623
45474
  },
45624
45475
  exit: {
45625
45476
  opacity: 0,
45626
45477
  transition: {
45627
- duration: 0.075
45478
+ duration: 0.13
45628
45479
  }
45629
45480
  }
45630
45481
  },
45631
45482
  "backdrop"
45632
45483
  ),
45633
- /* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
45634
- ] }) }) }) })
45484
+ searchOpened && /* @__PURE__ */ jsx(LikeC4SearchOverlay, {}, "overlay")
45485
+ ] }) })
45635
45486
  ] });
45636
- }
45637
- function LikeC4SearchOverlay() {
45638
- const close = useCloseSearch(), ref = useFocusTrap();
45487
+ });
45488
+ LikeC4Search.displayName = "LikeC4Search";
45489
+ const LikeC4SearchOverlay = () => {
45490
+ const close = useCloseSearch(), pickViewActive = useIsPickViewActive();
45639
45491
  return useWindowEvent(
45640
45492
  "keydown",
45641
45493
  (event) => {
@@ -45647,9 +45499,9 @@ function LikeC4SearchOverlay() {
45647
45499
  ), /* @__PURE__ */ jsxs(
45648
45500
  m$2.div,
45649
45501
  {
45650
- ref,
45651
45502
  className: root,
45652
- "data-likec4-search": !0,
45503
+ "data-likec4-search": "true",
45504
+ initial: !1,
45653
45505
  animate: {
45654
45506
  opacity: 1,
45655
45507
  scale: 1,
@@ -45658,14 +45510,15 @@ function LikeC4SearchOverlay() {
45658
45510
  exit: {
45659
45511
  opacity: 0,
45660
45512
  scale: 0.9,
45513
+ translateY: -30,
45661
45514
  transition: {
45662
- duration: 0.1
45515
+ duration: 0.13
45663
45516
  }
45664
45517
  },
45665
45518
  children: [
45666
45519
  /* @__PURE__ */ jsxs(Group, { wrap: "nowrap", children: [
45667
- /* @__PURE__ */ jsx(Box$1, { flex: 1, px: "sm", children: /* @__PURE__ */ jsx(LikeC4SearchInput, {}) }),
45668
- /* @__PURE__ */ jsx(Box$1, { flex: "0 0 auto", children: /* @__PURE__ */ jsx(
45520
+ /* @__PURE__ */ jsx(Box, { flex: 1, px: "sm", children: /* @__PURE__ */ jsx(LikeC4SearchInput, {}) }),
45521
+ /* @__PURE__ */ jsx(Box, { flex: "0 0 auto", children: /* @__PURE__ */ jsx(
45669
45522
  ActionIcon$1,
45670
45523
  {
45671
45524
  size: "lg",
@@ -45684,12 +45537,12 @@ function LikeC4SearchOverlay() {
45684
45537
  /* @__PURE__ */ jsxs(
45685
45538
  Grid,
45686
45539
  {
45687
- style: {
45540
+ className: css({
45688
45541
  containerName: "likec4-search-elements",
45689
45542
  containerType: "size",
45690
45543
  overflow: "hidden",
45691
45544
  flexGrow: 1
45692
- },
45545
+ }),
45693
45546
  children: [
45694
45547
  /* @__PURE__ */ jsx(GridCol, { span: 6, children: /* @__PURE__ */ jsx(
45695
45548
  ScrollArea,
@@ -45714,12 +45567,11 @@ function LikeC4SearchOverlay() {
45714
45567
  ]
45715
45568
  }
45716
45569
  ),
45717
- /* @__PURE__ */ jsx(Box$1, {}),
45718
- /* @__PURE__ */ jsx(PickView, {})
45570
+ pickViewActive && /* @__PURE__ */ jsx(PickView, {})
45719
45571
  ]
45720
45572
  }
45721
45573
  );
45722
- }
45574
+ };
45723
45575
  function PickView() {
45724
45576
  const pickview$1 = usePickView(), focusTrapRef = useFocusTrap(!!pickview$1);
45725
45577
  return useFocusReturn({
@@ -46264,7 +46116,7 @@ const autolayoutButton = css({
46264
46116
  translateY: -10
46265
46117
  },
46266
46118
  align: "flex-start",
46267
- className: clsx(
46119
+ className: cx(
46268
46120
  "react-flow__panel",
46269
46121
  panel,
46270
46122
  "likec4-top-left-panel"
@@ -46276,7 +46128,7 @@ const autolayoutButton = css({
46276
46128
  /* @__PURE__ */ jsx(LayoutGroup, { children: /* @__PURE__ */ jsxs(
46277
46129
  Group,
46278
46130
  {
46279
- className: clsx(navigationButtons, "likec4-navigation-webview"),
46131
+ className: cx(navigationButtons, "likec4-navigation-webview"),
46280
46132
  gap: "xs",
46281
46133
  children: [
46282
46134
  burgerMenu,
@@ -46305,7 +46157,7 @@ const autolayoutButton = css({
46305
46157
  enableReadOnly,
46306
46158
  enableVscode
46307
46159
  } = useEnabledFeatures(), notReadOnly = !enableReadOnly, portalProps = useMantinePortalProps(), ControlsLayout = useControlsCustomLayout() ?? ControlsDefaultLayout;
46308
- return /* @__PURE__ */ jsx(LayoutGroup, { inherit: !1, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "wait", children: isNotActiveWalkthrough && /* @__PURE__ */ jsx(
46160
+ return /* @__PURE__ */ jsx(Fragment$1, { children: isNotActiveWalkthrough && /* @__PURE__ */ jsx(
46309
46161
  ControlsLayout,
46310
46162
  {
46311
46163
  burgerMenu: onBurgerMenuClick && /* @__PURE__ */ jsx(
@@ -46347,7 +46199,7 @@ const autolayoutButton = css({
46347
46199
  ) })
46348
46200
  ] })
46349
46201
  }
46350
- ) }) });
46202
+ ) });
46351
46203
  }), SyncLayoutBadge = () => useDiagramSyncLayoutState((s2) => s2.hasTag("pending")) ? /* @__PURE__ */ jsx(Badge, { color: "pink", radius: "xs", size: "xs", variant: "light", leftSection: /* @__PURE__ */ jsx(Loader, { color: "orange", size: 8 }), children: "Pending..." }) : null, card$1 = css({
46352
46204
  cursor: "default",
46353
46205
  minWidth: 200,
@@ -47823,7 +47675,7 @@ function mergeXYNodesEdges({ context: context2, event }) {
47823
47675
  if (existing) {
47824
47676
  const { width: existingWidth, height: existingHeight } = getNodeDimensions(existing);
47825
47677
  return deepEqual(existing.type, update.type) && deepEqual(existingWidth, update.initialWidth) && deepEqual(existingHeight, update.initialHeight) && deepEqual(existing.hidden ?? !1, update.hidden ?? !1) && deepEqual(existing.position, update.position) && deepEqual(existing.data, update.data) && deepEqual(existing.parentId ?? null, update.parentId ?? null) ? existing : {
47826
- ...y$3(existing, ["measured", "parentId"]),
47678
+ ...y$2(existing, ["measured", "parentId"]),
47827
47679
  ...update,
47828
47680
  // Force dimensions from update
47829
47681
  width: update.initialWidth,
@@ -48277,6 +48129,7 @@ const diagramMachine = xstate_cjsExports.setup({
48277
48129
  "enabled: FitView": ({ context: context2 }) => context2.features.enableFitView,
48278
48130
  "enabled: FocusMode": ({ context: context2 }) => context2.features.enableFocusMode,
48279
48131
  "enabled: Readonly": ({ context: context2 }) => context2.features.enableReadOnly,
48132
+ "enabled: RelationshipDetails": ({ context: context2 }) => context2.features.enableRelationshipDetails,
48280
48133
  "not readonly": ({ context: context2 }) => !context2.features.enableReadOnly,
48281
48134
  "is dynamic view": ({ context: context2 }) => context2.view.__ === "dynamic",
48282
48135
  "is another view": ({ context: context2, event }) => {
@@ -48289,7 +48142,8 @@ const diagramMachine = xstate_cjsExports.setup({
48289
48142
  "click: selected node": ({ event }) => (xstate_cjsExports.assertEvent(event, "xyflow.nodeClick"), event.node.selected === !0),
48290
48143
  "click: same node": ({ context: context2, event }) => (xstate_cjsExports.assertEvent(event, "xyflow.nodeClick"), context2.lastClickedNode?.id === event.node.id),
48291
48144
  "click: focused node": ({ context: context2, event }) => (xstate_cjsExports.assertEvent(event, "xyflow.nodeClick"), context2.focusedNode === event.node.id),
48292
- "click: node has connections": ({ context: context2, event }) => (xstate_cjsExports.assertEvent(event, "xyflow.nodeClick"), context2.xyedges.some((e2) => e2.source === event.node.id || e2.target === event.node.id))
48145
+ "click: node has connections": ({ context: context2, event }) => (xstate_cjsExports.assertEvent(event, "xyflow.nodeClick"), context2.xyedges.some((e2) => e2.source === event.node.id || e2.target === event.node.id)),
48146
+ "click: selected edge": ({ event }) => (xstate_cjsExports.assertEvent(event, "xyflow.edgeClick"), event.edge.selected === !0 || event.edge.data.active === !0)
48293
48147
  },
48294
48148
  actions: {
48295
48149
  "trigger:NavigateTo": (_, _params) => {
@@ -48311,7 +48165,7 @@ const diagramMachine = xstate_cjsExports.setup({
48311
48165
  const {
48312
48166
  bounds = context2.view.bounds,
48313
48167
  duration = 450
48314
- } = params ?? {}, { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds$1(
48168
+ } = params ?? {}, { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds(
48315
48169
  bounds,
48316
48170
  width,
48317
48171
  height,
@@ -48322,7 +48176,7 @@ const diagramMachine = xstate_cjsExports.setup({
48322
48176
  viewport.x = Math.round(viewport.x), viewport.y = Math.round(viewport.y), panZoom?.setViewport(viewport, duration > 0 ? { duration } : void 0);
48323
48177
  },
48324
48178
  "xyflow:fitFocusedBounds": ({ context: context2 }) => {
48325
- const { bounds, duration = 450 } = focusedBounds({ context: context2 }), { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds$1(
48179
+ const { bounds, duration = 450 } = focusedBounds({ context: context2 }), { width, height, panZoom, transform: transform2 } = context2.xystore.getState(), maxZoom = Math.max(1, transform2[2]), viewport = getViewportForBounds(
48326
48180
  bounds,
48327
48181
  width,
48328
48182
  height,
@@ -48497,7 +48351,6 @@ const diagramMachine = xstate_cjsExports.setup({
48497
48351
  type: "xyflow:fitDiagram",
48498
48352
  params: { duration: 0 }
48499
48353
  },
48500
- "startSyncLayout",
48501
48354
  xstate_cjsExports.assign(({ context: context2 }) => ({
48502
48355
  navigationHistory: {
48503
48356
  currentIndex: 0,
@@ -48507,7 +48360,8 @@ const diagramMachine = xstate_cjsExports.setup({
48507
48360
  viewport: { ...context2.xyflow.getViewport() }
48508
48361
  }]
48509
48362
  }
48510
- }))
48363
+ })),
48364
+ "startSyncLayout"
48511
48365
  ],
48512
48366
  target: "ready"
48513
48367
  }, {
@@ -48720,7 +48574,27 @@ const diagramMachine = xstate_cjsExports.setup({
48720
48574
  focusedNode: ({ event }) => event.nodeId
48721
48575
  }),
48722
48576
  target: "focused"
48723
- }
48577
+ },
48578
+ "xyflow.edgeClick": [{
48579
+ guard: xstate_cjsExports.and([
48580
+ "is dynamic view",
48581
+ "click: selected edge"
48582
+ ]),
48583
+ actions: xstate_cjsExports.raise(({ event }) => ({
48584
+ type: "walkthrough.start",
48585
+ stepId: event.edge.id
48586
+ }))
48587
+ }, {
48588
+ guard: xstate_cjsExports.and([
48589
+ "enabled: RelationshipDetails",
48590
+ "click: selected edge"
48591
+ ]),
48592
+ actions: xstate_cjsExports.sendTo(({ system }) => typedSystem(system).overlaysActorRef, ({ context: context2, event }) => ({
48593
+ type: "open.relationshipDetails",
48594
+ viewId: context2.view.id,
48595
+ edgeId: event.edge.id
48596
+ }))
48597
+ }]
48724
48598
  }
48725
48599
  },
48726
48600
  focused: {
@@ -48733,12 +48607,12 @@ const diagramMachine = xstate_cjsExports.setup({
48733
48607
  xstate_cjsExports.spawnChild("hotkeyActorLogic", { id: "hotkey" }),
48734
48608
  "xyflow:fitFocusedBounds"
48735
48609
  ],
48736
- exit: xstate_cjsExports.enqueueActions(({ enqueue, context: context2 }) => {
48737
- enqueue.stopChild("hotkey"), context2.viewportBeforeFocus ? enqueue({ type: "xyflow:setViewport", params: { viewport: context2.viewportBeforeFocus } }) : enqueue({ type: "xyflow:fitDiagram" }), enqueue.assign((s2) => ({
48738
- ...unfocusNodesEdges(s2),
48610
+ exit: xstate_cjsExports.enqueueActions(({ enqueue, context: context2, event }) => {
48611
+ enqueue.stopChild("hotkey"), context2.viewportBeforeFocus ? enqueue({ type: "xyflow:setViewport", params: { viewport: context2.viewportBeforeFocus } }) : enqueue({ type: "xyflow:fitDiagram" }), enqueue.assign({
48612
+ ...unfocusNodesEdges({ context: context2 }),
48739
48613
  viewportBeforeFocus: null,
48740
48614
  focusedNode: null
48741
- }));
48615
+ });
48742
48616
  }),
48743
48617
  on: {
48744
48618
  "xyflow.nodeClick": [
@@ -48828,6 +48702,18 @@ const diagramMachine = xstate_cjsExports.setup({
48828
48702
  }), enqueue.assign(updateActiveWalkthrough), enqueue("xyflow:fitFocusedBounds");
48829
48703
  })
48830
48704
  },
48705
+ "xyflow.edgeClick": {
48706
+ actions: [
48707
+ xstate_cjsExports.assign(({ event, context: context2 }) => !isStepEdgeId(event.edge.id) || event.edge.id === context2.activeWalkthrough?.stepId ? {} : {
48708
+ activeWalkthrough: {
48709
+ stepId: event.edge.id,
48710
+ parallelPrefix: getParallelStepsPrefix(event.edge.id)
48711
+ }
48712
+ }),
48713
+ xstate_cjsExports.assign(updateActiveWalkthrough),
48714
+ "xyflow:fitFocusedBounds"
48715
+ ]
48716
+ },
48831
48717
  "notations.unhighlight": {
48832
48718
  actions: xstate_cjsExports.assign((s2) => ({
48833
48719
  ...updateActiveWalkthrough(s2)
@@ -48873,7 +48759,7 @@ const diagramMachine = xstate_cjsExports.setup({
48873
48759
  "update.view": {
48874
48760
  actions: xstate_cjsExports.enqueueActions(({ enqueue, context: context2, event }) => {
48875
48761
  const { fromNode, toNode } = findCorrespondingNode(context2, event);
48876
- fromNode && toNode ? (enqueue({
48762
+ enqueue(fromNode && toNode ? {
48877
48763
  type: "xyflow:alignNodeFromToAfterNavigate",
48878
48764
  params: {
48879
48765
  fromNode: fromNode.id,
@@ -48882,13 +48768,13 @@ const diagramMachine = xstate_cjsExports.setup({
48882
48768
  y: toNode.position[1]
48883
48769
  }
48884
48770
  }
48885
- }), enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 80 })) : (enqueue({
48771
+ } : {
48886
48772
  type: "xyflow:setViewportCenter",
48887
48773
  params: getBBoxCenter(event.view.bounds)
48888
- }), enqueue.raise({ type: "fitDiagram", duration: 200 }, { id: "fitDiagram", delay: 25 })), enqueue.assign(updateNavigationHistory), enqueue.assign({
48774
+ }), enqueue.assign(updateNavigationHistory), enqueue.assign({
48889
48775
  ...mergeXYNodesEdges({ context: context2, event }),
48890
48776
  lastOnNavigate: null
48891
- }), enqueue("startSyncLayout");
48777
+ }), enqueue("startSyncLayout"), enqueue.raise({ type: "fitDiagram" }, { id: "fitDiagram", delay: 25 });
48892
48778
  }),
48893
48779
  target: "#idle"
48894
48780
  }
@@ -48997,7 +48883,9 @@ function DiagramActorProvider({
48997
48883
  diagramMachine.provide({
48998
48884
  actions: {
48999
48885
  "trigger:NavigateTo": (_, { viewId }) => {
49000
- handlersRef.current.onNavigateTo?.(viewId);
48886
+ setTimeout(() => {
48887
+ handlersRef.current.onNavigateTo?.(viewId);
48888
+ }, 30);
49001
48889
  },
49002
48890
  "trigger:OnChange": (_, params) => {
49003
48891
  handlersRef.current.onChange?.(params);
@@ -49041,7 +48929,7 @@ function DiagramActorProvider({
49041
48929
  actorRef.send({ type: "update.view", view, xyedges, xynodes });
49042
48930
  }, [view, xyedges, xynodes]);
49043
48931
  const toggledFeatures = xstateReact_cjsExports.useSelector(actorRef, selectToggledFeatures, shallowEqual);
49044
- return /* @__PURE__ */ jsx(DiagramActorSafeContext, { value: actorRef, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children: children2 }) });
48932
+ return /* @__PURE__ */ jsx(DiagramActorContextProvider, { value: actorRef, children: /* @__PURE__ */ jsx(DiagramFeatures, { overrides: toggledFeatures, children: children2 }) });
49045
48933
  }
49046
48934
  function LikeC4Diagram({
49047
48935
  onCanvasClick,
@@ -49249,11 +49137,11 @@ function Fallback$1({ error, resetErrorBoundary }) {
49249
49137
  }
49250
49138
  const LikeC4ModelDataContext = createContext(null);
49251
49139
  function useLikeC4ModelDataContext() {
49252
- return use(LikeC4ModelDataContext);
49140
+ return useContext(LikeC4ModelDataContext);
49253
49141
  }
49254
49142
  function LikeC4ModelContext({ likec4data, children: children2 }) {
49255
49143
  const $likec4model = useMemo(() => computed(likec4data, (data) => createLikeC4Model(data)), [likec4data]), model = useStore($likec4model);
49256
- return /* @__PURE__ */ jsx(LikeC4ModelDataContext, { value: likec4data, children: /* @__PURE__ */ jsx(LikeC4ModelProvider, { likec4model: model, children: children2 }) });
49144
+ return /* @__PURE__ */ jsx(LikeC4ModelDataContext.Provider, { value: likec4data, children: /* @__PURE__ */ jsx(LikeC4ModelProvider, { likec4model: model, children: children2 }) });
49257
49145
  }
49258
49146
  css({
49259
49147
  position: "absolute",
@@ -50542,15 +50430,10 @@ async function downloadAsPng({
50542
50430
  pngFilename,
50543
50431
  viewport
50544
50432
  }) {
50545
- const { toBlob } = await import("./index-iX7kahqQ.js"), {
50546
- width,
50547
- height
50548
- } = viewport.getBoundingClientRect();
50433
+ const { toBlob } = await import("./index-iX7kahqQ.js");
50549
50434
  try {
50550
50435
  const blob = await toBlob(viewport, {
50551
50436
  backgroundColor: "transparent",
50552
- width,
50553
- height,
50554
50437
  cacheBust: !0,
50555
50438
  imagePlaceholder: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
50556
50439
  });
@@ -50568,19 +50451,23 @@ function ExportPage() {
50568
50451
  download = !1
50569
50452
  } = useSearch$1({
50570
50453
  strict: !1
50571
- }), { viewId } = useParams({ strict: !1 }), diagram = useCurrentDiagram(), viewportRef = useRef(null), loadingOverlayRef = useRef(null), downloadedRef = useRef(!1);
50572
- if (useTransparentBackground(), useEffect(() => {
50573
- document.querySelectorAll(".react-flow__viewport").forEach((el) => {
50574
- el.style.transform = "";
50575
- });
50576
- }), useDebouncedEffect(
50454
+ }), diagram = useCurrentDiagram(), viewportRef = useRef(null), loadingOverlayRef = useRef(null), downloadedRef = useRef(!1);
50455
+ if (useTransparentBackground(), useEffect(
50456
+ () => {
50457
+ if (!viewportRef.current)
50458
+ return;
50459
+ [...viewportRef.current.querySelectorAll(".react-flow__viewport")].forEach((el) => {
50460
+ el.style.transform = "";
50461
+ });
50462
+ }
50463
+ ), useDebouncedEffect(
50577
50464
  () => {
50578
50465
  const viewport = viewportRef.current;
50579
50466
  if (!download || !viewport || !diagram)
50580
50467
  return;
50581
50468
  const loadingOverlay = loadingOverlayRef.current;
50582
50469
  loadingOverlay && (loadingOverlay.style.display = "none"), !downloadedRef.current && (downloadedRef.current = !0, downloadAsPng({
50583
- pngFilename: viewId,
50470
+ pngFilename: diagram.id,
50584
50471
  viewport
50585
50472
  }));
50586
50473
  },
@@ -50590,11 +50477,11 @@ function ExportPage() {
50590
50477
  throw notFound();
50591
50478
  const width = diagram.bounds.width + padding * 2, height = diagram.bounds.height + padding * 2;
50592
50479
  return /* @__PURE__ */ jsxs(
50593
- Box$1,
50480
+ Box,
50594
50481
  {
50595
50482
  ref: viewportRef,
50596
- className: cssExportView,
50597
- role: "presentation",
50483
+ "data-testid": "export-page",
50484
+ className: cx(cssExportView),
50598
50485
  style: {
50599
50486
  padding,
50600
50487
  minWidth: width,