import { r as registerInstance, h, g as getElement } from './core-095fd691.js';
import { l as linker } from './input-linker-2b74e80e.js';
import { E as ElementQuestionBase } from './element-question-base-5de5ce16.js';

const BceElementSliderTemplate = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.metadata = {};
        this.question = '';
        this.required = false;
        this.step = 1;
        this.min = 1;
        this.max = 5;
        this.minText = '';
        this.maxText = '';
        this.labelQuestion = 'Formulate your question';
        this.labelRequired = 'Required';
        this.labelStep = 'Step size';
        this.labelMin = 'Min';
        this.labelMax = 'Max';
        this.labelMinText = 'Text left';
        this.labelMaxText = 'Text right';
        this._link = linker(this, this.handleInput);
        this._question = this._link('question');
        this._required = this._link('required');
        this._step = this._link('step');
        this._min = this._link('min');
        this._max = this._link('max');
        this._minText = this._link('minText');
        this._maxText = this._link('maxText');
    }
    handleInput(name, event) {
        const input = event.target;
        if (!input)
            return;
        event.cancelBubble = true;
        this[name] = input.value;
        this.value = this.updateValue({ [name]: input.value });
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    updateValue(part = {}) {
        const current = {
            question: this.question,
            required: this.required,
            step: this.step,
            min: this.min,
            max: this.max,
            minText: this.minText,
            maxText: this.maxText,
            metadata: Object.assign({}, this.metadata)
        };
        return Object.assign({}, current, part);
    }
    componentDidLoad() {
        this.value = this.updateValue();
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    render() {
        return (h(ElementQuestionBase, { question: this._question, required: this._required }, h("bce-input", Object.assign({ type: "number" }, this._step)), h("bce-input", Object.assign({ type: "number" }, this._min)), h("bce-input", Object.assign({ type: "number" }, this._max)), h("bce-input", Object.assign({ type: "text" }, this._minText)), h("bce-input", Object.assign({ type: "text" }, this._maxText))));
    }
    get el() { return getElement(this); }
};

export { BceElementSliderTemplate as bce_element_slider_template };
