import { Component } from '@angular/core';
import { RunView } from '@memberjunction/core';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
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 APIUsagePanelComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 1);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_76_For_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 56);
} if (rf & 2) {
    const bucket_r3 = i0.ɵɵnextContext().$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵstyleProp("height", ctx_r1.getErrorBarHeight(bucket_r3), "%");
} }
function APIUsagePanelComponent_Conditional_2_Conditional_76_For_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 50)(1, "div", 52)(2, "div", 53);
    i0.ɵɵconditionalCreate(3, APIUsagePanelComponent_Conditional_2_Conditional_76_For_3_Conditional_3_Template, 1, 2, "div", 54);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(4, "div", 55);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const bucket_r3 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("title", bucket_r3.requests + " requests, " + bucket_r3.errors + " errors");
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("height", ctx_r1.getBarHeight(bucket_r3.requests), "%");
    i0.ɵɵadvance();
    i0.ɵɵconditional(bucket_r3.errors > 0 ? 3 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(bucket_r3.label);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_76_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 33)(1, "div", 49);
    i0.ɵɵrepeaterCreate(2, APIUsagePanelComponent_Conditional_2_Conditional_76_For_3_Template, 6, 5, "div", 50, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 51)(5, "span");
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "span");
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "span");
    i0.ɵɵtext(10, "0");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r1.TimeBuckets);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(ctx_r1.MaxRequests));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(ctx_r1.Math.round(ctx_r1.MaxRequests / 2)));
} }
function APIUsagePanelComponent_Conditional_2_Conditional_77_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 34);
    i0.ɵɵelement(1, "i", 57);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3, "No usage data available");
    i0.ɵɵelementEnd()();
} }
function APIUsagePanelComponent_Conditional_2_Conditional_85_For_2_Template(rf, ctx) { if (rf & 1) {
    const _r4 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 59);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Conditional_85_For_2_Template_div_click_0_listener() { const ep_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.drillDownEndpoint(ep_r5)); });
    i0.ɵɵelementStart(1, "div", 60)(2, "span", 61);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 62);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "div", 63)(7, "span", 64);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "span", 65);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "span", 66);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ep_r5 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", ctx_r1.getMethodClass(ep_r5.method));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ep_r5.method, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ep_r5.endpoint);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(ep_r5.requests));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("", ep_r5.avgResponseTime, "ms");
    i0.ɵɵadvance();
    i0.ɵɵclassProp("has-errors", ep_r5.errorRate > 0);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ep_r5.errorRate, "% err ");
} }
function APIUsagePanelComponent_Conditional_2_Conditional_85_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 39);
    i0.ɵɵrepeaterCreate(1, APIUsagePanelComponent_Conditional_2_Conditional_85_For_2_Template, 13, 8, "div", 58, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r1.TopEndpoints);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_86_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 40);
    i0.ɵɵelement(1, "i", 26);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3, "No endpoint data");
    i0.ɵɵelementEnd()();
} }
function APIUsagePanelComponent_Conditional_2_Conditional_93_For_2_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 68);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Conditional_93_For_2_Template_div_click_0_listener() { const key_r7 = i0.ɵɵrestoreView(_r6).$implicit; const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.drillDownKey(key_r7)); });
    i0.ɵɵelementStart(1, "div", 69)(2, "span", 70);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 71);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(6, "div", 72);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const key_r7 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(key_r7.label);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatDate(key_r7.lastUsed));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(key_r7.requests));
} }
function APIUsagePanelComponent_Conditional_2_Conditional_93_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 41);
    i0.ɵɵrepeaterCreate(1, APIUsagePanelComponent_Conditional_2_Conditional_93_For_2_Template, 8, 3, "div", 67, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r1.TopKeys);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_94_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 40);
    i0.ɵɵelement(1, "i", 24);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3, "No key data");
    i0.ɵɵelementEnd()();
} }
function APIUsagePanelComponent_Conditional_2_Conditional_101_For_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 77);
} if (rf & 2) {
    const group_r8 = ctx.$implicit;
    i0.ɵɵstyleProp("width", group_r8.percentage, "%")("background-color", group_r8.color);
    i0.ɵɵproperty("title", group_r8.label + ": " + group_r8.count + " (" + group_r8.percentage + "%)");
} }
function APIUsagePanelComponent_Conditional_2_Conditional_101_For_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 76);
    i0.ɵɵelement(1, "span", 78);
    i0.ɵɵelementStart(2, "span", 79);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 80);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const group_r9 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵstyleProp("background-color", group_r9.color);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(group_r9.label);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate2("", ctx_r1.formatNumber(group_r9.count), " (", group_r9.percentage, "%)");
} }
function APIUsagePanelComponent_Conditional_2_Conditional_101_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 43)(1, "div", 73);
    i0.ɵɵrepeaterCreate(2, APIUsagePanelComponent_Conditional_2_Conditional_101_For_3_Template, 1, 5, "div", 74, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 75);
    i0.ɵɵrepeaterCreate(5, APIUsagePanelComponent_Conditional_2_Conditional_101_For_6_Template, 6, 5, "div", 76, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r1.StatusGroups);
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(ctx_r1.StatusGroups);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_102_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 40);
    i0.ɵɵelement(1, "i", 42);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3, "No status data");
    i0.ɵɵelementEnd()();
} }
function APIUsagePanelComponent_Conditional_2_Conditional_108_For_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 89)(1, "span", 82);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 83);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 84)(6, "span", 61);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(8, "span", 85);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "span", 90);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "span", 87);
    i0.ɵɵtext(13);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r10 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatDate(log_r10.timestamp));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r10.keyLabel);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", ctx_r1.getMethodClass(log_r10.method));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r10.method, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r10.endpoint);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", ctx_r1.getStatusClass(log_r10.statusCode));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r10.statusCode, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("", log_r10.responseTime, "ms");
} }
function APIUsagePanelComponent_Conditional_2_Conditional_108_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 47)(1, "div", 81)(2, "span", 82);
    i0.ɵɵtext(3, "Time");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 83);
    i0.ɵɵtext(5, "API Key");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "span", 84);
    i0.ɵɵtext(7, "Method");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "span", 85);
    i0.ɵɵtext(9, "Endpoint");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "span", 86);
    i0.ɵɵtext(11, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "span", 87);
    i0.ɵɵtext(13, "Duration");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(14, "div", 88);
    i0.ɵɵrepeaterCreate(15, APIUsagePanelComponent_Conditional_2_Conditional_108_For_16_Template, 14, 8, "div", 89, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(15);
    i0.ɵɵrepeater(ctx_r1.RecentLogs);
} }
function APIUsagePanelComponent_Conditional_2_Conditional_109_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 48);
    i0.ɵɵelement(1, "i", 91);
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3, "No requests logged yet");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "p");
    i0.ɵɵtext(5, "API usage will appear here once keys are used");
    i0.ɵɵelementEnd()();
} }
function APIUsagePanelComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 3)(1, "div", 4)(2, "h3", 5);
    i0.ɵɵelement(3, "i", 6);
    i0.ɵɵtext(4, " API Usage Analytics ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "p", 7);
    i0.ɵɵtext(6, "Monitor API key usage, performance, and trends");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(7, "div", 8)(8, "button", 9);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Template_button_click_8_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setTimeRange("day")); });
    i0.ɵɵtext(9, "24 Hours");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "button", 9);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setTimeRange("week")); });
    i0.ɵɵtext(11, "7 Days");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "button", 9);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Template_button_click_12_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setTimeRange("month")); });
    i0.ɵɵtext(13, "30 Days");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "button", 9);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_2_Template_button_click_14_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.setTimeRange("all")); });
    i0.ɵɵtext(15, "All Time");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(16, "div", 10)(17, "div", 11)(18, "div", 12);
    i0.ɵɵelement(19, "i", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(20, "div", 14)(21, "div", 15);
    i0.ɵɵtext(22);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(23, "div", 16);
    i0.ɵɵtext(24, "Total Requests");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(25, "div", 11)(26, "div", 17);
    i0.ɵɵelement(27, "i", 18);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(28, "div", 14)(29, "div", 15);
    i0.ɵɵtext(30);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(31, "div", 16);
    i0.ɵɵtext(32, "Success Rate");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(33, "div", 11)(34, "div", 19);
    i0.ɵɵelement(35, "i", 20);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(36, "div", 14)(37, "div", 15);
    i0.ɵɵtext(38);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(39, "div", 16);
    i0.ɵɵtext(40, "Errors");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(41, "div", 11)(42, "div", 21);
    i0.ɵɵelement(43, "i", 22);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(44, "div", 14)(45, "div", 15);
    i0.ɵɵtext(46);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(47, "div", 16);
    i0.ɵɵtext(48, "Avg Response Time");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(49, "div", 11)(50, "div", 23);
    i0.ɵɵelement(51, "i", 24);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(52, "div", 14)(53, "div", 15);
    i0.ɵɵtext(54);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(55, "div", 16);
    i0.ɵɵtext(56, "Active Keys");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(57, "div", 11)(58, "div", 25);
    i0.ɵɵelement(59, "i", 26);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(60, "div", 14)(61, "div", 15);
    i0.ɵɵtext(62);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(63, "div", 16);
    i0.ɵɵtext(64, "Unique Endpoints");
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(65, "div", 27)(66, "div", 28)(67, "h4");
    i0.ɵɵtext(68, "Request Volume");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(69, "div", 29)(70, "span", 30);
    i0.ɵɵelement(71, "span", 31);
    i0.ɵɵtext(72, " Requests ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(73, "span", 30);
    i0.ɵɵelement(74, "span", 32);
    i0.ɵɵtext(75, " Errors ");
    i0.ɵɵelementEnd()()();
    i0.ɵɵconditionalCreate(76, APIUsagePanelComponent_Conditional_2_Conditional_76_Template, 11, 2, "div", 33);
    i0.ɵɵconditionalCreate(77, APIUsagePanelComponent_Conditional_2_Conditional_77_Template, 4, 0, "div", 34);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(78, "div", 35)(79, "div", 36)(80, "div", 37)(81, "h4");
    i0.ɵɵelement(82, "i", 26);
    i0.ɵɵtext(83, " Top Endpoints ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(84, "div", 38);
    i0.ɵɵconditionalCreate(85, APIUsagePanelComponent_Conditional_2_Conditional_85_Template, 3, 0, "div", 39);
    i0.ɵɵconditionalCreate(86, APIUsagePanelComponent_Conditional_2_Conditional_86_Template, 4, 0, "div", 40);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(87, "div", 36)(88, "div", 37)(89, "h4");
    i0.ɵɵelement(90, "i", 24);
    i0.ɵɵtext(91, " Most Active Keys ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(92, "div", 38);
    i0.ɵɵconditionalCreate(93, APIUsagePanelComponent_Conditional_2_Conditional_93_Template, 3, 0, "div", 41);
    i0.ɵɵconditionalCreate(94, APIUsagePanelComponent_Conditional_2_Conditional_94_Template, 4, 0, "div", 40);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(95, "div", 36)(96, "div", 37)(97, "h4");
    i0.ɵɵelement(98, "i", 42);
    i0.ɵɵtext(99, " Status Distribution ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(100, "div", 38);
    i0.ɵɵconditionalCreate(101, APIUsagePanelComponent_Conditional_2_Conditional_101_Template, 7, 0, "div", 43);
    i0.ɵɵconditionalCreate(102, APIUsagePanelComponent_Conditional_2_Conditional_102_Template, 4, 0, "div", 40);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(103, "div", 44)(104, "div", 45)(105, "h4");
    i0.ɵɵelement(106, "i", 46);
    i0.ɵɵtext(107, " Recent Requests ");
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(108, APIUsagePanelComponent_Conditional_2_Conditional_108_Template, 17, 0, "div", 47);
    i0.ɵɵconditionalCreate(109, APIUsagePanelComponent_Conditional_2_Conditional_109_Template, 6, 0, "div", 48);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(8);
    i0.ɵɵclassProp("active", ctx_r1.TimeRange === "day");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("active", ctx_r1.TimeRange === "week");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("active", ctx_r1.TimeRange === "month");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("active", ctx_r1.TimeRange === "all");
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(ctx_r1.TotalRequests));
    i0.ɵɵadvance(3);
    i0.ɵɵclassProp("success", ctx_r1.SuccessRate >= 95);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate1("", ctx_r1.SuccessRate, "%");
    i0.ɵɵadvance(3);
    i0.ɵɵclassProp("warning", ctx_r1.TotalErrors > 0);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r1.formatNumber(ctx_r1.TotalErrors));
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate1("", ctx_r1.AvgResponseTime, "ms");
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate(ctx_r1.UniqueKeys);
    i0.ɵɵadvance(8);
    i0.ɵɵtextInterpolate(ctx_r1.UniqueEndpoints);
    i0.ɵɵadvance(14);
    i0.ɵɵconditional(ctx_r1.TimeBuckets.length > 0 ? 76 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.TimeBuckets.length === 0 ? 77 : -1);
    i0.ɵɵadvance(8);
    i0.ɵɵconditional(ctx_r1.TopEndpoints.length > 0 ? 85 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.TopEndpoints.length === 0 ? 86 : -1);
    i0.ɵɵadvance(7);
    i0.ɵɵconditional(ctx_r1.TopKeys.length > 0 ? 93 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.TopKeys.length === 0 ? 94 : -1);
    i0.ɵɵadvance(7);
    i0.ɵɵconditional(ctx_r1.StatusGroups.length > 0 ? 101 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.StatusGroups.length === 0 ? 102 : -1);
    i0.ɵɵadvance(6);
    i0.ɵɵconditional(ctx_r1.RecentLogs.length > 0 ? 108 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.RecentLogs.length === 0 ? 109 : -1);
} }
function APIUsagePanelComponent_Conditional_3_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 95);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.LogsFilter.endpoint, " ");
} }
function APIUsagePanelComponent_Conditional_3_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 95);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" Key: ", ctx_r1.KeyMap.get(ctx_r1.LogsFilter.keyId) || "Unknown", " ");
} }
function APIUsagePanelComponent_Conditional_3_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 99);
} }
function APIUsagePanelComponent_Conditional_3_Conditional_12_For_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 89)(1, "span", 82);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "span", 83);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 84)(6, "span", 61);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(8, "span", 85);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "span", 90);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "span", 87);
    i0.ɵɵtext(13);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const log_r12 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.formatDate(log_r12.timestamp));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r12.keyLabel);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", ctx_r1.getMethodClass(log_r12.method));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r12.method, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(log_r12.endpoint);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", ctx_r1.getStatusClass(log_r12.statusCode));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", log_r12.statusCode, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("", log_r12.responseTime, "ms");
} }
function APIUsagePanelComponent_Conditional_3_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 100)(1, "div", 47)(2, "div", 81)(3, "span", 82);
    i0.ɵɵtext(4, "Time");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 83);
    i0.ɵɵtext(6, "API Key");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "span", 84);
    i0.ɵɵtext(8, "Method");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "span", 85);
    i0.ɵɵtext(10, "Endpoint");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "span", 86);
    i0.ɵɵtext(12, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "span", 87);
    i0.ɵɵtext(14, "Duration");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(15, "div", 101);
    i0.ɵɵrepeaterCreate(16, APIUsagePanelComponent_Conditional_3_Conditional_12_For_17_Template, 14, 8, "div", 89, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(16);
    i0.ɵɵrepeater(ctx_r1.RecentLogs);
} }
function APIUsagePanelComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "mj-window", 92);
    i0.ɵɵlistener("Close", function APIUsagePanelComponent_Conditional_3_Template_mj_window_Close_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.closeLogsPanel()); });
    i0.ɵɵelementStart(1, "mj-window-titlebar")(2, "div", 93);
    i0.ɵɵelement(3, "i", 94);
    i0.ɵɵelementStart(4, "span");
    i0.ɵɵtext(5, "Request Details");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(6, APIUsagePanelComponent_Conditional_3_Conditional_6_Template, 2, 1, "span", 95);
    i0.ɵɵconditionalCreate(7, APIUsagePanelComponent_Conditional_3_Conditional_7_Template, 2, 1, "span", 95);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "button", 96);
    i0.ɵɵlistener("click", function APIUsagePanelComponent_Conditional_3_Template_button_click_8_listener() { i0.ɵɵrestoreView(_r11); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.closeLogsPanel()); });
    i0.ɵɵelement(9, "i", 97);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(10, "div", 98);
    i0.ɵɵconditionalCreate(11, APIUsagePanelComponent_Conditional_3_Conditional_11_Template, 1, 0, "mj-loading", 99);
    i0.ɵɵconditionalCreate(12, APIUsagePanelComponent_Conditional_3_Conditional_12_Template, 18, 0, "div", 100);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("Width", 800)("MinWidth", 600)("Height", 500)("MinHeight", 400)("Resizable", true)("Draggable", true)("Top", 80)("Visible", true);
    i0.ɵɵadvance(6);
    i0.ɵɵconditional(ctx_r1.LogsFilter.endpoint ? 6 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.LogsFilter.keyId ? 7 : -1);
    i0.ɵɵadvance(4);
    i0.ɵɵconditional(ctx_r1.IsLoadingLogs ? 11 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(!ctx_r1.IsLoadingLogs ? 12 : -1);
} }
/**
 * API Usage Analytics Panel Component
 * Comprehensive usage statistics and drill-down capabilities
 */
export class APIUsagePanelComponent extends BaseAngularComponent {
    get md() { return this.ProviderToUse; }
    cdr;
    // Loading states
    IsLoading = true;
    IsLoadingLogs = false;
    // Time range filter
    TimeRange = 'week';
    // Summary KPIs
    TotalRequests = 0;
    TotalErrors = 0;
    AvgResponseTime = 0;
    SuccessRate = 0;
    UniqueKeys = 0;
    UniqueEndpoints = 0;
    // Trend data (vs previous period)
    RequestsTrend = 0;
    ErrorsTrend = 0;
    ResponseTimeTrend = 0;
    // Chart data
    TimeBuckets = [];
    MaxRequests = 0;
    MaxErrors = 0;
    // Breakdown data
    TopEndpoints = [];
    TopKeys = [];
    StatusGroups = [];
    // Recent logs
    RecentLogs = [];
    ShowLogsPanel = false;
    LogsFilter = {};
    // Key map for labels
    KeyMap = new Map();
    // Expose Math for template
    Math = Math;
    constructor(cdr) {
        super();
        this.cdr = cdr;
    }
    async ngOnInit() {
        await this.loadData();
    }
    /**
     * Load all usage data
     */
    async loadData() {
        this.IsLoading = true;
        try {
            // Load keys for label lookup
            await this.loadKeys();
            // Load usage data
            await this.loadUsageStats();
        }
        catch (error) {
            console.error('Error loading usage data:', error);
        }
        finally {
            this.IsLoading = false;
            this.cdr.markForCheck();
        }
    }
    /**
     * Load API keys for label lookup
     */
    async loadKeys() {
        const rv = RunView.FromMetadataProvider(this.ProviderToUse);
        const result = await rv.RunView({
            EntityName: 'MJ: API Keys',
            Fields: ['ID', 'Label'],
            ResultType: 'simple'
        });
        if (result.Success) {
            for (const key of result.Results) {
                this.KeyMap.set(key.ID, key.Label);
            }
        }
    }
    /**
     * Load usage statistics based on time range
     */
    async loadUsageStats() {
        const rv = RunView.FromMetadataProvider(this.ProviderToUse);
        const filter = this.getTimeFilter();
        const result = await rv.RunView({
            EntityName: 'MJ: API Key Usage Logs',
            ExtraFilter: filter,
            OrderBy: '__mj_CreatedAt DESC',
            MaxRows: 5000,
            ResultType: 'entity_object'
        });
        if (result.Success) {
            const logs = result.Results;
            this.calculateSummaryKPIs(logs);
            this.buildTimeBuckets(logs);
            this.buildEndpointStats(logs);
            this.buildKeyStats(logs);
            this.buildStatusGroups(logs);
            this.RecentLogs = logs.slice(0, 20).map(log => this.mapLogToItem(log));
        }
    }
    /**
     * Get time filter for RunView based on selected range
     */
    getTimeFilter() {
        const now = new Date();
        let startDate;
        switch (this.TimeRange) {
            case 'day':
                startDate = new Date(now.getTime() - 24 * 60 * 60 * 1000);
                break;
            case 'week':
                startDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
                break;
            case 'month':
                startDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
                break;
            case 'all':
            default:
                return '';
        }
        return `__mj_CreatedAt >= '${startDate.toISOString()}'`;
    }
    /**
     * Calculate summary KPIs
     */
    calculateSummaryKPIs(logs) {
        this.TotalRequests = logs.length;
        // Count errors (4xx and 5xx status codes)
        this.TotalErrors = logs.filter(l => l.StatusCode >= 400).length;
        // Calculate average response time
        const totalResponseTime = logs.reduce((sum, l) => sum + (l.ResponseTimeMs || 0), 0);
        this.AvgResponseTime = this.TotalRequests > 0
            ? Math.round(totalResponseTime / this.TotalRequests)
            : 0;
        // Success rate
        this.SuccessRate = this.TotalRequests > 0
            ? Math.round(((this.TotalRequests - this.TotalErrors) / this.TotalRequests) * 100)
            : 100;
        // Unique counts
        const keySet = new Set(logs.map(l => l.APIKeyID));
        const endpointSet = new Set(logs.map(l => l.Endpoint));
        this.UniqueKeys = keySet.size;
        this.UniqueEndpoints = endpointSet.size;
    }
    /**
     * Build time buckets for chart
     */
    buildTimeBuckets(logs) {
        const bucketCount = this.TimeRange === 'day' ? 24 : this.TimeRange === 'week' ? 7 : 30;
        const bucketDuration = this.TimeRange === 'day' ? 60 * 60 * 1000 : 24 * 60 * 60 * 1000;
        const now = new Date();
        const buckets = [];
        for (let i = bucketCount - 1; i >= 0; i--) {
            const bucketDate = new Date(now.getTime() - i * bucketDuration);
            const bucketLogs = logs.filter(l => {
                const logDate = new Date(l.__mj_CreatedAt);
                const nextBucket = new Date(bucketDate.getTime() + bucketDuration);
                return logDate >= bucketDate && logDate < nextBucket;
            });
            const errors = bucketLogs.filter(l => l.StatusCode >= 400).length;
            const totalTime = bucketLogs.reduce((sum, l) => sum + (l.ResponseTimeMs || 0), 0);
            buckets.push({
                label: this.formatBucketLabel(bucketDate),
                date: bucketDate,
                requests: bucketLogs.length,
                errors,
                avgResponseTime: bucketLogs.length > 0 ? Math.round(totalTime / bucketLogs.length) : 0
            });
        }
        this.TimeBuckets = buckets;
        this.MaxRequests = Math.max(...buckets.map(b => b.requests), 1);
        this.MaxErrors = Math.max(...buckets.map(b => b.errors), 1);
    }
    /**
     * Format bucket label based on time range
     */
    formatBucketLabel(date) {
        if (this.TimeRange === 'day') {
            return date.toLocaleTimeString('en-US', { hour: 'numeric' });
        }
        return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
    }
    /**
     * Build endpoint statistics
     */
    buildEndpointStats(logs) {
        const endpointMap = new Map();
        for (const log of logs) {
            const key = `${log.Method}:${log.Endpoint}`;
            const existing = endpointMap.get(key);
            if (existing) {
                existing.requests++;
                existing.totalTime += log.ResponseTimeMs || 0;
                if (log.StatusCode >= 400)
                    existing.errors++;
            }
            else {
                endpointMap.set(key, {
                    endpoint: log.Endpoint,
                    method: log.Method,
                    requests: 1,
                    totalTime: log.ResponseTimeMs || 0,
                    errors: log.StatusCode >= 400 ? 1 : 0
                });
            }
        }
        this.TopEndpoints = Array.from(endpointMap.values())
            .map(e => ({
            endpoint: e.endpoint,
            method: e.method,
            requests: e.requests,
            avgResponseTime: Math.round(e.totalTime / e.requests),
            errorRate: Math.round((e.errors / e.requests) * 100)
        }))
            .sort((a, b) => b.requests - a.requests)
            .slice(0, 10);
    }
    /**
     * Build key statistics
     */
    buildKeyStats(logs) {
        const keyMap = new Map();
        for (const log of logs) {
            const existing = keyMap.get(log.APIKeyID);
            const logDate = new Date(log.__mj_CreatedAt);
            if (existing) {
                existing.requests++;
                if (!existing.lastUsed || logDate > existing.lastUsed) {
                    existing.lastUsed = logDate;
                }
            }
            else {
                keyMap.set(log.APIKeyID, {
                    requests: 1,
                    lastUsed: logDate
                });
            }
        }
        this.TopKeys = Array.from(keyMap.entries())
            .map(([keyId, stats]) => ({
            keyId,
            label: this.KeyMap.get(keyId) || 'Unknown Key',
            requests: stats.requests,
            lastUsed: stats.lastUsed
        }))
            .sort((a, b) => b.requests - a.requests)
            .slice(0, 10);
    }
    /**
     * Build status code groups
     */
    buildStatusGroups(logs) {
        const groups = {
            '2xx': { count: 0, label: 'Success (2xx)', color: '#10b981' },
            '3xx': { count: 0, label: 'Redirect (3xx)', color: '#3b82f6' },
            '4xx': { count: 0, label: 'Client Error (4xx)', color: '#f59e0b' },
            '5xx': { count: 0, label: 'Server Error (5xx)', color: '#ef4444' }
        };
        for (const log of logs) {
            const code = Math.floor(log.StatusCode / 100);
            const key = `${code}xx`;
            if (groups[key]) {
                groups[key].count++;
            }
        }
        this.StatusGroups = Object.entries(groups)
            .filter(([_, v]) => v.count > 0)
            .map(([code, v]) => ({
            code,
            label: v.label,
            count: v.count,
            percentage: this.TotalRequests > 0 ? Math.round((v.count / this.TotalRequests) * 100) : 0,
            color: v.color
        }));
    }
    /**
     * Map log entity to display item
     */
    mapLogToItem(log) {
        return {
            id: log.ID,
            timestamp: new Date(log.__mj_CreatedAt),
            endpoint: log.Endpoint,
            method: log.Method,
            statusCode: log.StatusCode,
            responseTime: log.ResponseTimeMs || 0,
            keyLabel: this.KeyMap.get(log.APIKeyID) || 'Unknown',
            keyId: log.APIKeyID
        };
    }
    /**
     * Change time range and reload
     */
    async setTimeRange(range) {
        this.TimeRange = range;
        await this.loadData();
    }
    /**
     * Get bar height percentage for chart
     */
    getBarHeight(value) {
        if (this.MaxRequests === 0)
            return 0;
        return Math.max(2, (value / this.MaxRequests) * 100);
    }
    /**
     * Get error bar height for chart
     */
    getErrorBarHeight(bucket) {
        if (bucket.requests === 0)
            return 0;
        return (bucket.errors / bucket.requests) * 100;
    }
    /**
     * Drill down into endpoint
     */
    drillDownEndpoint(endpoint) {
        this.LogsFilter = { endpoint: endpoint.endpoint };
        this.loadFilteredLogs();
        this.ShowLogsPanel = true;
    }
    /**
     * Drill down into key
     */
    drillDownKey(key) {
        this.LogsFilter = { keyId: key.keyId };
        this.loadFilteredLogs();
        this.ShowLogsPanel = true;
    }
    /**
     * Load filtered logs for drill-down
     */
    async loadFilteredLogs() {
        this.IsLoadingLogs = true;
        const rv = RunView.FromMetadataProvider(this.ProviderToUse);
        let filter = this.getTimeFilter();
        if (this.LogsFilter.endpoint) {
            filter += filter ? ' AND ' : '';
            filter += `Endpoint = '${this.LogsFilter.endpoint}'`;
        }
        if (this.LogsFilter.keyId) {
            filter += filter ? ' AND ' : '';
            filter += `APIKeyID = '${this.LogsFilter.keyId}'`;
        }
        const result = await rv.RunView({
            EntityName: 'MJ: API Key Usage Logs',
            ExtraFilter: filter,
            OrderBy: '__mj_CreatedAt DESC',
            MaxRows: 100,
            ResultType: 'entity_object'
        });
        if (result.Success) {
            this.RecentLogs = result.Results.map(log => this.mapLogToItem(log));
        }
        this.IsLoadingLogs = false;
        this.cdr.markForCheck();
    }
    /**
     * Close logs panel
     */
    closeLogsPanel() {
        this.ShowLogsPanel = false;
        this.LogsFilter = {};
    }
    /**
     * Get status class for HTTP status code
     */
    getStatusClass(statusCode) {
        if (statusCode >= 200 && statusCode < 300)
            return 'status-success';
        if (statusCode >= 300 && statusCode < 400)
            return 'status-info';
        if (statusCode >= 400 && statusCode < 500)
            return 'status-warning';
        if (statusCode >= 500)
            return 'status-error';
        return '';
    }
    /**
     * Get method badge class
     */
    getMethodClass(method) {
        const m = method.toUpperCase();
        if (m === 'GET')
            return 'method-get';
        if (m === 'POST')
            return 'method-post';
        if (m === 'PUT' || m === 'PATCH')
            return 'method-put';
        if (m === 'DELETE')
            return 'method-delete';
        return 'method-other';
    }
    /**
     * Format date for display
     */
    formatDate(date) {
        if (!date)
            return 'Never';
        const d = new Date(date);
        const now = new Date();
        const diff = now.getTime() - d.getTime();
        const minutes = Math.floor(diff / 60000);
        const hours = Math.floor(diff / 3600000);
        if (minutes < 1)
            return 'Just now';
        if (minutes < 60)
            return `${minutes}m ago`;
        if (hours < 24)
            return `${hours}h ago`;
        return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
    }
    /**
     * Format number with K/M suffix
     */
    formatNumber(num) {
        if (num >= 1000000)
            return (num / 1000000).toFixed(1) + 'M';
        if (num >= 1000)
            return (num / 1000).toFixed(1) + 'K';
        return num.toString();
    }
    static ɵfac = function APIUsagePanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || APIUsagePanelComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: APIUsagePanelComponent, selectors: [["mj-api-usage-panel"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 3, consts: [[1, "usage-panel"], ["text", "Loading usage analytics..."], [3, "Width", "MinWidth", "Height", "MinHeight", "Resizable", "Draggable", "Top", "Visible"], [1, "panel-header"], [1, "header-left"], [1, "panel-title"], [1, "fa-solid", "fa-chart-line"], [1, "panel-subtitle"], [1, "time-filters"], [1, "time-btn", 3, "click"], [1, "kpi-grid"], [1, "kpi-card"], [1, "kpi-icon", "requests"], [1, "fa-solid", "fa-arrow-right-arrow-left"], [1, "kpi-content"], [1, "kpi-value"], [1, "kpi-label"], [1, "kpi-icon", "success-rate"], [1, "fa-solid", "fa-check-circle"], [1, "kpi-icon", "errors"], [1, "fa-solid", "fa-circle-exclamation"], [1, "kpi-icon", "response-time"], [1, "fa-solid", "fa-gauge-high"], [1, "kpi-icon", "keys"], [1, "fa-solid", "fa-key"], [1, "kpi-icon", "endpoints"], [1, "fa-solid", "fa-code-branch"], [1, "chart-section"], [1, "chart-header"], [1, "chart-legend"], [1, "legend-item"], [1, "legend-color", "requests"], [1, "legend-color", "errors"], [1, "chart-container"], [1, "empty-chart"], [1, "breakdown-grid"], [1, "breakdown-card"], [1, "breakdown-header"], [1, "breakdown-content"], [1, "endpoint-list"], [1, "empty-state"], [1, "key-list"], [1, "fa-solid", "fa-circle-half-stroke"], [1, "status-distribution"], [1, "logs-section"], [1, "logs-header"], [1, "fa-solid", "fa-list"], [1, "logs-table"], [1, "empty-state", "large"], [1, "chart-bars"], [1, "bar-group", 3, "title"], [1, "chart-y-axis"], [1, "bar-wrapper"], [1, "bar", "requests-bar"], [1, "bar", "errors-bar", 3, "height"], [1, "bar-label"], [1, "bar", "errors-bar"], [1, "fa-solid", "fa-chart-area"], [1, "endpoint-item"], [1, "endpoint-item", 3, "click"], [1, "endpoint-info"], [1, "method-badge", 3, "ngClass"], [1, "endpoint-path"], [1, "endpoint-stats"], [1, "endpoint-requests"], [1, "endpoint-time"], [1, "endpoint-error"], [1, "key-item"], [1, "key-item", 3, "click"], [1, "key-info"], [1, "key-label"], [1, "key-last-used"], [1, "key-requests"], [1, "status-bar"], [1, "status-segment", 3, "width", "backgroundColor", "title"], [1, "status-legend"], [1, "status-legend-item"], [1, "status-segment", 3, "title"], [1, "status-color"], [1, "status-label"], [1, "status-count"], [1, "logs-table-header"], [1, "col-time"], [1, "col-key"], [1, "col-method"], [1, "col-endpoint"], [1, "col-status"], [1, "col-duration"], [1, "logs-table-body"], [1, "log-row"], [1, "col-status", 3, "ngClass"], [1, "fa-solid", "fa-inbox"], [3, "Close", "Width", "MinWidth", "Height", "MinHeight", "Resizable", "Draggable", "Top", "Visible"], [1, "drilldown-title"], [1, "fa-solid", "fa-magnifying-glass-chart"], [1, "filter-badge"], ["mjButton", "", "variant", "flat", 1, "window-close-btn", 3, "click"], [1, "fa-solid", "fa-times"], [1, "drilldown-content"], ["text", "Loading requests..."], [1, "drilldown-logs"], [1, "logs-table-body", "scrollable"]], template: function APIUsagePanelComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵconditionalCreate(1, APIUsagePanelComponent_Conditional_1_Template, 1, 0, "mj-loading", 1);
            i0.ɵɵconditionalCreate(2, APIUsagePanelComponent_Conditional_2_Template, 110, 28);
            i0.ɵɵconditionalCreate(3, APIUsagePanelComponent_Conditional_3_Template, 13, 12, "mj-window", 2);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.IsLoading ? 1 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(!ctx.IsLoading ? 2 : -1);
            i0.ɵɵadvance();
            i0.ɵɵconditional(ctx.ShowLogsPanel ? 3 : -1);
        } }, dependencies: [i1.NgClass, i2.MJButtonDirective, i2.MJWindowComponent, i2.MJWindowTitlebarComponent, i3.LoadingComponent], styles: [".usage-panel[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 24px;\n    padding: 24px;\n    background: var(--mj-bg-page);\n    min-height: 100%;\n}\n\n\n\n.panel-header[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: space-between;\n    align-items: flex-start;\n    gap: 24px;\n    flex-wrap: wrap;\n}\n\n.header-left[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n}\n\n.panel-title[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin: 0;\n    font-size: 24px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n}\n\n.panel-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-color-indigo-500);\n}\n\n.panel-subtitle[_ngcontent-%COMP%] {\n    margin: 0;\n    font-size: 14px;\n    color: var(--mj-text-secondary);\n}\n\n\n\n.time-filters[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 4px;\n    background: var(--mj-bg-surface);\n    padding: 4px;\n    border-radius: 10px;\n    box-shadow: var(--mj-shadow-sm);\n}\n\n.time-btn[_ngcontent-%COMP%] {\n    padding: 8px 16px;\n    background: transparent;\n    border: none;\n    border-radius: 8px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.time-btn[_ngcontent-%COMP%]:hover {\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-sunken);\n}\n\n.time-btn.active[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-indigo-500) 0%, var(--mj-color-indigo-600) 100%);\n    color: var(--mj-text-inverse);\n    box-shadow: 0 2px 8px color-mix(in srgb, var(--mj-color-indigo-500) 30%, transparent);\n}\n\n\n\n.kpi-grid[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(6, 1fr);\n    gap: 16px;\n}\n\n.kpi-card[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 14px;\n    padding: 18px 20px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    transition: all 0.2s ease;\n}\n\n.kpi-card[_ngcontent-%COMP%]:hover {\n    box-shadow: var(--mj-shadow-lg);\n    transform: translateY(-2px);\n}\n\n.kpi-card.success[_ngcontent-%COMP%] {\n    background: var(--mj-status-success-bg);\n}\n\n.kpi-card.warning[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-brand-100) 0%, var(--mj-color-brand-200) 100%);\n}\n\n.kpi-icon[_ngcontent-%COMP%] {\n    width: 44px;\n    height: 44px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 10px;\n    font-size: 18px;\n}\n\n.kpi-icon.requests[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-info-100) 0%, var(--mj-color-info-100) 100%);\n    color: var(--mj-color-info-600);\n}\n\n.kpi-icon.success-rate[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-success-100) 0%, var(--mj-color-success-200) 100%);\n    color: var(--mj-color-success-600);\n}\n\n.kpi-icon.errors[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-error-100) 0%, var(--mj-color-error-200) 100%);\n    color: var(--mj-color-error-600);\n}\n\n.kpi-icon.response-time[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-indigo-100) 0%, var(--mj-color-indigo-200) 100%);\n    color: var(--mj-color-indigo-600);\n}\n\n.kpi-icon.keys[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-brand-100) 0%, var(--mj-color-brand-200) 100%);\n    color: var(--mj-brand-primary-hover);\n}\n\n.kpi-icon.endpoints[_ngcontent-%COMP%] {\n    background: linear-gradient(135deg, var(--mj-color-violet-50) 0%, var(--mj-color-violet-200) 100%);\n    color: var(--mj-brand-primary);\n}\n\n.kpi-content[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n}\n\n.kpi-value[_ngcontent-%COMP%] {\n    font-size: 22px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n}\n\n.kpi-label[_ngcontent-%COMP%] {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n}\n\n\n\n.chart-section[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    padding: 20px;\n    box-shadow: var(--mj-shadow-sm);\n}\n\n.chart-header[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    margin-bottom: 16px;\n}\n\n.chart-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n    margin: 0;\n    font-size: 16px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.chart-legend[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 16px;\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.requests[_ngcontent-%COMP%] {\n    background: var(--mj-color-indigo-500);\n}\n\n.legend-color.errors[_ngcontent-%COMP%] {\n    background: var(--mj-status-error);\n}\n\n.chart-container[_ngcontent-%COMP%] {\n    display: flex;\n    height: 200px;\n    gap: 8px;\n}\n\n.chart-bars[_ngcontent-%COMP%] {\n    flex: 1;\n    display: flex;\n    align-items: flex-end;\n    gap: 4px;\n    padding-bottom: 24px;\n}\n\n.bar-group[_ngcontent-%COMP%] {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    min-width: 0;\n}\n\n.bar-wrapper[_ngcontent-%COMP%] {\n    width: 100%;\n    height: 160px;\n    display: flex;\n    align-items: flex-end;\n    justify-content: center;\n}\n\n.bar[_ngcontent-%COMP%] {\n    width: 100%;\n    max-width: 32px;\n    border-radius: 4px 4px 0 0;\n    transition: all 0.3s ease;\n    position: relative;\n}\n\n.bar.requests-bar[_ngcontent-%COMP%] {\n    background: linear-gradient(180deg, var(--mj-color-indigo-500) 0%, var(--mj-color-indigo-400) 100%);\n}\n\n.bar.requests-bar[_ngcontent-%COMP%]:hover {\n    background: linear-gradient(180deg, var(--mj-color-indigo-600) 0%, var(--mj-color-indigo-500) 100%);\n}\n\n.bar.errors-bar[_ngcontent-%COMP%] {\n    position: absolute;\n    bottom: 0;\n    left: 0;\n    width: 100%;\n    background: var(--mj-status-error);\n    border-radius: 0;\n}\n\n.bar-label[_ngcontent-%COMP%] {\n    margin-top: 8px;\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    white-space: nowrap;\n    text-overflow: ellipsis;\n    overflow: hidden;\n    max-width: 100%;\n}\n\n.chart-y-axis[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    padding-bottom: 24px;\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    text-align: right;\n    min-width: 40px;\n}\n\n.empty-chart[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    height: 200px;\n    color: var(--mj-text-muted);\n}\n\n.empty-chart[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 32px;\n    margin-bottom: 8px;\n    opacity: 0.5;\n}\n\n\n\n.breakdown-grid[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: 1fr 1fr 1fr;\n    gap: 20px;\n}\n\n.breakdown-card[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    overflow: hidden;\n}\n\n.breakdown-header[_ngcontent-%COMP%] {\n    padding: 16px 20px;\n    background: var(--mj-bg-page);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.breakdown-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n    margin: 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.breakdown-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n}\n\n.breakdown-content[_ngcontent-%COMP%] {\n    padding: 12px;\n    max-height: 280px;\n    overflow-y: auto;\n}\n\n\n\n.endpoint-list[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.endpoint-item[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 10px 12px;\n    background: var(--mj-bg-page);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.endpoint-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.endpoint-info[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    min-width: 0;\n    flex: 1;\n}\n\n.method-badge[_ngcontent-%COMP%] {\n    padding: 2px 6px;\n    border-radius: 4px;\n    font-size: 10px;\n    font-weight: 600;\n    text-transform: uppercase;\n    flex-shrink: 0;\n}\n\n.method-get[_ngcontent-%COMP%] { background: var(--mj-status-info-bg); color: var(--mj-color-info-600); }\n.method-post[_ngcontent-%COMP%] { background: var(--mj-color-success-100); color: var(--mj-color-success-600); }\n.method-put[_ngcontent-%COMP%] { background: var(--mj-color-brand-100); color: var(--mj-brand-primary-hover); }\n.method-delete[_ngcontent-%COMP%] { background: var(--mj-color-error-100); color: var(--mj-color-error-600); }\n.method-other[_ngcontent-%COMP%] { background: var(--mj-bg-surface-sunken); color: var(--mj-text-secondary); }\n\n.endpoint-path[_ngcontent-%COMP%] {\n    font-size: 12px;\n    font-family: 'Fira Code', monospace;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.endpoint-stats[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    font-size: 11px;\n    flex-shrink: 0;\n}\n\n.endpoint-requests[_ngcontent-%COMP%] {\n    font-weight: 600;\n    color: var(--mj-color-indigo-500);\n}\n\n.endpoint-time[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n}\n\n.endpoint-error[_ngcontent-%COMP%] {\n    color: var(--mj-status-success);\n}\n\n.endpoint-error.has-errors[_ngcontent-%COMP%] {\n    color: var(--mj-status-error);\n    font-weight: 500;\n}\n\n\n\n.key-list[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.key-item[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 10px 12px;\n    background: var(--mj-bg-page);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.key-item[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.key-info[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n    min-width: 0;\n}\n\n.key-label[_ngcontent-%COMP%] {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.key-last-used[_ngcontent-%COMP%] {\n    font-size: 11px;\n    color: var(--mj-text-muted);\n}\n\n.key-requests[_ngcontent-%COMP%] {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-color-indigo-500);\n}\n\n\n\n.status-distribution[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 16px;\n}\n\n.status-bar[_ngcontent-%COMP%] {\n    display: flex;\n    height: 24px;\n    border-radius: 6px;\n    overflow: hidden;\n    background: var(--mj-bg-surface-sunken);\n}\n\n.status-segment[_ngcontent-%COMP%] {\n    transition: all 0.3s ease;\n}\n\n.status-segment[_ngcontent-%COMP%]:hover {\n    filter: brightness(1.1);\n}\n\n.status-legend[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.status-legend-item[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 12px;\n}\n\n.status-color[_ngcontent-%COMP%] {\n    width: 12px;\n    height: 12px;\n    border-radius: 3px;\n}\n\n.status-label[_ngcontent-%COMP%] {\n    flex: 1;\n    color: var(--mj-text-secondary);\n}\n\n.status-count[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n    font-weight: 500;\n}\n\n\n\n.logs-section[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    overflow: hidden;\n}\n\n.logs-header[_ngcontent-%COMP%] {\n    padding: 16px 20px;\n    background: var(--mj-bg-page);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.logs-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] {\n    margin: 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.logs-header[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n}\n\n.logs-table[_ngcontent-%COMP%] {\n    width: 100%;\n}\n\n.logs-table-header[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: 100px 120px 70px 1fr 70px 80px;\n    gap: 12px;\n    padding: 12px 20px;\n    background: var(--mj-bg-surface-sunken);\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n}\n\n.logs-table-body[_ngcontent-%COMP%] {\n    max-height: 320px;\n    overflow-y: auto;\n}\n\n.logs-table-body.scrollable[_ngcontent-%COMP%] {\n    max-height: 380px;\n}\n\n.log-row[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: 100px 120px 70px 1fr 70px 80px;\n    gap: 12px;\n    padding: 12px 20px;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n    font-size: 13px;\n    align-items: center;\n    transition: background 0.2s ease;\n}\n\n.log-row[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-page);\n}\n\n.col-time[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n    font-size: 12px;\n}\n\n.col-key[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n    font-weight: 500;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.col-endpoint[_ngcontent-%COMP%] {\n    font-family: 'Fira Code', monospace;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.col-status[_ngcontent-%COMP%] {\n    font-weight: 600;\n    text-align: center;\n}\n\n.col-status.status-success[_ngcontent-%COMP%] { color: var(--mj-status-success); }\n.col-status.status-info[_ngcontent-%COMP%] { color: var(--mj-status-info); }\n.col-status.status-warning[_ngcontent-%COMP%] { color: var(--mj-color-warning-500); }\n.col-status.status-error[_ngcontent-%COMP%] { color: var(--mj-status-error); }\n\n.col-duration[_ngcontent-%COMP%] {\n    color: var(--mj-text-secondary);\n    text-align: right;\n}\n\n\n\n.empty-state[_ngcontent-%COMP%] {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 32px 20px;\n    color: var(--mj-text-muted);\n    text-align: center;\n}\n\n.empty-state[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 32px;\n    margin-bottom: 8px;\n    opacity: 0.5;\n}\n\n.empty-state[_ngcontent-%COMP%]   span[_ngcontent-%COMP%] {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n}\n\n.empty-state.large[_ngcontent-%COMP%] {\n    padding: 48px 24px;\n}\n\n.empty-state.large[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    font-size: 48px;\n}\n\n.empty-state[_ngcontent-%COMP%]   p[_ngcontent-%COMP%] {\n    margin: 8px 0 0 0;\n    font-size: 12px;\n}\n\n\n\n.drilldown-title[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    font-weight: 600;\n    font-size: 15px;\n}\n\n.drilldown-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: var(--mj-color-indigo-500);\n}\n\n.filter-badge[_ngcontent-%COMP%] {\n    padding: 4px 10px;\n    background: var(--mj-color-indigo-100);\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 500;\n    color: var(--mj-color-indigo-600);\n}\n\n.window-close-btn[_ngcontent-%COMP%] {\n    margin-left: auto;\n    color: var(--mj-text-muted);\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 8px;\n}\n\n.window-close-btn[_ngcontent-%COMP%]:hover {\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-hover);\n}\n\n.drilldown-content[_ngcontent-%COMP%] {\n    height: 100%;\n    overflow: hidden;\n}\n\n.drilldown-logs[_ngcontent-%COMP%] {\n    height: 100%;\n}\n\n\n\n[_nghost-%COMP%]     mj-window .mj-window {\n    border-radius: 12px !important;\n    overflow: hidden;\n    box-shadow: var(--mj-shadow-2xl) !important;\n}\n\n[_nghost-%COMP%]     mj-window .mj-window-content {\n    padding: 0 !important;\n}\n\n[_nghost-%COMP%]     mj-window-titlebar {\n    padding: 16px 20px !important;\n    background: var(--mj-bg-page) !important;\n    border-bottom: 1px solid var(--mj-border-default) !important;\n}\n\n\n\n@media (max-width: 1400px) {\n    .kpi-grid[_ngcontent-%COMP%] {\n        grid-template-columns: repeat(3, 1fr);\n    }\n}\n\n@media (max-width: 1200px) {\n    .breakdown-grid[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr 1fr;\n    }\n}\n\n@media (max-width: 900px) {\n    .kpi-grid[_ngcontent-%COMP%] {\n        grid-template-columns: repeat(2, 1fr);\n    }\n\n    .breakdown-grid[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr;\n    }\n\n    .logs-table-header[_ngcontent-%COMP%], \n   .log-row[_ngcontent-%COMP%] {\n        grid-template-columns: 80px 100px 60px 1fr 60px;\n    }\n\n    .col-duration[_ngcontent-%COMP%] {\n        display: none;\n    }\n}\n\n@media (max-width: 600px) {\n    .panel-header[_ngcontent-%COMP%] {\n        flex-direction: column;\n    }\n\n    .time-filters[_ngcontent-%COMP%] {\n        width: 100%;\n        justify-content: center;\n    }\n\n    .kpi-grid[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr;\n    }\n\n    .logs-table-header[_ngcontent-%COMP%], \n   .log-row[_ngcontent-%COMP%] {\n        grid-template-columns: 1fr 60px;\n    }\n\n    .col-key[_ngcontent-%COMP%], \n   .col-method[_ngcontent-%COMP%], \n   .col-endpoint[_ngcontent-%COMP%] {\n        display: none;\n    }\n}"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(APIUsagePanelComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-api-usage-panel', template: "<div class=\"usage-panel\">\n  @if (IsLoading) {\n    <mj-loading text=\"Loading usage analytics...\"></mj-loading>\n  }\n\n  @if (!IsLoading) {\n    <!-- Header -->\n    <div class=\"panel-header\">\n      <div class=\"header-left\">\n        <h3 class=\"panel-title\">\n          <i class=\"fa-solid fa-chart-line\"></i>\n          API Usage Analytics\n        </h3>\n        <p class=\"panel-subtitle\">Monitor API key usage, performance, and trends</p>\n      </div>\n      <div class=\"time-filters\">\n        <button class=\"time-btn\" [class.active]=\"TimeRange === 'day'\"\n        (click)=\"setTimeRange('day')\">24 Hours</button>\n        <button class=\"time-btn\" [class.active]=\"TimeRange === 'week'\"\n        (click)=\"setTimeRange('week')\">7 Days</button>\n        <button class=\"time-btn\" [class.active]=\"TimeRange === 'month'\"\n        (click)=\"setTimeRange('month')\">30 Days</button>\n        <button class=\"time-btn\" [class.active]=\"TimeRange === 'all'\"\n        (click)=\"setTimeRange('all')\">All Time</button>\n      </div>\n    </div>\n    <!-- Summary KPIs -->\n    <div class=\"kpi-grid\">\n      <div class=\"kpi-card\">\n        <div class=\"kpi-icon requests\">\n          <i class=\"fa-solid fa-arrow-right-arrow-left\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{formatNumber(TotalRequests)}}</div>\n          <div class=\"kpi-label\">Total Requests</div>\n        </div>\n      </div>\n      <div class=\"kpi-card\" [class.success]=\"SuccessRate >= 95\">\n        <div class=\"kpi-icon success-rate\">\n          <i class=\"fa-solid fa-check-circle\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{SuccessRate}}%</div>\n          <div class=\"kpi-label\">Success Rate</div>\n        </div>\n      </div>\n      <div class=\"kpi-card\" [class.warning]=\"TotalErrors > 0\">\n        <div class=\"kpi-icon errors\">\n          <i class=\"fa-solid fa-circle-exclamation\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{formatNumber(TotalErrors)}}</div>\n          <div class=\"kpi-label\">Errors</div>\n        </div>\n      </div>\n      <div class=\"kpi-card\">\n        <div class=\"kpi-icon response-time\">\n          <i class=\"fa-solid fa-gauge-high\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{AvgResponseTime}}ms</div>\n          <div class=\"kpi-label\">Avg Response Time</div>\n        </div>\n      </div>\n      <div class=\"kpi-card\">\n        <div class=\"kpi-icon keys\">\n          <i class=\"fa-solid fa-key\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{UniqueKeys}}</div>\n          <div class=\"kpi-label\">Active Keys</div>\n        </div>\n      </div>\n      <div class=\"kpi-card\">\n        <div class=\"kpi-icon endpoints\">\n          <i class=\"fa-solid fa-code-branch\"></i>\n        </div>\n        <div class=\"kpi-content\">\n          <div class=\"kpi-value\">{{UniqueEndpoints}}</div>\n          <div class=\"kpi-label\">Unique Endpoints</div>\n        </div>\n      </div>\n    </div>\n    <!-- Usage Chart -->\n    <div class=\"chart-section\">\n      <div class=\"chart-header\">\n        <h4>Request Volume</h4>\n        <div class=\"chart-legend\">\n          <span class=\"legend-item\">\n            <span class=\"legend-color requests\"></span> Requests\n          </span>\n          <span class=\"legend-item\">\n            <span class=\"legend-color errors\"></span> Errors\n          </span>\n        </div>\n      </div>\n      @if (TimeBuckets.length > 0) {\n        <div class=\"chart-container\">\n          <div class=\"chart-bars\">\n            @for (bucket of TimeBuckets; track bucket) {\n              <div class=\"bar-group\" [title]=\"bucket.requests + ' requests, ' + bucket.errors + ' errors'\">\n                <div class=\"bar-wrapper\">\n                  <div class=\"bar requests-bar\"\n                    [style.height.%]=\"getBarHeight(bucket.requests)\">\n                    @if (bucket.errors > 0) {\n                      <div class=\"bar errors-bar\"\n                        [style.height.%]=\"getErrorBarHeight(bucket)\"\n                        >\n                      </div>\n                    }\n                  </div>\n                </div>\n                <div class=\"bar-label\">{{bucket.label}}</div>\n              </div>\n            }\n          </div>\n          <div class=\"chart-y-axis\">\n            <span>{{formatNumber(MaxRequests)}}</span>\n            <span>{{formatNumber(Math.round(MaxRequests / 2))}}</span>\n            <span>0</span>\n          </div>\n        </div>\n      }\n      @if (TimeBuckets.length === 0) {\n        <div class=\"empty-chart\">\n          <i class=\"fa-solid fa-chart-area\"></i>\n          <span>No usage data available</span>\n        </div>\n      }\n    </div>\n    <!-- Breakdown Grid -->\n    <div class=\"breakdown-grid\">\n      <!-- Top Endpoints -->\n      <div class=\"breakdown-card\">\n        <div class=\"breakdown-header\">\n          <h4>\n            <i class=\"fa-solid fa-code-branch\"></i>\n            Top Endpoints\n          </h4>\n        </div>\n        <div class=\"breakdown-content\">\n          @if (TopEndpoints.length > 0) {\n            <div class=\"endpoint-list\">\n              @for (ep of TopEndpoints; track ep) {\n                <div class=\"endpoint-item\"\n                  (click)=\"drillDownEndpoint(ep)\">\n                  <div class=\"endpoint-info\">\n                    <span class=\"method-badge\" [ngClass]=\"getMethodClass(ep.method)\">\n                      {{ep.method}}\n                    </span>\n                    <span class=\"endpoint-path\">{{ep.endpoint}}</span>\n                  </div>\n                  <div class=\"endpoint-stats\">\n                    <span class=\"endpoint-requests\">{{formatNumber(ep.requests)}}</span>\n                    <span class=\"endpoint-time\">{{ep.avgResponseTime}}ms</span>\n                    <span class=\"endpoint-error\" [class.has-errors]=\"ep.errorRate > 0\">\n                      {{ep.errorRate}}% err\n                    </span>\n                  </div>\n                </div>\n              }\n            </div>\n          }\n          @if (TopEndpoints.length === 0) {\n            <div class=\"empty-state\">\n              <i class=\"fa-solid fa-code-branch\"></i>\n              <span>No endpoint data</span>\n            </div>\n          }\n        </div>\n      </div>\n      <!-- Top Keys -->\n      <div class=\"breakdown-card\">\n        <div class=\"breakdown-header\">\n          <h4>\n            <i class=\"fa-solid fa-key\"></i>\n            Most Active Keys\n          </h4>\n        </div>\n        <div class=\"breakdown-content\">\n          @if (TopKeys.length > 0) {\n            <div class=\"key-list\">\n              @for (key of TopKeys; track key) {\n                <div class=\"key-item\"\n                  (click)=\"drillDownKey(key)\">\n                  <div class=\"key-info\">\n                    <span class=\"key-label\">{{key.label}}</span>\n                    <span class=\"key-last-used\">{{formatDate(key.lastUsed)}}</span>\n                  </div>\n                  <div class=\"key-requests\">{{formatNumber(key.requests)}}</div>\n                </div>\n              }\n            </div>\n          }\n          @if (TopKeys.length === 0) {\n            <div class=\"empty-state\">\n              <i class=\"fa-solid fa-key\"></i>\n              <span>No key data</span>\n            </div>\n          }\n        </div>\n      </div>\n      <!-- Status Distribution -->\n      <div class=\"breakdown-card\">\n        <div class=\"breakdown-header\">\n          <h4>\n            <i class=\"fa-solid fa-circle-half-stroke\"></i>\n            Status Distribution\n          </h4>\n        </div>\n        <div class=\"breakdown-content\">\n          @if (StatusGroups.length > 0) {\n            <div class=\"status-distribution\">\n              <div class=\"status-bar\">\n                @for (group of StatusGroups; track group) {\n                  <div class=\"status-segment\"\n                    [style.width.%]=\"group.percentage\"\n                    [style.backgroundColor]=\"group.color\"\n                    [title]=\"group.label + ': ' + group.count + ' (' + group.percentage + '%)'\">\n                  </div>\n                }\n              </div>\n              <div class=\"status-legend\">\n                @for (group of StatusGroups; track group) {\n                  <div class=\"status-legend-item\">\n                    <span class=\"status-color\" [style.backgroundColor]=\"group.color\"></span>\n                    <span class=\"status-label\">{{group.label}}</span>\n                    <span class=\"status-count\">{{formatNumber(group.count)}} ({{group.percentage}}%)</span>\n                  </div>\n                }\n              </div>\n            </div>\n          }\n          @if (StatusGroups.length === 0) {\n            <div class=\"empty-state\">\n              <i class=\"fa-solid fa-circle-half-stroke\"></i>\n              <span>No status data</span>\n            </div>\n          }\n        </div>\n      </div>\n    </div>\n    <!-- Recent Logs -->\n    <div class=\"logs-section\">\n      <div class=\"logs-header\">\n        <h4>\n          <i class=\"fa-solid fa-list\"></i>\n          Recent Requests\n        </h4>\n      </div>\n      @if (RecentLogs.length > 0) {\n        <div class=\"logs-table\">\n          <div class=\"logs-table-header\">\n            <span class=\"col-time\">Time</span>\n            <span class=\"col-key\">API Key</span>\n            <span class=\"col-method\">Method</span>\n            <span class=\"col-endpoint\">Endpoint</span>\n            <span class=\"col-status\">Status</span>\n            <span class=\"col-duration\">Duration</span>\n          </div>\n          <div class=\"logs-table-body\">\n            @for (log of RecentLogs; track log) {\n              <div class=\"log-row\">\n                <span class=\"col-time\">{{formatDate(log.timestamp)}}</span>\n                <span class=\"col-key\">{{log.keyLabel}}</span>\n                <span class=\"col-method\">\n                  <span class=\"method-badge\" [ngClass]=\"getMethodClass(log.method)\">\n                    {{log.method}}\n                  </span>\n                </span>\n                <span class=\"col-endpoint\">{{log.endpoint}}</span>\n                <span class=\"col-status\" [ngClass]=\"getStatusClass(log.statusCode)\">\n                  {{log.statusCode}}\n                </span>\n                <span class=\"col-duration\">{{log.responseTime}}ms</span>\n              </div>\n            }\n          </div>\n        </div>\n      }\n      @if (RecentLogs.length === 0) {\n        <div class=\"empty-state large\">\n          <i class=\"fa-solid fa-inbox\"></i>\n          <span>No requests logged yet</span>\n          <p>API usage will appear here once keys are used</p>\n        </div>\n      }\n    </div>\n  }\n\n  <!-- Drill-down Panel -->\n  @if (ShowLogsPanel) {\n    <mj-window\n      [Width]=\"800\"\n      [MinWidth]=\"600\"\n      [Height]=\"500\"\n      [MinHeight]=\"400\"\n      [Resizable]=\"true\"\n      [Draggable]=\"true\"\n      [Top]=\"80\"\n      [Visible]=\"true\"\n      (Close)=\"closeLogsPanel()\">\n      <mj-window-titlebar>\n        <div class=\"drilldown-title\">\n          <i class=\"fa-solid fa-magnifying-glass-chart\"></i>\n          <span>Request Details</span>\n          @if (LogsFilter.endpoint) {\n            <span class=\"filter-badge\">\n              {{LogsFilter.endpoint}}\n            </span>\n          }\n          @if (LogsFilter.keyId) {\n            <span class=\"filter-badge\">\n              Key: {{KeyMap.get(LogsFilter.keyId) || 'Unknown'}}\n            </span>\n          }\n        </div>\n        <button mjButton variant=\"flat\" (click)=\"closeLogsPanel()\" class=\"window-close-btn\">\n          <i class=\"fa-solid fa-times\"></i>\n        </button>\n      </mj-window-titlebar>\n      <div class=\"drilldown-content\">\n        @if (IsLoadingLogs) {\n          <mj-loading text=\"Loading requests...\"></mj-loading>\n        }\n        @if (!IsLoadingLogs) {\n          <div class=\"drilldown-logs\">\n            <div class=\"logs-table\">\n              <div class=\"logs-table-header\">\n                <span class=\"col-time\">Time</span>\n                <span class=\"col-key\">API Key</span>\n                <span class=\"col-method\">Method</span>\n                <span class=\"col-endpoint\">Endpoint</span>\n                <span class=\"col-status\">Status</span>\n                <span class=\"col-duration\">Duration</span>\n              </div>\n              <div class=\"logs-table-body scrollable\">\n                @for (log of RecentLogs; track log) {\n                  <div class=\"log-row\">\n                    <span class=\"col-time\">{{formatDate(log.timestamp)}}</span>\n                    <span class=\"col-key\">{{log.keyLabel}}</span>\n                    <span class=\"col-method\">\n                      <span class=\"method-badge\" [ngClass]=\"getMethodClass(log.method)\">\n                        {{log.method}}\n                      </span>\n                    </span>\n                    <span class=\"col-endpoint\">{{log.endpoint}}</span>\n                    <span class=\"col-status\" [ngClass]=\"getStatusClass(log.statusCode)\">\n                      {{log.statusCode}}\n                    </span>\n                    <span class=\"col-duration\">{{log.responseTime}}ms</span>\n                  </div>\n                }\n              </div>\n            </div>\n          </div>\n        }\n      </div>\n    </mj-window>\n  }\n</div>\n", styles: [".usage-panel {\n    display: flex;\n    flex-direction: column;\n    gap: 24px;\n    padding: 24px;\n    background: var(--mj-bg-page);\n    min-height: 100%;\n}\n\n/* Header */\n.panel-header {\n    display: flex;\n    justify-content: space-between;\n    align-items: flex-start;\n    gap: 24px;\n    flex-wrap: wrap;\n}\n\n.header-left {\n    display: flex;\n    flex-direction: column;\n    gap: 4px;\n}\n\n.panel-title {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin: 0;\n    font-size: 24px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n}\n\n.panel-title i {\n    color: var(--mj-color-indigo-500);\n}\n\n.panel-subtitle {\n    margin: 0;\n    font-size: 14px;\n    color: var(--mj-text-secondary);\n}\n\n/* Time Filters */\n.time-filters {\n    display: flex;\n    gap: 4px;\n    background: var(--mj-bg-surface);\n    padding: 4px;\n    border-radius: 10px;\n    box-shadow: var(--mj-shadow-sm);\n}\n\n.time-btn {\n    padding: 8px 16px;\n    background: transparent;\n    border: none;\n    border-radius: 8px;\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.time-btn:hover {\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-sunken);\n}\n\n.time-btn.active {\n    background: linear-gradient(135deg, var(--mj-color-indigo-500) 0%, var(--mj-color-indigo-600) 100%);\n    color: var(--mj-text-inverse);\n    box-shadow: 0 2px 8px color-mix(in srgb, var(--mj-color-indigo-500) 30%, transparent);\n}\n\n/* KPI Grid */\n.kpi-grid {\n    display: grid;\n    grid-template-columns: repeat(6, 1fr);\n    gap: 16px;\n}\n\n.kpi-card {\n    display: flex;\n    align-items: center;\n    gap: 14px;\n    padding: 18px 20px;\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    transition: all 0.2s ease;\n}\n\n.kpi-card:hover {\n    box-shadow: var(--mj-shadow-lg);\n    transform: translateY(-2px);\n}\n\n.kpi-card.success {\n    background: var(--mj-status-success-bg);\n}\n\n.kpi-card.warning {\n    background: linear-gradient(135deg, var(--mj-color-brand-100) 0%, var(--mj-color-brand-200) 100%);\n}\n\n.kpi-icon {\n    width: 44px;\n    height: 44px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 10px;\n    font-size: 18px;\n}\n\n.kpi-icon.requests {\n    background: linear-gradient(135deg, var(--mj-color-info-100) 0%, var(--mj-color-info-100) 100%);\n    color: var(--mj-color-info-600);\n}\n\n.kpi-icon.success-rate {\n    background: linear-gradient(135deg, var(--mj-color-success-100) 0%, var(--mj-color-success-200) 100%);\n    color: var(--mj-color-success-600);\n}\n\n.kpi-icon.errors {\n    background: linear-gradient(135deg, var(--mj-color-error-100) 0%, var(--mj-color-error-200) 100%);\n    color: var(--mj-color-error-600);\n}\n\n.kpi-icon.response-time {\n    background: linear-gradient(135deg, var(--mj-color-indigo-100) 0%, var(--mj-color-indigo-200) 100%);\n    color: var(--mj-color-indigo-600);\n}\n\n.kpi-icon.keys {\n    background: linear-gradient(135deg, var(--mj-color-brand-100) 0%, var(--mj-color-brand-200) 100%);\n    color: var(--mj-brand-primary-hover);\n}\n\n.kpi-icon.endpoints {\n    background: linear-gradient(135deg, var(--mj-color-violet-50) 0%, var(--mj-color-violet-200) 100%);\n    color: var(--mj-brand-primary);\n}\n\n.kpi-content {\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n}\n\n.kpi-value {\n    font-size: 22px;\n    font-weight: 700;\n    color: var(--mj-text-primary);\n}\n\n.kpi-label {\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n}\n\n/* Chart Section */\n.chart-section {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    padding: 20px;\n    box-shadow: var(--mj-shadow-sm);\n}\n\n.chart-header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    margin-bottom: 16px;\n}\n\n.chart-header h4 {\n    margin: 0;\n    font-size: 16px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n}\n\n.chart-legend {\n    display: flex;\n    gap: 16px;\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.requests {\n    background: var(--mj-color-indigo-500);\n}\n\n.legend-color.errors {\n    background: var(--mj-status-error);\n}\n\n.chart-container {\n    display: flex;\n    height: 200px;\n    gap: 8px;\n}\n\n.chart-bars {\n    flex: 1;\n    display: flex;\n    align-items: flex-end;\n    gap: 4px;\n    padding-bottom: 24px;\n}\n\n.bar-group {\n    flex: 1;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    min-width: 0;\n}\n\n.bar-wrapper {\n    width: 100%;\n    height: 160px;\n    display: flex;\n    align-items: flex-end;\n    justify-content: center;\n}\n\n.bar {\n    width: 100%;\n    max-width: 32px;\n    border-radius: 4px 4px 0 0;\n    transition: all 0.3s ease;\n    position: relative;\n}\n\n.bar.requests-bar {\n    background: linear-gradient(180deg, var(--mj-color-indigo-500) 0%, var(--mj-color-indigo-400) 100%);\n}\n\n.bar.requests-bar:hover {\n    background: linear-gradient(180deg, var(--mj-color-indigo-600) 0%, var(--mj-color-indigo-500) 100%);\n}\n\n.bar.errors-bar {\n    position: absolute;\n    bottom: 0;\n    left: 0;\n    width: 100%;\n    background: var(--mj-status-error);\n    border-radius: 0;\n}\n\n.bar-label {\n    margin-top: 8px;\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    white-space: nowrap;\n    text-overflow: ellipsis;\n    overflow: hidden;\n    max-width: 100%;\n}\n\n.chart-y-axis {\n    display: flex;\n    flex-direction: column;\n    justify-content: space-between;\n    padding-bottom: 24px;\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    text-align: right;\n    min-width: 40px;\n}\n\n.empty-chart {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    height: 200px;\n    color: var(--mj-text-muted);\n}\n\n.empty-chart i {\n    font-size: 32px;\n    margin-bottom: 8px;\n    opacity: 0.5;\n}\n\n/* Breakdown Grid */\n.breakdown-grid {\n    display: grid;\n    grid-template-columns: 1fr 1fr 1fr;\n    gap: 20px;\n}\n\n.breakdown-card {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    overflow: hidden;\n}\n\n.breakdown-header {\n    padding: 16px 20px;\n    background: var(--mj-bg-page);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.breakdown-header h4 {\n    margin: 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.breakdown-header h4 i {\n    color: var(--mj-text-secondary);\n}\n\n.breakdown-content {\n    padding: 12px;\n    max-height: 280px;\n    overflow-y: auto;\n}\n\n/* Endpoint List */\n.endpoint-list {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.endpoint-item {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 10px 12px;\n    background: var(--mj-bg-page);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.endpoint-item:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.endpoint-info {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    min-width: 0;\n    flex: 1;\n}\n\n.method-badge {\n    padding: 2px 6px;\n    border-radius: 4px;\n    font-size: 10px;\n    font-weight: 600;\n    text-transform: uppercase;\n    flex-shrink: 0;\n}\n\n.method-get { background: var(--mj-status-info-bg); color: var(--mj-color-info-600); }\n.method-post { background: var(--mj-color-success-100); color: var(--mj-color-success-600); }\n.method-put { background: var(--mj-color-brand-100); color: var(--mj-brand-primary-hover); }\n.method-delete { background: var(--mj-color-error-100); color: var(--mj-color-error-600); }\n.method-other { background: var(--mj-bg-surface-sunken); color: var(--mj-text-secondary); }\n\n.endpoint-path {\n    font-size: 12px;\n    font-family: 'Fira Code', monospace;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.endpoint-stats {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    font-size: 11px;\n    flex-shrink: 0;\n}\n\n.endpoint-requests {\n    font-weight: 600;\n    color: var(--mj-color-indigo-500);\n}\n\n.endpoint-time {\n    color: var(--mj-text-secondary);\n}\n\n.endpoint-error {\n    color: var(--mj-status-success);\n}\n\n.endpoint-error.has-errors {\n    color: var(--mj-status-error);\n    font-weight: 500;\n}\n\n/* Key List */\n.key-list {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.key-item {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    padding: 10px 12px;\n    background: var(--mj-bg-page);\n    border-radius: 8px;\n    cursor: pointer;\n    transition: all 0.2s ease;\n}\n\n.key-item:hover {\n    background: var(--mj-bg-surface-sunken);\n}\n\n.key-info {\n    display: flex;\n    flex-direction: column;\n    gap: 2px;\n    min-width: 0;\n}\n\n.key-label {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.key-last-used {\n    font-size: 11px;\n    color: var(--mj-text-muted);\n}\n\n.key-requests {\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-color-indigo-500);\n}\n\n/* Status Distribution */\n.status-distribution {\n    display: flex;\n    flex-direction: column;\n    gap: 16px;\n}\n\n.status-bar {\n    display: flex;\n    height: 24px;\n    border-radius: 6px;\n    overflow: hidden;\n    background: var(--mj-bg-surface-sunken);\n}\n\n.status-segment {\n    transition: all 0.3s ease;\n}\n\n.status-segment:hover {\n    filter: brightness(1.1);\n}\n\n.status-legend {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n}\n\n.status-legend-item {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 12px;\n}\n\n.status-color {\n    width: 12px;\n    height: 12px;\n    border-radius: 3px;\n}\n\n.status-label {\n    flex: 1;\n    color: var(--mj-text-secondary);\n}\n\n.status-count {\n    color: var(--mj-text-secondary);\n    font-weight: 500;\n}\n\n/* Logs Section */\n.logs-section {\n    background: var(--mj-bg-surface);\n    border-radius: 12px;\n    box-shadow: var(--mj-shadow-sm);\n    overflow: hidden;\n}\n\n.logs-header {\n    padding: 16px 20px;\n    background: var(--mj-bg-page);\n    border-bottom: 1px solid var(--mj-border-default);\n}\n\n.logs-header h4 {\n    margin: 0;\n    font-size: 14px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.logs-header h4 i {\n    color: var(--mj-text-secondary);\n}\n\n.logs-table {\n    width: 100%;\n}\n\n.logs-table-header {\n    display: grid;\n    grid-template-columns: 100px 120px 70px 1fr 70px 80px;\n    gap: 12px;\n    padding: 12px 20px;\n    background: var(--mj-bg-surface-sunken);\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n}\n\n.logs-table-body {\n    max-height: 320px;\n    overflow-y: auto;\n}\n\n.logs-table-body.scrollable {\n    max-height: 380px;\n}\n\n.log-row {\n    display: grid;\n    grid-template-columns: 100px 120px 70px 1fr 70px 80px;\n    gap: 12px;\n    padding: 12px 20px;\n    border-bottom: 1px solid var(--mj-bg-surface-sunken);\n    font-size: 13px;\n    align-items: center;\n    transition: background 0.2s ease;\n}\n\n.log-row:hover {\n    background: var(--mj-bg-page);\n}\n\n.col-time {\n    color: var(--mj-text-secondary);\n    font-size: 12px;\n}\n\n.col-key {\n    color: var(--mj-text-secondary);\n    font-weight: 500;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.col-endpoint {\n    font-family: 'Fira Code', monospace;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.col-status {\n    font-weight: 600;\n    text-align: center;\n}\n\n.col-status.status-success { color: var(--mj-status-success); }\n.col-status.status-info { color: var(--mj-status-info); }\n.col-status.status-warning { color: var(--mj-color-warning-500); }\n.col-status.status-error { color: var(--mj-status-error); }\n\n.col-duration {\n    color: var(--mj-text-secondary);\n    text-align: right;\n}\n\n/* Empty States */\n.empty-state {\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    padding: 32px 20px;\n    color: var(--mj-text-muted);\n    text-align: center;\n}\n\n.empty-state i {\n    font-size: 32px;\n    margin-bottom: 8px;\n    opacity: 0.5;\n}\n\n.empty-state span {\n    font-size: 13px;\n    font-weight: 500;\n    color: var(--mj-text-secondary);\n}\n\n.empty-state.large {\n    padding: 48px 24px;\n}\n\n.empty-state.large i {\n    font-size: 48px;\n}\n\n.empty-state p {\n    margin: 8px 0 0 0;\n    font-size: 12px;\n}\n\n/* Drill-down Window */\n.drilldown-title {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    font-weight: 600;\n    font-size: 15px;\n}\n\n.drilldown-title i {\n    color: var(--mj-color-indigo-500);\n}\n\n.filter-badge {\n    padding: 4px 10px;\n    background: var(--mj-color-indigo-100);\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 500;\n    color: var(--mj-color-indigo-600);\n}\n\n.window-close-btn {\n    margin-left: auto;\n    color: var(--mj-text-muted);\n    width: 32px;\n    height: 32px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 8px;\n}\n\n.window-close-btn:hover {\n    color: var(--mj-text-secondary);\n    background: var(--mj-bg-surface-hover);\n}\n\n.drilldown-content {\n    height: 100%;\n    overflow: hidden;\n}\n\n.drilldown-logs {\n    height: 100%;\n}\n\n/* MJ Window Styling */\n:host ::ng-deep mj-window .mj-window {\n    border-radius: 12px !important;\n    overflow: hidden;\n    box-shadow: var(--mj-shadow-2xl) !important;\n}\n\n:host ::ng-deep mj-window .mj-window-content {\n    padding: 0 !important;\n}\n\n:host ::ng-deep mj-window-titlebar {\n    padding: 16px 20px !important;\n    background: var(--mj-bg-page) !important;\n    border-bottom: 1px solid var(--mj-border-default) !important;\n}\n\n/* Responsive */\n@media (max-width: 1400px) {\n    .kpi-grid {\n        grid-template-columns: repeat(3, 1fr);\n    }\n}\n\n@media (max-width: 1200px) {\n    .breakdown-grid {\n        grid-template-columns: 1fr 1fr;\n    }\n}\n\n@media (max-width: 900px) {\n    .kpi-grid {\n        grid-template-columns: repeat(2, 1fr);\n    }\n\n    .breakdown-grid {\n        grid-template-columns: 1fr;\n    }\n\n    .logs-table-header,\n    .log-row {\n        grid-template-columns: 80px 100px 60px 1fr 60px;\n    }\n\n    .col-duration {\n        display: none;\n    }\n}\n\n@media (max-width: 600px) {\n    .panel-header {\n        flex-direction: column;\n    }\n\n    .time-filters {\n        width: 100%;\n        justify-content: center;\n    }\n\n    .kpi-grid {\n        grid-template-columns: 1fr;\n    }\n\n    .logs-table-header,\n    .log-row {\n        grid-template-columns: 1fr 60px;\n    }\n\n    .col-key,\n    .col-method,\n    .col-endpoint {\n        display: none;\n    }\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(APIUsagePanelComponent, { className: "APIUsagePanelComponent", filePath: "src/APIKeys/api-usage-panel.component.ts", lineNumber: 62 }); })();
//# sourceMappingURL=api-usage-panel.component.js.map