import * as m from "react";
import V, { isValidElement as se, cloneElement as X } from "react";
import ue from "../../../../@gilbarbara_deep-equal@0.3.1/node_modules/@gilbarbara/deep-equal/dist/index.js";
import P from "../../../../is-lite@1.2.1/node_modules/is-lite/dist/index.js";
import W from "../../../../tree-changes@0.11.3/node_modules/tree-changes/dist/index.js";
import he from "../../../../../../_virtual/index2.js";
import ie from "../../../../../../_virtual/scrollparent.js";
import * as J from "react-dom";
import { createPortal as fe } from "react-dom";
import q from "../../../../../../_virtual/index3.js";
import k from "../../../../../../_virtual/cjs.js";
import ge from "../../../../react-floater@0.7.9_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-canary-3d9b_62b21de9365afe1f579085f085141253/node_modules/react-floater/es/index.js";
var me = Object.defineProperty, ye = (e, o, t) => o in e ? me(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t, a = (e, o, t) => ye(e, typeof o != "symbol" ? o + "" : o, t), b = {
  INIT: "init",
  START: "start",
  STOP: "stop",
  RESET: "reset",
  PREV: "prev",
  NEXT: "next",
  GO: "go",
  CLOSE: "close",
  SKIP: "skip",
  UPDATE: "update"
}, C = {
  TOUR_START: "tour:start",
  STEP_BEFORE: "step:before",
  BEACON: "beacon",
  TOOLTIP: "tooltip",
  STEP_AFTER: "step:after",
  TOUR_END: "tour:end",
  TOUR_STATUS: "tour:status",
  TARGET_NOT_FOUND: "error:target_not_found"
}, h = {
  INIT: "init",
  READY: "ready",
  BEACON: "beacon",
  TOOLTIP: "tooltip",
  COMPLETE: "complete",
  ERROR: "error"
}, g = {
  IDLE: "idle",
  READY: "ready",
  WAITING: "waiting",
  RUNNING: "running",
  PAUSED: "paused",
  SKIPPED: "skipped",
  FINISHED: "finished"
};
function I() {
  var e;
  return !!(typeof window < "u" && ((e = window.document) != null && e.createElement));
}
function ne(e) {
  return e ? e.getBoundingClientRect() : null;
}
function be(e = !1) {
  const { body: o, documentElement: t } = document;
  if (!o || !t)
    return 0;
  if (e) {
    const s = [
      o.scrollHeight,
      o.offsetHeight,
      t.clientHeight,
      t.scrollHeight,
      t.offsetHeight
    ].sort((n, r) => n - r), i = Math.floor(s.length / 2);
    return s.length % 2 === 0 ? (s[i - 1] + s[i]) / 2 : s[i];
  }
  return Math.max(
    o.scrollHeight,
    o.offsetHeight,
    t.clientHeight,
    t.scrollHeight,
    t.offsetHeight
  );
}
function w(e) {
  if (typeof e == "string")
    try {
      return document.querySelector(e);
    } catch (o) {
      return process.env.NODE_ENV !== "production" && console.error(o), null;
    }
  return e;
}
function Se(e) {
  return !e || e.nodeType !== 1 ? null : getComputedStyle(e);
}
function z(e, o, t) {
  if (!e)
    return A();
  const s = ie(e);
  if (s) {
    if (s.isSameNode(A()))
      return t ? document : A();
    if (!(s.scrollHeight > s.offsetHeight) && !o)
      return s.style.overflow = "initial", A();
  }
  return s;
}
function H(e, o) {
  if (!e)
    return !1;
  const t = z(e, o);
  return t ? !t.isSameNode(A()) : !1;
}
function Te(e) {
  return e.offsetParent !== document.body;
}
function F(e, o = "fixed") {
  if (!e || !(e instanceof HTMLElement))
    return !1;
  const { nodeName: t } = e, s = Se(e);
  return t === "BODY" || t === "HTML" ? !1 : s && s.position === o ? !0 : e.parentNode ? F(e.parentNode, o) : !1;
}
function ve(e) {
  var o;
  if (!e)
    return !1;
  let t = e;
  for (; t && t !== document.body; ) {
    if (t instanceof HTMLElement) {
      const { display: s, visibility: i } = getComputedStyle(t);
      if (s === "none" || i === "hidden")
        return !1;
    }
    t = (o = t.parentElement) != null ? o : null;
  }
  return !0;
}
function Ee(e, o, t) {
  var s, i, n;
  const r = ne(e), l = z(e, t), d = H(e, t), c = F(e);
  let u = 0, p = (s = r?.top) != null ? s : 0;
  if (d && c) {
    const f = (i = e?.offsetTop) != null ? i : 0, T = (n = l?.scrollTop) != null ? n : 0;
    p = f - T;
  } else l instanceof HTMLElement && (u = l.scrollTop, !d && !F(e) && (p += u), l.isSameNode(A()) || (p += A().scrollTop));
  return Math.floor(p - o);
}
function Pe(e, o, t) {
  var s;
  if (!e)
    return 0;
  const { offsetTop: i = 0, scrollTop: n = 0 } = (s = ie(e)) != null ? s : {};
  let r = e.getBoundingClientRect().top + n;
  i && (H(e, t) || Te(e)) && (r -= i);
  const l = Math.floor(r - o);
  return l < 0 ? 0 : l;
}
function A() {
  var e;
  return (e = document.scrollingElement) != null ? e : document.documentElement;
}
function xe(e, o) {
  const { duration: t, element: s } = o;
  return new Promise((i, n) => {
    const { scrollTop: r } = s, l = e > r ? e - r : r - e;
    he.top(s, e, { duration: l < 100 ? 50 : t }, (d) => d && d.message !== "Element already at target scroll position" ? n(d) : i());
  });
}
var M = fe !== void 0;
function re(e = navigator.userAgent) {
  let o = e;
  return typeof window > "u" ? o = "node" : document.documentMode ? o = "ie" : /Edge/.test(e) ? o = "edge" : window.opera || e.includes(" OPR/") ? o = "opera" : typeof window.InstallTrigger < "u" ? o = "firefox" : window.chrome ? o = "chrome" : /(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e) && (o = "safari"), o;
}
function K(e) {
  return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
}
function O(e, o = {}) {
  const { defaultValue: t, step: s, steps: i } = o;
  let n = q(e);
  if (n)
    (n.includes("{step}") || n.includes("{steps}")) && s && i && (n = n.replace("{step}", s.toString()).replace("{steps}", i.toString()));
  else if (se(e) && !Object.values(e.props).length && K(e.type) === "function") {
    const r = e.type({});
    n = O(r, o);
  } else
    n = q(t);
  return n;
}
function Ce(e, o) {
  return !P.plainObject(e) || !P.array(o) ? !1 : Object.keys(e).every((t) => o.includes(t));
}
function Oe(e) {
  const o = /^#?([\da-f])([\da-f])([\da-f])$/i, t = e.replace(o, (i, n, r, l) => n + n + r + r + l + l), s = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(t);
  return s ? [parseInt(s[1], 16), parseInt(s[2], 16), parseInt(s[3], 16)] : [];
}
function Z(e) {
  return e.disableBeacon || e.placement === "center";
}
function Q() {
  return !["chrome", "safari", "firefox", "opera"].includes(re());
}
function R({ data: e, debug: o = !1, title: t, warn: s = !1 }) {
  const i = s ? console.warn || console.error : console.log;
  o && (t && e ? (console.groupCollapsed(
    `%creact-joyride: ${t}`,
    "color: #ff0044; font-weight: bold; font-size: 12px;"
  ), Array.isArray(e) ? e.forEach((n) => {
    P.plainObject(n) && n.key ? i.apply(console, [n.key, n.value]) : i.apply(console, [n]);
  }) : i.apply(console, [e]), console.groupEnd()) : console.error("Missing title or data props"));
}
function Ne(e) {
  return Object.keys(e);
}
function le(e, ...o) {
  if (!P.plainObject(e))
    throw new TypeError("Expected an object");
  const t = {};
  for (const s in e)
    ({}).hasOwnProperty.call(e, s) && (o.includes(s) || (t[s] = e[s]));
  return t;
}
function we(e, ...o) {
  if (!P.plainObject(e))
    throw new TypeError("Expected an object");
  if (!o.length)
    return e;
  const t = {};
  for (const s in e)
    ({}).hasOwnProperty.call(e, s) && o.includes(s) && (t[s] = e[s]);
  return t;
}
function $(e, o, t) {
  const s = (n) => n.replace("{step}", String(o)).replace("{steps}", String(t));
  if (K(e) === "string")
    return s(e);
  if (!se(e))
    return e;
  const { children: i } = e.props;
  if (K(i) === "string" && i.includes("{step}"))
    return X(e, {
      children: s(i)
    });
  if (Array.isArray(i))
    return X(e, {
      children: i.map((n) => typeof n == "string" ? s(n) : $(n, o, t))
    });
  if (K(e.type) === "function" && !Object.values(e.props).length) {
    const n = e.type({});
    return $(n, o, t);
  }
  return e;
}
function Ie(e) {
  const { isFirstStep: o, lifecycle: t, previousLifecycle: s, scrollToFirstStep: i, step: n, target: r } = e;
  return !n.disableScrolling && (!o || i || t === h.TOOLTIP) && n.placement !== "center" && (!n.isFixed || !F(r)) && // fixed steps don't need to scroll
  s !== t && [h.BEACON, h.TOOLTIP].includes(t);
}
var ke = {
  options: {
    preventOverflow: {
      boundariesElement: "scrollParent"
    }
  },
  wrapperOptions: {
    offset: -18,
    position: !0
  }
}, ae = {
  back: "Back",
  close: "Close",
  last: "Last",
  next: "Next",
  nextLabelWithProgress: "Next (Step {step} of {steps})",
  open: "Open the dialog",
  skip: "Skip"
}, Re = {
  event: "click",
  placement: "bottom",
  offset: 10,
  disableBeacon: !1,
  disableCloseOnEsc: !1,
  disableOverlay: !1,
  disableOverlayClose: !1,
  disableScrollParentFix: !1,
  disableScrolling: !1,
  hideBackButton: !1,
  hideCloseButton: !1,
  hideFooter: !1,
  isFixed: !1,
  locale: ae,
  showProgress: !1,
  showSkipButton: !1,
  spotlightClicks: !1,
  spotlightPadding: 10
}, Le = {
  continuous: !1,
  debug: !1,
  disableCloseOnEsc: !1,
  disableOverlay: !1,
  disableOverlayClose: !1,
  disableScrolling: !1,
  disableScrollParentFix: !1,
  getHelpers: void 0,
  hideBackButton: !1,
  run: !0,
  scrollOffset: 20,
  scrollDuration: 300,
  scrollToFirstStep: !1,
  showSkipButton: !1,
  showProgress: !1,
  spotlightClicks: !1,
  spotlightPadding: 10,
  steps: []
}, _e = {
  arrowColor: "#fff",
  backgroundColor: "#fff",
  beaconSize: 36,
  overlayColor: "rgba(0, 0, 0, 0.5)",
  primaryColor: "#f04",
  spotlightShadow: "0 0 15px rgba(0, 0, 0, 0.5)",
  textColor: "#333",
  width: 380,
  zIndex: 100
}, U = {
  backgroundColor: "transparent",
  border: 0,
  borderRadius: 0,
  color: "#555",
  cursor: "pointer",
  fontSize: 16,
  lineHeight: 1,
  padding: 8,
  WebkitAppearance: "none"
}, ee = {
  borderRadius: 4,
  position: "absolute"
};
function Ae(e, o) {
  var t, s, i, n, r;
  const { floaterProps: l, styles: d } = e, c = k((t = o.floaterProps) != null ? t : {}, l ?? {}), u = k(d ?? {}, (s = o.styles) != null ? s : {}), p = k(_e, u.options || {}), f = o.placement === "center" || o.disableBeacon;
  let { width: T } = p;
  window.innerWidth > 480 && (T = 380), "width" in p && (T = typeof p.width == "number" && window.innerWidth < p.width ? window.innerWidth - 30 : p.width);
  const y = {
    bottom: 0,
    left: 0,
    overflow: "hidden",
    position: "absolute",
    right: 0,
    top: 0,
    zIndex: p.zIndex
  }, S = {
    beacon: {
      ...U,
      display: f ? "none" : "inline-block",
      height: p.beaconSize,
      position: "relative",
      width: p.beaconSize,
      zIndex: p.zIndex
    },
    beaconInner: {
      animation: "joyride-beacon-inner 1.2s infinite ease-in-out",
      backgroundColor: p.primaryColor,
      borderRadius: "50%",
      display: "block",
      height: "50%",
      left: "50%",
      opacity: 0.7,
      position: "absolute",
      top: "50%",
      transform: "translate(-50%, -50%)",
      width: "50%"
    },
    beaconOuter: {
      animation: "joyride-beacon-outer 1.2s infinite ease-in-out",
      backgroundColor: `rgba(${Oe(p.primaryColor).join(",")}, 0.2)`,
      border: `2px solid ${p.primaryColor}`,
      borderRadius: "50%",
      boxSizing: "border-box",
      display: "block",
      height: "100%",
      left: 0,
      opacity: 0.9,
      position: "absolute",
      top: 0,
      transformOrigin: "center",
      width: "100%"
    },
    tooltip: {
      backgroundColor: p.backgroundColor,
      borderRadius: 5,
      boxSizing: "border-box",
      color: p.textColor,
      fontSize: 16,
      maxWidth: "100%",
      padding: 15,
      position: "relative",
      width: T
    },
    tooltipContainer: {
      lineHeight: 1.4,
      textAlign: "center"
    },
    tooltipTitle: {
      fontSize: 18,
      margin: 0
    },
    tooltipContent: {
      padding: "20px 10px"
    },
    tooltipFooter: {
      alignItems: "center",
      display: "flex",
      justifyContent: "flex-end",
      marginTop: 15
    },
    tooltipFooterSpacer: {
      flex: 1
    },
    buttonNext: {
      ...U,
      backgroundColor: p.primaryColor,
      borderRadius: 4,
      color: "#fff"
    },
    buttonBack: {
      ...U,
      color: p.primaryColor,
      marginLeft: "auto",
      marginRight: 5
    },
    buttonClose: {
      ...U,
      color: p.textColor,
      height: 14,
      padding: 15,
      position: "absolute",
      right: 0,
      top: 0,
      width: 14
    },
    buttonSkip: {
      ...U,
      color: p.textColor,
      fontSize: 14
    },
    overlay: {
      ...y,
      backgroundColor: p.overlayColor,
      mixBlendMode: "hard-light"
    },
    overlayLegacy: {
      ...y
    },
    overlayLegacyCenter: {
      ...y,
      backgroundColor: p.overlayColor
    },
    spotlight: {
      ...ee,
      backgroundColor: "gray"
    },
    spotlightLegacy: {
      ...ee,
      boxShadow: `0 0 0 9999px ${p.overlayColor}, ${p.spotlightShadow}`
    },
    floaterStyles: {
      arrow: {
        color: (r = (n = (i = c?.styles) == null ? void 0 : i.arrow) == null ? void 0 : n.color) != null ? r : p.arrowColor
      },
      options: {
        zIndex: p.zIndex + 100
      }
    },
    options: p
  };
  return k(S, u);
}
function De(e) {
  return we(
    e,
    "beaconComponent",
    "disableCloseOnEsc",
    "disableOverlay",
    "disableOverlayClose",
    "disableScrolling",
    "disableScrollParentFix",
    "floaterProps",
    "hideBackButton",
    "hideCloseButton",
    "locale",
    "showProgress",
    "showSkipButton",
    "spotlightClicks",
    "spotlightPadding",
    "styles",
    "tooltipComponent"
  );
}
function B(e, o) {
  var t, s, i, n, r, l;
  const d = o ?? {}, c = k.all([Re, De(e), d], {
    isMergeableObject: P.plainObject
  }), u = Ae(e, c), p = H(
    w(c.target),
    c.disableScrollParentFix
  ), f = k.all([
    ke,
    (t = e.floaterProps) != null ? t : {},
    (s = c.floaterProps) != null ? s : {}
  ]);
  return f.offset = c.offset, f.styles = k((i = f.styles) != null ? i : {}, u.floaterStyles), f.offset += (r = (n = e.spotlightPadding) != null ? n : c.spotlightPadding) != null ? r : 0, c.placementBeacon && f.wrapperOptions && (f.wrapperOptions.placement = c.placementBeacon), p && f.options.preventOverflow && (f.options.preventOverflow.boundariesElement = "window"), {
    ...c,
    locale: k.all([ae, (l = e.locale) != null ? l : {}, c.locale || {}]),
    floaterProps: f,
    styles: le(u, "floaterStyles")
  };
}
function ce(e, o = !1) {
  return P.plainObject(e) ? e.target ? !0 : (R({
    title: "validateStep",
    data: "target is missing from the step",
    warn: !0,
    debug: o
  }), !1) : (R({
    title: "validateStep",
    data: "step must be an object",
    warn: !0,
    debug: o
  }), !1);
}
function te(e, o = !1) {
  return P.array(e) ? e.every((t) => ce(t, o)) : (R({
    title: "validateSteps",
    data: "steps must be an array",
    warn: !0,
    debug: o
  }), !1);
}
var pe = {
  action: "init",
  controlled: !1,
  index: 0,
  lifecycle: h.INIT,
  origin: null,
  size: 0,
  status: g.IDLE
}, oe = Ne(le(pe, "controlled", "size")), Be = class {
  constructor(e) {
    a(this, "beaconPopper"), a(this, "tooltipPopper"), a(this, "data", /* @__PURE__ */ new Map()), a(this, "listener"), a(this, "store", /* @__PURE__ */ new Map()), a(this, "addListener", (i) => {
      this.listener = i;
    }), a(this, "setSteps", (i) => {
      const { size: n, status: r } = this.getState(), l = {
        size: i.length,
        status: r
      };
      this.data.set("steps", i), r === g.WAITING && !n && i.length && (l.status = g.RUNNING), this.setState(l);
    }), a(this, "getPopper", (i) => i === "beacon" ? this.beaconPopper : this.tooltipPopper), a(this, "setPopper", (i, n) => {
      i === "beacon" ? this.beaconPopper = n : this.tooltipPopper = n;
    }), a(this, "cleanupPoppers", () => {
      this.beaconPopper = null, this.tooltipPopper = null;
    }), a(this, "close", (i = null) => {
      const { index: n, status: r } = this.getState();
      r === g.RUNNING && this.setState({
        ...this.getNextState({ action: b.CLOSE, index: n + 1, origin: i })
      });
    }), a(this, "go", (i) => {
      const { controlled: n, status: r } = this.getState();
      if (n || r !== g.RUNNING)
        return;
      const l = this.getSteps()[i];
      this.setState({
        ...this.getNextState({ action: b.GO, index: i }),
        status: l ? r : g.FINISHED
      });
    }), a(this, "info", () => this.getState()), a(this, "next", () => {
      const { index: i, status: n } = this.getState();
      n === g.RUNNING && this.setState(this.getNextState({ action: b.NEXT, index: i + 1 }));
    }), a(this, "open", () => {
      const { status: i } = this.getState();
      i === g.RUNNING && this.setState({
        ...this.getNextState({ action: b.UPDATE, lifecycle: h.TOOLTIP })
      });
    }), a(this, "prev", () => {
      const { index: i, status: n } = this.getState();
      n === g.RUNNING && this.setState({
        ...this.getNextState({ action: b.PREV, index: i - 1 })
      });
    }), a(this, "reset", (i = !1) => {
      const { controlled: n } = this.getState();
      n || this.setState({
        ...this.getNextState({ action: b.RESET, index: 0 }),
        status: i ? g.RUNNING : g.READY
      });
    }), a(this, "skip", () => {
      const { status: i } = this.getState();
      i === g.RUNNING && this.setState({
        action: b.SKIP,
        lifecycle: h.INIT,
        status: g.SKIPPED
      });
    }), a(this, "start", (i) => {
      const { index: n, size: r } = this.getState();
      this.setState({
        ...this.getNextState(
          {
            action: b.START,
            index: P.number(i) ? i : n
          },
          !0
        ),
        status: r ? g.RUNNING : g.WAITING
      });
    }), a(this, "stop", (i = !1) => {
      const { index: n, status: r } = this.getState();
      [g.FINISHED, g.SKIPPED].includes(r) || this.setState({
        ...this.getNextState({ action: b.STOP, index: n + (i ? 1 : 0) }),
        status: g.PAUSED
      });
    }), a(this, "update", (i) => {
      var n, r;
      if (!Ce(i, oe))
        throw new Error(`State is not valid. Valid keys: ${oe.join(", ")}`);
      this.setState({
        ...this.getNextState(
          {
            ...this.getState(),
            ...i,
            action: (n = i.action) != null ? n : b.UPDATE,
            origin: (r = i.origin) != null ? r : null
          },
          !0
        )
      });
    });
    const { continuous: o = !1, stepIndex: t, steps: s = [] } = e ?? {};
    this.setState(
      {
        action: b.INIT,
        controlled: P.number(t),
        continuous: o,
        index: P.number(t) ? t : 0,
        lifecycle: h.INIT,
        origin: null,
        status: s.length ? g.READY : g.IDLE
      },
      !0
    ), this.beaconPopper = null, this.tooltipPopper = null, this.listener = null, this.setSteps(s);
  }
  getState() {
    return this.store.size ? {
      action: this.store.get("action") || "",
      controlled: this.store.get("controlled") || !1,
      index: parseInt(this.store.get("index"), 10),
      lifecycle: this.store.get("lifecycle") || "",
      origin: this.store.get("origin") || null,
      size: this.store.get("size") || 0,
      status: this.store.get("status") || ""
    } : { ...pe };
  }
  getNextState(e, o = !1) {
    var t, s, i, n, r;
    const { action: l, controlled: d, index: c, size: u, status: p } = this.getState(), f = P.number(e.index) ? e.index : c, T = d && !o ? c : Math.min(Math.max(f, 0), u);
    return {
      action: (t = e.action) != null ? t : l,
      controlled: d,
      index: T,
      lifecycle: (s = e.lifecycle) != null ? s : h.INIT,
      origin: (i = e.origin) != null ? i : null,
      size: (n = e.size) != null ? n : u,
      status: T === u ? g.FINISHED : (r = e.status) != null ? r : p
    };
  }
  getSteps() {
    const e = this.data.get("steps");
    return Array.isArray(e) ? e : [];
  }
  hasUpdatedState(e) {
    const o = JSON.stringify(e), t = JSON.stringify(this.getState());
    return o !== t;
  }
  setState(e, o = !1) {
    const t = this.getState(), {
      action: s,
      index: i,
      lifecycle: n,
      origin: r = null,
      size: l,
      status: d
    } = {
      ...t,
      ...e
    };
    this.store.set("action", s), this.store.set("index", i), this.store.set("lifecycle", n), this.store.set("origin", r), this.store.set("size", l), this.store.set("status", d), o && (this.store.set("controlled", e.controlled), this.store.set("continuous", e.continuous)), this.listener && this.hasUpdatedState(t) && this.listener(this.getState());
  }
  getHelpers() {
    return {
      close: this.close,
      go: this.go,
      info: this.info,
      next: this.next,
      open: this.open,
      prev: this.prev,
      reset: this.reset,
      skip: this.skip
    };
  }
};
function Fe(e) {
  return new Be(e);
}
function Me({ styles: e }) {
  return /* @__PURE__ */ m.createElement(
    "div",
    {
      key: "JoyrideSpotlight",
      className: "react-joyride__spotlight",
      "data-test-id": "spotlight",
      style: e
    }
  );
}
var Ue = Me, ze = class extends m.Component {
  constructor() {
    super(...arguments), a(this, "isActive", !1), a(this, "resizeTimeout"), a(this, "scrollTimeout"), a(this, "scrollParent"), a(this, "state", {
      isScrolling: !1,
      mouseOverSpotlight: !1,
      showSpotlight: !0
    }), a(this, "hideSpotlight", () => {
      const { continuous: e, disableOverlay: o, lifecycle: t } = this.props, s = [
        h.INIT,
        h.BEACON,
        h.COMPLETE,
        h.ERROR
      ];
      return o || (e ? s.includes(t) : t !== h.TOOLTIP);
    }), a(this, "handleMouseMove", (e) => {
      const { mouseOverSpotlight: o } = this.state, { height: t, left: s, position: i, top: n, width: r } = this.spotlightStyles, l = i === "fixed" ? e.clientY : e.pageY, d = i === "fixed" ? e.clientX : e.pageX, c = l >= n && l <= n + t, p = d >= s && d <= s + r && c;
      p !== o && this.updateState({ mouseOverSpotlight: p });
    }), a(this, "handleScroll", () => {
      const { target: e } = this.props, o = w(e);
      if (this.scrollParent !== document) {
        const { isScrolling: t } = this.state;
        t || this.updateState({ isScrolling: !0, showSpotlight: !1 }), clearTimeout(this.scrollTimeout), this.scrollTimeout = window.setTimeout(() => {
          this.updateState({ isScrolling: !1, showSpotlight: !0 });
        }, 50);
      } else F(o, "sticky") && this.updateState({});
    }), a(this, "handleResize", () => {
      clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(() => {
        this.isActive && this.forceUpdate();
      }, 100);
    });
  }
  componentDidMount() {
    const { debug: e, disableScrolling: o, disableScrollParentFix: t = !1, target: s } = this.props, i = w(s);
    this.scrollParent = z(i ?? document.body, t, !0), this.isActive = !0, process.env.NODE_ENV !== "production" && !o && H(i, !0) && R({
      title: "step has a custom scroll parent and can cause trouble with scrolling",
      data: [{ key: "parent", value: this.scrollParent }],
      debug: e
    }), window.addEventListener("resize", this.handleResize);
  }
  componentDidUpdate(e) {
    var o;
    const { disableScrollParentFix: t, lifecycle: s, spotlightClicks: i, target: n } = this.props, { changed: r } = W(e, this.props);
    if (r("target") || r("disableScrollParentFix")) {
      const l = w(n);
      this.scrollParent = z(l ?? document.body, t, !0);
    }
    r("lifecycle", h.TOOLTIP) && ((o = this.scrollParent) == null || o.addEventListener("scroll", this.handleScroll, { passive: !0 }), setTimeout(() => {
      const { isScrolling: l } = this.state;
      l || this.updateState({ showSpotlight: !0 });
    }, 100)), (r("spotlightClicks") || r("disableOverlay") || r("lifecycle")) && (i && s === h.TOOLTIP ? window.addEventListener("mousemove", this.handleMouseMove, !1) : s !== h.TOOLTIP && window.removeEventListener("mousemove", this.handleMouseMove));
  }
  componentWillUnmount() {
    var e;
    this.isActive = !1, window.removeEventListener("mousemove", this.handleMouseMove), window.removeEventListener("resize", this.handleResize), clearTimeout(this.resizeTimeout), clearTimeout(this.scrollTimeout), (e = this.scrollParent) == null || e.removeEventListener("scroll", this.handleScroll);
  }
  get overlayStyles() {
    const { mouseOverSpotlight: e } = this.state, { disableOverlayClose: o, placement: t, styles: s } = this.props;
    let i = s.overlay;
    return Q() && (i = t === "center" ? s.overlayLegacyCenter : s.overlayLegacy), {
      cursor: o ? "default" : "pointer",
      height: be(),
      pointerEvents: e ? "none" : "auto",
      ...i
    };
  }
  get spotlightStyles() {
    var e, o, t;
    const { showSpotlight: s } = this.state, {
      disableScrollParentFix: i = !1,
      spotlightClicks: n,
      spotlightPadding: r = 0,
      styles: l,
      target: d
    } = this.props, c = w(d), u = ne(c), p = F(c), f = Ee(c, r, i);
    return {
      ...Q() ? l.spotlightLegacy : l.spotlight,
      height: Math.round(((e = u?.height) != null ? e : 0) + r * 2),
      left: Math.round(((o = u?.left) != null ? o : 0) - r),
      opacity: s ? 1 : 0,
      pointerEvents: n ? "none" : "auto",
      position: p ? "fixed" : "absolute",
      top: f,
      transition: "opacity 0.2s",
      width: Math.round(((t = u?.width) != null ? t : 0) + r * 2)
    };
  }
  updateState(e) {
    this.isActive && this.setState((o) => ({ ...o, ...e }));
  }
  render() {
    const { showSpotlight: e } = this.state, { onClickOverlay: o, placement: t } = this.props, { hideSpotlight: s, overlayStyles: i, spotlightStyles: n } = this;
    if (s())
      return null;
    let r = t !== "center" && e && /* @__PURE__ */ m.createElement(Ue, { styles: n });
    if (re() === "safari") {
      const { mixBlendMode: l, zIndex: d, ...c } = i;
      r = /* @__PURE__ */ m.createElement("div", { style: { ...c } }, r), delete i.backgroundColor;
    }
    return /* @__PURE__ */ m.createElement(
      "div",
      {
        className: "react-joyride__overlay",
        "data-test-id": "overlay",
        onClick: o,
        role: "presentation",
        style: i
      },
      r
    );
  }
}, He = class extends m.Component {
  constructor() {
    super(...arguments), a(this, "node", null);
  }
  componentDidMount() {
    const { id: e } = this.props;
    I() && (this.node = document.createElement("div"), this.node.id = e, document.body.appendChild(this.node), M || this.renderReact15());
  }
  componentDidUpdate() {
    I() && (M || this.renderReact15());
  }
  componentWillUnmount() {
    !I() || !this.node || (M || J.unmountComponentAtNode(this.node), this.node.parentNode === document.body && (document.body.removeChild(this.node), this.node = null));
  }
  renderReact15() {
    if (!I())
      return;
    const { children: e } = this.props;
    this.node && J.unstable_renderSubtreeIntoContainer(this, e, this.node);
  }
  renderReact16() {
    if (!I() || !M)
      return null;
    const { children: e } = this.props;
    return this.node ? J.createPortal(e, this.node) : null;
  }
  render() {
    return M ? this.renderReact16() : null;
  }
}, je = class {
  constructor(e, o) {
    if (a(this, "element"), a(this, "options"), a(this, "canBeTabbed", (t) => {
      const { tabIndex: s } = t;
      return s === null || s < 0 ? !1 : this.canHaveFocus(t);
    }), a(this, "canHaveFocus", (t) => {
      const s = /input|select|textarea|button|object/, i = t.nodeName.toLowerCase();
      return (s.test(i) && !t.getAttribute("disabled") || i === "a" && !!t.getAttribute("href")) && this.isVisible(t);
    }), a(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed)), a(this, "handleKeyDown", (t) => {
      const { code: s = "Tab" } = this.options;
      t.code === s && this.interceptTab(t);
    }), a(this, "interceptTab", (t) => {
      t.preventDefault();
      const s = this.findValidTabElements(), { shiftKey: i } = t;
      if (!s.length)
        return;
      let n = document.activeElement ? s.indexOf(document.activeElement) : 0;
      n === -1 || !i && n + 1 === s.length ? n = 0 : i && n === 0 ? n = s.length - 1 : n += i ? -1 : 1, s[n].focus();
    }), a(this, "isHidden", (t) => {
      const s = t.offsetWidth <= 0 && t.offsetHeight <= 0, i = window.getComputedStyle(t);
      return s && !t.innerHTML ? !0 : s && i.getPropertyValue("overflow") !== "visible" || i.getPropertyValue("display") === "none";
    }), a(this, "isVisible", (t) => {
      let s = t;
      for (; s; )
        if (s instanceof HTMLElement) {
          if (s === document.body)
            break;
          if (this.isHidden(s))
            return !1;
          s = s.parentNode;
        }
      return !0;
    }), a(this, "removeScope", () => {
      window.removeEventListener("keydown", this.handleKeyDown);
    }), a(this, "checkFocus", (t) => {
      document.activeElement !== t && (t.focus(), window.requestAnimationFrame(() => this.checkFocus(t)));
    }), a(this, "setFocus", () => {
      const { selector: t } = this.options;
      if (!t)
        return;
      const s = this.element.querySelector(t);
      s && window.requestAnimationFrame(() => this.checkFocus(s));
    }), !(e instanceof HTMLElement))
      throw new TypeError("Invalid parameter: element must be an HTMLElement");
    this.element = e, this.options = o, window.addEventListener("keydown", this.handleKeyDown, !1), this.setFocus();
  }
}, Ge = class extends m.Component {
  constructor(e) {
    if (super(e), a(this, "beacon", null), a(this, "setBeaconRef", (i) => {
      this.beacon = i;
    }), e.beaconComponent)
      return;
    const o = document.head || document.getElementsByTagName("head")[0], t = document.createElement("style");
    t.id = "joyride-beacon-animation", e.nonce && t.setAttribute("nonce", e.nonce), t.appendChild(document.createTextNode(`
        @keyframes joyride-beacon-inner {
          20% {
            opacity: 0.9;
          }
        
          90% {
            opacity: 0.7;
          }
        }
        
        @keyframes joyride-beacon-outer {
          0% {
            transform: scale(1);
          }
        
          45% {
            opacity: 0.7;
            transform: scale(0.75);
          }
        
          100% {
            opacity: 0.9;
            transform: scale(1);
          }
        }
      `)), o.appendChild(t);
  }
  componentDidMount() {
    const { shouldFocus: e } = this.props;
    process.env.NODE_ENV !== "production" && (P.domElement(this.beacon) || console.warn("beacon is not a valid DOM element")), setTimeout(() => {
      P.domElement(this.beacon) && e && this.beacon.focus();
    }, 0);
  }
  componentWillUnmount() {
    const e = document.getElementById("joyride-beacon-animation");
    e?.parentNode && e.parentNode.removeChild(e);
  }
  render() {
    const {
      beaconComponent: e,
      continuous: o,
      index: t,
      isLastStep: s,
      locale: i,
      onClickOrHover: n,
      size: r,
      step: l,
      styles: d
    } = this.props, c = O(i.open), u = {
      "aria-label": c,
      onClick: n,
      onMouseEnter: n,
      ref: this.setBeaconRef,
      title: c
    };
    let p;
    if (e) {
      const f = e;
      p = /* @__PURE__ */ m.createElement(
        f,
        {
          continuous: o,
          index: t,
          isLastStep: s,
          size: r,
          step: l,
          ...u
        }
      );
    } else
      p = /* @__PURE__ */ m.createElement(
        "button",
        {
          key: "JoyrideBeacon",
          className: "react-joyride__beacon",
          "data-test-id": "button-beacon",
          style: d.beacon,
          type: "button",
          ...u
        },
        /* @__PURE__ */ m.createElement("span", { style: d.beaconInner }),
        /* @__PURE__ */ m.createElement("span", { style: d.beaconOuter })
      );
    return p;
  }
};
function Ve({ styles: e, ...o }) {
  const { color: t, height: s, width: i, ...n } = e;
  return /* @__PURE__ */ V.createElement("button", { style: n, type: "button", ...o }, /* @__PURE__ */ V.createElement(
    "svg",
    {
      height: typeof s == "number" ? `${s}px` : s,
      preserveAspectRatio: "xMidYMid",
      version: "1.1",
      viewBox: "0 0 18 18",
      width: typeof i == "number" ? `${i}px` : i,
      xmlns: "http://www.w3.org/2000/svg"
    },
    /* @__PURE__ */ V.createElement("g", null, /* @__PURE__ */ V.createElement(
      "path",
      {
        d: "M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",
        fill: t
      }
    ))
  ));
}
var Ke = Ve;
function We(e) {
  const { backProps: o, closeProps: t, index: s, isLastStep: i, primaryProps: n, skipProps: r, step: l, tooltipProps: d } = e, { content: c, hideBackButton: u, hideCloseButton: p, hideFooter: f, showSkipButton: T, styles: y, title: S } = l, v = {};
  return v.primary = /* @__PURE__ */ m.createElement(
    "button",
    {
      "data-test-id": "button-primary",
      style: y.buttonNext,
      type: "button",
      ...n
    }
  ), T && !i && (v.skip = /* @__PURE__ */ m.createElement(
    "button",
    {
      "aria-live": "off",
      "data-test-id": "button-skip",
      style: y.buttonSkip,
      type: "button",
      ...r
    }
  )), !u && s > 0 && (v.back = /* @__PURE__ */ m.createElement("button", { "data-test-id": "button-back", style: y.buttonBack, type: "button", ...o })), v.close = !p && /* @__PURE__ */ m.createElement(Ke, { "data-test-id": "button-close", styles: y.buttonClose, ...t }), /* @__PURE__ */ m.createElement(
    "div",
    {
      key: "JoyrideTooltip",
      "aria-label": O(S ?? c),
      className: "react-joyride__tooltip",
      style: y.tooltip,
      ...d
    },
    /* @__PURE__ */ m.createElement("div", { style: y.tooltipContainer }, S && /* @__PURE__ */ m.createElement("h1", { "aria-label": O(S), style: y.tooltipTitle }, S), /* @__PURE__ */ m.createElement("div", { style: y.tooltipContent }, c)),
    !f && /* @__PURE__ */ m.createElement("div", { style: y.tooltipFooter }, /* @__PURE__ */ m.createElement("div", { style: y.tooltipFooterSpacer }, v.skip), v.back, v.primary),
    v.close
  );
}
var Ye = We, Je = class extends m.Component {
  constructor() {
    super(...arguments), a(this, "handleClickBack", (e) => {
      e.preventDefault();
      const { helpers: o } = this.props;
      o.prev();
    }), a(this, "handleClickClose", (e) => {
      e.preventDefault();
      const { helpers: o } = this.props;
      o.close("button_close");
    }), a(this, "handleClickPrimary", (e) => {
      e.preventDefault();
      const { continuous: o, helpers: t } = this.props;
      if (!o) {
        t.close("button_primary");
        return;
      }
      t.next();
    }), a(this, "handleClickSkip", (e) => {
      e.preventDefault();
      const { helpers: o } = this.props;
      o.skip();
    }), a(this, "getElementsProps", () => {
      const { continuous: e, index: o, isLastStep: t, setTooltipRef: s, size: i, step: n } = this.props, { back: r, close: l, last: d, next: c, nextLabelWithProgress: u, skip: p } = n.locale, f = O(r), T = O(l), y = O(d), S = O(c), v = O(p);
      let x = l, E = T;
      if (e) {
        if (x = c, E = S, n.showProgress && !t) {
          const N = O(u, {
            step: o + 1,
            steps: i
          });
          x = $(u, o + 1, i), E = N;
        }
        t && (x = d, E = y);
      }
      return {
        backProps: {
          "aria-label": f,
          children: r,
          "data-action": "back",
          onClick: this.handleClickBack,
          role: "button",
          title: f
        },
        closeProps: {
          "aria-label": T,
          children: l,
          "data-action": "close",
          onClick: this.handleClickClose,
          role: "button",
          title: T
        },
        primaryProps: {
          "aria-label": E,
          children: x,
          "data-action": "primary",
          onClick: this.handleClickPrimary,
          role: "button",
          title: E
        },
        skipProps: {
          "aria-label": v,
          children: p,
          "data-action": "skip",
          onClick: this.handleClickSkip,
          role: "button",
          title: v
        },
        tooltipProps: {
          "aria-modal": !0,
          ref: s,
          role: "alertdialog"
        }
      };
    });
  }
  render() {
    const { continuous: e, index: o, isLastStep: t, setTooltipRef: s, size: i, step: n } = this.props, { beaconComponent: r, tooltipComponent: l, ...d } = n;
    let c;
    if (l) {
      const u = {
        ...this.getElementsProps(),
        continuous: e,
        index: o,
        isLastStep: t,
        size: i,
        step: d,
        setTooltipRef: s
      }, p = l;
      c = /* @__PURE__ */ m.createElement(p, { ...u });
    } else
      c = /* @__PURE__ */ m.createElement(
        Ye,
        {
          ...this.getElementsProps(),
          continuous: e,
          index: o,
          isLastStep: t,
          size: i,
          step: n
        }
      );
    return c;
  }
}, $e = class extends m.Component {
  constructor() {
    super(...arguments), a(this, "scope", null), a(this, "tooltip", null), a(this, "handleClickHoverBeacon", (e) => {
      const { step: o, store: t } = this.props;
      e.type === "mouseenter" && o.event !== "hover" || t.update({ lifecycle: h.TOOLTIP });
    }), a(this, "setTooltipRef", (e) => {
      this.tooltip = e;
    }), a(this, "setPopper", (e, o) => {
      var t;
      const { action: s, lifecycle: i, step: n, store: r } = this.props;
      o === "wrapper" ? r.setPopper("beacon", e) : r.setPopper("tooltip", e), r.getPopper("beacon") && (r.getPopper("tooltip") || n.placement === "center") && i === h.INIT && r.update({
        action: s,
        lifecycle: h.READY
      }), (t = n.floaterProps) != null && t.getPopper && n.floaterProps.getPopper(e, o);
    }), a(this, "renderTooltip", (e) => {
      const { continuous: o, helpers: t, index: s, size: i, step: n } = this.props;
      return /* @__PURE__ */ m.createElement(
        Je,
        {
          continuous: o,
          helpers: t,
          index: s,
          isLastStep: s + 1 === i,
          setTooltipRef: this.setTooltipRef,
          size: i,
          step: n,
          ...e
        }
      );
    });
  }
  componentDidMount() {
    const { debug: e, index: o } = this.props;
    R({
      title: `step:${o}`,
      data: [{ key: "props", value: this.props }],
      debug: e
    });
  }
  componentDidUpdate(e) {
    var o;
    const {
      action: t,
      callback: s,
      continuous: i,
      controlled: n,
      debug: r,
      helpers: l,
      index: d,
      lifecycle: c,
      shouldScroll: u,
      status: p,
      step: f,
      store: T
    } = this.props, { changed: y, changedFrom: S } = W(e, this.props), v = l.info(), x = i && t !== b.CLOSE && (d > 0 || t === b.PREV), E = y("action") || y("index") || y("lifecycle") || y("status"), N = S("lifecycle", [h.TOOLTIP, h.INIT], h.INIT), L = y("action", [
      b.NEXT,
      b.PREV,
      b.SKIP,
      b.CLOSE
    ]), Y = n && d === e.index;
    if (L && (N || Y) && s({
      ...v,
      index: e.index,
      lifecycle: h.COMPLETE,
      step: e.step,
      type: C.STEP_AFTER
    }), f.placement === "center" && p === g.RUNNING && y("index") && t !== b.START && c === h.INIT && T.update({ lifecycle: h.READY }), E) {
      const j = w(f.target), G = !!j;
      G && ve(j) ? (S("status", g.READY, g.RUNNING) || S("lifecycle", h.INIT, h.READY)) && s({
        ...v,
        step: f,
        type: C.STEP_BEFORE
      }) : (console.warn(G ? "Target not visible" : "Target not mounted", f), s({
        ...v,
        type: C.TARGET_NOT_FOUND,
        step: f
      }), n || T.update({ index: d + (t === b.PREV ? -1 : 1) }));
    }
    S("lifecycle", h.INIT, h.READY) && T.update({
      lifecycle: Z(f) || x ? h.TOOLTIP : h.BEACON
    }), y("index") && R({
      title: `step:${c}`,
      data: [{ key: "props", value: this.props }],
      debug: r
    }), y("lifecycle", h.BEACON) && s({
      ...v,
      step: f,
      type: C.BEACON
    }), y("lifecycle", h.TOOLTIP) && (s({
      ...v,
      step: f,
      type: C.TOOLTIP
    }), u && this.tooltip && (this.scope = new je(this.tooltip, { selector: "[data-action=primary]" }), this.scope.setFocus())), S("lifecycle", [h.TOOLTIP, h.INIT], h.INIT) && ((o = this.scope) == null || o.removeScope(), T.cleanupPoppers());
  }
  componentWillUnmount() {
    var e;
    (e = this.scope) == null || e.removeScope();
  }
  get open() {
    const { lifecycle: e, step: o } = this.props;
    return Z(o) || e === h.TOOLTIP;
  }
  render() {
    const { continuous: e, debug: o, index: t, nonce: s, shouldScroll: i, size: n, step: r } = this.props, l = w(r.target);
    return !ce(r) || !P.domElement(l) ? null : /* @__PURE__ */ m.createElement("div", { key: `JoyrideStep-${t}`, className: "react-joyride__step" }, /* @__PURE__ */ m.createElement(
      ge,
      {
        ...r.floaterProps,
        component: this.renderTooltip,
        debug: o,
        getPopper: this.setPopper,
        id: `react-joyride-step-${t}`,
        open: this.open,
        placement: r.placement,
        target: r.target
      },
      /* @__PURE__ */ m.createElement(
        Ge,
        {
          beaconComponent: r.beaconComponent,
          continuous: e,
          index: t,
          isLastStep: t + 1 === n,
          locale: r.locale,
          nonce: s,
          onClickOrHover: this.handleClickHoverBeacon,
          shouldFocus: i,
          size: n,
          step: r,
          styles: r.styles
        }
      )
    ));
  }
}, de = class extends m.Component {
  constructor(e) {
    super(e), a(this, "helpers"), a(this, "store"), a(this, "callback", (r) => {
      const { callback: l } = this.props;
      P.function(l) && l(r);
    }), a(this, "handleKeyboard", (r) => {
      const { index: l, lifecycle: d } = this.state, { steps: c } = this.props, u = c[l];
      d === h.TOOLTIP && r.code === "Escape" && u && !u.disableCloseOnEsc && this.store.close("keyboard");
    }), a(this, "handleClickOverlay", () => {
      const { index: r } = this.state, { steps: l } = this.props;
      B(this.props, l[r]).disableOverlayClose || this.helpers.close("overlay");
    }), a(this, "syncState", (r) => {
      this.setState(r);
    });
    const { debug: o, getHelpers: t, run: s = !0, stepIndex: i } = e;
    this.store = Fe({
      ...e,
      controlled: s && P.number(i)
    }), this.helpers = this.store.getHelpers();
    const { addListener: n } = this.store;
    R({
      title: "init",
      data: [
        { key: "props", value: this.props },
        { key: "state", value: this.state }
      ],
      debug: o
    }), n(this.syncState), t && t(this.helpers), this.state = this.store.getState();
  }
  componentDidMount() {
    if (!I())
      return;
    const { debug: e, disableCloseOnEsc: o, run: t, steps: s } = this.props, { start: i } = this.store;
    te(s, e) && t && i(), o || document.body.addEventListener("keydown", this.handleKeyboard, { passive: !0 });
  }
  componentDidUpdate(e, o) {
    if (!I())
      return;
    const { action: t, controlled: s, index: i, status: n } = this.state, { debug: r, run: l, stepIndex: d, steps: c } = this.props, { stepIndex: u, steps: p } = e, { reset: f, setSteps: T, start: y, stop: S, update: v } = this.store, { changed: x } = W(e, this.props), { changed: E, changedFrom: N } = W(o, this.state), L = B(this.props, c[i]), Y = !ue(p, c), j = P.number(d) && x("stepIndex"), G = w(L.target);
    if (Y && (te(c, r) ? T(c) : console.warn("Steps are not valid", c)), x("run") && (l ? y(d) : S()), j) {
      let _ = P.number(u) && u < d ? b.NEXT : b.PREV;
      t === b.STOP && (_ = b.START), [g.FINISHED, g.SKIPPED].includes(n) || v({
        action: t === b.CLOSE ? b.CLOSE : _,
        index: d,
        lifecycle: h.INIT
      });
    }
    !s && n === g.RUNNING && i === 0 && !G && (this.store.update({ index: i + 1 }), this.callback({
      ...this.state,
      type: C.TARGET_NOT_FOUND,
      step: L
    }));
    const D = {
      ...this.state,
      index: i,
      step: L
    };
    if (E("action", [
      b.NEXT,
      b.PREV,
      b.SKIP,
      b.CLOSE
    ]) && E("status", g.PAUSED)) {
      const _ = B(this.props, c[o.index]);
      this.callback({
        ...D,
        index: o.index,
        lifecycle: h.COMPLETE,
        step: _,
        type: C.STEP_AFTER
      });
    }
    if (E("status", [g.FINISHED, g.SKIPPED])) {
      const _ = B(this.props, c[o.index]);
      s || this.callback({
        ...D,
        index: o.index,
        lifecycle: h.COMPLETE,
        step: _,
        type: C.STEP_AFTER
      }), this.callback({
        ...D,
        type: C.TOUR_END,
        // Return the last step when the tour is finished
        step: _,
        index: o.index
      }), f();
    } else N("status", [g.IDLE, g.READY], g.RUNNING) ? this.callback({
      ...D,
      type: C.TOUR_START
    }) : (E("status") || E("action", b.RESET)) && this.callback({
      ...D,
      type: C.TOUR_STATUS
    });
    this.scrollToStep(o);
  }
  componentWillUnmount() {
    const { disableCloseOnEsc: e } = this.props;
    e || document.body.removeEventListener("keydown", this.handleKeyboard);
  }
  scrollToStep(e) {
    const { index: o, lifecycle: t, status: s } = this.state, {
      debug: i,
      disableScrollParentFix: n = !1,
      scrollDuration: r,
      scrollOffset: l = 20,
      scrollToFirstStep: d = !1,
      steps: c
    } = this.props, u = B(this.props, c[o]), p = w(u.target), f = Ie({
      isFirstStep: o === 0,
      lifecycle: t,
      previousLifecycle: e.lifecycle,
      scrollToFirstStep: d,
      step: u,
      target: p
    });
    if (s === g.RUNNING && f) {
      const T = H(p, n), y = z(p, n);
      let S = Math.floor(Pe(p, l, n)) || 0;
      R({
        title: "scrollToStep",
        data: [
          { key: "index", value: o },
          { key: "lifecycle", value: t },
          { key: "status", value: s }
        ],
        debug: i
      });
      const v = this.store.getPopper("beacon"), x = this.store.getPopper("tooltip");
      if (t === h.BEACON && v) {
        const { offsets: E, placement: N } = v;
        !["bottom"].includes(N) && !T && (S = Math.floor(E.popper.top - l));
      } else if (t === h.TOOLTIP && x) {
        const { flipped: E, offsets: N, placement: L } = x;
        ["top", "right", "left"].includes(L) && !E && !T ? S = Math.floor(N.popper.top - l) : S -= u.spotlightPadding;
      }
      S = S >= 0 ? S : 0, s === g.RUNNING && xe(S, { element: y, duration: r }).then(
        () => {
          setTimeout(() => {
            var E;
            (E = this.store.getPopper("tooltip")) == null || E.instance.update();
          }, 10);
        }
      );
    }
  }
  render() {
    if (!I())
      return null;
    const { index: e, lifecycle: o, status: t } = this.state, {
      continuous: s = !1,
      debug: i = !1,
      nonce: n,
      scrollToFirstStep: r = !1,
      steps: l
    } = this.props, d = t === g.RUNNING, c = {};
    if (d && l[e]) {
      const u = B(this.props, l[e]);
      c.step = /* @__PURE__ */ m.createElement(
        $e,
        {
          ...this.state,
          callback: this.callback,
          continuous: s,
          debug: i,
          helpers: this.helpers,
          nonce: n,
          shouldScroll: !u.disableScrolling && (e !== 0 || r),
          step: u,
          store: this.store
        }
      ), c.overlay = /* @__PURE__ */ m.createElement(He, { id: "react-joyride-portal" }, /* @__PURE__ */ m.createElement(
        ze,
        {
          ...u,
          continuous: s,
          debug: i,
          lifecycle: o,
          onClickOverlay: this.handleClickOverlay
        }
      ));
    }
    return /* @__PURE__ */ m.createElement("div", { className: "react-joyride" }, c.step, c.overlay);
  }
};
a(de, "defaultProps", Le);
var lt = de;
export {
  b as ACTIONS,
  C as EVENTS,
  h as LIFECYCLE,
  g as STATUS,
  lt as default
};
//# sourceMappingURL=index.js.map
