/* eslint-disable @typescript-eslint/naming-convention */
// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { RendererServiceLocator } from '../../Dom/Renderer';
import { Attribute } from '../Decorators/AttributeDecorator';
import { Watch } from '../Decorators/WatchDecorator';
/**
 * @public
 */
export const Rangeable = (base) => {
    class RangeableElement extends base {
        // #region Fields
        _min;
        _max;
        // #endregion
        // #region Ctor
        /**
         * Constructs a new instance of the `RangeableElement` class.
         *
         * @public
         */
        constructor(...args) {
            super(args);
            this._min = undefined;
            this._max = undefined;
        }
        // #endregion
        // #region Properties
        /**
         * The minimum value of the range.
         * This property is used to define the lower bound of the range.
         * The default value is `undefined`, which means no minimum value is set.
         *
         * @public
         * @attr
         */
        get min() {
            return this._min;
        }
        set min(value) {
            if (this._min !== value) {
                this._min = value;
                this.requestUpdate('min');
            }
        }
        /**
         * The maximum value of the range.
         * This property is used to define the upper bound of the range.
         * The default value is `undefined`, which means no maximum value is set.
         *
         * @public
         * @attr
         */
        get max() {
            return this._max;
        }
        set max(value) {
            if (this._max !== value) {
                this._max = value;
                this.requestUpdate('max');
            }
        }
        // #endregion
        // #region Methods
        /**
         * @protected
         */
        onMinPropertyChanged(_prev, next) {
            if (next !== undefined) {
                RendererServiceLocator.current.setAttribute(this, 'aria-value-min', String(next));
            }
            else {
                RendererServiceLocator.current.removeAttribute(this, 'aria-value-min');
            }
        }
        /**
         * @protected
         */
        onMaxPropertyChanged(_prev, next) {
            if (next !== undefined) {
                RendererServiceLocator.current.setAttribute(this, 'aria-value-max', String(next));
            }
            else {
                RendererServiceLocator.current.removeAttribute(this, 'aria-value-max');
            }
        }
    }
    __decorate([
        Attribute({ type: Object }),
        __metadata("design:type", Object),
        __metadata("design:paramtypes", [Object])
    ], RangeableElement.prototype, "min", null);
    __decorate([
        Attribute({ type: Object }),
        __metadata("design:type", Object),
        __metadata("design:paramtypes", [Object])
    ], RangeableElement.prototype, "max", null);
    __decorate([
        Watch('min'),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object, Object]),
        __metadata("design:returntype", void 0)
    ], RangeableElement.prototype, "onMinPropertyChanged", null);
    __decorate([
        Watch('max'),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object, Object]),
        __metadata("design:returntype", void 0)
    ], RangeableElement.prototype, "onMaxPropertyChanged", null);
    return RangeableElement;
};
//# sourceMappingURL=Rangeable.js.map