var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { RegisterClass } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { RunView } from '@memberjunction/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@memberjunction/ng-ui-components";
import * as i3 from "@memberjunction/ng-shared-generic";
function CredentialsAuditResourceComponent_Conditional_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 13);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_35_For_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 38)(1, "div", 43);
    i0.ɵɵelement(2, "div", 44)(3, "div", 45);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 46);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const data_r1 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("title", data_r1.hour + ": " + (data_r1.success + data_r1.failed) + " events");
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("height", data_r1.success / ctx_r1.getMaxHourlyCount() * 100, "%");
    i0.ɵɵadvance();
    i0.ɵɵstyleProp("height", data_r1.failed / ctx_r1.getMaxHourlyCount() * 100, "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(data_r1.hour.split(":")[0]);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_35_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 30)(1, "div", 34)(2, "h3");
    i0.ɵɵelement(3, "i", 35);
    i0.ɵɵtext(4, " Today's Activity ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(5, "div", 36)(6, "div", 37);
    i0.ɵɵrepeaterCreate(7, CredentialsAuditResourceComponent_Conditional_17_Conditional_35_For_8_Template, 6, 6, "div", 38, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "div", 39)(10, "span", 40);
    i0.ɵɵelement(11, "span", 41);
    i0.ɵɵtext(12, " Success ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "span", 40);
    i0.ɵɵelement(14, "span", 42);
    i0.ɵɵtext(15, " Failed ");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(7);
    i0.ɵɵrepeater(ctx_r1.hourlyData);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 67);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r4.Description, " ");
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 70);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.getSubsystem(log_r4), " ");
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 71);
    i0.ɵɵelement(1, "i", 72);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", log_r4.parsedDetails == null ? null : log_r4.parsedDetails.credentialType, " ");
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 59)(1, "div", 60)(2, "div", 61);
    i0.ɵɵelement(3, "i");
    i0.ɵɵelementStart(4, "span", 62);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "div", 63);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(8, "div", 64)(9, "div", 65);
    i0.ɵɵelement(10, "i", 66);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(12, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_12_Template, 2, 1, "div", 67);
    i0.ɵɵelementStart(13, "div", 68)(14, "span", 69);
    i0.ɵɵelement(15, "i");
    i0.ɵɵtext(16);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(17, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_17_Template, 2, 1, "span", 70);
    i0.ɵɵconditionalCreate(18, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Conditional_18_Template, 3, 1, "span", 71);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext().$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(ctx_r1.getOperationIcon(ctx_r1.getOperationType(log_r4)));
    i0.ɵɵstyleProp("color", ctx_r1.getOperationColor(ctx_r1.getOperationType(log_r4)));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.getOperationType(log_r4));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatTime(log_r4.__mj_CreatedAt));
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" ", log_r4.User || "Unknown", " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(log_r4.Description ? 12 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", ctx_r1.getStatusClass(log_r4.Status));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(log_r4.Status === "Success" ? "fa-solid fa-check" : "fa-solid fa-times");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r4.Status, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.getSubsystem(log_r4) ? 17 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.credentialType) ? 18 : -1);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 75)(1, "span", 77);
    i0.ɵɵtext(2, "IP Address");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 78);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(log_r4.parsedDetails == null ? null : log_r4.parsedDetails.ipAddress);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 75)(1, "span", 77);
    i0.ɵɵtext(2, "Duration");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 78);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(ctx_r1.formatDuration(log_r4.parsedDetails == null ? null : log_r4.parsedDetails.duration));
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 75)(1, "span", 77);
    i0.ɵɵtext(2, "Credential ID");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 79);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(log_r4.parsedDetails == null ? null : log_r4.parsedDetails.credentialId);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 76)(1, "span", 77);
    i0.ɵɵtext(2, "Error Message");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 80);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(log_r4.parsedDetails == null ? null : log_r4.parsedDetails.errorMessage);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 76)(1, "span", 77);
    i0.ɵɵtext(2, "User Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 81);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(log_r4.parsedDetails == null ? null : log_r4.parsedDetails.userAgent);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 73)(1, "div", 74);
    i0.ɵɵconditionalCreate(2, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_2_Template, 5, 1, "div", 75);
    i0.ɵɵconditionalCreate(3, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_3_Template, 5, 1, "div", 75);
    i0.ɵɵconditionalCreate(4, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_4_Template, 5, 1, "div", 75);
    i0.ɵɵconditionalCreate(5, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_5_Template, 5, 1, "div", 76);
    i0.ɵɵconditionalCreate(6, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Conditional_6_Template, 5, 1, "div", 76);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.ipAddress) ? 2 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.duration) ? 3 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.credentialId) ? 4 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.errorMessage) ? 5 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional((log_r4.parsedDetails == null ? null : log_r4.parsedDetails.userAgent) ? 6 : -1);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 53)(1, "div", 54);
    i0.ɵɵelement(2, "div", 55);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "mj-accordion-panel", 56);
    i0.ɵɵlistener("ExpandedChange", function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_Template_mj_accordion_panel_ExpandedChange_3_listener($event) { const log_r4 = i0.ɵɵrestoreView(_r3).$implicit; const ctx_r1 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r1.onLogExpandedChange(log_r4.ID, $event)); });
    i0.ɵɵtemplate(4, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_4_Template, 19, 14, "ng-template", 57)(5, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_ng_template_5_Template, 7, 5, "ng-template", 58);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r4 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵclassProp("failed", log_r4.Status === "Failed");
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("background-color", ctx_r1.getOperationColor(ctx_r1.getOperationType(log_r4)));
    i0.ɵɵadvance();
    i0.ɵɵproperty("FlushBody", true)("Expanded", ctx_r1.expandedLogId === log_r4.ID);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 47)(1, "div", 48)(2, "span", 49);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 50);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "div", 51);
    i0.ɵɵrepeaterCreate(7, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_For_8_Template, 6, 6, "div", 52, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const group_r5 = ctx.$implicit;
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(group_r5.displayDate);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("", group_r5.logs.length, " events");
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(group_r5.logs);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_36_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 31);
    i0.ɵɵrepeaterCreate(1, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_For_2_Template, 9, 2, "div", 47, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r1.timelineGroups);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_37_For_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 84);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td", 85);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td", 86)(6, "span", 87);
    i0.ɵɵelement(7, "i");
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "td", 88);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "td", 89);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "td", 90)(14, "span", 69);
    i0.ɵɵelement(15, "i");
    i0.ɵɵtext(16);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const log_r6 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵclassProp("failed-row", log_r6.Status === "Failed");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatDate(log_r6.__mj_CreatedAt));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r6.User || "Unknown");
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("background-color", ctx_r1.getOperationColor(ctx_r1.getOperationType(log_r6)) + "20")("color", ctx_r1.getOperationColor(ctx_r1.getOperationType(log_r6)));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r1.getOperationIcon(ctx_r1.getOperationType(log_r6)));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.getOperationType(log_r6), " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r6.Description || "-");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.getSubsystem(log_r6) || "-");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", ctx_r1.getStatusClass(log_r6.Status));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(log_r6.Status === "Success" ? "fa-solid fa-check" : "fa-solid fa-times");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r6.Status, " ");
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_37_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 32)(1, "table", 82)(2, "thead")(3, "tr")(4, "th");
    i0.ɵɵtext(5, "Timestamp");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "th");
    i0.ɵɵtext(7, "User");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "th");
    i0.ɵɵtext(9, "Operation");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "th");
    i0.ɵɵtext(11, "Description");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "th");
    i0.ɵɵtext(13, "Subsystem");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "th");
    i0.ɵɵtext(15, "Status");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(16, "tbody");
    i0.ɵɵrepeaterCreate(17, CredentialsAuditResourceComponent_Conditional_17_Conditional_37_For_18_Template, 17, 17, "tr", 83, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(17);
    i0.ɵɵrepeater(ctx_r1.filteredLogs);
} }
function CredentialsAuditResourceComponent_Conditional_17_Conditional_38_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mj-empty-state", 91);
    i0.ɵɵlistener("Action", function CredentialsAuditResourceComponent_Conditional_17_Conditional_38_Template_mj_empty_state_Action_0_listener() { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.resetAuditFilters()); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("Variant", ctx_r1.IsListNarrowed ? "no-results" : "empty")("Message", ctx_r1.IsListNarrowed ? "No events match your current filters." : "No credential access events in the selected time range.")("ActionText", ctx_r1.IsListNarrowed ? "Reset filters" : "");
} }
function CredentialsAuditResourceComponent_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 14)(1, "div", 15)(2, "div", 16);
    i0.ɵɵelement(3, "i", 17);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 18)(5, "div", 19);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 20);
    i0.ɵɵtext(8, "Total Events");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(9, "div", 15)(10, "div", 21);
    i0.ɵɵelement(11, "i", 22);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "div", 18)(13, "div", 23);
    i0.ɵɵtext(14);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "div", 20);
    i0.ɵɵtext(16, "Successful");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(17, "div", 24);
    i0.ɵɵtext(18);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(19, "div", 15)(20, "div", 25);
    i0.ɵɵelement(21, "i", 26);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(22, "div", 18)(23, "div", 27);
    i0.ɵɵtext(24);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(25, "div", 20);
    i0.ɵɵtext(26, "Failed");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(27, "div", 15)(28, "div", 28);
    i0.ɵɵelement(29, "i", 29);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(30, "div", 18)(31, "div", 19);
    i0.ɵɵtext(32);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(33, "div", 20);
    i0.ɵɵtext(34, "Unique Users");
    i0.ɵɵelementEnd()()()();
    i0.ɵɵconditionalCreate(35, CredentialsAuditResourceComponent_Conditional_17_Conditional_35_Template, 16, 0, "div", 30);
    i0.ɵɵconditionalCreate(36, CredentialsAuditResourceComponent_Conditional_17_Conditional_36_Template, 3, 0, "div", 31);
    i0.ɵɵconditionalCreate(37, CredentialsAuditResourceComponent_Conditional_17_Conditional_37_Template, 19, 0, "div", 32);
    i0.ɵɵconditionalCreate(38, CredentialsAuditResourceComponent_Conditional_17_Conditional_38_Template, 1, 3, "mj-empty-state", 33);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(6);
    i0.ɵɵtextInterpolate(ctx_r1.auditLogs.length);
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate(ctx_r1.getSuccessCount());
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1("", ctx_r1.getSuccessRate(), "%");
    i0.ɵɵadvance(6);
    i0.ɵɵtextInterpolate(ctx_r1.getFailedCount());
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate(ctx_r1.getUniqueUserCount());
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.hourlyData.length > 0 ? 35 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.viewMode === "timeline" && ctx_r1.timelineGroups.length > 0 ? 36 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.viewMode === "table" && ctx_r1.filteredLogs.length > 0 ? 37 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.filteredLogs.length === 0 ? 38 : -1);
} }
// The Credential Access AuditLogType ID from metadata
const CREDENTIAL_ACCESS_AUDIT_LOG_TYPE_ID = 'E8D4D100-E785-42D3-997F-ECFF3B0BCFC0';
let CredentialsAuditResourceComponent = class CredentialsAuditResourceComponent extends BaseResourceComponent {
    cdr;
    isLoading = true;
    auditLogs = [];
    filteredLogs = [];
    timelineGroups = [];
    selectedStatus = '';
    selectedOperation = '';
    dateRange = '7'; // days
    searchText = '';
    viewMode = 'timeline';
    expandedLogId = null;
    // Chart data
    hourlyData = [];
    operationCounts = new Map();
    viewOptions = [
        { key: 'timeline', icon: 'fa-solid fa-timeline', title: 'Timeline view' },
        { key: 'table', icon: 'fa-solid fa-table', title: 'Table view' }
    ];
    get FilterFields() {
        return [
            {
                key: 'status',
                type: 'dropdown',
                label: 'Status',
                icon: 'fa-solid fa-circle-info',
                placeholder: 'All Statuses',
                options: [
                    { text: 'All Statuses', value: '' },
                    { text: 'Success', value: 'Success' },
                    { text: 'Failed', value: 'Failed' }
                ]
            },
            {
                key: 'operation',
                type: 'dropdown',
                label: 'Operation',
                icon: 'fa-solid fa-bolt',
                placeholder: 'All Operations',
                filterable: true,
                options: [
                    { text: 'All Operations', value: '' },
                    ...this.getOperationList().map(op => ({ text: op, value: op }))
                ]
            },
            {
                key: 'dateRange',
                type: 'dropdown',
                label: 'Time range',
                icon: 'fa-solid fa-clock',
                options: [
                    { text: 'Last 24 hours', value: '1' },
                    { text: 'Last 7 days', value: '7' },
                    { text: 'Last 30 days', value: '30' },
                    { text: 'Last 90 days', value: '90' }
                ]
            }
        ];
    }
    get FilterValues() {
        return {
            status: this.selectedStatus,
            operation: this.selectedOperation,
            dateRange: this.dateRange
        };
    }
    get ActiveFilterCount() {
        let n = 0;
        if (this.selectedStatus)
            n++;
        if (this.selectedOperation)
            n++;
        if (this.dateRange && this.dateRange !== '7')
            n++; // 7-day is the default; don't count it
        return n;
    }
    onFilterValuesChange(v) {
        const next = (v ?? {});
        if ((next.status ?? '') !== this.selectedStatus) {
            this.onStatusFilterChange(next.status ?? '');
        }
        if ((next.operation ?? '') !== this.selectedOperation) {
            this.onOperationFilterChange(next.operation ?? '');
        }
        if ((next.dateRange ?? '7') !== this.dateRange) {
            this.onDateRangeChange(next.dateRange ?? '7');
        }
    }
    resetFilters() {
        if (this.selectedStatus)
            this.onStatusFilterChange('');
        if (this.selectedOperation)
            this.onOperationFilterChange('');
        if (this.dateRange !== '7')
            this.onDateRangeChange('7');
    }
    constructor(cdr) {
        super();
        this.cdr = cdr;
    }
    ngOnInit() {
        super.ngOnInit();
        this.loadData();
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        // Cleanup if needed
    }
    async GetResourceDisplayName(data) {
        return 'Audit Trail';
    }
    async GetResourceIconClass(data) {
        return 'fa-solid fa-clipboard-list';
    }
    async loadData() {
        try {
            this.isLoading = true;
            this.cdr.markForCheck();
            const rv = RunView.FromMetadataProvider(this.ProviderToUse);
            // Calculate date filter
            const startDate = new Date();
            startDate.setDate(startDate.getDate() - parseInt(this.dateRange, 10));
            const dateFilter = `AuditLogTypeID = '${CREDENTIAL_ACCESS_AUDIT_LOG_TYPE_ID}' AND __mj_CreatedAt >= '${startDate.toISOString()}'`;
            const result = await rv.RunView({
                EntityName: 'MJ: Audit Logs',
                ExtraFilter: dateFilter,
                OrderBy: '__mj_CreatedAt DESC',
                MaxRows: 500,
                ResultType: 'entity_object'
            });
            if (result.Success) {
                this.auditLogs = result.Results;
                this.parseAllDetails();
                this.applyFilters();
                this.buildChartData();
            }
        }
        catch (error) {
            console.error('Error loading audit logs:', error);
        }
        finally {
            this.isLoading = false;
            this.NotifyLoadComplete();
            this.cdr.markForCheck();
        }
    }
    parseAllDetails() {
        for (const log of this.auditLogs) {
            log.parsedDetails = this.parseDetails(log);
        }
    }
    parseDetails(log) {
        try {
            if (log.Details) {
                return JSON.parse(log.Details);
            }
        }
        catch (e) {
            // Ignore parse errors
        }
        return {};
    }
    onStatusFilterChange(status) {
        this.selectedStatus = status;
        this.applyFilters();
    }
    onOperationFilterChange(operation) {
        this.selectedOperation = operation;
        this.applyFilters();
    }
    onDateRangeChange(days) {
        this.dateRange = days;
        this.loadData();
    }
    onSearchChange(value) {
        this.searchText = value;
        this.applyFilters();
    }
    clearSearch() {
        this.searchText = '';
        this.applyFilters();
    }
    /** True when search and/or any filter narrow the log list. */
    get IsListNarrowed() {
        return !!(this.searchText || this.selectedStatus || this.selectedOperation);
    }
    /** Empty-state CTA: reset search + status + operation filters. */
    resetAuditFilters() {
        this.searchText = '';
        this.selectedStatus = '';
        this.selectedOperation = '';
        this.applyFilters();
    }
    setViewMode(mode) {
        this.viewMode = mode;
        this.cdr.markForCheck();
    }
    /**
     * Accordion ExpandedChange handler for an audit timeline row. Single-expand
     * (radio-like) model: expanding a row sets it as the sole open row (the
     * template's `expandedLogId === log.ID` binding collapses the prior one);
     * collapsing the open row clears it. OnPush — drives change detection.
     */
    onLogExpandedChange(logId, expanded) {
        this.expandedLogId = expanded ? logId : null;
        this.cdr.markForCheck();
    }
    applyFilters() {
        let filtered = [...this.auditLogs];
        if (this.selectedStatus) {
            filtered = filtered.filter(log => log.Status === this.selectedStatus);
        }
        if (this.selectedOperation) {
            filtered = filtered.filter(log => {
                const op = log.parsedDetails?.operation || 'Access';
                return op === this.selectedOperation;
            });
        }
        if (this.searchText) {
            const searchLower = this.searchText.toLowerCase();
            filtered = filtered.filter(log => {
                const user = (log.User || '').toLowerCase();
                const desc = (log.Description || '').toLowerCase();
                const subsystem = (log.parsedDetails?.subsystem || '').toLowerCase();
                const credType = (log.parsedDetails?.credentialType || '').toLowerCase();
                return user.includes(searchLower) ||
                    desc.includes(searchLower) ||
                    subsystem.includes(searchLower) ||
                    credType.includes(searchLower);
            });
        }
        this.filteredLogs = filtered;
        this.buildTimelineGroups();
        this.cdr.markForCheck();
    }
    buildTimelineGroups() {
        const groups = new Map();
        for (const log of this.filteredLogs) {
            const date = new Date(log.__mj_CreatedAt);
            const dateKey = date.toISOString().split('T')[0];
            if (!groups.has(dateKey)) {
                groups.set(dateKey, []);
            }
            groups.get(dateKey).push(log);
        }
        this.timelineGroups = Array.from(groups.entries())
            .sort((a, b) => b[0].localeCompare(a[0]))
            .map(([date, logs]) => ({
            date,
            displayDate: this.formatGroupDate(date),
            logs
        }));
    }
    formatGroupDate(dateString) {
        const date = new Date(dateString);
        const today = new Date();
        const yesterday = new Date(today);
        yesterday.setDate(yesterday.getDate() - 1);
        if (date.toDateString() === today.toDateString()) {
            return 'Today';
        }
        else if (date.toDateString() === yesterday.toDateString()) {
            return 'Yesterday';
        }
        else {
            return date.toLocaleDateString('en-US', {
                weekday: 'long',
                month: 'long',
                day: 'numeric',
                year: date.getFullYear() !== today.getFullYear() ? 'numeric' : undefined
            });
        }
    }
    buildChartData() {
        // Build hourly distribution for today
        const hourCounts = {};
        const today = new Date().toDateString();
        for (let i = 0; i < 24; i++) {
            const hour = i.toString().padStart(2, '0') + ':00';
            hourCounts[hour] = { success: 0, failed: 0 };
        }
        for (const log of this.auditLogs) {
            const date = new Date(log.__mj_CreatedAt);
            if (date.toDateString() === today) {
                const hour = date.getHours().toString().padStart(2, '0') + ':00';
                if (log.Status === 'Success') {
                    hourCounts[hour].success++;
                }
                else {
                    hourCounts[hour].failed++;
                }
            }
        }
        this.hourlyData = Object.entries(hourCounts).map(([hour, counts]) => ({
            hour,
            ...counts
        }));
        // Build operation counts
        this.operationCounts.clear();
        for (const log of this.auditLogs) {
            const op = log.parsedDetails?.operation || 'Access';
            this.operationCounts.set(op, (this.operationCounts.get(op) || 0) + 1);
        }
    }
    getMaxHourlyCount() {
        return Math.max(...this.hourlyData.map(d => d.success + d.failed), 1);
    }
    getOperationList() {
        return Array.from(this.operationCounts.keys());
    }
    getStatusClass(status) {
        switch (status) {
            case 'Success': return 'success';
            case 'Failed': return 'failed';
            default: return 'unknown';
        }
    }
    getOperationType(log) {
        return log.parsedDetails?.operation || 'Access';
    }
    getSubsystem(log) {
        return log.parsedDetails?.subsystem || '';
    }
    getOperationIcon(operation) {
        switch (operation.toLowerCase()) {
            case 'access': return 'fa-solid fa-eye';
            case 'create': return 'fa-solid fa-plus';
            case 'update': return 'fa-solid fa-pen';
            case 'delete': return 'fa-solid fa-trash';
            case 'rotate': return 'fa-solid fa-rotate';
            case 'validate': return 'fa-solid fa-check-circle';
            default: return 'fa-solid fa-circle';
        }
    }
    getOperationColor(operation) {
        switch (operation.toLowerCase()) {
            case 'access': return 'var(--mj-brand-primary)';
            case 'create': return 'var(--mj-status-success)';
            case 'update': return 'var(--mj-status-warning)';
            case 'delete': return 'var(--mj-status-error)';
            case 'rotate': return 'var(--mj-brand-primary)';
            case 'validate': return 'var(--mj-brand-primary)';
            default: return 'var(--mj-text-secondary)';
        }
    }
    formatDate(date) {
        if (!date)
            return '';
        const d = new Date(date);
        return d.toLocaleDateString('en-US', {
            month: 'short',
            day: 'numeric',
            year: 'numeric',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit'
        });
    }
    formatTime(date) {
        if (!date)
            return '';
        const d = new Date(date);
        return d.toLocaleTimeString('en-US', {
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit'
        });
    }
    formatDuration(ms) {
        if (!ms)
            return '-';
        if (ms < 1000)
            return `${ms}ms`;
        return `${(ms / 1000).toFixed(2)}s`;
    }
    refresh() {
        this.loadData();
    }
    getSuccessCount() {
        return this.auditLogs.filter(log => log.Status === 'Success').length;
    }
    getFailedCount() {
        return this.auditLogs.filter(log => log.Status === 'Failed').length;
    }
    getSuccessRate() {
        if (this.auditLogs.length === 0)
            return 0;
        return Math.round((this.getSuccessCount() / this.auditLogs.length) * 100);
    }
    getUniqueUserCount() {
        const users = new Set(this.auditLogs.map(log => log.User).filter(Boolean));
        return users.size;
    }
    exportToCSV() {
        const headers = ['Timestamp', 'User', 'Operation', 'Status', 'Description', 'Subsystem', 'Credential Type'];
        const rows = this.filteredLogs.map(log => [
            this.formatDate(log.__mj_CreatedAt),
            log.User || '',
            this.getOperationType(log),
            log.Status || '',
            log.Description || '',
            this.getSubsystem(log),
            log.parsedDetails?.credentialType || ''
        ]);
        const csvContent = [
            headers.join(','),
            ...rows.map(row => row.map(cell => `"${cell.replace(/"/g, '""')}"`).join(','))
        ].join('\n');
        const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
        const link = document.createElement('a');
        link.href = URL.createObjectURL(blob);
        link.download = `credential-audit-log-${new Date().toISOString().split('T')[0]}.csv`;
        link.click();
    }
    static ɵfac = function CredentialsAuditResourceComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CredentialsAuditResourceComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CredentialsAuditResourceComponent, selectors: [["mj-credentials-audit-resource"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 18, vars: 12, consts: [["Title", "Audit Trail", "Icon", "fa-solid fa-clipboard-list", "Subtitle", "Credential access and modification history"], ["meta", ""], ["Label", "events", 3, "Count", "Total"], ["actions", ""], ["mjButton", "", "variant", "secondary", "size", "sm", "title", "Export to CSV", 3, "click"], [1, "fa-solid", "fa-download"], [1, "action-btn-label"], [3, "Clicked", "Loading"], ["toolbar", ""], ["Placeholder", "Search logs...", 3, "ValueChange", "Value"], [3, "ClearAllRequested", "ActiveCount", "ShowClearAll"], [3, "ValuesChange", "Reset", "Fields", "Values"], [3, "KeyChange", "Options", "ActiveKey"], ["text", "Loading audit logs..."], [1, "stats-grid"], [1, "stat-card"], [1, "stat-icon", "total"], [1, "fa-solid", "fa-clipboard-list"], [1, "stat-content"], [1, "stat-value"], [1, "stat-label"], [1, "stat-icon", "success"], [1, "fa-solid", "fa-check-circle"], [1, "stat-value", "success"], [1, "stat-rate"], [1, "stat-icon", "failed"], [1, "fa-solid", "fa-times-circle"], [1, "stat-value", "failed"], [1, "stat-icon", "users"], [1, "fa-solid", "fa-users"], [1, "activity-chart"], [1, "timeline-container"], [1, "audit-table-container"], ["Icon", "fa-solid fa-clipboard-list", "Title", "No Audit Logs", "ActionIcon", "fa-solid fa-rotate-left", 3, "Variant", "Message", "ActionText"], [1, "chart-header"], [1, "fa-solid", "fa-chart-bar"], [1, "chart-container"], [1, "chart-bars"], [1, "chart-bar-wrapper", 3, "title"], [1, "chart-legend"], [1, "legend-item"], [1, "legend-color", "success"], [1, "legend-color", "failed"], [1, "chart-bar"], [1, "bar-segment", "success"], [1, "bar-segment", "failed"], [1, "chart-label"], [1, "timeline-group"], [1, "timeline-date"], [1, "date-label"], [1, "date-count"], [1, "timeline-items"], [1, "timeline-item", 3, "failed"], [1, "timeline-item"], [1, "timeline-line"], [1, "timeline-dot"], ["Size", "sm", 1, "timeline-content", 3, "ExpandedChange", "FlushBody", "Expanded"], ["mjAccordionTitle", ""], ["mjAccordionBody", ""], [1, "timeline-summary"], [1, "timeline-header"], [1, "timeline-operation"], [1, "operation-name"], [1, "timeline-time"], [1, "timeline-body"], [1, "timeline-user"], [1, "fa-solid", "fa-user"], [1, "timeline-description"], [1, "timeline-badges"], [1, "status-badge", 3, "ngClass"], [1, "subsystem-badge"], [1, "type-badge"], [1, "fa-solid", "fa-key"], [1, "timeline-details"], [1, "detail-grid"], [1, "detail-item"], [1, "detail-item", "full-width"], [1, "detail-label"], [1, "detail-value"], [1, "detail-value", "mono"], [1, "detail-value", "error"], [1, "detail-value", "mono", "small"], [1, "audit-table"], [3, "failed-row"], [1, "timestamp"], [1, "user"], [1, "operation"], [1, "operation-badge"], [1, "description"], [1, "subsystem"], [1, "status"], ["Icon", "fa-solid fa-clipboard-list", "Title", "No Audit Logs", "ActionIcon", "fa-solid fa-rotate-left", 3, "Action", "Variant", "Message", "ActionText"]], template: function CredentialsAuditResourceComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 0)(2, "div", 1);
            i0.ɵɵelement(3, "mj-stat-badge", 2);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(4, "div", 3)(5, "button", 4);
            i0.ɵɵlistener("click", function CredentialsAuditResourceComponent_Template_button_click_5_listener() { return ctx.exportToCSV(); });
            i0.ɵɵelement(6, "i", 5);
            i0.ɵɵelementStart(7, "span", 6);
            i0.ɵɵtext(8, "Export");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(9, "mj-refresh-button", 7);
            i0.ɵɵlistener("Clicked", function CredentialsAuditResourceComponent_Template_mj_refresh_button_Clicked_9_listener() { return ctx.refresh(); });
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(10, "div", 8)(11, "mj-page-search", 9);
            i0.ɵɵlistener("ValueChange", function CredentialsAuditResourceComponent_Template_mj_page_search_ValueChange_11_listener($event) { return ctx.onSearchChange($event); });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(12, "mj-filter-popover", 10);
            i0.ɵɵlistener("ClearAllRequested", function CredentialsAuditResourceComponent_Template_mj_filter_popover_ClearAllRequested_12_listener() { return ctx.resetFilters(); });
            i0.ɵɵelementStart(13, "mj-filter-panel", 11);
            i0.ɵɵlistener("ValuesChange", function CredentialsAuditResourceComponent_Template_mj_filter_panel_ValuesChange_13_listener($event) { return ctx.onFilterValuesChange($event); })("Reset", function CredentialsAuditResourceComponent_Template_mj_filter_panel_Reset_13_listener() { return ctx.resetFilters(); });
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(14, "mj-view-toggle", 12);
            i0.ɵɵlistener("KeyChange", function CredentialsAuditResourceComponent_Template_mj_view_toggle_KeyChange_14_listener($event) { return ctx.setViewMode($event); });
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(15, "mj-page-body");
            i0.ɵɵconditionalCreate(16, CredentialsAuditResourceComponent_Conditional_16_Template, 1, 0, "mj-loading", 13);
            i0.ɵɵconditionalCreate(17, CredentialsAuditResourceComponent_Conditional_17_Template, 39, 9);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(3);
            i0.ɵɵproperty("Count", ctx.filteredLogs.length)("Total", ctx.auditLogs.length);
            i0.ɵɵadvance(6);
            i0.ɵɵproperty("Loading", ctx.isLoading);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Value", ctx.searchText);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ActiveCount", ctx.ActiveFilterCount)("ShowClearAll", ctx.ActiveFilterCount > 0);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Fields", ctx.FilterFields)("Values", ctx.FilterValues);
            i0.ɵɵadvance();
            i0.ɵɵproperty("Options", ctx.viewOptions)("ActiveKey", ctx.viewMode);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 16 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.isLoading ? 17 : -1);
        } }, dependencies: [i1.NgClass, i2.MJButtonDirective, i2.MJPageHeaderComponent, i2.MJPageLayoutComponent, i2.MJPageBodyComponent, i2.MJPageSearchComponent, i2.MJFilterPopoverComponent, i2.MJFilterPanelComponent, i2.MJViewToggleComponent, i2.MJStatBadgeComponent, i2.MJRefreshButtonComponent, i2.MJEmptyStateComponent, i2.MJAccordionPanelComponent, i2.MJAccordionTitleDirective, i2.MJAccordionBodyDirective, i3.LoadingComponent], styles: ["\n\n.stats-grid[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(4, 1fr);\n    gap: 16px;\n    margin-bottom: 24px;\n}\n\n.stat-card[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 16px;\n    padding: 20px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    position: relative;\n}\n\n.stat-icon[_ngcontent-%COMP%] {\n    width: 48px;\n    height: 48px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 12px;\n    flex-shrink: 0;\n}\n\n.stat-icon.total[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.stat-icon.success[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-success) 10%, transparent);\n    color: var(--mj-status-success);\n}\n\n.stat-icon.failed[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 10%, transparent);\n    color: var(--mj-status-error);\n}\n\n.stat-icon.users[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.stat-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 20px;\n}\n\n.stat-content[_ngcontent-%COMP%] {\n    flex: 1;\n}\n\n.stat-value[_ngcontent-%COMP%] {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n    line-height: 1;\n}\n\n.stat-value.success[_ngcontent-%COMP%] {\n    color: var(--mj-status-success);\n}\n\n.stat-value.failed[_ngcontent-%COMP%] {\n    color: var(--mj-status-error);\n}\n\n.stat-label[_ngcontent-%COMP%] {\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin-top: 4px;\n}\n\n.stat-rate[_ngcontent-%COMP%] {\n    position: absolute;\n    top: 12px;\n    right: 16px;\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-status-success);\n    background: color-mix(in srgb, var(--mj-status-success) 10%, transparent);\n    padding: 4px 8px;\n    border-radius: 8px;\n}\n\n\n\n.activity-chart[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    padding: 20px;\n    margin-bottom: 20px;\n}\n\n.chart-header[_ngcontent-%COMP%] {\n    margin-bottom: 16px;\n}\n\n.chart-header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0;\n}\n\n.chart-header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-brand-primary);\n}\n\n.chart-container[_ngcontent-%COMP%] {\n    height: 120px;\n    padding: 0 4px;\n}\n\n.chart-bars[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: flex-end;\n    height: 100%;\n    gap: 2px;\n}\n\n.chart-bar-wrapper[_ngcontent-%COMP%] {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    height: 100%;\n}\n\n.chart-bar[_ngcontent-%COMP%] {\n    flex: 1;\n    width: 100%;\n    max-width: 24px;\n    display: flex;\n    flex-direction: column-reverse;\n    border-radius: 4px 4px 0 0;\n    overflow: hidden;\n    background: var(--mj-bg-surface-sunken);\n}\n\n.bar-segment[_ngcontent-%COMP%] {\n    width: 100%;\n    transition: height 0.3s ease;\n}\n\n.bar-segment.success[_ngcontent-%COMP%] {\n    background: var(--mj-status-success);\n}\n\n.bar-segment.failed[_ngcontent-%COMP%] {\n    background: var(--mj-status-error);\n}\n\n.chart-label[_ngcontent-%COMP%] {\n    font-size: 10px;\n    color: var(--mj-text-disabled);\n    margin-top: 4px;\n}\n\n.chart-legend[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: center;\n    gap: 24px;\n    margin-top: 12px;\n    padding-top: 12px;\n    border-top: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.legend-item[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n}\n\n.legend-color[_ngcontent-%COMP%] {\n    width: 12px;\n    height: 12px;\n    border-radius: 3px;\n}\n\n.legend-color.success[_ngcontent-%COMP%] {\n    background: var(--mj-status-success);\n}\n\n.legend-color.failed[_ngcontent-%COMP%] {\n    background: var(--mj-status-error);\n}\n\n\n\n.timeline-container[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 24px;\n}\n\n.timeline-group[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.timeline-date[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    padding: 16px 20px;\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.date-label[_ngcontent-%COMP%] {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.date-count[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-border-default);\n    padding: 4px 10px;\n    border-radius: 12px;\n}\n\n.timeline-items[_ngcontent-%COMP%] {\n    padding: 8px 0;\n}\n\n.timeline-item[_ngcontent-%COMP%] {\n    display: flex;\n    padding: 12px 20px;\n    transition: background 0.2s ease;\n}\n\n.timeline-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-card);\n}\n\n.timeline-item.failed[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 2%, transparent);\n}\n\n.timeline-item.failed[_ngcontent-%COMP%]:hover {\n    background: color-mix(in srgb, var(--mj-status-error) 5%, transparent);\n}\n\n.timeline-line[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    width: 24px;\n    margin-right: 16px;\n    flex-shrink: 0;\n}\n\n.timeline-dot[_ngcontent-%COMP%] {\n    width: 12px;\n    height: 12px;\n    border-radius: 50%;\n    flex-shrink: 0;\n}\n\n\n\n\n\n.timeline-content[_ngcontent-%COMP%] {\n    flex: 1;\n    min-width: 0;\n}\n\n\n\n\n.timeline-summary[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-width: 0;\n}\n\n.timeline-header[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    margin-bottom: 8px;\n}\n\n.timeline-operation[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.timeline-operation[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 14px;\n}\n\n.operation-name[_ngcontent-%COMP%] {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.timeline-time[_ngcontent-%COMP%] {\n    font-size: 12px;\n    font-family: monospace;\n    color: var(--mj-text-secondary);\n}\n\n.timeline-body[_ngcontent-%COMP%] {\n    margin-bottom: 8px;\n}\n\n.timeline-user[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin-bottom: 4px;\n}\n\n.timeline-user[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 11px;\n}\n\n.timeline-description[_ngcontent-%COMP%] {\n    font-size: 13px;\n    color: var(--mj-text-primary);\n    margin-bottom: 8px;\n}\n\n.timeline-badges[_ngcontent-%COMP%] {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 8px;\n}\n\n.status-badge[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 10px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n}\n\n.status-badge.success[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-success) 15%, var(--mj-bg-surface));\n    color: var(--mj-status-success);\n}\n\n.status-badge.failed[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 8%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n\n.status-badge.unknown[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.status-badge[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 10px;\n}\n\n.subsystem-badge[_ngcontent-%COMP%], \n.type-badge[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 10px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 12px;\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n}\n\n.type-badge[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.type-badge[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 10px;\n}\n\n\n\n.timeline-details[_ngcontent-%COMP%] {\n    margin-top: 12px;\n    padding: 16px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    border: 1px solid var(--mj-border-default);\n}\n\n.detail-grid[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(2, 1fr);\n    gap: 12px;\n}\n\n.detail-item[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n}\n\n.detail-item.full-width[_ngcontent-%COMP%] {\n    grid-column: 1 / -1;\n}\n\n.detail-label[_ngcontent-%COMP%] {\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    color: var(--mj-text-secondary);\n}\n\n.detail-value[_ngcontent-%COMP%] {\n    font-size: 13px;\n    color: var(--mj-text-primary);\n}\n\n.detail-value.mono[_ngcontent-%COMP%] {\n    font-family: monospace;\n    font-size: 12px;\n}\n\n.detail-value.small[_ngcontent-%COMP%] {\n    font-size: 11px;\n    word-break: break-all;\n}\n\n.detail-value.error[_ngcontent-%COMP%] {\n    color: var(--mj-status-error);\n}\n\n\n\n\n\n\n\n.audit-table-container[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.audit-table[_ngcontent-%COMP%] {\n    width: 100%;\n    border-collapse: collapse;\n}\n\n.audit-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n    padding: 14px 16px;\n    text-align: left;\n    font-size: 12px;\n    font-weight: 600;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.audit-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] {\n    padding: 14px 16px;\n    font-size: 13px;\n    color: var(--mj-text-primary);\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.audit-table[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%] {\n    border-bottom: none;\n}\n\n.audit-table[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-card);\n}\n\n.audit-table[_ngcontent-%COMP%]   tr.failed-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 2%, transparent);\n}\n\n.audit-table[_ngcontent-%COMP%]   tr.failed-row[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 5%, transparent);\n}\n\n.timestamp[_ngcontent-%COMP%] {\n    font-family: monospace;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n}\n\n.user[_ngcontent-%COMP%] {\n    font-weight: 500;\n}\n\n.operation-badge[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 4px 10px;\n    border-radius: 6px;\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n}\n\n.operation-badge[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 10px;\n}\n\n.description[_ngcontent-%COMP%] {\n    max-width: 300px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.subsystem[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n}\n\n\n\n\n@media (max-width: 1200px) {\n    .stats-grid[_ngcontent-%COMP%] {\n        grid-template-columns: repeat(2, 1fr);\n    }\n}\n\n@media (max-width: 768px) {\n    .audit-container[_ngcontent-%COMP%] {\n        padding: 16px;\n    }\n\n    .audit-header[_ngcontent-%COMP%] {\n        flex-direction: column;\n        align-items: flex-start;\n        gap: 16px;\n    }\n\n    .stats-grid[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr;\n    }\n\n    .toolbar[_ngcontent-%COMP%] {\n        flex-direction: column;\n        align-items: stretch;\n    }\n\n    .toolbar-left[_ngcontent-%COMP%] {\n        flex-direction: column;\n    }\n\n    .search-container[_ngcontent-%COMP%] {\n        width: 100%;\n    }\n\n    .filter-select[_ngcontent-%COMP%] {\n        width: 100%;\n    }\n\n    .toolbar-right[_ngcontent-%COMP%] {\n        justify-content: space-between;\n    }\n\n    .detail-grid[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr;\n    }\n\n    .chart-label[_ngcontent-%COMP%] {\n        display: none;\n    }\n\n    .chart-label[_ngcontent-%COMP%]:nth-child(4n+1) {\n        display: block;\n    }\n}"], changeDetection: 0 });
};
CredentialsAuditResourceComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'CredentialsAuditResource')
], CredentialsAuditResourceComponent);
export { CredentialsAuditResourceComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CredentialsAuditResourceComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-credentials-audit-resource', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Audit Trail\"\n    Icon=\"fa-solid fa-clipboard-list\"\n    Subtitle=\"Credential access and modification history\">\n    <div meta>\n      <mj-stat-badge\n        [Count]=\"filteredLogs.length\"\n        [Total]=\"auditLogs.length\"\n        Label=\"events\">\n      </mj-stat-badge>\n    </div>\n    <div actions>\n      <button mjButton variant=\"secondary\" size=\"sm\" (click)=\"exportToCSV()\" title=\"Export to CSV\">\n        <i class=\"fa-solid fa-download\"></i> <span class=\"action-btn-label\">Export</span>\n      </button>\n      <mj-refresh-button [Loading]=\"isLoading\" (Clicked)=\"refresh()\"></mj-refresh-button>\n    </div>\n    <div toolbar>\n      <mj-page-search\n        Placeholder=\"Search logs...\"\n        [Value]=\"searchText\"\n        (ValueChange)=\"onSearchChange($event)\">\n      </mj-page-search>\n      <mj-filter-popover\n        [ActiveCount]=\"ActiveFilterCount\"\n        [ShowClearAll]=\"ActiveFilterCount > 0\"\n        (ClearAllRequested)=\"resetFilters()\">\n        <mj-filter-panel\n          [Fields]=\"FilterFields\"\n          [Values]=\"FilterValues\"\n          (ValuesChange)=\"onFilterValuesChange($event)\"\n          (Reset)=\"resetFilters()\">\n        </mj-filter-panel>\n      </mj-filter-popover>\n      <mj-view-toggle\n        [Options]=\"viewOptions\"\n        [ActiveKey]=\"viewMode\"\n        (KeyChange)=\"setViewMode($any($event))\">\n      </mj-view-toggle>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body>\n  @if (isLoading) {\n    <mj-loading text=\"Loading audit logs...\"></mj-loading>\n  }\n\n  @if (!isLoading) {\n    <!-- Stats Cards -->\n    <div class=\"stats-grid\">\n      <div class=\"stat-card\">\n        <div class=\"stat-icon total\">\n          <i class=\"fa-solid fa-clipboard-list\"></i>\n        </div>\n        <div class=\"stat-content\">\n          <div class=\"stat-value\">{{auditLogs.length}}</div>\n          <div class=\"stat-label\">Total Events</div>\n        </div>\n      </div>\n      <div class=\"stat-card\">\n        <div class=\"stat-icon success\">\n          <i class=\"fa-solid fa-check-circle\"></i>\n        </div>\n        <div class=\"stat-content\">\n          <div class=\"stat-value success\">{{getSuccessCount()}}</div>\n          <div class=\"stat-label\">Successful</div>\n        </div>\n        <div class=\"stat-rate\">{{getSuccessRate()}}%</div>\n      </div>\n      <div class=\"stat-card\">\n        <div class=\"stat-icon failed\">\n          <i class=\"fa-solid fa-times-circle\"></i>\n        </div>\n        <div class=\"stat-content\">\n          <div class=\"stat-value failed\">{{getFailedCount()}}</div>\n          <div class=\"stat-label\">Failed</div>\n        </div>\n      </div>\n      <div class=\"stat-card\">\n        <div class=\"stat-icon users\">\n          <i class=\"fa-solid fa-users\"></i>\n        </div>\n        <div class=\"stat-content\">\n          <div class=\"stat-value\">{{getUniqueUserCount()}}</div>\n          <div class=\"stat-label\">Unique Users</div>\n        </div>\n      </div>\n    </div>\n    <!-- Activity Chart -->\n    @if (hourlyData.length > 0) {\n      <div class=\"activity-chart\">\n        <div class=\"chart-header\">\n          <h3>\n            <i class=\"fa-solid fa-chart-bar\"></i>\n            Today's Activity\n          </h3>\n        </div>\n        <div class=\"chart-container\">\n          <div class=\"chart-bars\">\n            @for (data of hourlyData; track data) {\n              <div\n                class=\"chart-bar-wrapper\"\n                [title]=\"data.hour + ': ' + (data.success + data.failed) + ' events'\"\n                >\n                <div class=\"chart-bar\">\n                  <div\n                    class=\"bar-segment success\"\n                    [style.height.%]=\"(data.success / getMaxHourlyCount()) * 100\"\n                  ></div>\n                  <div\n                    class=\"bar-segment failed\"\n                    [style.height.%]=\"(data.failed / getMaxHourlyCount()) * 100\"\n                  ></div>\n                </div>\n                <span class=\"chart-label\">{{data.hour.split(':')[0]}}</span>\n              </div>\n            }\n          </div>\n        </div>\n        <div class=\"chart-legend\">\n          <span class=\"legend-item\">\n            <span class=\"legend-color success\"></span>\n            Success\n          </span>\n          <span class=\"legend-item\">\n            <span class=\"legend-color failed\"></span>\n            Failed\n          </span>\n        </div>\n      </div>\n    }\n    <!-- Timeline View -->\n    @if (viewMode === 'timeline' && timelineGroups.length > 0) {\n      <div class=\"timeline-container\">\n        @for (group of timelineGroups; track group) {\n          <div class=\"timeline-group\">\n            <div class=\"timeline-date\">\n              <span class=\"date-label\">{{group.displayDate}}</span>\n              <span class=\"date-count\">{{group.logs.length}} events</span>\n            </div>\n            <div class=\"timeline-items\">\n              @for (log of group.logs; track log) {\n                <div\n                  class=\"timeline-item\"\n                  [class.failed]=\"log.Status === 'Failed'\"\n                  >\n                  <div class=\"timeline-line\">\n                    <div\n                      class=\"timeline-dot\"\n                      [style.backgroundColor]=\"getOperationColor(getOperationType(log))\"\n                    ></div>\n                  </div>\n                  <mj-accordion-panel\n                    class=\"timeline-content\"\n                    Size=\"sm\"\n                    [FlushBody]=\"true\"\n                    [Expanded]=\"expandedLogId === log.ID\"\n                    (ExpandedChange)=\"onLogExpandedChange(log.ID, $event)\">\n                    <ng-template mjAccordionTitle>\n                      <div class=\"timeline-summary\">\n                        <div class=\"timeline-header\">\n                          <div class=\"timeline-operation\">\n                            <i [class]=\"getOperationIcon(getOperationType(log))\" [style.color]=\"getOperationColor(getOperationType(log))\"></i>\n                            <span class=\"operation-name\">{{getOperationType(log)}}</span>\n                          </div>\n                          <div class=\"timeline-time\">{{formatTime(log.__mj_CreatedAt)}}</div>\n                        </div>\n                        <div class=\"timeline-body\">\n                          <div class=\"timeline-user\">\n                            <i class=\"fa-solid fa-user\"></i>\n                            {{log.User || 'Unknown'}}\n                          </div>\n                          @if (log.Description) {\n                            <div class=\"timeline-description\">\n                              {{log.Description}}\n                            </div>\n                          }\n                          <div class=\"timeline-badges\">\n                            <span class=\"status-badge\" [ngClass]=\"getStatusClass(log.Status)\">\n                              <i [class]=\"log.Status === 'Success' ? 'fa-solid fa-check' : 'fa-solid fa-times'\"></i>\n                              {{log.Status}}\n                            </span>\n                            @if (getSubsystem(log)) {\n                              <span class=\"subsystem-badge\">\n                                {{getSubsystem(log)}}\n                              </span>\n                            }\n                            @if (log.parsedDetails?.credentialType) {\n                              <span class=\"type-badge\">\n                                <i class=\"fa-solid fa-key\"></i>\n                                {{log.parsedDetails?.credentialType}}\n                              </span>\n                            }\n                          </div>\n                        </div>\n                      </div>\n                    </ng-template>\n                    <ng-template mjAccordionBody>\n                      <div class=\"timeline-details\">\n                        <div class=\"detail-grid\">\n                          @if (log.parsedDetails?.ipAddress) {\n                            <div class=\"detail-item\">\n                              <span class=\"detail-label\">IP Address</span>\n                              <span class=\"detail-value\">{{log.parsedDetails?.ipAddress}}</span>\n                            </div>\n                          }\n                          @if (log.parsedDetails?.duration) {\n                            <div class=\"detail-item\">\n                              <span class=\"detail-label\">Duration</span>\n                              <span class=\"detail-value\">{{formatDuration(log.parsedDetails?.duration)}}</span>\n                            </div>\n                          }\n                          @if (log.parsedDetails?.credentialId) {\n                            <div class=\"detail-item\">\n                              <span class=\"detail-label\">Credential ID</span>\n                              <span class=\"detail-value mono\">{{log.parsedDetails?.credentialId}}</span>\n                            </div>\n                          }\n                          @if (log.parsedDetails?.errorMessage) {\n                            <div class=\"detail-item full-width\">\n                              <span class=\"detail-label\">Error Message</span>\n                              <span class=\"detail-value error\">{{log.parsedDetails?.errorMessage}}</span>\n                            </div>\n                          }\n                          @if (log.parsedDetails?.userAgent) {\n                            <div class=\"detail-item full-width\">\n                              <span class=\"detail-label\">User Agent</span>\n                              <span class=\"detail-value mono small\">{{log.parsedDetails?.userAgent}}</span>\n                            </div>\n                          }\n                        </div>\n                      </div>\n                    </ng-template>\n                  </mj-accordion-panel>\n                </div>\n              }\n            </div>\n          </div>\n        }\n      </div>\n    }\n    <!-- Table View -->\n    @if (viewMode === 'table' && filteredLogs.length > 0) {\n      <div class=\"audit-table-container\">\n        <table class=\"audit-table\">\n          <thead>\n            <tr>\n              <th>Timestamp</th>\n              <th>User</th>\n              <th>Operation</th>\n              <th>Description</th>\n              <th>Subsystem</th>\n              <th>Status</th>\n            </tr>\n          </thead>\n          <tbody>\n            @for (log of filteredLogs; track log) {\n              <tr [class.failed-row]=\"log.Status === 'Failed'\">\n                <td class=\"timestamp\">{{formatDate(log.__mj_CreatedAt)}}</td>\n                <td class=\"user\">{{log.User || 'Unknown'}}</td>\n                <td class=\"operation\">\n                  <span class=\"operation-badge\" [style.backgroundColor]=\"getOperationColor(getOperationType(log)) + '20'\" [style.color]=\"getOperationColor(getOperationType(log))\">\n                    <i [class]=\"getOperationIcon(getOperationType(log))\"></i>\n                    {{getOperationType(log)}}\n                  </span>\n                </td>\n                <td class=\"description\">{{log.Description || '-'}}</td>\n                <td class=\"subsystem\">{{getSubsystem(log) || '-'}}</td>\n                <td class=\"status\">\n                  <span class=\"status-badge\" [ngClass]=\"getStatusClass(log.Status)\">\n                    <i [class]=\"log.Status === 'Success' ? 'fa-solid fa-check' : 'fa-solid fa-times'\"></i>\n                    {{log.Status}}\n                  </span>\n                </td>\n              </tr>\n            }\n          </tbody>\n        </table>\n      </div>\n    }\n    <!-- Empty State -->\n    @if (filteredLogs.length === 0) {\n      <mj-empty-state\n        [Variant]=\"IsListNarrowed ? 'no-results' : 'empty'\"\n        Icon=\"fa-solid fa-clipboard-list\"\n        Title=\"No Audit Logs\"\n        [Message]=\"IsListNarrowed ? 'No events match your current filters.' : 'No credential access events in the selected time range.'\"\n        [ActionText]=\"IsListNarrowed ? 'Reset filters' : ''\"\n        ActionIcon=\"fa-solid fa-rotate-left\"\n        (Action)=\"resetAuditFilters()\" />\n    }\n  }\n  </mj-page-body>\n</mj-page-layout>\n", styles: ["/* Stats Grid */\n.stats-grid {\n    display: grid;\n    grid-template-columns: repeat(4, 1fr);\n    gap: 16px;\n    margin-bottom: 24px;\n}\n\n.stat-card {\n    display: flex;\n    align-items: center;\n    gap: 16px;\n    padding: 20px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    position: relative;\n}\n\n.stat-icon {\n    width: 48px;\n    height: 48px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 12px;\n    flex-shrink: 0;\n}\n\n.stat-icon.total {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.stat-icon.success {\n    background: color-mix(in srgb, var(--mj-status-success) 10%, transparent);\n    color: var(--mj-status-success);\n}\n\n.stat-icon.failed {\n    background: color-mix(in srgb, var(--mj-status-error) 10%, transparent);\n    color: var(--mj-status-error);\n}\n\n.stat-icon.users {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.stat-icon i {\n    font-size: 20px;\n}\n\n.stat-content {\n    flex: 1;\n}\n\n.stat-value {\n    font-size: 28px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n    line-height: 1;\n}\n\n.stat-value.success {\n    color: var(--mj-status-success);\n}\n\n.stat-value.failed {\n    color: var(--mj-status-error);\n}\n\n.stat-label {\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin-top: 4px;\n}\n\n.stat-rate {\n    position: absolute;\n    top: 12px;\n    right: 16px;\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-status-success);\n    background: color-mix(in srgb, var(--mj-status-success) 10%, transparent);\n    padding: 4px 8px;\n    border-radius: 8px;\n}\n\n/* Activity Chart */\n.activity-chart {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    padding: 20px;\n    margin-bottom: 20px;\n}\n\n.chart-header {\n    margin-bottom: 16px;\n}\n\n.chart-header h3 {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin: 0;\n}\n\n.chart-header h3 i {\n    color: var(--mj-brand-primary);\n}\n\n.chart-container {\n    height: 120px;\n    padding: 0 4px;\n}\n\n.chart-bars {\n    display: flex;\n    align-items: flex-end;\n    height: 100%;\n    gap: 2px;\n}\n\n.chart-bar-wrapper {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    height: 100%;\n}\n\n.chart-bar {\n    flex: 1;\n    width: 100%;\n    max-width: 24px;\n    display: flex;\n    flex-direction: column-reverse;\n    border-radius: 4px 4px 0 0;\n    overflow: hidden;\n    background: var(--mj-bg-surface-sunken);\n}\n\n.bar-segment {\n    width: 100%;\n    transition: height 0.3s ease;\n}\n\n.bar-segment.success {\n    background: var(--mj-status-success);\n}\n\n.bar-segment.failed {\n    background: var(--mj-status-error);\n}\n\n.chart-label {\n    font-size: 10px;\n    color: var(--mj-text-disabled);\n    margin-top: 4px;\n}\n\n.chart-legend {\n    display: flex;\n    justify-content: center;\n    gap: 24px;\n    margin-top: 12px;\n    padding-top: 12px;\n    border-top: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.legend-item {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n}\n\n.legend-color {\n    width: 12px;\n    height: 12px;\n    border-radius: 3px;\n}\n\n.legend-color.success {\n    background: var(--mj-status-success);\n}\n\n.legend-color.failed {\n    background: var(--mj-status-error);\n}\n\n/* Timeline View */\n.timeline-container {\n    display: flex;\n    flex-direction: column;\n    gap: 24px;\n}\n\n.timeline-group {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.timeline-date {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    padding: 16px 20px;\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.date-label {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.date-count {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-border-default);\n    padding: 4px 10px;\n    border-radius: 12px;\n}\n\n.timeline-items {\n    padding: 8px 0;\n}\n\n.timeline-item {\n    display: flex;\n    padding: 12px 20px;\n    transition: background 0.2s ease;\n}\n\n.timeline-item:hover {\n    background: var(--mj-bg-surface-card);\n}\n\n.timeline-item.failed {\n    background: color-mix(in srgb, var(--mj-status-error) 2%, transparent);\n}\n\n.timeline-item.failed:hover {\n    background: color-mix(in srgb, var(--mj-status-error) 5%, transparent);\n}\n\n.timeline-line {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    width: 24px;\n    margin-right: 16px;\n    flex-shrink: 0;\n}\n\n.timeline-dot {\n    width: 12px;\n    height: 12px;\n    border-radius: 50%;\n    flex-shrink: 0;\n}\n\n/* Disclosure migrated to <mj-accordion-panel>; the panel sits beside the\n   timeline dot/line and fills the row. (cursor/position chrome for the old\n   click target + absolute expand-btn removed \u2014 the accordion owns the toggle.) */\n.timeline-content {\n    flex: 1;\n    min-width: 0;\n}\n\n/* Stacks the always-visible header + body rows vertically inside the accordion\n   title slot (which is itself a horizontal flex row). */\n.timeline-summary {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-width: 0;\n}\n\n.timeline-header {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    margin-bottom: 8px;\n}\n\n.timeline-operation {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.timeline-operation i {\n    font-size: 14px;\n}\n\n.operation-name {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.timeline-time {\n    font-size: 12px;\n    font-family: monospace;\n    color: var(--mj-text-secondary);\n}\n\n.timeline-body {\n    margin-bottom: 8px;\n}\n\n.timeline-user {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n    margin-bottom: 4px;\n}\n\n.timeline-user i {\n    font-size: 11px;\n}\n\n.timeline-description {\n    font-size: 13px;\n    color: var(--mj-text-primary);\n    margin-bottom: 8px;\n}\n\n.timeline-badges {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 8px;\n}\n\n.status-badge {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 10px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n}\n\n.status-badge.success {\n    background: color-mix(in srgb, var(--mj-status-success) 15%, var(--mj-bg-surface));\n    color: var(--mj-status-success);\n}\n\n.status-badge.failed {\n    background: color-mix(in srgb, var(--mj-status-error) 8%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n\n.status-badge.unknown {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.status-badge i {\n    font-size: 10px;\n}\n\n.subsystem-badge,\n.type-badge {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    padding: 4px 10px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 12px;\n    font-size: 11px;\n    color: var(--mj-text-secondary);\n}\n\n.type-badge {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.type-badge i {\n    font-size: 10px;\n}\n\n/* Timeline Details */\n.timeline-details {\n    margin-top: 12px;\n    padding: 16px;\n    background: var(--mj-bg-surface-card);\n    border-radius: 8px;\n    border: 1px solid var(--mj-border-default);\n}\n\n.detail-grid {\n    display: grid;\n    grid-template-columns: repeat(2, 1fr);\n    gap: 12px;\n}\n\n.detail-item {\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n}\n\n.detail-item.full-width {\n    grid-column: 1 / -1;\n}\n\n.detail-label {\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    color: var(--mj-text-secondary);\n}\n\n.detail-value {\n    font-size: 13px;\n    color: var(--mj-text-primary);\n}\n\n.detail-value.mono {\n    font-family: monospace;\n    font-size: 12px;\n}\n\n.detail-value.small {\n    font-size: 11px;\n    word-break: break-all;\n}\n\n.detail-value.error {\n    color: var(--mj-status-error);\n}\n\n/* .expand-btn removed \u2014 the bespoke chevron toggle was replaced by\n   <mj-accordion-panel>'s built-in chevron. */\n\n/* Table View */\n.audit-table-container {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n    overflow: hidden;\n}\n\n.audit-table {\n    width: 100%;\n    border-collapse: collapse;\n}\n\n.audit-table th {\n    padding: 14px 16px;\n    text-align: left;\n    font-size: 12px;\n    font-weight: 600;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-card);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.audit-table td {\n    padding: 14px 16px;\n    font-size: 13px;\n    color: var(--mj-text-primary);\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n}\n\n.audit-table tr:last-child td {\n    border-bottom: none;\n}\n\n.audit-table tr:hover td {\n    background: var(--mj-bg-surface-card);\n}\n\n.audit-table tr.failed-row td {\n    background: color-mix(in srgb, var(--mj-status-error) 2%, transparent);\n}\n\n.audit-table tr.failed-row:hover td {\n    background: color-mix(in srgb, var(--mj-status-error) 5%, transparent);\n}\n\n.timestamp {\n    font-family: monospace;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n}\n\n.user {\n    font-weight: 500;\n}\n\n.operation-badge {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 4px 10px;\n    border-radius: 6px;\n    font-size: 11px;\n    font-weight: 600;\n    text-transform: uppercase;\n}\n\n.operation-badge i {\n    font-size: 10px;\n}\n\n.description {\n    max-width: 300px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.subsystem {\n    color: var(--mj-text-secondary);\n}\n\n\n/* Responsive */\n@media (max-width: 1200px) {\n    .stats-grid {\n        grid-template-columns: repeat(2, 1fr);\n    }\n}\n\n@media (max-width: 768px) {\n    .audit-container {\n        padding: 16px;\n    }\n\n    .audit-header {\n        flex-direction: column;\n        align-items: flex-start;\n        gap: 16px;\n    }\n\n    .stats-grid {\n        grid-template-columns: 1fr;\n    }\n\n    .toolbar {\n        flex-direction: column;\n        align-items: stretch;\n    }\n\n    .toolbar-left {\n        flex-direction: column;\n    }\n\n    .search-container {\n        width: 100%;\n    }\n\n    .filter-select {\n        width: 100%;\n    }\n\n    .toolbar-right {\n        justify-content: space-between;\n    }\n\n    .detail-grid {\n        grid-template-columns: 1fr;\n    }\n\n    .chart-label {\n        display: none;\n    }\n\n    .chart-label:nth-child(4n+1) {\n        display: block;\n    }\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CredentialsAuditResourceComponent, { className: "CredentialsAuditResourceComponent", filePath: "src/Credentials/components/credentials-audit-resource.component.ts", lineNumber: 39 }); })();
//# sourceMappingURL=credentials-audit-resource.component.js.map