import { Component, ViewEncapsulation, Input } from '@angular/core';
import { NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
import * as i2 from "../../services/faqs-manager.service";
import * as i3 from "@angular/common";
import * as i4 from "../../components/faqs-content/faqs-content.component";
export class SmzFaqsComponent {
    constructor(router, manager) {
        this.router = router;
        this.manager = manager;
        this.expanded = false;
        this.verticalPosition = 'bottom';
        this.activated = false;
        this.setupRouterListener();
    }
    ngOnInit() {
    }
    setupRouterListener() {
        this.router.events
            .pipe(filter(event => event instanceof NavigationEnd))
            .subscribe((event) => {
            const activedRoute = this.getActivatedRoute();
            const data = activedRoute.snapshot.data;
            const faqs = data.faqs;
            if (faqs && faqs.enabled) {
                // ROTA COM QUIZ HABILITADO
                this.activated = true;
                this.manager.currentTag = faqs.tag;
            }
            else {
                this.activated = false;
                this.manager.currentTag = null;
            }
        });
    }
    getActivatedRoute() {
        let route = this.router.routerState.root;
        while (route.firstChild)
            route = route.firstChild;
        return route;
    }
    toggle() {
        this.expanded = !this.expanded;
        if (this.expanded)
            this.loadData();
    }
    loadData() {
        this.manager.loadTag();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzFaqsComponent, deps: [{ token: i1.Router }, { token: i2.FaqsManagerService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: SmzFaqsComponent, selector: "smz-faqs", inputs: { expanded: "expanded", verticalPosition: "verticalPosition" }, ngImport: i0, template: "<ng-container *ngIf=\"activated\">\r\n    <div *ngIf=\"expanded\" class=\"layout-dimmer\" (click)=\"expanded = false\"></div>\r\n\r\n    <div class=\"layout-config\" [ngClass]=\"{ 'layout-config-active': expanded }\">\r\n        <div class=\"layout-config-content-wrapper\">\r\n            <a class=\"layout-config-button\" tabindex=\"0\" [ngStyle]=\"{ top: manager.config.layouts.positions[verticalPosition] }\" (click)=\"toggle()\">\r\n                <i class=\"fa-solid fa-circle-question\"></i>\r\n            </a>\r\n            <a class=\"layout-config-close hvr-grow\" tabindex=\"0\" (click)=\"expanded = false\">\r\n                <i class=\"fa-solid fa-xmark\"></i>\r\n            </a>\r\n            <div class=\"layout-config-content\">\r\n                <ng-container *ngIf=\"expanded\">\r\n                    <ng-container *ngIf=\"manager.dbData$ | async as dbData\">\r\n                        <smz-faqs-content [items]=\"dbData.items\"></smz-faqs-content>\r\n                    </ng-container>\r\n                </ng-container>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</ng-container>", styles: ["smz-faqs{font-size:14px}smz-faqs .layout-dimmer{position:fixed;inset:0;background-color:#00000059;-webkit-user-select:none;user-select:none;z-index:101}smz-faqs .layout-config{position:fixed;padding:0;top:0;right:0;display:block;width:550px;z-index:998;height:100%;transition:transform .4s cubic-bezier(.05,.74,.2,.99);-ms-transform:translateX(100%);transform:translate(100%);-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:inherit}smz-faqs .layout-config .layout-config-content-wrapper{position:relative;height:100%;box-shadow:0 2px 10px #0000003d;color:var(--text-color);background-color:var(--surface-f)}smz-faqs .layout-config .layout-config-content-wrapper .layout-config-button{display:block;position:absolute;width:52px;height:52px;line-height:52px;background-color:var(--primary-color);text-align:center;color:var(--primary-color-text);left:-51px;z-index:-1;overflow:hidden;cursor:pointer;outline:0 none;border-radius:3px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}smz-faqs .layout-config .layout-config-content-wrapper .layout-config-button i{font-size:26px;line-height:inherit;cursor:pointer;-ms-transform:rotate(1turn);transform:rotate(1turn);transition:transform 1s}smz-faqs .layout-config.layout-config-active{-ms-transform:translateX(0);transform:translate(0)}smz-faqs .layout-config .layout-config-close{position:absolute;width:25px;height:25px;line-height:26px;text-align:center;right:20px;top:20px;z-index:999;background-color:var(--primary-color);border-radius:50%;cursor:pointer;transition:background-color .2s,box-shadow .2s,transform .2s}smz-faqs .layout-config .layout-config-content{overflow:auto;height:100%;padding:4rem 2rem 2rem}smz-faqs .layout-config .layout-config-close i{color:var(--primary-color-text);line-height:inherit;font-size:14px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i4.FaqsContentComponent, selector: "smz-faqs-content", inputs: ["items"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzFaqsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'smz-faqs', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"activated\">\r\n    <div *ngIf=\"expanded\" class=\"layout-dimmer\" (click)=\"expanded = false\"></div>\r\n\r\n    <div class=\"layout-config\" [ngClass]=\"{ 'layout-config-active': expanded }\">\r\n        <div class=\"layout-config-content-wrapper\">\r\n            <a class=\"layout-config-button\" tabindex=\"0\" [ngStyle]=\"{ top: manager.config.layouts.positions[verticalPosition] }\" (click)=\"toggle()\">\r\n                <i class=\"fa-solid fa-circle-question\"></i>\r\n            </a>\r\n            <a class=\"layout-config-close hvr-grow\" tabindex=\"0\" (click)=\"expanded = false\">\r\n                <i class=\"fa-solid fa-xmark\"></i>\r\n            </a>\r\n            <div class=\"layout-config-content\">\r\n                <ng-container *ngIf=\"expanded\">\r\n                    <ng-container *ngIf=\"manager.dbData$ | async as dbData\">\r\n                        <smz-faqs-content [items]=\"dbData.items\"></smz-faqs-content>\r\n                    </ng-container>\r\n                </ng-container>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</ng-container>", styles: ["smz-faqs{font-size:14px}smz-faqs .layout-dimmer{position:fixed;inset:0;background-color:#00000059;-webkit-user-select:none;user-select:none;z-index:101}smz-faqs .layout-config{position:fixed;padding:0;top:0;right:0;display:block;width:550px;z-index:998;height:100%;transition:transform .4s cubic-bezier(.05,.74,.2,.99);-ms-transform:translateX(100%);transform:translate(100%);-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:inherit}smz-faqs .layout-config .layout-config-content-wrapper{position:relative;height:100%;box-shadow:0 2px 10px #0000003d;color:var(--text-color);background-color:var(--surface-f)}smz-faqs .layout-config .layout-config-content-wrapper .layout-config-button{display:block;position:absolute;width:52px;height:52px;line-height:52px;background-color:var(--primary-color);text-align:center;color:var(--primary-color-text);left:-51px;z-index:-1;overflow:hidden;cursor:pointer;outline:0 none;border-radius:3px;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}smz-faqs .layout-config .layout-config-content-wrapper .layout-config-button i{font-size:26px;line-height:inherit;cursor:pointer;-ms-transform:rotate(1turn);transform:rotate(1turn);transition:transform 1s}smz-faqs .layout-config.layout-config-active{-ms-transform:translateX(0);transform:translate(0)}smz-faqs .layout-config .layout-config-close{position:absolute;width:25px;height:25px;line-height:26px;text-align:center;right:20px;top:20px;z-index:999;background-color:var(--primary-color);border-radius:50%;cursor:pointer;transition:background-color .2s,box-shadow .2s,transform .2s}smz-faqs .layout-config .layout-config-content{overflow:auto;height:100%;padding:4rem 2rem 2rem}smz-faqs .layout-config .layout-config-close i{color:var(--primary-color-text);line-height:inherit;font-size:14px}\n"] }]
        }], ctorParameters: () => [{ type: i1.Router }, { type: i2.FaqsManagerService }], propDecorators: { expanded: [{
                type: Input
            }], verticalPosition: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 