@flowsterix/react 0.11.0 → 0.12.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.
Files changed (33) hide show
  1. package/dist/chunk-D5LQLRSU.cjs +289 -0
  2. package/dist/chunk-FCOKCGV3.cjs +21 -0
  3. package/dist/chunk-HPVLOLCD.cjs +1 -0
  4. package/dist/components/TourPopoverPortal.d.ts +1 -1
  5. package/dist/components/TourPopoverPortal.d.ts.map +1 -1
  6. package/dist/context.d.ts +6 -0
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/devtools/DevToolsProvider.d.ts.map +1 -1
  9. package/dist/devtools/components/FlowEditModal.d.ts.map +1 -1
  10. package/dist/devtools/components/FlowItem.d.ts.map +1 -1
  11. package/dist/devtools/components/GrabberOverlay.d.ts +1 -0
  12. package/dist/devtools/components/GrabberOverlay.d.ts.map +1 -1
  13. package/dist/devtools/components/StepItem.d.ts.map +1 -1
  14. package/dist/devtools/components/StepList.d.ts.map +1 -1
  15. package/dist/devtools/components/TabNav.d.ts.map +1 -1
  16. package/dist/devtools/components/Toolbar.d.ts.map +1 -1
  17. package/dist/devtools/globalBridge.d.ts +24 -0
  18. package/dist/devtools/globalBridge.d.ts.map +1 -0
  19. package/dist/devtools/hooks/useFlowsData.d.ts.map +1 -1
  20. package/dist/devtools/index.cjs +849 -577
  21. package/dist/devtools/index.mjs +605 -281
  22. package/dist/devtools/motion.d.ts +64 -0
  23. package/dist/devtools/motion.d.ts.map +1 -0
  24. package/dist/hooks/useHiddenTargetFallback.d.ts.map +1 -1
  25. package/dist/hooks/useTourOverlay.d.ts.map +1 -1
  26. package/dist/index.cjs +701 -927
  27. package/dist/index.mjs +116 -42
  28. package/dist/router/index.cjs +13 -202
  29. package/dist/router/nextAppRouterAdapter.cjs +11 -200
  30. package/dist/router/nextPagesRouterAdapter.cjs +10 -199
  31. package/dist/router/reactRouterAdapter.cjs +10 -199
  32. package/dist/router/tanstackRouterAdapter.cjs +22 -214
  33. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,79 +1,44 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.tsx
21
- var index_exports = {};
22
- __export(index_exports, {
23
- AnimationAdapterProvider: () => AnimationAdapterProvider,
24
- DialogRegistryProvider: () => DialogRegistryProvider,
25
- OverlayBackdrop: () => OverlayBackdrop,
26
- TourFocusManager: () => TourFocusManager,
27
- TourPopoverPortal: () => TourPopoverPortal,
28
- TourProvider: () => TourProvider,
29
- createPathString: () => createPathString,
30
- createWaitForPredicateController: () => createWaitForPredicateController,
31
- defaultAnimationAdapter: () => defaultAnimationAdapter,
32
- defaultLabels: () => defaultLabels,
33
- getCurrentRoutePath: () => getCurrentRoutePath,
34
- notifyRouteChange: () => notifyRouteChange,
35
- reducedMotionAnimationAdapter: () => reducedMotionAnimationAdapter,
36
- subscribeToRouteChanges: () => subscribeToRouteChanges,
37
- useAdvanceRules: () => useAdvanceRules,
38
- useAnimationAdapter: () => useAnimationAdapter,
39
- useBodyScrollLock: () => useBodyScrollLock,
40
- useDelayAdvance: () => useDelayAdvance,
41
- useDialogRegistry: () => useDialogRegistry,
42
- useDialogRegistryOptional: () => useDialogRegistryOptional,
43
- useHiddenTargetFallback: () => useHiddenTargetFallback,
44
- useHudDescription: () => useHudDescription,
45
- useHudMotion: () => useHudMotion,
46
- useHudShortcuts: () => useHudShortcuts,
47
- useHudState: () => useHudState,
48
- useHudTargetIssue: () => useHudTargetIssue,
49
- usePreferredAnimationAdapter: () => usePreferredAnimationAdapter,
50
- useRadixDialogAdapter: () => useRadixDialogAdapter,
51
- useRadixTourDialog: () => useRadixTourDialog,
52
- useTour: () => useTour,
53
- useTourControls: () => useTourControls,
54
- useTourEvents: () => useTourEvents,
55
- useTourFocusDominance: () => useTourFocusDominance,
56
- useTourHud: () => useTourHud,
57
- useTourLabels: () => useTourLabels,
58
- useTourOverlay: () => useTourOverlay,
59
- useTourTarget: () => useTourTarget,
60
- useViewportRect: () => useViewportRect,
61
- waitForDom: () => waitForDom
62
- });
63
- module.exports = __toCommonJS(index_exports);
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
+
3
+ var _chunkFCOKCGV3cjs = require('./chunk-FCOKCGV3.cjs');
4
+ require('./chunk-HPVLOLCD.cjs');
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
64
15
 
65
- // src/context.tsx
66
- var import_core = require("@flowsterix/core");
67
16
 
68
- // src/devtools/DevToolsContext.tsx
69
- var import_react = require("react");
70
- var DevToolsContext = (0, import_react.createContext)(null);
17
+
18
+ var _chunkD5LQLRSUcjs = require('./chunk-D5LQLRSU.cjs');
71
19
 
72
20
  // src/context.tsx
73
- var import_react7 = require("react");
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ var _core = require('@flowsterix/core');
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+ var _react = require('react');
74
39
 
75
40
  // src/labels.ts
76
- var import_react2 = require("react");
41
+
77
42
  var defaultLabels = {
78
43
  back: "Back",
79
44
  next: "Next",
@@ -95,34 +60,40 @@ var defaultLabels = {
95
60
  detachedBody: "Navigate back to the screen that contains this element or reopen it before continuing the tour."
96
61
  }
97
62
  };
98
- var LabelsContext = (0, import_react2.createContext)(defaultLabels);
63
+ var LabelsContext = _react.createContext.call(void 0, defaultLabels);
99
64
  var LabelsProvider = LabelsContext.Provider;
100
65
  function useTourLabels() {
101
- return (0, import_react2.useContext)(LabelsContext);
66
+ return _react.useContext.call(void 0, LabelsContext);
102
67
  }
103
68
 
104
69
  // src/dialog/DialogRegistryContext.tsx
105
- var import_react3 = require("react");
106
- var import_jsx_runtime = require("react/jsx-runtime");
107
- var DialogRegistryContext = (0, import_react3.createContext)(void 0);
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ var _jsxruntime = require('react/jsx-runtime');
78
+ var DialogRegistryContext = _react.createContext.call(void 0, void 0);
108
79
  var DialogRegistryProvider = ({ children }) => {
109
- const controllersRef = (0, import_react3.useRef)(/* @__PURE__ */ new Map());
110
- const register = (0, import_react3.useCallback)(
80
+ const controllersRef = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
81
+ const register = _react.useCallback.call(void 0,
111
82
  (dialogId, controller) => {
112
83
  controllersRef.current.set(dialogId, controller);
113
84
  },
114
85
  []
115
86
  );
116
- const unregister = (0, import_react3.useCallback)((dialogId) => {
87
+ const unregister = _react.useCallback.call(void 0, (dialogId) => {
117
88
  controllersRef.current.delete(dialogId);
118
89
  }, []);
119
- const getController = (0, import_react3.useCallback)((dialogId) => {
90
+ const getController = _react.useCallback.call(void 0, (dialogId) => {
120
91
  return controllersRef.current.get(dialogId);
121
92
  }, []);
122
- const isRegistered = (0, import_react3.useCallback)((dialogId) => {
93
+ const isRegistered = _react.useCallback.call(void 0, (dialogId) => {
123
94
  return controllersRef.current.has(dialogId);
124
95
  }, []);
125
- const value = (0, import_react3.useMemo)(
96
+ const value = _react.useMemo.call(void 0,
126
97
  () => ({
127
98
  register,
128
99
  unregister,
@@ -131,10 +102,10 @@ var DialogRegistryProvider = ({ children }) => {
131
102
  }),
132
103
  [register, unregister, getController, isRegistered]
133
104
  );
134
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogRegistryContext.Provider, { value, children });
105
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogRegistryContext.Provider, { value, children });
135
106
  };
136
107
  var useDialogRegistry = () => {
137
- const context = (0, import_react3.useContext)(DialogRegistryContext);
108
+ const context = _react.useContext.call(void 0, DialogRegistryContext);
138
109
  if (!context) {
139
110
  throw new Error(
140
111
  "useDialogRegistry must be used within a DialogRegistryProvider"
@@ -143,11 +114,11 @@ var useDialogRegistry = () => {
143
114
  return context;
144
115
  };
145
116
  var useDialogRegistryOptional = () => {
146
- return (0, import_react3.useContext)(DialogRegistryContext);
117
+ return _react.useContext.call(void 0, DialogRegistryContext);
147
118
  };
148
119
 
149
120
  // src/hooks/useDialogAutomation.ts
150
- var import_react4 = require("react");
121
+
151
122
  var resolveAutoOpen = (config) => {
152
123
  if (!config) return { onEnter: true, onResume: true };
153
124
  const { autoOpen } = config;
@@ -156,22 +127,22 @@ var resolveAutoOpen = (config) => {
156
127
  return { onEnter: true, onResume: true };
157
128
  }
158
129
  return {
159
- onEnter: autoOpen.onEnter ?? true,
160
- onResume: autoOpen.onResume ?? true
130
+ onEnter: _nullishCoalesce(autoOpen.onEnter, () => ( true)),
131
+ onResume: _nullishCoalesce(autoOpen.onResume, () => ( true))
161
132
  };
162
133
  };
163
134
  var useDialogAutomation = (params) => {
164
135
  const { flow, state, events, registry, onDialogNotMounted } = params;
165
- const previousDialogIdRef = (0, import_react4.useRef)(void 0);
166
- (0, import_react4.useEffect)(() => {
136
+ const previousDialogIdRef = _react.useRef.call(void 0, void 0);
137
+ _react.useEffect.call(void 0, () => {
167
138
  if (!events || !flow || !registry) return;
168
139
  const unsubscribeEnter = events.on("stepEnter", (payload) => {
169
140
  const step = payload.currentStep;
170
141
  const dialogId = step.dialogId;
171
142
  const previousDialogId = previousDialogIdRef.current;
172
- if (previousDialogId && previousDialogId !== dialogId && flow.dialogs?.[previousDialogId]) {
143
+ if (previousDialogId && previousDialogId !== dialogId && _optionalChain([flow, 'access', _ => _.dialogs, 'optionalAccess', _2 => _2[previousDialogId]])) {
173
144
  const config = flow.dialogs[previousDialogId];
174
- const autoClose = config.autoClose ?? "differentDialog";
145
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
175
146
  if (autoClose === "always" || autoClose === "differentDialog") {
176
147
  const controller = registry.getController(previousDialogId);
177
148
  if (controller) {
@@ -181,7 +152,7 @@ var useDialogAutomation = (params) => {
181
152
  }
182
153
  }
183
154
  }
184
- if (dialogId && flow.dialogs?.[dialogId]) {
155
+ if (dialogId && _optionalChain([flow, 'access', _3 => _3.dialogs, 'optionalAccess', _4 => _4[dialogId]])) {
185
156
  const config = flow.dialogs[dialogId];
186
157
  const autoOpenConfig = resolveAutoOpen(config);
187
158
  const isResume = payload.reason === "resume";
@@ -203,10 +174,10 @@ var useDialogAutomation = (params) => {
203
174
  const step = payload.previousStep;
204
175
  const dialogId = step.dialogId;
205
176
  const nextStep = payload.currentStep;
206
- if (nextStep?.dialogId === dialogId) return;
207
- if (dialogId && flow.dialogs?.[dialogId]) {
177
+ if (_optionalChain([nextStep, 'optionalAccess', _5 => _5.dialogId]) === dialogId) return;
178
+ if (dialogId && _optionalChain([flow, 'access', _6 => _6.dialogs, 'optionalAccess', _7 => _7[dialogId]])) {
208
179
  const config = flow.dialogs[dialogId];
209
- const autoClose = config.autoClose ?? "differentDialog";
180
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
210
181
  if (autoClose === "never") return;
211
182
  const controller = registry.getController(dialogId);
212
183
  if (controller) {
@@ -218,12 +189,12 @@ var useDialogAutomation = (params) => {
218
189
  });
219
190
  const handleFlowEnd = () => {
220
191
  const dialogId = previousDialogIdRef.current;
221
- if (dialogId && flow.dialogs?.[dialogId]) {
192
+ if (dialogId && _optionalChain([flow, 'access', _8 => _8.dialogs, 'optionalAccess', _9 => _9[dialogId]])) {
222
193
  const config = flow.dialogs[dialogId];
223
- const autoClose = config.autoClose ?? "differentDialog";
194
+ const autoClose = _nullishCoalesce(config.autoClose, () => ( "differentDialog"));
224
195
  if (autoClose !== "never") {
225
196
  const controller = registry.getController(dialogId);
226
- controller?.close();
197
+ _optionalChain([controller, 'optionalAccess', _10 => _10.close, 'call', _11 => _11()]);
227
198
  }
228
199
  }
229
200
  previousDialogIdRef.current = void 0;
@@ -239,7 +210,7 @@ var useDialogAutomation = (params) => {
239
210
  unsubscribeComplete();
240
211
  };
241
212
  }, [events, flow, registry, onDialogNotMounted]);
242
- (0, import_react4.useEffect)(() => {
213
+ _react.useEffect.call(void 0, () => {
243
214
  if (!flow || !state || state.status !== "running") return;
244
215
  if (state.stepIndex < 0 || state.stepIndex >= flow.steps.length) return;
245
216
  const currentStep = flow.steps[state.stepIndex];
@@ -248,19 +219,19 @@ var useDialogAutomation = (params) => {
248
219
  };
249
220
 
250
221
  // src/motion/animationAdapter.tsx
251
- var import_react5 = require("motion/react");
252
- var import_react6 = require("react");
253
- var import_jsx_runtime2 = require("react/jsx-runtime");
222
+ var _react3 = require('motion/react');
223
+
224
+
254
225
  var defaultAdapter = {
255
226
  components: {
256
- MotionDiv: import_react5.motion.div,
257
- MotionSection: import_react5.motion.section,
258
- MotionSvg: import_react5.motion.svg,
259
- MotionDefs: import_react5.motion.defs,
260
- MotionMask: import_react5.motion.mask,
261
- MotionRect: import_react5.motion.rect,
262
- MotionSpan: import_react5.motion.span,
263
- MotionButton: import_react5.motion.button
227
+ MotionDiv: _react3.motion.div,
228
+ MotionSection: _react3.motion.section,
229
+ MotionSvg: _react3.motion.svg,
230
+ MotionDefs: _react3.motion.defs,
231
+ MotionMask: _react3.motion.mask,
232
+ MotionRect: _react3.motion.rect,
233
+ MotionSpan: _react3.motion.span,
234
+ MotionButton: _react3.motion.button
264
235
  },
265
236
  transitions: {
266
237
  overlayHighlight: {
@@ -293,16 +264,16 @@ var defaultAdapter = {
293
264
  }
294
265
  }
295
266
  };
296
- var AnimationAdapterContext = (0, import_react6.createContext)(defaultAdapter);
267
+ var AnimationAdapterContext = _react.createContext.call(void 0, defaultAdapter);
297
268
  var AnimationAdapterProvider = ({
298
269
  adapter,
299
270
  children
300
271
  }) => {
301
- const value = (0, import_react6.useMemo)(() => adapter ?? defaultAdapter, [adapter]);
302
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AnimationAdapterContext.Provider, { value, children });
272
+ const value = _react.useMemo.call(void 0, () => _nullishCoalesce(adapter, () => ( defaultAdapter)), [adapter]);
273
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimationAdapterContext.Provider, { value, children });
303
274
  };
304
275
  var useAnimationAdapter = () => {
305
- return (0, import_react6.useContext)(AnimationAdapterContext);
276
+ return _react.useContext.call(void 0, AnimationAdapterContext);
306
277
  };
307
278
  var defaultAnimationAdapter = defaultAdapter;
308
279
  var reducedMotionAnimationAdapter = {
@@ -341,12 +312,12 @@ var usePreferredAnimationAdapter = (options) => {
341
312
  defaultAdapter: defaultOption = defaultAnimationAdapter,
342
313
  reducedMotionAdapter: reducedOption = reducedMotionAnimationAdapter,
343
314
  enabled = true
344
- } = options ?? {};
345
- const [prefersReduced, setPrefersReduced] = (0, import_react6.useState)(() => {
315
+ } = _nullishCoalesce(options, () => ( {}));
316
+ const [prefersReduced, setPrefersReduced] = _react.useState.call(void 0, () => {
346
317
  if (!enabled || typeof window === "undefined") return false;
347
318
  return window.matchMedia(REDUCED_MOTION_QUERY).matches;
348
319
  });
349
- (0, import_react6.useEffect)(() => {
320
+ _react.useEffect.call(void 0, () => {
350
321
  if (!enabled || typeof window === "undefined") return;
351
322
  const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
352
323
  const handleChange = (event) => {
@@ -362,243 +333,13 @@ var usePreferredAnimationAdapter = (options) => {
362
333
  return prefersReduced ? reducedOption : defaultOption;
363
334
  };
364
335
 
365
- // src/utils/dom.ts
366
- var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
367
- var createRect = ({
368
- top,
369
- left,
370
- width,
371
- height
372
- }) => ({
373
- top,
374
- left,
375
- width,
376
- height,
377
- right: left + width,
378
- bottom: top + height
379
- });
380
- var toClientRect = (rect) => createRect({
381
- top: rect.top,
382
- left: rect.left,
383
- width: rect.width,
384
- height: rect.height
385
- });
386
- var getViewportRect = () => {
387
- if (!isBrowser) {
388
- return createRect({ top: 0, left: 0, width: 0, height: 0 });
389
- }
390
- const clientWidth = document.documentElement.clientWidth;
391
- const clientHeight = document.documentElement.clientHeight;
392
- const width = clientWidth > 0 ? clientWidth : window.innerWidth;
393
- const height = clientHeight > 0 ? clientHeight : window.innerHeight;
394
- return createRect({
395
- top: 0,
396
- left: 0,
397
- width,
398
- height
399
- });
400
- };
401
- var expandRect = (rect, padding) => {
402
- if (!isBrowser) return rect;
403
- const viewport = getViewportRect();
404
- const spaceTop = rect.top;
405
- const spaceBottom = viewport.height - rect.bottom;
406
- const spaceLeft = rect.left;
407
- const spaceRight = viewport.width - rect.right;
408
- const verticalPadding = Math.min(padding, spaceTop, spaceBottom);
409
- const horizontalPadding = Math.min(padding, spaceLeft, spaceRight);
410
- return createRect({
411
- top: rect.top - verticalPadding,
412
- left: rect.left - horizontalPadding,
413
- width: rect.width + horizontalPadding * 2,
414
- height: rect.height + verticalPadding * 2
415
- });
416
- };
417
- var getClientRect = (element) => toClientRect(element.getBoundingClientRect());
418
- var SCROLLABLE_OVERFLOW = /(auto|scroll|overlay)/i;
419
- var isElementScrollable = (node) => {
420
- if (!isBrowser) return false;
421
- const style = window.getComputedStyle(node);
422
- if (style.position === "fixed") return false;
423
- return SCROLLABLE_OVERFLOW.test(style.overflow) || SCROLLABLE_OVERFLOW.test(style.overflowX) || SCROLLABLE_OVERFLOW.test(style.overflowY);
424
- };
425
- var getScrollParents = (element) => {
426
- if (!isBrowser) return [];
427
- const parents = [];
428
- const seen = /* @__PURE__ */ new Set();
429
- let current = element.parentElement;
430
- while (current && current !== document.documentElement) {
431
- if (current !== document.body && isElementScrollable(current)) {
432
- if (!seen.has(current)) {
433
- parents.push(current);
434
- seen.add(current);
435
- }
436
- }
437
- current = current.parentElement;
438
- }
439
- const scrollingElement = document.scrollingElement;
440
- if (scrollingElement && scrollingElement instanceof Element && !seen.has(scrollingElement) && isElementScrollable(scrollingElement)) {
441
- parents.push(scrollingElement);
442
- seen.add(scrollingElement);
443
- }
444
- return parents;
445
- };
446
- var portalHost = () => isBrowser ? document.body : null;
447
- var cachedMaskSupport = null;
448
- var detectMaskSupport = () => {
449
- if (!isBrowser) return false;
450
- if ("CSS" in window) {
451
- try {
452
- if (window.CSS.supports("mask-image", "linear-gradient(#000,#000)")) {
453
- return true;
454
- }
455
- if (window.CSS.supports("-webkit-mask-image", "linear-gradient(#000,#000)")) {
456
- return true;
457
- }
458
- } catch (error) {
459
- if (typeof console !== "undefined") {
460
- console.warn("Flowsterix: CSS.supports check failed", error);
461
- }
462
- }
463
- }
464
- const probe = document.createElement("div");
465
- return "maskImage" in probe.style || "webkitMaskImage" in probe.style;
466
- };
467
- var supportsMasking = () => {
468
- if (!isBrowser) return false;
469
- if (cachedMaskSupport === null) {
470
- cachedMaskSupport = detectMaskSupport();
471
- }
472
- return cachedMaskSupport;
473
- };
474
-
475
- // src/router/routeGating.ts
476
- var DEFAULT_POLL_MS = 150;
477
- var normalizePathname = (pathname) => {
478
- if (typeof pathname !== "string" || pathname.length === 0) {
479
- return "/";
480
- }
481
- return pathname.startsWith("/") ? pathname : `/${pathname}`;
482
- };
483
- var normalizePrefixedSegment = (value, prefix) => {
484
- if (typeof value !== "string" || value.length === 0) {
485
- return "";
486
- }
487
- return value.startsWith(prefix) ? value : `${prefix}${value}`;
488
- };
489
- var getWindowPath = () => {
490
- if (!isBrowser) return "/";
491
- const { pathname, search, hash } = window.location;
492
- return normalizePathname(pathname) + normalizePrefixedSegment(search, "?") + normalizePrefixedSegment(hash, "#");
493
- };
494
- var normalizeExternalPath = (path) => {
495
- if (path.length === 0) {
496
- return "/";
497
- }
498
- try {
499
- const parsed = new URL(path, "http://flowsterix.local");
500
- return normalizePathname(parsed.pathname) + normalizePrefixedSegment(parsed.search, "?") + normalizePrefixedSegment(parsed.hash, "#");
501
- } catch {
502
- const [withoutHash, hash = ""] = path.split("#");
503
- const [base, search = ""] = withoutHash.split("?");
504
- return normalizePathname(base) + normalizePrefixedSegment(search ? `?${search}` : "", "?") + normalizePrefixedSegment(hash ? `#${hash}` : "", "#");
505
- }
506
- };
507
- var RouteGatingChannel = class {
508
- #listeners = /* @__PURE__ */ new Set();
509
- #currentPath = getWindowPath();
510
- #teardown = null;
511
- #attachDefaultListeners() {
512
- if (!isBrowser) return;
513
- if (this.#teardown) return;
514
- let lastPath = getWindowPath();
515
- const emitIfChanged = () => {
516
- const nextPath = getWindowPath();
517
- if (nextPath === lastPath) return;
518
- lastPath = nextPath;
519
- this.notify(nextPath);
520
- };
521
- const handler = () => emitIfChanged();
522
- window.addEventListener("popstate", handler);
523
- window.addEventListener("hashchange", handler);
524
- const pollId = window.setInterval(emitIfChanged, DEFAULT_POLL_MS);
525
- this.#teardown = () => {
526
- window.removeEventListener("popstate", handler);
527
- window.removeEventListener("hashchange", handler);
528
- window.clearInterval(pollId);
529
- this.#teardown = null;
530
- };
531
- }
532
- #detachDefaultListeners() {
533
- if (this.#listeners.size > 0) return;
534
- this.#teardown?.();
535
- this.#teardown = null;
536
- }
537
- getCurrentPath() {
538
- if (isBrowser) {
539
- this.#currentPath = getWindowPath();
540
- }
541
- return this.#currentPath;
542
- }
543
- notify(path) {
544
- const resolved = typeof path === "string" && path.length > 0 ? normalizeExternalPath(path) : this.getCurrentPath();
545
- if (resolved === this.#currentPath) {
546
- this.#currentPath = resolved;
547
- return;
548
- }
549
- this.#currentPath = resolved;
550
- for (const listener of Array.from(this.#listeners)) {
551
- try {
552
- listener(resolved);
553
- } catch (error) {
554
- console.warn("[tour][route-gating] listener error", error);
555
- }
556
- }
557
- }
558
- subscribe(listener) {
559
- if (this.#listeners.has(listener)) {
560
- return () => {
561
- this.#listeners.delete(listener);
562
- this.#detachDefaultListeners();
563
- };
564
- }
565
- this.#listeners.add(listener);
566
- if (this.#listeners.size === 1) {
567
- this.#attachDefaultListeners();
568
- }
569
- const current = this.getCurrentPath();
570
- try {
571
- listener(current);
572
- } catch (error) {
573
- console.warn("[tour][route-gating] listener error", error);
574
- }
575
- return () => {
576
- this.#listeners.delete(listener);
577
- this.#detachDefaultListeners();
578
- };
579
- }
580
- };
581
- var routeGatingChannel = new RouteGatingChannel();
582
- var getCurrentRoutePath = () => routeGatingChannel.getCurrentPath();
583
- var notifyRouteChange = (path) => {
584
- routeGatingChannel.notify(path);
585
- };
586
- var subscribeToRouteChanges = (listener) => {
587
- return routeGatingChannel.subscribe(listener);
588
- };
589
- var matchRoute = (params) => {
590
- const { pattern, path } = params;
591
- if (!pattern) return true;
592
- if (typeof pattern === "string") return path === pattern;
593
- return pattern.test(path);
594
- };
595
-
596
336
  // src/context.tsx
597
- var import_jsx_runtime3 = require("react/jsx-runtime");
598
- var TourContext = (0, import_react7.createContext)(void 0);
337
+
338
+ var DEVTOOLS_BRIDGE_KEY = "__FLOWSTERIX_DEVTOOLS_BRIDGE__";
339
+ var TourContext = _react.createContext.call(void 0, void 0);
599
340
  var DEFAULT_STORAGE_PREFIX = "tour";
600
341
  var useFlowMap = (flows) => {
601
- return (0, import_react7.useMemo)(() => {
342
+ return _react.useMemo.call(void 0, () => {
602
343
  const map = /* @__PURE__ */ new Map();
603
344
  for (const flow of flows) {
604
345
  map.set(flow.id, flow);
@@ -622,35 +363,35 @@ var TourProvider = ({
622
363
  labels: labelsProp,
623
364
  onVersionMismatch
624
365
  }) => {
625
- const mergedLabels = (0, import_react7.useMemo)(
366
+ const mergedLabels = _react.useMemo.call(void 0,
626
367
  () => ({ ...defaultLabels, ...labelsProp }),
627
368
  [labelsProp]
628
369
  );
629
370
  const flowMap = useFlowMap(flows);
630
- const storeRef = (0, import_react7.useRef)(null);
631
- const unsubscribeRef = (0, import_react7.useRef)(null);
632
- const stepHooksUnsubscribeRef = (0, import_react7.useRef)(null);
633
- const fallbackStorageRef = (0, import_react7.useRef)(void 0);
634
- const pendingResumeRef = (0, import_react7.useRef)(/* @__PURE__ */ new Set());
635
- const autoStartRequestedRef = (0, import_react7.useRef)(null);
636
- const [activeFlowId, setActiveFlowId] = (0, import_react7.useState)(null);
637
- const [state, setState] = (0, import_react7.useState)(null);
638
- const [events, setEvents] = (0, import_react7.useState)(
371
+ const storeRef = _react.useRef.call(void 0, null);
372
+ const unsubscribeRef = _react.useRef.call(void 0, null);
373
+ const stepHooksUnsubscribeRef = _react.useRef.call(void 0, null);
374
+ const fallbackStorageRef = _react.useRef.call(void 0, void 0);
375
+ const pendingResumeRef = _react.useRef.call(void 0, /* @__PURE__ */ new Set());
376
+ const autoStartRequestedRef = _react.useRef.call(void 0, null);
377
+ const [activeFlowId, setActiveFlowId] = _react.useState.call(void 0, null);
378
+ const [state, setState] = _react.useState.call(void 0, null);
379
+ const [events, setEvents] = _react.useState.call(void 0,
639
380
  null
640
381
  );
641
- const [debugEnabled, setDebugEnabled] = (0, import_react7.useState)(defaultDebug);
642
- const [delayInfo, setDelayInfo] = (0, import_react7.useState)(null);
643
- const teardownStore = (0, import_react7.useCallback)(() => {
644
- unsubscribeRef.current?.();
382
+ const [debugEnabled, setDebugEnabled] = _react.useState.call(void 0, defaultDebug);
383
+ const [delayInfo, setDelayInfo] = _react.useState.call(void 0, null);
384
+ const teardownStore = _react.useCallback.call(void 0, () => {
385
+ _optionalChain([unsubscribeRef, 'access', _12 => _12.current, 'optionalCall', _13 => _13()]);
645
386
  unsubscribeRef.current = null;
646
- stepHooksUnsubscribeRef.current?.();
387
+ _optionalChain([stepHooksUnsubscribeRef, 'access', _14 => _14.current, 'optionalCall', _15 => _15()]);
647
388
  stepHooksUnsubscribeRef.current = null;
648
- storeRef.current?.destroy();
389
+ _optionalChain([storeRef, 'access', _16 => _16.current, 'optionalAccess', _17 => _17.destroy, 'call', _18 => _18()]);
649
390
  storeRef.current = null;
650
391
  setDelayInfo(null);
651
392
  pendingResumeRef.current.clear();
652
393
  }, []);
653
- (0, import_react7.useEffect)(() => {
394
+ _react.useEffect.call(void 0, () => {
654
395
  return () => {
655
396
  teardownStore();
656
397
  setState(null);
@@ -658,7 +399,7 @@ var TourProvider = ({
658
399
  setActiveFlowId(null);
659
400
  };
660
401
  }, [teardownStore]);
661
- (0, import_react7.useEffect)(() => {
402
+ _react.useEffect.call(void 0, () => {
662
403
  if (!activeFlowId) return;
663
404
  const definition = flowMap.get(activeFlowId);
664
405
  if (!definition) {
@@ -681,7 +422,7 @@ var TourProvider = ({
681
422
  console.warn(`[tour][step] ${phase} hook failed`, error);
682
423
  }
683
424
  };
684
- const ensureStore = (0, import_react7.useCallback)(
425
+ const ensureStore = _react.useCallback.call(void 0,
685
426
  (flowId) => {
686
427
  const existing = storeRef.current;
687
428
  if (existing && existing.definition.id === flowId) {
@@ -692,11 +433,11 @@ var TourProvider = ({
692
433
  if (!definition) {
693
434
  throw new Error(`Flow with id "${flowId}" is not registered.`);
694
435
  }
695
- if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
696
- fallbackStorageRef.current = (0, import_core.createLocalStorageAdapter)();
436
+ if (!storageAdapter && !fallbackStorageRef.current && _chunkD5LQLRSUcjs.isBrowser) {
437
+ fallbackStorageRef.current = _core.createLocalStorageAdapter.call(void 0, );
697
438
  }
698
439
  const resolvedStorageAdapter2 = storageAdapter ? storageAdapter : fallbackStorageRef.current;
699
- const store = (0, import_core.createFlowStore)(definition, {
440
+ const store = _core.createFlowStore.call(void 0, definition, {
700
441
  storageAdapter: resolvedStorageAdapter2,
701
442
  storageKey: storageNamespace ? `${storageNamespace}:${definition.id}` : void 0,
702
443
  persistOnChange,
@@ -740,7 +481,7 @@ var TourProvider = ({
740
481
  teardownStore
741
482
  ]
742
483
  );
743
- const getActiveStore = (0, import_react7.useCallback)(() => {
484
+ const getActiveStore = _react.useCallback.call(void 0, () => {
744
485
  const store = storeRef.current;
745
486
  if (!store) {
746
487
  throw new Error(
@@ -752,7 +493,7 @@ var TourProvider = ({
752
493
  const isPromiseLike2 = (value) => {
753
494
  return typeof value === "object" && value !== null && typeof value.then === "function";
754
495
  };
755
- const invokeStepHook = (0, import_react7.useCallback)(
496
+ const invokeStepHook = _react.useCallback.call(void 0,
756
497
  async (hook, context, phase) => {
757
498
  if (!hook) return;
758
499
  try {
@@ -766,7 +507,7 @@ var TourProvider = ({
766
507
  },
767
508
  []
768
509
  );
769
- const runResumeHooks = (0, import_react7.useCallback)(
510
+ const runResumeHooks = _react.useCallback.call(void 0,
770
511
  async (definition, flowState, strategy) => {
771
512
  if (flowState.status !== "running") return;
772
513
  if (strategy === "current") {
@@ -806,25 +547,25 @@ var TourProvider = ({
806
547
  },
807
548
  [invokeStepHook]
808
549
  );
809
- const resolveResumeStrategy = (0, import_react7.useCallback)(
550
+ const resolveResumeStrategy = _react.useCallback.call(void 0,
810
551
  (definition, options) => {
811
- return options?.resumeStrategy ?? definition.resumeStrategy ?? "chain";
552
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.resumeStrategy]), () => ( definition.resumeStrategy)), () => ( "chain"));
812
553
  },
813
554
  []
814
555
  );
815
- const startFlow = (0, import_react7.useCallback)(
556
+ const startFlow = _react.useCallback.call(void 0,
816
557
  (flowId, options) => {
817
558
  const store = ensureStore(flowId);
818
559
  const previousState = store.getState();
819
560
  setActiveFlowId(flowId);
820
- if (options?.resume) {
561
+ if (_optionalChain([options, 'optionalAccess', _20 => _20.resume])) {
821
562
  pendingResumeRef.current.add(flowId);
822
563
  } else {
823
564
  pendingResumeRef.current.delete(flowId);
824
565
  }
825
566
  const result = store.start(options);
826
567
  const nextState = store.getState();
827
- if (!options?.resume) {
568
+ if (!_optionalChain([options, 'optionalAccess', _21 => _21.resume])) {
828
569
  return result;
829
570
  }
830
571
  if (previousState.stepIndex >= 0 && nextState.status === "running") {
@@ -841,17 +582,17 @@ var TourProvider = ({
841
582
  },
842
583
  [ensureStore, resolveResumeStrategy, runResumeHooks]
843
584
  );
844
- const [eligibleFlows, setEligibleFlows] = (0, import_react7.useState)([]);
845
- (0, import_react7.useEffect)(() => {
585
+ const [eligibleFlows, setEligibleFlows] = _react.useState.call(void 0, []);
586
+ _react.useEffect.call(void 0, () => {
846
587
  const autoStartFlows = flows.filter((f) => f.autoStart);
847
588
  if (autoStartFlows.length === 0) {
848
589
  setEligibleFlows([]);
849
590
  return;
850
591
  }
851
- if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
852
- fallbackStorageRef.current = (0, import_core.createLocalStorageAdapter)();
592
+ if (!storageAdapter && !fallbackStorageRef.current && _chunkD5LQLRSUcjs.isBrowser) {
593
+ fallbackStorageRef.current = _core.createLocalStorageAdapter.call(void 0, );
853
594
  }
854
- const resolvedStorageAdapter2 = storageAdapter ?? fallbackStorageRef.current;
595
+ const resolvedStorageAdapter2 = _nullishCoalesce(storageAdapter, () => ( fallbackStorageRef.current));
855
596
  if (!resolvedStorageAdapter2) {
856
597
  setEligibleFlows(
857
598
  autoStartFlows.map((flow) => ({
@@ -869,7 +610,7 @@ var TourProvider = ({
869
610
  );
870
611
  const snapshots = await Promise.all(
871
612
  storageKeys.map(
872
- (key) => (0, import_core.resolveMaybePromise)(resolvedStorageAdapter2.get(key))
613
+ (key) => _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter2.get(key))
873
614
  )
874
615
  );
875
616
  if (cancelled) return;
@@ -881,10 +622,10 @@ var TourProvider = ({
881
622
  eligible.push({ flow, resolvedState: null, stepIndex: 0 });
882
623
  continue;
883
624
  }
884
- const storedVersionStr = typeof snapshot.version === "number" ? (0, import_core.serializeVersion)({ major: snapshot.version, minor: 0 }) : snapshot.version;
885
- const storedVersion = (0, import_core.parseVersion)(storedVersionStr);
886
- const stepIdMap = (0, import_core.buildStepIdMap)(flow);
887
- const { state: resolvedState } = (0, import_core.handleVersionMismatch)({
625
+ const storedVersionStr = typeof snapshot.version === "number" ? _core.serializeVersion.call(void 0, { major: snapshot.version, minor: 0 }) : snapshot.version;
626
+ const storedVersion = _core.parseVersion.call(void 0, storedVersionStr);
627
+ const stepIdMap = _core.buildStepIdMap.call(void 0, flow);
628
+ const { state: resolvedState } = _core.handleVersionMismatch.call(void 0, {
888
629
  storedState: snapshot.value,
889
630
  storedVersion,
890
631
  definition: flow,
@@ -906,7 +647,7 @@ var TourProvider = ({
906
647
  cancelled = true;
907
648
  };
908
649
  }, [flows, storageAdapter, storageNamespace]);
909
- (0, import_react7.useEffect)(() => {
650
+ _react.useEffect.call(void 0, () => {
910
651
  if (eligibleFlows.length === 0) {
911
652
  autoStartRequestedRef.current = null;
912
653
  return;
@@ -915,7 +656,7 @@ var TourProvider = ({
915
656
  const findMatchingFlow = (path) => {
916
657
  for (const { flow, stepIndex } of eligibleFlows) {
917
658
  const step = flow.steps[stepIndex];
918
- if (!step.route || matchRoute({ pattern: step.route, path })) {
659
+ if (!step.route || _chunkD5LQLRSUcjs.matchRoute.call(void 0, { pattern: step.route, path })) {
919
660
  return flow;
920
661
  }
921
662
  }
@@ -929,9 +670,9 @@ var TourProvider = ({
929
670
  startFlow(flow.id, { resume: true });
930
671
  }
931
672
  };
932
- const currentPath = getCurrentRoutePath();
673
+ const currentPath = _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, );
933
674
  tryStart(currentPath);
934
- const unsubscribe = subscribeToRouteChanges((path) => {
675
+ const unsubscribe = _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
935
676
  tryStart(path);
936
677
  });
937
678
  return () => {
@@ -941,14 +682,14 @@ var TourProvider = ({
941
682
  }
942
683
  };
943
684
  }, [activeFlowId, eligibleFlows, startFlow]);
944
- const next = (0, import_react7.useCallback)(() => getActiveStore().next(), [getActiveStore]);
945
- const back = (0, import_react7.useCallback)(() => getActiveStore().back(), [getActiveStore]);
946
- const goToStep = (0, import_react7.useCallback)(
685
+ const next = _react.useCallback.call(void 0, () => getActiveStore().next(), [getActiveStore]);
686
+ const back = _react.useCallback.call(void 0, () => getActiveStore().back(), [getActiveStore]);
687
+ const goToStep = _react.useCallback.call(void 0,
947
688
  (step) => getActiveStore().goToStep(step),
948
689
  [getActiveStore]
949
690
  );
950
- const pause = (0, import_react7.useCallback)(() => getActiveStore().pause(), [getActiveStore]);
951
- const resume = (0, import_react7.useCallback)(() => {
691
+ const pause = _react.useCallback.call(void 0, () => getActiveStore().pause(), [getActiveStore]);
692
+ const resume = _react.useCallback.call(void 0, () => {
952
693
  const store = getActiveStore();
953
694
  const previousState = store.getState();
954
695
  if (previousState.status === "paused") {
@@ -966,31 +707,31 @@ var TourProvider = ({
966
707
  }
967
708
  return result;
968
709
  }, [getActiveStore, resolveResumeStrategy, runResumeHooks]);
969
- const cancel = (0, import_react7.useCallback)(
710
+ const cancel = _react.useCallback.call(void 0,
970
711
  (reason) => getActiveStore().cancel(reason),
971
712
  [getActiveStore]
972
713
  );
973
- const complete = (0, import_react7.useCallback)(
714
+ const complete = _react.useCallback.call(void 0,
974
715
  () => getActiveStore().complete(),
975
716
  [getActiveStore]
976
717
  );
977
- const advanceStep = (0, import_react7.useCallback)(
718
+ const advanceStep = _react.useCallback.call(void 0,
978
719
  (stepId) => getActiveStore().advanceStep(stepId),
979
720
  [getActiveStore]
980
721
  );
981
- const toggleDebug = (0, import_react7.useCallback)(() => {
722
+ const toggleDebug = _react.useCallback.call(void 0, () => {
982
723
  setDebugEnabled((previous) => !previous);
983
724
  }, []);
984
- const activeStep = (0, import_react7.useMemo)(() => {
725
+ const activeStep = _react.useMemo.call(void 0, () => {
985
726
  if (!state || !storeRef.current) return null;
986
727
  if (state.stepIndex < 0) return null;
987
- return storeRef.current.definition.steps[state.stepIndex] ?? null;
728
+ return _nullishCoalesce(storeRef.current.definition.steps[state.stepIndex], () => ( null));
988
729
  }, [state]);
989
- const activeDialogConfig = (0, import_react7.useMemo)(() => {
990
- if (!activeStep?.dialogId || !storeRef.current) return void 0;
991
- return storeRef.current.definition.dialogs?.[activeStep.dialogId];
730
+ const activeDialogConfig = _react.useMemo.call(void 0, () => {
731
+ if (!_optionalChain([activeStep, 'optionalAccess', _22 => _22.dialogId]) || !storeRef.current) return void 0;
732
+ return _optionalChain([storeRef, 'access', _23 => _23.current, 'access', _24 => _24.definition, 'access', _25 => _25.dialogs, 'optionalAccess', _26 => _26[activeStep.dialogId]]);
992
733
  }, [activeStep]);
993
- (0, import_react7.useEffect)(() => {
734
+ _react.useEffect.call(void 0, () => {
994
735
  if (!activeFlowId) return;
995
736
  if (!pendingResumeRef.current.has(activeFlowId)) return;
996
737
  if (!state || state.status !== "running") return;
@@ -1005,7 +746,49 @@ var TourProvider = ({
1005
746
  pendingResumeRef.current.delete(activeFlowId);
1006
747
  void runResumeHooks(definition, state, resumeStrategy);
1007
748
  }, [activeFlowId, flowMap, resolveResumeStrategy, runResumeHooks, state]);
1008
- const contextValue = (0, import_react7.useMemo)(
749
+ const resolvedStorageAdapter = _react.useMemo.call(void 0, () => {
750
+ if (storageAdapter) return storageAdapter;
751
+ return _nullishCoalesce(fallbackStorageRef.current, () => ( null));
752
+ }, [storageAdapter]);
753
+ const getStorageKey = _react.useCallback.call(void 0,
754
+ (flowId) => storageNamespace ? `${storageNamespace}:${flowId}` : `${DEFAULT_STORAGE_PREFIX}:${flowId}`,
755
+ [storageNamespace]
756
+ );
757
+ const getFlowState = _react.useCallback.call(void 0,
758
+ async (flowId) => {
759
+ if (!resolvedStorageAdapter) return null;
760
+ const key = getStorageKey(flowId);
761
+ const snapshot = await _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter.get(key));
762
+ if (!snapshot) return null;
763
+ return snapshot.value;
764
+ },
765
+ [resolvedStorageAdapter, getStorageKey]
766
+ );
767
+ const deleteFlowStorage = _react.useCallback.call(void 0,
768
+ async (flowId) => {
769
+ if (!resolvedStorageAdapter) return;
770
+ const key = getStorageKey(flowId);
771
+ await _core.resolveMaybePromise.call(void 0, resolvedStorageAdapter.remove(key));
772
+ },
773
+ [resolvedStorageAdapter, getStorageKey]
774
+ );
775
+ const updateFlowStorage = _react.useCallback.call(void 0,
776
+ async (flowId, newState) => {
777
+ if (!resolvedStorageAdapter) return;
778
+ const key = getStorageKey(flowId);
779
+ const definition = flowMap.get(flowId);
780
+ if (!definition) return;
781
+ await _core.resolveMaybePromise.call(void 0,
782
+ resolvedStorageAdapter.set(key, {
783
+ version: newState.version,
784
+ value: newState,
785
+ updatedAt: Date.now()
786
+ })
787
+ );
788
+ },
789
+ [resolvedStorageAdapter, getStorageKey, flowMap]
790
+ );
791
+ const contextValue = _react.useMemo.call(void 0,
1009
792
  () => ({
1010
793
  flows: flowMap,
1011
794
  activeFlowId,
@@ -1028,7 +811,10 @@ var TourProvider = ({
1028
811
  delayInfo,
1029
812
  setDelayInfo,
1030
813
  backdropInteraction: backdropInteractionProp,
1031
- lockBodyScroll: lockBodyScrollProp
814
+ lockBodyScroll: lockBodyScrollProp,
815
+ getFlowState,
816
+ deleteFlowStorage,
817
+ updateFlowStorage
1032
818
  }),
1033
819
  [
1034
820
  activeFlowId,
@@ -1052,7 +838,10 @@ var TourProvider = ({
1052
838
  state,
1053
839
  toggleDebug,
1054
840
  backdropInteractionProp,
1055
- lockBodyScrollProp
841
+ lockBodyScrollProp,
842
+ getFlowState,
843
+ deleteFlowStorage,
844
+ updateFlowStorage
1056
845
  ]
1057
846
  );
1058
847
  const resolvedAnimationAdapter = usePreferredAnimationAdapter({
@@ -1060,60 +849,71 @@ var TourProvider = ({
1060
849
  reducedMotionAdapter,
1061
850
  enabled: autoDetectReducedMotion
1062
851
  });
1063
- const resolvedStorageAdapter = (0, import_react7.useMemo)(() => {
1064
- if (storageAdapter) return storageAdapter;
1065
- return fallbackStorageRef.current ?? null;
1066
- }, [storageAdapter]);
1067
- const devToolsContextValue = (0, import_react7.useMemo)(() => {
1068
- const getStorageKey = (flowId) => storageNamespace ? `${storageNamespace}:${flowId}` : `${DEFAULT_STORAGE_PREFIX}:${flowId}`;
852
+ const devToolsContextValue = _react.useMemo.call(void 0, () => {
1069
853
  return {
1070
854
  flows: flowMap,
1071
855
  activeFlowId,
1072
856
  state,
1073
857
  storageAdapter: resolvedStorageAdapter,
1074
- storageNamespace: storageNamespace ?? DEFAULT_STORAGE_PREFIX,
858
+ storageNamespace: _nullishCoalesce(storageNamespace, () => ( DEFAULT_STORAGE_PREFIX)),
1075
859
  cancelFlow: (flowId) => {
1076
860
  if (activeFlowId === flowId && storeRef.current) {
1077
861
  storeRef.current.cancel();
1078
862
  }
1079
863
  },
1080
- deleteFlowStorage: async (flowId) => {
1081
- if (!resolvedStorageAdapter) return;
1082
- const key = getStorageKey(flowId);
1083
- await (0, import_core.resolveMaybePromise)(resolvedStorageAdapter.remove(key));
1084
- },
1085
- updateFlowStorage: async (flowId, newState) => {
1086
- if (!resolvedStorageAdapter) return;
1087
- const key = getStorageKey(flowId);
1088
- const definition = flowMap.get(flowId);
1089
- if (!definition) return;
1090
- await (0, import_core.resolveMaybePromise)(
1091
- resolvedStorageAdapter.set(key, {
1092
- version: newState.version,
1093
- value: newState,
1094
- updatedAt: Date.now()
1095
- })
1096
- );
1097
- },
1098
- getFlowState: async (flowId) => {
1099
- if (!resolvedStorageAdapter) return null;
1100
- const key = getStorageKey(flowId);
1101
- const snapshot = await (0, import_core.resolveMaybePromise)(
1102
- resolvedStorageAdapter.get(key)
1103
- );
1104
- if (!snapshot) return null;
1105
- return snapshot.value;
1106
- }
864
+ deleteFlowStorage,
865
+ updateFlowStorage,
866
+ getFlowState
1107
867
  };
1108
868
  }, [
1109
869
  flowMap,
1110
870
  activeFlowId,
1111
871
  state,
1112
872
  resolvedStorageAdapter,
1113
- storageNamespace
873
+ storageNamespace,
874
+ deleteFlowStorage,
875
+ updateFlowStorage,
876
+ getFlowState
1114
877
  ]);
1115
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogRegistryProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TourContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DevToolsContext.Provider, { value: devToolsContextValue, children: [
1116
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
878
+ _react.useEffect.call(void 0, () => {
879
+ if (typeof window === "undefined") return;
880
+ const bridgeValue = {
881
+ flows: flowMap,
882
+ activeFlowId,
883
+ state,
884
+ cancel: () => {
885
+ if (storeRef.current) {
886
+ storeRef.current.cancel();
887
+ }
888
+ },
889
+ getFlowState,
890
+ deleteFlowStorage,
891
+ updateFlowStorage
892
+ };
893
+ const w = window;
894
+ if (!w[DEVTOOLS_BRIDGE_KEY]) {
895
+ w[DEVTOOLS_BRIDGE_KEY] = { value: null, listeners: /* @__PURE__ */ new Set() };
896
+ }
897
+ const bridge = w[DEVTOOLS_BRIDGE_KEY];
898
+ bridge.value = bridgeValue;
899
+ for (const listener of bridge.listeners) {
900
+ listener(bridgeValue);
901
+ }
902
+ }, [flowMap, activeFlowId, state, getFlowState, deleteFlowStorage, updateFlowStorage]);
903
+ _react.useEffect.call(void 0, () => {
904
+ return () => {
905
+ if (typeof window === "undefined") return;
906
+ const w = window;
907
+ if (w[DEVTOOLS_BRIDGE_KEY]) {
908
+ w[DEVTOOLS_BRIDGE_KEY].value = null;
909
+ for (const listener of w[DEVTOOLS_BRIDGE_KEY].listeners) {
910
+ listener(null);
911
+ }
912
+ }
913
+ };
914
+ }, []);
915
+ 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: [
916
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1117
917
  DialogAutomationBridge,
1118
918
  {
1119
919
  flow: activeFlowId ? flowMap.get(activeFlowId) : void 0,
@@ -1146,7 +946,7 @@ var DialogAutomationBridge = ({
1146
946
  return null;
1147
947
  };
1148
948
  var useTour = () => {
1149
- const context = (0, import_react7.useContext)(TourContext);
949
+ const context = _react.useContext.call(void 0, TourContext);
1150
950
  if (!context) {
1151
951
  throw new Error("useTour must be used within a TourProvider");
1152
952
  }
@@ -1154,14 +954,14 @@ var useTour = () => {
1154
954
  };
1155
955
  var useTourEvents = (event, handler) => {
1156
956
  const { events } = useTour();
1157
- (0, import_react7.useEffect)(() => {
957
+ _react.useEffect.call(void 0, () => {
1158
958
  if (!events) return;
1159
959
  return events.on(event, handler);
1160
960
  }, [event, events, handler]);
1161
961
  };
1162
962
 
1163
963
  // src/hooks/useTourTarget.ts
1164
- var import_react8 = require("react");
964
+
1165
965
 
1166
966
  // src/hooks/scrollMargin.ts
1167
967
  var DEFAULT_SCROLL_MARGIN = 16;
@@ -1182,10 +982,10 @@ var resolveScrollMargin = (margin, fallback = DEFAULT_SCROLL_MARGIN) => {
1182
982
  };
1183
983
  }
1184
984
  return {
1185
- top: sanitize(margin?.top, fallback),
1186
- bottom: sanitize(margin?.bottom, fallback),
1187
- left: sanitize(margin?.left, fallback),
1188
- right: sanitize(margin?.right, fallback)
985
+ top: sanitize(_optionalChain([margin, 'optionalAccess', _27 => _27.top]), fallback),
986
+ bottom: sanitize(_optionalChain([margin, 'optionalAccess', _28 => _28.bottom]), fallback),
987
+ left: sanitize(_optionalChain([margin, 'optionalAccess', _29 => _29.left]), fallback),
988
+ right: sanitize(_optionalChain([margin, 'optionalAccess', _30 => _30.right]), fallback)
1189
989
  };
1190
990
  };
1191
991
 
@@ -1204,8 +1004,8 @@ var createWaitForPredicateController = ({
1204
1004
  onChange,
1205
1005
  warn = defaultWarn
1206
1006
  }) => {
1207
- const hasPredicate = Boolean(waitFor?.predicate && context);
1208
- const hasSubscription = Boolean(waitFor?.subscribe && context);
1007
+ const hasPredicate = Boolean(_optionalChain([waitFor, 'optionalAccess', _31 => _31.predicate]) && context);
1008
+ const hasSubscription = Boolean(_optionalChain([waitFor, 'optionalAccess', _32 => _32.subscribe]) && context);
1209
1009
  let satisfied = !hasPredicate && !hasSubscription;
1210
1010
  let destroyed = false;
1211
1011
  let pollId = null;
@@ -1215,10 +1015,10 @@ var createWaitForPredicateController = ({
1215
1015
  const normalized = Boolean(nextValue);
1216
1016
  if (satisfied === normalized) return;
1217
1017
  satisfied = normalized;
1218
- onChange?.(satisfied);
1018
+ _optionalChain([onChange, 'optionalCall', _33 => _33(satisfied)]);
1219
1019
  };
1220
1020
  const evaluate = () => {
1221
- if (!waitFor?.predicate || !context || destroyed) {
1021
+ if (!_optionalChain([waitFor, 'optionalAccess', _34 => _34.predicate]) || !context || destroyed) {
1222
1022
  return;
1223
1023
  }
1224
1024
  const checkId = ++lastCheckId;
@@ -1247,7 +1047,7 @@ var createWaitForPredicateController = ({
1247
1047
  update(Boolean(result));
1248
1048
  };
1249
1049
  const attachSubscription = () => {
1250
- if (!waitFor?.subscribe || !context) return;
1050
+ if (!_optionalChain([waitFor, 'optionalAccess', _35 => _35.subscribe]) || !context) return;
1251
1051
  try {
1252
1052
  const cleanup = waitFor.subscribe({
1253
1053
  ...context,
@@ -1271,9 +1071,9 @@ var createWaitForPredicateController = ({
1271
1071
  destroyed = false;
1272
1072
  satisfied = !hasPredicate && !hasSubscription;
1273
1073
  lastCheckId = 0;
1274
- if (waitFor?.predicate && context) {
1074
+ if (_optionalChain([waitFor, 'optionalAccess', _36 => _36.predicate]) && context) {
1275
1075
  evaluate();
1276
- const pollMs = Math.max(0, waitFor.pollMs ?? 200);
1076
+ const pollMs = Math.max(0, _nullishCoalesce(waitFor.pollMs, () => ( 200)));
1277
1077
  if (pollMs > 0) {
1278
1078
  pollId = window.setInterval(evaluate, pollMs);
1279
1079
  }
@@ -1333,7 +1133,7 @@ var computeRectSource = (rect, storedRect, isScreen) => {
1333
1133
  return "none";
1334
1134
  };
1335
1135
  var computeVisibilityState = (element, rect, isScreen) => {
1336
- if (!isBrowser) return "unknown";
1136
+ if (!_chunkD5LQLRSUcjs.isBrowser) return "unknown";
1337
1137
  if (isScreen) return "visible";
1338
1138
  if (!element) return "missing";
1339
1139
  if (!document.documentElement.contains(element)) return "detached";
@@ -1349,7 +1149,7 @@ var computeVisibilityState = (element, rect, isScreen) => {
1349
1149
  return "visible";
1350
1150
  };
1351
1151
  var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1352
- if (!isBrowser) return;
1152
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1353
1153
  if (Math.abs(topDelta) < 0.5 && Math.abs(leftDelta) < 0.5) {
1354
1154
  return;
1355
1155
  }
@@ -1358,7 +1158,7 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1358
1158
  window.scrollBy({
1359
1159
  top: topDelta,
1360
1160
  left: leftDelta,
1361
- behavior: behavior ?? "auto"
1161
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1362
1162
  });
1363
1163
  return;
1364
1164
  }
@@ -1367,7 +1167,7 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1367
1167
  elementContainer.scrollBy({
1368
1168
  top: topDelta,
1369
1169
  left: leftDelta,
1370
- behavior: behavior ?? "auto"
1170
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1371
1171
  });
1372
1172
  return;
1373
1173
  }
@@ -1376,8 +1176,8 @@ var scrollContainerBy = (container, topDelta, leftDelta, behavior) => {
1376
1176
  };
1377
1177
  var alignWithinViewport = (element, margin, behavior, mode) => {
1378
1178
  if (mode === "preserve") return;
1379
- const viewportRect = getViewportRect();
1380
- const finalRect = getClientRect(element);
1179
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1180
+ const finalRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1381
1181
  const availableHeight = viewportRect.height - (margin.top + margin.bottom);
1382
1182
  if (availableHeight <= 0) return;
1383
1183
  const desiredTop = mode === "center" ? margin.top + (availableHeight - finalRect.height) / 2 : margin.top;
@@ -1385,21 +1185,21 @@ var alignWithinViewport = (element, margin, behavior, mode) => {
1385
1185
  if (Math.abs(delta) < 0.5) return;
1386
1186
  window.scrollBy({
1387
1187
  top: delta,
1388
- behavior: behavior ?? "auto"
1188
+ behavior: _nullishCoalesce(behavior, () => ( "auto"))
1389
1189
  });
1390
1190
  };
1391
1191
  var ensureElementInView = (element, margin, options) => {
1392
- const behavior = options?.behavior ?? "auto";
1393
- const mode = options?.mode ?? "preserve";
1394
- if (!isBrowser) return;
1395
- const scrollParents = getScrollParents(element);
1192
+ const behavior = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _37 => _37.behavior]), () => ( "auto"));
1193
+ const mode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.mode]), () => ( "preserve"));
1194
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1195
+ const scrollParents = _chunkD5LQLRSUcjs.getScrollParents.call(void 0, element);
1396
1196
  const rootScroller = document.scrollingElement;
1397
1197
  if (rootScroller && !scrollParents.includes(rootScroller)) {
1398
1198
  scrollParents.push(rootScroller);
1399
1199
  }
1400
1200
  for (const container of scrollParents) {
1401
- const containerRect = container === rootScroller || container === document.body || container === document.documentElement ? getViewportRect() : getClientRect(container);
1402
- const targetRect = getClientRect(element);
1201
+ const containerRect = container === rootScroller || container === document.body || container === document.documentElement ? _chunkD5LQLRSUcjs.getViewportRect.call(void 0, ) : _chunkD5LQLRSUcjs.getClientRect.call(void 0, container);
1202
+ const targetRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1403
1203
  let topDelta = 0;
1404
1204
  if (targetRect.top < containerRect.top + margin.top) {
1405
1205
  topDelta = targetRect.top - (containerRect.top + margin.top);
@@ -1416,8 +1216,8 @@ var ensureElementInView = (element, margin, options) => {
1416
1216
  scrollContainerBy(container, topDelta, leftDelta, behavior);
1417
1217
  }
1418
1218
  }
1419
- const viewportRect = getViewportRect();
1420
- const finalRect = getClientRect(element);
1219
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1220
+ const finalRect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1421
1221
  let viewportTopDelta = 0;
1422
1222
  if (finalRect.top < viewportRect.top + margin.top) {
1423
1223
  viewportTopDelta = finalRect.top - (viewportRect.top + margin.top);
@@ -1440,7 +1240,7 @@ var ensureElementInView = (element, margin, options) => {
1440
1240
  alignWithinViewport(element, margin, behavior, mode);
1441
1241
  };
1442
1242
  var resolveStepTarget = (target) => {
1443
- if (!isBrowser) return null;
1243
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
1444
1244
  if (target === "screen") {
1445
1245
  return document.body;
1446
1246
  }
@@ -1450,13 +1250,13 @@ var resolveStepTarget = (target) => {
1450
1250
  if (node) {
1451
1251
  return node;
1452
1252
  }
1453
- } catch {
1253
+ } catch (e) {
1454
1254
  }
1455
1255
  }
1456
1256
  if (target.selector) {
1457
1257
  try {
1458
1258
  return document.querySelector(target.selector);
1459
- } catch {
1259
+ } catch (e2) {
1460
1260
  return null;
1461
1261
  }
1462
1262
  }
@@ -1464,14 +1264,14 @@ var resolveStepTarget = (target) => {
1464
1264
  };
1465
1265
  var useTourTarget = () => {
1466
1266
  const { activeStep, state, activeFlowId, flows } = useTour();
1467
- const [targetInfo, setTargetInfo] = (0, import_react8.useState)(INITIAL_TARGET_INFO);
1468
- const autoScrollStateRef = (0, import_react8.useRef)({ stepId: null, checks: 0, stalledChecks: 0, done: false, lastRect: null });
1469
- const autoScrollRafRef = (0, import_react8.useRef)(null);
1470
- const autoScrollTimeoutRef = (0, import_react8.useRef)(null);
1471
- const lastRectRef = (0, import_react8.useRef)(null);
1472
- const initialScrollStepRef = (0, import_react8.useRef)(null);
1267
+ const [targetInfo, setTargetInfo] = _react.useState.call(void 0, INITIAL_TARGET_INFO);
1268
+ const autoScrollStateRef = _react.useRef.call(void 0, { stepId: null, checks: 0, stalledChecks: 0, done: false, lastRect: null });
1269
+ const autoScrollRafRef = _react.useRef.call(void 0, null);
1270
+ const autoScrollTimeoutRef = _react.useRef.call(void 0, null);
1271
+ const lastRectRef = _react.useRef.call(void 0, null);
1272
+ const initialScrollStepRef = _react.useRef.call(void 0, null);
1473
1273
  const cancelAutoScrollLoop = () => {
1474
- if (!isBrowser) return;
1274
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1475
1275
  if (autoScrollTimeoutRef.current !== null) {
1476
1276
  globalThis.clearTimeout(autoScrollTimeoutRef.current);
1477
1277
  autoScrollTimeoutRef.current = null;
@@ -1481,16 +1281,16 @@ var useTourTarget = () => {
1481
1281
  autoScrollRafRef.current = null;
1482
1282
  }
1483
1283
  };
1484
- (0, import_react8.useEffect)(() => {
1284
+ _react.useEffect.call(void 0, () => {
1485
1285
  if (!activeStep) {
1486
1286
  initialScrollStepRef.current = null;
1487
1287
  }
1488
1288
  return () => {
1489
1289
  initialScrollStepRef.current = null;
1490
1290
  };
1491
- }, [activeStep?.id]);
1492
- (0, import_react8.useLayoutEffect)(() => {
1493
- if (!isBrowser) return;
1291
+ }, [_optionalChain([activeStep, 'optionalAccess', _39 => _39.id])]);
1292
+ _react.useLayoutEffect.call(void 0, () => {
1293
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1494
1294
  if (!activeStep) return;
1495
1295
  if (targetInfo.status !== "ready") return;
1496
1296
  if (targetInfo.isScreen) return;
@@ -1500,10 +1300,10 @@ var useTourTarget = () => {
1500
1300
  }
1501
1301
  initialScrollStepRef.current = activeStep.id;
1502
1302
  const margin = resolveScrollMargin(
1503
- activeStep.targetBehavior?.scrollMargin,
1303
+ _optionalChain([activeStep, 'access', _40 => _40.targetBehavior, 'optionalAccess', _41 => _41.scrollMargin]),
1504
1304
  DEFAULT_SCROLL_MARGIN
1505
1305
  );
1506
- const scrollMode = activeStep.targetBehavior?.scrollMode ?? DEFAULT_SCROLL_MODE;
1306
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _42 => _42.targetBehavior, 'optionalAccess', _43 => _43.scrollMode]), () => ( DEFAULT_SCROLL_MODE));
1507
1307
  const hasLiveRect = targetInfo.rectSource === "live";
1508
1308
  const scrollBehavior = hasLiveRect ? "smooth" : "auto";
1509
1309
  ensureElementInView(targetInfo.element, margin, {
@@ -1511,9 +1311,9 @@ var useTourTarget = () => {
1511
1311
  mode: scrollMode
1512
1312
  });
1513
1313
  }, [
1514
- activeStep?.id,
1515
- activeStep?.targetBehavior?.scrollMargin,
1516
- activeStep?.targetBehavior?.scrollMode,
1314
+ _optionalChain([activeStep, 'optionalAccess', _44 => _44.id]),
1315
+ _optionalChain([activeStep, 'optionalAccess', _45 => _45.targetBehavior, 'optionalAccess', _46 => _46.scrollMargin]),
1316
+ _optionalChain([activeStep, 'optionalAccess', _47 => _47.targetBehavior, 'optionalAccess', _48 => _48.scrollMode]),
1517
1317
  targetInfo.rect,
1518
1318
  targetInfo.lastResolvedRect,
1519
1319
  targetInfo.element,
@@ -1521,7 +1321,7 @@ var useTourTarget = () => {
1521
1321
  targetInfo.status,
1522
1322
  targetInfo.rectSource
1523
1323
  ]);
1524
- (0, import_react8.useEffect)(() => {
1324
+ _react.useEffect.call(void 0, () => {
1525
1325
  if (!activeStep || !state || state.status !== "running") {
1526
1326
  setTargetInfo(INITIAL_TARGET_INFO);
1527
1327
  autoScrollStateRef.current = {
@@ -1534,8 +1334,8 @@ var useTourTarget = () => {
1534
1334
  cancelAutoScrollLoop();
1535
1335
  return;
1536
1336
  }
1537
- if (!isBrowser) {
1538
- const storedRect = lastResolvedRectByStep.get(activeStep.id) ?? null;
1337
+ if (!_chunkD5LQLRSUcjs.isBrowser) {
1338
+ const storedRect = _nullishCoalesce(lastResolvedRectByStep.get(activeStep.id), () => ( null));
1539
1339
  setTargetInfo({
1540
1340
  element: null,
1541
1341
  rect: null,
@@ -1550,12 +1350,12 @@ var useTourTarget = () => {
1550
1350
  return;
1551
1351
  }
1552
1352
  const currentStep = activeStep;
1553
- const activeFlow = activeFlowId ? flows.get(activeFlowId) ?? null : null;
1353
+ const activeFlow = activeFlowId ? _nullishCoalesce(flows.get(activeFlowId), () => ( null)) : null;
1554
1354
  const isScreen = currentStep.target === "screen";
1555
- const waitForSelectorRaw = currentStep.waitFor?.selector;
1355
+ const waitForSelectorRaw = _optionalChain([currentStep, 'access', _49 => _49.waitFor, 'optionalAccess', _50 => _50.selector]);
1556
1356
  const waitForSelector = typeof waitForSelectorRaw === "string" ? waitForSelectorRaw.trim() : void 0;
1557
1357
  const hasWaitForSelector = Boolean(waitForSelector);
1558
- const waitForTimeout = Math.max(0, currentStep.waitFor?.timeout ?? 8e3);
1358
+ const waitForTimeout = Math.max(0, _nullishCoalesce(_optionalChain([currentStep, 'access', _51 => _51.waitFor, 'optionalAccess', _52 => _52.timeout]), () => ( 8e3)));
1559
1359
  const waitContext = activeFlow ? {
1560
1360
  flow: activeFlow,
1561
1361
  state,
@@ -1617,12 +1417,12 @@ var useTourTarget = () => {
1617
1417
  };
1618
1418
  const isWaitForSatisfied = () => {
1619
1419
  const selectorReady = !hasWaitForSelector || isWaitForSelectorSatisfied();
1620
- const predicateReady = waitForPredicateController?.isSatisfied() ?? true;
1420
+ const predicateReady = _nullishCoalesce(_optionalChain([waitForPredicateController, 'optionalAccess', _53 => _53.isSatisfied, 'call', _54 => _54()]), () => ( true));
1621
1421
  return selectorReady && predicateReady;
1622
1422
  };
1623
1423
  function updateTargetState(status, rectOverride) {
1624
1424
  if (cancelled) return;
1625
- const rect = typeof rectOverride !== "undefined" ? rectOverride : isScreen ? getViewportRect() : element ? getClientRect(element) : null;
1425
+ const rect = typeof rectOverride !== "undefined" ? rectOverride : isScreen ? _chunkD5LQLRSUcjs.getViewportRect.call(void 0, ) : element ? _chunkD5LQLRSUcjs.getClientRect.call(void 0, element) : null;
1626
1426
  if (status === "ready" && hasWaitForSelector && waitForStartedAt === null) {
1627
1427
  waitForStartedAt = Date.now();
1628
1428
  }
@@ -1644,7 +1444,7 @@ var useTourTarget = () => {
1644
1444
  if (waitConditionMet) {
1645
1445
  clearWaitForPoll();
1646
1446
  }
1647
- const storedRect = lastResolvedRectByStep.get(currentStep.id) ?? null;
1447
+ const storedRect = _nullishCoalesce(lastResolvedRectByStep.get(currentStep.id), () => ( null));
1648
1448
  const shouldUpdate = !hasEmitted || rectChanged(rect) || lastStatus !== nextStatus || element !== lastElement;
1649
1449
  if (!shouldUpdate) {
1650
1450
  return;
@@ -1652,16 +1452,16 @@ var useTourTarget = () => {
1652
1452
  lastRectRef.current = rect ? { ...rect } : null;
1653
1453
  lastStatus = nextStatus;
1654
1454
  hasEmitted = true;
1655
- lastElement = element ?? null;
1455
+ lastElement = _nullishCoalesce(element, () => ( null));
1656
1456
  const shouldPersistRect = nextStatus === "ready" && !isScreen && rectHasMeaningfulSize(rect);
1657
1457
  if (shouldPersistRect && rect) {
1658
1458
  lastResolvedRectByStep.set(currentStep.id, { ...rect });
1659
1459
  }
1660
1460
  const lastResolvedRect = shouldPersistRect && rect ? { ...rect } : storedRect ? { ...storedRect } : null;
1661
- const visibility = computeVisibilityState(element ?? null, rect, isScreen);
1461
+ const visibility = computeVisibilityState(_nullishCoalesce(element, () => ( null)), rect, isScreen);
1662
1462
  const rectSource = computeRectSource(rect, lastResolvedRect, isScreen);
1663
1463
  setTargetInfo({
1664
- element: element ?? null,
1464
+ element: _nullishCoalesce(element, () => ( null)),
1665
1465
  rect,
1666
1466
  lastResolvedRect,
1667
1467
  isScreen,
@@ -1690,14 +1490,14 @@ var useTourTarget = () => {
1690
1490
  }
1691
1491
  }
1692
1492
  function startRafMonitor() {
1693
- if (isScreen || !isBrowser) return;
1493
+ if (isScreen || !_chunkD5LQLRSUcjs.isBrowser) return;
1694
1494
  stopRaf();
1695
1495
  const tick = () => {
1696
1496
  if (cancelled) return;
1697
1497
  if (!element) {
1698
1498
  updateTargetState("resolving", null);
1699
1499
  } else {
1700
- const rect = getClientRect(element);
1500
+ const rect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1701
1501
  if (rectChanged(rect)) {
1702
1502
  updateTargetState("ready", rect);
1703
1503
  }
@@ -1739,14 +1539,14 @@ var useTourTarget = () => {
1739
1539
  window.visualViewport.addEventListener("resize", onViewportChange);
1740
1540
  window.visualViewport.addEventListener("scroll", onViewportChange);
1741
1541
  cleanupFns.push(() => {
1742
- window.visualViewport?.removeEventListener(
1542
+ _optionalChain([window, 'access', _55 => _55.visualViewport, 'optionalAccess', _56 => _56.removeEventListener, 'call', _57 => _57(
1743
1543
  "resize",
1744
1544
  onViewportChange
1745
- );
1746
- window.visualViewport?.removeEventListener(
1545
+ )]);
1546
+ _optionalChain([window, 'access', _58 => _58.visualViewport, 'optionalAccess', _59 => _59.removeEventListener, 'call', _60 => _60(
1747
1547
  "scroll",
1748
1548
  onViewportChange
1749
- );
1549
+ )]);
1750
1550
  });
1751
1551
  }
1752
1552
  } else if (element) {
@@ -1762,7 +1562,7 @@ var useTourTarget = () => {
1762
1562
  window.removeEventListener("scroll", onReposition, true);
1763
1563
  });
1764
1564
  const onAncestorScroll = () => commitInfo("ready");
1765
- scrollParents = getScrollParents(element);
1565
+ scrollParents = _chunkD5LQLRSUcjs.getScrollParents.call(void 0, element);
1766
1566
  if (scrollParents.length > 0) {
1767
1567
  scrollParents.forEach(
1768
1568
  (parent) => parent.addEventListener("scroll", onAncestorScroll, {
@@ -1793,7 +1593,7 @@ var useTourTarget = () => {
1793
1593
  subtree: true
1794
1594
  });
1795
1595
  cleanupFns.push(() => {
1796
- mutationObserver?.disconnect();
1596
+ _optionalChain([mutationObserver, 'optionalAccess', _61 => _61.disconnect, 'call', _62 => _62()]);
1797
1597
  mutationObserver = null;
1798
1598
  });
1799
1599
  }
@@ -1840,12 +1640,12 @@ var useTourTarget = () => {
1840
1640
  clearResolvePolling();
1841
1641
  clearWaitForPoll();
1842
1642
  resetObservers();
1843
- waitForPredicateController?.stop();
1643
+ _optionalChain([waitForPredicateController, 'optionalAccess', _63 => _63.stop, 'call', _64 => _64()]);
1844
1644
  waitForPredicateController = null;
1845
1645
  };
1846
1646
  }, [activeStep, activeFlowId, flows, state]);
1847
- (0, import_react8.useEffect)(() => {
1848
- if (!isBrowser) return;
1647
+ _react.useEffect.call(void 0, () => {
1648
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1849
1649
  if (!activeStep) {
1850
1650
  cancelAutoScrollLoop();
1851
1651
  return;
@@ -1875,16 +1675,16 @@ var useTourTarget = () => {
1875
1675
  return;
1876
1676
  }
1877
1677
  const { element } = targetInfo;
1878
- const scrollMode = activeStep.targetBehavior?.scrollMode ?? "center";
1678
+ const scrollMode = _nullishCoalesce(_optionalChain([activeStep, 'access', _65 => _65.targetBehavior, 'optionalAccess', _66 => _66.scrollMode]), () => ( "center"));
1879
1679
  const runCheck = () => {
1880
1680
  autoScrollRafRef.current = null;
1881
- if (!isBrowser) return;
1681
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1882
1682
  if (autoState.stepId !== activeStep.id) return;
1883
1683
  if (!element.isConnected) return;
1884
- const rect = getClientRect(element);
1885
- const viewport = getViewportRect();
1684
+ const rect = _chunkD5LQLRSUcjs.getClientRect.call(void 0, element);
1685
+ const viewport = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
1886
1686
  const margin = resolveScrollMargin(
1887
- activeStep.targetBehavior?.scrollMargin,
1687
+ _optionalChain([activeStep, 'access', _67 => _67.targetBehavior, 'optionalAccess', _68 => _68.scrollMargin]),
1888
1688
  DEFAULT_SCROLL_MARGIN
1889
1689
  );
1890
1690
  const fitsHeight = rect.height <= viewport.height - (margin.top + margin.bottom);
@@ -1920,23 +1720,23 @@ var useTourTarget = () => {
1920
1720
  cancelAutoScrollLoop();
1921
1721
  autoScrollRafRef.current = window.requestAnimationFrame(runCheck);
1922
1722
  return cancelAutoScrollLoop;
1923
- }, [activeStep, activeStep?.targetBehavior?.scrollMode, targetInfo]);
1723
+ }, [activeStep, _optionalChain([activeStep, 'optionalAccess', _69 => _69.targetBehavior, 'optionalAccess', _70 => _70.scrollMode]), targetInfo]);
1924
1724
  return targetInfo;
1925
1725
  };
1926
1726
 
1927
1727
  // src/hooks/useHudState.ts
1928
- var import_react13 = require("react");
1728
+
1929
1729
 
1930
1730
  // src/hooks/useAdvanceRules.ts
1931
- var import_react9 = require("react");
1932
- var DEFAULT_POLL_MS2 = 250;
1731
+
1732
+ var DEFAULT_POLL_MS = 250;
1933
1733
  var isListenerTarget = (value) => {
1934
1734
  return !!value && typeof value.addEventListener === "function" && typeof value.removeEventListener === "function";
1935
1735
  };
1936
1736
  var resolveEventTarget = (rule, target) => {
1937
- if (!isBrowser) return null;
1737
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
1938
1738
  if (!rule.on || rule.on === "target") {
1939
- return target.element ?? null;
1739
+ return _nullishCoalesce(target.element, () => ( null));
1940
1740
  }
1941
1741
  if (rule.on === "window") {
1942
1742
  return window;
@@ -1946,7 +1746,7 @@ var resolveEventTarget = (rule, target) => {
1946
1746
  }
1947
1747
  try {
1948
1748
  return document.querySelector(rule.on);
1949
- } catch {
1749
+ } catch (e3) {
1950
1750
  return null;
1951
1751
  }
1952
1752
  };
@@ -1967,8 +1767,8 @@ var useAdvanceRules = (target) => {
1967
1767
  complete,
1968
1768
  setDelayInfo
1969
1769
  } = useTour();
1970
- (0, import_react9.useEffect)(() => {
1971
- if (!isBrowser) return;
1770
+ _react.useEffect.call(void 0, () => {
1771
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
1972
1772
  if (!state || state.status !== "running") return;
1973
1773
  if (!activeStep) return;
1974
1774
  const definition = activeFlowId ? flows.get(activeFlowId) : void 0;
@@ -1982,7 +1782,7 @@ var useAdvanceRules = (target) => {
1982
1782
  while (cleanupFns.length > 0) {
1983
1783
  const dispose = cleanupFns.pop();
1984
1784
  try {
1985
- dispose?.();
1785
+ _optionalChain([dispose, 'optionalCall', _71 => _71()]);
1986
1786
  } catch (error) {
1987
1787
  console.warn("[tour][advance] cleanup failed", error);
1988
1788
  }
@@ -2068,7 +1868,7 @@ var useAdvanceRules = (target) => {
2068
1868
  break;
2069
1869
  }
2070
1870
  case "predicate": {
2071
- const pollMs = Math.max(50, rule.pollMs ?? DEFAULT_POLL_MS2);
1871
+ const pollMs = Math.max(50, _nullishCoalesce(rule.pollMs, () => ( DEFAULT_POLL_MS)));
2072
1872
  const timeoutMs = rule.timeoutMs;
2073
1873
  const executeCheck = () => {
2074
1874
  if (resolved) return;
@@ -2101,12 +1901,12 @@ var useAdvanceRules = (target) => {
2101
1901
  finish();
2102
1902
  }
2103
1903
  };
2104
- const initialPath = getCurrentRoutePath();
1904
+ const initialPath = _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, );
2105
1905
  checkRoute(initialPath);
2106
1906
  if (hasResolved()) {
2107
1907
  break;
2108
1908
  }
2109
- const unsubscribe = subscribeToRouteChanges((path) => {
1909
+ const unsubscribe = _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
2110
1910
  checkRoute(path);
2111
1911
  });
2112
1912
  addCleanup(unsubscribe);
@@ -2138,7 +1938,7 @@ var useAdvanceRules = (target) => {
2138
1938
  };
2139
1939
 
2140
1940
  // src/hooks/useHiddenTargetFallback.ts
2141
- var import_react10 = require("react");
1941
+
2142
1942
  var DEFAULT_DELAY_MS = 900;
2143
1943
  var DEFAULT_GRACE_PERIOD_MS = 400;
2144
1944
  var useHiddenTargetFallback = ({
@@ -2147,15 +1947,15 @@ var useHiddenTargetFallback = ({
2147
1947
  viewportRect,
2148
1948
  onSkip
2149
1949
  }) => {
2150
- const [usingScreenFallback, setUsingScreenFallback] = (0, import_react10.useState)(false);
2151
- const [isInGracePeriod, setIsInGracePeriod] = (0, import_react10.useState)(false);
2152
- const timeoutRef = (0, import_react10.useRef)(null);
2153
- const graceTimeoutRef = (0, import_react10.useRef)(null);
2154
- const skipTriggeredRef = (0, import_react10.useRef)(false);
2155
- const hiddenMode = step?.targetBehavior?.hidden ?? "screen";
1950
+ const [usingScreenFallback, setUsingScreenFallback] = _react.useState.call(void 0, false);
1951
+ const [isInGracePeriod, setIsInGracePeriod] = _react.useState.call(void 0, false);
1952
+ const timeoutRef = _react.useRef.call(void 0, null);
1953
+ const graceTimeoutRef = _react.useRef.call(void 0, null);
1954
+ const skipTriggeredRef = _react.useRef.call(void 0, false);
1955
+ const hiddenMode = _nullishCoalesce(_optionalChain([step, 'optionalAccess', _72 => _72.targetBehavior, 'optionalAccess', _73 => _73.hidden]), () => ( "screen"));
2156
1956
  const hiddenDelayMs = Math.max(
2157
1957
  0,
2158
- step?.targetBehavior?.hiddenDelayMs ?? DEFAULT_DELAY_MS
1958
+ _nullishCoalesce(_optionalChain([step, 'optionalAccess', _74 => _74.targetBehavior, 'optionalAccess', _75 => _75.hiddenDelayMs]), () => ( DEFAULT_DELAY_MS))
2159
1959
  );
2160
1960
  const clearPendingTimeout = () => {
2161
1961
  if (timeoutRef.current !== null) {
@@ -2169,19 +1969,21 @@ var useHiddenTargetFallback = ({
2169
1969
  graceTimeoutRef.current = null;
2170
1970
  }
2171
1971
  };
2172
- (0, import_react10.useEffect)(() => {
1972
+ const stepChangeTimeRef = _react.useRef.call(void 0, 0);
1973
+ _react.useEffect.call(void 0, () => {
1974
+ stepChangeTimeRef.current = Date.now();
2173
1975
  skipTriggeredRef.current = false;
2174
1976
  setUsingScreenFallback(false);
2175
- setIsInGracePeriod(false);
1977
+ setIsInGracePeriod(true);
2176
1978
  clearPendingTimeout();
2177
1979
  clearGraceTimeout();
2178
1980
  return () => {
2179
1981
  clearPendingTimeout();
2180
1982
  clearGraceTimeout();
2181
1983
  };
2182
- }, [step?.id]);
2183
- (0, import_react10.useEffect)(() => {
2184
- if (!isBrowser) return void 0;
1984
+ }, [_optionalChain([step, 'optionalAccess', _76 => _76.id])]);
1985
+ _react.useEffect.call(void 0, () => {
1986
+ if (!_chunkD5LQLRSUcjs.isBrowser) return void 0;
2185
1987
  if (!step) return void 0;
2186
1988
  clearPendingTimeout();
2187
1989
  clearGraceTimeout();
@@ -2189,11 +1991,22 @@ var useHiddenTargetFallback = ({
2189
1991
  const isMissingWithNoRect = target.visibility === "missing" && target.status === "resolving" && target.rect === null && target.lastResolvedRect === null;
2190
1992
  const isMissingAfterNavigation = target.visibility === "missing" && target.status === "resolving" && target.rect === null;
2191
1993
  const shouldHandleHiddenTarget = !target.isScreen && (isHiddenOrDetached || isMissingWithNoRect || isMissingAfterNavigation);
2192
- if (!shouldHandleHiddenTarget) {
1994
+ const timeSinceStepChange = Date.now() - stepChangeTimeRef.current;
1995
+ const MIN_GRACE_AFTER_STEP_CHANGE = 300;
1996
+ if (!shouldHandleHiddenTarget && target.visibility !== "unknown") {
1997
+ if (timeSinceStepChange < MIN_GRACE_AFTER_STEP_CHANGE) {
1998
+ graceTimeoutRef.current = globalThis.setTimeout(() => {
1999
+ setIsInGracePeriod(false);
2000
+ }, MIN_GRACE_AFTER_STEP_CHANGE - timeSinceStepChange);
2001
+ return void 0;
2002
+ }
2193
2003
  setUsingScreenFallback(false);
2194
2004
  setIsInGracePeriod(false);
2195
2005
  return void 0;
2196
2006
  }
2007
+ if (target.visibility === "unknown") {
2008
+ return void 0;
2009
+ }
2197
2010
  setIsInGracePeriod(true);
2198
2011
  if (hiddenMode !== "screen") {
2199
2012
  setUsingScreenFallback(false);
@@ -2226,7 +2039,7 @@ var useHiddenTargetFallback = ({
2226
2039
  hiddenDelayMs,
2227
2040
  onSkip
2228
2041
  ]);
2229
- const resolvedTarget = (0, import_react10.useMemo)(() => {
2042
+ const resolvedTarget = _react.useMemo.call(void 0, () => {
2230
2043
  if (!usingScreenFallback) {
2231
2044
  return target;
2232
2045
  }
@@ -2248,61 +2061,16 @@ var useHiddenTargetFallback = ({
2248
2061
  };
2249
2062
 
2250
2063
  // src/hooks/useRouteMismatch.ts
2251
- var import_react11 = require("react");
2252
-
2253
- // src/router/utils.ts
2254
- var ensurePrefix = (value, prefix) => value.startsWith(prefix) ? value : `${prefix}${value}`;
2255
- var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
2256
- var toSearchString = (value) => {
2257
- if (!isNonEmptyString(value)) {
2258
- if (value instanceof URLSearchParams) {
2259
- const serialized = value.toString();
2260
- return serialized.length > 0 ? `?${serialized}` : "";
2261
- }
2262
- if (typeof value === "object" && value !== null) {
2263
- try {
2264
- const params = new URLSearchParams();
2265
- for (const [key, raw] of Object.entries(
2266
- value
2267
- )) {
2268
- if (raw === void 0 || raw === null) continue;
2269
- params.set(key, String(raw));
2270
- }
2271
- const serialized = params.toString();
2272
- return serialized.length > 0 ? `?${serialized}` : "";
2273
- } catch {
2274
- return "";
2275
- }
2276
- }
2277
- return "";
2278
- }
2279
- if (value === "?") return "";
2280
- return value.startsWith("?") ? value : ensurePrefix(value, "?");
2281
- };
2282
- var toHashString = (value) => {
2283
- if (!isNonEmptyString(value)) {
2284
- return "";
2285
- }
2286
- if (value === "#") return "";
2287
- return value.startsWith("#") ? value : ensurePrefix(value, "#");
2288
- };
2289
- var createPathString = (pathname, search, hash) => {
2290
- const normalizedPath = isNonEmptyString(pathname) ? pathname.startsWith("/") ? pathname : `/${pathname}` : "/";
2291
- const searchPart = toSearchString(search);
2292
- const hashPart = toHashString(hash);
2293
- return `${normalizedPath}${searchPart}${hashPart}`;
2294
- };
2295
2064
 
2296
- // src/hooks/useRouteMismatch.ts
2297
2065
  var useRouteMismatch = (step) => {
2298
- const [currentPath, setCurrentPath] = (0, import_react11.useState)(() => getCurrentRoutePath());
2299
- (0, import_react11.useEffect)(() => {
2300
- return subscribeToRouteChanges((path) => {
2066
+ const [currentPath, setCurrentPath] = _react.useState.call(void 0, () => _chunkD5LQLRSUcjs.getCurrentRoutePath.call(void 0, ));
2067
+ _react.useEffect.call(void 0, () => {
2068
+ return _chunkD5LQLRSUcjs.subscribeToRouteChanges.call(void 0, (path) => {
2301
2069
  setCurrentPath(path);
2302
2070
  });
2303
2071
  }, []);
2304
- const expectedRoute = step?.route;
2305
- const isRouteMismatch = step !== null && expectedRoute !== void 0 && !matchRoute({ pattern: expectedRoute, path: currentPath });
2072
+ const expectedRoute = _optionalChain([step, 'optionalAccess', _77 => _77.route]);
2073
+ const isRouteMismatch = step !== null && expectedRoute !== void 0 && !_chunkD5LQLRSUcjs.matchRoute.call(void 0, { pattern: expectedRoute, path: currentPath });
2306
2074
  return {
2307
2075
  isRouteMismatch,
2308
2076
  currentPath,
@@ -2311,17 +2079,17 @@ var useRouteMismatch = (step) => {
2311
2079
  };
2312
2080
 
2313
2081
  // src/hooks/useViewportRect.ts
2314
- var import_react12 = require("react");
2082
+
2315
2083
  var useViewportRect = () => {
2316
- const [viewport, setViewport] = (0, import_react12.useState)(
2317
- () => getViewportRect()
2084
+ const [viewport, setViewport] = _react.useState.call(void 0,
2085
+ () => _chunkD5LQLRSUcjs.getViewportRect.call(void 0, )
2318
2086
  );
2319
- const rafRef = (0, import_react12.useRef)(null);
2320
- (0, import_react12.useEffect)(() => {
2321
- if (!isBrowser) return;
2087
+ const rafRef = _react.useRef.call(void 0, null);
2088
+ _react.useEffect.call(void 0, () => {
2089
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2322
2090
  const updateViewport = () => {
2323
2091
  rafRef.current = null;
2324
- setViewport(getViewportRect());
2092
+ setViewport(_chunkD5LQLRSUcjs.getViewportRect.call(void 0, ));
2325
2093
  };
2326
2094
  const scheduleUpdate = () => {
2327
2095
  if (rafRef.current !== null) return;
@@ -2336,8 +2104,8 @@ var useViewportRect = () => {
2336
2104
  addListener(window, "resize", scheduleUpdate);
2337
2105
  addListener(window, "orientationchange", scheduleUpdate);
2338
2106
  addListener(window, "scroll", scheduleUpdate);
2339
- addListener(window.visualViewport ?? null, "resize", scheduleUpdate);
2340
- addListener(window.visualViewport ?? null, "scroll", scheduleUpdate);
2107
+ addListener(_nullishCoalesce(window.visualViewport, () => ( null)), "resize", scheduleUpdate);
2108
+ addListener(_nullishCoalesce(window.visualViewport, () => ( null)), "scroll", scheduleUpdate);
2341
2109
  return () => {
2342
2110
  listeners.forEach(
2343
2111
  ({ target, type, handler }) => target.removeEventListener(type, handler)
@@ -2359,28 +2127,28 @@ var normalizeFlowFilter = (value) => {
2359
2127
  };
2360
2128
  var useHudState = (options = {}) => {
2361
2129
  const { flowId } = options;
2362
- const flowFilter = (0, import_react13.useMemo)(() => normalizeFlowFilter(flowId), [flowId]);
2130
+ const flowFilter = _react.useMemo.call(void 0, () => normalizeFlowFilter(flowId), [flowId]);
2363
2131
  const { state, activeStep, activeFlowId, flows, next, complete, pause, resume } = useTour();
2364
2132
  const target = useTourTarget();
2365
2133
  const viewportRect = useViewportRect();
2366
2134
  useAdvanceRules(target);
2367
- const matchesFlowFilter = (0, import_react13.useMemo)(() => {
2135
+ const matchesFlowFilter = _react.useMemo.call(void 0, () => {
2368
2136
  if (!flowFilter || flowFilter.length === 0) return true;
2369
2137
  if (!activeFlowId) return false;
2370
2138
  return flowFilter.includes(activeFlowId);
2371
2139
  }, [activeFlowId, flowFilter]);
2372
- const isRunning = state?.status === "running";
2140
+ const isRunning = _optionalChain([state, 'optionalAccess', _78 => _78.status]) === "running";
2373
2141
  const runningState = isRunning && matchesFlowFilter ? state : null;
2374
2142
  const runningStep = runningState && activeStep ? activeStep : null;
2375
- const [shouldRender, setShouldRender] = (0, import_react13.useState)(
2143
+ const [shouldRender, setShouldRender] = _react.useState.call(void 0,
2376
2144
  Boolean(runningStep)
2377
2145
  );
2378
- (0, import_react13.useEffect)(() => {
2146
+ _react.useEffect.call(void 0, () => {
2379
2147
  if (runningStep) {
2380
2148
  setShouldRender(true);
2381
2149
  }
2382
- }, [runningStep?.id]);
2383
- (0, import_react13.useEffect)(() => {
2150
+ }, [_optionalChain([runningStep, 'optionalAccess', _79 => _79.id])]);
2151
+ _react.useEffect.call(void 0, () => {
2384
2152
  if (!shouldRender) return;
2385
2153
  if (runningStep) return;
2386
2154
  if (target.status !== "idle") return;
@@ -2392,19 +2160,19 @@ var useHudState = (options = {}) => {
2392
2160
  };
2393
2161
  }, [runningStep, shouldRender, target.status]);
2394
2162
  const { isRouteMismatch, currentPath } = useRouteMismatch(activeStep);
2395
- const pausedForMissingTargetRef = (0, import_react13.useRef)(null);
2396
- (0, import_react13.useEffect)(() => {
2163
+ const pausedForMissingTargetRef = _react.useRef.call(void 0, null);
2164
+ _react.useEffect.call(void 0, () => {
2397
2165
  if (!isRouteMismatch) return;
2398
2166
  if (!runningState || runningState.status !== "running") return;
2399
2167
  pause();
2400
2168
  }, [isRouteMismatch, runningState, pause]);
2401
- (0, import_react13.useEffect)(() => {
2169
+ _react.useEffect.call(void 0, () => {
2402
2170
  if (isRouteMismatch) return;
2403
2171
  if (pausedForMissingTargetRef.current !== null) return;
2404
2172
  if (!state || state.status !== "paused") return;
2405
2173
  resume();
2406
2174
  }, [isRouteMismatch, state, resume]);
2407
- const skipHiddenStep = (0, import_react13.useCallback)(() => {
2175
+ const skipHiddenStep = _react.useCallback.call(void 0, () => {
2408
2176
  if (!runningState || runningState.status !== "running") return;
2409
2177
  if (!activeFlowId) return;
2410
2178
  const flow = flows.get(activeFlowId);
@@ -2422,9 +2190,9 @@ var useHudState = (options = {}) => {
2422
2190
  viewportRect,
2423
2191
  onSkip: skipHiddenStep
2424
2192
  });
2425
- (0, import_react13.useEffect)(() => {
2193
+ _react.useEffect.call(void 0, () => {
2426
2194
  if (isRouteMismatch) return;
2427
- if (activeStep?.route !== void 0) return;
2195
+ if (_optionalChain([activeStep, 'optionalAccess', _80 => _80.route]) !== void 0) return;
2428
2196
  if (isInGracePeriod) return;
2429
2197
  if (target.visibility !== "missing") return;
2430
2198
  if (target.isScreen) return;
@@ -2433,7 +2201,7 @@ var useHudState = (options = {}) => {
2433
2201
  pause();
2434
2202
  }, [
2435
2203
  isRouteMismatch,
2436
- activeStep?.route,
2204
+ _optionalChain([activeStep, 'optionalAccess', _81 => _81.route]),
2437
2205
  isInGracePeriod,
2438
2206
  target.visibility,
2439
2207
  target.isScreen,
@@ -2441,20 +2209,20 @@ var useHudState = (options = {}) => {
2441
2209
  currentPath,
2442
2210
  pause
2443
2211
  ]);
2444
- (0, import_react13.useEffect)(() => {
2212
+ _react.useEffect.call(void 0, () => {
2445
2213
  if (pausedForMissingTargetRef.current === null) return;
2446
2214
  if (!state || state.status !== "paused") return;
2447
2215
  if (currentPath === pausedForMissingTargetRef.current) return;
2448
2216
  pausedForMissingTargetRef.current = null;
2449
2217
  resume();
2450
2218
  }, [currentPath, state, resume]);
2451
- (0, import_react13.useEffect)(() => {
2219
+ _react.useEffect.call(void 0, () => {
2452
2220
  pausedForMissingTargetRef.current = null;
2453
- }, [activeStep?.id]);
2221
+ }, [_optionalChain([activeStep, 'optionalAccess', _82 => _82.id])]);
2454
2222
  const canRenderStep = Boolean(runningStep && runningState);
2455
2223
  const focusTrapActive = canRenderStep;
2456
- const flowHudOptions = matchesFlowFilter && activeFlowId ? flows.get(activeFlowId)?.hud ?? null : null;
2457
- const hudRenderMode = flowHudOptions?.render ?? "default";
2224
+ const flowHudOptions = matchesFlowFilter && activeFlowId ? _nullishCoalesce(_optionalChain([flows, 'access', _83 => _83.get, 'call', _84 => _84(activeFlowId), 'optionalAccess', _85 => _85.hud]), () => ( null)) : null;
2225
+ const hudRenderMode = _nullishCoalesce(_optionalChain([flowHudOptions, 'optionalAccess', _86 => _86.render]), () => ( "default"));
2458
2226
  return {
2459
2227
  state,
2460
2228
  runningState,
@@ -2473,24 +2241,24 @@ var useHudState = (options = {}) => {
2473
2241
  };
2474
2242
 
2475
2243
  // src/hooks/useHudDescription.ts
2476
- var import_react14 = require("react");
2244
+
2477
2245
  var sanitizeForId = (value) => {
2478
2246
  const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
2479
2247
  return normalized.length > 0 ? normalized : "step";
2480
2248
  };
2481
2249
  var useHudDescription = (options) => {
2482
2250
  const { step, fallbackAriaDescribedBy } = options;
2483
- const targetDescription = (0, import_react14.useMemo)(() => {
2251
+ const targetDescription = _react.useMemo.call(void 0, () => {
2484
2252
  if (!step) return null;
2485
2253
  if (typeof step.target !== "object") return null;
2486
2254
  const description = step.target.description;
2487
2255
  return typeof description === "string" ? description : null;
2488
2256
  }, [step]);
2489
- const descriptionId = (0, import_react14.useMemo)(() => {
2257
+ const descriptionId = _react.useMemo.call(void 0, () => {
2490
2258
  if (!step || !targetDescription) return void 0;
2491
2259
  return `tour-step-${sanitizeForId(step.id)}-description`;
2492
2260
  }, [step, targetDescription]);
2493
- const combinedAriaDescribedBy = (0, import_react14.useMemo)(() => {
2261
+ const combinedAriaDescribedBy = _react.useMemo.call(void 0, () => {
2494
2262
  const parts = [fallbackAriaDescribedBy, descriptionId].filter(Boolean);
2495
2263
  return parts.length > 0 ? parts.join(" ") : void 0;
2496
2264
  }, [descriptionId, fallbackAriaDescribedBy]);
@@ -2502,10 +2270,10 @@ var useHudDescription = (options) => {
2502
2270
  };
2503
2271
 
2504
2272
  // src/hooks/useHudShortcuts.ts
2505
- var import_react16 = require("react");
2273
+
2506
2274
 
2507
2275
  // src/hooks/useTourControls.ts
2508
- var import_react15 = require("react");
2276
+
2509
2277
  var hasManualAdvance = (rules) => rules.some((rule) => rule.type === "manual");
2510
2278
  var didPreviousAdvanceViaRoute = (rules) => rules.some((rule) => rule.type === "route");
2511
2279
  var useTourControls = () => {
@@ -2520,7 +2288,7 @@ var useTourControls = () => {
2520
2288
  flows,
2521
2289
  activeStep
2522
2290
  } = tour;
2523
- const computed = (0, import_react15.useMemo)(() => {
2291
+ const computed = _react.useMemo.call(void 0, () => {
2524
2292
  if (!state || state.status !== "running" || !activeStep) {
2525
2293
  return {
2526
2294
  isActive: false,
@@ -2533,16 +2301,16 @@ var useTourControls = () => {
2533
2301
  };
2534
2302
  }
2535
2303
  const definition = activeFlowId ? flows.get(activeFlowId) : null;
2536
- const totalSteps = definition?.steps.length ?? 0;
2304
+ const totalSteps = _nullishCoalesce(_optionalChain([definition, 'optionalAccess', _87 => _87.steps, 'access', _88 => _88.length]), () => ( 0));
2537
2305
  const stepIndex = state.stepIndex;
2538
2306
  const isFirst2 = stepIndex <= 0;
2539
2307
  const isLast2 = totalSteps > 0 && stepIndex >= totalSteps - 1;
2540
2308
  const previousStep = !definition || stepIndex <= 0 ? null : definition.steps[stepIndex - 1];
2541
- const advanceRules = activeStep.advance ?? [];
2309
+ const advanceRules = _nullishCoalesce(activeStep.advance, () => ( []));
2542
2310
  const hasAdvanceRules = advanceRules.length > 0;
2543
- const previousAdvanceRules = previousStep?.advance ?? [];
2544
- const backControlState = activeStep.controls?.back ?? "auto";
2545
- const nextControlState = activeStep.controls?.next ?? "auto";
2311
+ const previousAdvanceRules = _nullishCoalesce(_optionalChain([previousStep, 'optionalAccess', _89 => _89.advance]), () => ( []));
2312
+ const backControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _90 => _90.controls, 'optionalAccess', _91 => _91.back]), () => ( "auto"));
2313
+ const nextControlState = _nullishCoalesce(_optionalChain([activeStep, 'access', _92 => _92.controls, 'optionalAccess', _93 => _93.next]), () => ( "auto"));
2546
2314
  const showBackButton2 = backControlState !== "hidden" && !isFirst2 && !didPreviousAdvanceViaRoute(previousAdvanceRules);
2547
2315
  const backDisabled2 = backControlState === "disabled";
2548
2316
  const manualAdvancePresent = hasManualAdvance(advanceRules);
@@ -2569,11 +2337,11 @@ var useTourControls = () => {
2569
2337
  } = computed;
2570
2338
  const canGoBack = showBackButton && !backDisabled;
2571
2339
  const canGoNext = showNextButton && !nextDisabled;
2572
- const goBack = (0, import_react15.useCallback)(() => {
2340
+ const goBack = _react.useCallback.call(void 0, () => {
2573
2341
  if (!canGoBack) return;
2574
2342
  back();
2575
2343
  }, [back, canGoBack]);
2576
- const goNext = (0, import_react15.useCallback)(() => {
2344
+ const goNext = _react.useCallback.call(void 0, () => {
2577
2345
  if (!canGoNext) return;
2578
2346
  if (isLast) {
2579
2347
  complete();
@@ -2581,7 +2349,7 @@ var useTourControls = () => {
2581
2349
  next();
2582
2350
  }
2583
2351
  }, [canGoNext, complete, isLast, next]);
2584
- return (0, import_react15.useMemo)(
2352
+ return _react.useMemo.call(void 0,
2585
2353
  () => ({
2586
2354
  showBackButton,
2587
2355
  backDisabled,
@@ -2622,12 +2390,12 @@ var isInteractiveElement = (node) => {
2622
2390
  return Boolean(node.closest(interactiveSelector));
2623
2391
  };
2624
2392
  var useHudShortcuts = (target, options) => {
2625
- const enabled = options?.enabled ?? true;
2626
- const escapeEnabled = options?.escape ?? true;
2393
+ const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _94 => _94.enabled]), () => ( true));
2394
+ const escapeEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95.escape]), () => ( true));
2627
2395
  const { state } = useTour();
2628
2396
  const { cancel, canGoBack, goBack, canGoNext, goNext, isActive } = useTourControls();
2629
- (0, import_react16.useEffect)(() => {
2630
- if (!isBrowser) return void 0;
2397
+ _react.useEffect.call(void 0, () => {
2398
+ if (!_chunkD5LQLRSUcjs.isBrowser) return void 0;
2631
2399
  if (!enabled) return void 0;
2632
2400
  if (!target) return void 0;
2633
2401
  if (!state || state.status !== "running") return void 0;
@@ -2690,14 +2458,14 @@ var useHudShortcuts = (target, options) => {
2690
2458
  };
2691
2459
 
2692
2460
  // src/hooks/useTourHud.ts
2693
- var import_react19 = require("react");
2461
+
2694
2462
 
2695
2463
  // src/hooks/useBodyScrollLock.ts
2696
- var import_react17 = require("react");
2464
+
2697
2465
  var lockCount = 0;
2698
2466
  var previousOverflow = null;
2699
2467
  var acquireLock = () => {
2700
- if (!isBrowser) return;
2468
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2701
2469
  if (lockCount === 0) {
2702
2470
  previousOverflow = document.body.style.overflow;
2703
2471
  document.body.style.overflow = "hidden";
@@ -2705,16 +2473,16 @@ var acquireLock = () => {
2705
2473
  lockCount += 1;
2706
2474
  };
2707
2475
  var releaseLock = () => {
2708
- if (!isBrowser) return;
2476
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2709
2477
  if (lockCount === 0) return;
2710
2478
  lockCount -= 1;
2711
2479
  if (lockCount === 0) {
2712
- document.body.style.overflow = previousOverflow ?? "";
2480
+ document.body.style.overflow = _nullishCoalesce(previousOverflow, () => ( ""));
2713
2481
  previousOverflow = null;
2714
2482
  }
2715
2483
  };
2716
2484
  var useBodyScrollLock = (enabled) => {
2717
- (0, import_react17.useEffect)(() => {
2485
+ _react.useEffect.call(void 0, () => {
2718
2486
  if (!enabled) return;
2719
2487
  acquireLock();
2720
2488
  return () => {
@@ -2724,7 +2492,7 @@ var useBodyScrollLock = (enabled) => {
2724
2492
  };
2725
2493
 
2726
2494
  // src/hooks/useHudTargetIssue.ts
2727
- var import_react18 = require("react");
2495
+
2728
2496
  var deriveTargetIssue = (params) => {
2729
2497
  const { target, labels } = params;
2730
2498
  if (target.isScreen) return null;
@@ -2756,18 +2524,18 @@ var deriveTargetIssue = (params) => {
2756
2524
  };
2757
2525
  var useHudTargetIssue = (target, options) => {
2758
2526
  const labels = useTourLabels();
2759
- const delayMs = Math.max(0, options?.delayMs ?? 500);
2760
- const [armed, setArmed] = (0, import_react18.useState)(false);
2761
- const rawIssue = (0, import_react18.useMemo)(
2527
+ const delayMs = Math.max(0, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.delayMs]), () => ( 500)));
2528
+ const [armed, setArmed] = _react.useState.call(void 0, false);
2529
+ const rawIssue = _react.useMemo.call(void 0,
2762
2530
  () => deriveTargetIssue({ target, labels }),
2763
2531
  [target.isScreen, target.rectSource, target.status, target.visibility, labels]
2764
2532
  );
2765
- (0, import_react18.useEffect)(() => {
2533
+ _react.useEffect.call(void 0, () => {
2766
2534
  if (!rawIssue) {
2767
2535
  setArmed(false);
2768
2536
  return;
2769
2537
  }
2770
- if (!isBrowser) {
2538
+ if (!_chunkD5LQLRSUcjs.isBrowser) {
2771
2539
  setArmed(true);
2772
2540
  return;
2773
2541
  }
@@ -2776,7 +2544,7 @@ var useHudTargetIssue = (target, options) => {
2776
2544
  setArmed(false);
2777
2545
  globalThis.clearTimeout(timeoutId);
2778
2546
  };
2779
- }, [delayMs, rawIssue?.type]);
2547
+ }, [delayMs, _optionalChain([rawIssue, 'optionalAccess', _97 => _97.type])]);
2780
2548
  return {
2781
2549
  issue: armed ? rawIssue : null,
2782
2550
  rawIssue
@@ -2792,24 +2560,24 @@ var useTourHud = (options = {}) => {
2792
2560
  overlayRadius,
2793
2561
  bodyScrollLock = DEFAULT_BODY_SCROLL_LOCK
2794
2562
  } = options;
2795
- const shortcuts = options.shortcuts ?? DEFAULT_SHORTCUTS;
2563
+ const shortcuts = _nullishCoalesce(options.shortcuts, () => ( DEFAULT_SHORTCUTS));
2796
2564
  const { backdropInteraction, lockBodyScroll } = useTour();
2797
2565
  const hudState = useHudState();
2798
2566
  const disableDefaultHud = hudState.hudRenderMode === "none";
2799
- const [popoverNode, setPopoverNode] = (0, import_react19.useState)(null);
2800
- const popoverOptions = hudState.flowHudOptions?.popover;
2567
+ const [popoverNode, setPopoverNode] = _react.useState.call(void 0, null);
2568
+ const popoverOptions = _optionalChain([hudState, 'access', _98 => _98.flowHudOptions, 'optionalAccess', _99 => _99.popover]);
2801
2569
  const description = useHudDescription({
2802
2570
  step: hudState.runningStep,
2803
- fallbackAriaDescribedBy: popoverOptions?.ariaDescribedBy
2571
+ fallbackAriaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _100 => _100.ariaDescribedBy])
2804
2572
  });
2805
2573
  const targetIssue = useHudTargetIssue(hudState.hudTarget);
2806
2574
  const shouldLockBodyScroll = Boolean(
2807
- bodyScrollLock && (hudState.flowHudOptions?.behavior?.lockBodyScroll ?? lockBodyScroll) && hudState.focusTrapActive
2575
+ bodyScrollLock && (_nullishCoalesce(_optionalChain([hudState, 'access', _101 => _101.flowHudOptions, 'optionalAccess', _102 => _102.behavior, 'optionalAccess', _103 => _103.lockBodyScroll]), () => ( lockBodyScroll))) && hudState.focusTrapActive
2808
2576
  );
2809
2577
  useBodyScrollLock(shouldLockBodyScroll);
2810
2578
  const shortcutOptions = typeof shortcuts === "object" ? shortcuts : {};
2811
2579
  const shortcutsEnabled = Boolean(
2812
- (typeof shortcuts === "boolean" ? shortcuts : shortcuts.enabled ?? true) && hudState.shouldRender
2580
+ (typeof shortcuts === "boolean" ? shortcuts : _nullishCoalesce(shortcuts.enabled, () => ( true))) && hudState.shouldRender
2813
2581
  );
2814
2582
  useHudShortcuts(shortcutsEnabled ? hudState.hudTarget : null, {
2815
2583
  ...shortcutOptions,
@@ -2818,40 +2586,40 @@ var useTourHud = (options = {}) => {
2818
2586
  const overlay = {
2819
2587
  padding: overlayPadding,
2820
2588
  radius: overlayRadius,
2821
- interactionMode: hudState.flowHudOptions?.backdrop?.interaction ?? backdropInteraction
2589
+ interactionMode: _nullishCoalesce(_optionalChain([hudState, 'access', _104 => _104.flowHudOptions, 'optionalAccess', _105 => _105.backdrop, 'optionalAccess', _106 => _106.interaction]), () => ( backdropInteraction))
2822
2590
  };
2823
- const popover = (0, import_react19.useMemo)(() => {
2591
+ const popover = _react.useMemo.call(void 0, () => {
2824
2592
  return {
2825
- offset: popoverOptions?.offset ?? 32,
2826
- role: popoverOptions?.role ?? "dialog",
2827
- ariaLabel: popoverOptions?.ariaLabel,
2828
- ariaDescribedBy: popoverOptions?.ariaDescribedBy,
2829
- ariaModal: popoverOptions?.ariaModal ?? false,
2830
- width: popoverOptions?.width,
2831
- maxWidth: popoverOptions?.maxWidth,
2832
- placement: hudState.runningStep?.placement
2593
+ offset: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _107 => _107.offset]), () => ( 32)),
2594
+ role: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _108 => _108.role]), () => ( "dialog")),
2595
+ ariaLabel: _optionalChain([popoverOptions, 'optionalAccess', _109 => _109.ariaLabel]),
2596
+ ariaDescribedBy: _optionalChain([popoverOptions, 'optionalAccess', _110 => _110.ariaDescribedBy]),
2597
+ ariaModal: _nullishCoalesce(_optionalChain([popoverOptions, 'optionalAccess', _111 => _111.ariaModal]), () => ( false)),
2598
+ width: _optionalChain([popoverOptions, 'optionalAccess', _112 => _112.width]),
2599
+ maxWidth: _optionalChain([popoverOptions, 'optionalAccess', _113 => _113.maxWidth]),
2600
+ placement: _optionalChain([hudState, 'access', _114 => _114.runningStep, 'optionalAccess', _115 => _115.placement])
2833
2601
  };
2834
- }, [hudState.runningStep?.placement, popoverOptions]);
2835
- const descriptionResult = (0, import_react19.useMemo)(() => {
2602
+ }, [_optionalChain([hudState, 'access', _116 => _116.runningStep, 'optionalAccess', _117 => _117.placement]), popoverOptions]);
2603
+ const descriptionResult = _react.useMemo.call(void 0, () => {
2836
2604
  return {
2837
2605
  ...description,
2838
2606
  text: description.targetDescription
2839
2607
  };
2840
2608
  }, [description]);
2841
- const focusManager = (0, import_react19.useMemo)(
2609
+ const focusManager = _react.useMemo.call(void 0,
2842
2610
  () => ({
2843
2611
  active: hudState.focusTrapActive,
2844
2612
  target: hudState.hudTarget,
2845
2613
  popoverNode,
2846
2614
  setPopoverNode,
2847
- guardElementFocusRing: hudState.flowHudOptions?.guardElementFocusRing
2615
+ guardElementFocusRing: _optionalChain([hudState, 'access', _118 => _118.flowHudOptions, 'optionalAccess', _119 => _119.guardElementFocusRing])
2848
2616
  }),
2849
2617
  [
2850
2618
  hudState.focusTrapActive,
2851
2619
  hudState.hudTarget,
2852
2620
  popoverNode,
2853
2621
  setPopoverNode,
2854
- hudState.flowHudOptions?.guardElementFocusRing
2622
+ _optionalChain([hudState, 'access', _120 => _120.flowHudOptions, 'optionalAccess', _121 => _121.guardElementFocusRing])
2855
2623
  ]
2856
2624
  );
2857
2625
  return {
@@ -2868,7 +2636,7 @@ var useTourHud = (options = {}) => {
2868
2636
  };
2869
2637
 
2870
2638
  // src/hooks/useTourOverlay.ts
2871
- var import_react20 = require("react");
2639
+
2872
2640
  var DEFAULT_PADDING = 12;
2873
2641
  var DEFAULT_RADIUS = 12;
2874
2642
  var DEFAULT_EDGE_BUFFER = 0;
@@ -2881,10 +2649,10 @@ var useTourOverlay = (options) => {
2881
2649
  interactionMode = "passthrough",
2882
2650
  isInGracePeriod = false
2883
2651
  } = options;
2884
- const hasShownRef = (0, import_react20.useRef)(false);
2885
- const lastReadyTargetRef = (0, import_react20.useRef)(null);
2886
- (0, import_react20.useEffect)(() => {
2887
- if (!isBrowser) return;
2652
+ const hasShownRef = _react.useRef.call(void 0, false);
2653
+ const lastReadyTargetRef = _react.useRef.call(void 0, null);
2654
+ _react.useEffect.call(void 0, () => {
2655
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
2888
2656
  if (target.status === "ready") {
2889
2657
  hasShownRef.current = true;
2890
2658
  lastReadyTargetRef.current = {
@@ -2893,17 +2661,17 @@ var useTourOverlay = (options) => {
2893
2661
  };
2894
2662
  return;
2895
2663
  }
2896
- if (target.status === "idle") {
2664
+ if (target.status === "idle" && !isInGracePeriod) {
2897
2665
  hasShownRef.current = false;
2898
2666
  lastReadyTargetRef.current = null;
2899
2667
  }
2900
- }, [target]);
2901
- const viewport = getViewportRect();
2668
+ }, [target, isInGracePeriod]);
2669
+ const viewport = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
2902
2670
  const cachedTarget = lastReadyTargetRef.current;
2903
2671
  const highlightTarget = target.status === "ready" ? target : cachedTarget;
2904
- const resolvedRect = highlightTarget?.rect ?? target.rect;
2905
- const resolvedIsScreen = highlightTarget?.isScreen ?? target.isScreen;
2906
- const expandedRect = resolvedIsScreen || !resolvedRect ? viewport : expandRect(resolvedRect, padding);
2672
+ const resolvedRect = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _122 => _122.rect]), () => ( target.rect));
2673
+ const resolvedIsScreen = _nullishCoalesce(_optionalChain([highlightTarget, 'optionalAccess', _123 => _123.isScreen]), () => ( target.isScreen));
2674
+ const expandedRect = resolvedIsScreen || !resolvedRect ? viewport : _chunkD5LQLRSUcjs.expandRect.call(void 0, resolvedRect, padding);
2907
2675
  const safeBuffer = Math.max(0, edgeBuffer);
2908
2676
  const insetTop = expandedRect.top <= 0 ? Math.min(safeBuffer, Math.max(0, expandedRect.height) / 2) : 0;
2909
2677
  const insetLeft = expandedRect.left <= 0 ? Math.min(safeBuffer, Math.max(0, expandedRect.width) / 2) : 0;
@@ -2933,15 +2701,15 @@ var useTourOverlay = (options) => {
2933
2701
  height: highlightHeight,
2934
2702
  radius: highlightRadius
2935
2703
  } : null;
2936
- const maskCapable = (0, import_react20.useMemo)(() => supportsMasking(), []);
2704
+ const maskCapable = _react.useMemo.call(void 0, () => _chunkD5LQLRSUcjs.supportsMasking.call(void 0, ), []);
2937
2705
  const isActive = target.status === "ready" || target.status === "resolving" && cachedTarget !== null || isInGracePeriod;
2938
2706
  const shouldMask = maskCapable && isActive;
2939
- const maskId = (0, import_react20.useMemo)(
2707
+ const maskId = _react.useMemo.call(void 0,
2940
2708
  () => `tour-overlay-mask-${Math.random().toString(36).slice(2, 10)}`,
2941
2709
  []
2942
2710
  );
2943
2711
  const maskUrl = shouldMask ? `url(#${maskId})` : void 0;
2944
- const fallbackSegments = (0, import_react20.useMemo)(() => {
2712
+ const fallbackSegments = _react.useMemo.call(void 0, () => {
2945
2713
  if (!isActive || shouldMask || !hasHighlightBounds || !highlightRect) {
2946
2714
  return null;
2947
2715
  }
@@ -2994,7 +2762,7 @@ var useTourOverlay = (options) => {
2994
2762
  viewport.height,
2995
2763
  viewport.width
2996
2764
  ]);
2997
- const blockerSegments = (0, import_react20.useMemo)(() => {
2765
+ const blockerSegments = _react.useMemo.call(void 0, () => {
2998
2766
  if (interactionMode !== "block") {
2999
2767
  return null;
3000
2768
  }
@@ -3064,7 +2832,7 @@ var useTourOverlay = (options) => {
3064
2832
  rect: highlightRect,
3065
2833
  centerX: highlightCenterX,
3066
2834
  centerY: highlightCenterY,
3067
- target: highlightTarget ?? null,
2835
+ target: _nullishCoalesce(highlightTarget, () => ( null)),
3068
2836
  isScreen: resolvedIsScreen
3069
2837
  },
3070
2838
  shouldMask,
@@ -3082,7 +2850,7 @@ var DEFAULT_ENABLED = true;
3082
2850
  var useTourFocusDominance = (options = {}) => {
3083
2851
  const { enabled = DEFAULT_ENABLED } = options;
3084
2852
  const { state } = useTour();
3085
- const isRunning = state?.status === "running";
2853
+ const isRunning = _optionalChain([state, 'optionalAccess', _124 => _124.status]) === "running";
3086
2854
  const active = Boolean(enabled && isRunning);
3087
2855
  return {
3088
2856
  active,
@@ -3124,7 +2892,7 @@ var waitForDom = () => new Promise(
3124
2892
  );
3125
2893
 
3126
2894
  // src/hooks/useRadixTourDialog.ts
3127
- var import_react21 = require("react");
2895
+
3128
2896
  var resolveAutoOpen2 = (config) => {
3129
2897
  if (!config) return { onEnter: true, onResume: true };
3130
2898
  const { autoOpen } = config;
@@ -3133,8 +2901,8 @@ var resolveAutoOpen2 = (config) => {
3133
2901
  return { onEnter: true, onResume: true };
3134
2902
  }
3135
2903
  return {
3136
- onEnter: autoOpen.onEnter ?? true,
3137
- onResume: autoOpen.onResume ?? true
2904
+ onEnter: _nullishCoalesce(autoOpen.onEnter, () => ( true)),
2905
+ onResume: _nullishCoalesce(autoOpen.onResume, () => ( true))
3138
2906
  };
3139
2907
  };
3140
2908
  var useRadixTourDialog = (params) => {
@@ -3142,27 +2910,27 @@ var useRadixTourDialog = (params) => {
3142
2910
  const { activeFlowId, state, flows, goToStep, events } = useTour();
3143
2911
  const registry = useDialogRegistryOptional();
3144
2912
  const { suspendExternalFocusTrap } = useTourFocusDominance();
3145
- const [internalOpen, setInternalOpen] = (0, import_react21.useState)(false);
3146
- const lastStepIndexRef = (0, import_react21.useRef)(-1);
3147
- const isResumeRef = (0, import_react21.useRef)(false);
2913
+ const [internalOpen, setInternalOpen] = _react.useState.call(void 0, false);
2914
+ const lastStepIndexRef = _react.useRef.call(void 0, -1);
2915
+ const isResumeRef = _react.useRef.call(void 0, false);
3148
2916
  const flow = activeFlowId ? flows.get(activeFlowId) : void 0;
3149
- const dialogConfig = flow?.dialogs?.[dialogId];
2917
+ const dialogConfig = _optionalChain([flow, 'optionalAccess', _125 => _125.dialogs, 'optionalAccess', _126 => _126[dialogId]]);
3150
2918
  const currentStep = flow && state && state.stepIndex >= 0 ? flow.steps[state.stepIndex] : void 0;
3151
- const isStepActive = currentStep?.dialogId === dialogId;
2919
+ const isStepActive = _optionalChain([currentStep, 'optionalAccess', _127 => _127.dialogId]) === dialogId;
3152
2920
  const autoOpenConfig = resolveAutoOpen2(dialogConfig);
3153
- const autoClose = dialogConfig?.autoClose ?? "differentDialog";
3154
- const shouldBeOpen = (0, import_react21.useMemo)(() => {
2921
+ const autoClose = _nullishCoalesce(_optionalChain([dialogConfig, 'optionalAccess', _128 => _128.autoClose]), () => ( "differentDialog"));
2922
+ const shouldBeOpen = _react.useMemo.call(void 0, () => {
3155
2923
  if (!isStepActive) return false;
3156
2924
  return true;
3157
2925
  }, [isStepActive]);
3158
- (0, import_react21.useEffect)(() => {
2926
+ _react.useEffect.call(void 0, () => {
3159
2927
  if (!events) return;
3160
2928
  const unsubscribe = events.on("flowResume", () => {
3161
2929
  isResumeRef.current = true;
3162
2930
  });
3163
2931
  return unsubscribe;
3164
2932
  }, [events]);
3165
- (0, import_react21.useEffect)(() => {
2933
+ _react.useEffect.call(void 0, () => {
3166
2934
  if (!state || state.status !== "running") return;
3167
2935
  if (!flow) return;
3168
2936
  const currentStepIndex = state.stepIndex;
@@ -3182,7 +2950,7 @@ var useRadixTourDialog = (params) => {
3182
2950
  if (previousStepIndex === currentStepIndex) return;
3183
2951
  lastStepIndexRef.current = currentStepIndex;
3184
2952
  const previousStep = previousStepIndex >= 0 ? flow.steps[previousStepIndex] : void 0;
3185
- const wasActive = previousStep?.dialogId === dialogId;
2953
+ const wasActive = _optionalChain([previousStep, 'optionalAccess', _129 => _129.dialogId]) === dialogId;
3186
2954
  if (isStepActive && !wasActive) {
3187
2955
  const shouldAutoOpen = wasResume ? autoOpenConfig.onResume : autoOpenConfig.onEnter;
3188
2956
  if (shouldAutoOpen) {
@@ -3203,7 +2971,7 @@ var useRadixTourDialog = (params) => {
3203
2971
  autoOpenConfig.onResume,
3204
2972
  autoClose
3205
2973
  ]);
3206
- (0, import_react21.useEffect)(() => {
2974
+ _react.useEffect.call(void 0, () => {
3207
2975
  if (!events) return;
3208
2976
  const unsubscribeEnter = events.on("stepEnter", (payload) => {
3209
2977
  const step = payload.currentStep;
@@ -3220,7 +2988,7 @@ var useRadixTourDialog = (params) => {
3220
2988
  const step = payload.previousStep;
3221
2989
  if (step.dialogId !== dialogId) return;
3222
2990
  const nextStep = payload.currentStep;
3223
- if (nextStep?.dialogId === dialogId) {
2991
+ if (_optionalChain([nextStep, 'optionalAccess', _130 => _130.dialogId]) === dialogId) {
3224
2992
  return;
3225
2993
  }
3226
2994
  if (autoClose === "always" || autoClose === "differentDialog") {
@@ -3234,12 +3002,12 @@ var useRadixTourDialog = (params) => {
3234
3002
  unsubscribeExit();
3235
3003
  };
3236
3004
  }, [events, dialogId, autoOpenConfig, autoClose]);
3237
- const handleDismiss = (0, import_react21.useCallback)(() => {
3005
+ const handleDismiss = _react.useCallback.call(void 0, () => {
3238
3006
  if (!dialogConfig) return;
3239
3007
  setInternalOpen(false);
3240
3008
  goToStep(dialogConfig.onDismissGoToStepId);
3241
3009
  }, [dialogConfig, goToStep]);
3242
- const onOpenChange = (0, import_react21.useCallback)(
3010
+ const onOpenChange = _react.useCallback.call(void 0,
3243
3011
  (open) => {
3244
3012
  if (open) {
3245
3013
  setInternalOpen(true);
@@ -3253,7 +3021,7 @@ var useRadixTourDialog = (params) => {
3253
3021
  },
3254
3022
  [isStepActive, dialogConfig, handleDismiss]
3255
3023
  );
3256
- (0, import_react21.useEffect)(() => {
3024
+ _react.useEffect.call(void 0, () => {
3257
3025
  if (!registry) return;
3258
3026
  const controller = {
3259
3027
  open: () => setInternalOpen(true),
@@ -3263,7 +3031,7 @@ var useRadixTourDialog = (params) => {
3263
3031
  registry.register(dialogId, controller);
3264
3032
  return () => registry.unregister(dialogId);
3265
3033
  }, [registry, dialogId, internalOpen]);
3266
- const preventDismiss = (0, import_react21.useCallback)(
3034
+ const preventDismiss = _react.useCallback.call(void 0,
3267
3035
  (event) => {
3268
3036
  if (suspendExternalFocusTrap) {
3269
3037
  event.preventDefault();
@@ -3271,7 +3039,7 @@ var useRadixTourDialog = (params) => {
3271
3039
  },
3272
3040
  [suspendExternalFocusTrap]
3273
3041
  );
3274
- const handleEscapeKeyDown = (0, import_react21.useCallback)(
3042
+ const handleEscapeKeyDown = _react.useCallback.call(void 0,
3275
3043
  (event) => {
3276
3044
  if (isStepActive && dialogConfig) {
3277
3045
  event.preventDefault();
@@ -3280,7 +3048,7 @@ var useRadixTourDialog = (params) => {
3280
3048
  },
3281
3049
  [isStepActive, dialogConfig, handleDismiss]
3282
3050
  );
3283
- const handleInteractOutside = (0, import_react21.useCallback)(
3051
+ const handleInteractOutside = _react.useCallback.call(void 0,
3284
3052
  (event) => {
3285
3053
  if (suspendExternalFocusTrap) {
3286
3054
  event.preventDefault();
@@ -3312,16 +3080,16 @@ var useRadixTourDialog = (params) => {
3312
3080
  };
3313
3081
 
3314
3082
  // src/hooks/useDelayAdvance.ts
3315
- var import_react22 = require("react");
3083
+
3316
3084
  var getTimestamp = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
3317
3085
  var useDelayAdvance = () => {
3318
3086
  const { delayInfo, activeStep, state } = useTour();
3319
- const [now, setNow] = (0, import_react22.useState)(() => getTimestamp());
3320
- (0, import_react22.useEffect)(() => {
3087
+ const [now, setNow] = _react.useState.call(void 0, () => getTimestamp());
3088
+ _react.useEffect.call(void 0, () => {
3321
3089
  if (!delayInfo) return;
3322
3090
  if (!activeStep || activeStep.id !== delayInfo.stepId) return;
3323
3091
  if (!state || state.status !== "running") return;
3324
- if (!isBrowser) return;
3092
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
3325
3093
  let frameId = null;
3326
3094
  const tick = () => {
3327
3095
  setNow(getTimestamp());
@@ -3334,14 +3102,14 @@ var useDelayAdvance = () => {
3334
3102
  }
3335
3103
  };
3336
3104
  }, [delayInfo, activeStep, state]);
3337
- (0, import_react22.useEffect)(() => {
3105
+ _react.useEffect.call(void 0, () => {
3338
3106
  if (!delayInfo) {
3339
3107
  setNow(getTimestamp());
3340
3108
  }
3341
3109
  }, [delayInfo]);
3342
- return (0, import_react22.useMemo)(() => {
3110
+ return _react.useMemo.call(void 0, () => {
3343
3111
  const matchingStep = !!delayInfo && !!activeStep && activeStep.id === delayInfo.stepId;
3344
- const isRunning = matchingStep && state?.status === "running";
3112
+ const isRunning = matchingStep && _optionalChain([state, 'optionalAccess', _131 => _131.status]) === "running";
3345
3113
  if (!delayInfo) {
3346
3114
  return {
3347
3115
  isActive: false,
@@ -3392,10 +3160,10 @@ var useDelayAdvance = () => {
3392
3160
  };
3393
3161
 
3394
3162
  // src/components/OverlayBackdrop.tsx
3395
- var import_react23 = require("react");
3396
- var import_react_dom = require("react-dom");
3397
- var import_react24 = require("motion/react");
3398
- var import_jsx_runtime4 = require("react/jsx-runtime");
3163
+
3164
+ var _reactdom = require('react-dom');
3165
+
3166
+
3399
3167
  var styles = {
3400
3168
  root: {
3401
3169
  position: "fixed",
@@ -3465,8 +3233,8 @@ var OverlayBackdrop = ({
3465
3233
  showInteractionBlocker = true,
3466
3234
  transitionsOverride
3467
3235
  }) => {
3468
- if (!isBrowser) return null;
3469
- const host = portalHost();
3236
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
3237
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
3470
3238
  if (!host) return null;
3471
3239
  const adapter = useAnimationAdapter();
3472
3240
  const {
@@ -3481,28 +3249,28 @@ var OverlayBackdrop = ({
3481
3249
  viewport
3482
3250
  } = overlay;
3483
3251
  const hasHighlightBounds = Boolean(highlight.rect);
3484
- const prevScreenTargetRef = (0, import_react23.useRef)(null);
3252
+ const prevScreenTargetRef = _react.useRef.call(void 0, null);
3485
3253
  const shouldSnapHighlight = prevScreenTargetRef.current === true && !highlight.isScreen && hasHighlightBounds;
3486
- (0, import_react23.useEffect)(() => {
3254
+ _react.useEffect.call(void 0, () => {
3487
3255
  prevScreenTargetRef.current = highlight.isScreen;
3488
3256
  }, [highlight.isScreen]);
3489
3257
  const resolvedBlur = typeof blurAmount === "number" ? `${blurAmount}px` : "0px";
3490
3258
  const defaultInsetShadow = "inset 0 0 0 2px rgba(56,189,248,0.4), inset 0 0 0 8px rgba(15,23,42,0.3)";
3491
3259
  const highlightAppearance = shadow ? { boxShadow: shadow } : { boxShadow: defaultInsetShadow };
3492
3260
  const { MotionDiv, MotionSvg, MotionDefs, MotionMask, MotionRect } = adapter.components;
3493
- const highlightTransition = transitionsOverride?.overlayHighlight ?? adapter.transitions.overlayHighlight ?? DEFAULT_HIGHLIGHT_TRANSITION;
3261
+ const highlightTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _132 => _132.overlayHighlight]), () => ( adapter.transitions.overlayHighlight)), () => ( DEFAULT_HIGHLIGHT_TRANSITION));
3494
3262
  const snapTransition = { type: "tween", duration: 0 };
3495
3263
  const resolvedHighlightTransition = shouldSnapHighlight ? snapTransition : highlightTransition;
3496
- const overlayTransition = transitionsOverride?.overlayFade ?? adapter.transitions.overlayFade ?? DEFAULT_OVERLAY_TRANSITION;
3497
- const highlightCollapseTransition = highlight.isScreen ? snapTransition : transitionsOverride?.overlayHighlightCollapse ?? DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION;
3264
+ const overlayTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _133 => _133.overlayFade]), () => ( adapter.transitions.overlayFade)), () => ( DEFAULT_OVERLAY_TRANSITION));
3265
+ const highlightCollapseTransition = highlight.isScreen ? snapTransition : _nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _134 => _134.overlayHighlightCollapse]), () => ( DEFAULT_HIGHLIGHT_COLLAPSE_TRANSITION));
3498
3266
  const highlightRectTransition = hasHighlightBounds ? resolvedHighlightTransition : highlightCollapseTransition;
3499
3267
  const highlightRectAnimation = shouldMask ? {
3500
- x: highlight.rect?.left ?? highlight.centerX,
3501
- y: highlight.rect?.top ?? highlight.centerY,
3502
- width: highlight.rect?.width ?? 0,
3503
- height: highlight.rect?.height ?? 0,
3504
- rx: highlight.rect?.radius ?? 0,
3505
- ry: highlight.rect?.radius ?? 0
3268
+ x: _nullishCoalesce(_optionalChain([highlight, 'access', _135 => _135.rect, 'optionalAccess', _136 => _136.left]), () => ( highlight.centerX)),
3269
+ y: _nullishCoalesce(_optionalChain([highlight, 'access', _137 => _137.rect, 'optionalAccess', _138 => _138.top]), () => ( highlight.centerY)),
3270
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _139 => _139.rect, 'optionalAccess', _140 => _140.width]), () => ( 0)),
3271
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _141 => _141.rect, 'optionalAccess', _142 => _142.height]), () => ( 0)),
3272
+ rx: _nullishCoalesce(_optionalChain([highlight, 'access', _143 => _143.rect, 'optionalAccess', _144 => _144.radius]), () => ( 0)),
3273
+ ry: _nullishCoalesce(_optionalChain([highlight, 'access', _145 => _145.rect, 'optionalAccess', _146 => _146.radius]), () => ( 0))
3506
3274
  } : {
3507
3275
  x: highlight.centerX,
3508
3276
  y: highlight.centerY,
@@ -3514,9 +3282,9 @@ var OverlayBackdrop = ({
3514
3282
  const highlightRingAnimation = hasHighlightBounds ? {
3515
3283
  top: highlight.centerY,
3516
3284
  left: highlight.centerX,
3517
- width: highlight.rect?.width ?? 0,
3518
- height: highlight.rect?.height ?? 0,
3519
- borderRadius: highlight.rect?.radius ?? 0,
3285
+ width: _nullishCoalesce(_optionalChain([highlight, 'access', _147 => _147.rect, 'optionalAccess', _148 => _148.width]), () => ( 0)),
3286
+ height: _nullishCoalesce(_optionalChain([highlight, 'access', _149 => _149.rect, 'optionalAccess', _150 => _150.height]), () => ( 0)),
3287
+ borderRadius: _nullishCoalesce(_optionalChain([highlight, 'access', _151 => _151.rect, 'optionalAccess', _152 => _152.radius]), () => ( 0)),
3520
3288
  opacity: 1,
3521
3289
  transform: "translate(-50%, -50%)"
3522
3290
  } : {
@@ -3542,8 +3310,8 @@ var OverlayBackdrop = ({
3542
3310
  if (color) {
3543
3311
  overlayStyle.backgroundColor = color;
3544
3312
  }
3545
- return (0, import_react_dom.createPortal)(
3546
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3313
+ return _reactdom.createPortal.call(void 0,
3314
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3547
3315
  MotionDiv,
3548
3316
  {
3549
3317
  className: rootClassName,
@@ -3551,7 +3319,7 @@ var OverlayBackdrop = ({
3551
3319
  "aria-hidden": ariaHidden,
3552
3320
  "data-tour-overlay": "",
3553
3321
  children: [
3554
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react24.AnimatePresence, { mode: "popLayout", children: shouldMask ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: shouldMask ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3555
3323
  MotionSvg,
3556
3324
  {
3557
3325
  width: "0",
@@ -3563,10 +3331,10 @@ var OverlayBackdrop = ({
3563
3331
  animate: { opacity: 1 },
3564
3332
  exit: { opacity: 0 },
3565
3333
  transition: overlayTransition,
3566
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MotionDefs, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3334
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MotionDefs, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3567
3335
  MotionMask,
3568
3336
  {
3569
- id: maskId ?? void 0,
3337
+ id: _nullishCoalesce(maskId, () => ( void 0)),
3570
3338
  initial: false,
3571
3339
  maskUnits: "userSpaceOnUse",
3572
3340
  maskContentUnits: "userSpaceOnUse",
@@ -3575,7 +3343,7 @@ var OverlayBackdrop = ({
3575
3343
  animate: { width: viewport.width, height: viewport.height },
3576
3344
  transition: highlightTransition,
3577
3345
  children: [
3578
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3579
3347
  MotionRect,
3580
3348
  {
3581
3349
  x: "0",
@@ -3591,7 +3359,7 @@ var OverlayBackdrop = ({
3591
3359
  exit: { opacity: 0 }
3592
3360
  }
3593
3361
  ),
3594
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3362
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3595
3363
  MotionRect,
3596
3364
  {
3597
3365
  initial: false,
@@ -3610,7 +3378,7 @@ var OverlayBackdrop = ({
3610
3378
  },
3611
3379
  "tour-mask"
3612
3380
  ) : null }),
3613
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react24.AnimatePresence, { mode: "popLayout", children: showBaseOverlay ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3381
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: showBaseOverlay ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3614
3382
  MotionDiv,
3615
3383
  {
3616
3384
  className: overlayClassName,
@@ -3619,7 +3387,7 @@ var OverlayBackdrop = ({
3619
3387
  ...styles.overlay,
3620
3388
  ...overlayStyle,
3621
3389
  zIndex,
3622
- backgroundColor: color ?? void 0
3390
+ backgroundColor: _nullishCoalesce(color, () => ( void 0))
3623
3391
  },
3624
3392
  initial: {
3625
3393
  opacity: 0,
@@ -3638,7 +3406,7 @@ var OverlayBackdrop = ({
3638
3406
  },
3639
3407
  "tour-overlay"
3640
3408
  ) : null }),
3641
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react24.AnimatePresence, { mode: "popLayout", children: fallbackSegments ? fallbackSegments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3409
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: fallbackSegments ? fallbackSegments.map((segment) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3642
3410
  MotionDiv,
3643
3411
  {
3644
3412
  className: segmentClassName,
@@ -3650,7 +3418,7 @@ var OverlayBackdrop = ({
3650
3418
  left: segment.left,
3651
3419
  width: segment.width,
3652
3420
  height: segment.height,
3653
- backgroundColor: color ?? void 0
3421
+ backgroundColor: _nullishCoalesce(color, () => ( void 0))
3654
3422
  },
3655
3423
  initial: {
3656
3424
  opacity: 0,
@@ -3668,13 +3436,13 @@ var OverlayBackdrop = ({
3668
3436
  },
3669
3437
  `tour-overlay-fallback-${segment.key}`
3670
3438
  )) : null }),
3671
- showInteractionBlocker && blockerSegments ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3439
+ showInteractionBlocker && blockerSegments ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3672
3440
  "div",
3673
3441
  {
3674
3442
  style: { ...styles.blockerContainer, zIndex },
3675
3443
  "data-tour-overlay-layer": "interaction-blocker",
3676
3444
  "aria-hidden": true,
3677
- children: blockerSegments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3445
+ children: blockerSegments.map((segment) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3678
3446
  "div",
3679
3447
  {
3680
3448
  style: {
@@ -3689,7 +3457,7 @@ var OverlayBackdrop = ({
3689
3457
  ))
3690
3458
  }
3691
3459
  ) : null,
3692
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react24.AnimatePresence, { mode: "popLayout", children: showHighlightRing && isActive && hasHighlightBounds ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3460
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react3.AnimatePresence, { mode: "popLayout", children: showHighlightRing && isActive && hasHighlightBounds ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3693
3461
  MotionDiv,
3694
3462
  {
3695
3463
  className: ringClassName,
@@ -3720,9 +3488,15 @@ var OverlayBackdrop = ({
3720
3488
  };
3721
3489
 
3722
3490
  // src/components/TourPopoverPortal.tsx
3723
- var import_react25 = require("react");
3724
- var import_react_dom2 = require("react-dom");
3725
- var import_dom13 = require("@floating-ui/dom");
3491
+
3492
+
3493
+
3494
+
3495
+
3496
+
3497
+
3498
+
3499
+ var _dom = require('@floating-ui/dom');
3726
3500
  var FLOATING_OFFSET = 8;
3727
3501
  var DOCKED_MARGIN = 24;
3728
3502
  var MOBILE_BREAKPOINT = 640;
@@ -3768,52 +3542,53 @@ var TourPopoverPortal = ({
3768
3542
  layoutId,
3769
3543
  containerComponent,
3770
3544
  contentComponent,
3771
- transitionsOverride
3545
+ transitionsOverride,
3546
+ isInGracePeriod = false
3772
3547
  }) => {
3773
- if (!isBrowser) return null;
3774
- const host = portalHost();
3548
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
3549
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
3775
3550
  if (!host) return null;
3776
3551
  const adapter = useAnimationAdapter();
3777
- const Container = containerComponent ?? adapter.components.MotionDiv;
3778
- const Content = contentComponent ?? adapter.components.MotionDiv;
3779
- const popoverEntranceTransition = transitionsOverride?.popoverEntrance ?? adapter.transitions.popoverEntrance ?? DEFAULT_POPOVER_ENTRANCE_TRANSITION;
3780
- const popoverExitTransition = transitionsOverride?.popoverExit ?? adapter.transitions.popoverExit ?? DEFAULT_POPOVER_EXIT_TRANSITION;
3781
- const popoverContentTransition = transitionsOverride?.popoverContent ?? adapter.transitions.popoverContent ?? DEFAULT_POPOVER_CONTENT_TRANSITION;
3552
+ const Container = _nullishCoalesce(containerComponent, () => ( adapter.components.MotionDiv));
3553
+ const Content = _nullishCoalesce(contentComponent, () => ( adapter.components.MotionDiv));
3554
+ const popoverEntranceTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _153 => _153.popoverEntrance]), () => ( adapter.transitions.popoverEntrance)), () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION));
3555
+ const popoverExitTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _154 => _154.popoverExit]), () => ( adapter.transitions.popoverExit)), () => ( DEFAULT_POPOVER_EXIT_TRANSITION));
3556
+ const popoverContentTransition = _nullishCoalesce(_nullishCoalesce(_optionalChain([transitionsOverride, 'optionalAccess', _155 => _155.popoverContent]), () => ( adapter.transitions.popoverContent)), () => ( DEFAULT_POPOVER_CONTENT_TRANSITION));
3782
3557
  const viewport = useViewportRect();
3783
3558
  const prefersMobileLayout = viewport.width <= MOBILE_BREAKPOINT || viewport.height <= MOBILE_HEIGHT_BREAKPOINT;
3784
- const prefersMobileRef = (0, import_react25.useRef)(prefersMobileLayout);
3785
- (0, import_react25.useEffect)(() => {
3559
+ const prefersMobileRef = _react.useRef.call(void 0, prefersMobileLayout);
3560
+ _react.useEffect.call(void 0, () => {
3786
3561
  prefersMobileRef.current = prefersMobileLayout;
3787
3562
  }, [prefersMobileLayout]);
3788
- const lastReadyTargetRef = (0, import_react25.useRef)(null);
3789
- (0, import_react25.useEffect)(() => {
3563
+ const lastReadyTargetRef = _react.useRef.call(void 0, null);
3564
+ _react.useEffect.call(void 0, () => {
3790
3565
  if (target.status === "ready" && target.rect) {
3791
3566
  lastReadyTargetRef.current = {
3792
3567
  rect: { ...target.rect },
3793
3568
  isScreen: target.isScreen
3794
3569
  };
3795
- } else if (target.status === "idle") {
3570
+ } else if (target.status === "idle" && !isInGracePeriod) {
3796
3571
  lastReadyTargetRef.current = null;
3797
3572
  }
3798
- }, [target.isScreen, target.rect, target.status]);
3573
+ }, [target.isScreen, target.rect, target.status, isInGracePeriod]);
3799
3574
  const cachedTarget = lastReadyTargetRef.current;
3800
- const resolvedRect = target.rect ?? target.lastResolvedRect ?? cachedTarget?.rect ?? null;
3801
- const resolvedIsScreen = target.status === "ready" ? target.isScreen : cachedTarget?.isScreen ?? target.isScreen;
3575
+ const resolvedRect = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(target.rect, () => ( target.lastResolvedRect)), () => ( _optionalChain([cachedTarget, 'optionalAccess', _156 => _156.rect]))), () => ( null));
3576
+ const resolvedIsScreen = target.status === "ready" ? target.isScreen : _nullishCoalesce(_optionalChain([cachedTarget, 'optionalAccess', _157 => _157.isScreen]), () => ( target.isScreen));
3802
3577
  const shouldHidePopover = !resolvedRect && !target.isScreen;
3803
- const fallbackRect = resolvedRect ?? viewport;
3578
+ const fallbackRect = _nullishCoalesce(resolvedRect, () => ( viewport));
3804
3579
  const fallbackIsScreen = resolvedIsScreen;
3805
- const [floatingSize, setFloatingSize] = (0, import_react25.useState)(null);
3580
+ const [floatingSize, setFloatingSize] = _react.useState.call(void 0, null);
3806
3581
  const clampVertical = (value) => Math.min(viewport.height - 24, Math.max(24, value));
3807
3582
  const clampHorizontal = (value) => Math.min(viewport.width - 24, Math.max(24, value));
3808
- const screenCenteredTop = viewport.height / 2 - (floatingSize?.height ?? 0) / 2;
3809
- const screenCenteredLeft = viewport.width / 2 - (floatingSize?.width ?? 0) / 2;
3810
- const floatingWidth = floatingSize?.width ?? 0;
3583
+ const screenCenteredTop = viewport.height / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _158 => _158.height]), () => ( 0))) / 2;
3584
+ const screenCenteredLeft = viewport.width / 2 - (_nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _159 => _159.width]), () => ( 0))) / 2;
3585
+ const floatingWidth = _nullishCoalesce(_optionalChain([floatingSize, 'optionalAccess', _160 => _160.width]), () => ( 0));
3811
3586
  const baseTop = fallbackIsScreen ? screenCenteredTop : fallbackRect.top + fallbackRect.height + offset;
3812
3587
  const top = fallbackIsScreen ? clampVertical(screenCenteredTop) : clampVertical(baseTop);
3813
3588
  const leftBase = fallbackIsScreen ? screenCenteredLeft : fallbackRect.left + fallbackRect.width / 2 - floatingWidth / 2;
3814
3589
  const left = clampHorizontal(leftBase);
3815
3590
  const fallbackTransform = "translate3d(0px, 0px, 0px)";
3816
- const fallbackPosition = (0, import_react25.useMemo)(
3591
+ const fallbackPosition = _react.useMemo.call(void 0,
3817
3592
  () => ({
3818
3593
  top,
3819
3594
  left,
@@ -3821,7 +3596,7 @@ var TourPopoverPortal = ({
3821
3596
  }),
3822
3597
  [fallbackTransform, left, top]
3823
3598
  );
3824
- const centerInitialPosition = (0, import_react25.useMemo)(
3599
+ const centerInitialPosition = _react.useMemo.call(void 0,
3825
3600
  () => ({
3826
3601
  top: viewport.height / 2,
3827
3602
  left: viewport.width / 2,
@@ -3829,24 +3604,24 @@ var TourPopoverPortal = ({
3829
3604
  }),
3830
3605
  [viewport.height, viewport.width]
3831
3606
  );
3832
- const floatingRef = (0, import_react25.useRef)(null);
3833
- const cachedFloatingPositionRef = (0, import_react25.useRef)(null);
3834
- const appliedFloatingCacheRef = (0, import_react25.useRef)(null);
3835
- const deferredScreenSnapRef = (0, import_react25.useRef)(null);
3836
- const [layoutMode, setLayoutMode] = (0, import_react25.useState)(
3607
+ const floatingRef = _react.useRef.call(void 0, null);
3608
+ const cachedFloatingPositionRef = _react.useRef.call(void 0, null);
3609
+ const appliedFloatingCacheRef = _react.useRef.call(void 0, null);
3610
+ const deferredScreenSnapRef = _react.useRef.call(void 0, null);
3611
+ const [layoutMode, setLayoutMode] = _react.useState.call(void 0,
3837
3612
  () => prefersMobileLayout ? "mobile" : "floating"
3838
3613
  );
3839
- const [floatingPosition, setFloatingPosition] = (0, import_react25.useState)(fallbackPosition);
3840
- const [dragPosition, setDragPosition] = (0, import_react25.useState)(null);
3841
- const [isDragging, setIsDragging] = (0, import_react25.useState)(false);
3842
- const dragStateRef = (0, import_react25.useRef)(null);
3843
- const overflowRetryRef = (0, import_react25.useRef)({
3614
+ const [floatingPosition, setFloatingPosition] = _react.useState.call(void 0, fallbackPosition);
3615
+ const [dragPosition, setDragPosition] = _react.useState.call(void 0, null);
3616
+ const [isDragging, setIsDragging] = _react.useState.call(void 0, false);
3617
+ const dragStateRef = _react.useRef.call(void 0, null);
3618
+ const overflowRetryRef = _react.useRef.call(void 0, {
3844
3619
  stepId: null,
3845
3620
  attempts: 0
3846
3621
  });
3847
- const overflowRetryTimeoutRef = (0, import_react25.useRef)(null);
3848
- (0, import_react25.useLayoutEffect)(() => {
3849
- if (!isBrowser) return;
3622
+ const overflowRetryTimeoutRef = _react.useRef.call(void 0, null);
3623
+ _react.useLayoutEffect.call(void 0, () => {
3624
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
3850
3625
  const node = floatingRef.current;
3851
3626
  if (!node) return;
3852
3627
  const updateSize = () => {
@@ -3859,30 +3634,30 @@ var TourPopoverPortal = ({
3859
3634
  observer.observe(node);
3860
3635
  return () => observer.disconnect();
3861
3636
  }, [target.stepId]);
3862
- const resolvedPlacement = placement ?? "bottom";
3637
+ const resolvedPlacement = _nullishCoalesce(placement, () => ( "bottom"));
3863
3638
  const isAutoPlacement = resolvedPlacement.startsWith("auto");
3864
3639
  const autoAlignment = resolvedPlacement.endsWith(
3865
3640
  "-start"
3866
3641
  ) ? "start" : resolvedPlacement.endsWith("-end") ? "end" : void 0;
3867
- (0, import_react25.useEffect)(() => {
3642
+ _react.useEffect.call(void 0, () => {
3868
3643
  setDragPosition(null);
3869
3644
  setLayoutMode(prefersMobileRef.current ? "mobile" : "floating");
3870
3645
  cachedFloatingPositionRef.current = null;
3871
3646
  appliedFloatingCacheRef.current = null;
3872
3647
  }, [target.stepId]);
3873
- (0, import_react25.useEffect)(() => {
3648
+ _react.useEffect.call(void 0, () => {
3874
3649
  if (layoutMode !== "manual") {
3875
3650
  setDragPosition(null);
3876
3651
  }
3877
3652
  }, [layoutMode]);
3878
- (0, import_react25.useEffect)(() => {
3653
+ _react.useEffect.call(void 0, () => {
3879
3654
  cachedFloatingPositionRef.current = floatingPosition;
3880
3655
  const cacheKey = getFloatingCacheKey(target);
3881
3656
  if (cacheKey) {
3882
3657
  floatingPositionCache.set(cacheKey, floatingPosition);
3883
3658
  }
3884
3659
  }, [floatingPosition, target.isScreen, target.stepId]);
3885
- const dockedPosition = (0, import_react25.useMemo)(
3660
+ const dockedPosition = _react.useMemo.call(void 0,
3886
3661
  () => ({
3887
3662
  top: viewport.height - DOCKED_MARGIN,
3888
3663
  left: viewport.width - DOCKED_MARGIN,
@@ -3890,7 +3665,7 @@ var TourPopoverPortal = ({
3890
3665
  }),
3891
3666
  [viewport.height, viewport.width]
3892
3667
  );
3893
- const mobilePosition = (0, import_react25.useMemo)(
3668
+ const mobilePosition = _react.useMemo.call(void 0,
3894
3669
  () => ({
3895
3670
  top: viewport.height - MOBILE_HORIZONTAL_GUTTER,
3896
3671
  left: viewport.width / 2,
@@ -3898,17 +3673,17 @@ var TourPopoverPortal = ({
3898
3673
  }),
3899
3674
  [viewport.height, viewport.width]
3900
3675
  );
3901
- (0, import_react25.useEffect)(() => {
3676
+ _react.useEffect.call(void 0, () => {
3902
3677
  if (layoutMode === "docked") {
3903
3678
  setFloatingPosition(dockedPosition);
3904
3679
  }
3905
3680
  }, [dockedPosition, layoutMode]);
3906
- (0, import_react25.useEffect)(() => {
3681
+ _react.useEffect.call(void 0, () => {
3907
3682
  if (layoutMode === "mobile") {
3908
3683
  setFloatingPosition(mobilePosition);
3909
3684
  }
3910
3685
  }, [layoutMode, mobilePosition]);
3911
- (0, import_react25.useEffect)(() => {
3686
+ _react.useEffect.call(void 0, () => {
3912
3687
  if (prefersMobileLayout) {
3913
3688
  if (layoutMode !== "mobile") {
3914
3689
  setLayoutMode("mobile");
@@ -3921,13 +3696,13 @@ var TourPopoverPortal = ({
3921
3696
  setFloatingPosition(fallbackPosition);
3922
3697
  }
3923
3698
  }, [fallbackPosition, layoutMode, prefersMobileLayout]);
3924
- (0, import_react25.useEffect)(() => {
3699
+ _react.useEffect.call(void 0, () => {
3925
3700
  if (layoutMode !== "floating") return;
3926
3701
  const stepId = target.stepId;
3927
3702
  if (!stepId) return;
3928
3703
  if (appliedFloatingCacheRef.current === stepId) return;
3929
3704
  const cacheKey = getFloatingCacheKey(target);
3930
- const cached = cacheKey ? floatingPositionCache.get(cacheKey) ?? null : null;
3705
+ const cached = cacheKey ? _nullishCoalesce(floatingPositionCache.get(cacheKey), () => ( null)) : null;
3931
3706
  if (cached) {
3932
3707
  appliedFloatingCacheRef.current = stepId;
3933
3708
  setFloatingPosition(cached);
@@ -3945,7 +3720,7 @@ var TourPopoverPortal = ({
3945
3720
  target.stepId
3946
3721
  ]);
3947
3722
  const shouldDeferScreenSnap = layoutMode === "floating" && target.isScreen && Boolean(layoutId);
3948
- (0, import_react25.useEffect)(() => {
3723
+ _react.useEffect.call(void 0, () => {
3949
3724
  return () => {
3950
3725
  if (deferredScreenSnapRef.current !== null) {
3951
3726
  cancelAnimationFrame(deferredScreenSnapRef.current);
@@ -3953,7 +3728,7 @@ var TourPopoverPortal = ({
3953
3728
  }
3954
3729
  };
3955
3730
  }, []);
3956
- (0, import_react25.useLayoutEffect)(() => {
3731
+ _react.useLayoutEffect.call(void 0, () => {
3957
3732
  if (layoutMode !== "floating") return;
3958
3733
  if (target.status === "ready" && !target.isScreen) return;
3959
3734
  if (shouldDeferScreenSnap) return;
@@ -3965,7 +3740,7 @@ var TourPopoverPortal = ({
3965
3740
  target.isScreen,
3966
3741
  target.status
3967
3742
  ]);
3968
- (0, import_react25.useEffect)(() => {
3743
+ _react.useEffect.call(void 0, () => {
3969
3744
  if (!shouldDeferScreenSnap) return;
3970
3745
  if (deferredScreenSnapRef.current !== null) {
3971
3746
  cancelAnimationFrame(deferredScreenSnapRef.current);
@@ -3992,15 +3767,15 @@ var TourPopoverPortal = ({
3992
3767
  }
3993
3768
  };
3994
3769
  }, [fallbackPosition, shouldDeferScreenSnap]);
3995
- (0, import_react25.useEffect)(() => {
3770
+ _react.useEffect.call(void 0, () => {
3996
3771
  return () => {
3997
3772
  if (overflowRetryTimeoutRef.current !== null) {
3998
3773
  window.clearTimeout(overflowRetryTimeoutRef.current);
3999
3774
  }
4000
3775
  };
4001
3776
  }, []);
4002
- (0, import_react25.useLayoutEffect)(() => {
4003
- if (!isBrowser) return;
3777
+ _react.useLayoutEffect.call(void 0, () => {
3778
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
4004
3779
  const floatingEl = floatingRef.current;
4005
3780
  const rectInfo = target.rect;
4006
3781
  if (!floatingEl) return;
@@ -4009,7 +3784,7 @@ var TourPopoverPortal = ({
4009
3784
  if (layoutMode === "mobile" || layoutMode === "manual") return;
4010
3785
  const cancelState = { cancelled: false };
4011
3786
  const retryState = overflowRetryRef.current;
4012
- const currentStepId = target.stepId ?? null;
3787
+ const currentStepId = _nullishCoalesce(target.stepId, () => ( null));
4013
3788
  if (retryState.stepId !== currentStepId) {
4014
3789
  retryState.stepId = currentStepId;
4015
3790
  retryState.attempts = 0;
@@ -4021,7 +3796,7 @@ var TourPopoverPortal = ({
4021
3796
  }
4022
3797
  };
4023
3798
  const virtualReference = {
4024
- contextElement: target.element ?? void 0,
3799
+ contextElement: _nullishCoalesce(target.element, () => ( void 0)),
4025
3800
  getBoundingClientRect: () => DOMRectReadOnly.fromRect({
4026
3801
  width: rectInfo.width,
4027
3802
  height: rectInfo.height,
@@ -4031,31 +3806,31 @@ var TourPopoverPortal = ({
4031
3806
  };
4032
3807
  const computePlacement = isAutoPlacement ? void 0 : resolvedPlacement;
4033
3808
  const middleware = [
4034
- (0, import_dom13.offset)(offset),
3809
+ _dom.offset.call(void 0, offset),
4035
3810
  ...isAutoPlacement ? [
4036
- (0, import_dom13.autoPlacement)({
3811
+ _dom.autoPlacement.call(void 0, {
4037
3812
  padding: FLOATING_OFFSET,
4038
3813
  alignment: autoAlignment
4039
3814
  })
4040
3815
  ] : [
4041
- (0, import_dom13.flip)({
3816
+ _dom.flip.call(void 0, {
4042
3817
  padding: FLOATING_OFFSET,
4043
3818
  fallbackStrategy: "bestFit",
4044
3819
  crossAxis: true,
4045
3820
  fallbackPlacements: ["bottom", "top", "right", "left"]
4046
3821
  })
4047
3822
  ],
4048
- (0, import_dom13.shift)({ padding: FLOATING_OFFSET })
3823
+ _dom.shift.call(void 0, { padding: FLOATING_OFFSET })
4049
3824
  ];
4050
3825
  const updatePosition = async () => {
4051
- const { x, y } = await (0, import_dom13.computePosition)(virtualReference, floatingEl, {
3826
+ const { x, y } = await _dom.computePosition.call(void 0, virtualReference, floatingEl, {
4052
3827
  placement: computePlacement,
4053
3828
  strategy: "fixed",
4054
3829
  middleware
4055
3830
  });
4056
3831
  if (cancelState.cancelled) return;
4057
3832
  const floatingBox = floatingEl.getBoundingClientRect();
4058
- const viewportRect = getViewportRect();
3833
+ const viewportRect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
4059
3834
  const viewportTop = viewportRect.top;
4060
3835
  const viewportBottom = viewportRect.top + viewportRect.height;
4061
3836
  const viewportLeft = viewportRect.left;
@@ -4141,7 +3916,7 @@ var TourPopoverPortal = ({
4141
3916
  target.status,
4142
3917
  target.stepId
4143
3918
  ]);
4144
- (0, import_react25.useLayoutEffect)(() => {
3919
+ _react.useLayoutEffect.call(void 0, () => {
4145
3920
  if (layoutMode !== "manual" || !dragPosition) return;
4146
3921
  setFloatingPosition({
4147
3922
  top: dragPosition.top,
@@ -4150,10 +3925,10 @@ var TourPopoverPortal = ({
4150
3925
  });
4151
3926
  }, [dragPosition, layoutMode]);
4152
3927
  const clampToViewport = (rawLeft, rawTop) => {
4153
- const rect = getViewportRect();
3928
+ const rect = _chunkD5LQLRSUcjs.getViewportRect.call(void 0, );
4154
3929
  const floatingEl = floatingRef.current;
4155
- const floatingElWidth = floatingEl?.offsetWidth ?? 0;
4156
- const floatingElHeight = floatingEl?.offsetHeight ?? 0;
3930
+ const floatingElWidth = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _161 => _161.offsetWidth]), () => ( 0));
3931
+ const floatingElHeight = _nullishCoalesce(_optionalChain([floatingEl, 'optionalAccess', _162 => _162.offsetHeight]), () => ( 0));
4157
3932
  const minLeft = rect.left + FLOATING_OFFSET;
4158
3933
  const maxLeft = rect.left + rect.width - floatingElWidth - FLOATING_OFFSET;
4159
3934
  const minTop = rect.top + FLOATING_OFFSET;
@@ -4190,7 +3965,7 @@ var TourPopoverPortal = ({
4190
3965
  if (supportsRelease && hasCapture) {
4191
3966
  try {
4192
3967
  floatingEl.releasePointerCapture(dragState.pointerId);
4193
- } catch {
3968
+ } catch (e4) {
4194
3969
  }
4195
3970
  }
4196
3971
  }
@@ -4221,16 +3996,16 @@ var TourPopoverPortal = ({
4221
3996
  if (supportsPointerCapture) {
4222
3997
  try {
4223
3998
  floatingEl.setPointerCapture(event.pointerId);
4224
- } catch {
3999
+ } catch (e5) {
4225
4000
  }
4226
4001
  }
4227
4002
  event.preventDefault();
4228
4003
  };
4229
- (0, import_react25.useEffect)(() => endDrag, []);
4004
+ _react.useEffect.call(void 0, () => endDrag, []);
4230
4005
  const shouldUseFallbackInitial = layoutMode !== "mobile" && (Boolean(target.lastResolvedRect) || Boolean(cachedTarget));
4231
4006
  const floatingCacheKey = layoutMode === "mobile" ? null : getFloatingCacheKey(target);
4232
- const persistedFloatingInitial = floatingCacheKey && floatingPositionCache.has(floatingCacheKey) ? floatingPositionCache.get(floatingCacheKey) ?? null : null;
4233
- const cachedFloatingInitial = layoutMode === "mobile" ? null : cachedFloatingPositionRef.current ?? persistedFloatingInitial;
4007
+ const persistedFloatingInitial = floatingCacheKey && floatingPositionCache.has(floatingCacheKey) ? _nullishCoalesce(floatingPositionCache.get(floatingCacheKey), () => ( null)) : null;
4008
+ const cachedFloatingInitial = layoutMode === "mobile" ? null : _nullishCoalesce(cachedFloatingPositionRef.current, () => ( persistedFloatingInitial));
4234
4009
  const hasCachedFloatingInitial = Boolean(cachedFloatingInitial);
4235
4010
  const resolvedInitialPosition = layoutMode === "mobile" ? mobilePosition : hasCachedFloatingInitial && cachedFloatingInitial ? cachedFloatingInitial : shouldUseFallbackInitial ? fallbackPosition : centerInitialPosition;
4236
4011
  const initialTop = resolvedInitialPosition.top;
@@ -4246,12 +4021,12 @@ var TourPopoverPortal = ({
4246
4021
  };
4247
4022
  const setFloatingNode = (node) => {
4248
4023
  floatingRef.current = node;
4249
- onContainerChange?.(node);
4024
+ _optionalChain([onContainerChange, 'optionalCall', _163 => _163(node)]);
4250
4025
  };
4251
4026
  const containerProps = {
4252
4027
  ref: setFloatingNode,
4253
- role: role ?? "dialog",
4254
- "aria-modal": ariaModal ?? false,
4028
+ role: _nullishCoalesce(role, () => ( "dialog")),
4029
+ "aria-modal": _nullishCoalesce(ariaModal, () => ( false)),
4255
4030
  "aria-label": ariaLabel,
4256
4031
  "aria-describedby": ariaDescribedBy,
4257
4032
  tabIndex: -1,
@@ -4284,7 +4059,7 @@ var TourPopoverPortal = ({
4284
4059
  ...layoutId ? { layoutId } : {}
4285
4060
  };
4286
4061
  const contentProps = {
4287
- key: target.stepId ?? void 0,
4062
+ key: _nullishCoalesce(target.stepId, () => ( void 0)),
4288
4063
  "data-tour-popover-content": "",
4289
4064
  initial: { opacity: 0, translateX: 0, filter: "blur(4px)" },
4290
4065
  animate: { opacity: 1, translateX: 0, filter: "blur(0px)" },
@@ -4314,12 +4089,12 @@ var TourPopoverPortal = ({
4314
4089
  descriptionProps
4315
4090
  };
4316
4091
  if (shouldHidePopover) return null;
4317
- return (0, import_react_dom2.createPortal)(children(context), host);
4092
+ return _reactdom.createPortal.call(void 0, children(context), host);
4318
4093
  };
4319
4094
 
4320
4095
  // src/components/TourFocusManager.tsx
4321
- var import_react26 = require("react");
4322
- var import_react_dom3 = require("react-dom");
4096
+
4097
+
4323
4098
 
4324
4099
  // src/utils/focus.ts
4325
4100
  var FOCUSABLE_SELECTOR = 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]';
@@ -4373,13 +4148,13 @@ var getFocusableIn = (root) => {
4373
4148
  var focusElement = (element, options) => {
4374
4149
  if (!element) return;
4375
4150
  try {
4376
- element.focus(options ?? { preventScroll: true });
4377
- } catch {
4151
+ element.focus(_nullishCoalesce(options, () => ( { preventScroll: true })));
4152
+ } catch (e6) {
4378
4153
  }
4379
4154
  };
4380
4155
 
4381
4156
  // src/components/TourFocusManager.tsx
4382
- var import_jsx_runtime5 = require("react/jsx-runtime");
4157
+
4383
4158
  var runMicrotask = (callback) => {
4384
4159
  if (typeof queueMicrotask === "function") {
4385
4160
  queueMicrotask(callback);
@@ -4395,18 +4170,18 @@ var TourFocusManager = ({
4395
4170
  highlightRect,
4396
4171
  guardElementFocusRing
4397
4172
  }) => {
4398
- const previousFocusRef = (0, import_react26.useRef)(null);
4399
- const guardNodesRef = (0, import_react26.useRef)({
4173
+ const previousFocusRef = _react.useRef.call(void 0, null);
4174
+ const guardNodesRef = _react.useRef.call(void 0, {
4400
4175
  "target-start": null,
4401
4176
  "target-end": null,
4402
4177
  "popover-start": null,
4403
4178
  "popover-end": null
4404
4179
  });
4405
- const lastTabDirectionRef = (0, import_react26.useRef)("forward");
4406
- const suppressGuardHopRef = (0, import_react26.useRef)(null);
4407
- const [targetRingActive, setTargetRingActive] = (0, import_react26.useState)(false);
4408
- const [popoverRingActive, setPopoverRingActive] = (0, import_react26.useState)(false);
4409
- const [popoverRect, setPopoverRect] = (0, import_react26.useState)(null);
4180
+ const lastTabDirectionRef = _react.useRef.call(void 0, "forward");
4181
+ const suppressGuardHopRef = _react.useRef.call(void 0, null);
4182
+ const [targetRingActive, setTargetRingActive] = _react.useState.call(void 0, false);
4183
+ const [popoverRingActive, setPopoverRingActive] = _react.useState.call(void 0, false);
4184
+ const [popoverRect, setPopoverRect] = _react.useState.call(void 0, null);
4410
4185
  const restoreFocus = () => {
4411
4186
  const previous = previousFocusRef.current;
4412
4187
  previousFocusRef.current = null;
@@ -4416,15 +4191,15 @@ var TourFocusManager = ({
4416
4191
  });
4417
4192
  }
4418
4193
  };
4419
- (0, import_react26.useLayoutEffect)(() => {
4420
- if (!isBrowser) return;
4194
+ _react.useLayoutEffect.call(void 0, () => {
4195
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
4421
4196
  if (!active) {
4422
4197
  restoreFocus();
4423
4198
  return;
4424
4199
  }
4425
4200
  if (previousFocusRef.current) return;
4426
- const doc = popoverNode?.ownerDocument ?? target.element?.ownerDocument;
4427
- const activeEl = (doc ?? document).activeElement;
4201
+ const doc = _nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _164 => _164.ownerDocument]), () => ( _optionalChain([target, 'access', _165 => _165.element, 'optionalAccess', _166 => _166.ownerDocument])));
4202
+ const activeEl = (_nullishCoalesce(doc, () => ( document))).activeElement;
4428
4203
  if (activeEl instanceof HTMLElement) {
4429
4204
  previousFocusRef.current = activeEl;
4430
4205
  }
@@ -4432,10 +4207,10 @@ var TourFocusManager = ({
4432
4207
  restoreFocus();
4433
4208
  };
4434
4209
  }, [active, popoverNode, target.element]);
4435
- (0, import_react26.useEffect)(() => {
4436
- if (!isBrowser) return;
4210
+ _react.useEffect.call(void 0, () => {
4211
+ if (!_chunkD5LQLRSUcjs.isBrowser) return;
4437
4212
  if (!active) return;
4438
- const doc = popoverNode?.ownerDocument ?? target.element?.ownerDocument ?? document;
4213
+ const doc = _nullishCoalesce(_nullishCoalesce(_optionalChain([popoverNode, 'optionalAccess', _167 => _167.ownerDocument]), () => ( _optionalChain([target, 'access', _168 => _168.element, 'optionalAccess', _169 => _169.ownerDocument]))), () => ( document));
4439
4214
  const createGuard = (key) => {
4440
4215
  const node = doc.createElement("div");
4441
4216
  node.tabIndex = 0;
@@ -4465,7 +4240,7 @@ var TourFocusManager = ({
4465
4240
  const removeGuards = () => {
4466
4241
  for (const key of Object.keys(guardNodesRef.current)) {
4467
4242
  const node = guardNodesRef.current[key];
4468
- if (node?.parentNode) {
4243
+ if (_optionalChain([node, 'optionalAccess', _170 => _170.parentNode])) {
4469
4244
  node.parentNode.removeChild(node);
4470
4245
  }
4471
4246
  guardNodesRef.current[key] = null;
@@ -4474,7 +4249,7 @@ var TourFocusManager = ({
4474
4249
  };
4475
4250
  const ensureGuards = () => {
4476
4251
  const targetElement = !target.isScreen && target.element instanceof HTMLElement ? target.element : null;
4477
- const popoverElement = popoverNode ?? null;
4252
+ const popoverElement = _nullishCoalesce(popoverNode, () => ( null));
4478
4253
  if (targetElement) {
4479
4254
  if (!guardNodesRef.current["target-start"]) {
4480
4255
  guardNodesRef.current["target-start"] = createGuard("target-start");
@@ -4493,7 +4268,7 @@ var TourFocusManager = ({
4493
4268
  } else {
4494
4269
  for (const key of ["target-start", "target-end"]) {
4495
4270
  const node = guardNodesRef.current[key];
4496
- if (node?.parentNode) {
4271
+ if (_optionalChain([node, 'optionalAccess', _171 => _171.parentNode])) {
4497
4272
  node.parentNode.removeChild(node);
4498
4273
  }
4499
4274
  guardNodesRef.current[key] = null;
@@ -4517,7 +4292,7 @@ var TourFocusManager = ({
4517
4292
  } else {
4518
4293
  for (const key of ["popover-start", "popover-end"]) {
4519
4294
  const node = guardNodesRef.current[key];
4520
- if (node?.parentNode) {
4295
+ if (_optionalChain([node, 'optionalAccess', _172 => _172.parentNode])) {
4521
4296
  node.parentNode.removeChild(node);
4522
4297
  }
4523
4298
  guardNodesRef.current[key] = null;
@@ -4537,7 +4312,7 @@ var TourFocusManager = ({
4537
4312
  }
4538
4313
  nodes.push(...getFocusableIn(targetElement));
4539
4314
  }
4540
- if (nodes.length === 0 && popoverNode?.hasAttribute("tabindex")) {
4315
+ if (nodes.length === 0 && _optionalChain([popoverNode, 'optionalAccess', _173 => _173.hasAttribute, 'call', _174 => _174("tabindex")])) {
4541
4316
  nodes.push(popoverNode);
4542
4317
  }
4543
4318
  const unique = [];
@@ -4551,7 +4326,7 @@ var TourFocusManager = ({
4551
4326
  };
4552
4327
  const isWithinTrap = (element) => {
4553
4328
  if (!(element instanceof HTMLElement)) return false;
4554
- if (popoverNode?.contains(element)) return true;
4329
+ if (_optionalChain([popoverNode, 'optionalAccess', _175 => _175.contains, 'call', _176 => _176(element)])) return true;
4555
4330
  if (target.element instanceof HTMLElement && target.element.contains(element)) {
4556
4331
  return true;
4557
4332
  }
@@ -4560,7 +4335,7 @@ var TourFocusManager = ({
4560
4335
  );
4561
4336
  };
4562
4337
  const ensureFocus = () => {
4563
- const firstGuard = guardNodesRef.current["target-start"] ?? guardNodesRef.current["popover-start"];
4338
+ const firstGuard = _nullishCoalesce(guardNodesRef.current["target-start"], () => ( guardNodesRef.current["popover-start"]));
4564
4339
  if (firstGuard) {
4565
4340
  focusElement(firstGuard);
4566
4341
  return;
@@ -4595,10 +4370,10 @@ var TourFocusManager = ({
4595
4370
  }
4596
4371
  }
4597
4372
  const key = targetNode.getAttribute("data-tour-focus-guard");
4598
- if (key?.startsWith("target")) {
4373
+ if (_optionalChain([key, 'optionalAccess', _177 => _177.startsWith, 'call', _178 => _178("target")])) {
4599
4374
  setTargetRingActive(true);
4600
4375
  setPopoverRingActive(false);
4601
- } else if (key?.startsWith("popover")) {
4376
+ } else if (_optionalChain([key, 'optionalAccess', _179 => _179.startsWith, 'call', _180 => _180("popover")])) {
4602
4377
  setTargetRingActive(false);
4603
4378
  setPopoverRingActive(true);
4604
4379
  }
@@ -4626,23 +4401,23 @@ var TourFocusManager = ({
4626
4401
  target.stepId,
4627
4402
  target.visibility
4628
4403
  ]);
4629
- (0, import_react26.useLayoutEffect)(() => {
4404
+ _react.useLayoutEffect.call(void 0, () => {
4630
4405
  if (popoverRingActive && popoverNode) {
4631
4406
  setPopoverRect(popoverNode.getBoundingClientRect());
4632
4407
  } else {
4633
4408
  setPopoverRect(null);
4634
4409
  }
4635
4410
  }, [popoverRingActive, popoverNode]);
4636
- if (!isBrowser) return null;
4637
- const host = portalHost();
4411
+ if (!_chunkD5LQLRSUcjs.isBrowser) return null;
4412
+ const host = _chunkD5LQLRSUcjs.portalHost.call(void 0, );
4638
4413
  if (!host) return null;
4639
- const boxShadow = guardElementFocusRing?.boxShadow ?? DEFAULT_BOX_SHADOW;
4414
+ const boxShadow = _nullishCoalesce(_optionalChain([guardElementFocusRing, 'optionalAccess', _181 => _181.boxShadow]), () => ( DEFAULT_BOX_SHADOW));
4640
4415
  const showTargetRing = targetRingActive && highlightRect;
4641
4416
  const showPopoverRing = popoverRingActive && popoverRect;
4642
4417
  if (!showTargetRing && !showPopoverRing) return null;
4643
- return (0, import_react_dom3.createPortal)(
4644
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
4645
- showTargetRing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4418
+ return _reactdom.createPortal.call(void 0,
4419
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
4420
+ showTargetRing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4646
4421
  "div",
4647
4422
  {
4648
4423
  style: {
@@ -4659,7 +4434,7 @@ var TourFocusManager = ({
4659
4434
  "aria-hidden": true
4660
4435
  }
4661
4436
  ),
4662
- showPopoverRing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4437
+ showPopoverRing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4663
4438
  "div",
4664
4439
  {
4665
4440
  style: {
@@ -4682,7 +4457,7 @@ var TourFocusManager = ({
4682
4457
  };
4683
4458
 
4684
4459
  // src/motion/useHudMotion.ts
4685
- var import_react27 = require("react");
4460
+
4686
4461
  var DEFAULT_HIGHLIGHT_TRANSITION2 = {
4687
4462
  duration: 0.35,
4688
4463
  ease: "easeOut",
@@ -4709,61 +4484,60 @@ var DEFAULT_POPOVER_CONTENT_TRANSITION2 = {
4709
4484
  };
4710
4485
  var useHudMotion = () => {
4711
4486
  const adapter = useAnimationAdapter();
4712
- return (0, import_react27.useMemo)(() => {
4487
+ return _react.useMemo.call(void 0, () => {
4713
4488
  const components = {
4714
4489
  ...adapter.components
4715
4490
  };
4716
4491
  return {
4717
4492
  components,
4718
4493
  transitions: {
4719
- highlight: adapter.transitions.overlayHighlight ?? DEFAULT_HIGHLIGHT_TRANSITION2,
4720
- overlayFade: adapter.transitions.overlayFade ?? DEFAULT_OVERLAY_TRANSITION2,
4721
- popoverEntrance: adapter.transitions.popoverEntrance ?? DEFAULT_POPOVER_ENTRANCE_TRANSITION2,
4722
- popoverExit: adapter.transitions.popoverExit ?? DEFAULT_POPOVER_EXIT_TRANSITION2,
4723
- popoverContent: adapter.transitions.popoverContent ?? DEFAULT_POPOVER_CONTENT_TRANSITION2
4494
+ highlight: _nullishCoalesce(adapter.transitions.overlayHighlight, () => ( DEFAULT_HIGHLIGHT_TRANSITION2)),
4495
+ overlayFade: _nullishCoalesce(adapter.transitions.overlayFade, () => ( DEFAULT_OVERLAY_TRANSITION2)),
4496
+ popoverEntrance: _nullishCoalesce(adapter.transitions.popoverEntrance, () => ( DEFAULT_POPOVER_ENTRANCE_TRANSITION2)),
4497
+ popoverExit: _nullishCoalesce(adapter.transitions.popoverExit, () => ( DEFAULT_POPOVER_EXIT_TRANSITION2)),
4498
+ popoverContent: _nullishCoalesce(adapter.transitions.popoverContent, () => ( DEFAULT_POPOVER_CONTENT_TRANSITION2))
4724
4499
  }
4725
4500
  };
4726
4501
  }, [adapter]);
4727
4502
  };
4728
- // Annotate the CommonJS export names for ESM import in node:
4729
- 0 && (module.exports = {
4730
- AnimationAdapterProvider,
4731
- DialogRegistryProvider,
4732
- OverlayBackdrop,
4733
- TourFocusManager,
4734
- TourPopoverPortal,
4735
- TourProvider,
4736
- createPathString,
4737
- createWaitForPredicateController,
4738
- defaultAnimationAdapter,
4739
- defaultLabels,
4740
- getCurrentRoutePath,
4741
- notifyRouteChange,
4742
- reducedMotionAnimationAdapter,
4743
- subscribeToRouteChanges,
4744
- useAdvanceRules,
4745
- useAnimationAdapter,
4746
- useBodyScrollLock,
4747
- useDelayAdvance,
4748
- useDialogRegistry,
4749
- useDialogRegistryOptional,
4750
- useHiddenTargetFallback,
4751
- useHudDescription,
4752
- useHudMotion,
4753
- useHudShortcuts,
4754
- useHudState,
4755
- useHudTargetIssue,
4756
- usePreferredAnimationAdapter,
4757
- useRadixDialogAdapter,
4758
- useRadixTourDialog,
4759
- useTour,
4760
- useTourControls,
4761
- useTourEvents,
4762
- useTourFocusDominance,
4763
- useTourHud,
4764
- useTourLabels,
4765
- useTourOverlay,
4766
- useTourTarget,
4767
- useViewportRect,
4768
- waitForDom
4769
- });
4503
+
4504
+
4505
+
4506
+
4507
+
4508
+
4509
+
4510
+
4511
+
4512
+
4513
+
4514
+
4515
+
4516
+
4517
+
4518
+
4519
+
4520
+
4521
+
4522
+
4523
+
4524
+
4525
+
4526
+
4527
+
4528
+
4529
+
4530
+
4531
+
4532
+
4533
+
4534
+
4535
+
4536
+
4537
+
4538
+
4539
+
4540
+
4541
+
4542
+
4543
+ exports.AnimationAdapterProvider = AnimationAdapterProvider; exports.DialogRegistryProvider = DialogRegistryProvider; exports.OverlayBackdrop = OverlayBackdrop; exports.TourFocusManager = TourFocusManager; exports.TourPopoverPortal = TourPopoverPortal; exports.TourProvider = TourProvider; exports.createPathString = _chunkD5LQLRSUcjs.createPathString; exports.createWaitForPredicateController = createWaitForPredicateController; exports.defaultAnimationAdapter = defaultAnimationAdapter; exports.defaultLabels = defaultLabels; exports.getCurrentRoutePath = _chunkD5LQLRSUcjs.getCurrentRoutePath; exports.notifyRouteChange = _chunkD5LQLRSUcjs.notifyRouteChange; exports.reducedMotionAnimationAdapter = reducedMotionAnimationAdapter; exports.subscribeToRouteChanges = _chunkD5LQLRSUcjs.subscribeToRouteChanges; exports.useAdvanceRules = useAdvanceRules; exports.useAnimationAdapter = useAnimationAdapter; exports.useBodyScrollLock = useBodyScrollLock; 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;