/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var vue = require('vue');
var isBoolean = require('lodash/isBoolean');
var inputNumber_index = require('../../input-number/index.js');
require('../../utils/withInstall.js');
require('../../input-number/input-number.js');
require('@ldesign/icons-vue-next');
require('../../button/index.js');
require('../../button/button.js');
require('@babel/runtime/helpers/toConsumableArray');
require('../../loading/index.js');
require('../../loading/directive.js');
require('../../loading/plugin.js');
require('../../utils/dom.js');
require('../../_chunks/dep-f4db2590.js');
require('lodash/isString');
require('lodash/isFunction');
require('lodash/isArray');
require('../../utils/easing.js');
require('../../hooks/useConfig.js');
require('../../config-provider/useConfig.js');
require('lodash/cloneDeep');
require('../../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('../../_common/js/global-config/default-config.js');
require('../../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('dayjs');
require('../../loading/loading.js');
require('@babel/runtime/helpers/slicedToArray');
require('../../utils/render-tnode.js');
require('lodash/isEmpty');
require('lodash/isObject');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../hooks/useTeleport.js');
require('../../loading/props.js');
require('../../loading/icon/gradient.js');
require('../../_common/js/loading/circle-adapter.js');
require('../../_common/js/utils/set-style.js');
require('../../_common/js/utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('../../hooks/useRipple.js');
require('../../utils/set-style.js');
require('../../hooks/useKeepAnimation.js');
require('../../form/hooks.js');
require('../../hooks/tnode.js');
require('../../button/props.js');
require('../../input/index.js');
require('../../input/input.js');
require('../../hooks/useGlobalIcon.js');
require('../../input/props.js');
require('../../input/useInput.js');
require('../../form/const.js');
require('../../hooks/useVModel.js');
require('../../input/useLengthLimit.js');
require('../../_common/js/log/log.js');
require('../../input/useInputEventHandler.js');
require('../../input/useInputWidth.js');
require('../../input/input-group.js');
require('../../input/input-group-props.js');
require('../../input-number/props.js');
require('../../input-number/useInputNumber.js');
require('../../hooks/useCommonClassName.js');
require('../../_common/js/input-number/number.js');
require('lodash/isNil');
require('../../_common/js/input-number/large-number.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
var isBoolean__default = /*#__PURE__*/_interopDefaultLegacy(isBoolean);

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var INPUT_NUMBER_PROPS_INITIAL_STATE = {
  decimalPlaces: 0,
  format: void 0,
  placeholder: "",
  theme: "column"
};
var useSliderInput = function useSliderInput(config) {
  var name = config.value.prefixName;
  var sliderInputState = vue.computed(function () {
    var initialState = _objectSpread({}, INPUT_NUMBER_PROPS_INITIAL_STATE);
    var inputProps = config.value;
    if (!isBoolean__default["default"](inputProps.inputNumberProps)) {
      var _inputProps$inputNumb;
      var inputTheme = (_inputProps$inputNumb = inputProps.inputNumberProps) === null || _inputProps$inputNumb === void 0 ? void 0 : _inputProps$inputNumb.theme;
      initialState = _objectSpread(_objectSpread({}, initialState), inputProps.inputNumberProps);
      if (["column", "row", "normal"].includes(inputTheme)) initialState.theme = inputTheme;
    }
    return initialState;
  });
  var sliderNumberClass = vue.computed(function () {
    return ["".concat(name, "__input"), {
      "is-vertical": config.value.vertical
    }];
  });
  var renderInputNumber = function renderInputNumber(val, changeFn) {
    var normalizeChangeFn = function normalizeChangeFn(num) {
      if (num !== void 0 && !isNaN(num)) changeFn(num);
    };
    return vue.createVNode(inputNumber_index.InputNumber, vue.mergeProps(sliderInputState.value, {
      "class": sliderNumberClass.value,
      "value": val,
      "step": config.value.step,
      "onChange": normalizeChangeFn,
      "disabled": config.value.disabled,
      "min": config.value.min,
      "max": config.value.max
    }), null);
  };
  return renderInputNumber;
};

exports.useSliderInput = useSliderInput;
//# sourceMappingURL=useSliderInput.js.map
