import * as i1$2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Component, Input, output, ViewChild, ContentChildren, NgModule } from '@angular/core';
import * as i3 from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import * as i5 from '@seniorsistemas/angular-components/badge';
import { BadgeModule } from '@seniorsistemas/angular-components/badge';
import { ButtonModule } from '@seniorsistemas/angular-components/button';
import { TemplateDirective, TemplateModule } from '@seniorsistemas/angular-components/template';
import { TooltipModule } from '@seniorsistemas/angular-components/tooltip';
import { first, finalize } from 'rxjs/operators';
import { marked } from 'marked';
import * as i1$1 from '@angular/cdk/clipboard';
import * as i2 from '@seniorsistemas/angular-components/toast';
import * as i1 from '@seniorsistemas/angular-components/common';
import { SVGFactoryModule } from '@seniorsistemas/angular-components/common';

class IAInsightCardLoaderComponent {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightCardLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: IAInsightCardLoaderComponent, selector: "s-ia-insight-card-loader", ngImport: i0, template: "<div class=\"ia-insight-card-loader\">\n    <div class=\"loader\">\n        <div class=\"loader-icon\">\n                <div *sSVGFactory=\"'iassist'\"></div>\n        </div>\n    </div>\n    \n    <span class=\"loader-label\">{{ \"platform.angular_components.loading_insight\" | translate }}</span>\n</div>\n", styles: [".ia-insight-card-loader{align-items:center;display:flex;flex-direction:column;gap:24px}.ia-insight-card-loader .loader{align-items:center;animation:spin 2s linear infinite;border:2px solid #f1f7f8;border-top:2px solid #0fa389;border-radius:50%;display:flex;height:48px;justify-content:center;width:48px}.ia-insight-card-loader .loader .loader-icon{animation:spin 2s linear infinite reverse;height:32px;transform:translate(-50%,-50%)}.ia-insight-card-loader .loader-label{color:#888b99;font-family:Open Sans,sans-serif;font-size:16px}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: i1.SVGFactoryDirective, selector: "[sSVGFactory]", inputs: ["sSVGFactory"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightCardLoaderComponent, decorators: [{
            type: Component,
            args: [{ selector: "s-ia-insight-card-loader", template: "<div class=\"ia-insight-card-loader\">\n    <div class=\"loader\">\n        <div class=\"loader-icon\">\n                <div *sSVGFactory=\"'iassist'\"></div>\n        </div>\n    </div>\n    \n    <span class=\"loader-label\">{{ \"platform.angular_components.loading_insight\" | translate }}</span>\n</div>\n", styles: [".ia-insight-card-loader{align-items:center;display:flex;flex-direction:column;gap:24px}.ia-insight-card-loader .loader{align-items:center;animation:spin 2s linear infinite;border:2px solid #f1f7f8;border-top:2px solid #0fa389;border-radius:50%;display:flex;height:48px;justify-content:center;width:48px}.ia-insight-card-loader .loader .loader-icon{animation:spin 2s linear infinite reverse;height:32px;transform:translate(-50%,-50%)}.ia-insight-card-loader .loader-label{color:#888b99;font-family:Open Sans,sans-serif;font-size:16px}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
        }] });

class IAInsightCardComponent {
    clipboard;
    toastService;
    translateService;
    insight;
    open = false;
    isLoading = false;
    content;
    likeSelected = false;
    dislikeSelected = false;
    constructor(clipboard, toastService, translateService) {
        this.clipboard = clipboard;
        this.toastService = toastService;
        this.translateService = translateService;
    }
    toggle() {
        const newOpenState = !this.open;
        this.open = newOpenState;
        if (newOpenState === true && this.insight.onOpenSidebar) {
            this.insight.onOpenSidebar();
        }
        else if (newOpenState === false && this.insight.onCloseSideBar) {
            this.insight.onCloseSideBar();
        }
        if (newOpenState === true) {
            this._requestInsight();
        }
    }
    onLikeSelected() {
        if (this.likeSelected) {
            this.likeSelected = false;
        }
        else {
            this.likeSelected = true;
            this.dislikeSelected = false;
            this.insight.onLikeSelected?.();
        }
    }
    onDislikeSelected() {
        if (this.dislikeSelected) {
            this.dislikeSelected = false;
        }
        else {
            this.dislikeSelected = true;
            this.likeSelected = false;
            this.insight.onDislikeSelected?.();
        }
    }
    copyContent() {
        if (!this.content)
            return;
        this.insight.onCopy?.(this.content);
        if (this.clipboard.copy(this.content)) {
            this.toastService.show({
                severity: 'info',
                title: this.translateService.instant('platform.angular_components.copied_to_clipboard'),
            });
        }
    }
    reloadContent() {
        this._requestInsight();
    }
    _requestInsight() {
        this.isLoading = true;
        this.insight.request$
            .pipe(first(), finalize(() => (this.isLoading = false)))
            .subscribe(async (content) => {
            this.content = await marked(content);
            if (this.insight.onContentLoaded) {
                this.insight.onContentLoaded();
            }
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightCardComponent, deps: [{ token: i1$1.Clipboard }, { token: i2.ToastService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: IAInsightCardComponent, selector: "s-ia-insight-card", inputs: { insight: "insight" }, ngImport: i0, template: "<div\n    class=\"ia-insight-card\"\n    [ngClass]=\"{ 'ia-insight-card--close': !open }\"\n>\n    <div\n        class=\"header\"\n        (click)=\"toggle()\"\n    >\n        <s-badge\n            text=\"Insight\"\n            iconClass=\"fal fa-lightbulb\"\n        ></s-badge>\n        <span class=\"insight-title\">{{ insight.title }}</span>\n        <span class=\"toggle-icon\">\n            <i\n                class=\"fas\"\n                [ngClass]=\"{\n                    'fa-angle-down': !open,\n                    'fa-angle-up': open,\n                }\"\n            >\n            </i>\n        </span>\n    </div>\n    <div class=\"content\">\n        <ng-container *ngIf=\"isLoading; then loadingBlock; else contentBlock\"></ng-container>\n        <ng-template #loadingBlock>\n            <s-ia-insight-card-loader></s-ia-insight-card-loader>\n        </ng-template>\n        <ng-template #contentBlock>\n            <ng-container *ngIf=\"content; then successBlock; else errorBlock\"></ng-container>\n\n            <ng-template #successBlock>\n                <span\n                    class=\"text\"\n                    [innerHTML]=\"content\"\n                ></span>\n                <span class=\"insight-footer\">{{ \"platform.angular_components.insight_footer\" | translate }}</span>\n\n            </ng-template>\n            <ng-template #errorBlock>\n                <span class=\"text text--error\">{{\n                    'platform.angular_components.error_loading_insight_alt' | translate\n                }}</span>\n            </ng-template>\n\n            <div class=\"options\">\n                <button\n                    [disabled]=\"!content\"\n                    (click)=\"copyContent()\"\n                    class=\"option\"\n                >\n                    <i class=\"fal fa-copy\"></i>\n                </button>\n                <button\n                    (click)=\"reloadContent()\"\n                    class=\"option\"\n                >\n                    <i class=\"fal fa-redo\"></i>\n                </button>\n                <button\n                    *ngIf=\"insight.onLikeSelected\"\n                    [disabled]=\"!content\"\n                    (click)=\"onLikeSelected()\"\n                    class=\"option\"\n                >\n                    <i\n                        [ngClass]=\"{\n                            fal: !likeSelected,\n                            fas: likeSelected,\n                            'fa-thumbs-up': true,\n                        }\"\n                    >\n                    </i>\n                </button>\n                <button\n                    *ngIf=\"insight.onDislikeSelected\"\n                    [disabled]=\"!content\"\n                    (click)=\"onDislikeSelected()\"\n                    class=\"option\"\n                >\n                    <i\n                        [ngClass]=\"{\n                            fal: !dislikeSelected,\n                            fas: dislikeSelected,\n                            'fa-thumbs-down': true,\n                        }\"\n                    ></i>\n                </button>\n            </div>\n        </ng-template>\n    </div>\n</div>\n", styles: [".ia-insight-card{background-color:#fff;border:1px solid #9ecad4;border-radius:4px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden}.ia-insight-card .header{align-items:center;background-color:#f1f7f8;border-bottom:1px solid #9ecad4;display:flex;gap:8px;min-height:60px;padding:8px 16px;-webkit-user-select:none;user-select:none}.ia-insight-card .header .insight-title{color:#428bca;flex-grow:1;font-family:Open Sans,sans-serif;font-size:14px;line-height:150%}.ia-insight-card .header .toggle-icon{color:#888b99;font-size:20px}.ia-insight-card .content{align-items:center;justify-content:space-between;cursor:auto;display:flex;flex-direction:column;gap:16px;min-height:160px;padding:24px}.ia-insight-card .content .text{color:#212533;font-family:Open Sans,sans-serif;font-size:14px;width:100%}.ia-insight-card .content .text--error{text-align:center}.ia-insight-card .content .insight-footer{color:#888b99;font-family:Open Sans,sans-serif;font-size:12px;text-align:center}.ia-insight-card .content .options{display:flex;gap:8px}.ia-insight-card .content .options .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:12px}.ia-insight-card .content .options .option:disabled{color:#c1c1cc;cursor:auto}.ia-insight-card--close{border-color:#dedce5}.ia-insight-card--close .header{background-color:#fbfafc;border:none;border-color:#dedce5}.ia-insight-card--close .header .insight-title{color:#888b99}.ia-insight-card--close .content{display:none}\n"], dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.BadgeComponent, selector: "s-badge", inputs: ["type", "color", "title", "text", "selectable", "iconClass", "iconPosition", "infoSign", "enableTruncateText"], outputs: ["selected"] }, { kind: "component", type: IAInsightCardLoaderComponent, selector: "s-ia-insight-card-loader" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-ia-insight-card', template: "<div\n    class=\"ia-insight-card\"\n    [ngClass]=\"{ 'ia-insight-card--close': !open }\"\n>\n    <div\n        class=\"header\"\n        (click)=\"toggle()\"\n    >\n        <s-badge\n            text=\"Insight\"\n            iconClass=\"fal fa-lightbulb\"\n        ></s-badge>\n        <span class=\"insight-title\">{{ insight.title }}</span>\n        <span class=\"toggle-icon\">\n            <i\n                class=\"fas\"\n                [ngClass]=\"{\n                    'fa-angle-down': !open,\n                    'fa-angle-up': open,\n                }\"\n            >\n            </i>\n        </span>\n    </div>\n    <div class=\"content\">\n        <ng-container *ngIf=\"isLoading; then loadingBlock; else contentBlock\"></ng-container>\n        <ng-template #loadingBlock>\n            <s-ia-insight-card-loader></s-ia-insight-card-loader>\n        </ng-template>\n        <ng-template #contentBlock>\n            <ng-container *ngIf=\"content; then successBlock; else errorBlock\"></ng-container>\n\n            <ng-template #successBlock>\n                <span\n                    class=\"text\"\n                    [innerHTML]=\"content\"\n                ></span>\n                <span class=\"insight-footer\">{{ \"platform.angular_components.insight_footer\" | translate }}</span>\n\n            </ng-template>\n            <ng-template #errorBlock>\n                <span class=\"text text--error\">{{\n                    'platform.angular_components.error_loading_insight_alt' | translate\n                }}</span>\n            </ng-template>\n\n            <div class=\"options\">\n                <button\n                    [disabled]=\"!content\"\n                    (click)=\"copyContent()\"\n                    class=\"option\"\n                >\n                    <i class=\"fal fa-copy\"></i>\n                </button>\n                <button\n                    (click)=\"reloadContent()\"\n                    class=\"option\"\n                >\n                    <i class=\"fal fa-redo\"></i>\n                </button>\n                <button\n                    *ngIf=\"insight.onLikeSelected\"\n                    [disabled]=\"!content\"\n                    (click)=\"onLikeSelected()\"\n                    class=\"option\"\n                >\n                    <i\n                        [ngClass]=\"{\n                            fal: !likeSelected,\n                            fas: likeSelected,\n                            'fa-thumbs-up': true,\n                        }\"\n                    >\n                    </i>\n                </button>\n                <button\n                    *ngIf=\"insight.onDislikeSelected\"\n                    [disabled]=\"!content\"\n                    (click)=\"onDislikeSelected()\"\n                    class=\"option\"\n                >\n                    <i\n                        [ngClass]=\"{\n                            fal: !dislikeSelected,\n                            fas: dislikeSelected,\n                            'fa-thumbs-down': true,\n                        }\"\n                    ></i>\n                </button>\n            </div>\n        </ng-template>\n    </div>\n</div>\n", styles: [".ia-insight-card{background-color:#fff;border:1px solid #9ecad4;border-radius:4px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden}.ia-insight-card .header{align-items:center;background-color:#f1f7f8;border-bottom:1px solid #9ecad4;display:flex;gap:8px;min-height:60px;padding:8px 16px;-webkit-user-select:none;user-select:none}.ia-insight-card .header .insight-title{color:#428bca;flex-grow:1;font-family:Open Sans,sans-serif;font-size:14px;line-height:150%}.ia-insight-card .header .toggle-icon{color:#888b99;font-size:20px}.ia-insight-card .content{align-items:center;justify-content:space-between;cursor:auto;display:flex;flex-direction:column;gap:16px;min-height:160px;padding:24px}.ia-insight-card .content .text{color:#212533;font-family:Open Sans,sans-serif;font-size:14px;width:100%}.ia-insight-card .content .text--error{text-align:center}.ia-insight-card .content .insight-footer{color:#888b99;font-family:Open Sans,sans-serif;font-size:12px;text-align:center}.ia-insight-card .content .options{display:flex;gap:8px}.ia-insight-card .content .options .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:12px}.ia-insight-card .content .options .option:disabled{color:#c1c1cc;cursor:auto}.ia-insight-card--close{border-color:#dedce5}.ia-insight-card--close .header{background-color:#fbfafc;border:none;border-color:#dedce5}.ia-insight-card--close .header .insight-title{color:#888b99}.ia-insight-card--close .content{display:none}\n"] }]
        }], ctorParameters: () => [{ type: i1$1.Clipboard }, { type: i2.ToastService }, { type: i3.TranslateService }], propDecorators: { insight: [{
                type: Input,
                args: [{ required: true }]
            }] } });

class IAInsightSidebarComponent {
    insights = [];
    hasPermission = false;
    introText;
    introTemplate = null;
    emptyText;
    emptyTemplate = null;
    noPermissionText;
    noPermissionTemplate = null;
    closedSidebar = output();
    openedSidebar = output();
    opened = false;
    toggle() {
        const newState = !this.opened;
        if (newState) {
            this.open();
        }
        else {
            this.close();
        }
    }
    open() {
        this.opened = true;
        this.openedSidebar.emit();
    }
    close() {
        this.opened = false;
        this.closedSidebar.emit();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightSidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: IAInsightSidebarComponent, selector: "s-ia-insight-sidebar", inputs: { insights: "insights", hasPermission: "hasPermission", introText: "introText", introTemplate: "introTemplate", emptyText: "emptyText", emptyTemplate: "emptyTemplate", noPermissionText: "noPermissionText", noPermissionTemplate: "noPermissionTemplate" }, outputs: { closedSidebar: "closedSidebar", openedSidebar: "openedSidebar" }, ngImport: i0, template: "<div\n    class=\"sidebar\"\n    [class.opened]=\"opened\">\n    <div class=\"header\">\n        <button (click)=\"close()\" class=\"option\">\n            <span class=\"far fa-chevron-double-right\"></span>\n        </button>\n        <div class=\"title\">\n            <span><ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container></span>\n            <span>Insight</span>\n        </div>\n    </div>\n    <div class=\"intro\">\n        <ng-container *ngIf=\"hasPermission; then permissionBlock; else noPermissionBlock\"></ng-container>\n\n        <ng-template #permissionBlock>\n            <ng-container *ngIf=\"insights?.length; then introBlock; else emptyBlock\"></ng-container>\n\n            <ng-template #introBlock>\n                <ng-container *ngIf=\"introTemplate; then introCustomBlock; else introTextBlock\"></ng-container>\n\n                <ng-template #introCustomBlock>\n                    <ng-container *ngTemplateOutlet=\"introTemplate\"></ng-container>\n                </ng-template>\n\n                <ng-template #introTextBlock>\n                    <span class=\"text\">{{ introText || \"platform.angular_components.insight_intro\" | translate }}</span>\n                </ng-template>\n            </ng-template>\n\n            <ng-template #emptyBlock>\n                <ng-container *ngIf=\"emptyTemplate; then emptyCustomBlock; else emptyTextBlock\"></ng-container>\n\n                <ng-template #emptyCustomBlock>\n                    <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\n                </ng-template>\n\n                <ng-template #emptyTextBlock>\n                    <span class=\"text\">{{ emptyText || \"platform.angular_components.insight_empty\" | translate }}</span>\n                </ng-template>\n            </ng-template>\n        </ng-template>\n\n        <ng-template #noPermissionBlock>\n            <ng-container *ngIf=\"noPermissionTemplate; then noPermissionCustomBlock; else noPermissionTextBlock\"></ng-container>\n\n            <ng-template #noPermissionCustomBlock>\n                <ng-container *ngTemplateOutlet=\"noPermissionTemplate\"></ng-container>\n            </ng-template>\n\n            <ng-template #noPermissionTextBlock>\n                <span>{{ noPermissionText || \"platform.angular_components.insight_no_permission\" | translate }}</span>\n            </ng-template>\n        </ng-template>\n    </div>\n    <div class=\"insights\">\n        <ng-container *ngIf=\"insights?.length\">\n            <s-ia-insight-card\n                *ngFor=\"let insight of insights\"\n                [insight]=\"insight\">\n            </s-ia-insight-card>\n        </ng-container>\n    </div>\n</div>\n\n<ng-template #iassistIcon>\n    <div style=\"width: 28px; height: 28px;\">\n        <span *sSVGFactory=\"'iassist'\"></span>\n    </div>\n</ng-template>\n", styles: [".sidebar{background-color:#fff;border-left:1px solid #dedce5;height:100%;overflow-x:hidden;position:fixed;right:-25%;transition:.5s;top:0;width:25%;z-index:1002}.sidebar .header{border-bottom:1px solid #dedce5;display:flex;gap:16px;padding:12px 20px}.sidebar .header .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:16px;padding:12px}.sidebar .header .title{align-items:center;color:#212533;display:flex;font-family:Open Sans,sans-serif;font-size:16px;gap:16px;line-height:1;-webkit-user-select:none;user-select:none}.sidebar .intro{margin:8px 40px}.sidebar .intro .text{color:#212533;display:flex;font-family:Open Sans,sans-serif;font-size:14px;justify-content:center;line-height:1.5;text-align:center;-webkit-user-select:none;user-select:none}.sidebar.opened{right:0}.sidebar.opened .insights{padding:12px}.insights{display:flex;flex-direction:column;gap:12px}@media (max-width: 1366px){.sidebar{right:-50%;width:50%}}@media (max-width: 768px){.sidebar{right:-75%;width:75%}}@media (max-width: 600px){.sidebar{right:-100%;width:100%}}\n"], dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.SVGFactoryDirective, selector: "[sSVGFactory]", inputs: ["sSVGFactory"] }, { kind: "component", type: IAInsightCardComponent, selector: "s-ia-insight-card", inputs: ["insight"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightSidebarComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-ia-insight-sidebar', template: "<div\n    class=\"sidebar\"\n    [class.opened]=\"opened\">\n    <div class=\"header\">\n        <button (click)=\"close()\" class=\"option\">\n            <span class=\"far fa-chevron-double-right\"></span>\n        </button>\n        <div class=\"title\">\n            <span><ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container></span>\n            <span>Insight</span>\n        </div>\n    </div>\n    <div class=\"intro\">\n        <ng-container *ngIf=\"hasPermission; then permissionBlock; else noPermissionBlock\"></ng-container>\n\n        <ng-template #permissionBlock>\n            <ng-container *ngIf=\"insights?.length; then introBlock; else emptyBlock\"></ng-container>\n\n            <ng-template #introBlock>\n                <ng-container *ngIf=\"introTemplate; then introCustomBlock; else introTextBlock\"></ng-container>\n\n                <ng-template #introCustomBlock>\n                    <ng-container *ngTemplateOutlet=\"introTemplate\"></ng-container>\n                </ng-template>\n\n                <ng-template #introTextBlock>\n                    <span class=\"text\">{{ introText || \"platform.angular_components.insight_intro\" | translate }}</span>\n                </ng-template>\n            </ng-template>\n\n            <ng-template #emptyBlock>\n                <ng-container *ngIf=\"emptyTemplate; then emptyCustomBlock; else emptyTextBlock\"></ng-container>\n\n                <ng-template #emptyCustomBlock>\n                    <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\n                </ng-template>\n\n                <ng-template #emptyTextBlock>\n                    <span class=\"text\">{{ emptyText || \"platform.angular_components.insight_empty\" | translate }}</span>\n                </ng-template>\n            </ng-template>\n        </ng-template>\n\n        <ng-template #noPermissionBlock>\n            <ng-container *ngIf=\"noPermissionTemplate; then noPermissionCustomBlock; else noPermissionTextBlock\"></ng-container>\n\n            <ng-template #noPermissionCustomBlock>\n                <ng-container *ngTemplateOutlet=\"noPermissionTemplate\"></ng-container>\n            </ng-template>\n\n            <ng-template #noPermissionTextBlock>\n                <span>{{ noPermissionText || \"platform.angular_components.insight_no_permission\" | translate }}</span>\n            </ng-template>\n        </ng-template>\n    </div>\n    <div class=\"insights\">\n        <ng-container *ngIf=\"insights?.length\">\n            <s-ia-insight-card\n                *ngFor=\"let insight of insights\"\n                [insight]=\"insight\">\n            </s-ia-insight-card>\n        </ng-container>\n    </div>\n</div>\n\n<ng-template #iassistIcon>\n    <div style=\"width: 28px; height: 28px;\">\n        <span *sSVGFactory=\"'iassist'\"></span>\n    </div>\n</ng-template>\n", styles: [".sidebar{background-color:#fff;border-left:1px solid #dedce5;height:100%;overflow-x:hidden;position:fixed;right:-25%;transition:.5s;top:0;width:25%;z-index:1002}.sidebar .header{border-bottom:1px solid #dedce5;display:flex;gap:16px;padding:12px 20px}.sidebar .header .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:16px;padding:12px}.sidebar .header .title{align-items:center;color:#212533;display:flex;font-family:Open Sans,sans-serif;font-size:16px;gap:16px;line-height:1;-webkit-user-select:none;user-select:none}.sidebar .intro{margin:8px 40px}.sidebar .intro .text{color:#212533;display:flex;font-family:Open Sans,sans-serif;font-size:14px;justify-content:center;line-height:1.5;text-align:center;-webkit-user-select:none;user-select:none}.sidebar.opened{right:0}.sidebar.opened .insights{padding:12px}.insights{display:flex;flex-direction:column;gap:12px}@media (max-width: 1366px){.sidebar{right:-50%;width:50%}}@media (max-width: 768px){.sidebar{right:-75%;width:75%}}@media (max-width: 600px){.sidebar{right:-100%;width:100%}}\n"] }]
        }], propDecorators: { insights: [{
                type: Input
            }], hasPermission: [{
                type: Input
            }], introText: [{
                type: Input
            }], introTemplate: [{
                type: Input
            }], emptyText: [{
                type: Input
            }], emptyTemplate: [{
                type: Input
            }], noPermissionText: [{
                type: Input
            }], noPermissionTemplate: [{
                type: Input
            }] } });

class IAInsightComponent {
    insights = [];
    hasPermission = true;
    introText;
    emptyText;
    noPermissionText;
    sidebar = null;
    templates = null;
    openIAInsight = output();
    closedIAInsight = output();
    introTemplate = null;
    emptyTemplate = null;
    noPermissionTemplate = null;
    ngAfterContentInit() {
        this._getTemplates();
    }
    open() {
        this.sidebar?.open();
    }
    close() {
        this.sidebar?.close();
    }
    getIntroTemplate() {
        return this._getCustomTemplate('intro');
    }
    getNoPermissionTemplate() {
        return this._getCustomTemplate('no-permission');
    }
    getEmptyTemplate() {
        return this._getCustomTemplate('empty');
    }
    _getCustomTemplate(type) {
        return this.templates?.find((template) => template.type === type)?.template ?? null;
    }
    _getTemplates() {
        this.introTemplate = this.getIntroTemplate();
        this.emptyTemplate = this.getEmptyTemplate();
        this.noPermissionTemplate = this.getNoPermissionTemplate();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: IAInsightComponent, selector: "s-ia-insight", inputs: { insights: "insights", hasPermission: "hasPermission", introText: "introText", emptyText: "emptyText", noPermissionText: "noPermissionText" }, outputs: { openIAInsight: "openIAInsight", closedIAInsight: "closedIAInsight" }, queries: [{ propertyName: "templates", predicate: TemplateDirective }], viewQueries: [{ propertyName: "sidebar", first: true, predicate: IAInsightSidebarComponent, descendants: true }], ngImport: i0, template: "<s-ia-insight-sidebar\n    #sidebar\n    [insights]=\"insights\"\n    [hasPermission]=\"hasPermission\"\n    [introText]=\"introText\"\n    [introTemplate]=\"introTemplate\"\n    [emptyText]=\"emptyText\"\n    [emptyTemplate]=\"emptyTemplate\"\n    [noPermissionText]=\"noPermissionText\"\n    [noPermissionTemplate]=\"noPermissionTemplate\"\n    (openedSidebar)=\"openIAInsight.emit()\"\n    (closedSidebar)=\"closedIAInsight.emit()\"\n>\n</s-ia-insight-sidebar>\n", dependencies: [{ kind: "component", type: IAInsightSidebarComponent, selector: "s-ia-insight-sidebar", inputs: ["insights", "hasPermission", "introText", "introTemplate", "emptyText", "emptyTemplate", "noPermissionText", "noPermissionTemplate"], outputs: ["closedSidebar", "openedSidebar"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-ia-insight', template: "<s-ia-insight-sidebar\n    #sidebar\n    [insights]=\"insights\"\n    [hasPermission]=\"hasPermission\"\n    [introText]=\"introText\"\n    [introTemplate]=\"introTemplate\"\n    [emptyText]=\"emptyText\"\n    [emptyTemplate]=\"emptyTemplate\"\n    [noPermissionText]=\"noPermissionText\"\n    [noPermissionTemplate]=\"noPermissionTemplate\"\n    (openedSidebar)=\"openIAInsight.emit()\"\n    (closedSidebar)=\"closedIAInsight.emit()\"\n>\n</s-ia-insight-sidebar>\n" }]
        }], propDecorators: { insights: [{
                type: Input
            }], hasPermission: [{
                type: Input
            }], introText: [{
                type: Input
            }], emptyText: [{
                type: Input
            }], noPermissionText: [{
                type: Input
            }], sidebar: [{
                type: ViewChild,
                args: [IAInsightSidebarComponent]
            }], templates: [{
                type: ContentChildren,
                args: [TemplateDirective]
            }] } });

class IAInsightModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: IAInsightModule, declarations: [IAInsightComponent, IAInsightCardComponent, IAInsightSidebarComponent, IAInsightCardLoaderComponent], imports: [CommonModule,
            TranslateModule,
            BadgeModule,
            ButtonModule,
            TooltipModule,
            TemplateModule,
            SVGFactoryModule], exports: [IAInsightComponent, TemplateModule] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightModule, imports: [CommonModule,
            TranslateModule,
            BadgeModule,
            ButtonModule,
            TooltipModule,
            TemplateModule,
            SVGFactoryModule, TemplateModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IAInsightModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        TranslateModule,
                        BadgeModule,
                        ButtonModule,
                        TooltipModule,
                        TemplateModule,
                        SVGFactoryModule,
                    ],
                    declarations: [IAInsightComponent, IAInsightCardComponent, IAInsightSidebarComponent, IAInsightCardLoaderComponent],
                    exports: [IAInsightComponent, TemplateModule],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { IAInsightComponent, IAInsightModule };
//# sourceMappingURL=seniorsistemas-angular-components-ia-insight.mjs.map
