/**
 * @fileoverview Realtime management section — the whole realtime + bridge
 * surface (§11b of the Realtime Bridges architecture) in one place.
 *
 * Hosts an internal sub-tab rail across seven surfaces:
 *  1. Live Sessions   — active session bridges (Connecting/Connected) joined
 *                       with their session: agent, provider, turn mode,
 *                       participant count, started-at.
 *  2. Bridge Providers — the platform registry with a compact capability
 *                       summary derived from `SupportedFeaturesObject`.
 *  3. Agent Identities — which agents are reachable where (mailboxes, numbers).
 *  4. Channels         — the `MJ: AI Agent Channels` registry + which providers
 *                       contribute them.
 *  5. Co-Agents        — the `MJ: AI Agent Co Agents` pairing registry.
 *  6. Session History  — closed/terminal session bridges with close reason.
 *  7. Metrics          — client-side aggregates (by provider / status / agent;
 *                       bridges-over-time bucketed per day).
 *
 * Read-only for v1. Data loads once per `TimeRange` change via one batched
 * `RunViews` in {@link LoadRealtimeManagementDataset}; everything else is
 * in-memory aggregation. The selected sub-tab persists via `UserInfoEngine`
 * under `mj.realtimeDashboard.subTab`.
 */
import { Component, Input, ChangeDetectorRef, inject } from '@angular/core';
import { CompositeKey } from '@memberjunction/core';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
import { SharedService } from '@memberjunction/ng-shared';
import { UserInfoEngine } from '@memberjunction/core-entities';
import { LoadRealtimeManagementDataset, BucketSessionBridgesByDay, SummarizeBridgesByProvider, SummarizeBridgesByStatus, SummarizeBridgesByAgent, BuildCapabilityChips, BridgeTypeIcon, IdentityTypeIcon, TransportTypeIcon, FormatBridgeDuration, FormatBridgeStart } from './realtime-management-data';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-shared-generic";
import * as i2 from "@memberjunction/ng-ui-components";
const _forTrack0 = ($index, $item) => $item.Key;
const _forTrack1 = ($index, $item) => $item.Record.ID;
const _forTrack2 = ($index, $item) => $item.Label;
const _forTrack3 = ($index, $item) => $item.ID;
function RealtimeManagementComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 0);
    i0.ɵɵelement(1, "mj-loading", 1);
    i0.ɵɵelementEnd();
} }
function RealtimeManagementComponent_Conditional_1_For_3_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 8);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_For_3_Template_button_click_0_listener() { const tab_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.SelectSubTab(tab_r3.Key)); });
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const tab_r3 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("subtab--active", ctx_r3.ActiveSubTab === tab_r3.Key);
    i0.ɵɵadvance();
    i0.ɵɵclassMap(tab_r3.Icon);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(tab_r3.Label);
} }
function RealtimeManagementComponent_Conditional_1_Case_6_Conditional_23_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 16);
    i0.ɵɵtext(2, "No live bridged sessions right now");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_6_For_25_Conditional_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "span", 22);
} }
function RealtimeManagementComponent_Conditional_1_Case_6_For_25_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "tr", 17);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Case_6_For_25_Template_tr_click_0_listener() { const b_r6 = i0.ɵɵrestoreView(_r5).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.OpenSession(b_r6.Record.AgentSessionID)); });
    i0.ɵɵelementStart(1, "td", 18);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td");
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td")(6, "span", 19);
    i0.ɵɵelement(7, "i", 20);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "td");
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "td", 21);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "td")(14, "span");
    i0.ɵɵconditionalCreate(15, RealtimeManagementComponent_Conditional_1_Case_6_For_25_Conditional_15_Template, 1, 0, "span", 22);
    i0.ɵɵtext(16);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(17, "td", 23);
    i0.ɵɵtext(18);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(19, "td", 24);
    i0.ɵɵtext(20);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(21, "td", 25)(22, "button", 26);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Case_6_For_25_Template_button_click_22_listener($event) { const b_r6 = i0.ɵɵrestoreView(_r5).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); ctx_r3.OpenSession(b_r6.Record.AgentSessionID); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵelement(23, "i", 27);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const b_r6 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r6.AgentName);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r6.Record.Provider);
    i0.ɵɵadvance(3);
    i0.ɵɵclassProp("fa-arrow-right-from-bracket", b_r6.Record.Direction === "Outbound")("fa-arrow-right-to-bracket", b_r6.Record.Direction === "Inbound");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", b_r6.Record.Direction, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r6.Record.TurnMode);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r6.ParticipantCount);
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r3.BridgeStatusClass(b_r6.Record.Status));
    i0.ɵɵadvance();
    i0.ɵɵconditional(b_r6.Record.Status === "Connected" ? 15 : -1);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", b_r6.Record.Status, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r3.FormatBridgeStart(b_r6.StartedAt));
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", b_r6.Record.HostInstanceID || "");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(b_r6.Record.HostInstanceID || "\u2014");
} }
function RealtimeManagementComponent_Conditional_1_Case_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Provider");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Direction");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12, "Turn mode");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th", 12);
    i0.ɵɵtext(14, "Participants");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th");
    i0.ɵɵtext(16, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(17, "th");
    i0.ɵɵtext(18, "Started");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(19, "th");
    i0.ɵɵtext(20, "Host instance");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(21, "th");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(22, "tbody");
    i0.ɵɵconditionalCreate(23, RealtimeManagementComponent_Conditional_1_Case_6_Conditional_23_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(24, RealtimeManagementComponent_Conditional_1_Case_6_For_25_Template, 24, 16, "tr", 13, _forTrack1);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(26, "div", 14)(27, "span", 15);
    i0.ɵɵtext(28);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(23);
    i0.ɵɵconditional(ctx_r3.LiveBridges.length === 0 ? 23 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.LiveBridges);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate2("", ctx_r3.LiveCount, " live bridge", ctx_r3.LiveCount === 1 ? "" : "s");
} }
function RealtimeManagementComponent_Conditional_1_Case_7_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 28);
    i0.ɵɵtext(2, "No bridge providers registered");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 30);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const p_r8 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(p_r8.Record.Description);
} }
function RealtimeManagementComponent_Conditional_1_Case_7_For_20_For_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 34);
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const chip_r9 = ctx.$implicit;
    i0.ɵɵproperty("title", chip_r9.Label);
    i0.ɵɵadvance();
    i0.ɵɵclassMap(chip_r9.Icon);
} }
function RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 35);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const p_r8 = i0.ɵɵnextContext().$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1("+", ctx_r3.CapabilityOverflowFor(p_r8.Record.ID));
} }
function RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 36);
    i0.ɵɵtext(1, "none declared");
    i0.ɵɵelementEnd();
} }
function RealtimeManagementComponent_Conditional_1_Case_7_For_20_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "tr", 17);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Case_7_For_20_Template_tr_click_0_listener() { const p_r8 = i0.ɵɵrestoreView(_r7).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.OpenProvider(p_r8.Record.ID)); });
    i0.ɵɵelementStart(1, "td")(2, "div", 18);
    i0.ɵɵelement(3, "i", 29);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(5, RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_5_Template, 2, 1, "div", 30);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "td");
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "td")(9, "span", 31);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(11, "td", 32);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "td")(14, "span", 33);
    i0.ɵɵrepeaterCreate(15, RealtimeManagementComponent_Conditional_1_Case_7_For_20_For_16_Template, 2, 3, "span", 34, _forTrack2);
    i0.ɵɵconditionalCreate(17, RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_17_Template, 2, 1, "span", 35);
    i0.ɵɵconditionalCreate(18, RealtimeManagementComponent_Conditional_1_Case_7_For_20_Conditional_18_Template, 2, 0, "span", 36);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(19, "td", 21);
    i0.ɵɵtext(20);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const p_r8 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(ctx_r3.BridgeTypeIcon(p_r8.Record.BridgeType));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", p_r8.Record.Name, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(p_r8.Record.Description ? 5 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(p_r8.Record.BridgeType);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("status-connected", p_r8.Record.Status === "Active")("status-closed", p_r8.Record.Status !== "Active");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", p_r8.Record.Status, " ");
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", p_r8.Record.DriverClass);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(p_r8.Record.DriverClass);
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(ctx_r3.CapabilityChipsFor(p_r8.Record.ID));
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r3.CapabilityOverflowFor(p_r8.Record.ID) > 0 ? 17 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(p_r8.FeatureCount === 0 ? 18 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(p_r8.Channels.length);
} }
function RealtimeManagementComponent_Conditional_1_Case_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Provider");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Type");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12, "Driver class");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th");
    i0.ɵɵtext(14, "Capabilities");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th", 12);
    i0.ɵɵtext(16, "Channels");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(17, "tbody");
    i0.ɵɵconditionalCreate(18, RealtimeManagementComponent_Conditional_1_Case_7_Conditional_18_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(19, RealtimeManagementComponent_Conditional_1_Case_7_For_20_Template, 21, 15, "tr", 13, _forTrack1);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(21, "div", 14)(22, "span", 15);
    i0.ɵɵtext(23);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(18);
    i0.ɵɵconditional(ctx_r3.Providers.length === 0 ? 18 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.Providers);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate2("", ctx_r3.Providers.length, " providers \u00B7 ", ctx_r3.ActiveProviderCount, " active");
} }
function RealtimeManagementComponent_Conditional_1_Case_8_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 28);
    i0.ɵɵtext(2, "No agent identities provisioned");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_8_For_20_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 13)(1, "td", 18);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td");
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td")(6, "span", 37);
    i0.ɵɵelement(7, "i");
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "td", 38);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "td", 36);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "td")(14, "span", 31);
    i0.ɵɵtext(15);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const id_r10 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(id_r10.Agent || "Unknown agent");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(id_r10.Provider);
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(ctx_r3.IdentityTypeIcon(id_r10.IdentityType));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", id_r10.IdentityType);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(id_r10.IdentityValue);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(id_r10.DisplayName || "\u2014");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("status-connected", id_r10.IsActive)("status-closed", !id_r10.IsActive);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", id_r10.IsActive ? "Active" : "Inactive", " ");
} }
function RealtimeManagementComponent_Conditional_1_Case_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Provider");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Type");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12, "Identity");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th");
    i0.ɵɵtext(14, "Display name");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th");
    i0.ɵɵtext(16, "Active");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(17, "tbody");
    i0.ɵɵconditionalCreate(18, RealtimeManagementComponent_Conditional_1_Case_8_Conditional_18_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(19, RealtimeManagementComponent_Conditional_1_Case_8_For_20_Template, 16, 12, "tr", 13, _forTrack3);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(21, "div", 14)(22, "span", 15);
    i0.ɵɵtext(23);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(18);
    i0.ɵɵconditional(ctx_r3.Identities.length === 0 ? 18 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.Identities);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate2("", ctx_r3.Identities.length, " identities \u00B7 ", ctx_r3.ActiveIdentityCount, " active");
} }
function RealtimeManagementComponent_Conditional_1_Case_9_Conditional_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 39);
    i0.ɵɵtext(2, "No channels registered");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_9_For_16_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 30);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ch_r11 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ch_r11.Description);
} }
function RealtimeManagementComponent_Conditional_1_Case_9_For_16_For_15_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 43);
} }
function RealtimeManagementComponent_Conditional_1_Case_9_For_16_For_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 42);
    i0.ɵɵtext(1);
    i0.ɵɵconditionalCreate(2, RealtimeManagementComponent_Conditional_1_Case_9_For_16_For_15_Conditional_2_Template, 1, 0, "i", 43);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const pc_r12 = ctx.$implicit;
    i0.ɵɵclassProp("provider-tag--default", pc_r12.IsDefault);
    i0.ɵɵproperty("title", pc_r12.IsDefault ? "Auto-attached by default" : "Available on demand");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", pc_r12.Provider, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(pc_r12.IsDefault ? 2 : -1);
} }
function RealtimeManagementComponent_Conditional_1_Case_9_For_16_ForEmpty_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 36);
    i0.ɵɵtext(1, "no provider contributions");
    i0.ɵɵelementEnd();
} }
function RealtimeManagementComponent_Conditional_1_Case_9_For_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 13)(1, "td")(2, "div", 18);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(4, RealtimeManagementComponent_Conditional_1_Case_9_For_16_Conditional_4_Template, 2, 1, "div", 30);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td")(6, "span", 37);
    i0.ɵɵelement(7, "i");
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(9, "td")(10, "span", 31);
    i0.ɵɵtext(11);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(12, "td")(13, "span", 40);
    i0.ɵɵrepeaterCreate(14, RealtimeManagementComponent_Conditional_1_Case_9_For_16_For_15_Template, 3, 5, "span", 41, _forTrack3, false, RealtimeManagementComponent_Conditional_1_Case_9_For_16_ForEmpty_16_Template, 2, 0, "span", 36);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ch_r11 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ch_r11.Name);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ch_r11.Description ? 4 : -1);
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(ctx_r3.TransportTypeIcon(ch_r11.TransportType));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ch_r11.TransportType);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("status-connected", ch_r11.IsActive)("status-closed", !ch_r11.IsActive);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ch_r11.IsActive ? "Active" : "Inactive", " ");
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(ctx_r3.ProvidersForChannel(ch_r11.ID));
} }
function RealtimeManagementComponent_Conditional_1_Case_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Channel");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Transport");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Active");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12, "Contributed by");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(13, "tbody");
    i0.ɵɵconditionalCreate(14, RealtimeManagementComponent_Conditional_1_Case_9_Conditional_14_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(15, RealtimeManagementComponent_Conditional_1_Case_9_For_16_Template, 17, 11, "tr", 13, _forTrack3);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(17, "div", 14)(18, "span", 15);
    i0.ɵɵtext(19);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(14);
    i0.ɵɵconditional(ctx_r3.Channels.length === 0 ? 14 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.Channels);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate2("", ctx_r3.Channels.length, " channels \u00B7 ", ctx_r3.ProviderChannels.length, " provider contributions");
} }
function RealtimeManagementComponent_Conditional_1_Case_10_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 28);
    i0.ɵɵtext(2, "No co-agent pairings configured");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_10_For_20_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 44);
    i0.ɵɵelement(1, "i", 43);
    i0.ɵɵtext(2, " default");
    i0.ɵɵelementEnd();
} }
function RealtimeManagementComponent_Conditional_1_Case_10_For_20_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 36);
    i0.ɵɵtext(1, "\u2014");
    i0.ɵɵelementEnd();
} }
function RealtimeManagementComponent_Conditional_1_Case_10_For_20_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 13)(1, "td", 18);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td");
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td")(6, "span", 37);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(8, "td");
    i0.ɵɵconditionalCreate(9, RealtimeManagementComponent_Conditional_1_Case_10_For_20_Conditional_9_Template, 3, 0, "span", 44)(10, RealtimeManagementComponent_Conditional_1_Case_10_For_20_Conditional_10_Template, 2, 0, "span", 36);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "td", 21);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "td")(14, "span", 31);
    i0.ɵɵtext(15);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const c_r13 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(c_r13.CoAgent || "Unknown");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r3.CoAgentTargetLabel(c_r13));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(c_r13.Type);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(c_r13.IsDefault ? 9 : 10);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(c_r13.Sequence);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("status-connected", c_r13.Status === "Active")("status-closed", c_r13.Status !== "Active");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", c_r13.Status, " ");
} }
function RealtimeManagementComponent_Conditional_1_Case_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Co-Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Pairs with");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Relationship");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th");
    i0.ɵɵtext(12, "Default");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th", 12);
    i0.ɵɵtext(14, "Seq");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th");
    i0.ɵɵtext(16, "Status");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(17, "tbody");
    i0.ɵɵconditionalCreate(18, RealtimeManagementComponent_Conditional_1_Case_10_Conditional_18_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(19, RealtimeManagementComponent_Conditional_1_Case_10_For_20_Template, 16, 10, "tr", 13, _forTrack3);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(21, "div", 14)(22, "span", 15);
    i0.ɵɵtext(23);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(18);
    i0.ɵɵconditional(ctx_r3.CoAgents.length === 0 ? 18 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.CoAgents);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate2("", ctx_r3.CoAgents.length, " pairings \u00B7 ", ctx_r3.ActiveCoAgentCount, " active");
} }
function RealtimeManagementComponent_Conditional_1_Case_11_Conditional_21_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td", 45);
    i0.ɵɵtext(2, "No closed bridges in this window");
    i0.ɵɵelementEnd()();
} }
function RealtimeManagementComponent_Conditional_1_Case_11_For_23_Template(rf, ctx) { if (rf & 1) {
    const _r14 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "tr", 17);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Case_11_For_23_Template_tr_click_0_listener() { const b_r15 = i0.ɵɵrestoreView(_r14).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.OpenSession(b_r15.Record.AgentSessionID)); });
    i0.ɵɵelementStart(1, "td", 18);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td");
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "td");
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "td", 21);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "td", 46);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "td")(12, "span");
    i0.ɵɵtext(13);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(14, "td", 23);
    i0.ɵɵtext(15);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "td", 25)(17, "button", 26);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Case_11_For_23_Template_button_click_17_listener($event) { const b_r15 = i0.ɵɵrestoreView(_r14).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); ctx_r3.OpenSession(b_r15.Record.AgentSessionID); return i0.ɵɵresetView($event.stopPropagation()); });
    i0.ɵɵelement(18, "i", 27);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const b_r15 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r15.AgentName);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r15.Record.Provider);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r15.Record.JoinMethod);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(b_r15.ParticipantCount);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r3.FormatBridgeDuration(b_r15.DurationMs));
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r3.CloseReasonClass(b_r15.Record.CloseReason));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", b_r15.Record.CloseReason || "unknown", " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r3.FormatBridgeStart(b_r15.StartedAt));
} }
function RealtimeManagementComponent_Conditional_1_Case_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9)(1, "div", 10)(2, "table", 11)(3, "thead")(4, "tr")(5, "th");
    i0.ɵɵtext(6, "Agent");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "th");
    i0.ɵɵtext(8, "Provider");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "th");
    i0.ɵɵtext(10, "Join method");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "th", 12);
    i0.ɵɵtext(12, "Participants");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(13, "th", 12);
    i0.ɵɵtext(14, "Duration");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "th");
    i0.ɵɵtext(16, "Close reason");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(17, "th");
    i0.ɵɵtext(18, "Started");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(19, "th");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(20, "tbody");
    i0.ɵɵconditionalCreate(21, RealtimeManagementComponent_Conditional_1_Case_11_Conditional_21_Template, 3, 0, "tr");
    i0.ɵɵrepeaterCreate(22, RealtimeManagementComponent_Conditional_1_Case_11_For_23_Template, 19, 9, "tr", 13, _forTrack1);
    i0.ɵɵelementEnd()()()();
    i0.ɵɵelementStart(24, "div", 14)(25, "span", 15);
    i0.ɵɵtext(26);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(21);
    i0.ɵɵconditional(ctx_r3.HistoryBridges.length === 0 ? 21 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.HistoryBridges);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate3("", ctx_r3.HistoryCount, " closed bridge", ctx_r3.HistoryCount === 1 ? "" : "s", " (", ctx_r3.TimeRange, ")");
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 49);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_5_For_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 53)(1, "div", 54);
    i0.ɵɵelement(2, "div", 55);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 56);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const bucket_r16 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(4);
    i0.ɵɵproperty("title", bucket_r16.Label + ": " + bucket_r16.Count);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("height", ctx_r3.DayBarHeight(bucket_r16.Count), "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(bucket_r16.Count);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 50);
    i0.ɵɵrepeaterCreate(1, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_5_For_2_Template, 5, 4, "div", 53, _forTrack2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.DayBuckets);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 52);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_10_For_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 57)(1, "span", 58);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 59);
    i0.ɵɵelement(4, "div", 60);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 61);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const slice_r17 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", slice_r17.Label);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(slice_r17.Label);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("width", ctx_r3.SliceBarWidth(ctx_r3.ByProvider, slice_r17.Count), "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(slice_r17.Count);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_10_For_1_Template, 7, 5, "div", 57, _forTrack2);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵrepeater(ctx_r3.ByProvider);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 52);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_15_For_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 57)(1, "span", 58);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 59);
    i0.ɵɵelement(4, "div", 60);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 61);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const slice_r18 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", slice_r18.Label);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(slice_r18.Label);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("width", ctx_r3.SliceBarWidth(ctx_r3.ByStatus, slice_r18.Count), "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(slice_r18.Count);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_15_For_1_Template, 7, 5, "div", 57, _forTrack2);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵrepeater(ctx_r3.ByStatus);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 52);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_20_For_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 57)(1, "span", 58);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 59);
    i0.ɵɵelement(4, "div", 60);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 61);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const slice_r19 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", slice_r19.Label);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(slice_r19.Label);
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("width", ctx_r3.SliceBarWidth(ctx_r3.ByAgent, slice_r19.Count), "%");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(slice_r19.Count);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Conditional_20_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵrepeaterCreate(0, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_20_For_1_Template, 7, 5, "div", 57, _forTrack2);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵrepeater(ctx_r3.ByAgent);
} }
function RealtimeManagementComponent_Conditional_1_Case_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7)(1, "div", 47)(2, "div", 48);
    i0.ɵɵtext(3, "Bridges over time");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(4, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_4_Template, 1, 0, "mj-empty-state", 49)(5, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_5_Template, 3, 0, "div", 50);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 51)(7, "div", 48);
    i0.ɵɵtext(8, "By provider");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(9, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_9_Template, 1, 0, "mj-empty-state", 52)(10, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_10_Template, 2, 0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "div", 51)(12, "div", 48);
    i0.ɵɵtext(13, "By status");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(14, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_14_Template, 1, 0, "mj-empty-state", 52)(15, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_15_Template, 2, 0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "div", 51)(17, "div", 48);
    i0.ɵɵtext(18, "By agent");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(19, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_19_Template, 1, 0, "mj-empty-state", 52)(20, RealtimeManagementComponent_Conditional_1_Case_12_Conditional_20_Template, 2, 0);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(4);
    i0.ɵɵconditional(ctx_r3.DayBuckets.length === 0 ? 4 : 5);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r3.ByProvider.length === 0 ? 9 : 10);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r3.ByStatus.length === 0 ? 14 : 15);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r3.ByAgent.length === 0 ? 19 : 20);
} }
function RealtimeManagementComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 2)(1, "div", 3);
    i0.ɵɵrepeaterCreate(2, RealtimeManagementComponent_Conditional_1_For_3_Template, 4, 5, "button", 4, _forTrack0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "button", 5);
    i0.ɵɵlistener("click", function RealtimeManagementComponent_Conditional_1_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r1); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.LoadData()); });
    i0.ɵɵelement(5, "i", 6);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(6, RealtimeManagementComponent_Conditional_1_Case_6_Template, 29, 3)(7, RealtimeManagementComponent_Conditional_1_Case_7_Template, 24, 3)(8, RealtimeManagementComponent_Conditional_1_Case_8_Template, 24, 3)(9, RealtimeManagementComponent_Conditional_1_Case_9_Template, 20, 3)(10, RealtimeManagementComponent_Conditional_1_Case_10_Template, 24, 3)(11, RealtimeManagementComponent_Conditional_1_Case_11_Template, 27, 4)(12, RealtimeManagementComponent_Conditional_1_Case_12_Template, 21, 4, "div", 7);
} if (rf & 2) {
    let tmp_2_0;
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r3.SubTabs);
    i0.ɵɵadvance(4);
    i0.ɵɵconditional((tmp_2_0 = ctx_r3.ActiveSubTab) === "live-sessions" ? 6 : tmp_2_0 === "providers" ? 7 : tmp_2_0 === "identities" ? 8 : tmp_2_0 === "channels" ? 9 : tmp_2_0 === "co-agents" ? 10 : tmp_2_0 === "history" ? 11 : tmp_2_0 === "metrics" ? 12 : -1);
} }
const SUB_TAB_PREF_KEY = 'mj.realtimeDashboard.subTab';
export class RealtimeManagementComponent extends BaseAngularComponent {
    // ── Inputs ──
    _timeRange = '7d';
    set TimeRange(value) {
        const prev = this._timeRange;
        this._timeRange = value;
        if (prev !== value && this.initialized)
            this.LoadData();
    }
    get TimeRange() { return this._timeRange; }
    // ── State ──
    initialized = false;
    cdr = inject(ChangeDetectorRef);
    dataset = null;
    IsLoading = false;
    ActiveSubTab = 'live-sessions';
    SubTabs = [
        { Key: 'live-sessions', Label: 'Live Sessions', Icon: 'fa-solid fa-tower-broadcast' },
        { Key: 'providers', Label: 'Bridge Providers', Icon: 'fa-solid fa-network-wired' },
        { Key: 'identities', Label: 'Agent Identities', Icon: 'fa-solid fa-id-badge' },
        { Key: 'channels', Label: 'Channels', Icon: 'fa-solid fa-satellite-dish' },
        { Key: 'co-agents', Label: 'Co-Agents', Icon: 'fa-solid fa-people-arrows' },
        { Key: 'history', Label: 'Session History', Icon: 'fa-solid fa-clock-rotate-left' },
        { Key: 'metrics', Label: 'Metrics', Icon: 'fa-solid fa-chart-column' }
    ];
    // ── View models (rebuilt on load) ──
    LiveBridges = [];
    HistoryBridges = [];
    Providers = [];
    Identities = [];
    Channels = [];
    ProviderChannels = [];
    CoAgents = [];
    // Metrics
    DayBuckets = [];
    ByProvider = [];
    ByStatus = [];
    ByAgent = [];
    // ── Provider capability summary cache (chips + remainder) ──
    capabilityChips = new Map();
    // ── Lifecycle ──
    async ngOnInit() {
        this.loadPrefs();
        this.initialized = true;
        await this.LoadData();
    }
    // ── Sub-tab navigation ──
    SelectSubTab(key) {
        if (key === this.ActiveSubTab)
            return;
        this.ActiveSubTab = key;
        this.savePrefs();
        this.cdr.detectChanges();
    }
    // ── Data loading ──
    /** Reloads the whole management surface for the current time range. */
    async LoadData() {
        this.IsLoading = true;
        this.cdr.detectChanges();
        try {
            this.dataset = await LoadRealtimeManagementDataset(this.ProviderToUse, this.TimeRange);
            this.applyDataset(this.dataset);
        }
        catch (e) {
            console.error('Realtime management load error:', e);
        }
        finally {
            this.IsLoading = false;
            this.cdr.detectChanges();
        }
    }
    applyDataset(ds) {
        this.LiveBridges = ds.LiveBridges;
        this.HistoryBridges = ds.HistoryBridges;
        this.Providers = ds.Providers;
        this.Identities = ds.Identities;
        this.Channels = ds.Channels;
        this.ProviderChannels = ds.ProviderChannels;
        this.CoAgents = ds.CoAgents;
        this.capabilityChips.clear();
        for (const p of ds.Providers) {
            this.capabilityChips.set(p.Record.ID, BuildCapabilityChips(p.Features));
        }
        this.DayBuckets = BucketSessionBridgesByDay(ds.AllBridges, ds.WindowStart, new Date());
        this.ByProvider = SummarizeBridgesByProvider(ds.AllBridges);
        this.ByStatus = SummarizeBridgesByStatus(ds.AllBridges);
        this.ByAgent = SummarizeBridgesByAgent(ds.AllBridges);
    }
    // ── Drill-in ──
    /** Opens the AIAgentSession record behind a bridge via the shared record-open path. */
    OpenSession(sessionId) {
        const key = new CompositeKey();
        key.LoadFromSingleKeyValuePair('ID', sessionId);
        SharedService.Instance.OpenEntityRecord('MJ: AI Agent Sessions', key);
    }
    /** Opens a bridge provider record. */
    OpenProvider(providerId) {
        const key = new CompositeKey();
        key.LoadFromSingleKeyValuePair('ID', providerId);
        SharedService.Instance.OpenEntityRecord('MJ: AI Bridge Providers', key);
    }
    // ── Capability summary accessors (template helpers) ──
    /** First N capability chips for a provider (kept compact in the grid). */
    CapabilityChipsFor(providerId, limit = 4) {
        return (this.capabilityChips.get(providerId) ?? []).slice(0, limit);
    }
    /** Count of capability chips beyond the displayed `limit` (for a "+N" pill). */
    CapabilityOverflowFor(providerId, limit = 4) {
        const total = this.capabilityChips.get(providerId)?.length ?? 0;
        return Math.max(0, total - limit);
    }
    // ── Channel surface helpers ──
    /** Providers contributing a given channel (for the Channels grid). */
    ProvidersForChannel(channelId) {
        const target = channelId.toLowerCase();
        return this.ProviderChannels.filter(pc => pc.ChannelID.toLowerCase() === target);
    }
    // ── Co-agent helpers ──
    /** Human-readable pairing target — a specific agent or a whole agent type. */
    CoAgentTargetLabel(row) {
        if (row.TargetAgent)
            return row.TargetAgent;
        if (row.TargetAgentType)
            return `Type: ${row.TargetAgentType}`;
        return '—';
    }
    // ── Metric rendering helpers ──
    /** Max count across day buckets (for bar height scaling); min 1 to avoid /0. */
    get MaxDayCount() {
        return Math.max(1, ...this.DayBuckets.map(b => b.Count));
    }
    /** Bar height percentage for a day bucket. */
    DayBarHeight(count) {
        return Math.round((count / this.MaxDayCount) * 100);
    }
    /** Max slice count (for horizontal bar scaling); min 1. */
    maxSlice(slices) {
        return Math.max(1, ...slices.map(s => s.Count));
    }
    /** Bar width percentage for a metric slice. */
    SliceBarWidth(slices, count) {
        return Math.round((count / this.maxSlice(slices)) * 100);
    }
    // ── Summary getters ──
    get LiveCount() { return this.LiveBridges.length; }
    get HistoryCount() { return this.HistoryBridges.length; }
    get ActiveProviderCount() {
        return this.Providers.filter(p => p.Record.Status === 'Active').length;
    }
    get ActiveIdentityCount() {
        return this.Identities.filter(i => i.IsActive).length;
    }
    get ActiveCoAgentCount() {
        return this.CoAgents.filter(c => c.Status === 'Active').length;
    }
    // ── Pure presentation helpers (delegated to the data module) ──
    BridgeTypeIcon = BridgeTypeIcon;
    IdentityTypeIcon = IdentityTypeIcon;
    TransportTypeIcon = TransportTypeIcon;
    FormatBridgeDuration = FormatBridgeDuration;
    FormatBridgeStart = FormatBridgeStart;
    /** CSS class for a bridge status pill. */
    BridgeStatusClass(status) {
        switch (status) {
            case 'Connected': return 'status-pill status-connected';
            case 'Connecting':
            case 'Pending':
            case 'Scheduled': return 'status-pill status-pending';
            case 'Disconnecting': return 'status-pill status-pending';
            case 'Failed': return 'status-pill status-failed';
            default: return 'status-pill status-closed';
        }
    }
    /** CSS class for a session-bridge close-reason pill. */
    CloseReasonClass(reason) {
        switch (reason) {
            case 'Error': return 'reason-pill reason-error';
            case 'Janitor': return 'reason-pill reason-janitor';
            case 'HostEnded': return 'reason-pill reason-hostended';
            case 'Shutdown': return 'reason-pill reason-shutdown';
            case 'Explicit': return 'reason-pill reason-explicit';
            default: return 'reason-pill reason-unknown';
        }
    }
    // ── Preferences ──
    loadPrefs() {
        try {
            const raw = UserInfoEngine.Instance.GetSetting(SUB_TAB_PREF_KEY);
            if (raw) {
                const prefs = JSON.parse(raw);
                if (prefs.subTab && this.SubTabs.some(t => t.Key === prefs.subTab)) {
                    this.ActiveSubTab = prefs.subTab;
                }
            }
        }
        catch {
            // Use defaults on parse failure.
        }
    }
    savePrefs() {
        const prefs = { subTab: this.ActiveSubTab };
        UserInfoEngine.Instance.SetSettingDebounced(SUB_TAB_PREF_KEY, JSON.stringify(prefs));
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵRealtimeManagementComponent_BaseFactory; return function RealtimeManagementComponent_Factory(__ngFactoryType__) { return (ɵRealtimeManagementComponent_BaseFactory || (ɵRealtimeManagementComponent_BaseFactory = i0.ɵɵgetInheritedFactory(RealtimeManagementComponent)))(__ngFactoryType__ || RealtimeManagementComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RealtimeManagementComponent, selectors: [["app-realtime-management"]], inputs: { TimeRange: "TimeRange" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 1, consts: [[1, "loading-container"], ["text", "Loading realtime surface..."], [1, "subtab-bar"], [1, "subtabs"], [1, "subtab", 3, "subtab--active"], ["mjButton", "", "variant", "secondary", "size", "sm", "title", "Refresh", 3, "click"], [1, "fa-solid", "fa-rotate"], [1, "metrics-grid"], [1, "subtab", 3, "click"], [1, "panel"], [1, "table-wrapper"], [1, "data-table"], [1, "th-numeric"], [1, "data-row"], [1, "grid-footer"], [1, "grid-summary"], ["colspan", "9", 1, "empty-row"], [1, "data-row", 3, "click"], [1, "cell-strong"], [1, "dir-pill"], [1, "fa-solid"], [1, "cell-numeric"], [1, "dot", "dot--live"], [1, "cell-time"], [1, "cell-host", "mono", 3, "title"], [1, "cell-action"], ["mjButton", "", "variant", "icon", "size", "sm", "title", "Open session record", 3, "click"], [1, "fa-solid", "fa-arrow-up-right-from-square"], ["colspan", "6", 1, "empty-row"], [1, "type-icon"], [1, "cell-sub"], [1, "status-pill"], [1, "mono", "cell-host", 3, "title"], [1, "cap-chips"], [1, "cap-chip", 3, "title"], [1, "cap-more"], [1, "cell-muted"], [1, "type-chip"], [1, "mono"], ["colspan", "4", 1, "empty-row"], [1, "provider-tags"], [1, "provider-tag", 3, "provider-tag--default", "title"], [1, "provider-tag", 3, "title"], [1, "fa-solid", "fa-star"], [1, "default-pill"], ["colspan", "8", 1, "empty-row"], [1, "cell-numeric", "mono"], [1, "metric-card", "metric-card--wide"], [1, "metric-title"], ["Size", "compact", "Variant", "empty", "Icon", "fa-solid fa-chart-column", "Title", "No bridge activity in this window"], [1, "bar-chart"], [1, "metric-card"], ["Size", "compact", "Variant", "empty", "Icon", "fa-solid fa-chart-simple", "Title", "No data"], [1, "bar-col", 3, "title"], [1, "bar-track"], [1, "bar-fill"], [1, "bar-value"], [1, "hbar-row"], [1, "hbar-label", 3, "title"], [1, "hbar-track"], [1, "hbar-fill"], [1, "hbar-count"]], template: function RealtimeManagementComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵconditionalCreate(0, RealtimeManagementComponent_Conditional_0_Template, 2, 0, "div", 0)(1, RealtimeManagementComponent_Conditional_1_Template, 13, 1);
        } if (rf & 2) {
            i0.ɵɵconditional(ctx.IsLoading ? 0 : 1);
        } }, dependencies: [i1.LoadingComponent, i2.MJButtonDirective, i2.MJEmptyStateComponent], styles: ["[_nghost-%COMP%] { display: block; }\n\n.loading-container[_ngcontent-%COMP%] {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    min-height: 300px;\n}\n\n\n\n.subtab-bar[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    margin-bottom: 16px;\n    flex-wrap: wrap;\n}\n\n.subtabs[_ngcontent-%COMP%] {\n    display: flex;\n    gap: 4px;\n    flex-wrap: wrap;\n    flex: 1;\n    background: var(--mj-bg-surface-card);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    padding: 4px;\n}\n\n.subtab[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 8px;\n    border: none;\n    background: transparent;\n    color: var(--mj-text-secondary);\n    font-size: 13px;\n    font-weight: 500;\n    padding: 7px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n    transition: background 0.15s, color 0.15s;\n    white-space: nowrap;\n}\n\n.subtab[_ngcontent-%COMP%]:hover {\n    background: var(--mj-bg-surface-hover);\n    color: var(--mj-text-primary);\n}\n\n.subtab--active[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n    font-weight: 600;\n}\n\n.subtab[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { font-size: 12px; }\n\n\n\n.panel[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    overflow: hidden;\n}\n\n.table-wrapper[_ngcontent-%COMP%] { overflow-x: auto; }\n\n.data-table[_ngcontent-%COMP%] {\n    width: 100%;\n    border-collapse: collapse;\n    font-size: 13px;\n}\n\n.data-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], \n.data-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] {\n    padding: 10px 14px;\n    text-align: left;\n    border-bottom: 1px solid var(--mj-border-subtle);\n    vertical-align: middle;\n}\n\n.data-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-muted);\n    text-transform: uppercase;\n    letter-spacing: 0.4px;\n    background: var(--mj-bg-surface-card);\n    white-space: nowrap;\n}\n\n.th-numeric[_ngcontent-%COMP%] { text-align: right; }\n\n.data-row[_ngcontent-%COMP%] { transition: background 0.15s; }\n.data-row[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); }\n\n.cell-strong[_ngcontent-%COMP%] {\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    white-space: nowrap;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.cell-sub[_ngcontent-%COMP%] {\n    font-size: 11.5px;\n    color: var(--mj-text-muted);\n    margin-top: 2px;\n    max-width: 360px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.cell-muted[_ngcontent-%COMP%] { color: var(--mj-text-muted); }\n\n.cell-numeric[_ngcontent-%COMP%] {\n    text-align: right;\n    font-variant-numeric: tabular-nums;\n    color: var(--mj-text-secondary);\n}\n\n.cell-time[_ngcontent-%COMP%] {\n    white-space: nowrap;\n    color: var(--mj-text-muted);\n    font-size: 12px;\n}\n\n.cell-host[_ngcontent-%COMP%] {\n    max-width: 220px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    color: var(--mj-text-muted);\n}\n\n.cell-action[_ngcontent-%COMP%] { text-align: right; white-space: nowrap; }\n\n.type-icon[_ngcontent-%COMP%] { color: var(--mj-brand-primary); }\n\n.mono[_ngcontent-%COMP%] {\n    font-family: var(--mj-font-mono, monospace);\n    font-size: 12px;\n}\n\n.empty-row[_ngcontent-%COMP%] {\n    text-align: center;\n    color: var(--mj-text-disabled);\n    padding: 24px;\n}\n\n\n\n.status-pill[_ngcontent-%COMP%], \n.reason-pill[_ngcontent-%COMP%], \n.type-chip[_ngcontent-%COMP%], \n.dir-pill[_ngcontent-%COMP%], \n.default-pill[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 3px 10px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 600;\n    letter-spacing: 0.3px;\n    white-space: nowrap;\n}\n\n.status-connected[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-success) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-success);\n}\n\n.status-pending[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-warning) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-warning);\n}\n\n.status-failed[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n\n.status-closed[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-text-disabled) 14%, var(--mj-bg-surface));\n    color: var(--mj-text-muted);\n}\n\n.dot--live[_ngcontent-%COMP%] {\n    width: 7px;\n    height: 7px;\n    border-radius: 50%;\n    background: var(--mj-status-success);\n    animation: _ngcontent-%COMP%_pulse-live 1.6s ease-in-out infinite;\n}\n\n@keyframes _ngcontent-%COMP%_pulse-live {\n    0%, 100% { opacity: 1; }\n    50% { opacity: 0.35; }\n}\n\n.dir-pill[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.type-chip[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n    border: 1px solid var(--mj-border-subtle);\n}\n\n.default-pill[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n}\n\n\n\n.reason-error[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-error) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n.reason-janitor[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-warning) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-warning);\n}\n.reason-hostended[_ngcontent-%COMP%], \n.reason-explicit[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n.reason-shutdown[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-status-info) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-info);\n}\n.reason-unknown[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-text-disabled) 14%, var(--mj-bg-surface));\n    color: var(--mj-text-muted);\n}\n\n\n\n.cap-chips[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    flex-wrap: wrap;\n}\n\n.cap-chip[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    width: 26px;\n    height: 22px;\n    border-radius: 6px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    color: var(--mj-text-secondary);\n    font-size: 11px;\n}\n\n.cap-more[_ngcontent-%COMP%] {\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-muted);\n}\n\n\n\n.provider-tags[_ngcontent-%COMP%] {\n    display: inline-flex;\n    gap: 6px;\n    flex-wrap: wrap;\n}\n\n.provider-tag[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    font-size: 11px;\n    padding: 2px 8px;\n    border-radius: 10px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    color: var(--mj-text-secondary);\n}\n\n.provider-tag--default[_ngcontent-%COMP%] {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n    border-color: color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.provider-tag[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { font-size: 9px; }\n\n\n\n.grid-footer[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    margin-top: 14px;\n    flex-wrap: wrap;\n}\n\n.grid-summary[_ngcontent-%COMP%] {\n    font-size: 12.5px;\n    color: var(--mj-text-muted);\n}\n\n\n\n.metrics-grid[_ngcontent-%COMP%] {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));\n    gap: 16px;\n}\n\n.metric-card[_ngcontent-%COMP%] {\n    background: var(--mj-bg-surface);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    padding: 16px 18px;\n}\n\n.metric-card--wide[_ngcontent-%COMP%] {\n    grid-column: 1 / -1;\n}\n\n.metric-title[_ngcontent-%COMP%] {\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin-bottom: 14px;\n}\n\n\n\n.bar-chart[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: flex-end;\n    gap: 6px;\n    height: 160px;\n    overflow-x: auto;\n}\n\n.bar-col[_ngcontent-%COMP%] {\n    flex: 1;\n    min-width: 16px;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 6px;\n    height: 100%;\n}\n\n.bar-track[_ngcontent-%COMP%] {\n    flex: 1;\n    width: 100%;\n    display: flex;\n    align-items: flex-end;\n}\n\n.bar-fill[_ngcontent-%COMP%] {\n    width: 100%;\n    min-height: 2px;\n    border-radius: 4px 4px 0 0;\n    background: var(--mj-brand-primary);\n    transition: height 0.3s ease;\n}\n\n.bar-value[_ngcontent-%COMP%] {\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    font-variant-numeric: tabular-nums;\n}\n\n\n\n.hbar-row[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin-bottom: 10px;\n}\n\n.hbar-label[_ngcontent-%COMP%] {\n    flex: 0 0 110px;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.hbar-track[_ngcontent-%COMP%] {\n    flex: 1;\n    height: 12px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 6px;\n    overflow: hidden;\n}\n\n.hbar-fill[_ngcontent-%COMP%] {\n    height: 100%;\n    border-radius: 6px;\n    background: var(--mj-brand-primary);\n    transition: width 0.3s ease;\n}\n\n.hbar-count[_ngcontent-%COMP%] {\n    flex: 0 0 auto;\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    font-variant-numeric: tabular-nums;\n    min-width: 24px;\n    text-align: right;\n}"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RealtimeManagementComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'app-realtime-management', template: "@if (IsLoading) {\n    <div class=\"loading-container\">\n        <mj-loading text=\"Loading realtime surface...\"></mj-loading>\n    </div>\n} @else {\n    <!-- Sub-tab rail + refresh -->\n    <div class=\"subtab-bar\">\n        <div class=\"subtabs\">\n            @for (tab of SubTabs; track tab.Key) {\n                <button class=\"subtab\" [class.subtab--active]=\"ActiveSubTab === tab.Key\"\n                        (click)=\"SelectSubTab(tab.Key)\">\n                    <i [class]=\"tab.Icon\"></i>\n                    <span>{{ tab.Label }}</span>\n                </button>\n            }\n        </div>\n        <button mjButton variant=\"secondary\" size=\"sm\" title=\"Refresh\" (click)=\"LoadData()\">\n            <i class=\"fa-solid fa-rotate\"></i>\n        </button>\n    </div>\n\n    @switch (ActiveSubTab) {\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 LIVE SESSIONS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('live-sessions') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Agent</th>\n                                <th>Provider</th>\n                                <th>Direction</th>\n                                <th>Turn mode</th>\n                                <th class=\"th-numeric\">Participants</th>\n                                <th>Status</th>\n                                <th>Started</th>\n                                <th>Host instance</th>\n                                <th></th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (LiveBridges.length === 0) {\n                                <tr><td colspan=\"9\" class=\"empty-row\">No live bridged sessions right now</td></tr>\n                            }\n                            @for (b of LiveBridges; track b.Record.ID) {\n                                <tr class=\"data-row\" (click)=\"OpenSession(b.Record.AgentSessionID)\">\n                                    <td class=\"cell-strong\">{{ b.AgentName }}</td>\n                                    <td>{{ b.Record.Provider }}</td>\n                                    <td>\n                                        <span class=\"dir-pill\">\n                                            <i class=\"fa-solid\"\n                                               [class.fa-arrow-right-from-bracket]=\"b.Record.Direction === 'Outbound'\"\n                                               [class.fa-arrow-right-to-bracket]=\"b.Record.Direction === 'Inbound'\"></i>\n                                            {{ b.Record.Direction }}\n                                        </span>\n                                    </td>\n                                    <td>{{ b.Record.TurnMode }}</td>\n                                    <td class=\"cell-numeric\">{{ b.ParticipantCount }}</td>\n                                    <td>\n                                        <span [class]=\"BridgeStatusClass(b.Record.Status)\">\n                                            @if (b.Record.Status === 'Connected') { <span class=\"dot dot--live\"></span> }\n                                            {{ b.Record.Status }}\n                                        </span>\n                                    </td>\n                                    <td class=\"cell-time\">{{ FormatBridgeStart(b.StartedAt) }}</td>\n                                    <td class=\"cell-host mono\" [title]=\"b.Record.HostInstanceID || ''\">{{ b.Record.HostInstanceID || '\u2014' }}</td>\n                                    <td class=\"cell-action\">\n                                        <!-- TODO(v1+): replace with the observer-console deep link (\u00A71 read-only monitor). -->\n                                        <button mjButton variant=\"icon\" size=\"sm\" title=\"Open session record\"\n                                                (click)=\"OpenSession(b.Record.AgentSessionID); $event.stopPropagation()\">\n                                            <i class=\"fa-solid fa-arrow-up-right-from-square\"></i>\n                                        </button>\n                                    </td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ LiveCount }} live bridge{{ LiveCount === 1 ? '' : 's' }}</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 BRIDGE PROVIDERS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('providers') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Provider</th>\n                                <th>Type</th>\n                                <th>Status</th>\n                                <th>Driver class</th>\n                                <th>Capabilities</th>\n                                <th class=\"th-numeric\">Channels</th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (Providers.length === 0) {\n                                <tr><td colspan=\"6\" class=\"empty-row\">No bridge providers registered</td></tr>\n                            }\n                            @for (p of Providers; track p.Record.ID) {\n                                <tr class=\"data-row\" (click)=\"OpenProvider(p.Record.ID)\">\n                                    <td>\n                                        <div class=\"cell-strong\">\n                                            <i [class]=\"BridgeTypeIcon(p.Record.BridgeType)\" class=\"type-icon\"></i>\n                                            {{ p.Record.Name }}\n                                        </div>\n                                        @if (p.Record.Description) {\n                                            <div class=\"cell-sub\">{{ p.Record.Description }}</div>\n                                        }\n                                    </td>\n                                    <td>{{ p.Record.BridgeType }}</td>\n                                    <td>\n                                        <span class=\"status-pill\" [class.status-connected]=\"p.Record.Status === 'Active'\"\n                                              [class.status-closed]=\"p.Record.Status !== 'Active'\">\n                                            {{ p.Record.Status }}\n                                        </span>\n                                    </td>\n                                    <td class=\"mono cell-host\" [title]=\"p.Record.DriverClass\">{{ p.Record.DriverClass }}</td>\n                                    <td>\n                                        <span class=\"cap-chips\">\n                                            @for (chip of CapabilityChipsFor(p.Record.ID); track chip.Label) {\n                                                <span class=\"cap-chip\" [title]=\"chip.Label\"><i [class]=\"chip.Icon\"></i></span>\n                                            }\n                                            @if (CapabilityOverflowFor(p.Record.ID) > 0) {\n                                                <span class=\"cap-more\">+{{ CapabilityOverflowFor(p.Record.ID) }}</span>\n                                            }\n                                            @if (p.FeatureCount === 0) {\n                                                <span class=\"cell-muted\">none declared</span>\n                                            }\n                                        </span>\n                                    </td>\n                                    <td class=\"cell-numeric\">{{ p.Channels.length }}</td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ Providers.length }} providers \u00B7 {{ ActiveProviderCount }} active</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 AGENT IDENTITIES \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('identities') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Agent</th>\n                                <th>Provider</th>\n                                <th>Type</th>\n                                <th>Identity</th>\n                                <th>Display name</th>\n                                <th>Active</th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (Identities.length === 0) {\n                                <tr><td colspan=\"6\" class=\"empty-row\">No agent identities provisioned</td></tr>\n                            }\n                            @for (id of Identities; track id.ID) {\n                                <tr class=\"data-row\">\n                                    <td class=\"cell-strong\">{{ id.Agent || 'Unknown agent' }}</td>\n                                    <td>{{ id.Provider }}</td>\n                                    <td>\n                                        <span class=\"type-chip\"><i [class]=\"IdentityTypeIcon(id.IdentityType)\"></i> {{ id.IdentityType }}</span>\n                                    </td>\n                                    <td class=\"mono\">{{ id.IdentityValue }}</td>\n                                    <td class=\"cell-muted\">{{ id.DisplayName || '\u2014' }}</td>\n                                    <td>\n                                        <span class=\"status-pill\" [class.status-connected]=\"id.IsActive\"\n                                              [class.status-closed]=\"!id.IsActive\">\n                                            {{ id.IsActive ? 'Active' : 'Inactive' }}\n                                        </span>\n                                    </td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ Identities.length }} identities \u00B7 {{ ActiveIdentityCount }} active</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 CHANNELS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('channels') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Channel</th>\n                                <th>Transport</th>\n                                <th>Active</th>\n                                <th>Contributed by</th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (Channels.length === 0) {\n                                <tr><td colspan=\"4\" class=\"empty-row\">No channels registered</td></tr>\n                            }\n                            @for (ch of Channels; track ch.ID) {\n                                <tr class=\"data-row\">\n                                    <td>\n                                        <div class=\"cell-strong\">{{ ch.Name }}</div>\n                                        @if (ch.Description) { <div class=\"cell-sub\">{{ ch.Description }}</div> }\n                                    </td>\n                                    <td>\n                                        <span class=\"type-chip\"><i [class]=\"TransportTypeIcon(ch.TransportType)\"></i> {{ ch.TransportType }}</span>\n                                    </td>\n                                    <td>\n                                        <span class=\"status-pill\" [class.status-connected]=\"ch.IsActive\"\n                                              [class.status-closed]=\"!ch.IsActive\">\n                                            {{ ch.IsActive ? 'Active' : 'Inactive' }}\n                                        </span>\n                                    </td>\n                                    <td>\n                                        <span class=\"provider-tags\">\n                                            @for (pc of ProvidersForChannel(ch.ID); track pc.ID) {\n                                                <span class=\"provider-tag\" [class.provider-tag--default]=\"pc.IsDefault\"\n                                                      [title]=\"pc.IsDefault ? 'Auto-attached by default' : 'Available on demand'\">\n                                                    {{ pc.Provider }}\n                                                    @if (pc.IsDefault) { <i class=\"fa-solid fa-star\"></i> }\n                                                </span>\n                                            } @empty {\n                                                <span class=\"cell-muted\">no provider contributions</span>\n                                            }\n                                        </span>\n                                    </td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ Channels.length }} channels \u00B7 {{ ProviderChannels.length }} provider contributions</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 CO-AGENTS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('co-agents') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Co-Agent</th>\n                                <th>Pairs with</th>\n                                <th>Relationship</th>\n                                <th>Default</th>\n                                <th class=\"th-numeric\">Seq</th>\n                                <th>Status</th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (CoAgents.length === 0) {\n                                <tr><td colspan=\"6\" class=\"empty-row\">No co-agent pairings configured</td></tr>\n                            }\n                            @for (c of CoAgents; track c.ID) {\n                                <tr class=\"data-row\">\n                                    <td class=\"cell-strong\">{{ c.CoAgent || 'Unknown' }}</td>\n                                    <td>{{ CoAgentTargetLabel(c) }}</td>\n                                    <td><span class=\"type-chip\">{{ c.Type }}</span></td>\n                                    <td>\n                                        @if (c.IsDefault) {\n                                            <span class=\"default-pill\"><i class=\"fa-solid fa-star\"></i> default</span>\n                                        } @else { <span class=\"cell-muted\">\u2014</span> }\n                                    </td>\n                                    <td class=\"cell-numeric\">{{ c.Sequence }}</td>\n                                    <td>\n                                        <span class=\"status-pill\" [class.status-connected]=\"c.Status === 'Active'\"\n                                              [class.status-closed]=\"c.Status !== 'Active'\">\n                                            {{ c.Status }}\n                                        </span>\n                                    </td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ CoAgents.length }} pairings \u00B7 {{ ActiveCoAgentCount }} active</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 SESSION HISTORY \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('history') {\n            <div class=\"panel\">\n                <div class=\"table-wrapper\">\n                    <table class=\"data-table\">\n                        <thead>\n                            <tr>\n                                <th>Agent</th>\n                                <th>Provider</th>\n                                <th>Join method</th>\n                                <th class=\"th-numeric\">Participants</th>\n                                <th class=\"th-numeric\">Duration</th>\n                                <th>Close reason</th>\n                                <th>Started</th>\n                                <th></th>\n                            </tr>\n                        </thead>\n                        <tbody>\n                            @if (HistoryBridges.length === 0) {\n                                <tr><td colspan=\"8\" class=\"empty-row\">No closed bridges in this window</td></tr>\n                            }\n                            @for (b of HistoryBridges; track b.Record.ID) {\n                                <tr class=\"data-row\" (click)=\"OpenSession(b.Record.AgentSessionID)\">\n                                    <td class=\"cell-strong\">{{ b.AgentName }}</td>\n                                    <td>{{ b.Record.Provider }}</td>\n                                    <td>{{ b.Record.JoinMethod }}</td>\n                                    <td class=\"cell-numeric\">{{ b.ParticipantCount }}</td>\n                                    <td class=\"cell-numeric mono\">{{ FormatBridgeDuration(b.DurationMs) }}</td>\n                                    <td>\n                                        <span [class]=\"CloseReasonClass(b.Record.CloseReason)\">\n                                            {{ b.Record.CloseReason || 'unknown' }}\n                                        </span>\n                                    </td>\n                                    <td class=\"cell-time\">{{ FormatBridgeStart(b.StartedAt) }}</td>\n                                    <td class=\"cell-action\">\n                                        <!-- TODO(v1+): transcript / recording review launch (\u00A77 review reuse). -->\n                                        <button mjButton variant=\"icon\" size=\"sm\" title=\"Open session record\"\n                                                (click)=\"OpenSession(b.Record.AgentSessionID); $event.stopPropagation()\">\n                                            <i class=\"fa-solid fa-arrow-up-right-from-square\"></i>\n                                        </button>\n                                    </td>\n                                </tr>\n                            }\n                        </tbody>\n                    </table>\n                </div>\n            </div>\n            <div class=\"grid-footer\">\n                <span class=\"grid-summary\">{{ HistoryCount }} closed bridge{{ HistoryCount === 1 ? '' : 's' }} ({{ TimeRange }})</span>\n            </div>\n        }\n\n        <!-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 METRICS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n        @case ('metrics') {\n            <div class=\"metrics-grid\">\n                <!-- Bridges over time (per-day bars) -->\n                <div class=\"metric-card metric-card--wide\">\n                    <div class=\"metric-title\">Bridges over time</div>\n                    @if (DayBuckets.length === 0) {\n                        <mj-empty-state Size=\"compact\" Variant=\"empty\" Icon=\"fa-solid fa-chart-column\"\n                            Title=\"No bridge activity in this window\" />\n                    } @else {\n                        <div class=\"bar-chart\">\n                            @for (bucket of DayBuckets; track bucket.Label) {\n                                <div class=\"bar-col\" [title]=\"bucket.Label + ': ' + bucket.Count\">\n                                    <div class=\"bar-track\">\n                                        <div class=\"bar-fill\" [style.height.%]=\"DayBarHeight(bucket.Count)\"></div>\n                                    </div>\n                                    <div class=\"bar-value\">{{ bucket.Count }}</div>\n                                </div>\n                            }\n                        </div>\n                    }\n                </div>\n\n                <!-- By provider -->\n                <div class=\"metric-card\">\n                    <div class=\"metric-title\">By provider</div>\n                    @if (ByProvider.length === 0) {\n                        <mj-empty-state Size=\"compact\" Variant=\"empty\" Icon=\"fa-solid fa-chart-simple\" Title=\"No data\" />\n                    } @else {\n                        @for (slice of ByProvider; track slice.Label) {\n                            <div class=\"hbar-row\">\n                                <span class=\"hbar-label\" [title]=\"slice.Label\">{{ slice.Label }}</span>\n                                <div class=\"hbar-track\">\n                                    <div class=\"hbar-fill\" [style.width.%]=\"SliceBarWidth(ByProvider, slice.Count)\"></div>\n                                </div>\n                                <span class=\"hbar-count\">{{ slice.Count }}</span>\n                            </div>\n                        }\n                    }\n                </div>\n\n                <!-- By status -->\n                <div class=\"metric-card\">\n                    <div class=\"metric-title\">By status</div>\n                    @if (ByStatus.length === 0) {\n                        <mj-empty-state Size=\"compact\" Variant=\"empty\" Icon=\"fa-solid fa-chart-simple\" Title=\"No data\" />\n                    } @else {\n                        @for (slice of ByStatus; track slice.Label) {\n                            <div class=\"hbar-row\">\n                                <span class=\"hbar-label\" [title]=\"slice.Label\">{{ slice.Label }}</span>\n                                <div class=\"hbar-track\">\n                                    <div class=\"hbar-fill\" [style.width.%]=\"SliceBarWidth(ByStatus, slice.Count)\"></div>\n                                </div>\n                                <span class=\"hbar-count\">{{ slice.Count }}</span>\n                            </div>\n                        }\n                    }\n                </div>\n\n                <!-- By agent -->\n                <div class=\"metric-card\">\n                    <div class=\"metric-title\">By agent</div>\n                    @if (ByAgent.length === 0) {\n                        <mj-empty-state Size=\"compact\" Variant=\"empty\" Icon=\"fa-solid fa-chart-simple\" Title=\"No data\" />\n                    } @else {\n                        @for (slice of ByAgent; track slice.Label) {\n                            <div class=\"hbar-row\">\n                                <span class=\"hbar-label\" [title]=\"slice.Label\">{{ slice.Label }}</span>\n                                <div class=\"hbar-track\">\n                                    <div class=\"hbar-fill\" [style.width.%]=\"SliceBarWidth(ByAgent, slice.Count)\"></div>\n                                </div>\n                                <span class=\"hbar-count\">{{ slice.Count }}</span>\n                            </div>\n                        }\n                    }\n                </div>\n            </div>\n        }\n    }\n}\n", styles: [":host { display: block; }\n\n.loading-container {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    min-height: 300px;\n}\n\n/* \u2500\u2500 Sub-tab rail \u2500\u2500 */\n.subtab-bar {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    margin-bottom: 16px;\n    flex-wrap: wrap;\n}\n\n.subtabs {\n    display: flex;\n    gap: 4px;\n    flex-wrap: wrap;\n    flex: 1;\n    background: var(--mj-bg-surface-card);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    padding: 4px;\n}\n\n.subtab {\n    display: inline-flex;\n    align-items: center;\n    gap: 8px;\n    border: none;\n    background: transparent;\n    color: var(--mj-text-secondary);\n    font-size: 13px;\n    font-weight: 500;\n    padding: 7px 14px;\n    border-radius: 8px;\n    cursor: pointer;\n    transition: background 0.15s, color 0.15s;\n    white-space: nowrap;\n}\n\n.subtab:hover {\n    background: var(--mj-bg-surface-hover);\n    color: var(--mj-text-primary);\n}\n\n.subtab--active {\n    background: color-mix(in srgb, var(--mj-brand-primary) 12%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n    font-weight: 600;\n}\n\n.subtab i { font-size: 12px; }\n\n/* \u2500\u2500 Panel + table (matches sibling analytics sections) \u2500\u2500 */\n.panel {\n    background: var(--mj-bg-surface);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    overflow: hidden;\n}\n\n.table-wrapper { overflow-x: auto; }\n\n.data-table {\n    width: 100%;\n    border-collapse: collapse;\n    font-size: 13px;\n}\n\n.data-table th,\n.data-table td {\n    padding: 10px 14px;\n    text-align: left;\n    border-bottom: 1px solid var(--mj-border-subtle);\n    vertical-align: middle;\n}\n\n.data-table th {\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-muted);\n    text-transform: uppercase;\n    letter-spacing: 0.4px;\n    background: var(--mj-bg-surface-card);\n    white-space: nowrap;\n}\n\n.th-numeric { text-align: right; }\n\n.data-row { transition: background 0.15s; }\n.data-row:hover { background: var(--mj-bg-surface-hover); }\n\n.cell-strong {\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    white-space: nowrap;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.cell-sub {\n    font-size: 11.5px;\n    color: var(--mj-text-muted);\n    margin-top: 2px;\n    max-width: 360px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.cell-muted { color: var(--mj-text-muted); }\n\n.cell-numeric {\n    text-align: right;\n    font-variant-numeric: tabular-nums;\n    color: var(--mj-text-secondary);\n}\n\n.cell-time {\n    white-space: nowrap;\n    color: var(--mj-text-muted);\n    font-size: 12px;\n}\n\n.cell-host {\n    max-width: 220px;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    color: var(--mj-text-muted);\n}\n\n.cell-action { text-align: right; white-space: nowrap; }\n\n.type-icon { color: var(--mj-brand-primary); }\n\n.mono {\n    font-family: var(--mj-font-mono, monospace);\n    font-size: 12px;\n}\n\n.empty-row {\n    text-align: center;\n    color: var(--mj-text-disabled);\n    padding: 24px;\n}\n\n/* \u2500\u2500 Pills \u2500\u2500 */\n.status-pill,\n.reason-pill,\n.type-chip,\n.dir-pill,\n.default-pill {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    padding: 3px 10px;\n    border-radius: 12px;\n    font-size: 11px;\n    font-weight: 600;\n    letter-spacing: 0.3px;\n    white-space: nowrap;\n}\n\n.status-connected {\n    background: color-mix(in srgb, var(--mj-status-success) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-success);\n}\n\n.status-pending {\n    background: color-mix(in srgb, var(--mj-status-warning) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-warning);\n}\n\n.status-failed {\n    background: color-mix(in srgb, var(--mj-status-error) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n\n.status-closed {\n    background: color-mix(in srgb, var(--mj-text-disabled) 14%, var(--mj-bg-surface));\n    color: var(--mj-text-muted);\n}\n\n.dot--live {\n    width: 7px;\n    height: 7px;\n    border-radius: 50%;\n    background: var(--mj-status-success);\n    animation: pulse-live 1.6s ease-in-out infinite;\n}\n\n@keyframes pulse-live {\n    0%, 100% { opacity: 1; }\n    50% { opacity: 0.35; }\n}\n\n.dir-pill {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n\n.type-chip {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n    border: 1px solid var(--mj-border-subtle);\n}\n\n.default-pill {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n    color: var(--mj-brand-primary);\n}\n\n/* Close-reason pills */\n.reason-error {\n    background: color-mix(in srgb, var(--mj-status-error) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-error);\n}\n.reason-janitor {\n    background: color-mix(in srgb, var(--mj-status-warning) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-warning);\n}\n.reason-hostended,\n.reason-explicit {\n    background: var(--mj-bg-surface-sunken);\n    color: var(--mj-text-secondary);\n}\n.reason-shutdown {\n    background: color-mix(in srgb, var(--mj-status-info) 12%, var(--mj-bg-surface));\n    color: var(--mj-status-info);\n}\n.reason-unknown {\n    background: color-mix(in srgb, var(--mj-text-disabled) 14%, var(--mj-bg-surface));\n    color: var(--mj-text-muted);\n}\n\n/* \u2500\u2500 Capability chips \u2500\u2500 */\n.cap-chips {\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n    flex-wrap: wrap;\n}\n\n.cap-chip {\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    width: 26px;\n    height: 22px;\n    border-radius: 6px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    color: var(--mj-text-secondary);\n    font-size: 11px;\n}\n\n.cap-more {\n    font-size: 11px;\n    font-weight: 600;\n    color: var(--mj-text-muted);\n}\n\n/* \u2500\u2500 Provider tags (Channels surface) \u2500\u2500 */\n.provider-tags {\n    display: inline-flex;\n    gap: 6px;\n    flex-wrap: wrap;\n}\n\n.provider-tag {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n    font-size: 11px;\n    padding: 2px 8px;\n    border-radius: 10px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    color: var(--mj-text-secondary);\n}\n\n.provider-tag--default {\n    background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n    border-color: color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n    color: var(--mj-brand-primary);\n}\n\n.provider-tag i { font-size: 9px; }\n\n/* \u2500\u2500 Footer \u2500\u2500 */\n.grid-footer {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    margin-top: 14px;\n    flex-wrap: wrap;\n}\n\n.grid-summary {\n    font-size: 12.5px;\n    color: var(--mj-text-muted);\n}\n\n/* \u2500\u2500 Metrics \u2500\u2500 */\n.metrics-grid {\n    display: grid;\n    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));\n    gap: 16px;\n}\n\n.metric-card {\n    background: var(--mj-bg-surface);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    padding: 16px 18px;\n}\n\n.metric-card--wide {\n    grid-column: 1 / -1;\n}\n\n.metric-title {\n    font-size: 13px;\n    font-weight: 600;\n    color: var(--mj-text-primary);\n    margin-bottom: 14px;\n}\n\n/* Vertical bar chart (bridges over time) */\n.bar-chart {\n    display: flex;\n    align-items: flex-end;\n    gap: 6px;\n    height: 160px;\n    overflow-x: auto;\n}\n\n.bar-col {\n    flex: 1;\n    min-width: 16px;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    gap: 6px;\n    height: 100%;\n}\n\n.bar-track {\n    flex: 1;\n    width: 100%;\n    display: flex;\n    align-items: flex-end;\n}\n\n.bar-fill {\n    width: 100%;\n    min-height: 2px;\n    border-radius: 4px 4px 0 0;\n    background: var(--mj-brand-primary);\n    transition: height 0.3s ease;\n}\n\n.bar-value {\n    font-size: 10px;\n    color: var(--mj-text-muted);\n    font-variant-numeric: tabular-nums;\n}\n\n/* Horizontal bars (distributions) */\n.hbar-row {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin-bottom: 10px;\n}\n\n.hbar-label {\n    flex: 0 0 110px;\n    font-size: 12px;\n    color: var(--mj-text-secondary);\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.hbar-track {\n    flex: 1;\n    height: 12px;\n    background: var(--mj-bg-surface-sunken);\n    border-radius: 6px;\n    overflow: hidden;\n}\n\n.hbar-fill {\n    height: 100%;\n    border-radius: 6px;\n    background: var(--mj-brand-primary);\n    transition: width 0.3s ease;\n}\n\n.hbar-count {\n    flex: 0 0 auto;\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n    font-variant-numeric: tabular-nums;\n    min-width: 24px;\n    text-align: right;\n}\n"] }]
    }], null, { TimeRange: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RealtimeManagementComponent, { className: "RealtimeManagementComponent", filePath: "src/AI/components/analytics/realtime/realtime-management.component.ts", lineNumber: 65 }); })();
export function LoadRealtimeManagement() { }
//# sourceMappingURL=realtime-management.component.js.map