(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@wm/components/base'), require('@wm/components/input'), require('@wm/core')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@angular/forms', '@wm/components/base', '@wm/components/input', '@wm/core'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.input = global.wm.components.input || {}, global.wm.components.input.slider = {}), global.ng.core, global.ng.common, global.ng.forms, global.wm.components.base, global.wm.components.input, global.wm.core));
})(this, (function (exports, i0, i1, i2, i3, input, core) { 'use strict';

    function _interopNamespaceDefault(e) {
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n.default = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
    var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
    var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
    var i3__namespace = /*#__PURE__*/_interopNamespaceDefault(i3);

    const sliderProps = new Map([
        ['class', i3.PROP_STRING],
        ['datavalue', i3.PROP_STRING],
        ['disabled', i3.PROP_BOOLEAN],
        ['hint', i3.PROP_STRING],
        ['arialabel', i3.PROP_STRING],
        ['maxvalue', i3.PROP_NUMBER],
        ['minvalue', i3.PROP_NUMBER],
        ['name', i3.PROP_STRING],
        ['readonly', i3.PROP_BOOLEAN],
        ['shortcutkey', i3.PROP_STRING],
        ['show', { value: true, ...i3.PROP_BOOLEAN }],
        ['step', i3.PROP_NUMBER],
        ['tabindex', { value: 0, ...i3.PROP_NUMBER }]
    ]);
    const registerProps = () => {
        i3.register('wm-slider', sliderProps);
        i3.registerFormWidget(core.FormWidgetType.SLIDER, new Map(sliderProps));
    };

    const _c0 = ["wmSlider", ""];
    const _c1 = () => ({ standalone: true });
    function SliderComponent_div_3_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "div", 4);
    } }
    const DEFAULT_CLS = 'app-slider slider';
    const WIDGET_CONFIG = {
        widgetType: 'wm-slider',
        hostClass: DEFAULT_CLS
    };
    class SliderComponent extends input.BaseFormCustomComponent {
        static { this.initializeProps = registerProps(); }
        constructor(inj, explicitContext) {
            super(inj, WIDGET_CONFIG, explicitContext);
            i3.styler(this.nativeElement, this);
        }
        // change and blur events are added from the template
        handleEvent(node, eventName, callback, locals) {
            if (eventName !== 'change' && eventName !== 'blur') {
                super.handleEvent(node, eventName, callback, locals);
            }
        }
        handleChange(newVal) {
            this.invokeOnChange(this.datavalue, { type: 'change' }, this.ngModel.valid);
        }
        onPropertyChange(key, nv, ov) {
            if (key === 'tabindex') {
                return;
            }
            super.onPropertyChange(key, nv, ov);
        }
        static { this.ɵfac = function SliderComponent_Factory(t) { return new (t || SliderComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: SliderComponent, selectors: [["", "wmSlider", ""]], viewQuery: function SliderComponent_Query(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵviewQuery(i2.NgModel, 5);
            } if (rf & 2) {
                let _t;
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.ngModel = _t.first);
            } }, features: [i0__namespace.ɵɵProvidersFeature([
                    i3.provideAs(SliderComponent, i2.NG_VALUE_ACCESSOR, true),
                    i3.provideAsWidgetRef(SliderComponent)
                ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c0, decls: 4, vars: 15, consts: [[1, "app-slider-value", "pull-left", 3, "textContent"], [1, "app-slider-value", "pull-right", 3, "textContent"], ["aria-orientation", "horizontal", "focus-target", "", "type", "range", 1, "range-input", 3, "ngModelChange", "blur", "title", "ngModel", "ngModelOptions", "disabled", "tabindex"], ["aria-readonly", "true", "class", "readonly-wrapper", 4, "ngIf"], ["aria-readonly", "true", 1, "readonly-wrapper"]], template: function SliderComponent_Template(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵelement(0, "span", 0)(1, "span", 1);
                i0__namespace.ɵɵelementStart(2, "input", 2);
                i0__namespace.ɵɵtwoWayListener("ngModelChange", function SliderComponent_Template_input_ngModelChange_2_listener($event) { i0__namespace.ɵɵtwoWayBindingSet(ctx.datavalue, $event) || (ctx.datavalue = $event); return $event; });
                i0__namespace.ɵɵlistener("blur", function SliderComponent_Template_input_blur_2_listener($event) { return ctx.invokeOnTouched($event); })("ngModelChange", function SliderComponent_Template_input_ngModelChange_2_listener($event) { return ctx.handleChange($event); });
                i0__namespace.ɵɵelementEnd();
                i0__namespace.ɵɵtemplate(3, SliderComponent_div_3_Template, 1, 0, "div", 3);
            } if (rf & 2) {
                i0__namespace.ɵɵproperty("textContent", ctx.minvalue);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("textContent", ctx.maxvalue);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("title", ctx.datavalue);
                i0__namespace.ɵɵtwoWayProperty("ngModel", ctx.datavalue);
                i0__namespace.ɵɵproperty("ngModelOptions", i0__namespace.ɵɵpureFunction0(14, _c1))("disabled", ctx.disabled)("tabindex", ctx.tabindex);
                i0__namespace.ɵɵattribute("min", ctx.minvalue)("max", ctx.maxvalue)("step", ctx.step)("accesskey", ctx.shortcutkey)("aria-label", ctx.arialabel)("name", ctx.name);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngIf", ctx.readonly || ctx.disabled);
            } }, dependencies: [i1__namespace.NgIf, i2__namespace.DefaultValueAccessor, i2__namespace.RangeValueAccessor, i2__namespace.NgControlStatus, i2__namespace.NgModel, i3__namespace.TextContentDirective], encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(SliderComponent, [{
            type: i0.Component,
            args: [{ selector: '[wmSlider]', providers: [
                        i3.provideAs(SliderComponent, i2.NG_VALUE_ACCESSOR, true),
                        i3.provideAsWidgetRef(SliderComponent)
                    ], template: "<span [textContent]=\"minvalue\" class=\"app-slider-value pull-left\"></span>\n<span [textContent]=\"maxvalue\" class=\"app-slider-value pull-right\"></span>\n<input class=\"range-input\" aria-orientation=\"horizontal\"\n       focus-target\n       type=\"range\" [title]=\"datavalue\"\n       [attr.min]=\"minvalue\"\n       [attr.max]=\"maxvalue\"\n       [attr.step]=\"step\"\n       [(ngModel)]=\"datavalue\"\n       [ngModelOptions]=\"{standalone: true}\"\n       [disabled]=\"disabled\"\n       [attr.accesskey]=\"shortcutkey\"\n       [attr.aria-label]=\"arialabel\"\n       (blur)=\"invokeOnTouched($event)\"\n       (ngModelChange)=\"handleChange($event)\"\n       [attr.name]=\"name\"\n       [tabindex]=\"tabindex\"/>\n<div *ngIf=\"readonly || disabled\" aria-readonly=\"true\" class=\"readonly-wrapper\"></div>\n" }]
        }], () => [{ type: i0__namespace.Injector }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], { ngModel: [{
                type: i0.ViewChild,
                args: [i2.NgModel]
            }] }); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(SliderComponent, { className: "SliderComponent", filePath: "slider.component.ts", lineNumber: 24 }); })();

    const components = [
        SliderComponent
    ];
    class SliderModule {
        static { this.ɵfac = function SliderModule_Factory(t) { return new (t || SliderModule)(); }; }
        static { this.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: SliderModule }); }
        static { this.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({ imports: [i1.CommonModule,
                i2.FormsModule,
                i3.WmComponentsModule] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(SliderModule, [{
            type: i0.NgModule,
            args: [{
                    imports: [
                        i1.CommonModule,
                        i2.FormsModule,
                        i3.WmComponentsModule
                    ],
                    declarations: [...components],
                    exports: [...components]
                }]
        }], null, null); })();
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(SliderModule, { declarations: [SliderComponent], imports: [i1.CommonModule,
            i2.FormsModule,
            i3.WmComponentsModule], exports: [SliderComponent] }); })();

    exports.SliderComponent = SliderComponent;
    exports.SliderModule = SliderModule;

}));
