'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../tokens/index.js');
require('../../../utils/index.js');
require('../../../hooks/index.js');
var util = require('./util.js');
var thumb = require('./thumb2.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var scrollbar = require('../../../tokens/scrollbar.js');
var index = require('../../../hooks/use-namespace/index.js');
var error = require('../../../utils/error.js');

const COMPONENT_NAME = "Thumb";
const _sfc_main = vue.defineComponent({
  name: COMPONENT_NAME,
  props: thumb.thumbProps,
  setup(props) {
    const scrollbar$1 = vue.inject(scrollbar.scrollbarContextKey);
    const ns = index.useNamespace("scrollbar");
    if (!scrollbar$1)
      error.throwError(COMPONENT_NAME, "can not inject scrollbar context");
    const instance = vue.ref();
    const thumb = vue.ref();
    const visible = vue.ref(false);
    const bar = vue.computed(() => util.BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
    const thumbStyle = vue.computed(() => util.renderThumbStyle({
      size: props.size,
      move: props.move,
      bar: bar.value
    }));
    return {
      ns,
      instance,
      thumb,
      bar,
      thumbStyle,
      visible
    };
  }
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return vue.openBlock(), vue.createBlock(vue.Transition, {
    name: _ctx.ns.b("fade")
  }, {
    default: vue.withCtx(() => [
      vue.withDirectives(vue.createElementVNode("div", {
        ref: "instance",
        class: vue.normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)])
      }, [
        vue.createElementVNode("div", {
          ref: "thumb",
          class: vue.normalizeClass(_ctx.ns.e("thumb")),
          style: vue.normalizeStyle(_ctx.thumbStyle)
        }, null, 6)
      ], 2), [
        [vue.vShow, _ctx.always || _ctx.visible]
      ])
    ]),
    _: 1
  }, 8, ["name"]);
}
var Thumb = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render], ["__file", "/Users/meng/workspace/element-ps/packages/components/scrollbar/src/thumb.vue"]]);

exports["default"] = Thumb;
//# sourceMappingURL=thumb.js.map
