import { Component, Input, Output, EventEmitter } from '@angular/core';
import { DeploymentSummaryCompactDescriptor } from '../types/al-deployment-summary-compact-header.types';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "primeng-lts/dropdown";
import * as i3 from "@angular/forms";
import * as i4 from "primeng-lts/api";
import * as i5 from "../pipes/al-prefix-multiplier.pipe";
function AlDeploymentSummaryHeaderCompactComponent_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 5);
    i0.ɵɵelement(1, "span", 6);
    i0.ɵɵelement(2, "span", 7);
    i0.ɵɵelementEnd();
} }
var _c0 = function (a0) { return { "without-sub-name": a0 }; };
function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_h2_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "h2", 13);
    i0.ɵɵelementStart(1, "div", 14);
    i0.ɵɵelementStart(2, "div", 15);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var infoblock_r3 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(2, _c0, !infoblock_r3.infoBlockLabelName));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(infoblock_r3.infoBlockName);
} }
function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_ng_template_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i");
    i0.ɵɵelementStart(1, "label");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var item_r10 = ctx.$implicit;
    i0.ɵɵclassMap(item_r10.label);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(item_r10.label);
} }
function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 20);
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementStart(2, "label", 21);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var item_r11 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵclassMap(item_r11.icon);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(item_r11.label);
} }
function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_Template(rf, ctx) { if (rf & 1) {
    var _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 16);
    i0.ɵɵelementStart(1, "p-dropdown", 17);
    i0.ɵɵlistener("ngModelChange", function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_Template_p_dropdown_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r13); var infoBlockIndex_r4 = i0.ɵɵnextContext().index; var ctx_r12 = i0.ɵɵnextContext(); return ctx_r12.multiSelectsConfigs[infoBlockIndex_r4].selectedValue = $event; })("onChange", function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_Template_p_dropdown_onChange_1_listener($event) { i0.ɵɵrestoreView(_r13); var infoBlockIndex_r4 = i0.ɵɵnextContext().index; var ctx_r15 = i0.ɵɵnextContext(); return ctx_r15.handleSelected(infoBlockIndex_r4, $event); });
    i0.ɵɵtemplate(2, AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_ng_template_2_Template, 3, 4, "ng-template", 18);
    i0.ɵɵtemplate(3, AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_ng_template_3_Template, 4, 4, "ng-template", 19);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var infoBlockIndex_r4 = i0.ɵɵnextContext().index;
    var ctx_r6 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("scrollHeight", "250px")("options", ctx_r6.multiSelectsConfigs[infoBlockIndex_r4].items)("ngModel", ctx_r6.multiSelectsConfigs[infoBlockIndex_r4].selectedValue);
} }
function AlDeploymentSummaryHeaderCompactComponent_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8);
    i0.ɵɵelementStart(1, "i");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 9);
    i0.ɵɵelementStart(4, "div");
    i0.ɵɵelementStart(5, "div", 10);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div");
    i0.ɵɵtemplate(8, AlDeploymentSummaryHeaderCompactComponent_ng_template_3_h2_8_Template, 4, 4, "h2", 11);
    i0.ɵɵtemplate(9, AlDeploymentSummaryHeaderCompactComponent_ng_template_3_div_9_Template, 4, 3, "div", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var infoblock_r3 = ctx.$implicit;
    var infoBlockIndex_r4 = ctx.index;
    var ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵclassMap(infoblock_r3.infoBlockIconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(infoblock_r3.infoBlockIconMaterial);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" ", infoblock_r3.infoBlockLabelName, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", infoblock_r3.infoBlockName && infoblock_r3.infoBlockOptions.length === 0);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.shouldDisplayDropDown(infoBlockIndex_r4));
} }
function AlDeploymentSummaryHeaderCompactComponent_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 22);
    i0.ɵɵelementStart(1, "div", 23);
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "alPrefixMultiplier");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 24);
    i0.ɵɵelementStart(5, "i");
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "p");
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var block_r18 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 6, block_r18.quantity), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(block_r18.iconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(block_r18.iconMaterial);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(block_r18.label);
} }
var _c1 = function (a0) { return { "border-bottom": a0 }; };
var AlDeploymentSummaryHeaderCompactComponent = /** @class */ (function () {
    function AlDeploymentSummaryHeaderCompactComponent() {
        this.data = new DeploymentSummaryCompactDescriptor();
        this.fullScreen = false;
        this.mode = 'default-mode';
        this.onSelectOption = new EventEmitter();
        this.multiSelectsConfigs = [];
        this.options = [];
    }
    Object.defineProperty(AlDeploymentSummaryHeaderCompactComponent.prototype, "title", {
        set: function (text) {
            this.setTitle(text);
        },
        enumerable: true,
        configurable: true
    });
    AlDeploymentSummaryHeaderCompactComponent.prototype.ngOnChanges = function () {
        var _a;
        this.multiSelectsConfigs = [];
        var _loop_1 = function (i) {
            var defaultId = this_1.data.infoBlocks[i].infoBlockOptionDefaultKey;
            var multiSelectConfig = {
                items: [],
                selectedItem: undefined,
                selectedValue: undefined,
            };
            multiSelectConfig.items = this_1.data
                .infoBlocks[i]
                .infoBlockOptions
                .map(function (opt) {
                var _a;
                opt.icon = (_a = opt.data) === null || _a === void 0 ? void 0 : _a.icon;
                return {
                    key: opt.key,
                    data: opt.data,
                    label: opt.name,
                    value: opt.key,
                    icon: opt.icon
                };
            });
            multiSelectConfig.selectedItem = multiSelectConfig.items.find(function (item) { return item.value === defaultId; });
            multiSelectConfig.selectedValue = (_a = multiSelectConfig.selectedItem) === null || _a === void 0 ? void 0 : _a.value;
            this_1.multiSelectsConfigs.push(multiSelectConfig);
        };
        var this_1 = this;
        for (var i = 0; i < this.data.infoBlocks.length; i++) {
            _loop_1(i);
        }
    };
    AlDeploymentSummaryHeaderCompactComponent.prototype.shouldDisplayDropDown = function (infoBlockIdx) {
        return this.data.infoBlocks[infoBlockIdx].infoBlockOptions.length > 0;
    };
    AlDeploymentSummaryHeaderCompactComponent.prototype.setTitle = function (text) {
        var _this = this;
        var _a, _b;
        if ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.infoBlocks) === null || _b === void 0 ? void 0 : _b.length) {
            if (this.data.infoBlocks[0].infoBlockOptions.length === 0) {
                this.data.infoBlocks[0].infoBlockName = text;
            }
            else {
                var key_1 = this.data.infoBlocks[0].infoBlockOptionDefaultKey;
                this.data.infoBlocks[0].infoBlockOptions.forEach(function (option, index) {
                    if (option.key === key_1) {
                        _this.data.infoBlocks[0].infoBlockOptions[index].name = text;
                    }
                });
            }
        }
    };
    AlDeploymentSummaryHeaderCompactComponent.prototype.handleSelected = function (index, event) {
        var item = this.multiSelectsConfigs[index].items.find(function (item) { return item.value === (event.value); });
        this.multiSelectsConfigs[index].selectedItem = item;
        this.onSelectOption.emit(item);
    };
    /** @nocollapse */ AlDeploymentSummaryHeaderCompactComponent.ɵfac = function AlDeploymentSummaryHeaderCompactComponent_Factory(t) { return new (t || AlDeploymentSummaryHeaderCompactComponent)(); };
    /** @nocollapse */ AlDeploymentSummaryHeaderCompactComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlDeploymentSummaryHeaderCompactComponent, selectors: [["al-deployment-summary-compact-header"]], inputs: { data: "data", fullScreen: "fullScreen", mode: "mode", title: "title" }, outputs: { onSelectOption: "onSelectOption" }, features: [i0.ɵɵNgOnChangesFeature], decls: 6, vars: 10, consts: [[3, "ngStyle"], ["class", "al al-logo-color logo-block", 4, "ngIf"], [1, "infoblock"], ["ngFor", "", 3, "ngForOf"], [1, "blocks"], [1, "al", "al-logo-color", "logo-block"], [1, "path1"], [1, "path2"], [1, "infoblock-icon"], [1, "infoblock-content"], [1, "sub-name"], ["class", "summary-title", "fxLayoutAlign", "start center", 3, "ngClass", 4, "ngIf"], ["class", "summary-container", 4, "ngIf"], ["fxLayoutAlign", "start center", 1, "summary-title", 3, "ngClass"], [1, "cut-text-parent"], [1, "cut-text-child"], [1, "summary-container"], [3, "scrollHeight", "options", "ngModel", "ngModelChange", "onChange"], ["pTemplate", "selectedItem"], ["pTemplate", "item"], [1, "item-container"], [1, "item-label"], [1, "block"], ["fxFlex", "", 1, "quantity"], [1, "icon-label"]], template: function AlDeploymentSummaryHeaderCompactComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵtemplate(1, AlDeploymentSummaryHeaderCompactComponent_span_1_Template, 3, 0, "span", 1);
            i0.ɵɵelementStart(2, "div", 2);
            i0.ɵɵtemplate(3, AlDeploymentSummaryHeaderCompactComponent_ng_template_3_Template, 10, 7, "ng-template", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(4, "div", 4);
            i0.ɵɵtemplate(5, AlDeploymentSummaryHeaderCompactComponent_ng_template_5_Template, 9, 8, "ng-template", 3);
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵclassMapInterpolate2("al-deployment-summary-compact-header ", ctx.data.lineColor, " ", ctx.mode, "");
            i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(8, _c1, ctx.data.getBorderColorHex()));
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.fullScreen);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngForOf", ctx.data.infoBlocks);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngForOf", ctx.data.summaryBlocks);
        } }, directives: [i1.NgStyle, i1.NgIf, i1.NgForOf, i1.NgClass, i2.Dropdown, i3.NgControlStatus, i3.NgModel, i4.PrimeTemplate], pipes: [i5.AlPrefixMultiplierPipe], styles: [".al-deployment-summary-compact-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 40px}.al-deployment-summary-compact-header.default-mode[_ngcontent-%COMP%]{height:72px;background-color:#fafafa}.al-deployment-summary-compact-header.embedded-mode[_ngcontent-%COMP%]{height:100%;background-color:#fff}.al-deployment-summary-compact-header.datacenter-line[_ngcontent-%COMP%]{border-bottom:2px solid #ba67c8}.al-deployment-summary-compact-header.aws-line[_ngcontent-%COMP%]{border-bottom:2px solid #ffa800}.al-deployment-summary-compact-header.azure-line[_ngcontent-%COMP%]{border-bottom:2px solid #3e82f7}.al-deployment-summary-compact-header.default-line[_ngcontent-%COMP%]{border-bottom:2px solid #cbcbcb}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .summary-title[_ngcontent-%COMP%]{font-size:1.2em;font-weight:400;color:rgba(0,0,0,.7);margin:0}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]{display:flex;align-items:center}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]:last-child{border-right:none}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]{padding-left:15px;padding-right:15px;padding-bottom:0;border-right:1px solid #cbcbcb;display:flex;align-items:center;min-width:100px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]   .quantity[_ngcontent-%COMP%]{font-size:1.2em;margin-top:6px;padding-right:6px;min-width:27px;text-align:right}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]   .icon-label[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex-direction:column;min-width:42px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:1.3em;color:rgba(0,0,0,.6)}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .blocks[_ngcontent-%COMP%]   .block[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin-top:3px;margin-bottom:1px;font-size:.7em;color:#a8a8a8;line-height:10px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]{width:600px;display:flex;align-items:center}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-icon[_ngcontent-%COMP%]{margin-right:12px;display:flex;align-items:center}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:36px;color:#474747}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]{width:100%}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .sub-name[_ngcontent-%COMP%]{font-size:.875em;color:#a8a8a8;padding-top:14px;padding-left:8px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-title[_ngcontent-%COMP%]{position:relative;height:20px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-title[_ngcontent-%COMP%]   .cut-text-parent[_ngcontent-%COMP%]{position:absolute;max-width:calc(100% - 18px);flex-grow:1;top:0;left:0;bottom:0;display:flex;align-items:center}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-title[_ngcontent-%COMP%]   .cut-text-parent[_ngcontent-%COMP%]   .cut-text-child[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:normal}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-title.without-sub-name[_ngcontent-%COMP%]{margin-top:12px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-container[_ngcontent-%COMP%]{width:300px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-container[_ngcontent-%COMP%]   .item-container[_ngcontent-%COMP%]{display:flex;align-items:center}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-container[_ngcontent-%COMP%]   .item-label[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:normal}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .infoblock[_ngcontent-%COMP%]   .infoblock-content[_ngcontent-%COMP%]   .summary-container[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{padding-left:5px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   .logo-block[_ngcontent-%COMP%]{font-size:40px;border-right:1px solid #cbcbcb;padding-right:15px;margin-right:15px}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   mat-select[_ngcontent-%COMP%]{padding-right:30px;margin:0}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   mat-select[_ngcontent-%COMP%]   .mat-select-underline[_ngcontent-%COMP%]{background-color:transparent!important}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   mat-select[_ngcontent-%COMP%]   .mat-select-value-text[_ngcontent-%COMP%]{font-size:1.05em;font-weight:400;color:rgba(0,0,0,.7);margin:0}.al-deployment-summary-compact-header[_ngcontent-%COMP%]   mat-select[_ngcontent-%COMP%]   .mat-select-trigger[_ngcontent-%COMP%]{height:20px}al-multi-select[_ngcontent-%COMP%]{width:100%;font-size:14px!important}"] });
    return AlDeploymentSummaryHeaderCompactComponent;
}());
export { AlDeploymentSummaryHeaderCompactComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlDeploymentSummaryHeaderCompactComponent, [{
        type: Component,
        args: [{
                selector: 'al-deployment-summary-compact-header',
                templateUrl: './al-deployment-summary-compact-header.component.html',
                styleUrls: ['./al-deployment-summary-compact-header.component.scss'],
            }]
    }], null, { data: [{
            type: Input
        }], fullScreen: [{
            type: Input
        }], mode: [{
            type: Input
        }], onSelectOption: [{
            type: Output
        }], title: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 