"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const util = require("./util.js");
const thumb2 = require("./thumb2.js");
const bar = require("./bar.js");
const constants = require("./constants.js");
const pluginVue_exportHelper = require("../../../_virtual/plugin-vue_export-helper.js");
const C = /* @__PURE__ */ Vue.defineComponent({
  __name: "bar",
  props: bar.barProps,
  setup(_, { expose: y }) {
    const m = _, u = Vue.inject(constants.scrollbarContextKey), v = Vue.ref(0), h = Vue.ref(0), p = Vue.ref(""), d = Vue.ref(""), r = Vue.ref(1), n = Vue.ref(1);
    return y({
      handleScroll: (e) => {
        if (e) {
          const t = e.offsetHeight - util.GAP, o = e.offsetWidth - util.GAP;
          h.value = e.scrollTop * 100 / t * r.value, v.value = e.scrollLeft * 100 / o * n.value;
        }
      },
      update: () => {
        const e = u == null ? void 0 : u.wrapElement;
        if (!e)
          return;
        const t = e.offsetHeight - util.GAP, o = e.offsetWidth - util.GAP, c = t ** 2 / e.scrollHeight, f = o ** 2 / e.scrollWidth, s = Math.max(c, m.minSize), i = Math.max(f, m.minSize);
        r.value = c / (t - c) / (s / (t - s)), n.value = f / (o - f) / (i / (o - i)), d.value = s + util.GAP < t ? `${s}px` : "", p.value = i + util.GAP < o ? `${i}px` : "";
      }
    }), (e, t) => (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
      Vue.createVNode(thumb2.default, {
        move: v.value,
        ratio: n.value,
        size: p.value,
        always: e.always
      }, null, 8, ["move", "ratio", "size", "always"]),
      Vue.createVNode(thumb2.default, {
        move: h.value,
        ratio: r.value,
        size: d.value,
        vertical: "",
        always: e.always
      }, null, 8, ["move", "ratio", "size", "always"])
    ], 64));
  }
});
var A = /* @__PURE__ */ pluginVue_exportHelper.default(C, [["__file", "bar.vue"]]);
exports.default = A;
