import { Component, Input } from '@angular/core';
import { CurrentDeviceService } from '@iotize/ionic';
import { TapGPIOController } from './tap-extension';
import * as i0 from "@angular/core";
import * as i1 from "@iotize/ionic";
import * as i2 from "@ionic/angular";
import * as i3 from "@angular/common";
function TapGpioComponent_ion_item_1_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "ion-label");
    i0.ɵɵelementStart(3, "span", 7);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const config_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(config_r1.num);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(config_r1.pin.type);
} }
function TapGpioComponent_ion_item_1_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "span", 7);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "ion-label");
    i0.ɵɵelementStart(5, "span", 7);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const config_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(config_r1.num);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(config_r1.pin.type);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1("", config_r1.power, "V");
} }
function TapGpioComponent_ion_item_1_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "ion-label");
    i0.ɵɵelementStart(3, "span", 7);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const config_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(config_r1.num);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(config_r1.pin.type);
} }
function TapGpioComponent_ion_item_1_ng_template_7_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "span", 7);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "ion-label");
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "ion-buttons", 8);
    i0.ɵɵelementStart(7, "ion-button", 9);
    i0.ɵɵlistener("click", function TapGpioComponent_ion_item_1_ng_template_7_Template_ion_button_click_7_listener() { i0.ɵɵrestoreView(_r15); const config_r1 = i0.ɵɵnextContext().$implicit; return config_r1.controller.setup("OUT"); });
    i0.ɵɵtext(8, "OUT");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "ion-button", 10);
    i0.ɵɵlistener("click", function TapGpioComponent_ion_item_1_ng_template_7_Template_ion_button_click_9_listener() { i0.ɵɵrestoreView(_r15); const config_r1 = i0.ɵɵnextContext().$implicit; return config_r1.controller.read(); });
    i0.ɵɵtext(10, "READ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "ion-buttons", 8);
    i0.ɵɵelementStart(12, "ion-button", 9);
    i0.ɵɵlistener("click", function TapGpioComponent_ion_item_1_ng_template_7_Template_ion_button_click_12_listener() { i0.ɵɵrestoreView(_r15); const config_r1 = i0.ɵɵnextContext().$implicit; return config_r1.controller.setup("IN"); });
    i0.ɵɵtext(13, "IN");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "ion-button", 9);
    i0.ɵɵlistener("click", function TapGpioComponent_ion_item_1_ng_template_7_Template_ion_button_click_14_listener() { i0.ɵɵrestoreView(_r15); const config_r1 = i0.ɵɵnextContext().$implicit; return config_r1.controller.low(); });
    i0.ɵɵtext(15, "LOW");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "ion-button", 9);
    i0.ɵɵlistener("click", function TapGpioComponent_ion_item_1_ng_template_7_Template_ion_button_click_16_listener() { i0.ɵɵrestoreView(_r15); const config_r1 = i0.ɵɵnextContext().$implicit; return config_r1.controller.high(); });
    i0.ɵɵtext(17, "HIGH");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const config_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(config_r1.num);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate2("", config_r1.pin.type, " ", config_r1.pin.num, "");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", config_r1.title, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("color", config_r1.controller._mode == "OUT" ? "primary" : "");
    i0.ɵɵadvance(5);
    i0.ɵɵproperty("color", config_r1.controller._mode == "IN" ? "primary" : "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("color", config_r1.controller._state == "LOW" ? "primary" : "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("color", config_r1.controller._state == "HIGH" ? "primary" : "");
} }
function TapGpioComponent_ion_item_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ion-item");
    i0.ɵɵtemplate(1, TapGpioComponent_ion_item_1_ng_template_1_Template, 5, 2, "ng-template", 2, 3, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(3, TapGpioComponent_ion_item_1_ng_template_3_Template, 7, 3, "ng-template", 2, 4, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(5, TapGpioComponent_ion_item_1_ng_template_5_Template, 5, 2, "ng-template", 2, 5, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(7, TapGpioComponent_ion_item_1_ng_template_7_Template, 18, 8, "ng-template", 2, 6, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const config_r1 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", config_r1.pin.type == "GROUND");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", config_r1.pin.type == "POWER");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", config_r1.pin.type == "DISABLED");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", config_r1.pin.type == "GPIO");
} }
export class TapGpioComponent {
    constructor(tapService) {
        this.tapService = tapService;
        this.schema = [];
        this.lines = 'full';
        this.pins = this.schema.map((entry) => {
            if (entry.pin.type === 'GPIO') {
                entry.controller = new TapGPIOController(this.tap, entry.pin);
            }
            return entry;
        });
    }
    get tap() {
        return this.tapService.tap;
    }
}
/** @nocollapse */ TapGpioComponent.ɵfac = function TapGpioComponent_Factory(t) { return new (t || TapGpioComponent)(i0.ɵɵdirectiveInject(i1.CurrentDeviceService)); };
/** @nocollapse */ TapGpioComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TapGpioComponent, selectors: [["tap-gpio"]], inputs: { schema: "schema", lines: "lines" }, decls: 2, vars: 2, consts: [[3, "lines"], [4, "ngFor", "ngForOf"], [3, "ngIf"], ["ground", ""], ["power", ""], ["disabledpin", ""], ["gpio", ""], ["slot", "start"], ["slot", "end"], [3, "color", "click"], [3, "click"]], template: function TapGpioComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "ion-list", 0);
        i0.ɵɵtemplate(1, TapGpioComponent_ion_item_1_Template, 9, 4, "ion-item", 1);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵproperty("lines", ctx.lines);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngForOf", ctx.pins);
    } }, directives: [i2.IonList, i3.NgForOf, i2.IonItem, i3.NgIf, i2.IonLabel, i2.IonButtons, i2.IonButton], styles: [""] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TapGpioComponent, [{
        type: Component,
        args: [{
                selector: 'tap-gpio',
                templateUrl: './tap-gpio.component.html',
                styleUrls: ['./tap-gpio.component.scss'],
            }]
    }], function () { return [{ type: i1.CurrentDeviceService }]; }, { schema: [{
            type: Input
        }], lines: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 