@flowsterix/react 0.14.0 → 0.14.2

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/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkFCOKCGV3cjs = require('./chunk-FCOKCGV3.cjs');
3
+
4
+ var _chunkIMMALBJLcjs = require('./chunk-IMMALBJL.cjs');
4
5
  require('./chunk-HPVLOLCD.cjs');
5
6
 
6
7
 
@@ -276,6 +277,21 @@ var useAnimationAdapter = () => {
276
277
  return _react.useContext.call(void 0, AnimationAdapterContext);
277
278
  };
278
279
  var defaultAnimationAdapter = defaultAdapter;
280
+ var tweenAnimationAdapter = {
281
+ components: defaultAdapter.components,
282
+ transitions: {
283
+ overlayHighlight: {
284
+ type: "tween",
285
+ duration: 0.35,
286
+ ease: [0.25, 1, 0.5, 1]
287
+ },
288
+ overlayFade: defaultAdapter.transitions.overlayFade,
289
+ popoverEntrance: defaultAdapter.transitions.popoverEntrance,
290
+ popoverExit: defaultAdapter.transitions.popoverExit,
291
+ popoverContent: defaultAdapter.transitions.popoverContent,
292
+ delayIndicator: defaultAdapter.transitions.delayIndicator
293
+ }
294
+ };
279
295
  var reducedMotionAnimationAdapter = {
280
296
  components: defaultAdapter.components,
281
297
  transitions: {
@@ -361,6 +377,7 @@ var TourProvider = ({
361
377
  backdropInteraction: backdropInteractionProp = "passthrough",
362
378
  lockBodyScroll: lockBodyScrollProp = false,
363
379
  labels: labelsProp,
380
+ useSpringAnimations: useSpringAnimationsProp = true,
364
381
  onVersionMismatch
365
382
  }) => {
366
383
  const mergedLabels = _react.useMemo.call(void 0,
@@ -848,8 +865,12 @@ var TourProvider = ({
848
865
  updateFlowStorage
849
866
  ]
850
867
  );
868
+ _react.useEffect.call(void 0, () => {
869
+ _chunkIMMALBJLcjs.setUseSpringAnimations.call(void 0, useSpringAnimationsProp);
870
+ }, [useSpringAnimationsProp]);
871
+ const effectiveDefaultAdapter = useSpringAnimationsProp ? animationAdapterProp : tweenAnimationAdapter;
851
872
  const resolvedAnimationAdapter = usePreferredAnimationAdapter({
852
- defaultAdapter: animationAdapterProp,
873
+ defaultAdapter: effectiveDefaultAdapter,
853
874
  reducedMotionAdapter,
854
875
  enabled: autoDetectReducedMotion
855
876
  });
@@ -916,7 +937,7 @@ var TourProvider = ({
916
937
  }
917
938
  };
918
939
  }, []);
919
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogRegistryProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TourContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFCOKCGV3cjs.DevToolsContext.Provider, { value: devToolsContextValue, children: [
940
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogRegistryProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TourContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIMMALBJLcjs.DevToolsContext.Provider, { value: devToolsContextValue, children: [
920
941
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
921
942
  DialogAutomationBridge,
922
943
  {
@@ -1152,13 +1173,69 @@ var computeVisibilityState = (element, rect, isScreen) => {
1152
1173
  }
1153
1174
  return "visible";
1154
1175
  };
1155
- var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1176
+ var clamp01 = (value) => Math.max(0, Math.min(1, value));
1177
+ var easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
1178
+ var windowScrollAnimationToken = 0;
1179
+ var getWindowScrollY = () => {
1180
+ if (!_chunk7SAJNRGZcjs.isBrowser) return 0;
1181
+ const scrollingElement = document.scrollingElement;
1182
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([scrollingElement, 'optionalAccess', _37 => _37.scrollTop]), () => ( window.scrollY)), () => ( 0));
1183
+ };
1184
+ var setWindowScrollY = (value) => {
1185
+ if (!_chunk7SAJNRGZcjs.isBrowser) return;
1186
+ const scrollingElement = document.scrollingElement;
1187
+ if (scrollingElement) {
1188
+ scrollingElement.scrollTop = value;
1189
+ return;
1190
+ }
1191
+ document.documentElement.scrollTop = value;
1192
+ document.body.scrollTop = value;
1193
+ };
1194
+ var animateWindowScrollBy = (topDelta, durationMs) => {
1195
+ if (!_chunk7SAJNRGZcjs.isBrowser) return;
1196
+ if (!Number.isFinite(topDelta) || Math.abs(topDelta) < 0.5) return;
1197
+ const startY = getWindowScrollY();
1198
+ const targetY = startY + topDelta;
1199
+ const scrollingElement = _nullishCoalesce(document.scrollingElement, () => ( document.documentElement));
1200
+ const maxScrollY = Math.max(
1201
+ 0,
1202
+ scrollingElement.scrollHeight - scrollingElement.clientHeight
1203
+ );
1204
+ const clampedTargetY = Math.max(0, Math.min(targetY, maxScrollY));
1205
+ const distance = clampedTargetY - startY;
1206
+ if (Math.abs(distance) < 0.5) return;
1207
+ const duration = Math.max(0, durationMs);
1208
+ const startTime = performance.now();
1209
+ const token = windowScrollAnimationToken += 1;
1210
+ const tick = (now) => {
1211
+ if (token !== windowScrollAnimationToken) return;
1212
+ const elapsed = now - startTime;
1213
+ const progress = duration === 0 ? 1 : clamp01(elapsed / duration);
1214
+ const eased = easeInOutCubic(progress);
1215
+ const nextY = startY + distance * eased;
1216
+ setWindowScrollY(nextY);
1217
+ if (progress < 1) {
1218
+ window.requestAnimationFrame(tick);
1219
+ }
1220
+ };
1221
+ window.requestAnimationFrame(tick);
1222
+ };
1223
+ var scrollContainerBy = (container, topDelta, leftDelta, options) => {
1156
1224
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
1157
1225
  if (Math.abs(topDelta) < 0.5 && Math.abs(leftDelta) < 0.5) {
1158
1226
  return;
1159
1227
  }
1228
+ const behavior = _optionalChain([options, 'optionalAccess', _38 => _38.behavior]);
1229
+ const durationMs = _optionalChain([options, 'optionalAccess', _39 => _39.durationMs]);
1160
1230
  const isRootContainer = container === document.body || container === document.documentElement || container === document.scrollingElement;
1161
1231
  if (isRootContainer) {
1232
+ if (typeof durationMs === "number" && durationMs >= 0) {
1233
+ animateWindowScrollBy(topDelta, durationMs);
1234
+ if (Math.abs(leftDelta) >= 0.5) {
1235
+ window.scrollBy({ left: leftDelta, behavior: _nullishCoalesce(behavior, () => ( "auto")) });
1236
+ }
1237
+ return;
1238
+ }
1162
1239
  window.scrollBy({
1163
1240
  top: topDelta,
1164
1241
  left: leftDelta,
@@ -1178,7 +1255,7 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1178
1255
  elementContainer.scrollTop += topDelta;
1179
1256
  elementContainer.scrollLeft += leftDelta;
1180
1257
  };
1181
- var alignWithinViewport = (element, margin, behavior, mode) => {
1258
+ var alignWithinViewport = (element, margin, behavior, durationMs, mode) => {
1182
1259
  if (mode === "preserve") return;
1183
1260
  const viewportRect = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
1184
1261
  const finalRect = _chunk7SAJNRGZcjs.getClientRect.call(void 0, element);
@@ -1187,14 +1264,19 @@ var alignWithinViewport = (element, margin, behavior, mode) => {
1187
1264
  const desiredTop = mode === "center" ? margin.top + (availableHeight - finalRect.height) / 2 : margin.top;
1188
1265
  const delta = finalRect.top - desiredTop;
1189
1266
  if (Math.abs(delta) < 0.5) return;
1267
+ if (typeof durationMs === "number" && durationMs >= 0) {
1268
+ animateWindowScrollBy(delta, durationMs);
1269
+ return;
1270
+ }
1190
1271
  window.scrollBy({
1191
1272
  top: delta,
1192
1273
  behavior: _nullishCoalesce(behavior, () => ( "auto"))
1193
1274
  });
1194
1275
  };
1195
1276
  var ensureElementInView = (element, margin, options) => {
1196
- const behavior = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _37 => _37.behavior]), () => ( "auto"));
1197
- const mode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.mode]), () => ( "preserve"));
1277
+ const behavior = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _40 => _40.behavior]), () => ( "auto"));
1278
+ const durationMs = _optionalChain([options, 'optionalAccess', _41 => _41.durationMs]);
1279
+ const mode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.mode]), () => ( "preserve"));
1198
1280
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
1199
1281
  const scrollParents = _chunk7SAJNRGZcjs.getScrollParents.call(void 0, element);
1200
1282
  const rootScroller = document.scrollingElement;
@@ -1217,7 +1299,10 @@ var ensureElementInView = (element, margin, options) => {
1217
1299
  leftDelta = targetRect.right - (containerRect.right - margin.right);
1218
1300
  }
1219
1301
  if (topDelta !== 0 || leftDelta !== 0) {
1220
- scrollContainerBy(container, topDelta, leftDelta, behavior);
1302
+ scrollContainerBy(container, topDelta, leftDelta, {
1303
+ behavior,
1304
+ durationMs
1305
+ });
1221
1306
  }
1222
1307
  }
1223
1308
  const viewportRect = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
@@ -1235,13 +1320,20 @@ var ensureElementInView = (element, margin, options) => {
1235
1320
  viewportLeftDelta = finalRect.right - (viewportRect.right - margin.right);
1236
1321
  }
1237
1322
  if (viewportTopDelta !== 0 || viewportLeftDelta !== 0) {
1238
- window.scrollBy({
1239
- top: viewportTopDelta,
1240
- left: viewportLeftDelta,
1241
- behavior
1242
- });
1323
+ if (typeof durationMs === "number" && durationMs >= 0) {
1324
+ animateWindowScrollBy(viewportTopDelta, durationMs);
1325
+ if (Math.abs(viewportLeftDelta) >= 0.5) {
1326
+ window.scrollBy({ left: viewportLeftDelta, behavior: _nullishCoalesce(behavior, () => ( "auto")) });
1327
+ }
1328
+ } else {
1329
+ window.scrollBy({
1330
+ top: viewportTopDelta,
1331
+ left: viewportLeftDelta,
1332
+ behavior
1333
+ });
1334
+ }
1243
1335
  }
1244
- alignWithinViewport(element, margin, behavior, mode);
1336
+ alignWithinViewport(element, margin, behavior, durationMs, mode);
1245
1337
  };
1246
1338
  var resolveStepTarget = (target) => {
1247
1339
  if (!_chunk7SAJNRGZcjs.isBrowser) return null;
@@ -1269,7 +1361,13 @@ var resolveStepTarget = (target) => {
1269
1361
  var useTourTarget = () => {
1270
1362
  const { activeStep, state, activeFlowId, flows } = useTour();
1271
1363
  const [targetInfo, setTargetInfo] = _react.useState.call(void 0, INITIAL_TARGET_INFO);
1272
- const autoScrollStateRef = _react.useRef.call(void 0, { stepId: null, checks: 0, stalledChecks: 0, done: false, lastRect: null });
1364
+ const autoScrollStateRef = _react.useRef.call(void 0, {
1365
+ stepId: null,
1366
+ checks: 0,
1367
+ stalledChecks: 0,
1368
+ done: false,
1369
+ lastRect: null
1370
+ });
1273
1371
  const autoScrollRafRef = _react.useRef.call(void 0, null);
1274
1372
  const autoScrollTimeoutRef = _react.useRef.call(void 0, null);
1275
1373
  const lastRectRef = _react.useRef.call(void 0, null);
@@ -1292,7 +1390,22 @@ var useTourTarget = () => {
1292
1390
  return () => {
1293
1391
  initialScrollStepRef.current = null;
1294
1392
  };
1295
- }, [_optionalChain([activeStep, 'optionalAccess', _39 => _39.id])]);
1393
+ }, [_optionalChain([activeStep, 'optionalAccess', _43 => _43.id])]);
1394
+ _react.useEffect.call(void 0, () => {
1395
+ if (!_chunk7SAJNRGZcjs.isBrowser) return;
1396
+ if (!activeStep || !state || state.status !== "running") return;
1397
+ if (typeof _optionalChain([activeStep, 'access', _44 => _44.targetBehavior, 'optionalAccess', _45 => _45.scrollDurationMs]) !== "number") return;
1398
+ const html = document.documentElement;
1399
+ const body = document.body;
1400
+ const previousHtmlScrollBehavior = html.style.scrollBehavior;
1401
+ const previousBodyScrollBehavior = body.style.scrollBehavior;
1402
+ html.style.scrollBehavior = "auto";
1403
+ body.style.scrollBehavior = "auto";
1404
+ return () => {
1405
+ html.style.scrollBehavior = previousHtmlScrollBehavior;
1406
+ body.style.scrollBehavior = previousBodyScrollBehavior;
1407
+ };
1408
+ }, [_optionalChain([activeStep, 'optionalAccess', _46 => _46.id]), _optionalChain([activeStep, 'optionalAccess', _47 => _47.targetBehavior, 'optionalAccess', _48 => _48.scrollDurationMs]), _optionalChain([state, 'optionalAccess', _49 => _49.status])]);
1296
1409
  _react.useLayoutEffect.call(void 0, () => {
1297
1410
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
1298
1411
  if (!activeStep) return;
@@ -1304,20 +1417,23 @@ var useTourTarget = () => {
1304
1417
  }
1305
1418
  initialScrollStepRef.current = activeStep.id;
1306
1419
  const margin = resolveScrollMargin(
1307
- _optionalChain([activeStep, 'access', _40 => _40.targetBehavior, 'optionalAccess', _41 => _41.scrollMargin]),
1420
+ _optionalChain([activeStep, 'access', _50 => _50.targetBehavior, 'optionalAccess', _51 => _51.scrollMargin]),
1308
1421
  DEFAULT_SCROLL_MARGIN
1309
1422
  );
1310
- const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _42 => _42.targetBehavior, 'optionalAccess', _43 => _43.scrollMode]), () => ( DEFAULT_SCROLL_MODE));
1423
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _52 => _52.targetBehavior, 'optionalAccess', _53 => _53.scrollMode]), () => ( DEFAULT_SCROLL_MODE));
1424
+ const scrollDurationMs = _optionalChain([activeStep, 'access', _54 => _54.targetBehavior, 'optionalAccess', _55 => _55.scrollDurationMs]);
1311
1425
  const hasLiveRect = targetInfo.rectSource === "live";
1312
1426
  const scrollBehavior = hasLiveRect ? "smooth" : "auto";
1313
1427
  ensureElementInView(targetInfo.element, margin, {
1314
1428
  behavior: scrollBehavior,
1429
+ durationMs: scrollBehavior === "smooth" ? scrollDurationMs : void 0,
1315
1430
  mode: scrollMode
1316
1431
  });
1317
1432
  }, [
1318
- _optionalChain([activeStep, 'optionalAccess', _44 => _44.id]),
1319
- _optionalChain([activeStep, 'optionalAccess', _45 => _45.targetBehavior, 'optionalAccess', _46 => _46.scrollMargin]),
1320
- _optionalChain([activeStep, 'optionalAccess', _47 => _47.targetBehavior, 'optionalAccess', _48 => _48.scrollMode]),
1433
+ _optionalChain([activeStep, 'optionalAccess', _56 => _56.id]),
1434
+ _optionalChain([activeStep, 'optionalAccess', _57 => _57.targetBehavior, 'optionalAccess', _58 => _58.scrollMargin]),
1435
+ _optionalChain([activeStep, 'optionalAccess', _59 => _59.targetBehavior, 'optionalAccess', _60 => _60.scrollMode]),
1436
+ _optionalChain([activeStep, 'optionalAccess', _61 => _61.targetBehavior, 'optionalAccess', _62 => _62.scrollDurationMs]),
1321
1437
  targetInfo.rect,
1322
1438
  targetInfo.lastResolvedRect,
1323
1439
  targetInfo.element,
@@ -1356,10 +1472,10 @@ var useTourTarget = () => {
1356
1472
  const currentStep = activeStep;
1357
1473
  const activeFlow = activeFlowId ? _nullishCoalesce(flows.get(activeFlowId), () => ( null)) : null;
1358
1474
  const isScreen = currentStep.target === "screen";
1359
- const waitForSelectorRaw = _optionalChain([currentStep, 'access', _49 => _49.waitFor, 'optionalAccess', _50 => _50.selector]);
1475
+ const waitForSelectorRaw = _optionalChain([currentStep, 'access', _63 => _63.waitFor, 'optionalAccess', _64 => _64.selector]);
1360
1476
  const waitForSelector = typeof waitForSelectorRaw === "string" ? waitForSelectorRaw.trim() : void 0;
1361
1477
  const hasWaitForSelector = Boolean(waitForSelector);
1362
- const waitForTimeout = Math.max(0, _nullishCoalesce(_optionalChain([currentStep, 'access', _51 => _51.waitFor, 'optionalAccess', _52 => _52.timeout]), () => ( 8e3)));
1478
+ const waitForTimeout = Math.max(0, _nullishCoalesce(_optionalChain([currentStep, 'access', _65 => _65.waitFor, 'optionalAccess', _66 => _66.timeout]), () => ( 8e3)));
1363
1479
  const waitContext = activeFlow ? {
1364
1480
  flow: activeFlow,
1365
1481
  state,
@@ -1421,7 +1537,7 @@ var useTourTarget = () => {
1421
1537
  };
1422
1538
  const isWaitForSatisfied = () => {
1423
1539
  const selectorReady = !hasWaitForSelector || isWaitForSelectorSatisfied();
1424
- const predicateReady = _nullishCoalesce(_optionalChain([waitForPredicateController, 'optionalAccess', _53 => _53.isSatisfied, 'call', _54 => _54()]), () => ( true));
1540
+ const predicateReady = _nullishCoalesce(_optionalChain([waitForPredicateController, 'optionalAccess', _67 => _67.isSatisfied, 'call', _68 => _68()]), () => ( true));
1425
1541
  return selectorReady && predicateReady;
1426
1542
  };
1427
1543
  function updateTargetState(status, rectOverride) {
@@ -1543,11 +1659,11 @@ var useTourTarget = () => {
1543
1659
  window.visualViewport.addEventListener("resize", onViewportChange);
1544
1660
  window.visualViewport.addEventListener("scroll", onViewportChange);
1545
1661
  cleanupFns.push(() => {
1546
- _optionalChain([window, 'access', _55 => _55.visualViewport, 'optionalAccess', _56 => _56.removeEventListener, 'call', _57 => _57(
1662
+ _optionalChain([window, 'access', _69 => _69.visualViewport, 'optionalAccess', _70 => _70.removeEventListener, 'call', _71 => _71(
1547
1663
  "resize",
1548
1664
  onViewportChange
1549
1665
  )]);
1550
- _optionalChain([window, 'access', _58 => _58.visualViewport, 'optionalAccess', _59 => _59.removeEventListener, 'call', _60 => _60(
1666
+ _optionalChain([window, 'access', _72 => _72.visualViewport, 'optionalAccess', _73 => _73.removeEventListener, 'call', _74 => _74(
1551
1667
  "scroll",
1552
1668
  onViewportChange
1553
1669
  )]);
@@ -1597,7 +1713,7 @@ var useTourTarget = () => {
1597
1713
  subtree: true
1598
1714
  });
1599
1715
  cleanupFns.push(() => {
1600
- _optionalChain([mutationObserver, 'optionalAccess', _61 => _61.disconnect, 'call', _62 => _62()]);
1716
+ _optionalChain([mutationObserver, 'optionalAccess', _75 => _75.disconnect, 'call', _76 => _76()]);
1601
1717
  mutationObserver = null;
1602
1718
  });
1603
1719
  }
@@ -1644,7 +1760,7 @@ var useTourTarget = () => {
1644
1760
  clearResolvePolling();
1645
1761
  clearWaitForPoll();
1646
1762
  resetObservers();
1647
- _optionalChain([waitForPredicateController, 'optionalAccess', _63 => _63.stop, 'call', _64 => _64()]);
1763
+ _optionalChain([waitForPredicateController, 'optionalAccess', _77 => _77.stop, 'call', _78 => _78()]);
1648
1764
  waitForPredicateController = null;
1649
1765
  };
1650
1766
  }, [activeStep, activeFlowId, flows, state]);
@@ -1679,7 +1795,8 @@ var useTourTarget = () => {
1679
1795
  return;
1680
1796
  }
1681
1797
  const { element } = targetInfo;
1682
- const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _65 => _65.targetBehavior, 'optionalAccess', _66 => _66.scrollMode]), () => ( "center"));
1798
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _79 => _79.targetBehavior, 'optionalAccess', _80 => _80.scrollMode]), () => ( "center"));
1799
+ const scrollDurationMs = _optionalChain([activeStep, 'access', _81 => _81.targetBehavior, 'optionalAccess', _82 => _82.scrollDurationMs]);
1683
1800
  const runCheck = () => {
1684
1801
  autoScrollRafRef.current = null;
1685
1802
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
@@ -1688,7 +1805,7 @@ var useTourTarget = () => {
1688
1805
  const rect = _chunk7SAJNRGZcjs.getClientRect.call(void 0, element);
1689
1806
  const viewport = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
1690
1807
  const margin = resolveScrollMargin(
1691
- _optionalChain([activeStep, 'access', _67 => _67.targetBehavior, 'optionalAccess', _68 => _68.scrollMargin]),
1808
+ _optionalChain([activeStep, 'access', _83 => _83.targetBehavior, 'optionalAccess', _84 => _84.scrollMargin]),
1692
1809
  DEFAULT_SCROLL_MARGIN
1693
1810
  );
1694
1811
  const fitsHeight = rect.height <= viewport.height - (margin.top + margin.bottom);
@@ -1713,10 +1830,14 @@ var useTourTarget = () => {
1713
1830
  autoState.stalledChecks += 1;
1714
1831
  }
1715
1832
  const behavior = autoState.stalledChecks >= STALLED_CHECKS_BEFORE_AUTO ? "auto" : "smooth";
1716
- ensureElementInView(element, margin, {
1717
- behavior,
1718
- mode: scrollMode
1719
- });
1833
+ const shouldDispatchScroll = behavior === "auto" || !hasProgress || autoState.checks <= 1;
1834
+ if (shouldDispatchScroll) {
1835
+ ensureElementInView(element, margin, {
1836
+ behavior,
1837
+ durationMs: behavior === "smooth" ? scrollDurationMs : void 0,
1838
+ mode: scrollMode
1839
+ });
1840
+ }
1720
1841
  autoScrollTimeoutRef.current = globalThis.setTimeout(() => {
1721
1842
  autoScrollRafRef.current = window.requestAnimationFrame(runCheck);
1722
1843
  }, 120);
@@ -1724,7 +1845,12 @@ var useTourTarget = () => {
1724
1845
  cancelAutoScrollLoop();
1725
1846
  autoScrollRafRef.current = window.requestAnimationFrame(runCheck);
1726
1847
  return cancelAutoScrollLoop;
1727
- }, [activeStep, _optionalChain([activeStep, 'optionalAccess', _69 => _69.targetBehavior, 'optionalAccess', _70 => _70.scrollMode]), targetInfo]);
1848
+ }, [
1849
+ activeStep,
1850
+ _optionalChain([activeStep, 'optionalAccess', _85 => _85.targetBehavior, 'optionalAccess', _86 => _86.scrollMode]),
1851
+ _optionalChain([activeStep, 'optionalAccess', _87 => _87.targetBehavior, 'optionalAccess', _88 => _88.scrollDurationMs]),
1852
+ targetInfo
1853
+ ]);
1728
1854
  return targetInfo;
1729
1855
  };
1730
1856
 
@@ -1786,7 +1912,7 @@ var useAdvanceRules = (target) => {
1786
1912
  while (cleanupFns.length > 0) {
1787
1913
  const dispose = cleanupFns.pop();
1788
1914
  try {
1789
- _optionalChain([dispose, 'optionalCall', _71 => _71()]);
1915
+ _optionalChain([dispose, 'optionalCall', _89 => _89()]);
1790
1916
  } catch (error) {
1791
1917
  console.warn("[tour][advance] cleanup failed", error);
1792
1918
  }
@@ -1956,10 +2082,10 @@ var useHiddenTargetFallback = ({
1956
2082
  const timeoutRef = _react.useRef.call(void 0, null);
1957
2083
  const graceTimeoutRef = _react.useRef.call(void 0, null);
1958
2084
  const skipTriggeredRef = _react.useRef.call(void 0, false);
1959
- const hiddenMode = _nullishCoalesce(_optionalChain([step, 'optionalAccess', _72 => _72.targetBehavior, 'optionalAccess', _73 => _73.hidden]), () => ( "screen"));
2085
+ const hiddenMode = _nullishCoalesce(_optionalChain([step, 'optionalAccess', _90 => _90.targetBehavior, 'optionalAccess', _91 => _91.hidden]), () => ( "screen"));
1960
2086
  const hiddenDelayMs = Math.max(
1961
2087
  0,
1962
- _nullishCoalesce(_optionalChain([step, 'optionalAccess', _74 => _74.targetBehavior, 'optionalAccess', _75 => _75.hiddenDelayMs]), () => ( DEFAULT_DELAY_MS))
2088
+ _nullishCoalesce(_optionalChain([step, 'optionalAccess', _92 => _92.targetBehavior, 'optionalAccess', _93 => _93.hiddenDelayMs]), () => ( DEFAULT_DELAY_MS))
1963
2089
  );
1964
2090
  const clearPendingTimeout = () => {
1965
2091
  if (timeoutRef.current !== null) {
@@ -1985,7 +2111,7 @@ var useHiddenTargetFallback = ({
1985
2111
  clearPendingTimeout();
1986
2112
  clearGraceTimeout();
1987
2113
  };
1988
- }, [_optionalChain([step, 'optionalAccess', _76 => _76.id])]);
2114
+ }, [_optionalChain([step, 'optionalAccess', _94 => _94.id])]);
1989
2115
  _react.useEffect.call(void 0, () => {
1990
2116
  if (!_chunk7SAJNRGZcjs.isBrowser) return void 0;
1991
2117
  if (!step) return void 0;
@@ -2073,7 +2199,7 @@ var useRouteMismatch = (step) => {
2073
2199
  setCurrentPath(path);
2074
2200
  });
2075
2201
  }, []);
2076
- const expectedRoute = _optionalChain([step, 'optionalAccess', _77 => _77.route]);
2202
+ const expectedRoute = _optionalChain([step, 'optionalAccess', _95 => _95.route]);
2077
2203
  const isRouteMismatch = step !== null && expectedRoute !== void 0 && !_chunk7SAJNRGZcjs.matchRoute.call(void 0, { pattern: expectedRoute, path: currentPath });
2078
2204
  return {
2079
2205
  isRouteMismatch,
@@ -2141,7 +2267,7 @@ var useHudState = (options = {}) => {
2141
2267
  if (!activeFlowId) return false;
2142
2268
  return flowFilter.includes(activeFlowId);
2143
2269
  }, [activeFlowId, flowFilter]);
2144
- const isRunning = _optionalChain([state, 'optionalAccess', _78 => _78.status]) === "running";
2270
+ const isRunning = _optionalChain([state, 'optionalAccess', _96 => _96.status]) === "running";
2145
2271
  const runningState = isRunning && matchesFlowFilter ? state : null;
2146
2272
  const runningStep = runningState && activeStep ? activeStep : null;
2147
2273
  const [shouldRender, setShouldRender] = _react.useState.call(void 0,
@@ -2151,7 +2277,7 @@ var useHudState = (options = {}) => {
2151
2277
  if (runningStep) {
2152
2278
  setShouldRender(true);
2153
2279
  }
2154
- }, [_optionalChain([runningStep, 'optionalAccess', _79 => _79.id])]);
2280
+ }, [_optionalChain([runningStep, 'optionalAccess', _97 => _97.id])]);
2155
2281
  _react.useEffect.call(void 0, () => {
2156
2282
  if (!shouldRender) return;
2157
2283
  if (runningStep) return;
@@ -2196,7 +2322,7 @@ var useHudState = (options = {}) => {
2196
2322
  });
2197
2323
  _react.useEffect.call(void 0, () => {
2198
2324
  if (isRouteMismatch) return;
2199
- if (_optionalChain([activeStep, 'optionalAccess', _80 => _80.route]) !== void 0) return;
2325
+ if (_optionalChain([activeStep, 'optionalAccess', _98 => _98.route]) !== void 0) return;
2200
2326
  if (isInGracePeriod) return;
2201
2327
  if (target.visibility !== "missing") return;
2202
2328
  if (target.isScreen) return;
@@ -2205,7 +2331,7 @@ var useHudState = (options = {}) => {
2205
2331
  pause();
2206
2332
  }, [
2207
2333
  isRouteMismatch,
2208
- _optionalChain([activeStep, 'optionalAccess', _81 => _81.route]),
2334
+ _optionalChain([activeStep, 'optionalAccess', _99 => _99.route]),
2209
2335
  isInGracePeriod,
2210
2336
  target.visibility,
2211
2337
  target.isScreen,
@@ -2222,11 +2348,11 @@ var useHudState = (options = {}) => {
2222
2348
  }, [currentPath, state, resume]);
2223
2349
  _react.useEffect.call(void 0, () => {
2224
2350
  pausedForMissingTargetRef.current = null;
2225
- }, [_optionalChain([activeStep, 'optionalAccess', _82 => _82.id])]);
2351
+ }, [_optionalChain([activeStep, 'optionalAccess', _100 => _100.id])]);
2226
2352
  const canRenderStep = Boolean(runningStep && runningState);
2227
2353
  const focusTrapActive = canRenderStep;
2228
- const flowHudOptions = matchesFlowFilter && activeFlowId ? _nullishCoalesce(_optionalChain([flows, 'access', _83 => _83.get, 'call', _84 => _84(activeFlowId), 'optionalAccess', _85 => _85.hud]), () => ( null)) : null;
2229
- const hudRenderMode = _nullishCoalesce(_optionalChain([flowHudOptions, 'optionalAccess', _86 => _86.render]), () => ( "default"));
2354
+ const flowHudOptions = matchesFlowFilter && activeFlowId ? _nullishCoalesce(_optionalChain([flows, 'access', _101 => _101.get, 'call', _102 => _102(activeFlowId), 'optionalAccess', _103 => _103.hud]), () => ( null)) : null;
2355
+ const hudRenderMode = _nullishCoalesce(_optionalChain([flowHudOptions, 'optionalAccess', _104 => _104.render]), () => ( "default"));
2230
2356
  return {
2231
2357
  state,
2232
2358
  runningState,
@@ -2305,16 +2431,16 @@ var useTourControls = () => {
2305
2431
  };
2306
2432
  }
2307
2433
  const definition = activeFlowId ? flows.get(activeFlowId) : null;
2308
- const totalSteps = _nullishCoalesce(_optionalChain([definition, 'optionalAccess', _87 => _87.steps, 'access', _88 => _88.length]), () => ( 0));
2434
+ const totalSteps = _nullishCoalesce(_optionalChain([definition, 'optionalAccess', _105 => _105.steps, 'access', _106 => _106.length]), () => ( 0));
2309
2435
  const stepIndex = state.stepIndex;
2310
2436
  const isFirst2 = stepIndex <= 0;
2311
2437
  const isLast2 = totalSteps > 0 && stepIndex >= totalSteps - 1;
2312
2438
  const previousStep = !definition || stepIndex <= 0 ? null : definition.steps[stepIndex - 1];
2313
2439
  const advanceRules = _nullishCoalesce(activeStep.advance, () => ( []));
2314
2440
  const hasAdvanceRules = advanceRules.length > 0;
2315
- const previousAdvanceRules = _nullishCoalesce(_optionalChain([previousStep, 'optionalAccess', _89 => _89.advance]), () => ( []));
2316
- const backControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _90 => _90.controls, 'optionalAccess', _91 => _91.back]), () => ( "auto"));
2317
- const nextControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _92 => _92.controls, 'optionalAccess', _93 => _93.next]), () => ( "auto"));
2441
+ const previousAdvanceRules = _nullishCoalesce(_optionalChain([previousStep, 'optionalAccess', _107 => _107.advance]), () => ( []));
2442
+ const backControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _108 => _108.controls, 'optionalAccess', _109 => _109.back]), () => ( "auto"));
2443
+ const nextControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _110 => _110.controls, 'optionalAccess', _111 => _111.next]), () => ( "auto"));
2318
2444
  const showBackButton2 = backControlState !== "hidden" && !isFirst2 && !didPreviousAdvanceViaRoute(previousAdvanceRules);
2319
2445
  const backDisabled2 = backControlState === "disabled";
2320
2446
  const manualAdvancePresent = hasManualAdvance(advanceRules);
@@ -2394,8 +2520,8 @@ var isInteractiveElement = (node) => {
2394
2520
  return Boolean(node.closest(interactiveSelector));
2395
2521
  };
2396
2522
  var useHudShortcuts = (target, options) => {
2397
- const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _94 => _94.enabled]), () => ( true));
2398
- const escapeEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95.escape]), () => ( true));
2523
+ const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _112 => _112.enabled]), () => ( true));
2524
+ const escapeEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _113 => _113.escape]), () => ( true));
2399
2525
  const { state } = useTour();
2400
2526
  const { cancel, canGoBack, goBack, canGoNext, goNext, isActive } = useTourControls();
2401
2527
  _react.useEffect.call(void 0, () => {
@@ -2571,7 +2697,7 @@ var deriveTargetIssue = (params) => {
2571
2697
  };
2572
2698
  var useHudTargetIssue = (target, options) => {
2573
2699
  const labels = useTourLabels();
2574
- const delayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.delayMs]), () => ( 500)));
2700
+ const delayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _114 => _114.delayMs]), () => ( 500)));
2575
2701
  const [armed, setArmed] = _react.useState.call(void 0, false);
2576
2702
  const rawIssue = _react.useMemo.call(void 0,
2577
2703
  () => deriveTargetIssue({ target, labels }),
@@ -2591,7 +2717,7 @@ var useHudTargetIssue = (target, options) => {
2591
2717
  setArmed(false);
2592
2718
  globalThis.clearTimeout(timeoutId);
2593
2719
  };
2594
- }, [delayMs, _optionalChain([rawIssue, 'optionalAccess', _97 => _97.type])]);
2720
+ }, [delayMs, _optionalChain([rawIssue, 'optionalAccess', _115 => _115.type])]);
2595
2721
  return {
2596
2722
  issue: armed ? rawIssue : null,
2597
2723
  rawIssue
@@ -2613,15 +2739,15 @@ var useTourHud = (options = {}) => {
2613
2739
  const hudState = useHudState();
2614
2740
  const disableDefaultHud = hudState.hudRenderMode === "none";
2615
2741
  const [popoverNode, setPopoverNode] = _react.useState.call(void 0, null);
2616
- const popoverOptions = _optionalChain([hudState, 'access', _98 => _98.flowHudOptions, 'optionalAccess', _99 => _99.popover]);
2742
+ const popoverOptions = _optionalChain([hudState, 'access', _116 => _116.flowHudOptions, 'optionalAccess', _117 => _117.popover]);
2617
2743
  const description = useHudDescription({
2618
2744
  step: hudState.runningStep,
2619
- fallbackAriaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _100 => _100.ariaDescribedBy])
2745
+ fallbackAriaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _118 => _118.ariaDescribedBy])
2620
2746
  });
2621
2747
  const targetIssue = useHudTargetIssue(hudState.hudTarget);
2622
2748
  const viewport = useViewportRect();
2623
2749
  const shouldLockBodyScroll = Boolean(
2624
- bodyScrollLock && (_nullishCoalesce(_optionalChain([hudState, 'access', _101 => _101.flowHudOptions, 'optionalAccess', _102 => _102.behavior, 'optionalAccess', _103 => _103.lockBodyScroll]), () => ( lockBodyScroll))) && hudState.focusTrapActive
2750
+ bodyScrollLock && (_nullishCoalesce(_optionalChain([hudState, 'access', _119 => _119.flowHudOptions, 'optionalAccess', _120 => _120.behavior, 'optionalAccess', _121 => _121.lockBodyScroll]), () => ( lockBodyScroll))) && hudState.focusTrapActive
2625
2751
  );
2626
2752
  const { isConstrainedMode: isConstrainedScrollActive } = useConstrainedScrollLock({
2627
2753
  enabled: shouldLockBodyScroll,
@@ -2641,20 +2767,20 @@ var useTourHud = (options = {}) => {
2641
2767
  const overlay = {
2642
2768
  padding: overlayPadding,
2643
2769
  radius: overlayRadius,
2644
- interactionMode: _nullishCoalesce(_optionalChain([hudState, 'access', _104 => _104.flowHudOptions, 'optionalAccess', _105 => _105.backdrop, 'optionalAccess', _106 => _106.interaction]), () => ( backdropInteraction))
2770
+ interactionMode: _nullishCoalesce(_optionalChain([hudState, 'access', _122 => _122.flowHudOptions, 'optionalAccess', _123 => _123.backdrop, 'optionalAccess', _124 => _124.interaction]), () => ( backdropInteraction))
2645
2771
  };
2646
2772
  const popover = _react.useMemo.call(void 0, () => {
2647
2773
  return {
2648
- offset: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _107 => _107.offset]), () => ( 32)),
2649
- role: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _108 => _108.role]), () => ( "dialog")),
2650
- ariaLabel: _optionalChain([popoverOptions, 'optionalAccess', _109 => _109.ariaLabel]),
2651
- ariaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _110 => _110.ariaDescribedBy]),
2652
- ariaModal: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _111 => _111.ariaModal]), () => ( false)),
2653
- width: _optionalChain([popoverOptions, 'optionalAccess', _112 => _112.width]),
2654
- maxWidth: _optionalChain([popoverOptions, 'optionalAccess', _113 => _113.maxWidth]),
2655
- placement: _optionalChain([hudState, 'access', _114 => _114.runningStep, 'optionalAccess', _115 => _115.placement])
2774
+ offset: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _125 => _125.offset]), () => ( 32)),
2775
+ role: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _126 => _126.role]), () => ( "dialog")),
2776
+ ariaLabel: _optionalChain([popoverOptions, 'optionalAccess', _127 => _127.ariaLabel]),
2777
+ ariaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _128 => _128.ariaDescribedBy]),
2778
+ ariaModal: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _129 => _129.ariaModal]), () => ( false)),
2779
+ width: _optionalChain([popoverOptions, 'optionalAccess', _130 => _130.width]),
2780
+ maxWidth: _optionalChain([popoverOptions, 'optionalAccess', _131 => _131.maxWidth]),
2781
+ placement: _optionalChain([hudState, 'access', _132 => _132.runningStep, 'optionalAccess', _133 => _133.placement])
2656
2782
  };
2657
- }, [_optionalChain([hudState, 'access', _116 => _116.runningStep, 'optionalAccess', _117 => _117.placement]), popoverOptions]);
2783
+ }, [_optionalChain([hudState, 'access', _134 => _134.runningStep, 'optionalAccess', _135 => _135.placement]), popoverOptions]);
2658
2784
  const descriptionResult = _react.useMemo.call(void 0, () => {
2659
2785
  return {
2660
2786
  ...description,
@@ -2667,14 +2793,14 @@ var useTourHud = (options = {}) => {
2667
2793
  target: hudState.hudTarget,
2668
2794
  popoverNode,
2669
2795
  setPopoverNode,
2670
- guardElementFocusRing: _optionalChain([hudState, 'access', _118 => _118.flowHudOptions, 'optionalAccess', _119 => _119.guardElementFocusRing])
2796
+ guardElementFocusRing: _optionalChain([hudState, 'access', _136 => _136.flowHudOptions, 'optionalAccess', _137 => _137.guardElementFocusRing])
2671
2797
  }),
2672
2798
  [
2673
2799
  hudState.focusTrapActive,
2674
2800
  hudState.hudTarget,
2675
2801
  popoverNode,
2676
2802
  setPopoverNode,
2677
- _optionalChain([hudState, 'access', _120 => _120.flowHudOptions, 'optionalAccess', _121 => _121.guardElementFocusRing])
2803
+ _optionalChain([hudState, 'access', _138 => _138.flowHudOptions, 'optionalAccess', _139 => _139.guardElementFocusRing])
2678
2804
  ]
2679
2805
  );
2680
2806
  return {
@@ -2696,6 +2822,7 @@ var useTourHud = (options = {}) => {
2696
2822
  var DEFAULT_PADDING = 12;
2697
2823
  var DEFAULT_RADIUS = 12;
2698
2824
  var DEFAULT_EDGE_BUFFER = 0;
2825
+ var rectIntersectsViewport = (rect, viewport) => rect.bottom > 0 && rect.right > 0 && rect.top < viewport.height && rect.left < viewport.width;
2699
2826
  var useTourOverlay = (options) => {
2700
2827
  const {
2701
2828
  target,
@@ -2707,9 +2834,13 @@ var useTourOverlay = (options) => {
2707
2834
  } = options;
2708
2835
  const hasShownRef = _react.useRef.call(void 0, false);
2709
2836
  const lastReadyTargetRef = _react.useRef.call(void 0, null);
2837
+ const viewport = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
2838
+ const liveRectIsInViewport = Boolean(
2839
+ target.isScreen || target.rect && rectIntersectsViewport(target.rect, viewport)
2840
+ );
2710
2841
  _react.useEffect.call(void 0, () => {
2711
2842
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
2712
- if (target.status === "ready") {
2843
+ if (target.status === "ready" && liveRectIsInViewport) {
2713
2844
  hasShownRef.current = true;
2714
2845
  lastReadyTargetRef.current = {
2715
2846
  ...target,
@@ -2721,12 +2852,11 @@ var useTourOverlay = (options) => {
2721
2852
  hasShownRef.current = false;
2722
2853
  lastReadyTargetRef.current = null;
2723
2854
  }
2724
- }, [target, isInGracePeriod]);
2725
- const viewport = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
2855
+ }, [target, isInGracePeriod, liveRectIsInViewport]);
2726
2856
  const cachedTarget = lastReadyTargetRef.current;
2727
- const highlightTarget = target.status === "ready" ? target : cachedTarget;
2728
- const resolvedRect = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _122 => _122.rect]), () => ( target.rect));
2729
- const resolvedIsScreen = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _123 => _123.isScreen]), () => ( target.isScreen));
2857
+ const highlightTarget = target.status === "ready" && liveRectIsInViewport ? target : cachedTarget;
2858
+ const resolvedRect = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _140 => _140.rect]), () => ( (cachedTarget ? null : _nullishCoalesce(target.rect, () => ( null)))));
2859
+ const resolvedIsScreen = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _141 => _141.isScreen]), () => ( target.isScreen));
2730
2860
  const expandedRect = resolvedIsScreen || !resolvedRect ? viewport : _chunk7SAJNRGZcjs.expandRect.call(void 0, resolvedRect, padding);
2731
2861
  const safeBuffer = Math.max(0, edgeBuffer);
2732
2862
  const insetTop = expandedRect.top <= 0 ? Math.min(safeBuffer, Math.max(0, expandedRect.height) / 2) : 0;
@@ -2906,7 +3036,7 @@ var DEFAULT_ENABLED = true;
2906
3036
  var useTourFocusDominance = (options = {}) => {
2907
3037
  const { enabled = DEFAULT_ENABLED } = options;
2908
3038
  const { state } = useTour();
2909
- const isRunning = _optionalChain([state, 'optionalAccess', _124 => _124.status]) === "running";
3039
+ const isRunning = _optionalChain([state, 'optionalAccess', _142 => _142.status]) === "running";
2910
3040
  const active = Boolean(enabled && isRunning);
2911
3041
  return {
2912
3042
  active,
@@ -2970,11 +3100,11 @@ var useRadixTourDialog = (params) => {
2970
3100
  const lastStepIndexRef = _react.useRef.call(void 0, -1);
2971
3101
  const isResumeRef = _react.useRef.call(void 0, false);
2972
3102
  const flow = activeFlowId ? flows.get(activeFlowId) : void 0;
2973
- const dialogConfig = _optionalChain([flow, 'optionalAccess', _125 => _125.dialogs, 'optionalAccess', _126 => _126[dialogId]]);
3103
+ const dialogConfig = _optionalChain([flow, 'optionalAccess', _143 => _143.dialogs, 'optionalAccess', _144 => _144[dialogId]]);
2974
3104
  const currentStep = flow && state && state.stepIndex >= 0 ? flow.steps[state.stepIndex] : void 0;
2975
- const isStepActive = _optionalChain([currentStep, 'optionalAccess', _127 => _127.dialogId]) === dialogId;
3105
+ const isStepActive = _optionalChain([currentStep, 'optionalAccess', _145 => _145.dialogId]) === dialogId;
2976
3106
  const autoOpenConfig = resolveAutoOpen2(dialogConfig);
2977
- const autoClose = _nullishCoalesce(_optionalChain([dialogConfig, 'optionalAccess', _128 => _128.autoClose]), () => ( "differentDialog"));
3107
+ const autoClose = _nullishCoalesce(_optionalChain([dialogConfig, 'optionalAccess', _146 => _146.autoClose]), () => ( "differentDialog"));
2978
3108
  const shouldBeOpen = _react.useMemo.call(void 0, () => {
2979
3109
  if (!isStepActive) return false;
2980
3110
  return true;
@@ -3006,7 +3136,7 @@ var useRadixTourDialog = (params) => {
3006
3136
  if (previousStepIndex === currentStepIndex) return;
3007
3137
  lastStepIndexRef.current = currentStepIndex;
3008
3138
  const previousStep = previousStepIndex >= 0 ? flow.steps[previousStepIndex] : void 0;
3009
- const wasActive = _optionalChain([previousStep, 'optionalAccess', _129 => _129.dialogId]) === dialogId;
3139
+ const wasActive = _optionalChain([previousStep, 'optionalAccess', _147 => _147.dialogId]) === dialogId;
3010
3140
  if (isStepActive && !wasActive) {
3011
3141
  const shouldAutoOpen = wasResume ? autoOpenConfig.onResume : autoOpenConfig.onEnter;
3012
3142
  if (shouldAutoOpen) {
@@ -3044,7 +3174,7 @@ var useRadixTourDialog = (params) => {
3044
3174
  const step = payload.previousStep;
3045
3175
  if (step.dialogId !== dialogId) return;
3046
3176
  const nextStep = payload.currentStep;
3047
- if (_optionalChain([nextStep, 'optionalAccess', _130 => _130.dialogId]) === dialogId) {
3177
+ if (_optionalChain([nextStep, 'optionalAccess', _148 => _148.dialogId]) === dialogId) {
3048
3178
  return;
3049
3179
  }
3050
3180
  if (autoClose === "always" || autoClose === "differentDialog") {
@@ -3165,7 +3295,7 @@ var useDelayAdvance = () => {
3165
3295
  }, [delayInfo]);
3166
3296
  return _react.useMemo.call(void 0, () => {
3167
3297
  const matchingStep = !!delayInfo && !!activeStep && activeStep.id === delayInfo.stepId;
3168
- const isRunning = matchingStep && _optionalChain([state, 'optionalAccess', _131 => _131.status]) === "running";
3298
+ const isRunning = matchingStep && _optionalChain([state, 'optionalAccess', _149 => _149.status]) === "running";
3169
3299
  if (!delayInfo) {
3170
3300
  return {
3171
3301
  isActive: false,
@@ -3314,19 +3444,19 @@ var OverlayBackdrop = ({
3314
3444
  const defaultInsetShadow = "inset 0 0 0 2px rgba(56,189,248,0.4), inset 0 0 0 8px rgba(15,23,42,0.3)";
3315
3445
  const highlightAppearance = shadow ? { boxShadow: shadow } : { boxShadow: defaultInsetShadow };
3316
3446
  const { MotionDiv, MotionSvg, MotionDefs, MotionMask, MotionRect } = adapter.components;
3317
- const highlightTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _132 => _132.overlayHighlight]), () => ( adapter.transitions.overlayHighlight)), () => ( DEFAULT_HIGHLIGHT_TRANSITION));
3447
+ const highlightTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _150 => _150.overlayHighlight]), () => ( adapter.transitions.overlayHighlight)), () => ( DEFAULT_HIGHLIGHT_TRANSITION));
3318
3448
  const snapTransition = { type: "tween", duration: 0 };
3319
3449
  const resolvedHighlightTransition = shouldSnapHighlight ? snapTransition : highlightTransition;
3320
- const overlayTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _133 => _133.overlayFade]), () => ( adapter.transitions.overlayFade)), () => ( DEFAULT_OVERLAY_TRANSITION));
3321
- const highlightCollapseTransition = highlight.isScreen ? snapTransition : _nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _134 => _134.overlayHighlightCollapse]), () => ( DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION));
3450
+ const overlayTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _151 => _151.overlayFade]), () => ( adapter.transitions.overlayFade)), () => ( DEFAULT_OVERLAY_TRANSITION));
3451
+ const highlightCollapseTransition = highlight.isScreen ? snapTransition : _nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _152 => _152.overlayHighlightCollapse]), () => ( DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION));
3322
3452
  const highlightRectTransition = hasHighlightBounds ? resolvedHighlightTransition : highlightCollapseTransition;
3323
3453
  const highlightRectAnimation = shouldMask ? {
3324
- x: _nullishCoalesce(_optionalChain([highlight, 'access', _135 => _135.rect, 'optionalAccess', _136 => _136.left]), () => ( highlight.centerX)),
3325
- y: _nullishCoalesce(_optionalChain([highlight, 'access', _137 => _137.rect, 'optionalAccess', _138 => _138.top]), () => ( highlight.centerY)),
3326
- width: _nullishCoalesce(_optionalChain([highlight, 'access', _139 => _139.rect, 'optionalAccess', _140 => _140.width]), () => ( 0)),
3327
- height: _nullishCoalesce(_optionalChain([highlight, 'access', _141 => _141.rect, 'optionalAccess', _142 => _142.height]), () => ( 0)),
3328
- rx: _nullishCoalesce(_optionalChain([highlight, 'access', _143 => _143.rect, 'optionalAccess', _144 => _144.radius]), () => ( 0)),
3329
- ry: _nullishCoalesce(_optionalChain([highlight, 'access', _145 => _145.rect, 'optionalAccess', _146 => _146.radius]), () => ( 0))
3454
+ x: _nullishCoalesce(_optionalChain([highlight, 'access', _153 => _153.rect, 'optionalAccess', _154 => _154.left]), () => ( highlight.centerX)),
3455
+ y: _nullishCoalesce(_optionalChain([highlight, 'access', _155 => _155.rect, 'optionalAccess', _156 => _156.top]), () => ( highlight.centerY)),
3456
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _157 => _157.rect, 'optionalAccess', _158 => _158.width]), () => ( 0)),
3457
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _159 => _159.rect, 'optionalAccess', _160 => _160.height]), () => ( 0)),
3458
+ rx: _nullishCoalesce(_optionalChain([highlight, 'access', _161 => _161.rect, 'optionalAccess', _162 => _162.radius]), () => ( 0)),
3459
+ ry: _nullishCoalesce(_optionalChain([highlight, 'access', _163 => _163.rect, 'optionalAccess', _164 => _164.radius]), () => ( 0))
3330
3460
  } : {
3331
3461
  x: highlight.centerX,
3332
3462
  y: highlight.centerY,
@@ -3338,9 +3468,9 @@ var OverlayBackdrop = ({
3338
3468
  const highlightRingAnimation = hasHighlightBounds ? {
3339
3469
  top: highlight.centerY,
3340
3470
  left: highlight.centerX,
3341
- width: _nullishCoalesce(_optionalChain([highlight, 'access', _147 => _147.rect, 'optionalAccess', _148 => _148.width]), () => ( 0)),
3342
- height: _nullishCoalesce(_optionalChain([highlight, 'access', _149 => _149.rect, 'optionalAccess', _150 => _150.height]), () => ( 0)),
3343
- borderRadius: _nullishCoalesce(_optionalChain([highlight, 'access', _151 => _151.rect, 'optionalAccess', _152 => _152.radius]), () => ( 0)),
3471
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _165 => _165.rect, 'optionalAccess', _166 => _166.width]), () => ( 0)),
3472
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _167 => _167.rect, 'optionalAccess', _168 => _168.height]), () => ( 0)),
3473
+ borderRadius: _nullishCoalesce(_optionalChain([highlight, 'access', _169 => _169.rect, 'optionalAccess', _170 => _170.radius]), () => ( 0)),
3344
3474
  opacity: 1,
3345
3475
  transform: "translate(-50%, -50%)"
3346
3476
  } : {
@@ -3571,6 +3701,7 @@ var DEFAULT_POPOVER_CONTENT_TRANSITION = {
3571
3701
  ease: "easeOut"
3572
3702
  };
3573
3703
  var floatingPositionCache = /* @__PURE__ */ new Map();
3704
+ var rectIntersectsViewport2 = (rect, viewport) => rect.bottom > 0 && rect.right > 0 && rect.top < viewport.height && rect.left < viewport.width;
3574
3705
  var getFloatingCacheKey = (target) => {
3575
3706
  if (target.stepId) {
3576
3707
  return `step:${target.stepId}`;
@@ -3599,7 +3730,8 @@ var TourPopoverPortal = ({
3599
3730
  containerComponent,
3600
3731
  contentComponent,
3601
3732
  transitionsOverride,
3602
- isInGracePeriod = false
3733
+ isInGracePeriod = false,
3734
+ onHeightChange
3603
3735
  }) => {
3604
3736
  if (!_chunk7SAJNRGZcjs.isBrowser) return null;
3605
3737
  const host = _chunk7SAJNRGZcjs.portalHost.call(void 0, );
@@ -3607,18 +3739,21 @@ var TourPopoverPortal = ({
3607
3739
  const adapter = useAnimationAdapter();
3608
3740
  const Container = _nullishCoalesce(containerComponent, () => ( adapter.components.MotionDiv));
3609
3741
  const Content = _nullishCoalesce(contentComponent, () => ( adapter.components.MotionDiv));
3610
- const popoverEntranceTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _153 => _153.popoverEntrance]), () => ( adapter.transitions.popoverEntrance)), () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION));
3611
- const popoverExitTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _154 => _154.popoverExit]), () => ( adapter.transitions.popoverExit)), () => ( DEFAULT_POPOVER_EXIT_TRANSITION));
3612
- const popoverContentTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _155 => _155.popoverContent]), () => ( adapter.transitions.popoverContent)), () => ( DEFAULT_POPOVER_CONTENT_TRANSITION));
3742
+ const popoverEntranceTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _171 => _171.popoverEntrance]), () => ( adapter.transitions.popoverEntrance)), () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION));
3743
+ const popoverExitTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _172 => _172.popoverExit]), () => ( adapter.transitions.popoverExit)), () => ( DEFAULT_POPOVER_EXIT_TRANSITION));
3744
+ const popoverContentTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _173 => _173.popoverContent]), () => ( adapter.transitions.popoverContent)), () => ( DEFAULT_POPOVER_CONTENT_TRANSITION));
3613
3745
  const viewport = useViewportRect();
3614
3746
  const prefersMobileLayout = viewport.width <= MOBILE_BREAKPOINT || viewport.height <= MOBILE_HEIGHT_BREAKPOINT;
3747
+ const liveTargetUsable = Boolean(
3748
+ target.status === "ready" && (target.isScreen || target.rect && rectIntersectsViewport2(target.rect, viewport))
3749
+ );
3615
3750
  const prefersMobileRef = _react.useRef.call(void 0, prefersMobileLayout);
3616
3751
  _react.useEffect.call(void 0, () => {
3617
3752
  prefersMobileRef.current = prefersMobileLayout;
3618
3753
  }, [prefersMobileLayout]);
3619
3754
  const lastReadyTargetRef = _react.useRef.call(void 0, null);
3620
3755
  _react.useEffect.call(void 0, () => {
3621
- if (target.status === "ready" && target.rect) {
3756
+ if (liveTargetUsable && target.rect) {
3622
3757
  lastReadyTargetRef.current = {
3623
3758
  rect: { ...target.rect },
3624
3759
  isScreen: target.isScreen
@@ -3626,19 +3761,19 @@ var TourPopoverPortal = ({
3626
3761
  } else if (target.status === "idle" && !isInGracePeriod) {
3627
3762
  lastReadyTargetRef.current = null;
3628
3763
  }
3629
- }, [target.isScreen, target.rect, target.status, isInGracePeriod]);
3764
+ }, [target.isScreen, target.rect, target.status, isInGracePeriod, liveTargetUsable]);
3630
3765
  const cachedTarget = lastReadyTargetRef.current;
3631
- const resolvedRect = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( _optionalChain([cachedTarget, 'optionalAccess', _156 => _156.rect]))), () => ( null));
3632
- const resolvedIsScreen = target.status === "ready" ? target.isScreen : _nullishCoalesce(_optionalChain([cachedTarget, 'optionalAccess', _157 => _157.isScreen]), () => ( target.isScreen));
3633
- const shouldHidePopover = !resolvedRect && !target.isScreen;
3766
+ const resolvedRect = liveTargetUsable ? _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( _optionalChain([cachedTarget, 'optionalAccess', _174 => _174.rect]))), () => ( null)) : _nullishCoalesce(_optionalChain([cachedTarget, 'optionalAccess', _175 => _175.rect]), () => ( (cachedTarget ? null : _nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( null)))));
3767
+ const resolvedIsScreen = liveTargetUsable ? target.isScreen : _nullishCoalesce(_optionalChain([cachedTarget, 'optionalAccess', _176 => _176.isScreen]), () => ( target.isScreen));
3768
+ const shouldHidePopover = !resolvedRect && !resolvedIsScreen;
3634
3769
  const fallbackRect = _nullishCoalesce(resolvedRect, () => ( viewport));
3635
3770
  const fallbackIsScreen = resolvedIsScreen;
3636
3771
  const [floatingSize, setFloatingSize] = _react.useState.call(void 0, null);
3637
3772
  const clampVertical = (value) => Math.min(viewport.height - 24, Math.max(24, value));
3638
3773
  const clampHorizontal = (value) => Math.min(viewport.width - 24, Math.max(24, value));
3639
- const screenCenteredTop = viewport.height / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _158 => _158.height]), () => ( 0))) / 2;
3640
- const screenCenteredLeft = viewport.width / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _159 => _159.width]), () => ( 0))) / 2;
3641
- const floatingWidth = _nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _160 => _160.width]), () => ( 0));
3774
+ const screenCenteredTop = viewport.height / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _177 => _177.height]), () => ( 0))) / 2;
3775
+ const screenCenteredLeft = viewport.width / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _178 => _178.width]), () => ( 0))) / 2;
3776
+ const floatingWidth = _nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _179 => _179.width]), () => ( 0));
3642
3777
  const baseTop = fallbackIsScreen ? screenCenteredTop : fallbackRect.top + fallbackRect.height + offset;
3643
3778
  const top = fallbackIsScreen ? clampVertical(screenCenteredTop) : clampVertical(baseTop);
3644
3779
  const leftBase = fallbackIsScreen ? screenCenteredLeft : fallbackRect.left + fallbackRect.width / 2 - floatingWidth / 2;
@@ -3713,14 +3848,20 @@ var TourPopoverPortal = ({
3713
3848
  floatingPositionCache.set(cacheKey, floatingPosition);
3714
3849
  }
3715
3850
  }, [floatingPosition, target.isScreen, target.stepId]);
3716
- const dockedPosition = _react.useMemo.call(void 0,
3717
- () => ({
3851
+ const dockedPosition = _react.useMemo.call(void 0, () => {
3852
+ if (floatingSize) {
3853
+ return {
3854
+ top: viewport.height - DOCKED_MARGIN - floatingSize.height,
3855
+ left: viewport.width - DOCKED_MARGIN - floatingSize.width,
3856
+ transform: "translate3d(0px, 0px, 0px)"
3857
+ };
3858
+ }
3859
+ return {
3718
3860
  top: viewport.height - DOCKED_MARGIN,
3719
3861
  left: viewport.width - DOCKED_MARGIN,
3720
3862
  transform: "translate3d(-100%, -100%, 0px)"
3721
- }),
3722
- [viewport.height, viewport.width]
3723
- );
3863
+ };
3864
+ }, [viewport.height, viewport.width, floatingSize]);
3724
3865
  const mobilePosition = _react.useMemo.call(void 0,
3725
3866
  () => ({
3726
3867
  top: viewport.height - MOBILE_HORIZONTAL_GUTTER,
@@ -3734,6 +3875,10 @@ var TourPopoverPortal = ({
3734
3875
  setFloatingPosition(dockedPosition);
3735
3876
  }
3736
3877
  }, [dockedPosition, layoutMode]);
3878
+ _react.useEffect.call(void 0, () => {
3879
+ if (!onHeightChange) return;
3880
+ onHeightChange(floatingSize ? floatingSize.height + DOCKED_MARGIN : 0);
3881
+ }, [floatingSize, onHeightChange]);
3737
3882
  _react.useEffect.call(void 0, () => {
3738
3883
  if (layoutMode === "mobile") {
3739
3884
  setFloatingPosition(mobilePosition);
@@ -3833,10 +3978,11 @@ var TourPopoverPortal = ({
3833
3978
  _react.useLayoutEffect.call(void 0, () => {
3834
3979
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
3835
3980
  const floatingEl = floatingRef.current;
3836
- const rectInfo = target.rect;
3981
+ const rectInfo = liveTargetUsable ? _nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( null)) : null;
3837
3982
  if (!floatingEl) return;
3983
+ if (!liveTargetUsable) return;
3838
3984
  if (target.status !== "ready") return;
3839
- if (!rectInfo || target.isScreen) return;
3985
+ if (!rectInfo || resolvedIsScreen) return;
3840
3986
  if (layoutMode === "mobile" || layoutMode === "manual") return;
3841
3987
  const cancelState = { cancelled: false };
3842
3988
  const retryState = overflowRetryRef.current;
@@ -3852,7 +3998,7 @@ var TourPopoverPortal = ({
3852
3998
  }
3853
3999
  };
3854
4000
  const virtualReference = {
3855
- contextElement: _nullishCoalesce(target.element, () => ( void 0)),
4001
+ contextElement: liveTargetUsable ? _nullishCoalesce(target.element, () => ( void 0)) : void 0,
3856
4002
  getBoundingClientRect: () => DOMRectReadOnly.fromRect({
3857
4003
  width: rectInfo.width,
3858
4004
  height: rectInfo.height,
@@ -3964,10 +4110,13 @@ var TourPopoverPortal = ({
3964
4110
  dockedPosition,
3965
4111
  isAutoPlacement,
3966
4112
  layoutMode,
4113
+ liveTargetUsable,
3967
4114
  offset,
4115
+ resolvedIsScreen,
3968
4116
  resolvedPlacement,
3969
4117
  target.element,
3970
4118
  target.isScreen,
4119
+ target.lastResolvedRect,
3971
4120
  target.lastUpdated,
3972
4121
  target.status,
3973
4122
  target.stepId
@@ -3983,8 +4132,8 @@ var TourPopoverPortal = ({
3983
4132
  const clampToViewport = (rawLeft, rawTop) => {
3984
4133
  const rect = _chunk7SAJNRGZcjs.getViewportRect.call(void 0, );
3985
4134
  const floatingEl = floatingRef.current;
3986
- const floatingElWidth = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _161 => _161.offsetWidth]), () => ( 0));
3987
- const floatingElHeight = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _162 => _162.offsetHeight]), () => ( 0));
4135
+ const floatingElWidth = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _180 => _180.offsetWidth]), () => ( 0));
4136
+ const floatingElHeight = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _181 => _181.offsetHeight]), () => ( 0));
3988
4137
  const minLeft = rect.left + FLOATING_OFFSET;
3989
4138
  const maxLeft = rect.left + rect.width - floatingElWidth - FLOATING_OFFSET;
3990
4139
  const minTop = rect.top + FLOATING_OFFSET;
@@ -4077,7 +4226,7 @@ var TourPopoverPortal = ({
4077
4226
  };
4078
4227
  const setFloatingNode = (node) => {
4079
4228
  floatingRef.current = node;
4080
- _optionalChain([onContainerChange, 'optionalCall', _163 => _163(node)]);
4229
+ _optionalChain([onContainerChange, 'optionalCall', _182 => _182(node)]);
4081
4230
  };
4082
4231
  const containerProps = {
4083
4232
  ref: setFloatingNode,
@@ -4254,7 +4403,7 @@ var TourFocusManager = ({
4254
4403
  return;
4255
4404
  }
4256
4405
  if (previousFocusRef.current) return;
4257
- const doc = _nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _164 => _164.ownerDocument]), () => ( _optionalChain([target, 'access', _165 => _165.element, 'optionalAccess', _166 => _166.ownerDocument])));
4406
+ const doc = _nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _183 => _183.ownerDocument]), () => ( _optionalChain([target, 'access', _184 => _184.element, 'optionalAccess', _185 => _185.ownerDocument])));
4258
4407
  const activeEl = (_nullishCoalesce(doc, () => ( document))).activeElement;
4259
4408
  if (activeEl instanceof HTMLElement) {
4260
4409
  previousFocusRef.current = activeEl;
@@ -4266,7 +4415,7 @@ var TourFocusManager = ({
4266
4415
  _react.useEffect.call(void 0, () => {
4267
4416
  if (!_chunk7SAJNRGZcjs.isBrowser) return;
4268
4417
  if (!active) return;
4269
- const doc = _nullishCoalesce(_nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _167 => _167.ownerDocument]), () => ( _optionalChain([target, 'access', _168 => _168.element, 'optionalAccess', _169 => _169.ownerDocument]))), () => ( document));
4418
+ const doc = _nullishCoalesce(_nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _186 => _186.ownerDocument]), () => ( _optionalChain([target, 'access', _187 => _187.element, 'optionalAccess', _188 => _188.ownerDocument]))), () => ( document));
4270
4419
  const createGuard = (key) => {
4271
4420
  const node = doc.createElement("div");
4272
4421
  node.tabIndex = 0;
@@ -4296,7 +4445,7 @@ var TourFocusManager = ({
4296
4445
  const removeGuards = () => {
4297
4446
  for (const key of Object.keys(guardNodesRef.current)) {
4298
4447
  const node = guardNodesRef.current[key];
4299
- if (_optionalChain([node, 'optionalAccess', _170 => _170.parentNode])) {
4448
+ if (_optionalChain([node, 'optionalAccess', _189 => _189.parentNode])) {
4300
4449
  node.parentNode.removeChild(node);
4301
4450
  }
4302
4451
  guardNodesRef.current[key] = null;
@@ -4324,7 +4473,7 @@ var TourFocusManager = ({
4324
4473
  } else {
4325
4474
  for (const key of ["target-start", "target-end"]) {
4326
4475
  const node = guardNodesRef.current[key];
4327
- if (_optionalChain([node, 'optionalAccess', _171 => _171.parentNode])) {
4476
+ if (_optionalChain([node, 'optionalAccess', _190 => _190.parentNode])) {
4328
4477
  node.parentNode.removeChild(node);
4329
4478
  }
4330
4479
  guardNodesRef.current[key] = null;
@@ -4348,7 +4497,7 @@ var TourFocusManager = ({
4348
4497
  } else {
4349
4498
  for (const key of ["popover-start", "popover-end"]) {
4350
4499
  const node = guardNodesRef.current[key];
4351
- if (_optionalChain([node, 'optionalAccess', _172 => _172.parentNode])) {
4500
+ if (_optionalChain([node, 'optionalAccess', _191 => _191.parentNode])) {
4352
4501
  node.parentNode.removeChild(node);
4353
4502
  }
4354
4503
  guardNodesRef.current[key] = null;
@@ -4368,7 +4517,7 @@ var TourFocusManager = ({
4368
4517
  }
4369
4518
  nodes.push(...getFocusableIn(targetElement));
4370
4519
  }
4371
- if (nodes.length === 0 && _optionalChain([popoverNode, 'optionalAccess', _173 => _173.hasAttribute, 'call', _174 => _174("tabindex")])) {
4520
+ if (nodes.length === 0 && _optionalChain([popoverNode, 'optionalAccess', _192 => _192.hasAttribute, 'call', _193 => _193("tabindex")])) {
4372
4521
  nodes.push(popoverNode);
4373
4522
  }
4374
4523
  const unique = [];
@@ -4382,7 +4531,7 @@ var TourFocusManager = ({
4382
4531
  };
4383
4532
  const isWithinTrap = (element) => {
4384
4533
  if (!(element instanceof HTMLElement)) return false;
4385
- if (_optionalChain([popoverNode, 'optionalAccess', _175 => _175.contains, 'call', _176 => _176(element)])) return true;
4534
+ if (_optionalChain([popoverNode, 'optionalAccess', _194 => _194.contains, 'call', _195 => _195(element)])) return true;
4386
4535
  if (target.element instanceof HTMLElement && target.element.contains(element)) {
4387
4536
  return true;
4388
4537
  }
@@ -4426,10 +4575,10 @@ var TourFocusManager = ({
4426
4575
  }
4427
4576
  }
4428
4577
  const key = targetNode.getAttribute("data-tour-focus-guard");
4429
- if (_optionalChain([key, 'optionalAccess', _177 => _177.startsWith, 'call', _178 => _178("target")])) {
4578
+ if (_optionalChain([key, 'optionalAccess', _196 => _196.startsWith, 'call', _197 => _197("target")])) {
4430
4579
  setTargetRingActive(true);
4431
4580
  setPopoverRingActive(false);
4432
- } else if (_optionalChain([key, 'optionalAccess', _179 => _179.startsWith, 'call', _180 => _180("popover")])) {
4581
+ } else if (_optionalChain([key, 'optionalAccess', _198 => _198.startsWith, 'call', _199 => _199("popover")])) {
4433
4582
  setTargetRingActive(false);
4434
4583
  setPopoverRingActive(true);
4435
4584
  }
@@ -4467,7 +4616,7 @@ var TourFocusManager = ({
4467
4616
  if (!_chunk7SAJNRGZcjs.isBrowser) return null;
4468
4617
  const host = _chunk7SAJNRGZcjs.portalHost.call(void 0, );
4469
4618
  if (!host) return null;
4470
- const boxShadow = _nullishCoalesce(_optionalChain([guardElementFocusRing, 'optionalAccess', _181 => _181.boxShadow]), () => ( DEFAULT_BOX_SHADOW));
4619
+ const boxShadow = _nullishCoalesce(_optionalChain([guardElementFocusRing, 'optionalAccess', _200 => _200.boxShadow]), () => ( DEFAULT_BOX_SHADOW));
4471
4620
  const showTargetRing = targetRingActive && highlightRect;
4472
4621
  const showPopoverRing = popoverRingActive && popoverRect;
4473
4622
  if (!showTargetRing && !showPopoverRing) return null;
@@ -4628,4 +4777,5 @@ var useBodyScrollLock = (enabled) => {
4628
4777
 
4629
4778
 
4630
4779
 
4631
- exports.AnimationAdapterProvider = AnimationAdapterProvider; exports.DialogRegistryProvider = DialogRegistryProvider; exports.OverlayBackdrop = OverlayBackdrop; exports.TourFocusManager = TourFocusManager; exports.TourPopoverPortal = TourPopoverPortal; exports.TourProvider = TourProvider; exports.createPathString = _chunk7SAJNRGZcjs.createPathString; exports.createWaitForPredicateController = createWaitForPredicateController; exports.defaultAnimationAdapter = defaultAnimationAdapter; exports.defaultLabels = defaultLabels; exports.getCurrentRoutePath = _chunk7SAJNRGZcjs.getCurrentRoutePath; exports.notifyRouteChange = _chunk7SAJNRGZcjs.notifyRouteChange; exports.reducedMotionAnimationAdapter = reducedMotionAnimationAdapter; exports.subscribeToRouteChanges = _chunk7SAJNRGZcjs.subscribeToRouteChanges; exports.useAdvanceRules = useAdvanceRules; exports.useAnimationAdapter = useAnimationAdapter; exports.useBodyScrollLock = useBodyScrollLock; exports.useConstrainedScrollLock = useConstrainedScrollLock; exports.useDelayAdvance = useDelayAdvance; exports.useDialogRegistry = useDialogRegistry; exports.useDialogRegistryOptional = useDialogRegistryOptional; exports.useHiddenTargetFallback = useHiddenTargetFallback; exports.useHudDescription = useHudDescription; exports.useHudMotion = useHudMotion; exports.useHudShortcuts = useHudShortcuts; exports.useHudState = useHudState; exports.useHudTargetIssue = useHudTargetIssue; exports.usePreferredAnimationAdapter = usePreferredAnimationAdapter; exports.useRadixDialogAdapter = useRadixDialogAdapter; exports.useRadixTourDialog = useRadixTourDialog; exports.useTour = useTour; exports.useTourControls = useTourControls; exports.useTourEvents = useTourEvents; exports.useTourFocusDominance = useTourFocusDominance; exports.useTourHud = useTourHud; exports.useTourLabels = useTourLabels; exports.useTourOverlay = useTourOverlay; exports.useTourTarget = useTourTarget; exports.useViewportRect = useViewportRect; exports.waitForDom = waitForDom;
4780
+
4781
+ exports.AnimationAdapterProvider = AnimationAdapterProvider; exports.DialogRegistryProvider = DialogRegistryProvider; exports.OverlayBackdrop = OverlayBackdrop; exports.TourFocusManager = TourFocusManager; exports.TourPopoverPortal = TourPopoverPortal; exports.TourProvider = TourProvider; exports.createPathString = _chunk7SAJNRGZcjs.createPathString; exports.createWaitForPredicateController = createWaitForPredicateController; exports.defaultAnimationAdapter = defaultAnimationAdapter; exports.defaultLabels = defaultLabels; exports.getCurrentRoutePath = _chunk7SAJNRGZcjs.getCurrentRoutePath; exports.notifyRouteChange = _chunk7SAJNRGZcjs.notifyRouteChange; exports.reducedMotionAnimationAdapter = reducedMotionAnimationAdapter; exports.subscribeToRouteChanges = _chunk7SAJNRGZcjs.subscribeToRouteChanges; exports.tweenAnimationAdapter = tweenAnimationAdapter; exports.useAdvanceRules = useAdvanceRules; exports.useAnimationAdapter = useAnimationAdapter; exports.useBodyScrollLock = useBodyScrollLock; exports.useConstrainedScrollLock = useConstrainedScrollLock; exports.useDelayAdvance = useDelayAdvance; exports.useDialogRegistry = useDialogRegistry; exports.useDialogRegistryOptional = useDialogRegistryOptional; exports.useHiddenTargetFallback = useHiddenTargetFallback; exports.useHudDescription = useHudDescription; exports.useHudMotion = useHudMotion; exports.useHudShortcuts = useHudShortcuts; exports.useHudState = useHudState; exports.useHudTargetIssue = useHudTargetIssue; exports.usePreferredAnimationAdapter = usePreferredAnimationAdapter; exports.useRadixDialogAdapter = useRadixDialogAdapter; exports.useRadixTourDialog = useRadixTourDialog; exports.useTour = useTour; exports.useTourControls = useTourControls; exports.useTourEvents = useTourEvents; exports.useTourFocusDominance = useTourFocusDominance; exports.useTourHud = useTourHud; exports.useTourLabels = useTourLabels; exports.useTourOverlay = useTourOverlay; exports.useTourTarget = useTourTarget; exports.useViewportRect = useViewportRect; exports.waitForDom = waitForDom;