import { Component, Input, inject } from '@angular/core';
import { UUIDsEqual } from '@memberjunction/global';
import { IntegrationDataService } from '../../services/integration-data.service';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
import * as i3 from "@angular/common";
const _forTrack0 = ($index, $item) => $item.ID;
const _forTrack1 = ($index, $item) => $item.EntityID;
function RunHistoryPanelComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 0);
    i0.ɵɵelement(1, "mj-loading", 3);
    i0.ɵɵelementEnd();
} }
function RunHistoryPanelComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 1);
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 9)(1, "td", 10);
    i0.ɵɵelement(2, "mj-loading", 11);
    i0.ɵɵelementEnd()();
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_For_20_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr")(1, "td");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td");
    i0.ɵɵtext(4);
    i0.ɵɵpipe(5, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "td");
    i0.ɵɵtext(7);
    i0.ɵɵpipe(8, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "td");
    i0.ɵɵtext(10);
    i0.ɵɵpipe(11, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "td");
    i0.ɵɵtext(13);
    i0.ɵɵpipe(14, "number");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const detail_r4 = ctx.$implicit;
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(detail_r4.Entity);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(5, 7, detail_r4.RecordsProcessed));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(8, 9, detail_r4.RecordsCreated));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 11, detail_r4.RecordsUpdated));
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("error-count", detail_r4.RecordsErrored > 0);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(14, 13, detail_r4.RecordsErrored), " ");
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Conditional_21_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "pre", 18);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const run_r2 = i0.ɵɵnextContext(3).$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(run_r2.ErrorLog);
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Conditional_21_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 14)(1, "button", 15);
    i0.ɵɵlistener("click", function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Conditional_21_Template_button_click_1_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r2 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r2.ToggleErrorLog($event)); });
    i0.ɵɵelement(2, "i", 16);
    i0.ɵɵtext(3, " Error Details ");
    i0.ɵɵelement(4, "i", 17);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(5, RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Conditional_21_Conditional_5_Template, 2, 1, "pre", 18);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(4);
    i0.ɵɵclassProp("rotated", ctx_r2.ShowErrorLog);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.ShowErrorLog ? 5 : -1);
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 9)(1, "td", 10)(2, "div", 12)(3, "h4");
    i0.ɵɵtext(4, "Entity Breakdown");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "table", 13)(6, "thead")(7, "tr")(8, "th");
    i0.ɵɵtext(9, "Entity");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "th");
    i0.ɵɵtext(11, "Processed");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "th");
    i0.ɵɵtext(13, "Created");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "th");
    i0.ɵɵtext(15, "Updated");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "th");
    i0.ɵɵtext(17, "Errors");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(18, "tbody");
    i0.ɵɵrepeaterCreate(19, RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_For_20_Template, 15, 15, "tr", null, _forTrack1);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(21, RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Conditional_21_Template, 6, 3, "div", 14);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const run_r2 = i0.ɵɵnextContext().$implicit;
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(19);
    i0.ɵɵrepeater(ctx_r2.RunDetails);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(run_r2.ErrorLog ? 21 : -1);
} }
function RunHistoryPanelComponent_Conditional_2_For_17_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "tr", 5);
    i0.ɵɵlistener("click", function RunHistoryPanelComponent_Conditional_2_For_17_Template_tr_click_0_listener() { const run_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.OnRunClick(run_r2)); });
    i0.ɵɵelementStart(1, "td");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "td")(4, "span", 6);
    i0.ɵɵelement(5, "i");
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(7, "td", 7);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "td");
    i0.ɵɵtext(10);
    i0.ɵɵpipe(11, "number");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "td");
    i0.ɵɵtext(13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(14, "td");
    i0.ɵɵelement(15, "i", 8);
    i0.ɵɵelementEnd()();
    i0.ɵɵconditionalCreate(16, RunHistoryPanelComponent_Conditional_2_For_17_Conditional_16_Template, 3, 0, "tr", 9);
    i0.ɵɵconditionalCreate(17, RunHistoryPanelComponent_Conditional_2_For_17_Conditional_17_Template, 22, 1, "tr", 9);
} if (rf & 2) {
    const run_r2 = ctx.$implicit;
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("selected", ctx_r2.IsSelectedRun(run_r2.ID));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r2.FormatDate(run_r2.StartedAt));
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap("chip-" + ctx_r2.StatusColor(run_r2));
    i0.ɵɵadvance();
    i0.ɵɵclassMap(ctx_r2.StatusIcon(run_r2));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", run_r2.Status, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r2.FormatDuration(run_r2));
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 15, run_r2.TotalRecords));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(run_r2.RunByUser);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("rotated", ctx_r2.IsSelectedRun(run_r2.ID));
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.IsSelectedRun(run_r2.ID) && ctx_r2.IsLoadingDetails ? 16 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r2.IsSelectedRun(run_r2.ID) && !ctx_r2.IsLoadingDetails && ctx_r2.RunDetails.length > 0 ? 17 : -1);
} }
function RunHistoryPanelComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 2)(1, "table", 4)(2, "thead")(3, "tr")(4, "th");
    i0.ɵɵtext(5, "Started");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "th");
    i0.ɵɵtext(7, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "th");
    i0.ɵɵtext(9, "Duration");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "th");
    i0.ɵɵtext(11, "Records");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(12, "th");
    i0.ɵɵtext(13, "Run By");
    i0.ɵɵelementEnd();
    i0.ɵɵelement(14, "th");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(15, "tbody");
    i0.ɵɵrepeaterCreate(16, RunHistoryPanelComponent_Conditional_2_For_17_Template, 18, 17, null, null, _forTrack0);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(16);
    i0.ɵɵrepeater(ctx_r2.Runs);
} }
export class RunHistoryPanelComponent {
    CompanyIntegrationID = null;
    ViewProvider = null;
    Runs = [];
    RunDetails = [];
    SelectedRunID = null;
    IsLoading = false;
    IsLoadingDetails = false;
    ShowErrorLog = false;
    dataService = inject(IntegrationDataService);
    ngOnChanges(changes) {
        if (changes['CompanyIntegrationID'] && this.CompanyIntegrationID) {
            this.LoadRuns();
        }
    }
    async LoadRuns() {
        if (!this.CompanyIntegrationID)
            return;
        this.IsLoading = true;
        this.SelectedRunID = null;
        this.RunDetails = [];
        this.ShowErrorLog = false;
        try {
            this.Runs = await this.dataService.LoadRunHistory(this.CompanyIntegrationID, 10, this.ViewProvider);
        }
        finally {
            this.IsLoading = false;
        }
    }
    async OnRunClick(run) {
        if (UUIDsEqual(this.SelectedRunID, run.ID)) {
            this.SelectedRunID = null;
            this.RunDetails = [];
            this.ShowErrorLog = false;
            return;
        }
        this.SelectedRunID = run.ID;
        this.IsLoadingDetails = true;
        this.RunDetails = [];
        this.ShowErrorLog = false;
        try {
            this.RunDetails = await this.dataService.LoadRunDetails(run.ID, this.ViewProvider);
        }
        finally {
            this.IsLoadingDetails = false;
        }
    }
    IsSelectedRun(id) {
        return UUIDsEqual(this.SelectedRunID, id);
    }
    StatusColor(run) {
        if (run.Status === 'Success')
            return 'green';
        if (run.Status === 'Failed')
            return 'red';
        return 'amber';
    }
    StatusIcon(run) {
        if (run.Status === 'Success')
            return 'fa-solid fa-circle-check';
        if (run.Status === 'Failed')
            return 'fa-solid fa-circle-xmark';
        if (run.Status === 'In Progress')
            return 'fa-solid fa-spinner fa-spin';
        return 'fa-solid fa-clock';
    }
    FormatDate(dateStr) {
        if (!dateStr)
            return '--';
        const d = new Date(dateStr);
        return d.toLocaleString(undefined, {
            month: 'short', day: 'numeric',
            hour: '2-digit', minute: '2-digit'
        });
    }
    FormatDuration(run) {
        if (!run.StartedAt || !run.EndedAt)
            return '--';
        const ms = new Date(run.EndedAt).getTime() - new Date(run.StartedAt).getTime();
        return this.dataService.FormatDuration(ms);
    }
    ToggleErrorLog(event) {
        event.stopPropagation();
        this.ShowErrorLog = !this.ShowErrorLog;
    }
    static ɵfac = function RunHistoryPanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RunHistoryPanelComponent)(); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RunHistoryPanelComponent, selectors: [["app-run-history-panel"]], inputs: { CompanyIntegrationID: "CompanyIntegrationID", ViewProvider: "ViewProvider" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 3, vars: 1, consts: [[1, "history-loading"], ["Size", "compact", "Icon", "fa-solid fa-clock-rotate-left", "Title", "No runs recorded yet", 1, "history-empty"], [1, "history-panel"], ["text", "Loading run history...", "size", "small"], [1, "history-table"], [1, "run-row", 3, "click"], [1, "run-status-chip"], [1, "duration-cell"], [1, "fa-solid", "fa-chevron-right", "detail-arrow"], [1, "detail-row"], ["colspan", "6"], ["text", "Loading details...", "size", "small"], [1, "detail-panel"], [1, "detail-table"], [1, "error-details-section"], [1, "error-toggle", 3, "click"], [1, "fa-solid", "fa-exclamation-triangle"], [1, "fa-solid", "fa-chevron-down", "toggle-icon"], [1, "error-log"]], template: function RunHistoryPanelComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵconditionalCreate(0, RunHistoryPanelComponent_Conditional_0_Template, 2, 0, "div", 0)(1, RunHistoryPanelComponent_Conditional_1_Template, 1, 0, "mj-empty-state", 1)(2, RunHistoryPanelComponent_Conditional_2_Template, 18, 0, "div", 2);
        } if (rf & 2) {
            i0.ɵɵconditional(ctx.IsLoading ? 0 : ctx.Runs.length === 0 ? 1 : 2);
        } }, dependencies: [i1.MJEmptyStateComponent, i2.LoadingComponent, i3.DecimalPipe], styles: [".history-loading[_ngcontent-%COMP%], .history-empty[_ngcontent-%COMP%] {\n      padding: 24px; text-align: center; color: var(--mj-text-muted);\n    }\n    .history-empty[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { font-size: 24px; margin-bottom: 8px; display: block; }\n\n    .history-panel[_ngcontent-%COMP%] { margin-top: 8px; }\n\n    .history-table[_ngcontent-%COMP%] {\n      width: 100%; border-collapse: collapse; font-size: 13px;\n    }\n    .history-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n      text-align: left; padding: 6px 8px;\n      border-bottom: 2px solid var(--mj-border-default); color: var(--mj-text-secondary); font-weight: 600;\n    }\n    .run-row[_ngcontent-%COMP%] { cursor: pointer; }\n    .run-row[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-sunken); }\n    .run-row.selected[_ngcontent-%COMP%] { background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface)); }\n    .run-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] { padding: 6px 8px; border-bottom: 1px solid var(--mj-border-default); }\n\n    \n\n    .run-status-chip[_ngcontent-%COMP%] {\n      font-size: 11px; font-weight: 600; padding: 3px 8px;\n      border-radius: 10px; display: inline-flex; align-items: center; gap: 4px;\n      white-space: nowrap;\n    }\n    .chip-green[_ngcontent-%COMP%] { background: var(--mj-status-success-bg); color: var(--mj-status-success-text); }\n    .chip-amber[_ngcontent-%COMP%] { background: var(--mj-status-warning-bg); color: var(--mj-status-warning-text); }\n    .chip-red[_ngcontent-%COMP%]   { background: var(--mj-status-error-bg); color: var(--mj-status-error-text); }\n\n    .duration-cell[_ngcontent-%COMP%] {\n      font-variant-numeric: tabular-nums;\n      color: var(--mj-text-secondary);\n    }\n\n    .detail-arrow[_ngcontent-%COMP%] { transition: transform 0.2s; font-size: 11px; color: var(--mj-text-muted); }\n    .detail-arrow.rotated[_ngcontent-%COMP%] { transform: rotate(90deg); }\n\n    .detail-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] { padding: 0; }\n    .detail-panel[_ngcontent-%COMP%] {\n      padding: 12px 16px; background: var(--mj-bg-surface-sunken);\n      border-left: 3px solid var(--mj-brand-primary);\n    }\n    .detail-panel[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%] { margin: 0 0 8px 0; font-size: 13px; }\n\n    .detail-table[_ngcontent-%COMP%] {\n      width: 100%; border-collapse: collapse; font-size: 12px;\n    }\n    .detail-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%] {\n      text-align: left; padding: 4px 6px; color: var(--mj-text-muted); font-weight: 500;\n    }\n    .detail-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%] { padding: 4px 6px; }\n    .error-count[_ngcontent-%COMP%] { color: var(--mj-status-error-text); font-weight: 600; }\n\n    \n\n    .error-details-section[_ngcontent-%COMP%] {\n      margin-top: 12px;\n      border-top: 1px solid var(--mj-border-default);\n      padding-top: 8px;\n    }\n    .error-toggle[_ngcontent-%COMP%] {\n      background: none; border: none; cursor: pointer;\n      font-size: 12px; font-weight: 600; color: var(--mj-status-error-text);\n      display: flex; align-items: center; gap: 6px;\n      padding: 4px 0;\n    }\n    .error-toggle[_ngcontent-%COMP%]:hover { text-decoration: underline; }\n    .toggle-icon[_ngcontent-%COMP%] {\n      transition: transform 0.2s; font-size: 10px;\n    }\n    .toggle-icon.rotated[_ngcontent-%COMP%] { transform: rotate(180deg); }\n    .error-log[_ngcontent-%COMP%] {\n      margin: 8px 0 0 0; padding: 10px;\n      background: var(--mj-status-error-bg); border: 1px solid var(--mj-status-error-border);\n      border-radius: 4px; font-size: 11px;\n      white-space: pre-wrap; word-break: break-word;\n      max-height: 200px; overflow-y: auto;\n      color: var(--mj-status-error-text);\n    }"] });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RunHistoryPanelComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'app-run-history-panel', template: `
    @if (IsLoading) {
      <div class="history-loading">
        <mj-loading text="Loading run history..." size="small"></mj-loading>
      </div>
    } @else if (Runs.length === 0) {
      <mj-empty-state class="history-empty" Size="compact"
        Icon="fa-solid fa-clock-rotate-left"
        Title="No runs recorded yet" />
    } @else {
      <div class="history-panel">
        <table class="history-table">
          <thead>
            <tr>
              <th>Started</th>
              <th>Status</th>
              <th>Duration</th>
              <th>Records</th>
              <th>Run By</th>
              <th></th>
            </tr>
          </thead>
          <tbody>
            @for (run of Runs; track run.ID) {
              <tr class="run-row" [class.selected]="IsSelectedRun(run.ID)"
                  (click)="OnRunClick(run)">
                <td>{{ FormatDate(run.StartedAt) }}</td>
                <td>
                  <span class="run-status-chip" [class]="'chip-' + StatusColor(run)">
                    <i [class]="StatusIcon(run)"></i>
                    {{ run.Status }}
                  </span>
                </td>
                <td class="duration-cell">{{ FormatDuration(run) }}</td>
                <td>{{ run.TotalRecords | number }}</td>
                <td>{{ run.RunByUser }}</td>
                <td>
                  <i class="fa-solid fa-chevron-right detail-arrow"
                     [class.rotated]="IsSelectedRun(run.ID)"></i>
                </td>
              </tr>
              @if (IsSelectedRun(run.ID) && IsLoadingDetails) {
                <tr class="detail-row">
                  <td colspan="6">
                    <mj-loading text="Loading details..." size="small"></mj-loading>
                  </td>
                </tr>
              }
              @if (IsSelectedRun(run.ID) && !IsLoadingDetails && RunDetails.length > 0) {
                <tr class="detail-row">
                  <td colspan="6">
                    <div class="detail-panel">
                      <h4>Entity Breakdown</h4>
                      <table class="detail-table">
                        <thead>
                          <tr>
                            <th>Entity</th>
                            <th>Processed</th>
                            <th>Created</th>
                            <th>Updated</th>
                            <th>Errors</th>
                          </tr>
                        </thead>
                        <tbody>
                          @for (detail of RunDetails; track detail.EntityID) {
                            <tr>
                              <td>{{ detail.Entity }}</td>
                              <td>{{ detail.RecordsProcessed | number }}</td>
                              <td>{{ detail.RecordsCreated | number }}</td>
                              <td>{{ detail.RecordsUpdated | number }}</td>
                              <td [class.error-count]="detail.RecordsErrored > 0">
                                {{ detail.RecordsErrored | number }}
                              </td>
                            </tr>
                          }
                        </tbody>
                      </table>

                      <!-- Error details expandable -->
                      @if (run.ErrorLog) {
                        <div class="error-details-section">
                          <button class="error-toggle" (click)="ToggleErrorLog($event)">
                            <i class="fa-solid fa-exclamation-triangle"></i>
                            Error Details
                            <i class="fa-solid fa-chevron-down toggle-icon"
                               [class.rotated]="ShowErrorLog"></i>
                          </button>
                          @if (ShowErrorLog) {
                            <pre class="error-log">{{ run.ErrorLog }}</pre>
                          }
                        </div>
                      }
                    </div>
                  </td>
                </tr>
              }
            }
          </tbody>
        </table>
      </div>
    }
  `, styles: ["\n    .history-loading, .history-empty {\n      padding: 24px; text-align: center; color: var(--mj-text-muted);\n    }\n    .history-empty i { font-size: 24px; margin-bottom: 8px; display: block; }\n\n    .history-panel { margin-top: 8px; }\n\n    .history-table {\n      width: 100%; border-collapse: collapse; font-size: 13px;\n    }\n    .history-table th {\n      text-align: left; padding: 6px 8px;\n      border-bottom: 2px solid var(--mj-border-default); color: var(--mj-text-secondary); font-weight: 600;\n    }\n    .run-row { cursor: pointer; }\n    .run-row:hover { background: var(--mj-bg-surface-sunken); }\n    .run-row.selected { background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface)); }\n    .run-row td { padding: 6px 8px; border-bottom: 1px solid var(--mj-border-default); }\n\n    /* Status Chips with icon */\n    .run-status-chip {\n      font-size: 11px; font-weight: 600; padding: 3px 8px;\n      border-radius: 10px; display: inline-flex; align-items: center; gap: 4px;\n      white-space: nowrap;\n    }\n    .chip-green { background: var(--mj-status-success-bg); color: var(--mj-status-success-text); }\n    .chip-amber { background: var(--mj-status-warning-bg); color: var(--mj-status-warning-text); }\n    .chip-red   { background: var(--mj-status-error-bg); color: var(--mj-status-error-text); }\n\n    .duration-cell {\n      font-variant-numeric: tabular-nums;\n      color: var(--mj-text-secondary);\n    }\n\n    .detail-arrow { transition: transform 0.2s; font-size: 11px; color: var(--mj-text-muted); }\n    .detail-arrow.rotated { transform: rotate(90deg); }\n\n    .detail-row td { padding: 0; }\n    .detail-panel {\n      padding: 12px 16px; background: var(--mj-bg-surface-sunken);\n      border-left: 3px solid var(--mj-brand-primary);\n    }\n    .detail-panel h4 { margin: 0 0 8px 0; font-size: 13px; }\n\n    .detail-table {\n      width: 100%; border-collapse: collapse; font-size: 12px;\n    }\n    .detail-table th {\n      text-align: left; padding: 4px 6px; color: var(--mj-text-muted); font-weight: 500;\n    }\n    .detail-table td { padding: 4px 6px; }\n    .error-count { color: var(--mj-status-error-text); font-weight: 600; }\n\n    /* Error Details */\n    .error-details-section {\n      margin-top: 12px;\n      border-top: 1px solid var(--mj-border-default);\n      padding-top: 8px;\n    }\n    .error-toggle {\n      background: none; border: none; cursor: pointer;\n      font-size: 12px; font-weight: 600; color: var(--mj-status-error-text);\n      display: flex; align-items: center; gap: 6px;\n      padding: 4px 0;\n    }\n    .error-toggle:hover { text-decoration: underline; }\n    .toggle-icon {\n      transition: transform 0.2s; font-size: 10px;\n    }\n    .toggle-icon.rotated { transform: rotate(180deg); }\n    .error-log {\n      margin: 8px 0 0 0; padding: 10px;\n      background: var(--mj-status-error-bg); border: 1px solid var(--mj-status-error-border);\n      border-radius: 4px; font-size: 11px;\n      white-space: pre-wrap; word-break: break-word;\n      max-height: 200px; overflow-y: auto;\n      color: var(--mj-status-error-text);\n    }\n  "] }]
    }], null, { CompanyIntegrationID: [{
            type: Input
        }], ViewProvider: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RunHistoryPanelComponent, { className: "RunHistoryPanelComponent", filePath: "src/Integration/components/widgets/run-history-panel.component.ts", lineNumber: 194 }); })();
//# sourceMappingURL=run-history-panel.component.js.map