import { Component, Input } from '@angular/core';
import { AlPreviewData } from '../types/al-preview-data.types';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
function AlPreviewComponent_h3_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "h3", 5);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r0.data.subtitleLabel);
} }
function AlPreviewComponent_div_6_div_3_div_1_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵelement(1, "i", 14);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const valueDef_r6 = i0.ɵɵnextContext().$implicit;
    const prop_r2 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", valueDef_r6.icon || prop_r2.icon);
} }
function AlPreviewComponent_div_6_div_3_div_1_div_2_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵelementStart(1, "a", 15);
    i0.ɵɵlistener("click", function AlPreviewComponent_div_6_div_3_div_1_div_2_Template_a_click_1_listener() { i0.ɵɵrestoreView(_r15); const valueDef_r6 = i0.ɵɵnextContext().$implicit; return valueDef_r6.action(); });
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const valueDef_r6 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(valueDef_r6.label);
} }
function AlPreviewComponent_div_6_div_3_div_1_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtext(0);
} if (rf & 2) {
    const valueDef_r6 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵtextInterpolate(valueDef_r6.label);
} }
function AlPreviewComponent_div_6_div_3_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵtemplate(1, AlPreviewComponent_div_6_div_3_div_1_span_1_Template, 2, 1, "span", 10);
    i0.ɵɵtemplate(2, AlPreviewComponent_div_6_div_3_div_1_div_2_Template, 3, 1, "div", 11);
    i0.ɵɵtemplate(3, AlPreviewComponent_div_6_div_3_div_1_ng_template_3_Template, 1, 1, "ng-template", null, 12, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const valueDef_r6 = ctx.$implicit;
    const _r9 = i0.ɵɵreference(4);
    const prop_r2 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", valueDef_r6.icon || prop_r2.icon);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", valueDef_r6.action)("ngIfElse", _r9);
} }
function AlPreviewComponent_div_6_div_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵtemplate(1, AlPreviewComponent_div_6_div_3_div_1_Template, 5, 3, "div", 8);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const prop_r2 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", prop_r2.value);
} }
function AlPreviewComponent_div_6_div_4_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
const _c0 = function (a0) { return { $implicit: a0 }; };
function AlPreviewComponent_div_6_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵtemplate(1, AlPreviewComponent_div_6_div_4_ng_container_1_Template, 1, 0, "ng-container", 16);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const prop_r2 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", prop_r2.value[0].label)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c0, prop_r2.templateData));
} }
function AlPreviewComponent_div_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div");
    i0.ɵɵelementStart(1, "h3", 6);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(3, AlPreviewComponent_div_6_div_3_Template, 2, 1, "div", 7);
    i0.ɵɵtemplate(4, AlPreviewComponent_div_6_div_4_Template, 2, 4, "div", 7);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const prop_r2 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(prop_r2.key);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !prop_r2.isTemplate);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", prop_r2.isTemplate);
} }
export class AlPreviewComponent {
    constructor() {
        this.data = new AlPreviewData();
    }
    ngOnChanges(changes) {
        this.data = changes.data.currentValue;
        this.data.properties.forEach(prop => {
            prop.value = Array.isArray(prop.value) ? this.normalizeValues(prop.value) : [{ label: isNaN(prop.value) ? prop.value : `${prop.value}`, icon: prop.icon }];
        });
    }
    /*
     * Simple helper to ensure all array value entries are constructed as objects with a label property at a minimum
     */
    normalizeValues(vals) {
        vals = vals.filter(v => v !== null); // remove any null entries
        if (vals.every((value) => !value.hasOwnProperty('label'))) {
            return vals.map(v => {
                return { label: isNaN(v) ? v : `${v}` };
            });
        }
        return vals;
    }
}
/** @nocollapse */ AlPreviewComponent.ɵfac = function AlPreviewComponent_Factory(t) { return new (t || AlPreviewComponent)(); };
/** @nocollapse */ AlPreviewComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlPreviewComponent, selectors: [["al-preview"]], inputs: { data: "data" }, features: [i0.ɵɵNgOnChangesFeature], decls: 7, vars: 4, consts: [[1, "al-preview"], [1, "dont-break-out"], ["class", "property-name dont-break-out subtitle-label", 4, "ngIf"], [1, "subtitle", "dont-break-out"], [4, "ngFor", "ngForOf"], [1, "property-name", "dont-break-out", "subtitle-label"], [1, "property-name", "dont-break-out"], [4, "ngIf"], ["class", "property-value dont-break-out", 4, "ngFor", "ngForOf"], [1, "property-value", "dont-break-out"], ["class", "property-icon", 4, "ngIf"], [4, "ngIf", "ngIfElse"], ["noAction", ""], [1, "property-icon"], [3, "ngClass"], ["href", "#", 3, "click"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"]], template: function AlPreviewComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div", 0);
        i0.ɵɵelementStart(1, "h2", 1);
        i0.ɵɵtext(2);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(3, AlPreviewComponent_h3_3_Template, 2, 1, "h3", 2);
        i0.ɵɵelementStart(4, "div", 3);
        i0.ɵɵtext(5);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(6, AlPreviewComponent_div_6_Template, 5, 3, "div", 4);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵadvance(2);
        i0.ɵɵtextInterpolate(ctx.data.title);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.data.subtitleLabel);
        i0.ɵɵadvance(2);
        i0.ɵɵtextInterpolate(ctx.data.subtitle);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngForOf", ctx.data.properties);
    } }, directives: [i1.NgIf, i1.NgForOf, i1.NgClass, i1.NgTemplateOutlet], styles: [".al-preview[_ngcontent-%COMP%]{position:sticky;overflow-y:auto}.al-preview[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{border-bottom:none;color:#3c3c3c;font-size:14px;font-weight:700;margin:12px 0 0;padding:0}.al-preview[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:12px;font-weight:400;color:var(--label);margin:12px 0 0;padding-bottom:0;text-transform:capitalize}.al-preview[_ngcontent-%COMP%]   h3.subtitle-label[_ngcontent-%COMP%]{margin-block-start:0}.al-preview[_ngcontent-%COMP%]   .property-value[_ngcontent-%COMP%]{margin-bottom:12px;font-size:14px;display:flex;align-items:center}.al-preview[_ngcontent-%COMP%]   .property-value[_ngcontent-%COMP%]   .property-icon[_ngcontent-%COMP%]{font-size:24px}.al-preview[_ngcontent-%COMP%]   .property-value[_ngcontent-%COMP%]   .property-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{margin-right:6px}.al-preview[_ngcontent-%COMP%]   .property-value[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]{color:#57a0d7;text-decoration:underline}.al-preview[_ngcontent-%COMP%]   .dont-break-out[_ngcontent-%COMP%]{overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-webkit-hyphens:auto;hyphens:auto}@media only screen and (max-width:1024px){.al-preview[_ngcontent-%COMP%], .al-preview[_ngcontent-%COMP%]   .property-value[_ngcontent-%COMP%], .al-preview[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:12px}}"] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlPreviewComponent, [{
        type: Component,
        args: [{
                selector: 'al-preview',
                templateUrl: './al-preview.component.html',
                styleUrls: ['./al-preview.component.scss'],
            }]
    }], function () { return []; }, { data: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 