import * as i0 from '@angular/core';
import { Component, inject, DestroyRef, Input, output, ViewChild, ContentChildren, NgModule } from '@angular/core';
import { TemplateDirective, TemplateModule } from '@seniorsistemas/angular-components/template';
import * as i1 from '@seniorsistemas/angular-components/common/deprecated-selector';
import { DEPRECATED_CONFIG, DeprecatedSelectorDirective } from '@seniorsistemas/angular-components/common/deprecated-selector';
import { NgClass, NgTemplateOutlet } from '@angular/common';
import { Clipboard } from '@angular/cdk/clipboard';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { ToastService } from '@seniorsistemas/angular-components/toast';
import { first, finalize } from 'rxjs/operators';
import { marked } from 'marked';
import { BadgeComponent } from '@seniorsistemas/angular-components/badge';
import { SVGFactoryDirective } from '@seniorsistemas/angular-components/common';

class InsightsCardLoaderComponent {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsCardLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InsightsCardLoaderComponent, isStandalone: true, selector: "s-insights-card-loader", ngImport: i0, template: "<div class=\"insights-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: [".insights-card-loader{align-items:center;display:flex;flex-direction:column;gap:24px}.insights-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}.insights-card-loader .loader .loader-icon{animation:spin 2s linear infinite reverse;height:32px;transform:translate(-50%,-50%)}.insights-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: SVGFactoryDirective, selector: "[sSVGFactory]", inputs: ["sSVGFactory"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsCardLoaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-insights-card-loader', standalone: true, imports: [SVGFactoryDirective, TranslatePipe], template: "<div class=\"insights-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: [".insights-card-loader{align-items:center;display:flex;flex-direction:column;gap:24px}.insights-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}.insights-card-loader .loader .loader-icon{animation:spin 2s linear infinite reverse;height:32px;transform:translate(-50%,-50%)}.insights-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 InsightsCardComponent {
    clipboard = inject(Clipboard);
    toastService = inject(ToastService);
    translateService = inject(TranslateService);
    _destroyRef = inject(DestroyRef);
    insight;
    open = false;
    isLoading = false;
    content;
    likeSelected = false;
    dislikeSelected = false;
    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)), takeUntilDestroyed(this._destroyRef))
            .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: InsightsCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: InsightsCardComponent, isStandalone: true, selector: "s-insights-card", inputs: { insight: "insight" }, ngImport: i0, template: "<div\r\n    class=\"insights-card\"\r\n    [ngClass]=\"{ 'insights-card--close': !open }\"\r\n>\r\n    <div\r\n        class=\"header\"\r\n        (click)=\"toggle()\"\r\n    >\r\n        <s-badge\r\n            text=\"Insight\"\r\n            iconClass=\"fal fa-lightbulb\"\r\n        ></s-badge>\r\n        <span class=\"insight-title\">{{ insight.title }}</span>\r\n        <span class=\"toggle-icon\">\r\n            <i\r\n                class=\"fas\"\r\n                [ngClass]=\"{\r\n                    'fa-angle-down': !open,\r\n                    'fa-angle-up': open,\r\n                }\"\r\n            >\r\n            </i>\r\n        </span>\r\n    </div>\r\n    <div class=\"content\">\r\n        @if (isLoading) {\r\n            <s-insights-card-loader></s-insights-card-loader>\r\n        } @else {\r\n            @if (content) {\r\n                <span\r\n                    class=\"text\"\r\n                    [innerHTML]=\"content\"\r\n                ></span>\r\n                <span class=\"insight-footer\">{{ 'platform.angular_components.insight_footer' | translate }}</span>\r\n            } @else {\r\n                <span class=\"text text--error\">{{\r\n                    'platform.angular_components.error_loading_insight_alt' | translate\r\n                }}</span>\r\n            }\r\n            <div class=\"options\">\r\n                <button\r\n                    [disabled]=\"!content\"\r\n                    (click)=\"copyContent()\"\r\n                    class=\"option\"\r\n                >\r\n                    <i class=\"fal fa-copy\"></i>\r\n                </button>\r\n                <button\r\n                    (click)=\"reloadContent()\"\r\n                    class=\"option\"\r\n                >\r\n                    <i class=\"fal fa-redo\"></i>\r\n                </button>\r\n                @if (insight.onLikeSelected) {\r\n                    <button\r\n                        [disabled]=\"!content\"\r\n                        (click)=\"onLikeSelected()\"\r\n                        class=\"option\"\r\n                    >\r\n                        <i\r\n                            [ngClass]=\"{\r\n                                fal: !likeSelected,\r\n                                fas: likeSelected,\r\n                                'fa-thumbs-up': true,\r\n                            }\"\r\n                        >\r\n                        </i>\r\n                    </button>\r\n                }\r\n                @if (insight.onDislikeSelected) {\r\n                    <button\r\n                        [disabled]=\"!content\"\r\n                        (click)=\"onDislikeSelected()\"\r\n                        class=\"option\"\r\n                    >\r\n                        <i\r\n                            [ngClass]=\"{\r\n                                fal: !dislikeSelected,\r\n                                fas: dislikeSelected,\r\n                                'fa-thumbs-down': true,\r\n                            }\"\r\n                        ></i>\r\n                    </button>\r\n                }\r\n            </div>\r\n        }\r\n    </div>\r\n</div>\r\n", styles: [".insights-card{background-color:#fff;border:1px solid #9ecad4;border-radius:4px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden}.insights-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}.insights-card .header .insight-title{color:#428bca;flex-grow:1;font-family:Open Sans,sans-serif;font-size:14px;line-height:150%}.insights-card .header .toggle-icon{color:#888b99;font-size:20px}.insights-card .content{align-items:center;justify-content:space-between;cursor:auto;display:flex;flex-direction:column;gap:16px;min-height:160px;padding:24px}.insights-card .content .text{color:#212533;font-family:Open Sans,sans-serif;font-size:14px;width:100%}.insights-card .content .text--error{text-align:center}.insights-card .content .insight-footer{color:#888b99;font-family:Open Sans,sans-serif;font-size:12px;text-align:center}.insights-card .content .options{display:flex;gap:8px}.insights-card .content .options .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:12px}.insights-card .content .options .option:disabled{color:#c1c1cc;cursor:auto}.insights-card--close{border-color:#dedce5}.insights-card--close .header{background-color:#fbfafc;border:none;border-color:#dedce5}.insights-card--close .header .insight-title{color:#888b99}.insights-card--close .content{display:none}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: BadgeComponent, selector: "s-badge", inputs: ["type", "color", "title", "text", "selectable", "iconClass", "iconPosition", "infoSign", "enableTruncateText"], outputs: ["selected"] }, { kind: "component", type: InsightsCardLoaderComponent, selector: "s-insights-card-loader" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsCardComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-insights-card', standalone: true, imports: [NgClass, BadgeComponent, InsightsCardLoaderComponent, TranslatePipe], template: "<div\r\n    class=\"insights-card\"\r\n    [ngClass]=\"{ 'insights-card--close': !open }\"\r\n>\r\n    <div\r\n        class=\"header\"\r\n        (click)=\"toggle()\"\r\n    >\r\n        <s-badge\r\n            text=\"Insight\"\r\n            iconClass=\"fal fa-lightbulb\"\r\n        ></s-badge>\r\n        <span class=\"insight-title\">{{ insight.title }}</span>\r\n        <span class=\"toggle-icon\">\r\n            <i\r\n                class=\"fas\"\r\n                [ngClass]=\"{\r\n                    'fa-angle-down': !open,\r\n                    'fa-angle-up': open,\r\n                }\"\r\n            >\r\n            </i>\r\n        </span>\r\n    </div>\r\n    <div class=\"content\">\r\n        @if (isLoading) {\r\n            <s-insights-card-loader></s-insights-card-loader>\r\n        } @else {\r\n            @if (content) {\r\n                <span\r\n                    class=\"text\"\r\n                    [innerHTML]=\"content\"\r\n                ></span>\r\n                <span class=\"insight-footer\">{{ 'platform.angular_components.insight_footer' | translate }}</span>\r\n            } @else {\r\n                <span class=\"text text--error\">{{\r\n                    'platform.angular_components.error_loading_insight_alt' | translate\r\n                }}</span>\r\n            }\r\n            <div class=\"options\">\r\n                <button\r\n                    [disabled]=\"!content\"\r\n                    (click)=\"copyContent()\"\r\n                    class=\"option\"\r\n                >\r\n                    <i class=\"fal fa-copy\"></i>\r\n                </button>\r\n                <button\r\n                    (click)=\"reloadContent()\"\r\n                    class=\"option\"\r\n                >\r\n                    <i class=\"fal fa-redo\"></i>\r\n                </button>\r\n                @if (insight.onLikeSelected) {\r\n                    <button\r\n                        [disabled]=\"!content\"\r\n                        (click)=\"onLikeSelected()\"\r\n                        class=\"option\"\r\n                    >\r\n                        <i\r\n                            [ngClass]=\"{\r\n                                fal: !likeSelected,\r\n                                fas: likeSelected,\r\n                                'fa-thumbs-up': true,\r\n                            }\"\r\n                        >\r\n                        </i>\r\n                    </button>\r\n                }\r\n                @if (insight.onDislikeSelected) {\r\n                    <button\r\n                        [disabled]=\"!content\"\r\n                        (click)=\"onDislikeSelected()\"\r\n                        class=\"option\"\r\n                    >\r\n                        <i\r\n                            [ngClass]=\"{\r\n                                fal: !dislikeSelected,\r\n                                fas: dislikeSelected,\r\n                                'fa-thumbs-down': true,\r\n                            }\"\r\n                        ></i>\r\n                    </button>\r\n                }\r\n            </div>\r\n        }\r\n    </div>\r\n</div>\r\n", styles: [".insights-card{background-color:#fff;border:1px solid #9ecad4;border-radius:4px;cursor:pointer;display:flex;flex-direction:column;overflow:hidden}.insights-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}.insights-card .header .insight-title{color:#428bca;flex-grow:1;font-family:Open Sans,sans-serif;font-size:14px;line-height:150%}.insights-card .header .toggle-icon{color:#888b99;font-size:20px}.insights-card .content{align-items:center;justify-content:space-between;cursor:auto;display:flex;flex-direction:column;gap:16px;min-height:160px;padding:24px}.insights-card .content .text{color:#212533;font-family:Open Sans,sans-serif;font-size:14px;width:100%}.insights-card .content .text--error{text-align:center}.insights-card .content .insight-footer{color:#888b99;font-family:Open Sans,sans-serif;font-size:12px;text-align:center}.insights-card .content .options{display:flex;gap:8px}.insights-card .content .options .option{background-color:transparent;border:none;color:#428bca;cursor:pointer;font-size:12px}.insights-card .content .options .option:disabled{color:#c1c1cc;cursor:auto}.insights-card--close{border-color:#dedce5}.insights-card--close .header{background-color:#fbfafc;border:none;border-color:#dedce5}.insights-card--close .header .insight-title{color:#888b99}.insights-card--close .content{display:none}\n"] }]
        }], propDecorators: { insight: [{
                type: Input,
                args: [{ required: true }]
            }] } });

class InsightsSidebarComponent {
    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: InsightsSidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: InsightsSidebarComponent, isStandalone: true, selector: "s-insights-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\r\n    class=\"sidebar\"\r\n    [class.opened]=\"opened\"\r\n>\r\n    <div class=\"header\">\r\n        <button\r\n            (click)=\"close()\"\r\n            class=\"option\"\r\n        >\r\n            <span class=\"far fa-chevron-double-right\"></span>\r\n        </button>\r\n        <div class=\"title\">\r\n            <span><ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container></span>\r\n            <span>IAssist Insights</span>\r\n        </div>\r\n    </div>\r\n    <div class=\"intro\">\r\n        @if (hasPermission) {\r\n            @if (insights.length) {\r\n                @if (introTemplate) {\r\n                    <ng-container *ngTemplateOutlet=\"introTemplate\"></ng-container>\r\n                } @else {\r\n                    <span class=\"text\">{{ introText || 'platform.angular_components.insight_intro' | translate }}</span>\r\n                }\r\n            } @else {\r\n                @if (emptyTemplate) {\r\n                    <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\r\n                } @else {\r\n                    <span class=\"text\">{{ emptyText || 'platform.angular_components.insight_empty' | translate }}</span>\r\n                }\r\n            }\r\n        } @else {\r\n            @if (noPermissionTemplate) {\r\n                <ng-container *ngTemplateOutlet=\"noPermissionTemplate\"></ng-container>\r\n            } @else {\r\n                <span>{{ noPermissionText || 'platform.angular_components.insight_no_permission' | translate }}</span>\r\n            }\r\n        }\r\n    </div>\r\n    <div class=\"insights\">\r\n        @if (insights.length) {\r\n            @for (insight of insights; track insight) {\r\n                <s-insights-card [insight]=\"insight\"> </s-insights-card>\r\n            }\r\n        }\r\n    </div>\r\n</div>\r\n\r\n<ng-template #iassistIcon>\r\n    <div style=\"width: 28px; height: 28px\">\r\n        <span *sSVGFactory=\"'iassist'\"></span>\r\n    </div>\r\n</ng-template>\r\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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InsightsCardComponent, selector: "s-insights-card", inputs: ["insight"] }, { kind: "directive", type: SVGFactoryDirective, selector: "[sSVGFactory]", inputs: ["sSVGFactory"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsSidebarComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-insights-sidebar', standalone: true, imports: [NgTemplateOutlet, InsightsCardComponent, SVGFactoryDirective, TranslatePipe], template: "<div\r\n    class=\"sidebar\"\r\n    [class.opened]=\"opened\"\r\n>\r\n    <div class=\"header\">\r\n        <button\r\n            (click)=\"close()\"\r\n            class=\"option\"\r\n        >\r\n            <span class=\"far fa-chevron-double-right\"></span>\r\n        </button>\r\n        <div class=\"title\">\r\n            <span><ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container></span>\r\n            <span>IAssist Insights</span>\r\n        </div>\r\n    </div>\r\n    <div class=\"intro\">\r\n        @if (hasPermission) {\r\n            @if (insights.length) {\r\n                @if (introTemplate) {\r\n                    <ng-container *ngTemplateOutlet=\"introTemplate\"></ng-container>\r\n                } @else {\r\n                    <span class=\"text\">{{ introText || 'platform.angular_components.insight_intro' | translate }}</span>\r\n                }\r\n            } @else {\r\n                @if (emptyTemplate) {\r\n                    <ng-container *ngTemplateOutlet=\"emptyTemplate\"></ng-container>\r\n                } @else {\r\n                    <span class=\"text\">{{ emptyText || 'platform.angular_components.insight_empty' | translate }}</span>\r\n                }\r\n            }\r\n        } @else {\r\n            @if (noPermissionTemplate) {\r\n                <ng-container *ngTemplateOutlet=\"noPermissionTemplate\"></ng-container>\r\n            } @else {\r\n                <span>{{ noPermissionText || 'platform.angular_components.insight_no_permission' | translate }}</span>\r\n            }\r\n        }\r\n    </div>\r\n    <div class=\"insights\">\r\n        @if (insights.length) {\r\n            @for (insight of insights; track insight) {\r\n                <s-insights-card [insight]=\"insight\"> </s-insights-card>\r\n            }\r\n        }\r\n    </div>\r\n</div>\r\n\r\n<ng-template #iassistIcon>\r\n    <div style=\"width: 28px; height: 28px\">\r\n        <span *sSVGFactory=\"'iassist'\"></span>\r\n    </div>\r\n</ng-template>\r\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
            }] } });

/**
 * @description Componente de painel lateral de insights com IA. Exibe uma lista de itens
 * de insights em um sidebar, suportando templates customizáveis para o conteúdo de
 * introdução, estado vazio e sem permissão. Também exporta como seletor legado `s-ia-insight`.
 *
 * @example
 * ```html
 * <s-insights
 *   [insights]="listaInsights"
 *   [hasPermission]="true"
 *   (openInsights)="onAbrir()" />
 * ```
 *
 * @category Structure
 */
class InsightsComponent {
    /** @description Lista de itens de insight a serem exibidos no painel. @default [] */
    insights = [];
    /** @description Indica se o usuário tem permissão para ver os insights. @default true */
    hasPermission = true;
    /** @description Texto de introdução exibido no topo do painel (quando sem template customizado). */
    introText;
    /** @description Texto exibido quando não há insights disponíveis. */
    emptyText;
    /** @description Texto exibido quando o usuário não tem permissão. */
    noPermissionText;
    sidebar = null;
    templates = null;
    /** @description Emitido quando o painel de insights é aberto. */
    openInsights = output();
    /** @description Emitido quando o painel de insights é fechado. */
    closedInsights = 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: InsightsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: InsightsComponent, isStandalone: true, selector: "s-insights, s-ia-insight", inputs: { insights: "insights", hasPermission: "hasPermission", introText: "introText", emptyText: "emptyText", noPermissionText: "noPermissionText" }, outputs: { openInsights: "openInsights", closedInsights: "closedInsights" }, providers: [
            {
                provide: DEPRECATED_CONFIG,
                useValue: {
                    oldSelector: 's-ia-insight',
                    newSelector: 's-insights',
                    removalVersion: '20.0.0',
                },
            },
        ], queries: [{ propertyName: "templates", predicate: TemplateDirective }], viewQueries: [{ propertyName: "sidebar", first: true, predicate: InsightsSidebarComponent, descendants: true }], hostDirectives: [{ directive: i1.DeprecatedSelectorDirective }], ngImport: i0, template: "<s-insights-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)=\"openInsights.emit()\"\n    (closedSidebar)=\"closedInsights.emit()\"\n>\n</s-insights-sidebar>\n", dependencies: [{ kind: "component", type: InsightsSidebarComponent, selector: "s-insights-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: InsightsComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-insights, s-ia-insight', hostDirectives: [DeprecatedSelectorDirective], providers: [
                        {
                            provide: DEPRECATED_CONFIG,
                            useValue: {
                                oldSelector: 's-ia-insight',
                                newSelector: 's-insights',
                                removalVersion: '20.0.0',
                            },
                        },
                    ], standalone: true, imports: [InsightsSidebarComponent], template: "<s-insights-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)=\"openInsights.emit()\"\n    (closedSidebar)=\"closedInsights.emit()\"\n>\n</s-insights-sidebar>\n" }]
        }], propDecorators: { insights: [{
                type: Input
            }], hasPermission: [{
                type: Input
            }], introText: [{
                type: Input
            }], emptyText: [{
                type: Input
            }], noPermissionText: [{
                type: Input
            }], sidebar: [{
                type: ViewChild,
                args: [InsightsSidebarComponent]
            }], templates: [{
                type: ContentChildren,
                args: [TemplateDirective]
            }] } });

class InsightsModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: InsightsModule, imports: [TemplateModule, InsightsComponent], exports: [InsightsComponent, TemplateModule] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsModule, imports: [TemplateModule, InsightsComponent, TemplateModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: InsightsModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [TemplateModule, InsightsComponent],
                    exports: [InsightsComponent, TemplateModule],
                }]
        }] });

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

export { InsightsComponent, InsightsModule };
//# sourceMappingURL=seniorsistemas-angular-components-insights.mjs.map
