import * as React from 'react';
import { be as Slider, a1 as Input, t as toastApi } from './MapEditView-f6381866.js';
import classNames from 'classnames';
import { isNumber } from 'lodash';

const prefixCls = 'dm-map-base-slider-input';
const InputWraper = (props) => {
    const { value, onPressEnter } = props;
    const _changeValue = (value) => {
        const _value = Number(value);
        if (isNumber(_value)) {
            onPressEnter && onPressEnter(_value);
        }
        else {
            toastApi.warning('Illegal number');
        }
    };
    const _onPressEnter = (e) => {
        const target = e.target;
        _changeValue(target.value);
    };
    const _onBlur = (e) => {
        const target = e.target;
        _changeValue(target.value);
    };
    const _value = value === null || value === void 0 ? void 0 : value.toString();
    return (React.createElement("div", { style: { width: 70 } },
        React.createElement(Input, { size: "compact", type: "menu-bg", block: true, allowClear: false, defaultValue: _value, onPressEnter: _onPressEnter, onBlur: _onBlur })));
};
const SliderInput = (props) => {
    const { min, max, step, className, value, range, onChange, renderInput = true } = props;
    const _onAfterChange = (value) => {
        onChange && onChange(value);
    };
    return (React.createElement("div", { className: classNames(prefixCls, className) },
        React.createElement("div", { style: { flex: 1 } },
            React.createElement(Slider, { range: range, min: min, max: max, step: step, size: "small", defaultValue: value, onAfterChange: _onAfterChange, getTooltipPopupContainer: (node) => node === null || node === void 0 ? void 0 : node.closest('.dm-page-framewrap') })),
        renderInput && React.createElement(InputWraper, { value: value, onPressEnter: _onAfterChange })));
};

export { SliderInput as S };
