import { r as registerInstance, h } from './index-b13326fc.js';
import { E as ElementQuestionBase } from './element-question-base-275076e1.js';
var ElementCheckboxEditor = /** @class */ (function () {
    function ElementCheckboxEditor(hostRef) {
        var _this = this;
        registerInstance(this, hostRef);
        this.handleOther = function (event) {
            var target = event.target;
            _this.handler.set('options', target.value, { localize: true });
            _this.handler.set('other', event.detail, { emit: true, localize: true });
        };
        this.transformMax = {
            path: 'validation',
            get: function (value) { return "max:" + value; },
            set: function (value) { return value.slice(4); }
        };
    }
    ElementCheckboxEditor.prototype.prop = function (path, options) {
        if (options === void 0) { options = {}; }
        return this.handler.prop(path, Object.assign({}, options));
    };
    ElementCheckboxEditor.prototype.render = function () {
        var options = this.value.options;
        return (h(ElementQuestionBase, { question: this.prop('question', { localize: true }), required: this.prop('required'), t: this.t }, h("bce-option-creator", Object.assign({}, this.prop('options', { default: function () { return []; }, localize: true }), { "allow-other": true, label: this.t('me-option'), other: this.handler.tryGet('other', { localize: true }), placeholder: this.t('me-option'), t: this.t, onOther: this.handleOther })), h("bce-input", Object.assign({}, this.prop('max', { transform: this.transformMax }), { label: this.t('me-element-checkbox-max'), max: '' + options.length, min: options.length ? '1' : '0', type: "number" })), h("bce-select", Object.assign({}, this.prop('orientation'), { label: this.t('me-orientation'), type: "radio" }), h("bce-option", { value: "horizontal" }, this.t('me-orientation-h')), h("bce-option", { value: "vertical" }, this.t('me-orientation-v'))), h("slot", null)));
    };
    return ElementCheckboxEditor;
}());
export { ElementCheckboxEditor as bce_element_checkbox_editor };
