/**
 * @author Mario Payan <mario.payan@alertlogic.com>
 * @copyright 2019 Alert Logic, Inc.
 */
import { Component, Input, EventEmitter, Output } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { DomSanitizer } from '@angular/platform-browser';
import * as i0 from "@angular/core";
import * as i1 from "@angular/platform-browser";
import * as i2 from "primeng-lts/sidebar";
import * as i3 from "@angular/common";
import * as i4 from "primeng-lts/button";
function AlHelpSidebarComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8);
    i0.ɵɵelement(1, "iframe", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("src", ctx_r0.iframeSafeResourceUrl, i0.ɵɵsanitizeResourceUrl);
} }
var _c0 = function () { return { width: "30em" }; };
var AlHelpSidebarComponent = /** @class */ (function () {
    function AlHelpSidebarComponent(sanitizer) {
        var _this = this;
        this.sanitizer = sanitizer;
        this.visible = false;
        this.iframeContentUrl = "";
        this.learnMoreUrl = "";
        this.onOpen = new EventEmitter();
        this.onClose = new EventEmitter();
        this.iframeSafeResourceUrl = "";
        this.safeUrl = function () {
            _this.iframeSafeResourceUrl = _this.sanitizer.bypassSecurityTrustResourceUrl(_this.iframeContentUrl);
        };
        this.open = function () {
            _this.visible = true;
            _this.onOpen.emit();
        };
        this.close = function () {
            _this.visible = false;
            _this.onClose.emit();
        };
    }
    AlHelpSidebarComponent.prototype.ngOnInit = function () {
        this.safeUrl();
    };
    /** @nocollapse */ AlHelpSidebarComponent.ɵfac = function AlHelpSidebarComponent_Factory(t) { return new (t || AlHelpSidebarComponent)(i0.ɵɵdirectiveInject(i1.DomSanitizer)); };
    /** @nocollapse */ AlHelpSidebarComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlHelpSidebarComponent, selectors: [["al-help-sidebar"]], inputs: { visible: "visible", iframeContentUrl: "iframeContentUrl", learnMoreUrl: "learnMoreUrl" }, outputs: { onOpen: "onOpen", onClose: "onClose" }, decls: 8, vars: 8, consts: [["position", "right", 1, "help-sidebar", 3, "visible", "showCloseIcon", "modal", "visibleChange"], [1, "box"], ["class", "row content", 4, "ngIf"], [1, "row", "footer"], [1, "actions"], ["label", "CLOSE", 1, "close", 3, "onClick"], ["target", "_blank", 3, "href"], ["label", "LEARN MORE", 1, "link"], [1, "row", "content"], ["height", "100%", "frameborder", "0", "width", "100%", 3, "src"]], template: function AlHelpSidebarComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "p-sidebar", 0);
            i0.ɵɵlistener("visibleChange", function AlHelpSidebarComponent_Template_p_sidebar_visibleChange_0_listener($event) { return ctx.visible = $event; });
            i0.ɵɵelementStart(1, "div", 1);
            i0.ɵɵtemplate(2, AlHelpSidebarComponent_div_2_Template, 2, 1, "div", 2);
            i0.ɵɵelementStart(3, "div", 3);
            i0.ɵɵelementStart(4, "div", 4);
            i0.ɵɵelementStart(5, "p-button", 5);
            i0.ɵɵlistener("onClick", function AlHelpSidebarComponent_Template_p_button_onClick_5_listener() { return ctx.close(); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(6, "a", 6);
            i0.ɵɵelement(7, "p-button", 7);
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵstyleMap(i0.ɵɵpureFunction0(7, _c0));
            i0.ɵɵproperty("visible", ctx.visible)("showCloseIcon", false)("modal", false);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", ctx.iframeSafeResourceUrl);
            i0.ɵɵadvance(4);
            i0.ɵɵpropertyInterpolate("href", ctx.learnMoreUrl, i0.ɵɵsanitizeUrl);
        } }, directives: [i2.Sidebar, i3.NgIf, i4.Button], styles: ["[_nghost-%COMP%]     .help-sidebar .ui-sidebar{border-top-left-radius:10px;border-bottom-left-radius:10px;box-shadow:-2px 1px 2px 1px rgba(100,100,100,.5);height:calc(100% - 40px);margin-top:40px}[_nghost-%COMP%]     .help-sidebar .box{display:flex;flex-flow:column;height:100%}[_nghost-%COMP%]     .help-sidebar .box .row.header{flex:0 1 auto}[_nghost-%COMP%]     .help-sidebar .box .row.content{flex:1 1 auto;padding-bottom:7px}[_nghost-%COMP%]     .help-sidebar .box .row.footer{flex:0 1 40px}[_nghost-%COMP%]     .help-sidebar .box .actions .ui-button{width:14em;background-color:transparent}[_nghost-%COMP%]     .help-sidebar .box .actions .close .ui-button-text{color:#000}[_nghost-%COMP%]     .help-sidebar .box .actions .link .ui-button-text{color:#f78c1e}"], data: { animation: [
                trigger('panelState', [
                    state('hidden', style({
                        opacity: 0
                    })),
                    state('visible', style({
                        opacity: 1
                    })),
                    transition('visible => hidden', animate('300ms ease-in')),
                    transition('hidden => visible', animate('300ms ease-out'))
                ])
            ] } });
    return AlHelpSidebarComponent;
}());
export { AlHelpSidebarComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlHelpSidebarComponent, [{
        type: Component,
        args: [{
                selector: 'al-help-sidebar',
                templateUrl: './al-help-sidebar.component.html',
                styleUrls: ['./al-help-sidebar.component.scss'],
                animations: [
                    trigger('panelState', [
                        state('hidden', style({
                            opacity: 0
                        })),
                        state('visible', style({
                            opacity: 1
                        })),
                        transition('visible => hidden', animate('300ms ease-in')),
                        transition('hidden => visible', animate('300ms ease-out'))
                    ])
                ]
            }]
    }], function () { return [{ type: i1.DomSanitizer }]; }, { visible: [{
            type: Input
        }], iframeContentUrl: [{
            type: Input
        }], learnMoreUrl: [{
            type: Input
        }], onOpen: [{
            type: Output
        }], onClose: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 