likec4 1.51.0 → 1.52.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.
package/react/index.mjs CHANGED
@@ -1226,12 +1226,12 @@ function* selection_iterator() {
1226
1226
  for (var group = groups[j2], i2 = 0, n2 = group.length, node2; i2 < n2; ++i2)
1227
1227
  (node2 = group[i2]) && (yield node2);
1228
1228
  }
1229
- var root = [null];
1229
+ var root$1 = [null];
1230
1230
  function Selection$1(groups, parents) {
1231
1231
  this._groups = groups, this._parents = parents;
1232
1232
  }
1233
1233
  function selection() {
1234
- return new Selection$1([[document.documentElement]], root);
1234
+ return new Selection$1([[document.documentElement]], root$1);
1235
1235
  }
1236
1236
  function selection_selection() {
1237
1237
  return this;
@@ -1275,7 +1275,7 @@ Selection$1.prototype = selection.prototype = {
1275
1275
  [Symbol.iterator]: selection_iterator
1276
1276
  };
1277
1277
  function select$2(selector3) {
1278
- return typeof selector3 == "string" ? new Selection$1([[document.querySelector(selector3)]], [document.documentElement]) : new Selection$1([[selector3]], root);
1278
+ return typeof selector3 == "string" ? new Selection$1([[document.querySelector(selector3)]], [document.documentElement]) : new Selection$1([[selector3]], root$1);
1279
1279
  }
1280
1280
  function sourceEvent(event) {
1281
1281
  let sourceEvent2;
@@ -3162,7 +3162,7 @@ function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = !1, transfo
3162
3162
  ...pointerPos
3163
3163
  };
3164
3164
  }
3165
- const getDimensions$1 = (node2) => ({
3165
+ const getDimensions$2 = (node2) => ({
3166
3166
  width: node2.offsetWidth,
3167
3167
  height: node2.offsetHeight
3168
3168
  }), getHostForElement = (element) => element?.getRootNode?.() || window?.document, inputTags = ["INPUT", "SELECT", "TEXTAREA"];
@@ -3187,7 +3187,7 @@ const isMouseEvent = (event) => "clientX" in event, getEventPosition = (event, b
3187
3187
  position: handle.getAttribute("data-handlepos"),
3188
3188
  x: (handleBounds.left - nodeBounds.left) / zoom2,
3189
3189
  y: (handleBounds.top - nodeBounds.top) / zoom2,
3190
- ...getDimensions$1(handle)
3190
+ ...getDimensions$2(handle)
3191
3191
  };
3192
3192
  });
3193
3193
  };
@@ -3634,7 +3634,7 @@ function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOri
3634
3634
  }), updatedInternals = !0;
3635
3635
  continue;
3636
3636
  }
3637
- const dimensions = getDimensions$1(update.nodeElement), dimensionChanged = node2.measured.width !== dimensions.width || node2.measured.height !== dimensions.height;
3637
+ const dimensions = getDimensions$2(update.nodeElement), dimensionChanged = node2.measured.width !== dimensions.width || node2.measured.height !== dimensions.height;
3638
3638
  if (!!(dimensions.width && dimensions.height && (dimensionChanged || !node2.internals.handleBounds || update.force))) {
3639
3639
  const nodeBounds = update.nodeElement.getBoundingClientRect(), extent = isCoordinateExtent(node2.extent) ? node2.extent : nodeExtent;
3640
3640
  let { positionAbsolute } = node2.internals;
@@ -5069,7 +5069,7 @@ function elementToRemoveChange(item) {
5069
5069
  type: "remove"
5070
5070
  };
5071
5071
  }
5072
- const isNode$1 = (element) => isNodeBase(element), isEdge = (element) => isEdgeBase(element);
5072
+ const isNode$2 = (element) => isNodeBase(element), isEdge = (element) => isEdgeBase(element);
5073
5073
  function fixedForwardRef(render) {
5074
5074
  return forwardRef(render);
5075
5075
  }
@@ -5136,7 +5136,7 @@ function useReactFlow() {
5136
5136
  }, setEdges = (payload) => {
5137
5137
  batchContext.edgeQueue.push(payload);
5138
5138
  }, getNodeRect = (node2) => {
5139
- const { nodeLookup, nodeOrigin } = store.getState(), nodeToUse = isNode$1(node2) ? node2 : nodeLookup.get(node2.id), position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, nodeLookup, nodeOrigin) : nodeToUse.position, nodeWithPosition = {
5139
+ const { nodeLookup, nodeOrigin } = store.getState(), nodeToUse = isNode$2(node2) ? node2 : nodeLookup.get(node2.id), position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, nodeLookup, nodeOrigin) : nodeToUse.position, nodeWithPosition = {
5140
5140
  ...nodeToUse,
5141
5141
  position,
5142
5142
  width: nodeToUse.measured?.width ?? nodeToUse.width,
@@ -5147,7 +5147,7 @@ function useReactFlow() {
5147
5147
  setNodes((prevNodes) => prevNodes.map((node2) => {
5148
5148
  if (node2.id === id2) {
5149
5149
  const nextNode = typeof nodeUpdate == "function" ? nodeUpdate(node2) : nodeUpdate;
5150
- return options.replace && isNode$1(nextNode) ? nextNode : { ...node2, ...nextNode };
5150
+ return options.replace && isNode$2(nextNode) ? nextNode : { ...node2, ...nextNode };
5151
5151
  }
5152
5152
  return node2;
5153
5153
  }));
@@ -5281,7 +5281,7 @@ function useResizeHandler(domNode) {
5281
5281
  const updateDimensions = () => {
5282
5282
  if (!domNode.current || !(domNode.current.checkVisibility?.() ?? !0))
5283
5283
  return !1;
5284
- const size2 = getDimensions$1(domNode.current);
5284
+ const size2 = getDimensions$2(domNode.current);
5285
5285
  (size2.height === 0 || size2.width === 0) && store.getState().onError?.("004", errorMessages.error004()), store.setState({ width: size2.width || 500, height: size2.height || 500 });
5286
5286
  };
5287
5287
  if (domNode.current) {
@@ -5318,7 +5318,7 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panO
5318
5318
  maxZoom,
5319
5319
  translateExtent,
5320
5320
  viewport: defaultViewport2,
5321
- onDraggingChange: (paneDragging) => store.setState({ paneDragging }),
5321
+ onDraggingChange: (paneDragging) => store.setState((prevState) => prevState.paneDragging === paneDragging ? prevState : { paneDragging }),
5322
5322
  onPanZoomStart: (event, vp) => {
5323
5323
  const { onViewportChangeStart, onMoveStart } = store.getState();
5324
5324
  onMoveStart?.(event, vp), onViewportChangeStart?.(vp);
@@ -5518,10 +5518,8 @@ function useDrag({ nodeRef: nodeRef2, disabled = !1, noDragClassName, handleSele
5518
5518
  }
5519
5519
  });
5520
5520
  }, []), useEffect(() => {
5521
- if (disabled)
5522
- xyDrag.current?.destroy();
5523
- else if (nodeRef2.current)
5524
- return xyDrag.current?.update({
5521
+ if (!(disabled || !nodeRef2.current || !xyDrag.current))
5522
+ return xyDrag.current.update({
5525
5523
  noDragClassName,
5526
5524
  handleSelector,
5527
5525
  domNode: nodeRef2.current,
@@ -5531,7 +5529,7 @@ function useDrag({ nodeRef: nodeRef2, disabled = !1, noDragClassName, handleSele
5531
5529
  }), () => {
5532
5530
  xyDrag.current?.destroy();
5533
5531
  };
5534
- }, [noDragClassName, handleSelector, disabled, isSelectable, nodeRef2, nodeId]), dragging;
5532
+ }, [noDragClassName, handleSelector, disabled, isSelectable, nodeRef2, nodeId, nodeClickDistance]), dragging;
5535
5533
  }
5536
5534
  const selectedAndDraggable = (nodesDraggable) => (n2) => n2.selected && (n2.draggable || nodesDraggable && typeof n2.draggable > "u");
5537
5535
  function useMoveSelectedNodes() {
@@ -5611,10 +5609,10 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
5611
5609
  panBy: currentStore.panBy,
5612
5610
  cancelConnection: currentStore.cancelConnection,
5613
5611
  onConnectStart: currentStore.onConnectStart,
5614
- onConnectEnd: currentStore.onConnectEnd,
5612
+ onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
5615
5613
  updateConnection: currentStore.updateConnection,
5616
5614
  onConnect: onConnectExtended,
5617
- isValidConnection: isValidConnection || currentStore.isValidConnection,
5615
+ isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? !0),
5618
5616
  getTransform: () => store.getState().transform,
5619
5617
  getFromHandle: () => store.getState().connection.fromHandle,
5620
5618
  autoPanSpeed: currentStore.autoPanSpeed,
@@ -5720,13 +5718,16 @@ const selector$f = (s2) => {
5720
5718
  };
5721
5719
  function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y }) {
5722
5720
  const store = useStoreApi(), { width, height, transformString, userSelectionActive } = useStore$1(selector$f, shallow$1), moveSelectedNodes = useMoveSelectedNodes(), nodeRef2 = useRef(null);
5723
- if (useEffect(() => {
5721
+ useEffect(() => {
5724
5722
  disableKeyboardA11y || nodeRef2.current?.focus({
5725
5723
  preventScroll: !0
5726
5724
  });
5727
- }, [disableKeyboardA11y]), useDrag({
5728
- nodeRef: nodeRef2
5729
- }), userSelectionActive || !width || !height)
5725
+ }, [disableKeyboardA11y]);
5726
+ const shouldRender = !userSelectionActive && width !== null && height !== null;
5727
+ if (useDrag({
5728
+ nodeRef: nodeRef2,
5729
+ disabled: !shouldRender
5730
+ }), !shouldRender)
5730
5731
  return null;
5731
5732
  const onContextMenu = onSelectionContextMenu ? (event) => {
5732
5733
  const selectedNodes = store.getState().nodes.filter((n2) => n2.selected);
@@ -6110,7 +6111,7 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
6110
6111
  const store = useStoreApi(), handleEdgeUpdater = (event, oppositeHandle) => {
6111
6112
  if (event.button !== 0)
6112
6113
  return;
6113
- const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib: lib2, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState(), isTarget = oppositeHandle.type === "target", _onReconnectEnd = (evt, connectionState) => {
6114
+ const { autoPanOnConnect, domNode, connectionMode, connectionRadius, lib: lib2, onConnectStart, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState(), isTarget = oppositeHandle.type === "target", _onReconnectEnd = (evt, connectionState) => {
6114
6115
  setReconnecting(!1), onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
6115
6116
  }, onConnectEdge = (connection) => onReconnect?.(edge, connection), _onConnectStart = (_event, params) => {
6116
6117
  setReconnecting(!0), onReconnectStart?.(event, edge, oppositeHandle.type), onConnectStart?.(_event, params);
@@ -6129,10 +6130,10 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
6129
6130
  flowId,
6130
6131
  cancelConnection,
6131
6132
  panBy: panBy2,
6132
- isValidConnection,
6133
+ isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? !0,
6133
6134
  onConnect: onConnectEdge,
6134
6135
  onConnectStart: _onConnectStart,
6135
- onConnectEnd,
6136
+ onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
6136
6137
  onReconnectEnd: _onReconnectEnd,
6137
6138
  updateConnection,
6138
6139
  getTransform: () => store.getState().transform,
@@ -6530,10 +6531,16 @@ const GraphView = memo$2(GraphViewComponent), getInitialState = ({ nodes, edges,
6530
6531
  triggerEdgeChanges(getSelectionChanges(edgeLookup, /* @__PURE__ */ new Set([...selectedEdgeIds]))), triggerNodeChanges(getSelectionChanges(nodeLookup, /* @__PURE__ */ new Set(), !0));
6531
6532
  },
6532
6533
  unselectNodesAndEdges: ({ nodes: nodes2, edges: edges2 } = {}) => {
6533
- const { edges: storeEdges, nodes: storeNodes, nodeLookup, triggerNodeChanges, triggerEdgeChanges } = get2(), nodesToUnselect = nodes2 || storeNodes, edgesToUnselect = edges2 || storeEdges, nodeChanges = nodesToUnselect.map((n2) => {
6534
- const internalNode = nodeLookup.get(n2.id);
6535
- return internalNode && (internalNode.selected = !1), createSelectionChange(n2.id, !1);
6536
- }), edgeChanges = edgesToUnselect.map((edge) => createSelectionChange(edge.id, !1));
6534
+ const { edges: storeEdges, nodes: storeNodes, nodeLookup, triggerNodeChanges, triggerEdgeChanges } = get2(), nodesToUnselect = nodes2 || storeNodes, edgesToUnselect = edges2 || storeEdges, nodeChanges = [];
6535
+ for (const node2 of nodesToUnselect) {
6536
+ if (!node2.selected)
6537
+ continue;
6538
+ const internalNode = nodeLookup.get(node2.id);
6539
+ internalNode && (internalNode.selected = !1), nodeChanges.push(createSelectionChange(node2.id, !1));
6540
+ }
6541
+ const edgeChanges = [];
6542
+ for (const edge of edgesToUnselect)
6543
+ edge.selected && edgeChanges.push(createSelectionChange(edge.id, !1));
6537
6544
  triggerNodeChanges(nodeChanges), triggerEdgeChanges(edgeChanges);
6538
6545
  },
6539
6546
  setMinZoom: (minZoom2) => {
@@ -6756,9 +6763,12 @@ function MiniMapNodes({
6756
6763
  }
6757
6764
  function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
6758
6765
  const { node: node2, x: x2, y: y2, width, height } = useStore$1((s2) => {
6759
- const { internals } = s2.nodeLookup.get(id2), node22 = internals.userNode, { x: x22, y: y22 } = internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions(node22);
6766
+ const node22 = s2.nodeLookup.get(id2);
6767
+ if (!node22)
6768
+ return { node: void 0, x: 0, y: 0, width: 0, height: 0 };
6769
+ const userNode = node22.internals.userNode, { x: x22, y: y22 } = node22.internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions(userNode);
6760
6770
  return {
6761
- node: node22,
6771
+ node: userNode,
6762
6772
  x: x22,
6763
6773
  y: y22,
6764
6774
  width: width2,
@@ -8301,7 +8311,7 @@ function isNumberLike(value) {
8301
8311
  }
8302
8312
  return !1;
8303
8313
  }
8304
- function isElement$1(value) {
8314
+ function isElement$2(value) {
8305
8315
  return Array.isArray(value) || value === null ? !1 : typeof value == "object" ? value.type !== Fragment$1 : !1;
8306
8316
  }
8307
8317
  function createSafeContext$1(errorMessage) {
@@ -9222,7 +9232,7 @@ function getRootElement(targetElement) {
9222
9232
  }
9223
9233
  function getSingleElementChild(children2) {
9224
9234
  const _children = Children.toArray(children2);
9225
- return _children.length !== 1 || !isElement$1(_children[0]) ? null : _children[0];
9235
+ return _children.length !== 1 || !isElement$2(_children[0]) ? null : _children[0];
9226
9236
  }
9227
9237
  function r(e2) {
9228
9238
  var t2, f2, n2 = "";
@@ -11174,48 +11184,48 @@ const defaultProps$L = {
11174
11184
  );
11175
11185
  });
11176
11186
  Collapse.displayName = "@mantine/core/Collapse";
11177
- function hasWindow() {
11187
+ function hasWindow$1() {
11178
11188
  return typeof window < "u";
11179
11189
  }
11180
- function getNodeName(node2) {
11181
- return isNode(node2) ? (node2.nodeName || "").toLowerCase() : "#document";
11190
+ function getNodeName$1(node2) {
11191
+ return isNode$1(node2) ? (node2.nodeName || "").toLowerCase() : "#document";
11182
11192
  }
11183
- function getWindow(node2) {
11193
+ function getWindow$1(node2) {
11184
11194
  var _node$ownerDocument;
11185
11195
  return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
11186
11196
  }
11187
- function getDocumentElement(node2) {
11197
+ function getDocumentElement$1(node2) {
11188
11198
  var _ref;
11189
- return (_ref = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
11199
+ return (_ref = (isNode$1(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
11190
11200
  }
11191
- function isNode(value) {
11192
- return hasWindow() ? value instanceof Node || value instanceof getWindow(value).Node : !1;
11201
+ function isNode$1(value) {
11202
+ return hasWindow$1() ? value instanceof Node || value instanceof getWindow$1(value).Node : !1;
11193
11203
  }
11194
- function isElement(value) {
11195
- return hasWindow() ? value instanceof Element || value instanceof getWindow(value).Element : !1;
11204
+ function isElement$1(value) {
11205
+ return hasWindow$1() ? value instanceof Element || value instanceof getWindow$1(value).Element : !1;
11196
11206
  }
11197
- function isHTMLElement$1(value) {
11198
- return hasWindow() ? value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement : !1;
11207
+ function isHTMLElement$2(value) {
11208
+ return hasWindow$1() ? value instanceof HTMLElement || value instanceof getWindow$1(value).HTMLElement : !1;
11199
11209
  }
11200
- function isShadowRoot(value) {
11201
- return !hasWindow() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
11210
+ function isShadowRoot$1(value) {
11211
+ return !hasWindow$1() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow$1(value).ShadowRoot;
11202
11212
  }
11203
11213
  const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
11204
- function isOverflowElement(element) {
11214
+ function isOverflowElement$1(element) {
11205
11215
  const {
11206
11216
  overflow,
11207
11217
  overflowX,
11208
11218
  overflowY,
11209
11219
  display
11210
- } = getComputedStyle$2(element);
11220
+ } = getComputedStyle$3(element);
11211
11221
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
11212
11222
  }
11213
11223
  const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
11214
- function isTableElement(element) {
11215
- return tableElements.has(getNodeName(element));
11224
+ function isTableElement$1(element) {
11225
+ return tableElements.has(getNodeName$1(element));
11216
11226
  }
11217
11227
  const topLayerSelectors = [":popover-open", ":modal"];
11218
- function isTopLayer(element) {
11228
+ function isTopLayer$1(element) {
11219
11229
  return topLayerSelectors.some((selector3) => {
11220
11230
  try {
11221
11231
  return element.matches(selector3);
@@ -11225,33 +11235,33 @@ function isTopLayer(element) {
11225
11235
  });
11226
11236
  }
11227
11237
  const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"], willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"], containValues = ["paint", "layout", "strict", "content"];
11228
- function isContainingBlock(elementOrCss) {
11229
- const webkit = isWebKit(), css2 = isElement(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
11238
+ function isContainingBlock$1(elementOrCss) {
11239
+ const webkit = isWebKit$1(), css2 = isElement$1(elementOrCss) ? getComputedStyle$3(elementOrCss) : elementOrCss;
11230
11240
  return transformProperties.some((value) => css2[value] ? css2[value] !== "none" : !1) || (css2.containerType ? css2.containerType !== "normal" : !1) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : !1) || !webkit && (css2.filter ? css2.filter !== "none" : !1) || willChangeValues.some((value) => (css2.willChange || "").includes(value)) || containValues.some((value) => (css2.contain || "").includes(value));
11231
11241
  }
11232
- function getContainingBlock(element) {
11233
- let currentNode = getParentNode(element);
11234
- for (; isHTMLElement$1(currentNode) && !isLastTraversableNode(currentNode); ) {
11235
- if (isContainingBlock(currentNode))
11242
+ function getContainingBlock$1(element) {
11243
+ let currentNode = getParentNode$1(element);
11244
+ for (; isHTMLElement$2(currentNode) && !isLastTraversableNode$1(currentNode); ) {
11245
+ if (isContainingBlock$1(currentNode))
11236
11246
  return currentNode;
11237
- if (isTopLayer(currentNode))
11247
+ if (isTopLayer$1(currentNode))
11238
11248
  return null;
11239
- currentNode = getParentNode(currentNode);
11249
+ currentNode = getParentNode$1(currentNode);
11240
11250
  }
11241
11251
  return null;
11242
11252
  }
11243
- function isWebKit() {
11253
+ function isWebKit$1() {
11244
11254
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
11245
11255
  }
11246
11256
  const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
11247
- function isLastTraversableNode(node2) {
11248
- return lastTraversableNodeNames.has(getNodeName(node2));
11257
+ function isLastTraversableNode$1(node2) {
11258
+ return lastTraversableNodeNames.has(getNodeName$1(node2));
11249
11259
  }
11250
- function getComputedStyle$2(element) {
11251
- return getWindow(element).getComputedStyle(element);
11260
+ function getComputedStyle$3(element) {
11261
+ return getWindow$1(element).getComputedStyle(element);
11252
11262
  }
11253
- function getNodeScroll(element) {
11254
- return isElement(element) ? {
11263
+ function getNodeScroll$1(element) {
11264
+ return isElement$1(element) ? {
11255
11265
  scrollLeft: element.scrollLeft,
11256
11266
  scrollTop: element.scrollTop
11257
11267
  } : {
@@ -11259,39 +11269,39 @@ function getNodeScroll(element) {
11259
11269
  scrollTop: element.scrollY
11260
11270
  };
11261
11271
  }
11262
- function getParentNode(node2) {
11263
- if (getNodeName(node2) === "html")
11272
+ function getParentNode$1(node2) {
11273
+ if (getNodeName$1(node2) === "html")
11264
11274
  return node2;
11265
11275
  const result = (
11266
11276
  // Step into the shadow DOM of the parent of a slotted node.
11267
11277
  node2.assignedSlot || // DOM Element detected.
11268
11278
  node2.parentNode || // ShadowRoot detected.
11269
- isShadowRoot(node2) && node2.host || // Fallback.
11270
- getDocumentElement(node2)
11279
+ isShadowRoot$1(node2) && node2.host || // Fallback.
11280
+ getDocumentElement$1(node2)
11271
11281
  );
11272
- return isShadowRoot(result) ? result.host : result;
11282
+ return isShadowRoot$1(result) ? result.host : result;
11273
11283
  }
11274
- function getNearestOverflowAncestor(node2) {
11275
- const parentNode = getParentNode(node2);
11276
- return isLastTraversableNode(parentNode) ? node2.ownerDocument ? node2.ownerDocument.body : node2.body : isHTMLElement$1(parentNode) && isOverflowElement(parentNode) ? parentNode : getNearestOverflowAncestor(parentNode);
11284
+ function getNearestOverflowAncestor$1(node2) {
11285
+ const parentNode = getParentNode$1(node2);
11286
+ return isLastTraversableNode$1(parentNode) ? node2.ownerDocument ? node2.ownerDocument.body : node2.body : isHTMLElement$2(parentNode) && isOverflowElement$1(parentNode) ? parentNode : getNearestOverflowAncestor$1(parentNode);
11277
11287
  }
11278
- function getOverflowAncestors(node2, list2, traverseIframes) {
11288
+ function getOverflowAncestors$1(node2, list2, traverseIframes) {
11279
11289
  var _node$ownerDocument2;
11280
11290
  list2 === void 0 && (list2 = []), traverseIframes === void 0 && (traverseIframes = !0);
11281
- const scrollableAncestor = getNearestOverflowAncestor(node2), isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body), win2 = getWindow(scrollableAncestor);
11291
+ const scrollableAncestor = getNearestOverflowAncestor$1(node2), isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body), win2 = getWindow$1(scrollableAncestor);
11282
11292
  if (isBody) {
11283
- const frameElement = getFrameElement(win2);
11284
- return list2.concat(win2, win2.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
11293
+ const frameElement = getFrameElement$1(win2);
11294
+ return list2.concat(win2, win2.visualViewport || [], isOverflowElement$1(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors$1(frameElement) : []);
11285
11295
  }
11286
- return list2.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
11296
+ return list2.concat(scrollableAncestor, getOverflowAncestors$1(scrollableAncestor, [], traverseIframes));
11287
11297
  }
11288
- function getFrameElement(win2) {
11298
+ function getFrameElement$1(win2) {
11289
11299
  return win2.parent && Object.getPrototypeOf(win2.parent) ? win2.frameElement : null;
11290
11300
  }
11291
- const sides = ["top", "right", "bottom", "left"], alignments = ["start", "end"], placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []), min$1 = Math.min, max$1 = Math.max, round = Math.round, floor = Math.floor, createCoords = (v2) => ({
11301
+ const sides$1 = ["top", "right", "bottom", "left"], min$2 = Math.min, max$2 = Math.max, round$1 = Math.round, floor$1 = Math.floor, createCoords$1 = (v2) => ({
11292
11302
  x: v2,
11293
11303
  y: v2
11294
- }), oppositeSideMap = {
11304
+ }), oppositeSideMap$1 = {
11295
11305
  left: "right",
11296
11306
  right: "left",
11297
11307
  bottom: "top",
@@ -11301,41 +11311,41 @@ const sides = ["top", "right", "bottom", "left"], alignments = ["start", "end"],
11301
11311
  end: "start"
11302
11312
  };
11303
11313
  function clamp$2(start2, value, end) {
11304
- return max$1(start2, min$1(value, end));
11314
+ return max$2(start2, min$2(value, end));
11305
11315
  }
11306
- function evaluate(value, param) {
11316
+ function evaluate$1(value, param) {
11307
11317
  return typeof value == "function" ? value(param) : value;
11308
11318
  }
11309
- function getSide(placement) {
11319
+ function getSide$1(placement) {
11310
11320
  return placement.split("-")[0];
11311
11321
  }
11312
- function getAlignment(placement) {
11322
+ function getAlignment$1(placement) {
11313
11323
  return placement.split("-")[1];
11314
11324
  }
11315
- function getOppositeAxis(axis) {
11325
+ function getOppositeAxis$1(axis) {
11316
11326
  return axis === "x" ? "y" : "x";
11317
11327
  }
11318
- function getAxisLength(axis) {
11328
+ function getAxisLength$1(axis) {
11319
11329
  return axis === "y" ? "height" : "width";
11320
11330
  }
11321
11331
  const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
11322
- function getSideAxis(placement) {
11323
- return yAxisSides.has(getSide(placement)) ? "y" : "x";
11332
+ function getSideAxis$1(placement) {
11333
+ return yAxisSides.has(getSide$1(placement)) ? "y" : "x";
11324
11334
  }
11325
- function getAlignmentAxis(placement) {
11326
- return getOppositeAxis(getSideAxis(placement));
11335
+ function getAlignmentAxis$1(placement) {
11336
+ return getOppositeAxis$1(getSideAxis$1(placement));
11327
11337
  }
11328
- function getAlignmentSides(placement, rects, rtl) {
11338
+ function getAlignmentSides$1(placement, rects, rtl) {
11329
11339
  rtl === void 0 && (rtl = !1);
11330
- const alignment = getAlignment(placement), alignmentAxis = getAlignmentAxis(placement), length = getAxisLength(alignmentAxis);
11340
+ const alignment = getAlignment$1(placement), alignmentAxis = getAlignmentAxis$1(placement), length = getAxisLength$1(alignmentAxis);
11331
11341
  let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
11332
- return rects.reference[length] > rects.floating[length] && (mainAlignmentSide = getOppositePlacement(mainAlignmentSide)), [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
11342
+ return rects.reference[length] > rects.floating[length] && (mainAlignmentSide = getOppositePlacement$1(mainAlignmentSide)), [mainAlignmentSide, getOppositePlacement$1(mainAlignmentSide)];
11333
11343
  }
11334
11344
  function getExpandedPlacements(placement) {
11335
- const oppositePlacement = getOppositePlacement(placement);
11336
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
11345
+ const oppositePlacement = getOppositePlacement$1(placement);
11346
+ return [getOppositeAlignmentPlacement$1(placement), oppositePlacement, getOppositeAlignmentPlacement$1(oppositePlacement)];
11337
11347
  }
11338
- function getOppositeAlignmentPlacement(placement) {
11348
+ function getOppositeAlignmentPlacement$1(placement) {
11339
11349
  return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
11340
11350
  }
11341
11351
  const lrPlacement = ["left", "right"], rlPlacement = ["right", "left"], tbPlacement = ["top", "bottom"], btPlacement = ["bottom", "top"];
@@ -11352,14 +11362,14 @@ function getSideList(side, isStart, rtl) {
11352
11362
  }
11353
11363
  }
11354
11364
  function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
11355
- const alignment = getAlignment(placement);
11356
- let list2 = getSideList(getSide(placement), direction === "start", rtl);
11357
- return alignment && (list2 = list2.map((side) => side + "-" + alignment), flipAlignment && (list2 = list2.concat(list2.map(getOppositeAlignmentPlacement)))), list2;
11365
+ const alignment = getAlignment$1(placement);
11366
+ let list2 = getSideList(getSide$1(placement), direction === "start", rtl);
11367
+ return alignment && (list2 = list2.map((side) => side + "-" + alignment), flipAlignment && (list2 = list2.concat(list2.map(getOppositeAlignmentPlacement$1)))), list2;
11358
11368
  }
11359
- function getOppositePlacement(placement) {
11360
- return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
11369
+ function getOppositePlacement$1(placement) {
11370
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap$1[side]);
11361
11371
  }
11362
- function expandPaddingObject(padding) {
11372
+ function expandPaddingObject$1(padding) {
11363
11373
  return {
11364
11374
  top: 0,
11365
11375
  right: 0,
@@ -11368,15 +11378,15 @@ function expandPaddingObject(padding) {
11368
11378
  ...padding
11369
11379
  };
11370
11380
  }
11371
- function getPaddingObject(padding) {
11372
- return typeof padding != "number" ? expandPaddingObject(padding) : {
11381
+ function getPaddingObject$1(padding) {
11382
+ return typeof padding != "number" ? expandPaddingObject$1(padding) : {
11373
11383
  top: padding,
11374
11384
  right: padding,
11375
11385
  bottom: padding,
11376
11386
  left: padding
11377
11387
  };
11378
11388
  }
11379
- function rectToClientRect(rect) {
11389
+ function rectToClientRect$1(rect) {
11380
11390
  const {
11381
11391
  x: x2,
11382
11392
  y: y2,
@@ -11432,7 +11442,7 @@ function contains(parent, child) {
11432
11442
  const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
11433
11443
  if (parent.contains(child))
11434
11444
  return !0;
11435
- if (rootNode && isShadowRoot(rootNode)) {
11445
+ if (rootNode && isShadowRoot$1(rootNode)) {
11436
11446
  let next = child;
11437
11447
  for (; next; ) {
11438
11448
  if (parent === next)
@@ -11460,7 +11470,7 @@ function getDocument(node2) {
11460
11470
  return node2?.ownerDocument || document;
11461
11471
  }
11462
11472
  function isTypeableElement(element) {
11463
- return isHTMLElement$1(element) && element.matches(TYPEABLE_SELECTOR);
11473
+ return isHTMLElement$2(element) && element.matches(TYPEABLE_SELECTOR);
11464
11474
  }
11465
11475
  function matchesFocusVisible(element) {
11466
11476
  if (!element || isJSDOM()) return !0;
@@ -11509,12 +11519,12 @@ function useEffectEvent(callback) {
11509
11519
  return ref.current == null ? void 0 : ref.current(...args);
11510
11520
  }, []);
11511
11521
  }
11512
- function computeCoordsFromPlacement(_ref, placement, rtl) {
11522
+ function computeCoordsFromPlacement$1(_ref, placement, rtl) {
11513
11523
  let {
11514
11524
  reference,
11515
11525
  floating
11516
11526
  } = _ref;
11517
- const sideAxis = getSideAxis(placement), alignmentAxis = getAlignmentAxis(placement), alignLength = getAxisLength(alignmentAxis), side = getSide(placement), isVertical = sideAxis === "y", commonX = reference.x + reference.width / 2 - floating.width / 2, commonY = reference.y + reference.height / 2 - floating.height / 2, commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
11527
+ const sideAxis = getSideAxis$1(placement), alignmentAxis = getAlignmentAxis$1(placement), alignLength = getAxisLength$1(alignmentAxis), side = getSide$1(placement), isVertical = sideAxis === "y", commonX = reference.x + reference.width / 2 - floating.width / 2, commonY = reference.y + reference.height / 2 - floating.height / 2, commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
11518
11528
  let coords;
11519
11529
  switch (side) {
11520
11530
  case "top":
@@ -11547,7 +11557,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
11547
11557
  y: reference.y
11548
11558
  };
11549
11559
  }
11550
- switch (getAlignment(placement)) {
11560
+ switch (getAlignment$1(placement)) {
11551
11561
  case "start":
11552
11562
  coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
11553
11563
  break;
@@ -11557,7 +11567,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
11557
11567
  }
11558
11568
  return coords;
11559
11569
  }
11560
- async function detectOverflow(state, options) {
11570
+ async function detectOverflow$1(state, options) {
11561
11571
  var _await$platform$isEle;
11562
11572
  options === void 0 && (options = {});
11563
11573
  const {
@@ -11573,7 +11583,7 @@ async function detectOverflow(state, options) {
11573
11583
  elementContext = "floating",
11574
11584
  altBoundary = !1,
11575
11585
  padding = 0
11576
- } = evaluate(options, state), paddingObject = getPaddingObject(padding), element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext], clippingClientRect = rectToClientRect(await platform2.getClippingRect({
11586
+ } = evaluate$1(options, state), paddingObject = getPaddingObject$1(padding), element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext], clippingClientRect = rectToClientRect$1(await platform2.getClippingRect({
11577
11587
  element: (_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) == null || _await$platform$isEle ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
11578
11588
  boundary,
11579
11589
  rootBoundary,
@@ -11589,7 +11599,7 @@ async function detectOverflow(state, options) {
11589
11599
  } : {
11590
11600
  x: 1,
11591
11601
  y: 1
11592
- }, elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
11602
+ }, elementClientRect = rectToClientRect$1(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
11593
11603
  elements,
11594
11604
  rect,
11595
11605
  offsetParent,
@@ -11602,7 +11612,7 @@ async function detectOverflow(state, options) {
11602
11612
  right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
11603
11613
  };
11604
11614
  }
11605
- const computePosition$1 = async (reference, floating, config) => {
11615
+ const computePosition$3 = async (reference, floating, config) => {
11606
11616
  const {
11607
11617
  placement = "bottom",
11608
11618
  strategy = "absolute",
@@ -11616,7 +11626,7 @@ const computePosition$1 = async (reference, floating, config) => {
11616
11626
  }), {
11617
11627
  x: x2,
11618
11628
  y: y2
11619
- } = computeCoordsFromPlacement(rects, placement, rtl), statefulPlacement = placement, middlewareData = {}, resetCount = 0;
11629
+ } = computeCoordsFromPlacement$1(rects, placement, rtl), statefulPlacement = placement, middlewareData = {}, resetCount = 0;
11620
11630
  for (let i2 = 0; i2 < validMiddleware.length; i2++) {
11621
11631
  var _platform$detectOverf;
11622
11632
  const {
@@ -11637,7 +11647,7 @@ const computePosition$1 = async (reference, floating, config) => {
11637
11647
  rects,
11638
11648
  platform: {
11639
11649
  ...platform2,
11640
- detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
11650
+ detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow$1
11641
11651
  },
11642
11652
  elements: {
11643
11653
  reference,
@@ -11657,7 +11667,7 @@ const computePosition$1 = async (reference, floating, config) => {
11657
11667
  }) : reset.rects), {
11658
11668
  x: x2,
11659
11669
  y: y2
11660
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)), i2 = -1);
11670
+ } = computeCoordsFromPlacement$1(rects, statefulPlacement, rtl)), i2 = -1);
11661
11671
  }
11662
11672
  return {
11663
11673
  x: x2,
@@ -11681,16 +11691,16 @@ const computePosition$1 = async (reference, floating, config) => {
11681
11691
  } = state, {
11682
11692
  element,
11683
11693
  padding = 0
11684
- } = evaluate(options, state) || {};
11694
+ } = evaluate$1(options, state) || {};
11685
11695
  if (element == null)
11686
11696
  return {};
11687
- const paddingObject = getPaddingObject(padding), coords = {
11697
+ const paddingObject = getPaddingObject$1(padding), coords = {
11688
11698
  x: x2,
11689
11699
  y: y2
11690
- }, 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));
11700
+ }, axis = getAlignmentAxis$1(placement), length = getAxisLength$1(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));
11691
11701
  let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
11692
11702
  (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) && (clientSize = elements.floating[clientProp] || rects.floating[length]);
11693
- 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$2(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;
11703
+ const centerToReference = endDiff / 2 - startDiff / 2, largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1, minPadding = min$2(paddingObject[minProp], largestPossiblePadding), maxPadding = min$2(paddingObject[maxProp], largestPossiblePadding), min$12 = minPadding, max2 = clientSize - arrowDimensions[length] - maxPadding, center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference, offset2 = clamp$2(min$12, center, max2), shouldAddOffset = !middlewareData.arrow && getAlignment$1(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$12 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0, alignmentOffset = shouldAddOffset ? center < min$12 ? center - min$12 : center - max2 : 0;
11694
11704
  return {
11695
11705
  [axis]: coords[axis] + alignmentOffset,
11696
11706
  data: {
@@ -11703,79 +11713,7 @@ const computePosition$1 = async (reference, floating, config) => {
11703
11713
  reset: shouldAddOffset
11704
11714
  };
11705
11715
  }
11706
- });
11707
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
11708
- return (alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement)).filter((placement) => alignment ? getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : !1) : !0);
11709
- }
11710
- const autoPlacement$1 = function(options) {
11711
- return options === void 0 && (options = {}), {
11712
- name: "autoPlacement",
11713
- options,
11714
- async fn(state) {
11715
- var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
11716
- const {
11717
- rects,
11718
- middlewareData,
11719
- placement,
11720
- platform: platform2,
11721
- elements
11722
- } = state, {
11723
- crossAxis = !1,
11724
- alignment,
11725
- allowedPlacements = placements,
11726
- autoAlignment = !0,
11727
- ...detectOverflowOptions
11728
- } = evaluate(options, state), placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements, overflow = await platform2.detectOverflow(state, detectOverflowOptions), currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0, currentPlacement = placements$1[currentIndex];
11729
- if (currentPlacement == null)
11730
- return {};
11731
- const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
11732
- if (placement !== currentPlacement)
11733
- return {
11734
- reset: {
11735
- placement: placements$1[0]
11736
- }
11737
- };
11738
- const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]], allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
11739
- placement: currentPlacement,
11740
- overflows: currentOverflows
11741
- }], nextPlacement = placements$1[currentIndex + 1];
11742
- if (nextPlacement)
11743
- return {
11744
- data: {
11745
- index: currentIndex + 1,
11746
- overflows: allOverflows
11747
- },
11748
- reset: {
11749
- placement: nextPlacement
11750
- }
11751
- };
11752
- const placementsSortedByMostSpace = allOverflows.map((d2) => {
11753
- const alignment2 = getAlignment(d2.placement);
11754
- return [d2.placement, alignment2 && crossAxis ? (
11755
- // Check along the mainAxis and main crossAxis side.
11756
- d2.overflows.slice(0, 2).reduce((acc, v2) => acc + v2, 0)
11757
- ) : (
11758
- // Check only the mainAxis.
11759
- d2.overflows[0]
11760
- ), d2.overflows];
11761
- }).sort((a2, b2) => a2[1] - b2[1]), resetPlacement = ((_placementsThatFitOnE = placementsSortedByMostSpace.filter((d2) => d2[2].slice(
11762
- 0,
11763
- // Aligned placements should not check their opposite crossAxis
11764
- // side.
11765
- getAlignment(d2[0]) ? 2 : 3
11766
- ).every((v2) => v2 <= 0))[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
11767
- return resetPlacement !== placement ? {
11768
- data: {
11769
- index: currentIndex + 1,
11770
- overflows: allOverflows
11771
- },
11772
- reset: {
11773
- placement: resetPlacement
11774
- }
11775
- } : {};
11776
- }
11777
- };
11778
- }, flip$2 = function(options) {
11716
+ }), flip$2 = function(options) {
11779
11717
  return options === void 0 && (options = {}), {
11780
11718
  name: "flip",
11781
11719
  options,
@@ -11796,15 +11734,15 @@ const autoPlacement$1 = function(options) {
11796
11734
  fallbackAxisSideDirection = "none",
11797
11735
  flipAlignment = !0,
11798
11736
  ...detectOverflowOptions
11799
- } = evaluate(options, state);
11737
+ } = evaluate$1(options, state);
11800
11738
  if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset)
11801
11739
  return {};
11802
- const side = getSide(placement), initialSideAxis = getSideAxis(initialPlacement), isBasePlacement = getSide(initialPlacement) === initialPlacement, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)), hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
11740
+ const side = getSide$1(placement), initialSideAxis = getSideAxis$1(initialPlacement), isBasePlacement = getSide$1(initialPlacement) === initialPlacement, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement)), hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
11803
11741
  !specifiedFallbackPlacements && hasFallbackAxisSideDirection && fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
11804
11742
  const placements2 = [initialPlacement, ...fallbackPlacements], overflow = await platform2.detectOverflow(state, detectOverflowOptions), overflows = [];
11805
11743
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
11806
11744
  if (checkMainAxis && overflows.push(overflow[side]), checkCrossAxis) {
11807
- const sides2 = getAlignmentSides(placement, rects, rtl);
11745
+ const sides2 = getAlignmentSides$1(placement, rects, rtl);
11808
11746
  overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
11809
11747
  }
11810
11748
  if (overflowsData = [...overflowsData, {
@@ -11813,9 +11751,9 @@ const autoPlacement$1 = function(options) {
11813
11751
  }], !overflows.every((side2) => side2 <= 0)) {
11814
11752
  var _middlewareData$flip2, _overflowsData$filter;
11815
11753
  const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1, nextPlacement = placements2[nextIndex];
11816
- if (nextPlacement && (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : !1) || // We leave the current main axis only if every placement on that axis
11754
+ if (nextPlacement && (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis$1(nextPlacement) : !1) || // We leave the current main axis only if every placement on that axis
11817
11755
  // overflows the main axis.
11818
- overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : !0)))
11756
+ overflowsData.every((d2) => getSideAxis$1(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : !0)))
11819
11757
  return {
11820
11758
  data: {
11821
11759
  index: nextIndex,
@@ -11832,7 +11770,7 @@ const autoPlacement$1 = function(options) {
11832
11770
  var _overflowsData$filter2;
11833
11771
  const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
11834
11772
  if (hasFallbackAxisSideDirection) {
11835
- const currentSideAxis = getSideAxis(d2.placement);
11773
+ const currentSideAxis = getSideAxis$1(d2.placement);
11836
11774
  return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
11837
11775
  // reading directions favoring greater width.
11838
11776
  currentSideAxis === "y";
@@ -11857,7 +11795,7 @@ const autoPlacement$1 = function(options) {
11857
11795
  }
11858
11796
  };
11859
11797
  };
11860
- function getSideOffsets(overflow, rect) {
11798
+ function getSideOffsets$1(overflow, rect) {
11861
11799
  return {
11862
11800
  top: overflow.top - rect.height,
11863
11801
  right: overflow.right - rect.width,
@@ -11865,10 +11803,10 @@ function getSideOffsets(overflow, rect) {
11865
11803
  left: overflow.left - rect.width
11866
11804
  };
11867
11805
  }
11868
- function isAnySideFullyClipped(overflow) {
11869
- return sides.some((side) => overflow[side] >= 0);
11806
+ function isAnySideFullyClipped$1(overflow) {
11807
+ return sides$1.some((side) => overflow[side] >= 0);
11870
11808
  }
11871
- const hide$2 = function(options) {
11809
+ const hide$4 = function(options) {
11872
11810
  return options === void 0 && (options = {}), {
11873
11811
  name: "hide",
11874
11812
  options,
@@ -11879,17 +11817,17 @@ const hide$2 = function(options) {
11879
11817
  } = state, {
11880
11818
  strategy = "referenceHidden",
11881
11819
  ...detectOverflowOptions
11882
- } = evaluate(options, state);
11820
+ } = evaluate$1(options, state);
11883
11821
  switch (strategy) {
11884
11822
  case "referenceHidden": {
11885
11823
  const overflow = await platform2.detectOverflow(state, {
11886
11824
  ...detectOverflowOptions,
11887
11825
  elementContext: "reference"
11888
- }), offsets = getSideOffsets(overflow, rects.reference);
11826
+ }), offsets = getSideOffsets$1(overflow, rects.reference);
11889
11827
  return {
11890
11828
  data: {
11891
11829
  referenceHiddenOffsets: offsets,
11892
- referenceHidden: isAnySideFullyClipped(offsets)
11830
+ referenceHidden: isAnySideFullyClipped$1(offsets)
11893
11831
  }
11894
11832
  };
11895
11833
  }
@@ -11897,11 +11835,11 @@ const hide$2 = function(options) {
11897
11835
  const overflow = await platform2.detectOverflow(state, {
11898
11836
  ...detectOverflowOptions,
11899
11837
  altBoundary: !0
11900
- }), offsets = getSideOffsets(overflow, rects.floating);
11838
+ }), offsets = getSideOffsets$1(overflow, rects.floating);
11901
11839
  return {
11902
11840
  data: {
11903
11841
  escapedOffsets: offsets,
11904
- escaped: isAnySideFullyClipped(offsets)
11842
+ escaped: isAnySideFullyClipped$1(offsets)
11905
11843
  }
11906
11844
  };
11907
11845
  }
@@ -11912,7 +11850,7 @@ const hide$2 = function(options) {
11912
11850
  };
11913
11851
  };
11914
11852
  function getBoundingRect(rects) {
11915
- const minX = min$1(...rects.map((rect) => rect.left)), minY = min$1(...rects.map((rect) => rect.top)), maxX = max$1(...rects.map((rect) => rect.right)), maxY = max$1(...rects.map((rect) => rect.bottom));
11853
+ const minX = min$2(...rects.map((rect) => rect.left)), minY = min$2(...rects.map((rect) => rect.top)), maxX = max$2(...rects.map((rect) => rect.right)), maxY = max$2(...rects.map((rect) => rect.bottom));
11916
11854
  return {
11917
11855
  x: minX,
11918
11856
  y: minY,
@@ -11927,7 +11865,7 @@ function getRectsByLine(rects) {
11927
11865
  const rect = sortedRects[i2];
11928
11866
  !prevRect || rect.y - prevRect.y > prevRect.height / 2 ? groups.push([rect]) : groups[groups.length - 1].push(rect), prevRect = rect;
11929
11867
  }
11930
- return groups.map((rect) => rectToClientRect(getBoundingRect(rect)));
11868
+ return groups.map((rect) => rectToClientRect$1(getBoundingRect(rect)));
11931
11869
  }
11932
11870
  const inline$2 = function(options) {
11933
11871
  return options === void 0 && (options = {}), {
@@ -11944,13 +11882,13 @@ const inline$2 = function(options) {
11944
11882
  padding = 2,
11945
11883
  x: x2,
11946
11884
  y: y2
11947
- } = evaluate(options, state), nativeClientRects = Array.from(await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference)) || []), clientRects = getRectsByLine(nativeClientRects), fallback = rectToClientRect(getBoundingRect(nativeClientRects)), paddingObject = getPaddingObject(padding);
11885
+ } = evaluate$1(options, state), nativeClientRects = Array.from(await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference)) || []), clientRects = getRectsByLine(nativeClientRects), fallback = rectToClientRect$1(getBoundingRect(nativeClientRects)), paddingObject = getPaddingObject$1(padding);
11948
11886
  function getBoundingClientRect2() {
11949
11887
  if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x2 != null && y2 != null)
11950
11888
  return clientRects.find((rect) => x2 > rect.left - paddingObject.left && x2 < rect.right + paddingObject.right && y2 > rect.top - paddingObject.top && y2 < rect.bottom + paddingObject.bottom) || fallback;
11951
11889
  if (clientRects.length >= 2) {
11952
- if (getSideAxis(placement) === "y") {
11953
- const firstRect = clientRects[0], lastRect = clientRects[clientRects.length - 1], isTop = getSide(placement) === "top", top2 = firstRect.top, bottom2 = lastRect.bottom, left2 = isTop ? firstRect.left : lastRect.left, right2 = isTop ? firstRect.right : lastRect.right, width2 = right2 - left2, height2 = bottom2 - top2;
11890
+ if (getSideAxis$1(placement) === "y") {
11891
+ const firstRect = clientRects[0], lastRect = clientRects[clientRects.length - 1], isTop = getSide$1(placement) === "top", top2 = firstRect.top, bottom2 = lastRect.bottom, left2 = isTop ? firstRect.left : lastRect.left, right2 = isTop ? firstRect.right : lastRect.right, width2 = right2 - left2, height2 = bottom2 - top2;
11954
11892
  return {
11955
11893
  top: top2,
11956
11894
  bottom: bottom2,
@@ -11962,7 +11900,7 @@ const inline$2 = function(options) {
11962
11900
  y: top2
11963
11901
  };
11964
11902
  }
11965
- const isLeftSide = getSide(placement) === "left", maxRight = max$1(...clientRects.map((rect) => rect.right)), minLeft = min$1(...clientRects.map((rect) => rect.left)), measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight), top = measureRects[0].top, bottom = measureRects[measureRects.length - 1].bottom, left = minLeft, right = maxRight, width = right - left, height = bottom - top;
11903
+ const isLeftSide = getSide$1(placement) === "left", maxRight = max$2(...clientRects.map((rect) => rect.right)), minLeft = min$2(...clientRects.map((rect) => rect.left)), measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight), top = measureRects[0].top, bottom = measureRects[measureRects.length - 1].bottom, left = minLeft, right = maxRight, width = right - left, height = bottom - top;
11966
11904
  return {
11967
11905
  top,
11968
11906
  bottom,
@@ -11990,13 +11928,13 @@ const inline$2 = function(options) {
11990
11928
  } : {};
11991
11929
  }
11992
11930
  };
11993
- }, originSides = /* @__PURE__ */ new Set(["left", "top"]);
11994
- async function convertValueToCoords(state, options) {
11931
+ }, originSides$1 = /* @__PURE__ */ new Set(["left", "top"]);
11932
+ async function convertValueToCoords$1(state, options) {
11995
11933
  const {
11996
11934
  placement,
11997
11935
  platform: platform2,
11998
11936
  elements
11999
- } = state, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), side = getSide(placement), alignment = getAlignment(placement), isVertical = getSideAxis(placement) === "y", mainAxisMulti = originSides.has(side) ? -1 : 1, crossAxisMulti = rtl && isVertical ? -1 : 1, rawValue = evaluate(options, state);
11937
+ } = state, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), side = getSide$1(placement), alignment = getAlignment$1(placement), isVertical = getSideAxis$1(placement) === "y", mainAxisMulti = originSides$1.has(side) ? -1 : 1, crossAxisMulti = rtl && isVertical ? -1 : 1, rawValue = evaluate$1(options, state);
12000
11938
  let {
12001
11939
  mainAxis,
12002
11940
  crossAxis,
@@ -12018,7 +11956,7 @@ async function convertValueToCoords(state, options) {
12018
11956
  y: crossAxis * crossAxisMulti
12019
11957
  };
12020
11958
  }
12021
- const offset$2 = function(options) {
11959
+ const offset$4 = function(options) {
12022
11960
  return options === void 0 && (options = 0), {
12023
11961
  name: "offset",
12024
11962
  options,
@@ -12029,7 +11967,7 @@ const offset$2 = function(options) {
12029
11967
  y: y2,
12030
11968
  placement,
12031
11969
  middlewareData
12032
- } = state, diffCoords = await convertValueToCoords(state, options);
11970
+ } = state, diffCoords = await convertValueToCoords$1(state, options);
12033
11971
  return placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset ? {} : {
12034
11972
  x: x2 + diffCoords.x,
12035
11973
  y: y2 + diffCoords.y,
@@ -12066,10 +12004,10 @@ const offset$2 = function(options) {
12066
12004
  }
12067
12005
  },
12068
12006
  ...detectOverflowOptions
12069
- } = evaluate(options, state), coords = {
12007
+ } = evaluate$1(options, state), coords = {
12070
12008
  x: x2,
12071
12009
  y: y2
12072
- }, overflow = await platform2.detectOverflow(state, detectOverflowOptions), crossAxis = getSideAxis(getSide(placement)), mainAxis = getOppositeAxis(crossAxis);
12010
+ }, overflow = await platform2.detectOverflow(state, detectOverflowOptions), crossAxis = getSideAxis$1(getSide$1(placement)), mainAxis = getOppositeAxis$1(crossAxis);
12073
12011
  let mainAxisCoord = coords[mainAxis], crossAxisCoord = coords[crossAxis];
12074
12012
  if (checkMainAxis) {
12075
12013
  const minSide = mainAxis === "y" ? "top" : "left", maxSide = mainAxis === "y" ? "bottom" : "right", min2 = mainAxisCoord + overflow[minSide], max2 = mainAxisCoord - overflow[maxSide];
@@ -12111,12 +12049,12 @@ const offset$2 = function(options) {
12111
12049
  offset: offset2 = 0,
12112
12050
  mainAxis: checkMainAxis = !0,
12113
12051
  crossAxis: checkCrossAxis = !0
12114
- } = evaluate(options, state), coords = {
12052
+ } = evaluate$1(options, state), coords = {
12115
12053
  x: x2,
12116
12054
  y: y2
12117
- }, crossAxis = getSideAxis(placement), mainAxis = getOppositeAxis(crossAxis);
12055
+ }, crossAxis = getSideAxis$1(placement), mainAxis = getOppositeAxis$1(crossAxis);
12118
12056
  let mainAxisCoord = coords[mainAxis], crossAxisCoord = coords[crossAxis];
12119
- const rawOffset = evaluate(offset2, state), computedOffset = typeof rawOffset == "number" ? {
12057
+ const rawOffset = evaluate$1(offset2, state), computedOffset = typeof rawOffset == "number" ? {
12120
12058
  mainAxis: rawOffset,
12121
12059
  crossAxis: 0
12122
12060
  } : {
@@ -12130,7 +12068,7 @@ const offset$2 = function(options) {
12130
12068
  }
12131
12069
  if (checkCrossAxis) {
12132
12070
  var _middlewareData$offse, _middlewareData$offse2;
12133
- const len = mainAxis === "y" ? "width" : "height", isOriginSide = originSides.has(getSide(placement)), limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide && ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0) + (isOriginSide ? 0 : computedOffset.crossAxis), limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
12071
+ const len = mainAxis === "y" ? "width" : "height", isOriginSide = originSides$1.has(getSide$1(placement)), limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide && ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0) + (isOriginSide ? 0 : computedOffset.crossAxis), limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
12134
12072
  crossAxisCoord < limitMin ? crossAxisCoord = limitMin : crossAxisCoord > limitMax && (crossAxisCoord = limitMax);
12135
12073
  }
12136
12074
  return {
@@ -12139,7 +12077,7 @@ const offset$2 = function(options) {
12139
12077
  };
12140
12078
  }
12141
12079
  };
12142
- }, size$2 = function(options) {
12080
+ }, size$4 = function(options) {
12143
12081
  return options === void 0 && (options = {}), {
12144
12082
  name: "size",
12145
12083
  options,
@@ -12154,17 +12092,17 @@ const offset$2 = function(options) {
12154
12092
  apply = () => {
12155
12093
  },
12156
12094
  ...detectOverflowOptions
12157
- } = evaluate(options, state), overflow = await platform2.detectOverflow(state, detectOverflowOptions), side = getSide(placement), alignment = getAlignment(placement), isYAxis = getSideAxis(placement) === "y", {
12095
+ } = evaluate$1(options, state), overflow = await platform2.detectOverflow(state, detectOverflowOptions), side = getSide$1(placement), alignment = getAlignment$1(placement), isYAxis = getSideAxis$1(placement) === "y", {
12158
12096
  width,
12159
12097
  height
12160
12098
  } = rects.floating;
12161
12099
  let heightSide, widthSide;
12162
12100
  side === "top" || side === "bottom" ? (heightSide = side, widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right") : (widthSide = side, heightSide = alignment === "end" ? "top" : "bottom");
12163
- const maximumClippingHeight = height - overflow.top - overflow.bottom, maximumClippingWidth = width - overflow.left - overflow.right, overflowAvailableHeight = min$1(height - overflow[heightSide], maximumClippingHeight), overflowAvailableWidth = min$1(width - overflow[widthSide], maximumClippingWidth), noShift = !state.middlewareData.shift;
12101
+ const maximumClippingHeight = height - overflow.top - overflow.bottom, maximumClippingWidth = width - overflow.left - overflow.right, overflowAvailableHeight = min$2(height - overflow[heightSide], maximumClippingHeight), overflowAvailableWidth = min$2(width - overflow[widthSide], maximumClippingWidth), noShift = !state.middlewareData.shift;
12164
12102
  let availableHeight = overflowAvailableHeight, availableWidth = overflowAvailableWidth;
12165
12103
  if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x && (availableWidth = maximumClippingWidth), (_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y && (availableHeight = maximumClippingHeight), noShift && !alignment) {
12166
- const xMin = max$1(overflow.left, 0), xMax = max$1(overflow.right, 0), yMin = max$1(overflow.top, 0), yMax = max$1(overflow.bottom, 0);
12167
- isYAxis ? availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
12104
+ const xMin = max$2(overflow.left, 0), xMax = max$2(overflow.right, 0), yMin = max$2(overflow.top, 0), yMax = max$2(overflow.bottom, 0);
12105
+ isYAxis ? availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$2(overflow.left, overflow.right)) : availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$2(overflow.top, overflow.bottom));
12168
12106
  }
12169
12107
  await apply({
12170
12108
  ...state,
@@ -12180,98 +12118,98 @@ const offset$2 = function(options) {
12180
12118
  }
12181
12119
  };
12182
12120
  };
12183
- function getCssDimensions(element) {
12184
- const css2 = getComputedStyle$2(element);
12121
+ function getCssDimensions$1(element) {
12122
+ const css2 = getComputedStyle$3(element);
12185
12123
  let width = parseFloat(css2.width) || 0, height = parseFloat(css2.height) || 0;
12186
- const hasOffset = isHTMLElement$1(element), offsetWidth = hasOffset ? element.offsetWidth : width, offsetHeight = hasOffset ? element.offsetHeight : height, shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
12124
+ const hasOffset = isHTMLElement$2(element), offsetWidth = hasOffset ? element.offsetWidth : width, offsetHeight = hasOffset ? element.offsetHeight : height, shouldFallback = round$1(width) !== offsetWidth || round$1(height) !== offsetHeight;
12187
12125
  return shouldFallback && (width = offsetWidth, height = offsetHeight), {
12188
12126
  width,
12189
12127
  height,
12190
12128
  $: shouldFallback
12191
12129
  };
12192
12130
  }
12193
- function unwrapElement(element) {
12194
- return isElement(element) ? element : element.contextElement;
12131
+ function unwrapElement$1(element) {
12132
+ return isElement$1(element) ? element : element.contextElement;
12195
12133
  }
12196
- function getScale(element) {
12197
- const domElement = unwrapElement(element);
12198
- if (!isHTMLElement$1(domElement))
12199
- return createCoords(1);
12134
+ function getScale$1(element) {
12135
+ const domElement = unwrapElement$1(element);
12136
+ if (!isHTMLElement$2(domElement))
12137
+ return createCoords$1(1);
12200
12138
  const rect = domElement.getBoundingClientRect(), {
12201
12139
  width,
12202
12140
  height,
12203
12141
  $
12204
- } = getCssDimensions(domElement);
12205
- let x2 = ($ ? round(rect.width) : rect.width) / width, y2 = ($ ? round(rect.height) : rect.height) / height;
12142
+ } = getCssDimensions$1(domElement);
12143
+ let x2 = ($ ? round$1(rect.width) : rect.width) / width, y2 = ($ ? round$1(rect.height) : rect.height) / height;
12206
12144
  return (!x2 || !Number.isFinite(x2)) && (x2 = 1), (!y2 || !Number.isFinite(y2)) && (y2 = 1), {
12207
12145
  x: x2,
12208
12146
  y: y2
12209
12147
  };
12210
12148
  }
12211
- const noOffsets = /* @__PURE__ */ createCoords(0);
12212
- function getVisualOffsets(element) {
12213
- const win2 = getWindow(element);
12214
- return !isWebKit() || !win2.visualViewport ? noOffsets : {
12149
+ const noOffsets$1 = /* @__PURE__ */ createCoords$1(0);
12150
+ function getVisualOffsets$1(element) {
12151
+ const win2 = getWindow$1(element);
12152
+ return !isWebKit$1() || !win2.visualViewport ? noOffsets$1 : {
12215
12153
  x: win2.visualViewport.offsetLeft,
12216
12154
  y: win2.visualViewport.offsetTop
12217
12155
  };
12218
12156
  }
12219
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
12220
- return isFixed === void 0 && (isFixed = !1), !floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element) ? !1 : isFixed;
12157
+ function shouldAddVisualOffsets$1(element, isFixed, floatingOffsetParent) {
12158
+ return isFixed === void 0 && (isFixed = !1), !floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow$1(element) ? !1 : isFixed;
12221
12159
  }
12222
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
12160
+ function getBoundingClientRect$1(element, includeScale, isFixedStrategy, offsetParent) {
12223
12161
  includeScale === void 0 && (includeScale = !1), isFixedStrategy === void 0 && (isFixedStrategy = !1);
12224
- const clientRect = element.getBoundingClientRect(), domElement = unwrapElement(element);
12225
- let scale2 = createCoords(1);
12226
- includeScale && (offsetParent ? isElement(offsetParent) && (scale2 = getScale(offsetParent)) : scale2 = getScale(element));
12227
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
12162
+ const clientRect = element.getBoundingClientRect(), domElement = unwrapElement$1(element);
12163
+ let scale2 = createCoords$1(1);
12164
+ includeScale && (offsetParent ? isElement$1(offsetParent) && (scale2 = getScale$1(offsetParent)) : scale2 = getScale$1(element));
12165
+ const visualOffsets = shouldAddVisualOffsets$1(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets$1(domElement) : createCoords$1(0);
12228
12166
  let x2 = (clientRect.left + visualOffsets.x) / scale2.x, y2 = (clientRect.top + visualOffsets.y) / scale2.y, width = clientRect.width / scale2.x, height = clientRect.height / scale2.y;
12229
12167
  if (domElement) {
12230
- const win2 = getWindow(domElement), offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
12231
- let currentWin = win2, currentIFrame = getFrameElement(currentWin);
12168
+ const win2 = getWindow$1(domElement), offsetWin = offsetParent && isElement$1(offsetParent) ? getWindow$1(offsetParent) : offsetParent;
12169
+ let currentWin = win2, currentIFrame = getFrameElement$1(currentWin);
12232
12170
  for (; currentIFrame && offsetParent && offsetWin !== currentWin; ) {
12233
- const iframeScale = getScale(currentIFrame), iframeRect = currentIFrame.getBoundingClientRect(), css2 = getComputedStyle$2(currentIFrame), left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x, top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
12234
- x2 *= iframeScale.x, y2 *= iframeScale.y, width *= iframeScale.x, height *= iframeScale.y, x2 += left, y2 += top, currentWin = getWindow(currentIFrame), currentIFrame = getFrameElement(currentWin);
12171
+ const iframeScale = getScale$1(currentIFrame), iframeRect = currentIFrame.getBoundingClientRect(), css2 = getComputedStyle$3(currentIFrame), left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x, top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
12172
+ x2 *= iframeScale.x, y2 *= iframeScale.y, width *= iframeScale.x, height *= iframeScale.y, x2 += left, y2 += top, currentWin = getWindow$1(currentIFrame), currentIFrame = getFrameElement$1(currentWin);
12235
12173
  }
12236
12174
  }
12237
- return rectToClientRect({
12175
+ return rectToClientRect$1({
12238
12176
  width,
12239
12177
  height,
12240
12178
  x: x2,
12241
12179
  y: y2
12242
12180
  });
12243
12181
  }
12244
- function getWindowScrollBarX(element, rect) {
12245
- const leftScroll = getNodeScroll(element).scrollLeft;
12246
- return rect ? rect.left + leftScroll : getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
12182
+ function getWindowScrollBarX$1(element, rect) {
12183
+ const leftScroll = getNodeScroll$1(element).scrollLeft;
12184
+ return rect ? rect.left + leftScroll : getBoundingClientRect$1(getDocumentElement$1(element)).left + leftScroll;
12247
12185
  }
12248
- function getHTMLOffset(documentElement, scroll) {
12249
- const htmlRect = documentElement.getBoundingClientRect(), x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect), y2 = htmlRect.top + scroll.scrollTop;
12186
+ function getHTMLOffset$1(documentElement, scroll) {
12187
+ const htmlRect = documentElement.getBoundingClientRect(), x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX$1(documentElement, htmlRect), y2 = htmlRect.top + scroll.scrollTop;
12250
12188
  return {
12251
12189
  x: x2,
12252
12190
  y: y2
12253
12191
  };
12254
12192
  }
12255
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
12193
+ function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
12256
12194
  let {
12257
12195
  elements,
12258
12196
  rect,
12259
12197
  offsetParent,
12260
12198
  strategy
12261
12199
  } = _ref;
12262
- const isFixed = strategy === "fixed", documentElement = getDocumentElement(offsetParent), topLayer = elements ? isTopLayer(elements.floating) : !1;
12200
+ const isFixed = strategy === "fixed", documentElement = getDocumentElement$1(offsetParent), topLayer = elements ? isTopLayer$1(elements.floating) : !1;
12263
12201
  if (offsetParent === documentElement || topLayer && isFixed)
12264
12202
  return rect;
12265
12203
  let scroll = {
12266
12204
  scrollLeft: 0,
12267
12205
  scrollTop: 0
12268
- }, scale2 = createCoords(1);
12269
- const offsets = createCoords(0), isOffsetParentAnElement = isHTMLElement$1(offsetParent);
12270
- if ((isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) && ((getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) && (scroll = getNodeScroll(offsetParent)), isHTMLElement$1(offsetParent))) {
12271
- const offsetRect = getBoundingClientRect(offsetParent);
12272
- scale2 = getScale(offsetParent), offsets.x = offsetRect.x + offsetParent.clientLeft, offsets.y = offsetRect.y + offsetParent.clientTop;
12206
+ }, scale2 = createCoords$1(1);
12207
+ const offsets = createCoords$1(0), isOffsetParentAnElement = isHTMLElement$2(offsetParent);
12208
+ if ((isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) && ((getNodeName$1(offsetParent) !== "body" || isOverflowElement$1(documentElement)) && (scroll = getNodeScroll$1(offsetParent)), isHTMLElement$2(offsetParent))) {
12209
+ const offsetRect = getBoundingClientRect$1(offsetParent);
12210
+ scale2 = getScale$1(offsetParent), offsets.x = offsetRect.x + offsetParent.clientLeft, offsets.y = offsetRect.y + offsetParent.clientTop;
12273
12211
  }
12274
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
12212
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset$1(documentElement, scroll) : createCoords$1(0);
12275
12213
  return {
12276
12214
  width: rect.width * scale2.x,
12277
12215
  height: rect.height * scale2.y,
@@ -12279,34 +12217,34 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
12279
12217
  y: rect.y * scale2.y - scroll.scrollTop * scale2.y + offsets.y + htmlOffset.y
12280
12218
  };
12281
12219
  }
12282
- function getClientRects(element) {
12220
+ function getClientRects$1(element) {
12283
12221
  return Array.from(element.getClientRects());
12284
12222
  }
12285
- function getDocumentRect(element) {
12286
- const html = getDocumentElement(element), scroll = getNodeScroll(element), body2 = element.ownerDocument.body, width = max$1(html.scrollWidth, html.clientWidth, body2.scrollWidth, body2.clientWidth), height = max$1(html.scrollHeight, html.clientHeight, body2.scrollHeight, body2.clientHeight);
12287
- let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
12223
+ function getDocumentRect$1(element) {
12224
+ const html = getDocumentElement$1(element), scroll = getNodeScroll$1(element), body = element.ownerDocument.body, width = max$2(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth), height = max$2(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
12225
+ let x2 = -scroll.scrollLeft + getWindowScrollBarX$1(element);
12288
12226
  const y2 = -scroll.scrollTop;
12289
- return getComputedStyle$2(body2).direction === "rtl" && (x2 += max$1(html.clientWidth, body2.clientWidth) - width), {
12227
+ return getComputedStyle$3(body).direction === "rtl" && (x2 += max$2(html.clientWidth, body.clientWidth) - width), {
12290
12228
  width,
12291
12229
  height,
12292
12230
  x: x2,
12293
12231
  y: y2
12294
12232
  };
12295
12233
  }
12296
- const SCROLLBAR_MAX = 25;
12297
- function getViewportRect(element, strategy) {
12298
- const win2 = getWindow(element), html = getDocumentElement(element), visualViewport = win2.visualViewport;
12234
+ const SCROLLBAR_MAX$1 = 25;
12235
+ function getViewportRect$1(element, strategy) {
12236
+ const win2 = getWindow$1(element), html = getDocumentElement$1(element), visualViewport = win2.visualViewport;
12299
12237
  let width = html.clientWidth, height = html.clientHeight, x2 = 0, y2 = 0;
12300
12238
  if (visualViewport) {
12301
12239
  width = visualViewport.width, height = visualViewport.height;
12302
- const visualViewportBased = isWebKit();
12240
+ const visualViewportBased = isWebKit$1();
12303
12241
  (!visualViewportBased || visualViewportBased && strategy === "fixed") && (x2 = visualViewport.offsetLeft, y2 = visualViewport.offsetTop);
12304
12242
  }
12305
- const windowScrollbarX = getWindowScrollBarX(html);
12243
+ const windowScrollbarX = getWindowScrollBarX$1(html);
12306
12244
  if (windowScrollbarX <= 0) {
12307
- const doc = html.ownerDocument, body2 = doc.body, bodyStyles = getComputedStyle(body2), bodyMarginInline = doc.compatMode === "CSS1Compat" && parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0, clippingStableScrollbarWidth = Math.abs(html.clientWidth - body2.clientWidth - bodyMarginInline);
12308
- clippingStableScrollbarWidth <= SCROLLBAR_MAX && (width -= clippingStableScrollbarWidth);
12309
- } else windowScrollbarX <= SCROLLBAR_MAX && (width += windowScrollbarX);
12245
+ const doc = html.ownerDocument, body = doc.body, bodyStyles = getComputedStyle(body), bodyMarginInline = doc.compatMode === "CSS1Compat" && parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0, clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
12246
+ clippingStableScrollbarWidth <= SCROLLBAR_MAX$1 && (width -= clippingStableScrollbarWidth);
12247
+ } else windowScrollbarX <= SCROLLBAR_MAX$1 && (width += windowScrollbarX);
12310
12248
  return {
12311
12249
  width,
12312
12250
  height,
@@ -12315,8 +12253,8 @@ function getViewportRect(element, strategy) {
12315
12253
  };
12316
12254
  }
12317
12255
  const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
12318
- function getInnerBoundingClientRect(element, strategy) {
12319
- const clientRect = getBoundingClientRect(element, !0, strategy === "fixed"), top = clientRect.top + element.clientTop, left = clientRect.left + element.clientLeft, scale2 = isHTMLElement$1(element) ? getScale(element) : createCoords(1), width = element.clientWidth * scale2.x, height = element.clientHeight * scale2.y, x2 = left * scale2.x, y2 = top * scale2.y;
12256
+ function getInnerBoundingClientRect$1(element, strategy) {
12257
+ const clientRect = getBoundingClientRect$1(element, !0, strategy === "fixed"), top = clientRect.top + element.clientTop, left = clientRect.left + element.clientLeft, scale2 = isHTMLElement$2(element) ? getScale$1(element) : createCoords$1(1), width = element.clientWidth * scale2.x, height = element.clientHeight * scale2.y, x2 = left * scale2.x, y2 = top * scale2.y;
12320
12258
  return {
12321
12259
  width,
12322
12260
  height,
@@ -12324,16 +12262,16 @@ function getInnerBoundingClientRect(element, strategy) {
12324
12262
  y: y2
12325
12263
  };
12326
12264
  }
12327
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
12265
+ function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy) {
12328
12266
  let rect;
12329
12267
  if (clippingAncestor === "viewport")
12330
- rect = getViewportRect(element, strategy);
12268
+ rect = getViewportRect$1(element, strategy);
12331
12269
  else if (clippingAncestor === "document")
12332
- rect = getDocumentRect(getDocumentElement(element));
12333
- else if (isElement(clippingAncestor))
12334
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
12270
+ rect = getDocumentRect$1(getDocumentElement$1(element));
12271
+ else if (isElement$1(clippingAncestor))
12272
+ rect = getInnerBoundingClientRect$1(clippingAncestor, strategy);
12335
12273
  else {
12336
- const visualOffsets = getVisualOffsets(element);
12274
+ const visualOffsets = getVisualOffsets$1(element);
12337
12275
  rect = {
12338
12276
  x: clippingAncestor.x - visualOffsets.x,
12339
12277
  y: clippingAncestor.y - visualOffsets.y,
@@ -12341,36 +12279,36 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
12341
12279
  height: clippingAncestor.height
12342
12280
  };
12343
12281
  }
12344
- return rectToClientRect(rect);
12282
+ return rectToClientRect$1(rect);
12345
12283
  }
12346
- function hasFixedPositionAncestor(element, stopNode) {
12347
- const parentNode = getParentNode(element);
12348
- return parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode) ? !1 : getComputedStyle$2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
12284
+ function hasFixedPositionAncestor$1(element, stopNode) {
12285
+ const parentNode = getParentNode$1(element);
12286
+ return parentNode === stopNode || !isElement$1(parentNode) || isLastTraversableNode$1(parentNode) ? !1 : getComputedStyle$3(parentNode).position === "fixed" || hasFixedPositionAncestor$1(parentNode, stopNode);
12349
12287
  }
12350
- function getClippingElementAncestors(element, cache) {
12288
+ function getClippingElementAncestors$1(element, cache) {
12351
12289
  const cachedResult = cache.get(element);
12352
12290
  if (cachedResult)
12353
12291
  return cachedResult;
12354
- let result = getOverflowAncestors(element, [], !1).filter((el) => isElement(el) && getNodeName(el) !== "body"), currentContainingBlockComputedStyle = null;
12355
- const elementIsFixed = getComputedStyle$2(element).position === "fixed";
12356
- let currentNode = elementIsFixed ? getParentNode(element) : element;
12357
- for (; isElement(currentNode) && !isLastTraversableNode(currentNode); ) {
12358
- const computedStyle = getComputedStyle$2(currentNode), currentNodeIsContaining = isContainingBlock(currentNode);
12359
- !currentNodeIsContaining && computedStyle.position === "fixed" && (currentContainingBlockComputedStyle = null), (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) ? result = result.filter((ancestor) => ancestor !== currentNode) : currentContainingBlockComputedStyle = computedStyle, currentNode = getParentNode(currentNode);
12292
+ let result = getOverflowAncestors$1(element, [], !1).filter((el) => isElement$1(el) && getNodeName$1(el) !== "body"), currentContainingBlockComputedStyle = null;
12293
+ const elementIsFixed = getComputedStyle$3(element).position === "fixed";
12294
+ let currentNode = elementIsFixed ? getParentNode$1(element) : element;
12295
+ for (; isElement$1(currentNode) && !isLastTraversableNode$1(currentNode); ) {
12296
+ const computedStyle = getComputedStyle$3(currentNode), currentNodeIsContaining = isContainingBlock$1(currentNode);
12297
+ !currentNodeIsContaining && computedStyle.position === "fixed" && (currentContainingBlockComputedStyle = null), (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement$1(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor$1(element, currentNode)) ? result = result.filter((ancestor) => ancestor !== currentNode) : currentContainingBlockComputedStyle = computedStyle, currentNode = getParentNode$1(currentNode);
12360
12298
  }
12361
12299
  return cache.set(element, result), result;
12362
12300
  }
12363
- function getClippingRect(_ref) {
12301
+ function getClippingRect$1(_ref) {
12364
12302
  let {
12365
12303
  element,
12366
12304
  boundary,
12367
12305
  rootBoundary,
12368
12306
  strategy
12369
12307
  } = _ref;
12370
- const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary], firstClippingAncestor = clippingAncestors[0], clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
12371
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
12372
- return accRect.top = max$1(rect.top, accRect.top), accRect.right = min$1(rect.right, accRect.right), accRect.bottom = min$1(rect.bottom, accRect.bottom), accRect.left = max$1(rect.left, accRect.left), accRect;
12373
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
12308
+ const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer$1(element) ? [] : getClippingElementAncestors$1(element, this._c) : [].concat(boundary), rootBoundary], firstClippingAncestor = clippingAncestors[0], clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
12309
+ const rect = getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy);
12310
+ return accRect.top = max$2(rect.top, accRect.top), accRect.right = min$2(rect.right, accRect.right), accRect.bottom = min$2(rect.bottom, accRect.bottom), accRect.left = max$2(rect.left, accRect.left), accRect;
12311
+ }, getClientRectFromClippingAncestor$1(element, firstClippingAncestor, strategy));
12374
12312
  return {
12375
12313
  width: clippingRect.right - clippingRect.left,
12376
12314
  height: clippingRect.bottom - clippingRect.top,
@@ -12378,33 +12316,33 @@ function getClippingRect(_ref) {
12378
12316
  y: clippingRect.top
12379
12317
  };
12380
12318
  }
12381
- function getDimensions(element) {
12319
+ function getDimensions$1(element) {
12382
12320
  const {
12383
12321
  width,
12384
12322
  height
12385
- } = getCssDimensions(element);
12323
+ } = getCssDimensions$1(element);
12386
12324
  return {
12387
12325
  width,
12388
12326
  height
12389
12327
  };
12390
12328
  }
12391
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
12392
- const isOffsetParentAnElement = isHTMLElement$1(offsetParent), documentElement = getDocumentElement(offsetParent), isFixed = strategy === "fixed", rect = getBoundingClientRect(element, !0, isFixed, offsetParent);
12329
+ function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
12330
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent), documentElement = getDocumentElement$1(offsetParent), isFixed = strategy === "fixed", rect = getBoundingClientRect$1(element, !0, isFixed, offsetParent);
12393
12331
  let scroll = {
12394
12332
  scrollLeft: 0,
12395
12333
  scrollTop: 0
12396
12334
  };
12397
- const offsets = createCoords(0);
12335
+ const offsets = createCoords$1(0);
12398
12336
  function setLeftRTLScrollbarOffset() {
12399
- offsets.x = getWindowScrollBarX(documentElement);
12337
+ offsets.x = getWindowScrollBarX$1(documentElement);
12400
12338
  }
12401
12339
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed)
12402
- if ((getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) && (scroll = getNodeScroll(offsetParent)), isOffsetParentAnElement) {
12403
- const offsetRect = getBoundingClientRect(offsetParent, !0, isFixed, offsetParent);
12340
+ if ((getNodeName$1(offsetParent) !== "body" || isOverflowElement$1(documentElement)) && (scroll = getNodeScroll$1(offsetParent)), isOffsetParentAnElement) {
12341
+ const offsetRect = getBoundingClientRect$1(offsetParent, !0, isFixed, offsetParent);
12404
12342
  offsets.x = offsetRect.x + offsetParent.clientLeft, offsets.y = offsetRect.y + offsetParent.clientTop;
12405
12343
  } else documentElement && setLeftRTLScrollbarOffset();
12406
12344
  isFixed && !isOffsetParentAnElement && documentElement && setLeftRTLScrollbarOffset();
12407
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0), x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x, y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
12345
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset$1(documentElement, scroll) : createCoords$1(0), x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x, y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
12408
12346
  return {
12409
12347
  x: x2,
12410
12348
  y: y2,
@@ -12412,39 +12350,39 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
12412
12350
  height: rect.height
12413
12351
  };
12414
12352
  }
12415
- function isStaticPositioned(element) {
12416
- return getComputedStyle$2(element).position === "static";
12353
+ function isStaticPositioned$1(element) {
12354
+ return getComputedStyle$3(element).position === "static";
12417
12355
  }
12418
- function getTrueOffsetParent(element, polyfill) {
12419
- if (!isHTMLElement$1(element) || getComputedStyle$2(element).position === "fixed")
12356
+ function getTrueOffsetParent$1(element, polyfill) {
12357
+ if (!isHTMLElement$2(element) || getComputedStyle$3(element).position === "fixed")
12420
12358
  return null;
12421
12359
  if (polyfill)
12422
12360
  return polyfill(element);
12423
12361
  let rawOffsetParent = element.offsetParent;
12424
- return getDocumentElement(element) === rawOffsetParent && (rawOffsetParent = rawOffsetParent.ownerDocument.body), rawOffsetParent;
12362
+ return getDocumentElement$1(element) === rawOffsetParent && (rawOffsetParent = rawOffsetParent.ownerDocument.body), rawOffsetParent;
12425
12363
  }
12426
- function getOffsetParent(element, polyfill) {
12427
- const win2 = getWindow(element);
12428
- if (isTopLayer(element))
12364
+ function getOffsetParent$1(element, polyfill) {
12365
+ const win2 = getWindow$1(element);
12366
+ if (isTopLayer$1(element))
12429
12367
  return win2;
12430
- if (!isHTMLElement$1(element)) {
12431
- let svgOffsetParent = getParentNode(element);
12432
- for (; svgOffsetParent && !isLastTraversableNode(svgOffsetParent); ) {
12433
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent))
12368
+ if (!isHTMLElement$2(element)) {
12369
+ let svgOffsetParent = getParentNode$1(element);
12370
+ for (; svgOffsetParent && !isLastTraversableNode$1(svgOffsetParent); ) {
12371
+ if (isElement$1(svgOffsetParent) && !isStaticPositioned$1(svgOffsetParent))
12434
12372
  return svgOffsetParent;
12435
- svgOffsetParent = getParentNode(svgOffsetParent);
12373
+ svgOffsetParent = getParentNode$1(svgOffsetParent);
12436
12374
  }
12437
12375
  return win2;
12438
12376
  }
12439
- let offsetParent = getTrueOffsetParent(element, polyfill);
12440
- for (; offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent); )
12441
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
12442
- return offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent) ? win2 : offsetParent || getContainingBlock(element) || win2;
12377
+ let offsetParent = getTrueOffsetParent$1(element, polyfill);
12378
+ for (; offsetParent && isTableElement$1(offsetParent) && isStaticPositioned$1(offsetParent); )
12379
+ offsetParent = getTrueOffsetParent$1(offsetParent, polyfill);
12380
+ return offsetParent && isLastTraversableNode$1(offsetParent) && isStaticPositioned$1(offsetParent) && !isContainingBlock$1(offsetParent) ? win2 : offsetParent || getContainingBlock$1(element) || win2;
12443
12381
  }
12444
- const getElementRects = async function(data2) {
12445
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent, getDimensionsFn = this.getDimensions, floatingDimensions = await getDimensionsFn(data2.floating);
12382
+ const getElementRects$1 = async function(data2) {
12383
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent$1, getDimensionsFn = this.getDimensions, floatingDimensions = await getDimensionsFn(data2.floating);
12446
12384
  return {
12447
- reference: getRectRelativeToOffsetParent(data2.reference, await getOffsetParentFn(data2.floating), data2.strategy),
12385
+ reference: getRectRelativeToOffsetParent$1(data2.reference, await getOffsetParentFn(data2.floating), data2.strategy),
12448
12386
  floating: {
12449
12387
  x: 0,
12450
12388
  y: 0,
@@ -12453,27 +12391,27 @@ const getElementRects = async function(data2) {
12453
12391
  }
12454
12392
  };
12455
12393
  };
12456
- function isRTL(element) {
12457
- return getComputedStyle$2(element).direction === "rtl";
12458
- }
12459
- const platform = {
12460
- convertOffsetParentRelativeRectToViewportRelativeRect,
12461
- getDocumentElement,
12462
- getClippingRect,
12463
- getOffsetParent,
12464
- getElementRects,
12465
- getClientRects,
12466
- getDimensions,
12467
- getScale,
12468
- isElement,
12469
- isRTL
12394
+ function isRTL$1(element) {
12395
+ return getComputedStyle$3(element).direction === "rtl";
12396
+ }
12397
+ const platform$1 = {
12398
+ convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect$1,
12399
+ getDocumentElement: getDocumentElement$1,
12400
+ getClippingRect: getClippingRect$1,
12401
+ getOffsetParent: getOffsetParent$1,
12402
+ getElementRects: getElementRects$1,
12403
+ getClientRects: getClientRects$1,
12404
+ getDimensions: getDimensions$1,
12405
+ getScale: getScale$1,
12406
+ isElement: isElement$1,
12407
+ isRTL: isRTL$1
12470
12408
  };
12471
- function rectsAreEqual(a2, b2) {
12409
+ function rectsAreEqual$1(a2, b2) {
12472
12410
  return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height;
12473
12411
  }
12474
- function observeMove(element, onMove) {
12412
+ function observeMove$1(element, onMove) {
12475
12413
  let io = null, timeoutId;
12476
- const root2 = getDocumentElement(element);
12414
+ const root2 = getDocumentElement$1(element);
12477
12415
  function cleanup() {
12478
12416
  var _io;
12479
12417
  clearTimeout(timeoutId), (_io = io) == null || _io.disconnect(), io = null;
@@ -12488,9 +12426,9 @@ function observeMove(element, onMove) {
12488
12426
  } = elementRectForRootMargin;
12489
12427
  if (skip || onMove(), !width || !height)
12490
12428
  return;
12491
- const insetTop = floor(top), insetRight = floor(root2.clientWidth - (left + width)), insetBottom = floor(root2.clientHeight - (top + height)), insetLeft = floor(left), options = {
12429
+ const insetTop = floor$1(top), insetRight = floor$1(root2.clientWidth - (left + width)), insetBottom = floor$1(root2.clientHeight - (top + height)), insetLeft = floor$1(left), options = {
12492
12430
  rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px",
12493
- threshold: max$1(0, min$1(1, threshold)) || 1
12431
+ threshold: max$2(0, min$2(1, threshold)) || 1
12494
12432
  };
12495
12433
  let isFirstUpdate = !0;
12496
12434
  function handleObserve(entries) {
@@ -12502,7 +12440,7 @@ function observeMove(element, onMove) {
12502
12440
  refresh(!1, 1e-7);
12503
12441
  }, 1e3);
12504
12442
  }
12505
- ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect()) && refresh(), isFirstUpdate = !1;
12443
+ ratio === 1 && !rectsAreEqual$1(elementRectForRootMargin, element.getBoundingClientRect()) && refresh(), isFirstUpdate = !1;
12506
12444
  }
12507
12445
  try {
12508
12446
  io = new IntersectionObserver(handleObserve, {
@@ -12517,7 +12455,7 @@ function observeMove(element, onMove) {
12517
12455
  }
12518
12456
  return refresh(!0), cleanup;
12519
12457
  }
12520
- function autoUpdate(reference, floating, update, options) {
12458
+ function autoUpdate$1(reference, floating, update, options) {
12521
12459
  options === void 0 && (options = {});
12522
12460
  const {
12523
12461
  ancestorScroll = !0,
@@ -12525,13 +12463,13 @@ function autoUpdate(reference, floating, update, options) {
12525
12463
  elementResize = typeof ResizeObserver == "function",
12526
12464
  layoutShift = typeof IntersectionObserver == "function",
12527
12465
  animationFrame = !1
12528
- } = options, referenceEl = unwrapElement(reference), ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
12466
+ } = options, referenceEl = unwrapElement$1(reference), ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors$1(referenceEl) : [], ...getOverflowAncestors$1(floating)] : [];
12529
12467
  ancestors.forEach((ancestor) => {
12530
12468
  ancestorScroll && ancestor.addEventListener("scroll", update, {
12531
12469
  passive: !0
12532
12470
  }), ancestorResize && ancestor.addEventListener("resize", update);
12533
12471
  });
12534
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
12472
+ const cleanupIo = referenceEl && layoutShift ? observeMove$1(referenceEl, update) : null;
12535
12473
  let reobserveFrame = -1, resizeObserver = null;
12536
12474
  elementResize && (resizeObserver = new ResizeObserver((_ref) => {
12537
12475
  let [firstEntry] = _ref;
@@ -12540,11 +12478,11 @@ function autoUpdate(reference, floating, update, options) {
12540
12478
  (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
12541
12479
  })), update();
12542
12480
  }), referenceEl && !animationFrame && resizeObserver.observe(referenceEl), resizeObserver.observe(floating));
12543
- let frameId, prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
12481
+ let frameId, prevRefRect = animationFrame ? getBoundingClientRect$1(reference) : null;
12544
12482
  animationFrame && frameLoop();
12545
12483
  function frameLoop() {
12546
- const nextRefRect = getBoundingClientRect(reference);
12547
- prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect) && update(), prevRefRect = nextRefRect, frameId = requestAnimationFrame(frameLoop);
12484
+ const nextRefRect = getBoundingClientRect$1(reference);
12485
+ prevRefRect && !rectsAreEqual$1(prevRefRect, nextRefRect) && update(), prevRefRect = nextRefRect, frameId = requestAnimationFrame(frameLoop);
12548
12486
  }
12549
12487
  return update(), () => {
12550
12488
  var _resizeObserver2;
@@ -12553,15 +12491,15 @@ function autoUpdate(reference, floating, update, options) {
12553
12491
  }), cleanupIo?.(), (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(), resizeObserver = null, animationFrame && cancelAnimationFrame(frameId);
12554
12492
  };
12555
12493
  }
12556
- const offset$1 = offset$2, autoPlacement = autoPlacement$1, shift$1 = shift$2, flip$1 = flip$2, size$1 = size$2, hide$1 = hide$2, arrow$2 = arrow$3, inline$1 = inline$2, limitShift$1 = limitShift$2, computePosition = (reference, floating, options) => {
12494
+ const offset$3 = offset$4, shift$1 = shift$2, flip$1 = flip$2, size$3 = size$4, hide$3 = hide$4, arrow$2 = arrow$3, inline$1 = inline$2, limitShift$1 = limitShift$2, computePosition$2 = (reference, floating, options) => {
12557
12495
  const cache = /* @__PURE__ */ new Map(), mergedOptions = {
12558
- platform,
12496
+ platform: platform$1,
12559
12497
  ...options
12560
12498
  }, platformWithCache = {
12561
12499
  ...mergedOptions.platform,
12562
12500
  _c: cache
12563
12501
  };
12564
- return computePosition$1(reference, floating, {
12502
+ return computePosition$3(reference, floating, {
12565
12503
  ...mergedOptions,
12566
12504
  platform: platformWithCache
12567
12505
  });
@@ -12646,7 +12584,7 @@ function useFloating$1(options) {
12646
12584
  strategy,
12647
12585
  middleware: latestMiddleware
12648
12586
  };
12649
- platformRef.current && (config.platform = platformRef.current), computePosition(referenceRef.current, floatingRef.current, config).then((data3) => {
12587
+ platformRef.current && (config.platform = platformRef.current), computePosition$2(referenceRef.current, floatingRef.current, config).then((data3) => {
12650
12588
  const fullData = {
12651
12589
  ...data3,
12652
12590
  // The floating element's position may be recomputed while it's closed
@@ -12734,8 +12672,8 @@ const arrow$1 = (options) => {
12734
12672
  }).fn(state) : {};
12735
12673
  }
12736
12674
  };
12737
- }, offset = (options, deps) => ({
12738
- ...offset$1(options),
12675
+ }, offset$2 = (options, deps) => ({
12676
+ ...offset$3(options),
12739
12677
  options: [options, deps]
12740
12678
  }), shift = (options, deps) => ({
12741
12679
  ...shift$1(options),
@@ -12746,11 +12684,11 @@ const arrow$1 = (options) => {
12746
12684
  }), flip = (options, deps) => ({
12747
12685
  ...flip$1(options),
12748
12686
  options: [options, deps]
12749
- }), size = (options, deps) => ({
12750
- ...size$1(options),
12687
+ }), size$2 = (options, deps) => ({
12688
+ ...size$3(options),
12751
12689
  options: [options, deps]
12752
- }), hide = (options, deps) => ({
12753
- ...hide$1(options),
12690
+ }), hide$2 = (options, deps) => ({
12691
+ ...hide$3(options),
12754
12692
  options: [options, deps]
12755
12693
  }), inline = (options, deps) => ({
12756
12694
  ...inline$1(options),
@@ -12891,8 +12829,8 @@ function useHover(context2, props) {
12891
12829
  unbindMouseMoveRef.current(), handlerRef.current = void 0;
12892
12830
  }), clearPointerEvents = useEffectEvent(() => {
12893
12831
  if (performedPointerEventsMutationRef.current) {
12894
- const body2 = getDocument(elements.floating).body;
12895
- body2.style.pointerEvents = "", body2.removeAttribute(safePolygonIdentifier), performedPointerEventsMutationRef.current = !1;
12832
+ const body = getDocument(elements.floating).body;
12833
+ body.style.pointerEvents = "", body.removeAttribute(safePolygonIdentifier), performedPointerEventsMutationRef.current = !1;
12896
12834
  }
12897
12835
  }), isClickLikeOpenEvent = useEffectEvent(() => dataRef.current.openEvent ? ["click", "mousedown"].includes(dataRef.current.openEvent.type) : !1);
12898
12836
  React.useEffect(() => {
@@ -12947,7 +12885,7 @@ function useHover(context2, props) {
12947
12885
  function onFloatingMouseLeave(event) {
12948
12886
  isClickLikeOpenEvent() || closeWithDelay(event, !1);
12949
12887
  }
12950
- if (isElement(elements.domReference)) {
12888
+ if (isElement$1(elements.domReference)) {
12951
12889
  const reference2 = elements.domReference, floating = elements.floating;
12952
12890
  return open && reference2.addEventListener("mouseleave", onScrollMouseLeave), move && reference2.addEventListener("mousemove", onReferenceMouseEnter, {
12953
12891
  once: !0
@@ -12960,13 +12898,13 @@ function useHover(context2, props) {
12960
12898
  if (enabled && open && (_handleCloseRef$curre = handleCloseRef.current) != null && (_handleCloseRef$curre = _handleCloseRef$curre.__options) != null && _handleCloseRef$curre.blockPointerEvents && isHoverOpen()) {
12961
12899
  performedPointerEventsMutationRef.current = !0;
12962
12900
  const floatingEl = elements.floating;
12963
- if (isElement(elements.domReference) && floatingEl) {
12901
+ if (isElement$1(elements.domReference) && floatingEl) {
12964
12902
  var _tree$nodesRef$curren;
12965
- const body2 = getDocument(elements.floating).body;
12966
- body2.setAttribute(safePolygonIdentifier, "");
12903
+ const body = getDocument(elements.floating).body;
12904
+ body.setAttribute(safePolygonIdentifier, "");
12967
12905
  const ref = elements.domReference, parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node2) => node2.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
12968
- return parentFloating && (parentFloating.style.pointerEvents = ""), body2.style.pointerEvents = "none", ref.style.pointerEvents = "auto", floatingEl.style.pointerEvents = "auto", () => {
12969
- body2.style.pointerEvents = "", ref.style.pointerEvents = "", floatingEl.style.pointerEvents = "";
12906
+ return parentFloating && (parentFloating.style.pointerEvents = ""), body.style.pointerEvents = "none", ref.style.pointerEvents = "auto", floatingEl.style.pointerEvents = "auto", () => {
12907
+ body.style.pointerEvents = "", ref.style.pointerEvents = "", floatingEl.style.pointerEvents = "";
12970
12908
  };
12971
12909
  }
12972
12910
  }
@@ -13154,20 +13092,20 @@ function useDismiss(context2, props) {
13154
13092
  if (endedOrStartedInsideRef.current = !1, outsidePressEvent === "click" && endedOrStartedInside || insideReactTree || typeof outsidePress == "function" && !outsidePress(event))
13155
13093
  return;
13156
13094
  const target = getTarget(event), inertSelector = "[" + createAttribute("inert") + "]", markers = getDocument(elements.floating).querySelectorAll(inertSelector);
13157
- let targetRootAncestor = isElement(target) ? target : null;
13158
- for (; targetRootAncestor && !isLastTraversableNode(targetRootAncestor); ) {
13159
- const nextParent = getParentNode(targetRootAncestor);
13160
- if (isLastTraversableNode(nextParent) || !isElement(nextParent))
13095
+ let targetRootAncestor = isElement$1(target) ? target : null;
13096
+ for (; targetRootAncestor && !isLastTraversableNode$1(targetRootAncestor); ) {
13097
+ const nextParent = getParentNode$1(targetRootAncestor);
13098
+ if (isLastTraversableNode$1(nextParent) || !isElement$1(nextParent))
13161
13099
  break;
13162
13100
  targetRootAncestor = nextParent;
13163
13101
  }
13164
- if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
13102
+ if (markers.length && isElement$1(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
13165
13103
  !contains(target, elements.floating) && // If the target root element contains none of the markers, then the
13166
13104
  // element was injected after the floating element rendered.
13167
13105
  Array.from(markers).every((marker) => !contains(targetRootAncestor, marker)))
13168
13106
  return;
13169
- if (isHTMLElement$1(target) && floating) {
13170
- const lastTraversableNode = isLastTraversableNode(target), style2 = getComputedStyle$2(target), scrollRe = /auto|scroll/, isScrollableX = lastTraversableNode || scrollRe.test(style2.overflowX), isScrollableY = lastTraversableNode || scrollRe.test(style2.overflowY), canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth, canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight, isRTL2 = style2.direction === "rtl", pressedVerticalScrollbar = canScrollY && (isRTL2 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth), pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
13107
+ if (isHTMLElement$2(target) && floating) {
13108
+ const lastTraversableNode = isLastTraversableNode$1(target), style2 = getComputedStyle$3(target), scrollRe = /auto|scroll/, isScrollableX = lastTraversableNode || scrollRe.test(style2.overflowX), isScrollableY = lastTraversableNode || scrollRe.test(style2.overflowY), canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth, canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight, isRTL2 = style2.direction === "rtl", pressedVerticalScrollbar = canScrollY && (isRTL2 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth), pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
13171
13109
  if (pressedVerticalScrollbar || pressedHorizontalScrollbar)
13172
13110
  return;
13173
13111
  }
@@ -13216,13 +13154,13 @@ function useDismiss(context2, props) {
13216
13154
  },
13217
13155
  // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
13218
13156
  // Only apply to WebKit for the test to remain 0ms.
13219
- isWebKit() ? 5 : 0
13157
+ isWebKit$1() ? 5 : 0
13220
13158
  );
13221
13159
  }
13222
13160
  const doc = getDocument(elements.floating);
13223
13161
  escapeKey && (doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture), doc.addEventListener("compositionstart", handleCompositionStart), doc.addEventListener("compositionend", handleCompositionEnd)), outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
13224
13162
  let ancestors = [];
13225
- return ancestorScroll && (isElement(elements.domReference) && (ancestors = getOverflowAncestors(elements.domReference)), isElement(elements.floating) && (ancestors = ancestors.concat(getOverflowAncestors(elements.floating))), !isElement(elements.reference) && elements.reference && elements.reference.contextElement && (ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement)))), ancestors = ancestors.filter((ancestor) => {
13163
+ return ancestorScroll && (isElement$1(elements.domReference) && (ancestors = getOverflowAncestors$1(elements.domReference)), isElement$1(elements.floating) && (ancestors = ancestors.concat(getOverflowAncestors$1(elements.floating))), !isElement$1(elements.reference) && elements.reference && elements.reference.contextElement && (ancestors = ancestors.concat(getOverflowAncestors$1(elements.reference.contextElement)))), ancestors = ancestors.filter((ancestor) => {
13226
13164
  var _doc$defaultView;
13227
13165
  return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
13228
13166
  }), ancestors.forEach((ancestor) => {
@@ -13319,17 +13257,17 @@ function useFloating(options) {
13319
13257
  }
13320
13258
  }
13321
13259
  }), setPositionReference = React.useCallback((node2) => {
13322
- const computedPositionReference = isElement(node2) ? {
13260
+ const computedPositionReference = isElement$1(node2) ? {
13323
13261
  getBoundingClientRect: () => node2.getBoundingClientRect(),
13324
13262
  getClientRects: () => node2.getClientRects(),
13325
13263
  contextElement: node2
13326
13264
  } : node2;
13327
13265
  _setPositionReference(computedPositionReference), position.refs.setReference(computedPositionReference);
13328
13266
  }, [position.refs]), setReference = React.useCallback((node2) => {
13329
- (isElement(node2) || node2 === null) && (domReferenceRef.current = node2, setDomReference(node2)), (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
13267
+ (isElement$1(node2) || node2 === null) && (domReferenceRef.current = node2, setDomReference(node2)), (isElement$1(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
13330
13268
  // `null` to support `positionReference` + an unstable `reference`
13331
13269
  // callback ref.
13332
- node2 !== null && !isElement(node2)) && position.refs.setReference(node2);
13270
+ node2 !== null && !isElement$1(node2)) && position.refs.setReference(node2);
13333
13271
  }, [position.refs]), refs = React.useMemo(() => ({
13334
13272
  ...position.refs,
13335
13273
  setReference,
@@ -13373,9 +13311,9 @@ function useFocus(context2, props) {
13373
13311
  } = props, blockFocusRef = React.useRef(!1), timeoutRef = React.useRef(-1), keyboardModalityRef = React.useRef(!0);
13374
13312
  React.useEffect(() => {
13375
13313
  if (!enabled) return;
13376
- const win2 = getWindow(elements.domReference);
13314
+ const win2 = getWindow$1(elements.domReference);
13377
13315
  function onBlur() {
13378
- !open && isHTMLElement$1(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference)) && (blockFocusRef.current = !0);
13316
+ !open && isHTMLElement$2(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference)) && (blockFocusRef.current = !0);
13379
13317
  }
13380
13318
  function onKeyDown() {
13381
13319
  keyboardModalityRef.current = !0;
@@ -13407,7 +13345,7 @@ function useFocus(context2, props) {
13407
13345
  onFocus(event) {
13408
13346
  if (blockFocusRef.current) return;
13409
13347
  const target = getTarget(event.nativeEvent);
13410
- if (visibleOnly && isElement(target)) {
13348
+ if (visibleOnly && isElement$1(target)) {
13411
13349
  if (isMacSafari() && !event.relatedTarget) {
13412
13350
  if (!keyboardModalityRef.current && !isTypeableElement(target))
13413
13351
  return;
@@ -13418,7 +13356,7 @@ function useFocus(context2, props) {
13418
13356
  },
13419
13357
  onBlur(event) {
13420
13358
  blockFocusRef.current = !1;
13421
- const relatedTarget = event.relatedTarget, nativeEvent = event.nativeEvent, movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
13359
+ const relatedTarget = event.relatedTarget, nativeEvent = event.nativeEvent, movedToFocusGuard = isElement$1(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
13422
13360
  timeoutRef.current = window.setTimeout(() => {
13423
13361
  var _dataRef$current$floa;
13424
13362
  const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
@@ -14911,7 +14849,7 @@ function getDefaultMiddlewares$1(middlewares) {
14911
14849
  return middlewares.shift === void 0 && (result.shift = !0), middlewares.flip === void 0 && (result.flip = !0), result;
14912
14850
  }
14913
14851
  function getPopoverMiddlewares(options, getFloating, env) {
14914
- const middlewaresOptions = getDefaultMiddlewares$1(options.middlewares), middlewares = [offset(options.offset), hide()];
14852
+ const middlewaresOptions = getDefaultMiddlewares$1(options.middlewares), middlewares = [offset$2(options.offset), hide$2()];
14915
14853
  return options.dropdownVisible && env !== "test" && options.preventPositionChangeWhenVisible && (middlewaresOptions.flip = !1), middlewaresOptions.flip && middlewares.push(
14916
14854
  typeof middlewaresOptions.flip == "boolean" ? flip() : flip(middlewaresOptions.flip)
14917
14855
  ), middlewaresOptions.shift && middlewares.push(
@@ -14921,7 +14859,7 @@ function getPopoverMiddlewares(options, getFloating, env) {
14921
14859
  ), middlewaresOptions.inline && middlewares.push(
14922
14860
  typeof middlewaresOptions.inline == "boolean" ? inline() : inline(middlewaresOptions.inline)
14923
14861
  ), middlewares.push(arrow({ element: options.arrowRef, padding: options.arrowOffset })), (middlewaresOptions.size || options.width === "target") && middlewares.push(
14924
- size({
14862
+ size$2({
14925
14863
  ...typeof middlewaresOptions.size == "boolean" ? {} : middlewaresOptions.size,
14926
14864
  apply({ rects, availableWidth, availableHeight, ...rest }) {
14927
14865
  const styles = getFloating().refs.floating.current?.style ?? {};
@@ -14949,11 +14887,11 @@ function usePopover(options) {
14949
14887
  strategy: options.strategy,
14950
14888
  placement: options.preventPositionChangeWhenVisible ? options.positionRef.current : options.position,
14951
14889
  middleware: getPopoverMiddlewares(options, () => floating, env),
14952
- whileElementsMounted: options.keepMounted ? void 0 : autoUpdate
14890
+ whileElementsMounted: options.keepMounted ? void 0 : autoUpdate$1
14953
14891
  });
14954
14892
  return useEffect(() => {
14955
14893
  if (!(!floating.refs.reference.current || !floating.refs.floating.current) && _opened)
14956
- return autoUpdate(
14894
+ return autoUpdate$1(
14957
14895
  floating.refs.reference.current,
14958
14896
  floating.refs.floating.current,
14959
14897
  floating.update
@@ -16612,7 +16550,7 @@ const defaultProps$t = {
16612
16550
  refProp: "ref"
16613
16551
  }, ComboboxDropdownTarget = factory((props, ref) => {
16614
16552
  const { children: children2, refProp } = useProps("ComboboxDropdownTarget", defaultProps$t, props);
16615
- if (useComboboxContext(), !isElement$1(children2))
16553
+ if (useComboboxContext(), !isElement$2(children2))
16616
16554
  throw new Error(
16617
16555
  "Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
16618
16556
  );
@@ -17306,7 +17244,7 @@ const defaultProps$o = {
17306
17244
  vars,
17307
17245
  varsResolver: varsResolver$l
17308
17246
  }), items = Children.toArray(children2).reduce((acc, child, index2, array2) => {
17309
- const item = isElement$1(child) ? cloneElement(child, {
17247
+ const item = isElement$2(child) ? cloneElement(child, {
17310
17248
  ...getStyles2("breadcrumb", { className: child.props?.className }),
17311
17249
  key: index2
17312
17250
  }) : /* @__PURE__ */ createElement("div", { ...getStyles2("breadcrumb"), key: index2 }, child);
@@ -18297,7 +18235,7 @@ const MenuSubItem = polymorphicFactory((props, ref) => {
18297
18235
  MenuSubItem.classes = classes$c;
18298
18236
  MenuSubItem.displayName = "@mantine/core/MenuSubItem";
18299
18237
  function MenuSubTarget({ children: children2, refProp }) {
18300
- if (!isElement$1(children2))
18238
+ if (!isElement$2(children2))
18301
18239
  throw new Error(
18302
18240
  "Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
18303
18241
  );
@@ -18827,7 +18765,7 @@ function useFloatingTooltip({
18827
18765
  if (refs.floating.current) {
18828
18766
  const boundary = boundaryRef.current;
18829
18767
  boundary.addEventListener("mousemove", handleMouseMove);
18830
- const parents = getOverflowAncestors(refs.floating.current);
18768
+ const parents = getOverflowAncestors$1(refs.floating.current);
18831
18769
  return parents.forEach((parent) => {
18832
18770
  parent.addEventListener("scroll", update);
18833
18771
  }), () => {
@@ -18948,7 +18886,7 @@ function getDefaultMiddlewares(middlewares) {
18948
18886
  return middlewares.shift === void 0 && (result.shift = !0), middlewares.flip === void 0 && (result.flip = !0), result;
18949
18887
  }
18950
18888
  function getTooltipMiddlewares(settings) {
18951
- const middlewaresOptions = getDefaultMiddlewares(settings.middlewares), middlewares = [offset(settings.offset)];
18889
+ const middlewaresOptions = getDefaultMiddlewares(settings.middlewares), middlewares = [offset$2(settings.offset)];
18952
18890
  return middlewaresOptions.shift && middlewares.push(
18953
18891
  shift(
18954
18892
  typeof middlewaresOptions.shift == "boolean" ? { padding: 8 } : { padding: 8, ...middlewaresOptions.shift }
@@ -18978,7 +18916,7 @@ function useTooltip(settings) {
18978
18916
  open: opened,
18979
18917
  onOpenChange: onChange,
18980
18918
  middleware: getTooltipMiddlewares(settings),
18981
- whileElementsMounted: autoUpdate
18919
+ whileElementsMounted: autoUpdate$1
18982
18920
  }), { delay: groupDelay, currentId, setCurrentId } = useDelayGroup(context2, { id: uid }), { getReferenceProps, getFloatingProps } = useInteractions([
18983
18921
  useHover(context2, {
18984
18922
  enabled: settings.events?.hover,
@@ -21067,7 +21005,7 @@ class PolyBezier {
21067
21005
  }), new PolyBezier(offset2);
21068
21006
  }
21069
21007
  }
21070
- const { abs, min, max, cos, sin, acos, sqrt } = Math, pi$1 = Math.PI;
21008
+ const { abs, min: min$1, max: max$1, cos, sin, acos, sqrt } = Math, pi$1 = Math.PI;
21071
21009
  class Bezier {
21072
21010
  constructor(coords) {
21073
21011
  let args = coords && coords.forEach ? coords : Array.from(arguments).slice(), coordlen = !1;
@@ -21477,7 +21415,7 @@ class Bezier {
21477
21415
  )) : this.selfintersects(curveIntersectionThreshold);
21478
21416
  }
21479
21417
  lineIntersects(line) {
21480
- const mx = min(line.p1.x, line.p2.x), my = min(line.p1.y, line.p2.y), MX = max(line.p1.x, line.p2.x), MY = max(line.p1.y, line.p2.y);
21418
+ const mx = min$1(line.p1.x, line.p2.x), my = min$1(line.p1.y, line.p2.y), MX = max$1(line.p1.x, line.p2.x), MY = max$1(line.p1.y, line.p2.y);
21481
21419
  return utils.roots(this.points, line).filter((t2) => {
21482
21420
  var p2 = this.get(t2);
21483
21421
  return utils.between(p2.x, mx, MX) && utils.between(p2.y, my, MY);
@@ -22959,7 +22897,7 @@ class JSAnimation extends WithPromise {
22959
22897
  !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(0, 1, iterationProgress) * resolvedDuration;
22960
22898
  }
22961
22899
  const state = isInDelayPhase ? { done: !1, value: keyframes2[0] } : frameGenerator.next(elapsed);
22962
- mixKeyframes && (state.value = mixKeyframes(state.value));
22900
+ mixKeyframes && !isInDelayPhase && (state.value = mixKeyframes(state.value));
22963
22901
  let { done } = state;
22964
22902
  !isInDelayPhase && calculatedDuration !== null && (done = this.playbackSpeed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0);
22965
22903
  const isAnimationFinished = this.holdTime === null && (this.state === "finished" || this.state === "running" && done);
@@ -22984,15 +22922,14 @@ class JSAnimation extends WithPromise {
22984
22922
  return /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
22985
22923
  }
22986
22924
  set time(newTime) {
22987
- newTime = /* @__PURE__ */ secondsToMilliseconds(newTime), this.currentTime = newTime, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = newTime : this.driver && (this.startTime = this.driver.now() - newTime / this.playbackSpeed), this.driver?.start(!1);
22925
+ newTime = /* @__PURE__ */ secondsToMilliseconds(newTime), this.currentTime = newTime, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = newTime : this.driver && (this.startTime = this.driver.now() - newTime / this.playbackSpeed), this.driver ? this.driver.start(!1) : (this.startTime = 0, this.state = "paused", this.holdTime = newTime, this.tick(newTime));
22988
22926
  }
22989
22927
  get speed() {
22990
22928
  return this.playbackSpeed;
22991
22929
  }
22992
22930
  set speed(newSpeed) {
22993
- this.updateTime(time.now());
22994
22931
  const hasChanged = this.playbackSpeed !== newSpeed;
22995
- this.playbackSpeed = newSpeed, hasChanged && (this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime));
22932
+ hasChanged && this.driver && this.updateTime(time.now()), this.playbackSpeed = newSpeed, hasChanged && this.driver && (this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime));
22996
22933
  }
22997
22934
  play() {
22998
22935
  if (this.isStopped)
@@ -23262,7 +23199,7 @@ class NativeAnimation extends WithPromise {
23262
23199
  this.animation = startWaapiAnimation(element, name, keyframes2, transition, pseudoElement), transition.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
23263
23200
  if (this.finishedTime = this.time, !pseudoElement) {
23264
23201
  const keyframe = getFinalKeyframe$1(keyframes2, this.options, finalKeyframe, this.speed);
23265
- this.updateMotionValue ? this.updateMotionValue(keyframe) : setStyle(element, name, keyframe), this.animation.cancel();
23202
+ this.updateMotionValue && this.updateMotionValue(keyframe), setStyle(element, name, keyframe), this.animation.cancel();
23266
23203
  }
23267
23204
  onComplete?.(), this.notifyFinished();
23268
23205
  };
@@ -23317,7 +23254,8 @@ class NativeAnimation extends WithPromise {
23317
23254
  return /* @__PURE__ */ millisecondsToSeconds(Number(this.animation.currentTime) || 0);
23318
23255
  }
23319
23256
  set time(newTime) {
23320
- this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
23257
+ const wasFinished = this.finishedTime !== null;
23258
+ this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(newTime), wasFinished && this.animation.pause();
23321
23259
  }
23322
23260
  /**
23323
23261
  * The playback speed of the animation.
@@ -23341,8 +23279,8 @@ class NativeAnimation extends WithPromise {
23341
23279
  /**
23342
23280
  * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
23343
23281
  */
23344
- attachTimeline({ timeline, observe }) {
23345
- return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, timeline && supportsScrollTimeline() ? (this.animation.timeline = timeline, noop$1) : observe(this);
23282
+ attachTimeline({ timeline, rangeStart, rangeEnd, observe }) {
23283
+ return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, timeline && supportsScrollTimeline() ? (this.animation.timeline = timeline, rangeStart && (this.animation.rangeStart = rangeStart), rangeEnd && (this.animation.rangeEnd = rangeEnd), noop$1) : observe(this);
23346
23284
  }
23347
23285
  }
23348
23286
  const unsupportedEasingFunctions = {
@@ -23380,8 +23318,8 @@ class NativeAnimationExtended extends NativeAnimation {
23380
23318
  const sampleAnimation = new JSAnimation({
23381
23319
  ...options,
23382
23320
  autoplay: !1
23383
- }), sampleTime = Math.max(sampleDelta, time.now() - this.startTime), delta = clamp(0, sampleDelta, sampleTime - sampleDelta);
23384
- motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, sampleAnimation.sample(sampleTime).value, delta), sampleAnimation.stop();
23321
+ }), sampleTime = Math.max(sampleDelta, time.now() - this.startTime), delta = clamp(0, sampleDelta, sampleTime - sampleDelta), current2 = sampleAnimation.sample(sampleTime).value, { name } = this.options;
23322
+ element && name && setStyle(element, name, current2), motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current2, delta), sampleAnimation.stop();
23385
23323
  }
23386
23324
  }
23387
23325
  const isAnimatable = (value, name) => name === "zIndex" ? !1 : !!(typeof value == "number" || Array.isArray(value) || typeof value == "string" && // It's animatable if we have a string
@@ -24329,7 +24267,7 @@ function createEffect(addValue) {
24329
24267
  };
24330
24268
  };
24331
24269
  }
24332
- function isHTMLElement(element) {
24270
+ function isHTMLElement$1(element) {
24333
24271
  return isObject(element) && "offsetHeight" in element;
24334
24272
  }
24335
24273
  const translateAlias$1 = {
@@ -24361,7 +24299,7 @@ function buildTransform$1(state) {
24361
24299
  }
24362
24300
  const originProps = /* @__PURE__ */ new Set(["originX", "originY", "originZ"]), addStyleValue = (element, state, key2, value) => {
24363
24301
  let render, computed;
24364
- return transformProps.has(key2) ? (state.get("transform") || (!isHTMLElement(element) && !state.get("transformBox") && addStyleValue(element, state, "transformBox", new MotionValue("fill-box")), state.set("transform", new MotionValue("none"), () => {
24302
+ return transformProps.has(key2) ? (state.get("transform") || (!isHTMLElement$1(element) && !state.get("transformBox") && addStyleValue(element, state, "transformBox", new MotionValue("fill-box")), state.set("transform", new MotionValue("none"), () => {
24365
24303
  element.style.transform = buildTransform$1(state);
24366
24304
  })), computed = state.get("transform")) : originProps.has(key2) ? (state.get("transformOrigin") || state.set("transformOrigin", new MotionValue(""), () => {
24367
24305
  const originX = state.latest.originX ?? "50%", originY = state.latest.originY ?? "50%", originZ = state.latest.originZ ?? 0;
@@ -24486,7 +24424,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
24486
24424
  window.addEventListener("pointerup", onPointerUp, eventOptions), window.addEventListener("pointercancel", onPointerCancel, eventOptions);
24487
24425
  };
24488
24426
  return targets.forEach((target) => {
24489
- (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), isHTMLElement(target) && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex") && (target.tabIndex = 0));
24427
+ (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions), isHTMLElement$1(target) && (target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)), !isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex") && (target.tabIndex = 0));
24490
24428
  }), cancelEvents;
24491
24429
  }
24492
24430
  function isSVGElement(element) {
@@ -24990,8 +24928,11 @@ function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.
24990
24928
  const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
24991
24929
  applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
24992
24930
  }
24931
+ function resolveAxisTranslate(value, axis) {
24932
+ return typeof value == "string" ? parseFloat(value) / 100 * (axis.max - axis.min) : value;
24933
+ }
24993
24934
  function transformBox(box, transform2) {
24994
- transformAxis(box.x, transform2.x, transform2.scaleX, transform2.scale, transform2.originX), transformAxis(box.y, transform2.y, transform2.scaleY, transform2.scale, transform2.originY);
24935
+ transformAxis(box.x, resolveAxisTranslate(transform2.x, box.x), transform2.scaleX, transform2.scale, transform2.originX), transformAxis(box.y, resolveAxisTranslate(transform2.y, box.y), transform2.scaleY, transform2.scale, transform2.originY);
24995
24936
  }
24996
24937
  function measureViewportBox(instance, transformPoint2) {
24997
24938
  return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint2));
@@ -25113,7 +25054,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
25113
25054
  (isMotionValue(style2[key2]) || prevStyle && isMotionValue(prevStyle[key2]) || isForcedMotionValue(key2, props) || visualElement?.getValue(key2)?.liveStyle !== void 0) && (newValues[key2] = style2[key2]);
25114
25055
  return newValues;
25115
25056
  }
25116
- function getComputedStyle$1(element) {
25057
+ function getComputedStyle$2(element) {
25117
25058
  return window.getComputedStyle(element);
25118
25059
  }
25119
25060
  class HTMLVisualElement extends DOMVisualElement {
@@ -25124,7 +25065,7 @@ class HTMLVisualElement extends DOMVisualElement {
25124
25065
  if (transformProps.has(key2))
25125
25066
  return this.projection?.isProjecting ? defaultTransformValue(key2) : readTransformValue(instance, key2);
25126
25067
  {
25127
- const computedStyle = getComputedStyle$1(instance), value = (isCSSVariableName(key2) ? computedStyle.getPropertyValue(key2) : computedStyle[key2]) || 0;
25068
+ const computedStyle = getComputedStyle$2(instance), value = (isCSSVariableName(key2) ? computedStyle.getPropertyValue(key2) : computedStyle[key2]) || 0;
25128
25069
  return typeof value == "string" ? value.trim() : value;
25129
25070
  }
25130
25071
  }
@@ -25306,7 +25247,7 @@ function createAnimateFunction(visualElement) {
25306
25247
  return (animations2) => Promise.all(animations2.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
25307
25248
  }
25308
25249
  function createAnimationState(visualElement) {
25309
- let animate2 = createAnimateFunction(visualElement), state = createState(), isInitialRender = !0;
25250
+ let animate2 = createAnimateFunction(visualElement), state = createState(), isInitialRender = !0, wasReset = !1;
25310
25251
  const buildResolvedTypeValues = (type) => (acc, definition) => {
25311
25252
  const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0);
25312
25253
  if (resolved) {
@@ -25325,7 +25266,7 @@ function createAnimationState(visualElement) {
25325
25266
  const type = reversePriorityOrder[i2], typeState = state[type], prop = props[type] !== void 0 ? props[type] : context2[type], propIsVariant = isVariantLabel(prop), activeDelta = type === changedActiveType ? typeState.isActive : null;
25326
25267
  activeDelta === !1 && (removedVariantIndex = i2);
25327
25268
  let isInherited = prop === context2[type] && prop !== props[type] && propIsVariant;
25328
- if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount && (isInherited = !1), typeState.protectedKeys = { ...encounteredKeys }, // If it isn't active and hasn't *just* been set as inactive
25269
+ if (isInherited && (isInitialRender || wasReset) && visualElement.manuallyAnimateOnMount && (isInherited = !1), typeState.protectedKeys = { ...encounteredKeys }, // If it isn't active and hasn't *just* been set as inactive
25329
25270
  !typeState.isActive && activeDelta === null || // If we didn't and don't have any defined prop for this animation type
25330
25271
  !prop && !typeState.prevProp || // Or if the prop doesn't define an animation
25331
25272
  isAnimationControls(prop) || typeof prop == "boolean")
@@ -25359,11 +25300,11 @@ function createAnimationState(visualElement) {
25359
25300
  let valueHasChanged = !1;
25360
25301
  isKeyframesTarget(next) && isKeyframesTarget(prev) ? valueHasChanged = !shallowCompare(next, prev) : valueHasChanged = next !== prev, valueHasChanged ? next != null ? markToAnimate(key2) : removedKeys.add(key2) : next !== void 0 && removedKeys.has(key2) ? markToAnimate(key2) : typeState.protectedKeys[key2] = !0;
25361
25302
  }
25362
- typeState.prevProp = prop, typeState.prevResolvedValues = resolvedValues, typeState.isActive && (encounteredKeys = { ...encounteredKeys, ...resolvedValues }), isInitialRender && visualElement.blockInitialAnimation && (shouldAnimateType = !1);
25303
+ typeState.prevProp = prop, typeState.prevResolvedValues = resolvedValues, typeState.isActive && (encounteredKeys = { ...encounteredKeys, ...resolvedValues }), (isInitialRender || wasReset) && visualElement.blockInitialAnimation && (shouldAnimateType = !1);
25363
25304
  const willAnimateViaParent = isInherited && variantDidChange;
25364
25305
  shouldAnimateType && (!willAnimateViaParent || handledRemovedValues) && animations2.push(...definitionList.map((animation) => {
25365
25306
  const options = { type };
25366
- if (typeof animation == "string" && isInitialRender && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
25307
+ if (typeof animation == "string" && (isInitialRender || wasReset) && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
25367
25308
  const { parent } = visualElement, parentVariant = resolveVariant(parent, animation);
25368
25309
  if (parent.enteringChildren && parentVariant) {
25369
25310
  const { delayChildren } = parentVariant.transition || {};
@@ -25388,7 +25329,7 @@ function createAnimationState(visualElement) {
25388
25329
  }), animations2.push({ animation: fallbackAnimation });
25389
25330
  }
25390
25331
  let shouldAnimate = !!animations2.length;
25391
- return isInitialRender && (props.initial === !1 || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount && (shouldAnimate = !1), isInitialRender = !1, shouldAnimate ? animate2(animations2) : Promise.resolve();
25332
+ return isInitialRender && (props.initial === !1 || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount && (shouldAnimate = !1), isInitialRender = !1, wasReset = !1, shouldAnimate ? animate2(animations2) : Promise.resolve();
25392
25333
  }
25393
25334
  function setActive(type, isActive) {
25394
25335
  if (state[type].isActive === isActive)
@@ -25405,7 +25346,7 @@ function createAnimationState(visualElement) {
25405
25346
  setAnimateFunction,
25406
25347
  getState: () => state,
25407
25348
  reset: () => {
25408
- state = createState();
25349
+ state = createState(), wasReset = !0;
25409
25350
  }
25410
25351
  };
25411
25352
  }
@@ -25576,11 +25517,11 @@ class NodeStack {
25576
25517
  add(node2) {
25577
25518
  addUniqueItem(this.members, node2);
25578
25519
  for (let i2 = this.members.length - 1; i2 >= 0; i2--) {
25579
- const m3 = this.members[i2];
25580
- if (m3 === node2 || m3 === this.lead || m3 === this.prevLead)
25520
+ const member = this.members[i2];
25521
+ if (member === node2 || member === this.lead || member === this.prevLead)
25581
25522
  continue;
25582
- const inst = m3.instance;
25583
- inst && inst.isConnected === !1 && m3.isPresent !== !1 && !m3.snapshot && removeItem(this.members, m3);
25523
+ const inst = member.instance;
25524
+ (!inst || inst.isConnected === !1) && !member.snapshot && (removeItem(this.members, member), member.unmount());
25584
25525
  }
25585
25526
  node2.scheduleRender();
25586
25527
  }
@@ -25591,49 +25532,31 @@ class NodeStack {
25591
25532
  }
25592
25533
  }
25593
25534
  relegate(node2) {
25594
- const indexOfNode = this.members.findIndex((member) => node2 === member);
25595
- if (indexOfNode === 0)
25596
- return !1;
25597
- let prevLead;
25598
- for (let i2 = indexOfNode; i2 >= 0; i2--) {
25599
- const member = this.members[i2], inst = member.instance;
25600
- if (member.isPresent !== !1 && (!inst || inst.isConnected !== !1)) {
25601
- prevLead = member;
25602
- break;
25603
- }
25535
+ for (let i2 = this.members.indexOf(node2) - 1; i2 >= 0; i2--) {
25536
+ const member = this.members[i2];
25537
+ if (member.isPresent !== !1 && member.instance?.isConnected !== !1)
25538
+ return this.promote(member), !0;
25604
25539
  }
25605
- return prevLead ? (this.promote(prevLead), !0) : !1;
25540
+ return !1;
25606
25541
  }
25607
25542
  promote(node2, preserveFollowOpacity) {
25608
25543
  const prevLead = this.lead;
25609
25544
  if (node2 !== prevLead && (this.prevLead = prevLead, this.lead = node2, node2.show(), prevLead)) {
25610
- prevLead.instance && prevLead.scheduleRender(), node2.scheduleRender();
25611
- const prevDep = prevLead.options.layoutDependency, nextDep = node2.options.layoutDependency;
25612
- if (!(prevDep !== void 0 && nextDep !== void 0 && prevDep === nextDep)) {
25613
- const prevInstance = prevLead.instance;
25614
- prevInstance && prevInstance.isConnected === !1 && !prevLead.snapshot || (node2.resumeFrom = prevLead, preserveFollowOpacity && (node2.resumeFrom.preserveOpacity = !0), prevLead.snapshot && (node2.snapshot = prevLead.snapshot, node2.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues), node2.root && node2.root.isUpdating && (node2.isLayoutDirty = !0));
25615
- }
25616
- const { crossfade } = node2.options;
25617
- crossfade === !1 && prevLead.hide();
25545
+ prevLead.updateSnapshot(), node2.scheduleRender();
25546
+ const { layoutDependency: prevDep } = prevLead.options, { layoutDependency: nextDep } = node2.options;
25547
+ (prevDep === void 0 || prevDep !== nextDep) && (node2.resumeFrom = prevLead, preserveFollowOpacity && (prevLead.preserveOpacity = !0), prevLead.snapshot && (node2.snapshot = prevLead.snapshot, node2.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues), node2.root?.isUpdating && (node2.isLayoutDirty = !0)), node2.options.crossfade === !1 && prevLead.hide();
25618
25548
  }
25619
25549
  }
25620
25550
  exitAnimationComplete() {
25621
- this.members.forEach((node2) => {
25622
- const { options, resumingFrom } = node2;
25623
- options.onExitComplete && options.onExitComplete(), resumingFrom && resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete();
25551
+ this.members.forEach((member) => {
25552
+ member.options.onExitComplete?.(), member.resumingFrom?.options.onExitComplete?.();
25624
25553
  });
25625
25554
  }
25626
25555
  scheduleRender() {
25627
- this.members.forEach((node2) => {
25628
- node2.instance && node2.scheduleRender(!1);
25629
- });
25556
+ this.members.forEach((member) => member.instance && member.scheduleRender(!1));
25630
25557
  }
25631
- /**
25632
- * Clear any leads that have been removed this render to prevent them from being
25633
- * used in future animations and to prevent memory leaks
25634
- */
25635
25558
  removeLeadSnapshot() {
25636
- this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
25559
+ this.lead?.snapshot && (this.lead.snapshot = void 0);
25637
25560
  }
25638
25561
  }
25639
25562
  const globalProjectionState = {
@@ -26293,7 +26216,7 @@ class PopChildMeasure extends React.Component {
26293
26216
  getSnapshotBeforeUpdate(prevProps) {
26294
26217
  const element = this.props.childRef.current;
26295
26218
  if (element && prevProps.isPresent && !this.props.isPresent && this.props.pop !== !1) {
26296
- const parent = element.offsetParent, parentWidth = isHTMLElement(parent) && parent.offsetWidth || 0, parentHeight = isHTMLElement(parent) && parent.offsetHeight || 0, size2 = this.props.sizeRef.current;
26219
+ const parent = element.offsetParent, parentWidth = isHTMLElement$1(parent) && parent.offsetWidth || 0, parentHeight = isHTMLElement$1(parent) && parent.offsetHeight || 0, size2 = this.props.sizeRef.current;
26297
26220
  size2.height = element.offsetHeight || 0, size2.width = element.offsetWidth || 0, size2.top = element.offsetTop, size2.left = element.offsetLeft, size2.right = parentWidth - size2.width - size2.left, size2.bottom = parentHeight - size2.height - size2.top;
26298
26221
  }
26299
26222
  return null;
@@ -26726,7 +26649,7 @@ function useMotionRef(visualState, visualElement, externalRef) {
26726
26649
  });
26727
26650
  const refCleanup = useRef(null);
26728
26651
  return useCallback((instance) => {
26729
- instance && visualState.onMount?.(instance), visualElement && (instance ? visualElement.mount(instance) : visualElement.unmount());
26652
+ instance && visualState.onMount?.(instance);
26730
26653
  const ref = externalRefContainer.current;
26731
26654
  if (typeof ref == "function")
26732
26655
  if (instance) {
@@ -26734,6 +26657,7 @@ function useMotionRef(visualState, visualElement, externalRef) {
26734
26657
  typeof cleanup == "function" && (refCleanup.current = cleanup);
26735
26658
  } else refCleanup.current ? (refCleanup.current(), refCleanup.current = null) : ref(instance);
26736
26659
  else ref && (ref.current = instance);
26660
+ visualElement && (instance ? visualElement.mount(instance) : visualElement.unmount());
26737
26661
  }, [visualElement]);
26738
26662
  }
26739
26663
  const SwitchLayoutGroupContext = createContext({});
@@ -26758,7 +26682,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
26758
26682
  useInsertionEffect$1(() => {
26759
26683
  visualElement && isMounted.current && visualElement.update(props, presenceContext);
26760
26684
  });
26761
- const optimisedAppearId = props[optimizedAppearDataAttribute], wantsHandoff = useRef(!!optimisedAppearId && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
26685
+ const optimisedAppearId = props[optimizedAppearDataAttribute], wantsHandoff = useRef(!!optimisedAppearId && typeof window < "u" && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
26762
26686
  return useIsomorphicLayoutEffect(() => {
26763
26687
  hasMountedOnce.current = !0, visualElement && (isMounted.current = !0, window.MotionIsMounted = !0, visualElement.updateFeatures(), visualElement.scheduleRenderMicrotask(), wantsHandoff.current && visualElement.animationState && visualElement.animationState.animateChanges());
26764
26688
  }), useEffect(() => {
@@ -26802,7 +26726,7 @@ function createMotionComponent(Component2, { forwardMotionProps = !1, type } = {
26802
26726
  ...props,
26803
26727
  layoutId: useLayoutId(props)
26804
26728
  }, { isStatic } = configAndProps, context2 = useCreateMotionContext(props), visualState = useVisualState(props, isStatic);
26805
- if (!isStatic && isBrowser$1) {
26729
+ if (!isStatic && typeof window < "u") {
26806
26730
  useStrictMode();
26807
26731
  const layoutProjection = getProjectionFunctionality(configAndProps);
26808
26732
  MeasureLayout2 = layoutProjection.MeasureLayout, context2.visualElement = useVisualElement(Component2, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG);
@@ -27827,9 +27751,10 @@ function createScopedAnimate(options = {}) {
27827
27751
  const { scope, reduceMotion } = options;
27828
27752
  function scopedAnimate(subjectOrSequence, optionsOrKeyframes, options2) {
27829
27753
  let animations2 = [], animationOnComplete;
27830
- if (isSequence(subjectOrSequence))
27831
- animations2 = animateSequence(subjectOrSequence, reduceMotion !== void 0 ? { reduceMotion, ...optionsOrKeyframes } : optionsOrKeyframes, scope);
27832
- else {
27754
+ if (isSequence(subjectOrSequence)) {
27755
+ const { onComplete, ...sequenceOptions } = optionsOrKeyframes || {};
27756
+ typeof onComplete == "function" && (animationOnComplete = onComplete), animations2 = animateSequence(subjectOrSequence, reduceMotion !== void 0 ? { reduceMotion, ...sequenceOptions } : sequenceOptions, scope);
27757
+ } else {
27833
27758
  const { onComplete, ...rest } = options2 || {};
27834
27759
  typeof onComplete == "function" && (animationOnComplete = onComplete), animations2 = animateSubject(subjectOrSequence, optionsOrKeyframes, reduceMotion !== void 0 ? { reduceMotion, ...rest } : rest, scope);
27835
27760
  }
@@ -40034,7 +39959,7 @@ const Logo$1 = forwardRef(
40034
39959
  }
40035
39960
  ) }) : null;
40036
39961
  };
40037
- function SearchControl() {
39962
+ function SearchControl$1() {
40038
39963
  const diagram = useDiagram(), isMac2 = isMacOs();
40039
39964
  return /* @__PURE__ */ jsxs(
40040
39965
  UnstyledButton,
@@ -40497,7 +40422,7 @@ const selectBreadcrumbs = ({ context: context2 }) => {
40497
40422
  "actions"
40498
40423
  ),
40499
40424
  enableDynamicViewWalkthrough && isDynamicView && /* @__PURE__ */ jsx(DynamicViewControls, {}, "dynamic-view-controls"),
40500
- enableSearch && !enableCompareWithLatest && /* @__PURE__ */ jsx(SearchControl, {}, "search-control"),
40425
+ enableSearch && !enableCompareWithLatest && /* @__PURE__ */ jsx(SearchControl$1, {}, "search-control"),
40501
40426
  /* @__PURE__ */ jsx(LayoutWarning, {}, "outdated-manual-layout-warning")
40502
40427
  ] });
40503
40428
  });
@@ -41209,7 +41134,7 @@ const useElementDetailsActorRef = () => {
41209
41134
  if (ctx === null)
41210
41135
  throw new Error("ElementDetailsActorRef is not provided");
41211
41136
  return ctx;
41212
- }, backdropBlur$1 = "--_blur", backdropOpacity$1 = "--_opacity", dialog$1 = css({
41137
+ }, backdropBlur$1 = "--_blur", backdropOpacity$1 = "--_opacity", dialog = css({
41213
41138
  boxSizing: "border-box",
41214
41139
  margin: "0",
41215
41140
  padding: "0",
@@ -42173,7 +42098,7 @@ const node = css({
42173
42098
  color: "white"
42174
42099
  }
42175
42100
  }
42176
- }), scrollArea$2 = css({
42101
+ }), scrollArea$1 = css({
42177
42102
  maxHeight: [
42178
42103
  "70vh",
42179
42104
  "calc(100cqh - 70px)"
@@ -42182,7 +42107,7 @@ const node = css({
42182
42107
  __proto__: null,
42183
42108
  label,
42184
42109
  node,
42185
- scrollArea: scrollArea$2
42110
+ scrollArea: scrollArea$1
42186
42111
  }, Symbol.toStringTag, { value: "Module" })), selector2$1 = (state) => {
42187
42112
  const subjectExistsInScope = state.context.layouted?.subjectExistsInScope ?? !1;
42188
42113
  return {
@@ -42246,7 +42171,7 @@ const node = css({
42246
42171
  children: /* @__PURE__ */ jsx(Text, { fz: "xs", fw: "500", truncate: !0, children: subject?.title ?? "???" })
42247
42172
  }
42248
42173
  ) }),
42249
- /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { scrollbars: "y", type: "never", viewportRef: viewport, className: scrollArea$2, children: /* @__PURE__ */ jsx(
42174
+ /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { scrollbars: "y", type: "never", viewportRef: viewport, className: scrollArea$1, children: /* @__PURE__ */ jsx(
42250
42175
  Tree,
42251
42176
  {
42252
42177
  allowRangeSelection: !1,
@@ -43007,7 +42932,7 @@ function ElementDetailsCard({
43007
42932
  m$2.dialog,
43008
42933
  {
43009
42934
  ref,
43010
- className: cx(dialog$1, ReactRemoveScroll.classNames.fullWidth),
42935
+ className: cx(dialog, ReactRemoveScroll.classNames.fullWidth),
43011
42936
  layout: !0,
43012
42937
  initial: {
43013
42938
  [backdropBlur$1]: "0px",
@@ -44052,7 +43977,7 @@ css({
44052
43977
  alignItems: "baseline",
44053
43978
  justifyItems: "start"
44054
43979
  });
44055
- const scrollArea$1 = css({
43980
+ const scrollArea = css({
44056
43981
  maxHeight: [
44057
43982
  "70vh",
44058
43983
  "calc(100cqh - 70px)"
@@ -44122,7 +44047,7 @@ const scrollArea$1 = css({
44122
44047
  ]
44123
44048
  }
44124
44049
  ) }),
44125
- /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { className: scrollArea$1, scrollbars: "y", type: "never", viewportRef: viewport, children: /* @__PURE__ */ jsx(Box$1, { className: edgeGrid, p: "xs", maw: 400, children: edges.map((e2) => /* @__PURE__ */ jsxs(
44050
+ /* @__PURE__ */ jsx(PopoverDropdown, { p: 0, miw: 250, maw: 400, children: /* @__PURE__ */ jsx(ScrollAreaAutosize, { className: scrollArea, scrollbars: "y", type: "never", viewportRef: viewport, children: /* @__PURE__ */ jsx(Box$1, { className: edgeGrid, p: "xs", maw: 400, children: edges.map((e2) => /* @__PURE__ */ jsxs(
44126
44051
  "div",
44127
44052
  {
44128
44053
  className: edgeRow,
@@ -44433,32 +44358,27 @@ const select = (s2) => s2.children.search ?? null;
44433
44358
  function useSearchActorRef() {
44434
44359
  return useDiagramSnapshot(select, Object.is);
44435
44360
  }
44436
- function useSearchActor() {
44437
- const searchActorRef = useSearchActorRef();
44438
- if (!searchActorRef)
44439
- throw new Error("Search actor not found");
44440
- return searchActorRef;
44361
+ const SearchContext = createContext(null);
44362
+ function useSearchContext() {
44363
+ const ctx = useContext(SearchContext);
44364
+ if (!ctx)
44365
+ throw new Error("useSearchContext must be used within a SearchContext.Provider");
44366
+ return ctx;
44441
44367
  }
44442
- const selectSearchValue = (s2) => s2.context.searchValue;
44443
- function useSearch() {
44444
- const searchActorRef = useSearchActor(), searchValue = xstateReact_cjsExports.useSelector(searchActorRef, selectSearchValue), updateSearch = useCallback((search) => {
44445
- searchActorRef.send({ type: "change.search", search });
44446
- }, [searchActorRef]);
44447
- return [searchValue, updateSearch];
44368
+ function normalizeSearch(value) {
44369
+ if (value === "") return value;
44370
+ const v2 = value.trim().toLowerCase();
44371
+ return v2.startsWith("#") && v2.length <= 2 ? "" : v2.length > 1 ? v2 : "";
44448
44372
  }
44449
- const selectNormalizedSearchValue = (s2) => {
44450
- let v2 = selectSearchValue(s2);
44451
- return v2 === "" ? v2 : (v2 = v2.trim().toLowerCase(), v2.startsWith("#") && v2.length <= 2 ? "" : v2.length > 1 ? v2 : "");
44452
- };
44453
44373
  function useNormalizedSearch() {
44454
- const searchActorRef = useSearchActor();
44455
- return useDeferredValue(xstateReact_cjsExports.useSelector(searchActorRef, selectNormalizedSearchValue));
44374
+ const ctx = useSearchContext();
44375
+ return useDeferredValue(ctx.normalizedSearch);
44456
44376
  }
44457
44377
  function useUpdateSearch() {
44458
- const searchActorRef = useSearchActor();
44378
+ const { setSearchValue } = useSearchContext();
44459
44379
  return useCallback((search) => {
44460
- searchActorRef.send({ type: "change.search", search });
44461
- }, [searchActorRef]);
44380
+ setSearchValue(search);
44381
+ }, [setSearchValue]);
44462
44382
  }
44463
44383
  const buttonFocused = css.raw({
44464
44384
  outline: "none",
@@ -44728,7 +44648,7 @@ css({
44728
44648
  }
44729
44649
  });
44730
44650
  const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, children: "Nothing found" }), useFoundViews = () => {
44731
- const currentViewId = useCurrentViewId(), likec4model = useLikeC4Model(), search = useNormalizedSearch();
44651
+ const { currentViewId } = useSearchContext(), likec4model = useLikeC4Model(), search = useNormalizedSearch();
44732
44652
  return useMemo(() => {
44733
44653
  let views = [...likec4model.views()];
44734
44654
  if (search)
@@ -44778,7 +44698,7 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
44778
44698
  ViewButton,
44779
44699
  {
44780
44700
  view,
44781
- currentViewId,
44701
+ currentViewId: currentViewId ?? "",
44782
44702
  search,
44783
44703
  tabIndex: i2 === 0 ? 0 : -1
44784
44704
  }
@@ -44788,12 +44708,8 @@ const NothingFound = () => /* @__PURE__ */ jsx(Box, { className: emptyBoX, child
44788
44708
  );
44789
44709
  }), btn$1 = buttonsva();
44790
44710
  function ViewButton({ className, view, loop = !1, search, focusOnElement, currentViewId, ...props }) {
44791
- const searchActorRef = useSearchActor(), nextViewId = view.id, isCurrentView = nextViewId === currentViewId, navigate = () => {
44792
- searchActorRef.send({
44793
- type: "navigate.to",
44794
- viewId: nextViewId,
44795
- focusOnElement
44796
- });
44711
+ const ctx = useSearchContext(), nextViewId = view.id, isCurrentView = nextViewId === currentViewId, navigate = () => {
44712
+ ctx.navigateTo(nextViewId, focusOnElement);
44797
44713
  };
44798
44714
  return /* @__PURE__ */ jsxs(
44799
44715
  UnstyledButton,
@@ -45049,21 +44965,17 @@ function ElementTreeNode({ node: node2, elementProps, hasChildren, expanded, han
45049
44965
  ] });
45050
44966
  }
45051
44967
  function useHandleElementSelection() {
45052
- const searchActorRef = useSearchActor();
44968
+ const ctx = useSearchContext();
45053
44969
  return useCallbackRef((element) => {
45054
44970
  const views = [...element.views()];
45055
44971
  if (views.length === 0)
45056
44972
  return;
45057
44973
  const elementFqn = element.id, onlyOneViewId = t$a(views)?.id;
45058
44974
  if (!onlyOneViewId) {
45059
- searchActorRef.send({ type: "pickview.open", elementFqn });
44975
+ ctx.openPickView(elementFqn);
45060
44976
  return;
45061
44977
  }
45062
- searchActorRef.send({
45063
- type: "navigate.to",
45064
- viewId: onlyOneViewId,
45065
- focusOnElement: elementFqn
45066
- });
44978
+ ctx.navigateTo(onlyOneViewId, elementFqn);
45067
44979
  });
45068
44980
  }
45069
44981
  const input = css({
@@ -45120,14 +45032,13 @@ css({
45120
45032
  }
45121
45033
  });
45122
45034
  function PickView({
45123
- searchActorRef,
45124
45035
  elementFqn
45125
45036
  }) {
45126
- const currentViewId = useCurrentViewId(), element = useLikeC4Model().element(elementFqn), scoped = [], others = [];
45037
+ const ctx = useSearchContext(), currentViewId = ctx.currentViewId ?? "", element = useLikeC4Model().element(elementFqn), scoped = [], others = [];
45127
45038
  for (const view of element.views())
45128
45039
  view.viewOf === element ? scoped.push(view) : others.push(view);
45129
45040
  const closePickView = () => {
45130
- searchActorRef.send({ type: "pickview.close" });
45041
+ ctx.closePickView();
45131
45042
  };
45132
45043
  return useWindowEvent(
45133
45044
  "keydown",
@@ -45309,7 +45220,7 @@ function startingWithKind(search) {
45309
45220
  return search.match(/^(k|ki|kin|kind|kind:)$/) != null;
45310
45221
  }
45311
45222
  const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45312
- const searchActorRef = useSearchActor(), likec4model = useLikeC4Model(), inputRef = useRef(null), { ref, focused: focused2 } = useFocusWithin(), [search, setSearch] = useSearch(), combobox = useCombobox({
45223
+ const searchCtx = useSearchContext(), likec4model = useLikeC4Model(), inputRef = useRef(null), { ref, focused: focused2 } = useFocusWithin(), { searchValue: search, setSearchValue: setSearch } = searchCtx, combobox = useCombobox({
45313
45224
  scrollBehavior: "smooth",
45314
45225
  loop: !1
45315
45226
  });
@@ -45394,9 +45305,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45394
45305
  Input.ClearButton,
45395
45306
  {
45396
45307
  onClick: (e2) => {
45397
- e2.stopPropagation();
45398
- const openedWithSearch = searchActorRef.getSnapshot().context.openedWithSearch;
45399
- search === "" || search === openedWithSearch ? searchActorRef.send({ type: "close" }) : setSearch("");
45308
+ e2.stopPropagation(), search === "" || search === searchCtx.openedWithSearch ? searchCtx.close() : setSearch("");
45400
45309
  }
45401
45310
  }
45402
45311
  ),
@@ -45447,23 +45356,58 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45447
45356
  ]
45448
45357
  }
45449
45358
  );
45450
- }), dialog = css({
45359
+ }), selectSearchValue = (s2) => s2.context.searchValue, selectPickViewFor = (s2) => s2.context.pickViewFor, selectOpenedWithSearch = (s2) => s2.context.openedWithSearch;
45360
+ function XStateSearchAdapter({
45361
+ searchActorRef,
45362
+ children: children2
45363
+ }) {
45364
+ const searchValue = xstateReact_cjsExports.useSelector(searchActorRef, selectSearchValue), pickViewFor = xstateReact_cjsExports.useSelector(searchActorRef, selectPickViewFor), openedWithSearch = xstateReact_cjsExports.useSelector(searchActorRef, selectOpenedWithSearch), currentViewId = useCurrentViewId(), setSearchValue = useCallbackRef((search) => {
45365
+ searchActorRef.send({ type: "change.search", search });
45366
+ }), navigateTo = useCallbackRef((viewId, focusOnElement) => {
45367
+ searchActorRef.send({
45368
+ type: "navigate.to",
45369
+ viewId,
45370
+ focusOnElement
45371
+ });
45372
+ }), openPickView = useCallbackRef((elementFqn) => {
45373
+ searchActorRef.send({ type: "pickview.open", elementFqn });
45374
+ }), closePickView = useCallbackRef(() => {
45375
+ searchActorRef.send({ type: "pickview.close" });
45376
+ }), close = useCallbackRef(() => {
45377
+ searchActorRef.send({ type: "close" });
45378
+ }), value = useMemo(() => ({
45379
+ searchValue,
45380
+ setSearchValue,
45381
+ normalizedSearch: normalizeSearch(searchValue),
45382
+ navigateTo,
45383
+ openPickView,
45384
+ closePickView,
45385
+ pickViewFor,
45386
+ close,
45387
+ currentViewId,
45388
+ openedWithSearch
45389
+ }), [
45390
+ searchValue,
45391
+ pickViewFor,
45392
+ currentViewId,
45393
+ openedWithSearch,
45394
+ // stable refs from useCallbackRef — listed for exhaustive-deps lint rule
45395
+ setSearchValue,
45396
+ navigateTo,
45397
+ openPickView,
45398
+ closePickView,
45399
+ close
45400
+ ]);
45401
+ return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children: children2 });
45402
+ }
45403
+ const dialogCss = css({
45451
45404
  backgroundColor: "[rgb(34 34 34 / var(--_opacity, 95%))]",
45452
45405
  _light: {
45453
45406
  backgroundColor: "[rgb(250 250 250 / var(--_opacity, 95%))]"
45454
45407
  },
45455
45408
  backdropFilter: "auto",
45456
45409
  backdropBlur: "var(--_blur, 10px)"
45457
- // base: `[rgb(34 34 34 / var(${backdropOpacity}))]`,
45458
- // _light: `[rgb(255 255 255/ var(${backdropOpacity}))]`,
45459
- // },
45460
- }), body = css({
45461
- // containerName: 'likec4-search',
45462
- // containerType: 'size',
45463
- // position: 'fixed',
45464
- // zIndex: 901,
45465
- // top: '0',
45466
- // left: '0',
45410
+ }), bodyCss = css({
45467
45411
  width: "100%",
45468
45412
  height: "100%",
45469
45413
  maxHeight: "100vh",
@@ -45477,11 +45421,7 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45477
45421
  paddingRight: "md",
45478
45422
  paddingBottom: "sm",
45479
45423
  background: "transparent"
45480
- // backgroundColor: {
45481
- // _dark: `[rgb(34 34 34 / 0.95)]`,
45482
- // _light: `[rgb(255 255 255/ 0.95)]`,
45483
- // },
45484
- }), scrollArea = css({
45424
+ }), scrollAreaCss = css({
45485
45425
  height: [
45486
45426
  "100%",
45487
45427
  "100cqh"
@@ -45524,33 +45464,20 @@ const SEARCH_PREFIXES = ["#", "kind:"], LikeC4SearchInput = memo$2(() => {
45524
45464
  opacity: 0.9
45525
45465
  },
45526
45466
  classes: {
45527
- dialog,
45528
- body
45467
+ dialog: dialogCss,
45468
+ body: bodyCss
45529
45469
  },
45530
45470
  openDelay: 0,
45531
45471
  onClose: close,
45532
45472
  "data-likec4-search": "true",
45533
- children: /* @__PURE__ */ jsx(SearchOverlayBody, { searchActorRef })
45473
+ children: /* @__PURE__ */ jsx(XStateSearchAdapter, { searchActorRef, children: /* @__PURE__ */ jsx(SearchOverlayBody, { searchActorRef }) })
45534
45474
  }
45535
45475
  ) });
45536
45476
  });
45537
45477
  Search.displayName = "Search";
45538
- const selectPickViewFor = (s2) => s2.context.pickViewFor, SearchOverlayBody = memo$2(({ searchActorRef }) => {
45539
- const ref = useRef(null), pickViewFor = xstateReact_cjsExports.useSelector(searchActorRef, selectPickViewFor);
45540
- useTimeoutEffect(() => {
45541
- e$1(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
45542
- }, 150);
45543
- const [isPresent, safeToRemove] = usePresence();
45544
- return useEffect(() => {
45545
- if (!isPresent) {
45546
- safeToRemove();
45547
- try {
45548
- searchActorRef.send({ type: "animation.presence.end" });
45549
- } catch (e2) {
45550
- console.debug("SearchOverlayBody: animation.presence.end failed", e2);
45551
- }
45552
- }
45553
- }, [isPresent, searchActorRef, safeToRemove]), /* @__PURE__ */ jsxs(Box, { ref, display: "contents", children: [
45478
+ const SearchPanelContent = memo$2(() => {
45479
+ const ref = useRef(null), { pickViewFor } = useSearchContext();
45480
+ return /* @__PURE__ */ jsxs(Box, { ref, display: "contents", children: [
45554
45481
  /* @__PURE__ */ jsx(
45555
45482
  Group,
45556
45483
  {
@@ -45583,7 +45510,7 @@ const selectPickViewFor = (s2) => s2.context.pickViewFor, SearchOverlayBody = me
45583
45510
  ScrollArea,
45584
45511
  {
45585
45512
  type: "scroll",
45586
- className: scrollArea,
45513
+ className: scrollAreaCss,
45587
45514
  pr: "xs",
45588
45515
  scrollbars: "y",
45589
45516
  children: /* @__PURE__ */ jsx(LayoutGroup, { id: "likec4-search-elements", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(ElementsColumn, {}) }) })
@@ -45593,7 +45520,7 @@ const selectPickViewFor = (s2) => s2.context.pickViewFor, SearchOverlayBody = me
45593
45520
  ScrollArea,
45594
45521
  {
45595
45522
  type: "scroll",
45596
- className: scrollArea,
45523
+ className: scrollAreaCss,
45597
45524
  pr: "xs",
45598
45525
  scrollbars: "y",
45599
45526
  children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(LayoutGroup, { id: "likec4-search-views", children: /* @__PURE__ */ jsx(ViewsColumn, {}) }) })
@@ -45602,9 +45529,980 @@ const selectPickViewFor = (s2) => s2.context.pickViewFor, SearchOverlayBody = me
45602
45529
  ]
45603
45530
  }
45604
45531
  ),
45605
- pickViewFor && /* @__PURE__ */ jsx(PickView, { searchActorRef, elementFqn: pickViewFor })
45532
+ pickViewFor && /* @__PURE__ */ jsx(PickView, { elementFqn: pickViewFor })
45606
45533
  ] });
45607
45534
  });
45535
+ SearchPanelContent.displayName = "SearchPanelContent";
45536
+ const SearchOverlayBody = memo$2(function({ searchActorRef }) {
45537
+ const ref = useRef(null);
45538
+ useTimeoutEffect(() => {
45539
+ e$1(searchActorRef.getSnapshot().context.openedWithSearch) && focusToFirstFoundElement(ref.current);
45540
+ }, 150);
45541
+ const [isPresent, safeToRemove] = usePresence();
45542
+ return useEffect(() => {
45543
+ if (!isPresent) {
45544
+ safeToRemove();
45545
+ try {
45546
+ searchActorRef.send({ type: "animation.presence.end" });
45547
+ } catch (e2) {
45548
+ console.debug("SearchOverlayBody: animation.presence.end failed", e2);
45549
+ }
45550
+ }
45551
+ }, [isPresent, searchActorRef, safeToRemove]), /* @__PURE__ */ jsx(Box, { ref, display: "contents", children: /* @__PURE__ */ jsx(SearchPanelContent, {}) });
45552
+ }), sides = ["top", "right", "bottom", "left"], alignments = ["start", "end"], placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []), min = Math.min, max = Math.max, round = Math.round, floor = Math.floor, createCoords = (v2) => ({
45553
+ x: v2,
45554
+ y: v2
45555
+ }), oppositeSideMap = {
45556
+ left: "right",
45557
+ right: "left",
45558
+ bottom: "top",
45559
+ top: "bottom"
45560
+ };
45561
+ function evaluate(value, param) {
45562
+ return typeof value == "function" ? value(param) : value;
45563
+ }
45564
+ function getSide(placement) {
45565
+ return placement.split("-")[0];
45566
+ }
45567
+ function getAlignment(placement) {
45568
+ return placement.split("-")[1];
45569
+ }
45570
+ function getOppositeAxis(axis) {
45571
+ return axis === "x" ? "y" : "x";
45572
+ }
45573
+ function getAxisLength(axis) {
45574
+ return axis === "y" ? "height" : "width";
45575
+ }
45576
+ function getSideAxis(placement) {
45577
+ const firstChar = placement[0];
45578
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
45579
+ }
45580
+ function getAlignmentAxis(placement) {
45581
+ return getOppositeAxis(getSideAxis(placement));
45582
+ }
45583
+ function getAlignmentSides(placement, rects, rtl) {
45584
+ rtl === void 0 && (rtl = !1);
45585
+ const alignment = getAlignment(placement), alignmentAxis = getAlignmentAxis(placement), length = getAxisLength(alignmentAxis);
45586
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
45587
+ return rects.reference[length] > rects.floating[length] && (mainAlignmentSide = getOppositePlacement(mainAlignmentSide)), [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
45588
+ }
45589
+ function getOppositeAlignmentPlacement(placement) {
45590
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
45591
+ }
45592
+ function getOppositePlacement(placement) {
45593
+ const side = getSide(placement);
45594
+ return oppositeSideMap[side] + placement.slice(side.length);
45595
+ }
45596
+ function expandPaddingObject(padding) {
45597
+ return {
45598
+ top: 0,
45599
+ right: 0,
45600
+ bottom: 0,
45601
+ left: 0,
45602
+ ...padding
45603
+ };
45604
+ }
45605
+ function getPaddingObject(padding) {
45606
+ return typeof padding != "number" ? expandPaddingObject(padding) : {
45607
+ top: padding,
45608
+ right: padding,
45609
+ bottom: padding,
45610
+ left: padding
45611
+ };
45612
+ }
45613
+ function rectToClientRect(rect) {
45614
+ const {
45615
+ x: x2,
45616
+ y: y2,
45617
+ width,
45618
+ height
45619
+ } = rect;
45620
+ return {
45621
+ width,
45622
+ height,
45623
+ top: y2,
45624
+ left: x2,
45625
+ right: x2 + width,
45626
+ bottom: y2 + height,
45627
+ x: x2,
45628
+ y: y2
45629
+ };
45630
+ }
45631
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
45632
+ let {
45633
+ reference,
45634
+ floating
45635
+ } = _ref;
45636
+ const sideAxis = getSideAxis(placement), alignmentAxis = getAlignmentAxis(placement), alignLength = getAxisLength(alignmentAxis), side = getSide(placement), isVertical = sideAxis === "y", commonX = reference.x + reference.width / 2 - floating.width / 2, commonY = reference.y + reference.height / 2 - floating.height / 2, commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
45637
+ let coords;
45638
+ switch (side) {
45639
+ case "top":
45640
+ coords = {
45641
+ x: commonX,
45642
+ y: reference.y - floating.height
45643
+ };
45644
+ break;
45645
+ case "bottom":
45646
+ coords = {
45647
+ x: commonX,
45648
+ y: reference.y + reference.height
45649
+ };
45650
+ break;
45651
+ case "right":
45652
+ coords = {
45653
+ x: reference.x + reference.width,
45654
+ y: commonY
45655
+ };
45656
+ break;
45657
+ case "left":
45658
+ coords = {
45659
+ x: reference.x - floating.width,
45660
+ y: commonY
45661
+ };
45662
+ break;
45663
+ default:
45664
+ coords = {
45665
+ x: reference.x,
45666
+ y: reference.y
45667
+ };
45668
+ }
45669
+ switch (getAlignment(placement)) {
45670
+ case "start":
45671
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
45672
+ break;
45673
+ case "end":
45674
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
45675
+ break;
45676
+ }
45677
+ return coords;
45678
+ }
45679
+ async function detectOverflow(state, options) {
45680
+ var _await$platform$isEle;
45681
+ options === void 0 && (options = {});
45682
+ const {
45683
+ x: x2,
45684
+ y: y2,
45685
+ platform: platform2,
45686
+ rects,
45687
+ elements,
45688
+ strategy
45689
+ } = state, {
45690
+ boundary = "clippingAncestors",
45691
+ rootBoundary = "viewport",
45692
+ elementContext = "floating",
45693
+ altBoundary = !1,
45694
+ padding = 0
45695
+ } = evaluate(options, state), paddingObject = getPaddingObject(padding), element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext], clippingClientRect = rectToClientRect(await platform2.getClippingRect({
45696
+ element: (_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) == null || _await$platform$isEle ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
45697
+ boundary,
45698
+ rootBoundary,
45699
+ strategy
45700
+ })), rect = elementContext === "floating" ? {
45701
+ x: x2,
45702
+ y: y2,
45703
+ width: rects.floating.width,
45704
+ height: rects.floating.height
45705
+ } : rects.reference, offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)), offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
45706
+ x: 1,
45707
+ y: 1
45708
+ } : {
45709
+ x: 1,
45710
+ y: 1
45711
+ }, elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
45712
+ elements,
45713
+ rect,
45714
+ offsetParent,
45715
+ strategy
45716
+ }) : rect);
45717
+ return {
45718
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
45719
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
45720
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
45721
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
45722
+ };
45723
+ }
45724
+ const MAX_RESET_COUNT = 50, computePosition$1 = async (reference, floating, config) => {
45725
+ const {
45726
+ placement = "bottom",
45727
+ strategy = "absolute",
45728
+ middleware = [],
45729
+ platform: platform2
45730
+ } = config, platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
45731
+ ...platform2,
45732
+ detectOverflow
45733
+ }, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
45734
+ let rects = await platform2.getElementRects({
45735
+ reference,
45736
+ floating,
45737
+ strategy
45738
+ }), {
45739
+ x: x2,
45740
+ y: y2
45741
+ } = computeCoordsFromPlacement(rects, placement, rtl), statefulPlacement = placement, resetCount = 0;
45742
+ const middlewareData = {};
45743
+ for (let i2 = 0; i2 < middleware.length; i2++) {
45744
+ const currentMiddleware = middleware[i2];
45745
+ if (!currentMiddleware)
45746
+ continue;
45747
+ const {
45748
+ name,
45749
+ fn
45750
+ } = currentMiddleware, {
45751
+ x: nextX,
45752
+ y: nextY,
45753
+ data: data2,
45754
+ reset
45755
+ } = await fn({
45756
+ x: x2,
45757
+ y: y2,
45758
+ initialPlacement: placement,
45759
+ placement: statefulPlacement,
45760
+ strategy,
45761
+ middlewareData,
45762
+ rects,
45763
+ platform: platformWithDetectOverflow,
45764
+ elements: {
45765
+ reference,
45766
+ floating
45767
+ }
45768
+ });
45769
+ x2 = nextX ?? x2, y2 = nextY ?? y2, middlewareData[name] = {
45770
+ ...middlewareData[name],
45771
+ ...data2
45772
+ }, reset && resetCount < MAX_RESET_COUNT && (resetCount++, typeof reset == "object" && (reset.placement && (statefulPlacement = reset.placement), reset.rects && (rects = reset.rects === !0 ? await platform2.getElementRects({
45773
+ reference,
45774
+ floating,
45775
+ strategy
45776
+ }) : reset.rects), {
45777
+ x: x2,
45778
+ y: y2
45779
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)), i2 = -1);
45780
+ }
45781
+ return {
45782
+ x: x2,
45783
+ y: y2,
45784
+ placement: statefulPlacement,
45785
+ strategy,
45786
+ middlewareData
45787
+ };
45788
+ };
45789
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
45790
+ return (alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement)).filter((placement) => alignment ? getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : !1) : !0);
45791
+ }
45792
+ const autoPlacement$1 = function(options) {
45793
+ return options === void 0 && (options = {}), {
45794
+ name: "autoPlacement",
45795
+ options,
45796
+ async fn(state) {
45797
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
45798
+ const {
45799
+ rects,
45800
+ middlewareData,
45801
+ placement,
45802
+ platform: platform2,
45803
+ elements
45804
+ } = state, {
45805
+ crossAxis = !1,
45806
+ alignment,
45807
+ allowedPlacements = placements,
45808
+ autoAlignment = !0,
45809
+ ...detectOverflowOptions
45810
+ } = evaluate(options, state), placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements, overflow = await platform2.detectOverflow(state, detectOverflowOptions), currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0, currentPlacement = placements$1[currentIndex];
45811
+ if (currentPlacement == null)
45812
+ return {};
45813
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
45814
+ if (placement !== currentPlacement)
45815
+ return {
45816
+ reset: {
45817
+ placement: placements$1[0]
45818
+ }
45819
+ };
45820
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]], allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
45821
+ placement: currentPlacement,
45822
+ overflows: currentOverflows
45823
+ }], nextPlacement = placements$1[currentIndex + 1];
45824
+ if (nextPlacement)
45825
+ return {
45826
+ data: {
45827
+ index: currentIndex + 1,
45828
+ overflows: allOverflows
45829
+ },
45830
+ reset: {
45831
+ placement: nextPlacement
45832
+ }
45833
+ };
45834
+ const placementsSortedByMostSpace = allOverflows.map((d2) => {
45835
+ const alignment2 = getAlignment(d2.placement);
45836
+ return [d2.placement, alignment2 && crossAxis ? (
45837
+ // Check along the mainAxis and main crossAxis side.
45838
+ d2.overflows.slice(0, 2).reduce((acc, v2) => acc + v2, 0)
45839
+ ) : (
45840
+ // Check only the mainAxis.
45841
+ d2.overflows[0]
45842
+ ), d2.overflows];
45843
+ }).sort((a2, b2) => a2[1] - b2[1]), resetPlacement = ((_placementsThatFitOnE = placementsSortedByMostSpace.filter((d2) => d2[2].slice(
45844
+ 0,
45845
+ // Aligned placements should not check their opposite crossAxis
45846
+ // side.
45847
+ getAlignment(d2[0]) ? 2 : 3
45848
+ ).every((v2) => v2 <= 0))[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
45849
+ return resetPlacement !== placement ? {
45850
+ data: {
45851
+ index: currentIndex + 1,
45852
+ overflows: allOverflows
45853
+ },
45854
+ reset: {
45855
+ placement: resetPlacement
45856
+ }
45857
+ } : {};
45858
+ }
45859
+ };
45860
+ };
45861
+ function getSideOffsets(overflow, rect) {
45862
+ return {
45863
+ top: overflow.top - rect.height,
45864
+ right: overflow.right - rect.width,
45865
+ bottom: overflow.bottom - rect.height,
45866
+ left: overflow.left - rect.width
45867
+ };
45868
+ }
45869
+ function isAnySideFullyClipped(overflow) {
45870
+ return sides.some((side) => overflow[side] >= 0);
45871
+ }
45872
+ const hide$1 = function(options) {
45873
+ return options === void 0 && (options = {}), {
45874
+ name: "hide",
45875
+ options,
45876
+ async fn(state) {
45877
+ const {
45878
+ rects,
45879
+ platform: platform2
45880
+ } = state, {
45881
+ strategy = "referenceHidden",
45882
+ ...detectOverflowOptions
45883
+ } = evaluate(options, state);
45884
+ switch (strategy) {
45885
+ case "referenceHidden": {
45886
+ const overflow = await platform2.detectOverflow(state, {
45887
+ ...detectOverflowOptions,
45888
+ elementContext: "reference"
45889
+ }), offsets = getSideOffsets(overflow, rects.reference);
45890
+ return {
45891
+ data: {
45892
+ referenceHiddenOffsets: offsets,
45893
+ referenceHidden: isAnySideFullyClipped(offsets)
45894
+ }
45895
+ };
45896
+ }
45897
+ case "escaped": {
45898
+ const overflow = await platform2.detectOverflow(state, {
45899
+ ...detectOverflowOptions,
45900
+ altBoundary: !0
45901
+ }), offsets = getSideOffsets(overflow, rects.floating);
45902
+ return {
45903
+ data: {
45904
+ escapedOffsets: offsets,
45905
+ escaped: isAnySideFullyClipped(offsets)
45906
+ }
45907
+ };
45908
+ }
45909
+ default:
45910
+ return {};
45911
+ }
45912
+ }
45913
+ };
45914
+ }, originSides = /* @__PURE__ */ new Set(["left", "top"]);
45915
+ async function convertValueToCoords(state, options) {
45916
+ const {
45917
+ placement,
45918
+ platform: platform2,
45919
+ elements
45920
+ } = state, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), side = getSide(placement), alignment = getAlignment(placement), isVertical = getSideAxis(placement) === "y", mainAxisMulti = originSides.has(side) ? -1 : 1, crossAxisMulti = rtl && isVertical ? -1 : 1, rawValue = evaluate(options, state);
45921
+ let {
45922
+ mainAxis,
45923
+ crossAxis,
45924
+ alignmentAxis
45925
+ } = typeof rawValue == "number" ? {
45926
+ mainAxis: rawValue,
45927
+ crossAxis: 0,
45928
+ alignmentAxis: null
45929
+ } : {
45930
+ mainAxis: rawValue.mainAxis || 0,
45931
+ crossAxis: rawValue.crossAxis || 0,
45932
+ alignmentAxis: rawValue.alignmentAxis
45933
+ };
45934
+ return alignment && typeof alignmentAxis == "number" && (crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis), isVertical ? {
45935
+ x: crossAxis * crossAxisMulti,
45936
+ y: mainAxis * mainAxisMulti
45937
+ } : {
45938
+ x: mainAxis * mainAxisMulti,
45939
+ y: crossAxis * crossAxisMulti
45940
+ };
45941
+ }
45942
+ const offset$1 = function(options) {
45943
+ return options === void 0 && (options = 0), {
45944
+ name: "offset",
45945
+ options,
45946
+ async fn(state) {
45947
+ var _middlewareData$offse, _middlewareData$arrow;
45948
+ const {
45949
+ x: x2,
45950
+ y: y2,
45951
+ placement,
45952
+ middlewareData
45953
+ } = state, diffCoords = await convertValueToCoords(state, options);
45954
+ return placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset ? {} : {
45955
+ x: x2 + diffCoords.x,
45956
+ y: y2 + diffCoords.y,
45957
+ data: {
45958
+ ...diffCoords,
45959
+ placement
45960
+ }
45961
+ };
45962
+ }
45963
+ };
45964
+ }, size$1 = function(options) {
45965
+ return options === void 0 && (options = {}), {
45966
+ name: "size",
45967
+ options,
45968
+ async fn(state) {
45969
+ var _state$middlewareData, _state$middlewareData2;
45970
+ const {
45971
+ placement,
45972
+ rects,
45973
+ platform: platform2,
45974
+ elements
45975
+ } = state, {
45976
+ apply = () => {
45977
+ },
45978
+ ...detectOverflowOptions
45979
+ } = evaluate(options, state), overflow = await platform2.detectOverflow(state, detectOverflowOptions), side = getSide(placement), alignment = getAlignment(placement), isYAxis = getSideAxis(placement) === "y", {
45980
+ width,
45981
+ height
45982
+ } = rects.floating;
45983
+ let heightSide, widthSide;
45984
+ side === "top" || side === "bottom" ? (heightSide = side, widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right") : (widthSide = side, heightSide = alignment === "end" ? "top" : "bottom");
45985
+ const maximumClippingHeight = height - overflow.top - overflow.bottom, maximumClippingWidth = width - overflow.left - overflow.right, overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight), overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth), noShift = !state.middlewareData.shift;
45986
+ let availableHeight = overflowAvailableHeight, availableWidth = overflowAvailableWidth;
45987
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x && (availableWidth = maximumClippingWidth), (_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y && (availableHeight = maximumClippingHeight), noShift && !alignment) {
45988
+ const xMin = max(overflow.left, 0), xMax = max(overflow.right, 0), yMin = max(overflow.top, 0), yMax = max(overflow.bottom, 0);
45989
+ isYAxis ? availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)) : availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
45990
+ }
45991
+ await apply({
45992
+ ...state,
45993
+ availableWidth,
45994
+ availableHeight
45995
+ });
45996
+ const nextDimensions = await platform2.getDimensions(elements.floating);
45997
+ return width !== nextDimensions.width || height !== nextDimensions.height ? {
45998
+ reset: {
45999
+ rects: !0
46000
+ }
46001
+ } : {};
46002
+ }
46003
+ };
46004
+ };
46005
+ function hasWindow() {
46006
+ return typeof window < "u";
46007
+ }
46008
+ function getNodeName(node2) {
46009
+ return isNode(node2) ? (node2.nodeName || "").toLowerCase() : "#document";
46010
+ }
46011
+ function getWindow(node2) {
46012
+ var _node$ownerDocument;
46013
+ return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
46014
+ }
46015
+ function getDocumentElement(node2) {
46016
+ var _ref;
46017
+ return (_ref = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
46018
+ }
46019
+ function isNode(value) {
46020
+ return hasWindow() ? value instanceof Node || value instanceof getWindow(value).Node : !1;
46021
+ }
46022
+ function isElement(value) {
46023
+ return hasWindow() ? value instanceof Element || value instanceof getWindow(value).Element : !1;
46024
+ }
46025
+ function isHTMLElement(value) {
46026
+ return hasWindow() ? value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement : !1;
46027
+ }
46028
+ function isShadowRoot(value) {
46029
+ return !hasWindow() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
46030
+ }
46031
+ function isOverflowElement(element) {
46032
+ const {
46033
+ overflow,
46034
+ overflowX,
46035
+ overflowY,
46036
+ display
46037
+ } = getComputedStyle$1(element);
46038
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
46039
+ }
46040
+ function isTableElement(element) {
46041
+ return /^(table|td|th)$/.test(getNodeName(element));
46042
+ }
46043
+ function isTopLayer(element) {
46044
+ try {
46045
+ if (element.matches(":popover-open"))
46046
+ return !0;
46047
+ } catch {
46048
+ }
46049
+ try {
46050
+ return element.matches(":modal");
46051
+ } catch {
46052
+ return !1;
46053
+ }
46054
+ }
46055
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/, containRe = /paint|layout|strict|content/, isNotNone = (value) => !!value && value !== "none";
46056
+ let isWebKitValue;
46057
+ function isContainingBlock(elementOrCss) {
46058
+ const css2 = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
46059
+ return isNotNone(css2.transform) || isNotNone(css2.translate) || isNotNone(css2.scale) || isNotNone(css2.rotate) || isNotNone(css2.perspective) || !isWebKit() && (isNotNone(css2.backdropFilter) || isNotNone(css2.filter)) || willChangeRe.test(css2.willChange || "") || containRe.test(css2.contain || "");
46060
+ }
46061
+ function getContainingBlock(element) {
46062
+ let currentNode = getParentNode(element);
46063
+ for (; isHTMLElement(currentNode) && !isLastTraversableNode(currentNode); ) {
46064
+ if (isContainingBlock(currentNode))
46065
+ return currentNode;
46066
+ if (isTopLayer(currentNode))
46067
+ return null;
46068
+ currentNode = getParentNode(currentNode);
46069
+ }
46070
+ return null;
46071
+ }
46072
+ function isWebKit() {
46073
+ return isWebKitValue == null && (isWebKitValue = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), isWebKitValue;
46074
+ }
46075
+ function isLastTraversableNode(node2) {
46076
+ return /^(html|body|#document)$/.test(getNodeName(node2));
46077
+ }
46078
+ function getComputedStyle$1(element) {
46079
+ return getWindow(element).getComputedStyle(element);
46080
+ }
46081
+ function getNodeScroll(element) {
46082
+ return isElement(element) ? {
46083
+ scrollLeft: element.scrollLeft,
46084
+ scrollTop: element.scrollTop
46085
+ } : {
46086
+ scrollLeft: element.scrollX,
46087
+ scrollTop: element.scrollY
46088
+ };
46089
+ }
46090
+ function getParentNode(node2) {
46091
+ if (getNodeName(node2) === "html")
46092
+ return node2;
46093
+ const result = (
46094
+ // Step into the shadow DOM of the parent of a slotted node.
46095
+ node2.assignedSlot || // DOM Element detected.
46096
+ node2.parentNode || // ShadowRoot detected.
46097
+ isShadowRoot(node2) && node2.host || // Fallback.
46098
+ getDocumentElement(node2)
46099
+ );
46100
+ return isShadowRoot(result) ? result.host : result;
46101
+ }
46102
+ function getNearestOverflowAncestor(node2) {
46103
+ const parentNode = getParentNode(node2);
46104
+ return isLastTraversableNode(parentNode) ? node2.ownerDocument ? node2.ownerDocument.body : node2.body : isHTMLElement(parentNode) && isOverflowElement(parentNode) ? parentNode : getNearestOverflowAncestor(parentNode);
46105
+ }
46106
+ function getOverflowAncestors(node2, list2, traverseIframes) {
46107
+ var _node$ownerDocument2;
46108
+ list2 === void 0 && (list2 = []), traverseIframes === void 0 && (traverseIframes = !0);
46109
+ const scrollableAncestor = getNearestOverflowAncestor(node2), isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body), win2 = getWindow(scrollableAncestor);
46110
+ if (isBody) {
46111
+ const frameElement = getFrameElement(win2);
46112
+ return list2.concat(win2, win2.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
46113
+ } else
46114
+ return list2.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
46115
+ }
46116
+ function getFrameElement(win2) {
46117
+ return win2.parent && Object.getPrototypeOf(win2.parent) ? win2.frameElement : null;
46118
+ }
46119
+ function getCssDimensions(element) {
46120
+ const css2 = getComputedStyle$1(element);
46121
+ let width = parseFloat(css2.width) || 0, height = parseFloat(css2.height) || 0;
46122
+ const hasOffset = isHTMLElement(element), offsetWidth = hasOffset ? element.offsetWidth : width, offsetHeight = hasOffset ? element.offsetHeight : height, shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
46123
+ return shouldFallback && (width = offsetWidth, height = offsetHeight), {
46124
+ width,
46125
+ height,
46126
+ $: shouldFallback
46127
+ };
46128
+ }
46129
+ function unwrapElement(element) {
46130
+ return isElement(element) ? element : element.contextElement;
46131
+ }
46132
+ function getScale(element) {
46133
+ const domElement = unwrapElement(element);
46134
+ if (!isHTMLElement(domElement))
46135
+ return createCoords(1);
46136
+ const rect = domElement.getBoundingClientRect(), {
46137
+ width,
46138
+ height,
46139
+ $
46140
+ } = getCssDimensions(domElement);
46141
+ let x2 = ($ ? round(rect.width) : rect.width) / width, y2 = ($ ? round(rect.height) : rect.height) / height;
46142
+ return (!x2 || !Number.isFinite(x2)) && (x2 = 1), (!y2 || !Number.isFinite(y2)) && (y2 = 1), {
46143
+ x: x2,
46144
+ y: y2
46145
+ };
46146
+ }
46147
+ const noOffsets = /* @__PURE__ */ createCoords(0);
46148
+ function getVisualOffsets(element) {
46149
+ const win2 = getWindow(element);
46150
+ return !isWebKit() || !win2.visualViewport ? noOffsets : {
46151
+ x: win2.visualViewport.offsetLeft,
46152
+ y: win2.visualViewport.offsetTop
46153
+ };
46154
+ }
46155
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
46156
+ return isFixed === void 0 && (isFixed = !1), !floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element) ? !1 : isFixed;
46157
+ }
46158
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
46159
+ includeScale === void 0 && (includeScale = !1), isFixedStrategy === void 0 && (isFixedStrategy = !1);
46160
+ const clientRect = element.getBoundingClientRect(), domElement = unwrapElement(element);
46161
+ let scale2 = createCoords(1);
46162
+ includeScale && (offsetParent ? isElement(offsetParent) && (scale2 = getScale(offsetParent)) : scale2 = getScale(element));
46163
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
46164
+ let x2 = (clientRect.left + visualOffsets.x) / scale2.x, y2 = (clientRect.top + visualOffsets.y) / scale2.y, width = clientRect.width / scale2.x, height = clientRect.height / scale2.y;
46165
+ if (domElement) {
46166
+ const win2 = getWindow(domElement), offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
46167
+ let currentWin = win2, currentIFrame = getFrameElement(currentWin);
46168
+ for (; currentIFrame && offsetParent && offsetWin !== currentWin; ) {
46169
+ const iframeScale = getScale(currentIFrame), iframeRect = currentIFrame.getBoundingClientRect(), css2 = getComputedStyle$1(currentIFrame), left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x, top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y;
46170
+ x2 *= iframeScale.x, y2 *= iframeScale.y, width *= iframeScale.x, height *= iframeScale.y, x2 += left, y2 += top, currentWin = getWindow(currentIFrame), currentIFrame = getFrameElement(currentWin);
46171
+ }
46172
+ }
46173
+ return rectToClientRect({
46174
+ width,
46175
+ height,
46176
+ x: x2,
46177
+ y: y2
46178
+ });
46179
+ }
46180
+ function getWindowScrollBarX(element, rect) {
46181
+ const leftScroll = getNodeScroll(element).scrollLeft;
46182
+ return rect ? rect.left + leftScroll : getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
46183
+ }
46184
+ function getHTMLOffset(documentElement, scroll) {
46185
+ const htmlRect = documentElement.getBoundingClientRect(), x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect), y2 = htmlRect.top + scroll.scrollTop;
46186
+ return {
46187
+ x: x2,
46188
+ y: y2
46189
+ };
46190
+ }
46191
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
46192
+ let {
46193
+ elements,
46194
+ rect,
46195
+ offsetParent,
46196
+ strategy
46197
+ } = _ref;
46198
+ const isFixed = strategy === "fixed", documentElement = getDocumentElement(offsetParent), topLayer = elements ? isTopLayer(elements.floating) : !1;
46199
+ if (offsetParent === documentElement || topLayer && isFixed)
46200
+ return rect;
46201
+ let scroll = {
46202
+ scrollLeft: 0,
46203
+ scrollTop: 0
46204
+ }, scale2 = createCoords(1);
46205
+ const offsets = createCoords(0), isOffsetParentAnElement = isHTMLElement(offsetParent);
46206
+ if ((isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) && ((getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) && (scroll = getNodeScroll(offsetParent)), isOffsetParentAnElement)) {
46207
+ const offsetRect = getBoundingClientRect(offsetParent);
46208
+ scale2 = getScale(offsetParent), offsets.x = offsetRect.x + offsetParent.clientLeft, offsets.y = offsetRect.y + offsetParent.clientTop;
46209
+ }
46210
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
46211
+ return {
46212
+ width: rect.width * scale2.x,
46213
+ height: rect.height * scale2.y,
46214
+ x: rect.x * scale2.x - scroll.scrollLeft * scale2.x + offsets.x + htmlOffset.x,
46215
+ y: rect.y * scale2.y - scroll.scrollTop * scale2.y + offsets.y + htmlOffset.y
46216
+ };
46217
+ }
46218
+ function getClientRects(element) {
46219
+ return Array.from(element.getClientRects());
46220
+ }
46221
+ function getDocumentRect(element) {
46222
+ const html = getDocumentElement(element), scroll = getNodeScroll(element), body = element.ownerDocument.body, width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth), height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
46223
+ let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
46224
+ const y2 = -scroll.scrollTop;
46225
+ return getComputedStyle$1(body).direction === "rtl" && (x2 += max(html.clientWidth, body.clientWidth) - width), {
46226
+ width,
46227
+ height,
46228
+ x: x2,
46229
+ y: y2
46230
+ };
46231
+ }
46232
+ const SCROLLBAR_MAX = 25;
46233
+ function getViewportRect(element, strategy) {
46234
+ const win2 = getWindow(element), html = getDocumentElement(element), visualViewport = win2.visualViewport;
46235
+ let width = html.clientWidth, height = html.clientHeight, x2 = 0, y2 = 0;
46236
+ if (visualViewport) {
46237
+ width = visualViewport.width, height = visualViewport.height;
46238
+ const visualViewportBased = isWebKit();
46239
+ (!visualViewportBased || visualViewportBased && strategy === "fixed") && (x2 = visualViewport.offsetLeft, y2 = visualViewport.offsetTop);
46240
+ }
46241
+ const windowScrollbarX = getWindowScrollBarX(html);
46242
+ if (windowScrollbarX <= 0) {
46243
+ const doc = html.ownerDocument, body = doc.body, bodyStyles = getComputedStyle(body), bodyMarginInline = doc.compatMode === "CSS1Compat" && parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0, clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
46244
+ clippingStableScrollbarWidth <= SCROLLBAR_MAX && (width -= clippingStableScrollbarWidth);
46245
+ } else windowScrollbarX <= SCROLLBAR_MAX && (width += windowScrollbarX);
46246
+ return {
46247
+ width,
46248
+ height,
46249
+ x: x2,
46250
+ y: y2
46251
+ };
46252
+ }
46253
+ function getInnerBoundingClientRect(element, strategy) {
46254
+ const clientRect = getBoundingClientRect(element, !0, strategy === "fixed"), top = clientRect.top + element.clientTop, left = clientRect.left + element.clientLeft, scale2 = isHTMLElement(element) ? getScale(element) : createCoords(1), width = element.clientWidth * scale2.x, height = element.clientHeight * scale2.y, x2 = left * scale2.x, y2 = top * scale2.y;
46255
+ return {
46256
+ width,
46257
+ height,
46258
+ x: x2,
46259
+ y: y2
46260
+ };
46261
+ }
46262
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
46263
+ let rect;
46264
+ if (clippingAncestor === "viewport")
46265
+ rect = getViewportRect(element, strategy);
46266
+ else if (clippingAncestor === "document")
46267
+ rect = getDocumentRect(getDocumentElement(element));
46268
+ else if (isElement(clippingAncestor))
46269
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
46270
+ else {
46271
+ const visualOffsets = getVisualOffsets(element);
46272
+ rect = {
46273
+ x: clippingAncestor.x - visualOffsets.x,
46274
+ y: clippingAncestor.y - visualOffsets.y,
46275
+ width: clippingAncestor.width,
46276
+ height: clippingAncestor.height
46277
+ };
46278
+ }
46279
+ return rectToClientRect(rect);
46280
+ }
46281
+ function hasFixedPositionAncestor(element, stopNode) {
46282
+ const parentNode = getParentNode(element);
46283
+ return parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode) ? !1 : getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
46284
+ }
46285
+ function getClippingElementAncestors(element, cache) {
46286
+ const cachedResult = cache.get(element);
46287
+ if (cachedResult)
46288
+ return cachedResult;
46289
+ let result = getOverflowAncestors(element, [], !1).filter((el) => isElement(el) && getNodeName(el) !== "body"), currentContainingBlockComputedStyle = null;
46290
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
46291
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
46292
+ for (; isElement(currentNode) && !isLastTraversableNode(currentNode); ) {
46293
+ const computedStyle = getComputedStyle$1(currentNode), currentNodeIsContaining = isContainingBlock(currentNode);
46294
+ !currentNodeIsContaining && computedStyle.position === "fixed" && (currentContainingBlockComputedStyle = null), (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) ? result = result.filter((ancestor) => ancestor !== currentNode) : currentContainingBlockComputedStyle = computedStyle, currentNode = getParentNode(currentNode);
46295
+ }
46296
+ return cache.set(element, result), result;
46297
+ }
46298
+ function getClippingRect(_ref) {
46299
+ let {
46300
+ element,
46301
+ boundary,
46302
+ rootBoundary,
46303
+ strategy
46304
+ } = _ref;
46305
+ const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary], firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
46306
+ let top = firstRect.top, right = firstRect.right, bottom = firstRect.bottom, left = firstRect.left;
46307
+ for (let i2 = 1; i2 < clippingAncestors.length; i2++) {
46308
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy);
46309
+ top = max(rect.top, top), right = min(rect.right, right), bottom = min(rect.bottom, bottom), left = max(rect.left, left);
46310
+ }
46311
+ return {
46312
+ width: right - left,
46313
+ height: bottom - top,
46314
+ x: left,
46315
+ y: top
46316
+ };
46317
+ }
46318
+ function getDimensions(element) {
46319
+ const {
46320
+ width,
46321
+ height
46322
+ } = getCssDimensions(element);
46323
+ return {
46324
+ width,
46325
+ height
46326
+ };
46327
+ }
46328
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
46329
+ const isOffsetParentAnElement = isHTMLElement(offsetParent), documentElement = getDocumentElement(offsetParent), isFixed = strategy === "fixed", rect = getBoundingClientRect(element, !0, isFixed, offsetParent);
46330
+ let scroll = {
46331
+ scrollLeft: 0,
46332
+ scrollTop: 0
46333
+ };
46334
+ const offsets = createCoords(0);
46335
+ function setLeftRTLScrollbarOffset() {
46336
+ offsets.x = getWindowScrollBarX(documentElement);
46337
+ }
46338
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed)
46339
+ if ((getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) && (scroll = getNodeScroll(offsetParent)), isOffsetParentAnElement) {
46340
+ const offsetRect = getBoundingClientRect(offsetParent, !0, isFixed, offsetParent);
46341
+ offsets.x = offsetRect.x + offsetParent.clientLeft, offsets.y = offsetRect.y + offsetParent.clientTop;
46342
+ } else documentElement && setLeftRTLScrollbarOffset();
46343
+ isFixed && !isOffsetParentAnElement && documentElement && setLeftRTLScrollbarOffset();
46344
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0), x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x, y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
46345
+ return {
46346
+ x: x2,
46347
+ y: y2,
46348
+ width: rect.width,
46349
+ height: rect.height
46350
+ };
46351
+ }
46352
+ function isStaticPositioned(element) {
46353
+ return getComputedStyle$1(element).position === "static";
46354
+ }
46355
+ function getTrueOffsetParent(element, polyfill) {
46356
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed")
46357
+ return null;
46358
+ if (polyfill)
46359
+ return polyfill(element);
46360
+ let rawOffsetParent = element.offsetParent;
46361
+ return getDocumentElement(element) === rawOffsetParent && (rawOffsetParent = rawOffsetParent.ownerDocument.body), rawOffsetParent;
46362
+ }
46363
+ function getOffsetParent(element, polyfill) {
46364
+ const win2 = getWindow(element);
46365
+ if (isTopLayer(element))
46366
+ return win2;
46367
+ if (!isHTMLElement(element)) {
46368
+ let svgOffsetParent = getParentNode(element);
46369
+ for (; svgOffsetParent && !isLastTraversableNode(svgOffsetParent); ) {
46370
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent))
46371
+ return svgOffsetParent;
46372
+ svgOffsetParent = getParentNode(svgOffsetParent);
46373
+ }
46374
+ return win2;
46375
+ }
46376
+ let offsetParent = getTrueOffsetParent(element, polyfill);
46377
+ for (; offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent); )
46378
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
46379
+ return offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent) ? win2 : offsetParent || getContainingBlock(element) || win2;
46380
+ }
46381
+ const getElementRects = async function(data2) {
46382
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent, getDimensionsFn = this.getDimensions, floatingDimensions = await getDimensionsFn(data2.floating);
46383
+ return {
46384
+ reference: getRectRelativeToOffsetParent(data2.reference, await getOffsetParentFn(data2.floating), data2.strategy),
46385
+ floating: {
46386
+ x: 0,
46387
+ y: 0,
46388
+ width: floatingDimensions.width,
46389
+ height: floatingDimensions.height
46390
+ }
46391
+ };
46392
+ };
46393
+ function isRTL(element) {
46394
+ return getComputedStyle$1(element).direction === "rtl";
46395
+ }
46396
+ const platform = {
46397
+ convertOffsetParentRelativeRectToViewportRelativeRect,
46398
+ getDocumentElement,
46399
+ getClippingRect,
46400
+ getOffsetParent,
46401
+ getElementRects,
46402
+ getClientRects,
46403
+ getDimensions,
46404
+ getScale,
46405
+ isElement,
46406
+ isRTL
46407
+ };
46408
+ function rectsAreEqual(a2, b2) {
46409
+ return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height;
46410
+ }
46411
+ function observeMove(element, onMove) {
46412
+ let io = null, timeoutId;
46413
+ const root2 = getDocumentElement(element);
46414
+ function cleanup() {
46415
+ var _io;
46416
+ clearTimeout(timeoutId), (_io = io) == null || _io.disconnect(), io = null;
46417
+ }
46418
+ function refresh(skip, threshold) {
46419
+ skip === void 0 && (skip = !1), threshold === void 0 && (threshold = 1), cleanup();
46420
+ const elementRectForRootMargin = element.getBoundingClientRect(), {
46421
+ left,
46422
+ top,
46423
+ width,
46424
+ height
46425
+ } = elementRectForRootMargin;
46426
+ if (skip || onMove(), !width || !height)
46427
+ return;
46428
+ const insetTop = floor(top), insetRight = floor(root2.clientWidth - (left + width)), insetBottom = floor(root2.clientHeight - (top + height)), insetLeft = floor(left), options = {
46429
+ rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px",
46430
+ threshold: max(0, min(1, threshold)) || 1
46431
+ };
46432
+ let isFirstUpdate = !0;
46433
+ function handleObserve(entries) {
46434
+ const ratio = entries[0].intersectionRatio;
46435
+ if (ratio !== threshold) {
46436
+ if (!isFirstUpdate)
46437
+ return refresh();
46438
+ ratio ? refresh(!1, ratio) : timeoutId = setTimeout(() => {
46439
+ refresh(!1, 1e-7);
46440
+ }, 1e3);
46441
+ }
46442
+ ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect()) && refresh(), isFirstUpdate = !1;
46443
+ }
46444
+ try {
46445
+ io = new IntersectionObserver(handleObserve, {
46446
+ ...options,
46447
+ // Handle <iframe>s
46448
+ root: root2.ownerDocument
46449
+ });
46450
+ } catch {
46451
+ io = new IntersectionObserver(handleObserve, options);
46452
+ }
46453
+ io.observe(element);
46454
+ }
46455
+ return refresh(!0), cleanup;
46456
+ }
46457
+ function autoUpdate(reference, floating, update, options) {
46458
+ options === void 0 && (options = {});
46459
+ const {
46460
+ ancestorScroll = !0,
46461
+ ancestorResize = !0,
46462
+ elementResize = typeof ResizeObserver == "function",
46463
+ layoutShift = typeof IntersectionObserver == "function",
46464
+ animationFrame = !1
46465
+ } = options, referenceEl = unwrapElement(reference), ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
46466
+ ancestors.forEach((ancestor) => {
46467
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
46468
+ passive: !0
46469
+ }), ancestorResize && ancestor.addEventListener("resize", update);
46470
+ });
46471
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
46472
+ let reobserveFrame = -1, resizeObserver = null;
46473
+ elementResize && (resizeObserver = new ResizeObserver((_ref) => {
46474
+ let [firstEntry] = _ref;
46475
+ firstEntry && firstEntry.target === referenceEl && resizeObserver && floating && (resizeObserver.unobserve(floating), cancelAnimationFrame(reobserveFrame), reobserveFrame = requestAnimationFrame(() => {
46476
+ var _resizeObserver;
46477
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
46478
+ })), update();
46479
+ }), referenceEl && !animationFrame && resizeObserver.observe(referenceEl), floating && resizeObserver.observe(floating));
46480
+ let frameId, prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
46481
+ animationFrame && frameLoop();
46482
+ function frameLoop() {
46483
+ const nextRefRect = getBoundingClientRect(reference);
46484
+ prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect) && update(), prevRefRect = nextRefRect, frameId = requestAnimationFrame(frameLoop);
46485
+ }
46486
+ return update(), () => {
46487
+ var _resizeObserver2;
46488
+ ancestors.forEach((ancestor) => {
46489
+ ancestorScroll && ancestor.removeEventListener("scroll", update), ancestorResize && ancestor.removeEventListener("resize", update);
46490
+ }), cleanupIo?.(), (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(), resizeObserver = null, animationFrame && cancelAnimationFrame(frameId);
46491
+ };
46492
+ }
46493
+ const offset = offset$1, autoPlacement = autoPlacement$1, size = size$1, hide = hide$1, computePosition = (reference, floating, options) => {
46494
+ const cache = /* @__PURE__ */ new Map(), mergedOptions = {
46495
+ platform,
46496
+ ...options
46497
+ }, platformWithCache = {
46498
+ ...mergedOptions.platform,
46499
+ _c: cache
46500
+ };
46501
+ return computePosition$1(reference, floating, {
46502
+ ...mergedOptions,
46503
+ platform: platformWithCache
46504
+ });
46505
+ };
45608
46506
  function PortalToContainer({ children: children2 }) {
45609
46507
  const ctx = useRootContainerContext();
45610
46508
  if (!ctx)
@@ -45895,7 +46793,7 @@ const RelationshipPopover = memo$2(() => {
45895
46793
  computePosition(reference, popper, {
45896
46794
  placement: "bottom-start",
45897
46795
  middleware: [
45898
- offset$1(4),
46796
+ offset(4),
45899
46797
  autoPlacement({
45900
46798
  crossAxis: !0,
45901
46799
  // padding: POPOVER_PADDING,
@@ -45910,7 +46808,7 @@ const RelationshipPopover = memo$2(() => {
45910
46808
  "left-end"
45911
46809
  ]
45912
46810
  }),
45913
- size$1({
46811
+ size({
45914
46812
  apply({ availableHeight, availableWidth, elements }) {
45915
46813
  wasCanceled || Object.assign(elements.floating.style, {
45916
46814
  maxWidth: `${t$t(roundDpr(availableWidth), { min: 220, max: 400 })}px`,
@@ -45918,7 +46816,7 @@ const RelationshipPopover = memo$2(() => {
45918
46816
  });
45919
46817
  }
45920
46818
  }),
45921
- hide$1({
46819
+ hide({
45922
46820
  padding: POPOVER_PADDING * 2
45923
46821
  })
45924
46822
  ]
@@ -53541,15 +54439,14 @@ const { withProvider, withContext } = createStyleContext(navigationPanel), shoul
53541
54439
  shouldForwardProp
53542
54440
  }), Logo = withContext(LogoButton, "logo"), Label = withContext(MotionDiv, "label", {
53543
54441
  shouldForwardProp
53544
- });
53545
- withContext(MotionDiv, "dropdown", {
54442
+ }), Dropdown = withContext(MotionDiv, "dropdown", {
53546
54443
  shouldForwardProp
53547
- });
53548
- const NavigationPanel = {
54444
+ }), NavigationPanel = {
53549
54445
  Root,
53550
54446
  Body,
53551
54447
  Logo,
53552
- Label
54448
+ Label,
54449
+ Dropdown
53553
54450
  }, ProjectsOverviewPanel = () => /* @__PURE__ */ jsx(NavigationPanel.Root, { children: /* @__PURE__ */ jsxs(NavigationPanel.Body, { children: [
53554
54451
  /* @__PURE__ */ jsx(NavigationPanel.Logo, {}),
53555
54452
  /* @__PURE__ */ jsx(NavigationPanel.Label, { children: "Projects Overview" })
@@ -53741,6 +54638,87 @@ function LikeC4ProjectsOverview({
53741
54638
  ) })
53742
54639
  ] }) });
53743
54640
  }
54641
+ const root = css({
54642
+ height: "30px",
54643
+ paddingLeft: "sm",
54644
+ paddingRight: "1",
54645
+ borderRadius: "sm",
54646
+ // TODO
54647
+ // color: fallbackVar('var(--search-color)', 'mantine.colors.placeholder)',
54648
+ border: "1px solid",
54649
+ borderColor: {
54650
+ base: "default.border",
54651
+ _light: "mantine.colors.gray[4]",
54652
+ _dark: "mantine.colors.dark[4]",
54653
+ _hover: "default.border"
54654
+ },
54655
+ cursor: "pointer",
54656
+ background: {
54657
+ base: "default",
54658
+ _light: "white",
54659
+ _dark: "mantine.colors.dark[6]",
54660
+ _hover: "default.hover"
54661
+ },
54662
+ width: "100%",
54663
+ "& .tabler-icon": {
54664
+ color: "text"
54665
+ },
54666
+ transition: {
54667
+ base: "fast",
54668
+ _whenPanning: "none !important"
54669
+ },
54670
+ boxShadow: {
54671
+ base: "xs",
54672
+ _hover: "sm",
54673
+ _whenPanning: "none !important"
54674
+ }
54675
+ }), placeholder = css({
54676
+ fontSize: "sm",
54677
+ // mantine.fontSizes.sm,
54678
+ fontWeight: "medium",
54679
+ paddingRight: "2.5",
54680
+ // 10px
54681
+ color: "text.placeholder",
54682
+ flex: "1",
54683
+ sm: {
54684
+ paddingRight: "[30px]"
54685
+ },
54686
+ md: {
54687
+ paddingRight: "[50px]"
54688
+ }
54689
+ }), shortcut = css({
54690
+ fontSize: "11px",
54691
+ fontWeight: "bold",
54692
+ lineHeight: 1,
54693
+ padding: "[4px 7px]",
54694
+ borderRadius: "sm",
54695
+ border: "1px solid",
54696
+ transition: "fast",
54697
+ _light: {
54698
+ color: "mantine.colors.gray[7]",
54699
+ borderColor: "mantine.colors.gray[2]"
54700
+ },
54701
+ _dark: {
54702
+ color: "mantine.colors.dark[0]",
54703
+ borderColor: "mantine.colors.dark[7]"
54704
+ },
54705
+ backgroundColor: {
54706
+ _light: "mantine.colors.gray[2]/70",
54707
+ _dark: "mantine.colors.dark[8]/70",
54708
+ _groupHover: {
54709
+ _light: "mantine.colors.gray[2]",
54710
+ _dark: "mantine.colors.dark[8]"
54711
+ }
54712
+ }
54713
+ });
54714
+ function SearchControl({ className, ...others }) {
54715
+ const isMac2 = isMacOs();
54716
+ return /* @__PURE__ */ jsx(UnstyledButton, { ...others, className: cx("group", root, className), children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
54717
+ /* @__PURE__ */ jsx(IconSearch, { style: { width: "15px", height: "15px" }, stroke: 2 }),
54718
+ /* @__PURE__ */ jsx(Text, { component: "div", className: placeholder, children: "Search" }),
54719
+ /* @__PURE__ */ jsx(Text, { component: "div", className: shortcut, children: isMac2 ? "⌘ + K" : "Ctrl + K" })
54720
+ ] }) });
54721
+ }
53744
54722
  function customDiagramNode(Node2) {
53745
54723
  return ((props) => {
53746
54724
  const viewId = props.data.viewId, viewModel = useLikeC4Model().findView(viewId);
@@ -53824,9 +54802,13 @@ export {
53824
54802
  LikeC4ProjectsProvider,
53825
54803
  LikeC4View,
53826
54804
  Markdown,
54805
+ NavigationPanel,
53827
54806
  Overlay,
53828
54807
  PortalToContainer,
53829
54808
  ReactLikeC4,
54809
+ SearchContext,
54810
+ SearchControl,
54811
+ SearchPanelContent,
53830
54812
  SequenceActorNode,
53831
54813
  SequenceParallelArea,
53832
54814
  ShadowRoot$1 as ShadowRoot,
@@ -53841,7 +54823,10 @@ export {
53841
54823
  elementNode,
53842
54824
  memoEdge,
53843
54825
  memoNode,
54826
+ normalizeSearch,
53844
54827
  pickViewBounds,
54828
+ bodyCss as searchBodyCss,
54829
+ dialogCss as searchDialogCss,
53845
54830
  sequenceActorNode,
53846
54831
  useChangeLikeC4Project,
53847
54832
  useCurrentView,
@@ -53864,6 +54849,7 @@ export {
53864
54849
  useOnDiagramEvent,
53865
54850
  useOptionalCurrentViewModel,
53866
54851
  useOptionalLikeC4Model,
54852
+ useSearchContext,
53867
54853
  useSetState,
53868
54854
  useUpdateEffect,
53869
54855
  viewGroupNode