import { defineComponent as c, reactive as x, ref as h, computed as d, watch as $, createElementBlock as F, openBlock as M, mergeProps as I, withDirectives as f, createElementVNode as a, vModelText as g, toDisplayString as y } from "vue";
const C = { class: "ui-input-range__separator" }, B = /* @__PURE__ */ c({
  __name: "InputRange",
  props: {
    modelValue: {},
    separator: { default: "-" }
  },
  emits: ["update:modelValue", "change"],
  setup(m, { emit: v }) {
    const u = m, r = v, l = x({
      left: u.modelValue[0],
      right: u.modelValue[1]
    }), o = h(!1), V = d(() => (o.value, "ui-input-range-focused")), s = d({
      get() {
        return {
          left: Math.min(...u.modelValue),
          // dangerous....
          right: Math.max(...u.modelValue)
        };
      },
      set() {
      }
    });
    $(
      () => s.value,
      (n) => (l.left = n.left) && (l.right = n.right)
    );
    function i() {
      r("update:modelValue", [+l.left, +l.right]), r("change", [+l.left, +l.right]);
    }
    function p(n, t) {
      const e = t.target.value;
      /^[0-9]{0,2}$/.test(e) ? n ? l.left = +e : l.right = +e : n ? l.left = +e.slice(0, e.length - 1) : l.right = +e.slice(0, e.length - 1);
    }
    return (n, t) => (M(), F("div", I({
      class: [V.value, "ui-input-range"]
    }, n.$attrs), [
      f(a("input", {
        "onUpdate:modelValue": t[0] || (t[0] = (e) => s.value.left = e),
        class: "text-s",
        type: "text",
        onChange: i,
        onFocus: t[1] || (t[1] = (e) => o.value = !0),
        onFocusout: t[2] || (t[2] = (e) => o.value = !1),
        onInput: t[3] || (t[3] = (e) => p(!0, e))
      }, null, 544), [
        [g, s.value.left]
      ]),
      a("div", C, y(u.separator), 1),
      f(a("input", {
        "onUpdate:modelValue": t[4] || (t[4] = (e) => s.value.right = e),
        class: "text-s",
        type: "text",
        onChange: i,
        onFocus: t[5] || (t[5] = (e) => o.value = !0),
        onFocusout: t[6] || (t[6] = (e) => o.value = !1),
        onInput: t[7] || (t[7] = (e) => p(!1, e))
      }, null, 544), [
        [g, s.value.right]
      ])
    ], 16));
  }
});
export {
  B as default
};
//# sourceMappingURL=InputRange.vue.js.map
