import { aa as q, bn as vt, ab as Gt, o as $, aI as Zt, aJ as ft, r as Ge, t as Me, bd as yt, u as Ct, bo as Bt, j as P, W as Wt, l as Rt, O as Vt, T as xt, P as Xt, bp as At, bq as Ae } from "./index-CsBCemCF.js";
import * as J from "react";
import $e, { memo as Ft, useState as oe, useCallback as ae, useRef as Tt, useEffect as Ue, forwardRef as wt, createRef as Ht } from "react";
import { s as ze } from "./sprintf-D5E86llw.js";
import { u as kt } from "./useBasicWidgetState-KOlq_goV.js";
var se = {}, z = {}, ue = {}, de = {}, je;
function Te() {
  if (je) return de;
  je = 1, Object.defineProperty(de, "__esModule", { value: !0 }), de.Direction = void 0;
  var e;
  return (function(n) {
    n.Right = "to right", n.Left = "to left", n.Down = "to bottom", n.Up = "to top";
  })(e || (de.Direction = e = {})), de;
}
var Ee;
function qe() {
  return Ee || (Ee = 1, (function(e) {
    var n = ue && ue.__spreadArray || function(a, l, o) {
      if (o || arguments.length === 2) for (var b = 0, p = l.length, h; b < p; b++)
        (h || !(b in l)) && (h || (h = Array.prototype.slice.call(l, 0, b)), h[b] = l[b]);
      return a.concat(h || Array.prototype.slice.call(l));
    };
    Object.defineProperty(e, "__esModule", { value: !0 }), e.isIOS = e.useThumbOverlap = e.assertUnreachable = e.voidFn = e.getTrackBackground = e.replaceAt = e.schd = e.translate = e.getClosestThumbIndex = e.translateThumbs = e.getPaddingAndBorder = e.getMargin = e.checkInitialOverlap = e.checkValuesAgainstBoundaries = e.checkBoundaries = e.isVertical = e.relativeValue = e.normalizeValue = e.isStepDivisible = e.isTouchEvent = e.getStepDecimals = void 0;
    var i = $e, c = /* @__PURE__ */ Te(), m = function(a) {
      var l = a.toString().split(".")[1];
      return l ? l.length : 0;
    };
    e.getStepDecimals = m;
    function W(a) {
      return a.touches && a.touches.length || a.changedTouches && a.changedTouches.length;
    }
    e.isTouchEvent = W;
    function u(a, l, o) {
      var b = (l - a) / o, p = 8, h = Number(b.toFixed(p));
      return parseInt(h.toString(), 10) === h;
    }
    e.isStepDivisible = u;
    function I(a, l, o, b, p, h, Z) {
      var V = 1e11;
      if (a = Math.round(a * V) / V, !h) {
        var T = Z[l - 1], A = Z[l + 1];
        if (T && T > a)
          return T;
        if (A && A < a)
          return A;
      }
      if (a > b)
        return b;
      if (a < o)
        return o;
      var U = Math.floor(a * V - o * V) % Math.floor(p * V), N = Math.floor(a * V - Math.abs(U)), j = U === 0 ? a : N / V, H = Math.abs(U / V) < p / 2 ? j : j + p, k = (0, e.getStepDecimals)(p);
      return parseFloat(H.toFixed(k));
    }
    e.normalizeValue = I;
    function Y(a, l, o) {
      return (a - l) / (o - l);
    }
    e.relativeValue = Y;
    function O(a) {
      return a === c.Direction.Up || a === c.Direction.Down;
    }
    e.isVertical = O;
    function L(a, l, o) {
      if (l >= o)
        throw new RangeError("min (".concat(l, ") is equal/bigger than max (").concat(o, ")"));
      if (a < l)
        throw new RangeError("value (".concat(a, ") is smaller than min (").concat(l, ")"));
      if (a > o)
        throw new RangeError("value (".concat(a, ") is bigger than max (").concat(o, ")"));
    }
    e.checkBoundaries = L;
    function x(a, l, o) {
      return a < l ? l : a > o ? o : a;
    }
    e.checkValuesAgainstBoundaries = x;
    function G(a) {
      if (!(a.length < 2) && !a.slice(1).every(function(l, o) {
        return a[o] <= l;
      }))
        throw new RangeError("values={[".concat(a, "]} needs to be sorted when allowOverlap={false}"));
    }
    e.checkInitialOverlap = G;
    function d(a) {
      var l = window.getComputedStyle(a);
      return {
        top: parseInt(l["margin-top"], 10),
        bottom: parseInt(l["margin-bottom"], 10),
        left: parseInt(l["margin-left"], 10),
        right: parseInt(l["margin-right"], 10)
      };
    }
    e.getMargin = d;
    function t(a) {
      var l = window.getComputedStyle(a);
      return {
        top: parseInt(l["padding-top"], 10) + parseInt(l["border-top-width"], 10),
        bottom: parseInt(l["padding-bottom"], 10) + parseInt(l["border-bottom-width"], 10),
        left: parseInt(l["padding-left"], 10) + parseInt(l["border-left-width"], 10),
        right: parseInt(l["padding-right"], 10) + parseInt(l["border-right-width"], 10)
      };
    }
    e.getPaddingAndBorder = t;
    function r(a, l, o) {
      var b = o ? -1 : 1;
      a.forEach(function(p, h) {
        return g(p, b * l[h].x, l[h].y);
      });
    }
    e.translateThumbs = r;
    function s(a, l, o, b) {
      for (var p = 0, h = F(a[0], l, o, b), Z = 1; Z < a.length; Z++) {
        var V = F(a[Z], l, o, b);
        V < h && (h = V, p = Z);
      }
      return p;
    }
    e.getClosestThumbIndex = s;
    function g(a, l, o) {
      a.style.transform = "translate(".concat(l, "px, ").concat(o, "px)");
    }
    e.translate = g;
    var v = function(a) {
      var l = [], o = null, b = function() {
        for (var p = [], h = 0; h < arguments.length; h++)
          p[h] = arguments[h];
        l = p, !o && (o = requestAnimationFrame(function() {
          o = null, a.apply(void 0, l);
        }));
      };
      return b;
    };
    e.schd = v;
    function f(a, l, o) {
      var b = a.slice(0);
      return b[l] = o, b;
    }
    e.replaceAt = f;
    function X(a) {
      var l = a.values, o = a.colors, b = a.min, p = a.max, h = a.direction, Z = h === void 0 ? c.Direction.Right : h, V = a.rtl, T = V === void 0 ? !1 : V;
      T && Z === c.Direction.Right ? Z = c.Direction.Left : T && c.Direction.Left && (Z = c.Direction.Right);
      var A = l.slice(0).sort(function(N, j) {
        return N - j;
      }).map(function(N) {
        return (N - b) / (p - b) * 100;
      }), U = A.reduce(function(N, j, H) {
        return "".concat(N, ", ").concat(o[H], " ").concat(j, "%, ").concat(o[H + 1], " ").concat(j, "%");
      }, "");
      return "linear-gradient(".concat(Z, ", ").concat(o[0], " 0%").concat(U, ", ").concat(o[o.length - 1], " 100%)");
    }
    e.getTrackBackground = X;
    function y() {
    }
    e.voidFn = y;
    function C(a) {
      throw new Error("Didn't expect to get here");
    }
    e.assertUnreachable = C;
    var R = function(a, l, o, b, p) {
      p === void 0 && (p = function(Z) {
        return Z;
      });
      var h = Math.ceil(n([a], Array.from(a.children), !0).reduce(function(Z, V) {
        var T = Math.ceil(V.getBoundingClientRect().width);
        if (V.innerText && V.innerText.includes(o) && V.childElementCount === 0) {
          var A = V.cloneNode(!0);
          A.innerHTML = p(l.toFixed(b)), A.style.visibility = "hidden", document.body.appendChild(A), T = Math.ceil(A.getBoundingClientRect().width), document.body.removeChild(A);
        }
        return T > Z ? T : Z;
      }, a.getBoundingClientRect().width));
      return h;
    }, w = function(a, l, o, b, p, h, Z) {
      Z === void 0 && (Z = function(A) {
        return A;
      });
      var V = [], T = function(A) {
        var U = R(o[A], b[A], p, h, Z), N = l[A].x;
        l.forEach(function(j, H) {
          var k = j.x, K = R(o[H], b[H], p, h, Z);
          A !== H && (N >= k && N <= k + K || N + U >= k && N + U <= k + K) && (V.includes(H) || (V.push(A), V.push(H), V = n(n([], V, !0), [A, H], !1), T(H)));
        });
      };
      return T(a), Array.from(new Set(V.sort()));
    }, B = function(a, l, o, b, p, h) {
      b === void 0 && (b = 0.1), p === void 0 && (p = " - "), h === void 0 && (h = function(H) {
        return H;
      });
      var Z = (0, e.getStepDecimals)(b), V = (0, i.useState)({}), T = V[0], A = V[1], U = (0, i.useState)(h(l[o].toFixed(Z))), N = U[0], j = U[1];
      return (0, i.useEffect)(function() {
        if (a) {
          var H = a.getThumbs();
          if (H.length < 1)
            return;
          var k = {}, K = a.getOffsets(), ie = w(o, K, H, l, p, Z, h), ge = h(l[o].toFixed(Z));
          if (ie.length) {
            var ee = ie.reduce(function(te, le, he, pe) {
              return te.length ? n(n([], te, !0), [K[pe[he]].x], !1) : [K[pe[he]].x];
            }, []);
            if (Math.min.apply(Math, ee) === K[o].x) {
              var be = [];
              ie.forEach(function(te) {
                be.push(l[te].toFixed(Z));
              }), ge = Array.from(new Set(be.sort(function(te, le) {
                return parseFloat(te) - parseFloat(le);
              }))).map(h).join(p);
              var Ie = Math.min.apply(Math, ee), me = Math.max.apply(Math, ee), Xe = H[ie[ee.indexOf(me)]].getBoundingClientRect().width;
              k.left = "".concat(Math.abs(Ie - (me + Xe)) / 2, "px"), k.transform = "translate(-50%, 0)";
            } else
              k.visibility = "hidden";
          }
          j(ge), A(k);
        }
      }, [a, l]), [N, T];
    };
    e.useThumbOverlap = B;
    function F(a, l, o, b) {
      var p = a.getBoundingClientRect(), h = p.left, Z = p.top, V = p.width, T = p.height;
      return O(b) ? Math.abs(o - (Z + T / 2)) : Math.abs(l - (h + V / 2));
    }
    var S = function() {
      var a, l = ((a = navigator.userAgentData) === null || a === void 0 ? void 0 : a.platform) || navigator.platform;
      return [
        "iPad Simulator",
        "iPhone Simulator",
        "iPod Simulator",
        "iPad",
        "iPhone",
        "iPod"
      ].includes(l) || // iPad on iOS 13 detection
      navigator.userAgent.includes("Mac") && "ontouchend" in document;
    };
    e.isIOS = S;
  })(ue)), ue;
}
var De;
function St() {
  if (De) return z;
  De = 1;
  var e = z && z.__extends || /* @__PURE__ */ (function() {
    var x = function(G, d) {
      return x = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) {
        t.__proto__ = r;
      } || function(t, r) {
        for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
      }, x(G, d);
    };
    return function(G, d) {
      if (typeof d != "function" && d !== null)
        throw new TypeError("Class extends value " + String(d) + " is not a constructor or null");
      x(G, d);
      function t() {
        this.constructor = G;
      }
      G.prototype = d === null ? Object.create(d) : (t.prototype = d.prototype, new t());
    };
  })(), n = z && z.__createBinding || (Object.create ? (function(x, G, d, t) {
    t === void 0 && (t = d);
    var r = Object.getOwnPropertyDescriptor(G, d);
    (!r || ("get" in r ? !G.__esModule : r.writable || r.configurable)) && (r = { enumerable: !0, get: function() {
      return G[d];
    } }), Object.defineProperty(x, t, r);
  }) : (function(x, G, d, t) {
    t === void 0 && (t = d), x[t] = G[d];
  })), i = z && z.__setModuleDefault || (Object.create ? (function(x, G) {
    Object.defineProperty(x, "default", { enumerable: !0, value: G });
  }) : function(x, G) {
    x.default = G;
  }), c = z && z.__importStar || function(x) {
    if (x && x.__esModule) return x;
    var G = {};
    if (x != null) for (var d in x) d !== "default" && Object.prototype.hasOwnProperty.call(x, d) && n(G, x, d);
    return i(G, x), G;
  }, m = z && z.__spreadArray || function(x, G, d) {
    if (d || arguments.length === 2) for (var t = 0, r = G.length, s; t < r; t++)
      (s || !(t in G)) && (s || (s = Array.prototype.slice.call(G, 0, t)), s[t] = G[t]);
    return x.concat(s || Array.prototype.slice.call(G));
  };
  Object.defineProperty(z, "__esModule", { value: !0 });
  var W = c($e), u = /* @__PURE__ */ qe(), I = /* @__PURE__ */ Te(), Y = ["ArrowRight", "ArrowUp", "k", "PageUp"], O = ["ArrowLeft", "ArrowDown", "j", "PageDown"], L = (
    /** @class */
    (function(x) {
      e(G, x);
      function G(d) {
        var t = x.call(this, d) || this;
        if (t.trackRef = W.createRef(), t.thumbRefs = [], t.state = {
          draggedTrackPos: [-1, -1],
          draggedThumbIndex: -1,
          thumbZIndexes: new Array(t.props.values.length).fill(0).map(function(r, s) {
            return s;
          }),
          isChanged: !1,
          markOffsets: []
        }, t.getOffsets = function() {
          var r = t.props, s = r.direction, g = r.values, v = r.min, f = r.max, X = t.trackRef.current;
          if (!X)
            return console.warn("No track element found."), [];
          var y = X.getBoundingClientRect(), C = (0, u.getPaddingAndBorder)(X);
          return t.getThumbs().map(function(R, w) {
            var B = { x: 0, y: 0 }, F = R.getBoundingClientRect(), S = (0, u.getMargin)(R);
            switch (s) {
              case I.Direction.Right:
                return B.x = (S.left + C.left) * -1, B.y = ((F.height - y.height) / 2 + C.top) * -1, B.x += y.width * (0, u.relativeValue)(g[w], v, f) - F.width / 2, B;
              case I.Direction.Left:
                return B.x = (S.right + C.right) * -1, B.y = ((F.height - y.height) / 2 + C.top) * -1, B.x += y.width - y.width * (0, u.relativeValue)(g[w], v, f) - F.width / 2, B;
              case I.Direction.Up:
                return B.x = ((F.width - y.width) / 2 + S.left + C.left) * -1, B.y = -C.left, B.y += y.height - y.height * (0, u.relativeValue)(g[w], v, f) - F.height / 2, B;
              case I.Direction.Down:
                return B.x = ((F.width - y.width) / 2 + S.left + C.left) * -1, B.y = -C.left, B.y += y.height * (0, u.relativeValue)(g[w], v, f) - F.height / 2, B;
              default:
                return (0, u.assertUnreachable)(s);
            }
          });
        }, t.getThumbs = function() {
          return t.trackRef && t.trackRef.current ? Array.from(t.trackRef.current.children).filter(function(r) {
            return r.hasAttribute("aria-valuenow");
          }) : (console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"), []);
        }, t.getTargetIndex = function(r) {
          return t.getThumbs().findIndex(function(s) {
            return s === r.target || s.contains(r.target);
          });
        }, t.addTouchEvents = function(r) {
          document.addEventListener("touchmove", t.schdOnTouchMove, {
            passive: !1
          }), document.addEventListener("touchend", t.schdOnEnd, {
            passive: !1
          }), document.addEventListener("touchcancel", t.schdOnEnd, {
            passive: !1
          });
        }, t.addMouseEvents = function(r) {
          document.addEventListener("mousemove", t.schdOnMouseMove), document.addEventListener("mouseup", t.schdOnEnd);
        }, t.onMouseDownTrack = function(r) {
          var s;
          if (!(r.button !== 0 || (0, u.isIOS)()))
            if (r.persist(), r.preventDefault(), t.addMouseEvents(r.nativeEvent), t.props.values.length > 1 && t.props.draggableTrack) {
              if (t.thumbRefs.some(function(v) {
                var f;
                return (f = v.current) === null || f === void 0 ? void 0 : f.contains(r.target);
              }))
                return;
              t.setState({
                draggedTrackPos: [r.clientX, r.clientY]
              }, function() {
                return t.onMove(r.clientX, r.clientY);
              });
            } else {
              var g = (0, u.getClosestThumbIndex)(t.thumbRefs.map(function(v) {
                return v.current;
              }), r.clientX, r.clientY, t.props.direction);
              (s = t.thumbRefs[g].current) === null || s === void 0 || s.focus(), t.setState({
                draggedThumbIndex: g
              }, function() {
                return t.onMove(r.clientX, r.clientY);
              });
            }
        }, t.onResize = function() {
          (0, u.translateThumbs)(t.getThumbs(), t.getOffsets(), t.props.rtl), t.calculateMarkOffsets();
        }, t.onTouchStartTrack = function(r) {
          var s;
          if (r.persist(), t.addTouchEvents(r.nativeEvent), t.props.values.length > 1 && t.props.draggableTrack) {
            if (t.thumbRefs.some(function(v) {
              var f;
              return (f = v.current) === null || f === void 0 ? void 0 : f.contains(r.target);
            }))
              return;
            t.setState({
              draggedTrackPos: [r.touches[0].clientX, r.touches[0].clientY]
            }, function() {
              return t.onMove(r.touches[0].clientX, r.touches[0].clientY);
            });
          } else {
            var g = (0, u.getClosestThumbIndex)(t.thumbRefs.map(function(v) {
              return v.current;
            }), r.touches[0].clientX, r.touches[0].clientY, t.props.direction);
            (s = t.thumbRefs[g].current) === null || s === void 0 || s.focus(), t.setState({
              draggedThumbIndex: g
            }, function() {
              return t.onMove(r.touches[0].clientX, r.touches[0].clientY);
            });
          }
        }, t.onMouseOrTouchStart = function(r) {
          if (!t.props.disabled) {
            var s = (0, u.isTouchEvent)(r);
            if (!(!s && r.button !== 0)) {
              var g = t.getTargetIndex(r);
              g !== -1 && (s ? t.addTouchEvents(r) : t.addMouseEvents(r), t.setState({
                draggedThumbIndex: g,
                thumbZIndexes: t.state.thumbZIndexes.map(function(v, f) {
                  return f === g ? Math.max.apply(Math, t.state.thumbZIndexes) : v <= t.state.thumbZIndexes[g] ? v : v - 1;
                })
              }));
            }
          }
        }, t.onMouseMove = function(r) {
          r.preventDefault(), t.onMove(r.clientX, r.clientY);
        }, t.onTouchMove = function(r) {
          r.preventDefault(), t.onMove(r.touches[0].clientX, r.touches[0].clientY);
        }, t.onKeyDown = function(r) {
          var s = t.props, g = s.values, v = s.onChange, f = s.step, X = s.rtl, y = s.direction, C = t.state.isChanged, R = t.getTargetIndex(r.nativeEvent), w = X || y === I.Direction.Left || y === I.Direction.Down ? -1 : 1;
          R !== -1 && (Y.includes(r.key) ? (r.preventDefault(), t.setState({
            draggedThumbIndex: R,
            isChanged: !0
          }), v((0, u.replaceAt)(g, R, t.normalizeValue(g[R] + w * (r.key === "PageUp" ? f * 10 : f), R)))) : O.includes(r.key) ? (r.preventDefault(), t.setState({
            draggedThumbIndex: R,
            isChanged: !0
          }), v((0, u.replaceAt)(g, R, t.normalizeValue(g[R] - w * (r.key === "PageDown" ? f * 10 : f), R)))) : r.key === "Tab" ? t.setState({ draggedThumbIndex: -1 }, function() {
            C && t.fireOnFinalChange();
          }) : C && t.fireOnFinalChange());
        }, t.onKeyUp = function(r) {
          var s = t.state.isChanged;
          t.setState({
            draggedThumbIndex: -1
          }, function() {
            s && t.fireOnFinalChange();
          });
        }, t.onMove = function(r, s) {
          var g = t.state, v = g.draggedThumbIndex, f = g.draggedTrackPos, X = t.props, y = X.direction, C = X.min, R = X.max, w = X.onChange, B = X.values, F = X.step, S = X.rtl;
          if (v === -1 && f[0] === -1 && f[1] === -1)
            return null;
          var a = t.trackRef.current;
          if (!a)
            return null;
          var l = a.getBoundingClientRect(), o = (0, u.isVertical)(y) ? l.height : l.width;
          if (f[0] !== -1 && f[1] !== -1) {
            var b = r - f[0], p = s - f[1], h = 0;
            switch (y) {
              case I.Direction.Right:
              case I.Direction.Left:
                h = b / o * (R - C);
                break;
              case I.Direction.Down:
              case I.Direction.Up:
                h = p / o * (R - C);
                break;
              default:
                (0, u.assertUnreachable)(y);
            }
            if (S && (h *= -1), Math.abs(h) >= F / 2) {
              for (var Z = 0; Z < t.thumbRefs.length; Z++) {
                if (B[Z] === R && Math.sign(h) === 1 || B[Z] === C && Math.sign(h) === -1)
                  return;
                var V = B[Z] + h;
                V > R ? h = R - B[Z] : V < C && (h = C - B[Z]);
              }
              for (var T = B.slice(0), Z = 0; Z < t.thumbRefs.length; Z++)
                T = (0, u.replaceAt)(T, Z, t.normalizeValue(B[Z] + h, Z));
              t.setState({
                draggedTrackPos: [r, s]
              }), w(T);
            }
          } else {
            var A = 0;
            switch (y) {
              case I.Direction.Right:
                A = (r - l.left) / o * (R - C) + C;
                break;
              case I.Direction.Left:
                A = (o - (r - l.left)) / o * (R - C) + C;
                break;
              case I.Direction.Down:
                A = (s - l.top) / o * (R - C) + C;
                break;
              case I.Direction.Up:
                A = (o - (s - l.top)) / o * (R - C) + C;
                break;
              default:
                (0, u.assertUnreachable)(y);
            }
            S && (A = R + C - A), Math.abs(B[v] - A) >= F / 2 && w((0, u.replaceAt)(B, v, t.normalizeValue(A, v)));
          }
        }, t.normalizeValue = function(r, s) {
          var g = t.props, v = g.min, f = g.max, X = g.step, y = g.allowOverlap, C = g.values;
          return (0, u.normalizeValue)(r, s, v, f, X, y, C);
        }, t.onEnd = function(r) {
          if (r.preventDefault(), document.removeEventListener("mousemove", t.schdOnMouseMove), document.removeEventListener("touchmove", t.schdOnTouchMove), document.removeEventListener("mouseup", t.schdOnEnd), document.removeEventListener("touchend", t.schdOnEnd), document.removeEventListener("touchcancel", t.schdOnEnd), t.state.draggedThumbIndex === -1 && t.state.draggedTrackPos[0] === -1 && t.state.draggedTrackPos[1] === -1)
            return null;
          t.setState({ draggedThumbIndex: -1, draggedTrackPos: [-1, -1] }, function() {
            t.fireOnFinalChange();
          });
        }, t.fireOnFinalChange = function() {
          t.setState({ isChanged: !1 });
          var r = t.props, s = r.onFinalChange, g = r.values;
          s && s(g);
        }, t.updateMarkRefs = function(r) {
          if (!r.renderMark) {
            t.numOfMarks = void 0, t.markRefs = void 0;
            return;
          }
          t.numOfMarks = (r.max - r.min) / t.props.step, t.markRefs = [];
          for (var s = 0; s < t.numOfMarks + 1; s++)
            t.markRefs[s] = W.createRef();
        }, t.calculateMarkOffsets = function() {
          if (!(!t.props.renderMark || !t.trackRef || !t.numOfMarks || !t.markRefs || t.trackRef.current === null)) {
            for (var r = window.getComputedStyle(t.trackRef.current), s = parseInt(r.width, 10), g = parseInt(r.height, 10), v = parseInt(r.paddingLeft, 10), f = parseInt(r.paddingTop, 10), X = [], y = 0; y < t.numOfMarks + 1; y++) {
              var C = 9999, R = 9999;
              if (t.markRefs[y].current) {
                var w = t.markRefs[y].current.getBoundingClientRect();
                C = w.height, R = w.width;
              }
              t.props.direction === I.Direction.Left || t.props.direction === I.Direction.Right ? X.push([
                Math.round(s / t.numOfMarks * y + v - R / 2),
                -Math.round((C - g) / 2)
              ]) : X.push([
                Math.round(g / t.numOfMarks * y + f - C / 2),
                -Math.round((R - s) / 2)
              ]);
            }
            t.setState({ markOffsets: X });
          }
        }, d.step === 0)
          throw new Error('"step" property should be a positive number');
        return t.schdOnMouseMove = (0, u.schd)(t.onMouseMove), t.schdOnTouchMove = (0, u.schd)(t.onTouchMove), t.schdOnEnd = (0, u.schd)(t.onEnd), t.thumbRefs = d.values.map(function() {
          return W.createRef();
        }), t.updateMarkRefs(d), t;
      }
      return G.prototype.componentDidMount = function() {
        var d = this, t = this.props, r = t.values, s = t.min, g = t.step;
        this.resizeObserver = window.ResizeObserver ? new window.ResizeObserver(this.onResize) : {
          observe: function() {
            return window.addEventListener("resize", d.onResize);
          },
          unobserve: function() {
            return window.removeEventListener("resize", d.onResize);
          }
        }, document.addEventListener("touchstart", this.onMouseOrTouchStart, {
          passive: !1
        }), document.addEventListener("mousedown", this.onMouseOrTouchStart, {
          passive: !1
        }), !this.props.allowOverlap && (0, u.checkInitialOverlap)(this.props.values), this.props.values.forEach(function(v) {
          return (0, u.checkBoundaries)(v, d.props.min, d.props.max);
        }), this.resizeObserver.observe(this.trackRef.current), (0, u.translateThumbs)(this.getThumbs(), this.getOffsets(), this.props.rtl), this.calculateMarkOffsets(), r.forEach(function(v) {
          (0, u.isStepDivisible)(s, v, g) || console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.");
        });
      }, G.prototype.componentDidUpdate = function(d, t) {
        var r = this.props, s = r.max, g = r.min, v = r.step, f = r.values, X = r.rtl;
        (d.max !== s || d.min !== g || d.step !== v) && this.updateMarkRefs(this.props), (0, u.translateThumbs)(this.getThumbs(), this.getOffsets(), X), (d.max !== s || d.min !== g || d.step !== v || t.markOffsets.length !== this.state.markOffsets.length) && (this.calculateMarkOffsets(), f.forEach(function(y) {
          (0, u.isStepDivisible)(g, y, v) || console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.");
        }));
      }, G.prototype.componentWillUnmount = function() {
        var d = {
          passive: !1
        };
        document.removeEventListener("mousedown", this.onMouseOrTouchStart, d), document.removeEventListener("mousemove", this.schdOnMouseMove), document.removeEventListener("touchmove", this.schdOnTouchMove), document.removeEventListener("touchstart", this.onMouseOrTouchStart), document.removeEventListener("mouseup", this.schdOnEnd), document.removeEventListener("touchend", this.schdOnEnd), this.resizeObserver.unobserve(this.trackRef.current);
      }, G.prototype.render = function() {
        var d = this, t = this.props, r = t.label, s = t.labelledBy, g = t.renderTrack, v = t.renderThumb, f = t.renderMark, X = f === void 0 ? function() {
          return null;
        } : f, y = t.values, C = t.min, R = t.max, w = t.allowOverlap, B = t.disabled, F = this.state, S = F.draggedThumbIndex, a = F.thumbZIndexes, l = F.markOffsets;
        return g({
          props: {
            style: {
              // creates stacking context that prevents z-index applied to thumbs
              // interfere with other elements
              transform: "scale(1)",
              cursor: S > -1 ? "grabbing" : this.props.draggableTrack ? (0, u.isVertical)(this.props.direction) ? "ns-resize" : "ew-resize" : y.length === 1 && !B ? "pointer" : "inherit"
            },
            onMouseDown: B ? u.voidFn : this.onMouseDownTrack,
            onTouchStart: B ? u.voidFn : this.onTouchStartTrack,
            ref: this.trackRef
          },
          isDragged: this.state.draggedThumbIndex > -1,
          disabled: B,
          children: m(m([], l.map(function(o, b, p) {
            return X({
              props: {
                style: d.props.direction === I.Direction.Left || d.props.direction === I.Direction.Right ? {
                  position: "absolute",
                  left: "".concat(o[0], "px"),
                  marginTop: "".concat(o[1], "px")
                } : {
                  position: "absolute",
                  top: "".concat(o[0], "px"),
                  marginLeft: "".concat(o[1], "px")
                },
                key: "mark".concat(b),
                ref: d.markRefs[b]
              },
              index: b
            });
          }), !0), y.map(function(o, b) {
            var p = d.state.draggedThumbIndex === b;
            return v({
              index: b,
              value: o,
              isDragged: p,
              props: {
                style: {
                  position: "absolute",
                  zIndex: a[b],
                  cursor: B ? "inherit" : p ? "grabbing" : "grab",
                  userSelect: "none",
                  touchAction: "none",
                  WebkitUserSelect: "none",
                  MozUserSelect: "none",
                  msUserSelect: "none"
                },
                key: b,
                tabIndex: B ? void 0 : 0,
                "aria-valuemax": w ? R : y[b + 1] || R,
                "aria-valuemin": w ? C : y[b - 1] || C,
                "aria-valuenow": o,
                draggable: !1,
                ref: d.thumbRefs[b],
                "aria-label": r,
                "aria-labelledby": s,
                role: "slider",
                onKeyDown: B ? u.voidFn : d.onKeyDown,
                onKeyUp: B ? u.voidFn : d.onKeyUp
              }
            });
          }), !0)
        });
      }, G.defaultProps = {
        label: "Accessibility label",
        labelledBy: null,
        step: 1,
        direction: I.Direction.Right,
        rtl: !1,
        disabled: !1,
        allowOverlap: !1,
        draggableTrack: !1,
        min: 0,
        max: 100
      }, G;
    })(W.Component)
  );
  return z.default = L, z;
}
var Qe;
function Yt() {
  return Qe || (Qe = 1, (function(e) {
    var n = se && se.__importDefault || function(W) {
      return W && W.__esModule ? W : { default: W };
    };
    Object.defineProperty(e, "__esModule", { value: !0 }), e.checkValuesAgainstBoundaries = e.relativeValue = e.useThumbOverlap = e.Direction = e.getTrackBackground = e.Range = void 0;
    var i = n(/* @__PURE__ */ St());
    e.Range = i.default;
    var c = /* @__PURE__ */ qe();
    Object.defineProperty(e, "getTrackBackground", { enumerable: !0, get: function() {
      return c.getTrackBackground;
    } }), Object.defineProperty(e, "useThumbOverlap", { enumerable: !0, get: function() {
      return c.useThumbOverlap;
    } }), Object.defineProperty(e, "relativeValue", { enumerable: !0, get: function() {
      return c.relativeValue;
    } }), Object.defineProperty(e, "checkValuesAgainstBoundaries", { enumerable: !0, get: function() {
      return c.checkValuesAgainstBoundaries;
    } });
    var m = /* @__PURE__ */ Te();
    Object.defineProperty(e, "Direction", { enumerable: !0, get: function() {
      return m.Direction;
    } });
  })(se)), se;
}
var et = /* @__PURE__ */ Yt();
function _e(e, n) {
  var i = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var c = Object.getOwnPropertySymbols(e);
    n && (c = c.filter(function(m) {
      return Object.getOwnPropertyDescriptor(e, m).enumerable;
    })), i.push.apply(i, c);
  }
  return i;
}
function ve(e) {
  for (var n = 1; n < arguments.length; n++) {
    var i = arguments[n] != null ? arguments[n] : {};
    n % 2 ? _e(Object(i), !0).forEach(function(c) {
      Jt(e, c, i[c]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) : _e(Object(i)).forEach(function(c) {
      Object.defineProperty(e, c, Object.getOwnPropertyDescriptor(i, c));
    });
  }
  return e;
}
function Jt(e, n, i) {
  return n in e ? Object.defineProperty(e, n, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = i, e;
}
var Ze = q("div", {
  position: "relative",
  width: "100%"
});
Ze.displayName = "Root";
Ze.displayName = "Root";
Ze.displayName = "StyledRoot";
var fe = q("div", function(e) {
  var n = e.$theme, i = e.$value, c = i === void 0 ? [] : i, m = e.$disabled, W = e.$isDragged, u = n.sizing, I = "inherit";
  return m ? I = "not-allowed" : W ? I = "grabbing" : c.length === 1 && (I = "pointer"), {
    paddingTop: u.scale600,
    paddingBottom: u.scale600,
    paddingRight: u.scale600,
    paddingLeft: u.scale600,
    display: "flex",
    cursor: I,
    backgroundColor: n.colors.sliderTrackFill
  };
});
fe.displayName = "Track";
fe.displayName = "Track";
fe.displayName = "StyledTrack";
var ye = q("div", function(e) {
  var n = e.$theme, i = e.$value, c = i === void 0 ? [] : i, m = e.$min, W = e.$max, u = e.$disabled, I = n.colors, Y = n.borders, O = n.direction, L = n.borders.useRoundedCorners ? Y.radius100 : 0;
  return {
    borderTopLeftRadius: L,
    borderTopRightRadius: L,
    borderBottomRightRadius: L,
    borderBottomLeftRadius: L,
    background: et.getTrackBackground({
      values: c,
      colors: c.length === 1 ? [u ? I.borderOpaque : I.primary, u ? I.backgroundSecondary : I.borderOpaque] : [u ? I.backgroundSecondary : I.borderOpaque, u ? I.borderOpaque : I.primary, u ? I.backgroundSecondary : I.borderOpaque],
      min: m || 0,
      max: W || 0,
      rtl: O === "rtl"
    }),
    height: "2px",
    width: "100%",
    alignSelf: "center",
    cursor: u ? "not-allowed" : "inherit"
  };
});
ye.displayName = "InnerTrack";
ye.displayName = "InnerTrack";
ye.displayName = "StyledInnerTrack";
var Ce = q("div", function(e) {
  return {
    width: "4px",
    height: "2px",
    backgroundColor: e.$theme.colors.backgroundPrimary,
    marginLeft: "16px"
  };
});
Ce.displayName = "Mark";
Ce.displayName = "Mark";
Ce.displayName = "StyledMark";
var Be = q("div", function(e) {
  return ve(ve({}, e.$theme.typography.font200), {}, {
    color: e.$theme.colors.contentPrimary
  });
});
Be.displayName = "Tick";
Be.displayName = "Tick";
Be.displayName = "StyledTick";
var We = q("div", function(e) {
  var n = e.$theme, i = n.sizing;
  return {
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    paddingRight: i.scale600,
    paddingLeft: i.scale600,
    paddingBottom: i.scale400
  };
});
We.displayName = "TickBar";
We.displayName = "TickBar";
We.displayName = "StyledTickBar";
var Re = q("div", function(e) {
  var n = e.$theme, i = e.$value, c = i === void 0 ? [] : i, m = e.$thumbIndex, W = e.$disabled, u = c.length === 2 && m === 0, I = c.length === 2 && m === 1;
  return n.direction === "rtl" && (I || u) && (u = !u, I = !I), {
    height: "24px",
    width: "24px",
    borderTopLeftRadius: "24px",
    borderTopRightRadius: "24px",
    borderBottomLeftRadius: "24px",
    borderBottomRightRadius: "24px",
    display: "flex",
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: W ? n.colors.sliderHandleFillDisabled : n.colors.sliderHandleFill,
    outline: "none",
    boxShadow: e.$isFocusVisible ? "0 0 0 3px ".concat(n.colors.accent) : "0 1px 4px rgba(0, 0, 0, 0.12)",
    cursor: W ? "not-allowed" : "inherit"
  };
});
Re.displayName = "Thumb";
Re.displayName = "Thumb";
Re.displayName = "StyledThumb";
var Ve = q("div", function(e) {
  var n = e.$disabled, i = e.$theme;
  return {
    position: "absolute",
    top: "-16px",
    width: "4px",
    height: "20px",
    backgroundColor: n ? i.colors.sliderHandleFillDisabled : i.colors.sliderHandleInnerFill
  };
});
Ve.displayName = "InnerThumb";
Ve.displayName = "InnerThumb";
Ve.displayName = "StyledInnerThumb";
var xe = q("div", function(e) {
  var n = e.$disabled, i = e.$theme;
  return ve(ve({
    position: "absolute",
    top: "-".concat(i.sizing.scale1400)
  }, i.typography.font200), {}, {
    backgroundColor: n ? i.colors.sliderHandleFillDisabled : i.colors.sliderHandleInnerFill,
    color: i.colors.contentInversePrimary,
    paddingLeft: i.sizing.scale600,
    paddingRight: i.sizing.scale600,
    paddingTop: i.sizing.scale500,
    paddingBottom: i.sizing.scale500,
    borderBottomLeftRadius: "48px",
    borderBottomRightRadius: "48px",
    borderTopLeftRadius: "48px",
    borderTopRightRadius: "48px",
    whiteSpace: "nowrap"
  });
});
xe.displayName = "ThumbValue";
xe.displayName = "ThumbValue";
xe.displayName = "StyledThumbValue";
function Pe(e, n) {
  var i = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var c = Object.getOwnPropertySymbols(e);
    n && (c = c.filter(function(m) {
      return Object.getOwnPropertyDescriptor(e, m).enumerable;
    })), i.push.apply(i, c);
  }
  return i;
}
function Ot(e) {
  for (var n = 1; n < arguments.length; n++) {
    var i = arguments[n] != null ? arguments[n] : {};
    n % 2 ? Pe(Object(i), !0).forEach(function(c) {
      Lt(e, c, i[c]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) : Pe(Object(i)).forEach(function(c) {
      Object.defineProperty(e, c, Object.getOwnPropertyDescriptor(i, c));
    });
  }
  return e;
}
function Lt(e, n, i) {
  return n in e ? Object.defineProperty(e, n, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[n] = i, e;
}
function Q() {
  return Q = Object.assign ? Object.assign.bind() : function(e) {
    for (var n = 1; n < arguments.length; n++) {
      var i = arguments[n];
      for (var c in i)
        Object.prototype.hasOwnProperty.call(i, c) && (e[c] = i[c]);
    }
    return e;
  }, Q.apply(this, arguments);
}
function D(e, n) {
  return zt(e) || Ut(e, n) || Mt(e, n) || Nt();
}
function Nt() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function Mt(e, n) {
  if (e) {
    if (typeof e == "string") return Ke(e, n);
    var i = Object.prototype.toString.call(e).slice(8, -1);
    if (i === "Object" && e.constructor && (i = e.constructor.name), i === "Map" || i === "Set") return Array.from(e);
    if (i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return Ke(e, n);
  }
}
function Ke(e, n) {
  (n == null || n > e.length) && (n = e.length);
  for (var i = 0, c = new Array(n); i < n; i++)
    c[i] = e[i];
  return c;
}
function Ut(e, n) {
  var i = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
  if (i != null) {
    var c = [], m = !0, W = !1, u, I;
    try {
      for (i = i.call(e); !(m = (u = i.next()).done) && (c.push(u.value), !(n && c.length === n)); m = !0)
        ;
    } catch (Y) {
      W = !0, I = Y;
    } finally {
      try {
        !m && i.return != null && i.return();
      } finally {
        if (W) throw I;
      }
    }
    return c;
  }
}
function zt(e) {
  if (Array.isArray(e)) return e;
}
var jt = function(n) {
  if (n.length > 2 || n.length === 0)
    throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");
  return n;
};
function Et(e) {
  var n = e.overrides, i = n === void 0 ? {} : n, c = e.disabled, m = c === void 0 ? !1 : c, W = e.marks, u = W === void 0 ? !1 : W, I = e.onChange, Y = I === void 0 ? function() {
  } : I, O = e.onFinalChange, L = O === void 0 ? function() {
  } : O, x = e.min, G = x === void 0 ? 0 : x, d = e.max, t = d === void 0 ? 100 : d, r = e.step, s = r === void 0 ? 1 : r, g = e.persistentThumb, v = g === void 0 ? !1 : g, f = e.valueToLabel, X = f === void 0 ? function(_) {
    return _;
  } : f, y = e.value, C = J.useContext(vt), R = J.useState(!1), w = D(R, 2), B = w[0], F = w[1], S = J.useState(!1), a = D(S, 2), l = a[0], o = a[1], b = J.useState(!1), p = D(b, 2), h = p[0], Z = p[1], V = J.useState(-1), T = D(V, 2), A = T[0], U = T[1], N = J.useCallback(function(_) {
    Gt(_) && Z(!0);
    var M = _.target.parentNode.firstChild === _.target ? 0 : 1;
    U(M);
  }, []), j = J.useCallback(function(_) {
    h !== !1 && Z(!1), U(-1);
  }, []), H = jt(y), k = {
    $disabled: m,
    $step: s,
    $min: G,
    $max: t,
    $marks: u,
    $value: H,
    $isFocusVisible: h
  }, K = $(i.Root, Ze), ie = D(K, 2), ge = ie[0], ee = ie[1], be = $(i.Track, fe), Ie = D(be, 2), me = Ie[0], Xe = Ie[1], te = $(i.InnerTrack, ye), le = D(te, 2), he = le[0], pe = le[1], tt = $(i.Thumb, Re), we = D(tt, 2), nt = we[0], it = we[1], rt = $(i.InnerThumb, Ve), He = D(rt, 2), at = He[0], ct = He[1], lt = $(i.ThumbValue, xe), ke = D(lt, 2), ot = ke[0], st = ke[1], ut = $(i.Tick, Be), Se = D(ut, 2), Ye = Se[0], Je = Se[1], dt = $(i.TickBar, We), Oe = D(dt, 2), gt = Oe[0], bt = Oe[1], It = $(i.Mark, Ce), Le = D(It, 2), mt = Le[0], ht = Le[1];
  return /* @__PURE__ */ J.createElement(ge, Q({
    "data-baseweb": "slider"
  }, k, ee, {
    onFocus: ft(ee, N),
    onBlur: Zt(ee, j)
  }), /* @__PURE__ */ J.createElement(et.Range, Q({
    step: s,
    min: G,
    max: t,
    values: H,
    disabled: m,
    onChange: function(M) {
      return Y({
        value: M
      });
    },
    onFinalChange: function(M) {
      return L({
        value: M
      });
    },
    rtl: C.direction === "rtl",
    renderTrack: function(M) {
      var ne = M.props, E = M.children, re = M.isDragged;
      return /* @__PURE__ */ J.createElement(me, Q({
        onMouseDown: ne.onMouseDown,
        onTouchStart: ne.onTouchStart,
        $isDragged: re
      }, k, Xe), /* @__PURE__ */ J.createElement(he, Q({
        $isDragged: re,
        ref: ne.ref
      }, k, pe), E));
    },
    renderThumb: function(M) {
      var ne = M.props, E = M.index, re = M.isDragged, Ne = v || (!!E && l || !E && B || re) && !m;
      return /* @__PURE__ */ J.createElement(nt, Q({}, ne, {
        onMouseEnter: function() {
          E === 0 ? F(!0) : o(!0);
        },
        onMouseLeave: function() {
          E === 0 ? F(!1) : o(!1);
        },
        $thumbIndex: E,
        $isDragged: re,
        style: Ot({}, ne.style)
      }, k, it, {
        $isFocusVisible: h && A === E
      }), Ne && /* @__PURE__ */ J.createElement(ot, Q({
        $thumbIndex: E,
        $isDragged: re
      }, k, st), X(H[E])), Ne && /* @__PURE__ */ J.createElement(at, Q({
        $thumbIndex: E,
        $isDragged: re
      }, k, ct)));
    }
  }, u ? {
    // eslint-disable-next-line react/display-name
    renderMark: function(M) {
      var ne = M.props, E = M.index;
      return /* @__PURE__ */ J.createElement(mt, Q({
        $markIndex: E
      }, ne, k, ht));
    }
  } : {})), /* @__PURE__ */ J.createElement(gt, Q({}, k, bt), /* @__PURE__ */ J.createElement(Ye, Q({}, k, Je), X(G)), /* @__PURE__ */ J.createElement(Ye, Q({}, k, Je), X(t))));
}
function Dt() {
  return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
}
const Qt = /* @__PURE__ */ Ge("div", process.env.NODE_ENV === "production" ? {
  target: "ew7r33m3"
} : {
  target: "ew7r33m3",
  label: "StyledSlider"
})(process.env.NODE_ENV === "production" ? {
  name: "bjn8wh",
  styles: "position:relative"
} : {
  name: "bjn8wh",
  styles: "position:relative/*# sourceMappingURL=data:application/json;charset=utf-8;base64,  */",
  toString: Dt
}), _t = /* @__PURE__ */ Ge("div", process.env.NODE_ENV === "production" ? {
  target: "ew7r33m2"
} : {
  target: "ew7r33m2",
  label: "StyledThumb"
})(({
  disabled: e,
  theme: n,
  isDragged: i
}) => ({
  alignItems: "center",
  backgroundColor: e ? n.colors.gray60 : n.colors.primary,
  borderTopLeftRadius: "100%",
  borderTopRightRadius: "100%",
  borderBottomLeftRadius: "100%",
  borderBottomRightRadius: "100%",
  borderTopStyle: "none",
  borderBottomStyle: "none",
  borderRightStyle: "none",
  borderLeftStyle: "none",
  display: "flex",
  justifyContent: "center",
  height: n.sizes.sliderThumb,
  width: n.sizes.sliderThumb,
  boxShadow: i ? `0 0 0 0.2rem ${Me(n.colors.primary, 0.5)}` : "none",
  ":focus": {
    outline: "none"
  },
  ":focus-visible": {
    boxShadow: `0 0 0 0.2rem ${Me(n.colors.primary, 0.5)}`
  }
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,  */"), Pt = /* @__PURE__ */ Ge("div", process.env.NODE_ENV === "production" ? {
  target: "ew7r33m1"
} : {
  target: "ew7r33m1",
  label: "StyledThumbValue"
})(({
  disabled: e,
  theme: n
}) => ({
  fontFamily: n.genericFonts.bodyFont,
  fontSize: n.fontSizes.sm,
  color: e ? n.colors.gray60 : n.colors.primary,
  top: "-1.6em",
  position: "absolute",
  whiteSpace: "nowrap",
  backgroundColor: n.colors.transparent,
  lineHeight: n.lineHeights.base,
  fontWeight: n.fontWeights.normal,
  // If values are clickable, it's hard to move the right thumb when they're
  // very close. So make them unclickable:
  pointerEvents: "none"
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,  */"), Kt = /* @__PURE__ */ Ge("div", process.env.NODE_ENV === "production" ? {
  target: "ew7r33m0"
} : {
  target: "ew7r33m0",
  label: "StyledSliderTickBar"
})(({
  theme: e,
  isHovered: n,
  isDisabled: i
}) => ({
  position: "absolute",
  left: 0,
  right: 0,
  top: "100%",
  display: "flex",
  justifyContent: "space-between",
  pointerEvents: "none",
  marginTop: `-${e.spacing.md}`,
  fontSize: e.fontSizes.sm,
  lineHeight: e.lineHeights.base,
  fontWeight: e.fontWeights.normal,
  color: i ? e.colors.fadedText40 : e.colors.fadedText60,
  opacity: n ? 1 : 0,
  transition: "opacity 70ms ease-in-out"
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,  */");
function $t({
  minLabel: e,
  maxLabel: n,
  isHovered: i,
  isDisabled: c
}) {
  return /* @__PURE__ */ P.jsxs(Kt, { "data-testid": "stSliderTickBar", isHovered: i, isDisabled: c, children: [
    /* @__PURE__ */ P.jsx("span", { children: e }),
    /* @__PURE__ */ P.jsx("span", { children: n })
  ] });
}
function qt({
  disabled: e,
  element: n,
  widgetMgr: i,
  fragmentId: c
}) {
  const [m, W] = kt({
    getStateFromWidgetMgr: en,
    getDefaultStateFromProto: tn,
    getCurrStateFromProto: nn,
    updateWidgetMgrState: rn,
    element: n,
    widgetMgr: i,
    fragmentId: c
  }), [u, I] = oe(m), [Y, O] = oe(!1), [L, x] = oe(!1), G = ae(() => O(!0), []), d = ae(() => O(!1), []), t = Tt(null), [r] = oe([]), [s] = oe([]), g = Ct(), v = u.map((F) => Fe(F, n)), f = Fe(n.min, n), X = Fe(n.max, n), y = n.label;
  Ue(() => {
    I(m);
  }, [m]);
  const C = ae(({
    value: F
  }) => {
    W({
      value: F,
      fromUi: !0
    }), x(!1);
  }, [W]), R = ae(({
    value: F
  }) => {
    I(F), x(!0);
  }, []), w = ae(
    wt(function(S, a) {
      const {
        $thumbIndex: l
      } = S, o = l || 0;
      r[o] = a, s[o] ||= Ht();
      const b = Bt(S, ["role", "style", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabIndex", "onKeyUp", "onKeyDown", "onMouseEnter", "onMouseLeave", "draggable"]), p = v[o];
      return /* @__PURE__ */ P.jsx(_t, { ...b, disabled: S.$disabled === !0, isDragged: S.$isDragged === !0, ref: r[o], "aria-valuetext": p, "aria-label": y, children: /* @__PURE__ */ P.jsx(Pt, { "data-testid": "stSliderThumbValue", disabled: S.$disabled === !0, ref: s[o], children: p }) });
    }),
    // Only run this on first render, to avoid losing the focus state.
    // Then, when the value written about the thumb needs to change, that
    // happens with the function below instead.
    []
  );
  Ue(() => {
    s.map((b, p) => {
      b.current && (b.current.innerText = v[p]);
    }), r.map((b, p) => {
      b.current && b.current.setAttribute("aria-valuetext", v[p]);
    });
    const F = t.current ?? null, S = r[0].current, a = r[1]?.current, l = s[0].current, o = s[1]?.current;
    ln(F, S, a, l, o);
  });
  const B = ae(({
    $disabled: F
  }) => ({
    height: g.spacing.twoXS,
    ...F ? {
      background: g.colors.darkenedBgMix25
    } : {}
  }), [g.colors.darkenedBgMix25, g.spacing.twoXS]);
  return /* @__PURE__ */ P.jsxs(Qt, { ref: t, className: "stSlider", "data-testid": "stSlider", onMouseEnter: G, onMouseLeave: d, children: [
    /* @__PURE__ */ P.jsx(Wt, { label: n.label, disabled: e, labelVisibility: Rt(n.labelVisibility?.value), children: n.help && /* @__PURE__ */ P.jsx(Vt, { children: /* @__PURE__ */ P.jsx(xt, { content: n.help, placement: Xt.TOP_RIGHT }) }) }),
    /* @__PURE__ */ P.jsx(Et, { min: n.min, max: n.max, step: n.step, value: cn(u, n), onChange: R, onFinalChange: C, disabled: e, overrides: {
      Thumb: w,
      Track: {
        style: {
          backgroundColor: "none !important",
          paddingLeft: g.spacing.none,
          paddingRight: g.spacing.none,
          // Set padding so total height equals minElementHeight (40px)
          // Total height = paddingTop + innerTrack height + paddingBottom
          paddingTop: `calc((${g.sizes.minElementHeight} - ${g.spacing.twoXS}) / 2)`,
          paddingBottom: `calc((${g.sizes.minElementHeight} - ${g.spacing.twoXS}) / 2)`
        }
      },
      InnerTrack: {
        style: B
      },
      // Show min/max labels when hovering the slider or dragging it
      TickBar: {
        component: $t,
        props: {
          minLabel: f,
          maxLabel: X,
          isHovered: Y || L,
          isDisabled: e
        }
      }
    } })
  ] });
}
function en(e, n) {
  return e.getDoubleArrayValue(n);
}
function tn(e) {
  return e.default;
}
function nn(e) {
  return e.value;
}
function rn(e, n, i, c) {
  n.setDoubleArrayValue(e, i.value, {
    fromUi: i.fromUi
  }, c);
}
function an(e) {
  const {
    dataType: n
  } = e;
  return n === Ae.DataType.DATETIME || n === Ae.DataType.DATE || n === Ae.DataType.TIME;
}
function Fe(e, n) {
  const {
    format: i,
    options: c
  } = n;
  return an(n) ? At.utc(e / 1e3).format(i) : c.length > 0 ? ze.sprintf(i, c[e]) : ze.sprintf(i, e);
}
function cn(e, n) {
  const {
    min: i,
    max: c
  } = n;
  let m = e[0], W = e.length > 1 ? e[1] : e[0];
  return m > W && (m = W), m < i && (m = i), m > c && (m = c), W < i && (W = i), W > c && (W = c), e.length > 1 ? [m, W] : [m];
}
function ln(e, n, i, c, m) {
  !e || !n || !c || (ce(e, n, c), i && m && (ce(e, i, m), on(e, n, i, c, m)));
}
function ce(e, n, i) {
  const c = e.getBoundingClientRect(), m = n.getBoundingClientRect(), W = i.getBoundingClientRect(), u = m.left + m.width / 2, I = u - W.width / 2 < c.left, Y = u + W.width / 2 > c.right;
  i.style.left = I ? "0" : "", i.style.right = Y ? "0" : "";
}
function on(e, n, i, c, m) {
  const u = e.getBoundingClientRect(), I = n.getBoundingClientRect(), Y = i.getBoundingClientRect(), O = c.getBoundingClientRect(), L = m.getBoundingClientRect(), x = u.left + u.width / 2, G = I.left + I.width / 2, d = Y.left + Y.width / 2, t = G - O.width / 2 >= u.left, r = d + L.width / 2 <= u.right, s = I.left - O.width >= u.left, g = Y.right + L.width <= u.right, v = t ? O.width / 2 : O.width, f = r ? L.width / 2 : L.width, X = G + v;
  if (d - f - X > 24) {
    ce(e, n, c), ce(e, i, m);
    return;
  }
  if (s && g) {
    c.style.left = "", c.style.right = `${Math.round(I.width)}px`, m.style.left = `${Math.round(Y.width)}px`, m.style.right = "";
    return;
  }
  G < x ? (ce(e, n, c), m.style.left = `${Math.round(G + v + 24 - d)}px`, m.style.right = "") : (ce(e, i, m), c.style.left = "", c.style.right = `${-Math.round(d - f - 24 - G)}px`);
}
const bn = yt(Ft(qt));
export {
  bn as default
};
//# sourceMappingURL=index-DOE9zKwT.js.map
