(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@iotize/tap/service/impl/target'), require('@ionic/angular')) :
    typeof define === 'function' && define.amd ? define('@iotize/ionic/target/s3p', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@iotize/tap/service/impl/target', '@ionic/angular'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.iotize = global.iotize || {}, global.iotize.ionic = global.iotize.ionic || {}, global.iotize.ionic.target = global.iotize.ionic.target || {}, global.iotize.ionic.target.s3p = {}), global.ng.core, global.ng.common, global.ng.forms, global.target, global.i2));
}(this, (function (exports, i0, i3, i1, target, i2) { 'use strict';

    function TapS3pConfigurationFormComponent_ion_select_option_5_Template(rf, ctx) {
        if (rf & 1) {
            i0.ɵɵelementStart(0, "ion-select-option", 4);
            i0.ɵɵtext(1);
            i0.ɵɵelementEnd();
        }
        if (rf & 2) {
            var mode_r1 = ctx.$implicit;
            i0.ɵɵproperty("value", mode_r1.value);
            i0.ɵɵadvance(1);
            i0.ɵɵtextInterpolate1(" ", mode_r1.title, " ");
        }
    }
    var TapS3pConfigurationFormComponent = /** @class */ (function () {
        function TapS3pConfigurationFormComponent(formBuilder) {
            var _this = this;
            this.valueChanges = new i0.EventEmitter();
            this.modes = [
                {
                    title: 'Indexed',
                    value: target.TargetS3PProtocolConfiguration.Mode.INDEXED,
                },
                {
                    title: 'Emulation',
                    value: target.TargetS3PProtocolConfiguration.Mode.EMULATION,
                },
            ];
            this.form = formBuilder.group({
                mode: [
                    target.TargetS3PProtocolConfiguration.Mode.INDEXED,
                    [i1.Validators.required],
                ],
                delay: [1, [i1.Validators.required, i1.Validators.min(1), i1.Validators.max(255)]],
            });
            this.form.valueChanges.subscribe(function (event) {
                // if (this.form.valid){
                _this.valueChanges.emit(event);
                // }
            });
        }
        Object.defineProperty(TapS3pConfigurationFormComponent.prototype, "values", {
            set: function (obs) {
                var _this = this;
                var _a;
                (_a = this.valueSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
                this.valueSub = obs === null || obs === void 0 ? void 0 : obs.subscribe(function (newValue) {
                    _this.form.setValue(newValue, {
                        emitEvent: false,
                    });
                });
            },
            enumerable: false,
            configurable: true
        });
        return TapS3pConfigurationFormComponent;
    }());
    /** @nocollapse */ TapS3pConfigurationFormComponent.ɵfac = function TapS3pConfigurationFormComponent_Factory(t) { return new (t || TapS3pConfigurationFormComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder)); };
    /** @nocollapse */ TapS3pConfigurationFormComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TapS3pConfigurationFormComponent, selectors: [["tap-s3p-configuration-form"]], inputs: { values: "values" }, outputs: { valueChanges: "valueChanges" }, decls: 10, vars: 4, consts: [[3, "formGroup"], ["slot", "end", 3, "formControlName"], [3, "value", 4, "ngFor", "ngForOf"], ["type", "number", "slot", "end", 3, "formControlName"], [3, "value"]], template: function TapS3pConfigurationFormComponent_Template(rf, ctx) {
            if (rf & 1) {
                i0.ɵɵelementStart(0, "form", 0);
                i0.ɵɵelementStart(1, "ion-item");
                i0.ɵɵelementStart(2, "ion-label");
                i0.ɵɵtext(3, " Mode ");
                i0.ɵɵelementEnd();
                i0.ɵɵelementStart(4, "ion-select", 1);
                i0.ɵɵtemplate(5, TapS3pConfigurationFormComponent_ion_select_option_5_Template, 2, 2, "ion-select-option", 2);
                i0.ɵɵelementEnd();
                i0.ɵɵelementEnd();
                i0.ɵɵelementStart(6, "ion-item");
                i0.ɵɵelementStart(7, "ion-label");
                i0.ɵɵtext(8, " Delay ");
                i0.ɵɵelementEnd();
                i0.ɵɵelement(9, "ion-input", 3);
                i0.ɵɵelementEnd();
                i0.ɵɵelementEnd();
            }
            if (rf & 2) {
                i0.ɵɵproperty("formGroup", ctx.form);
                i0.ɵɵadvance(4);
                i0.ɵɵproperty("formControlName", "mode");
                i0.ɵɵadvance(1);
                i0.ɵɵproperty("ngForOf", ctx.modes);
                i0.ɵɵadvance(4);
                i0.ɵɵproperty("formControlName", "delay");
            }
        }, directives: [i1.ɵangular_packages_forms_forms_ba, i1.NgControlStatusGroup, i1.FormGroupDirective, i2.IonItem, i2.IonLabel, i2.IonSelect, i2.SelectValueAccessor, i1.NgControlStatus, i1.FormControlName, i3.NgForOf, i2.IonInput, i2.NumericValueAccessor, i2.IonSelectOption], styles: ["ion-input[_ngcontent-%COMP%]{text-align:right}"] });
    (function () {
        (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TapS3pConfigurationFormComponent, [{
                type: i0.Component,
                args: [{
                        selector: 'tap-s3p-configuration-form',
                        templateUrl: './tap-s3p-configuration-form.component.html',
                        styleUrls: ['./tap-s3p-configuration-form.component.scss'],
                    }]
            }], function () { return [{ type: i1.FormBuilder }]; }, { valueChanges: [{
                    type: i0.Output
                }], values: [{
                    type: i0.Input
                }] });
    })();

    var TapTargetS3PModule = /** @class */ (function () {
        function TapTargetS3PModule() {
        }
        return TapTargetS3PModule;
    }());
    /** @nocollapse */ TapTargetS3PModule.ɵfac = function TapTargetS3PModule_Factory(t) { return new (t || TapTargetS3PModule)(); };
    /** @nocollapse */ TapTargetS3PModule.ɵmod = i0.ɵɵdefineNgModule({ type: TapTargetS3PModule });
    /** @nocollapse */ TapTargetS3PModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[i3.CommonModule, i2.IonicModule, i1.FormsModule, i1.ReactiveFormsModule]] });
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TapTargetS3PModule, { declarations: [TapS3pConfigurationFormComponent], imports: [i3.CommonModule, i2.IonicModule, i1.FormsModule, i1.ReactiveFormsModule], exports: [TapS3pConfigurationFormComponent] }); })();
    (function () {
        (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TapTargetS3PModule, [{
                type: i0.NgModule,
                args: [{
                        declarations: [TapS3pConfigurationFormComponent],
                        exports: [TapS3pConfigurationFormComponent],
                        imports: [i3.CommonModule, i2.IonicModule, i1.FormsModule, i1.ReactiveFormsModule],
                    }]
            }], null, null);
    })();

    /**
     * Generated bundle index. Do not edit.
     */

    exports.TapS3pConfigurationFormComponent = TapS3pConfigurationFormComponent;
    exports.TapTargetS3PModule = TapTargetS3PModule;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=iotize-ionic-target-s3p.umd.js.map
