var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { ChangeDetectorRef, Component, inject } from '@angular/core';
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
import { CompositeKey, RunView } from '@memberjunction/core';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { IntegrationDataService, ResolveIntegrationIcon } from '../../services/integration-data.service';
import { buildSchedulesAgentContext, resolveIntegrationSurface, navLabelForSurface, resolveIntegrationRecord, buildIntegrationNotFoundError, } from '../../integration-agent-context';
import { validateStringParam } from '../../../shared/agent-tool-validation';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
function SchedulesComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 1);
    i0.ɵɵelement(1, "mj-stat-badge", 6);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵproperty("Count", ctx_r0.LockedCount);
} }
function SchedulesComponent_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 4);
    i0.ɵɵelement(1, "mj-loading", 7);
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_9_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 20);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const hour_r2 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵstyleProp("left", ctx_r0.ComputeTimelinePosition(hour_r2, 0), "%");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", hour_r2, ":00 ");
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, SchedulesComponent_Conditional_7_Conditional_1_For_9_Conditional_0_Template, 2, 3, "span", 19);
} if (rf & 2) {
    const hour_r2 = ctx.$implicit;
    i0.ɵɵconditional(hour_r2 % 4 === 0 ? 0 : -1);
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_11_For_5_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 28);
} if (rf & 2) {
    const hour_r3 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵstyleProp("left", ctx_r0.ComputeTimelinePosition(hour_r3, 0), "%");
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_11_For_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, SchedulesComponent_Conditional_7_Conditional_1_For_11_For_5_Conditional_0_Template, 1, 2, "div", 27);
} if (rf & 2) {
    const hour_r3 = ctx.$implicit;
    i0.ɵɵconditional(hour_r3 % 4 === 0 ? 0 : -1);
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_11_For_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 29);
} if (rf & 2) {
    const marker_r4 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(4);
    i0.ɵɵstyleProp("left", ctx_r0.ComputeTimelinePosition(marker_r4.Hour, marker_r4.Minute), "%");
    i0.ɵɵclassProp("timeline-marker-next", marker_r4.IsNext);
    i0.ɵɵproperty("title", marker_r4.Hour + ":" + ("" + marker_r4.Minute).padStart(2, "0"));
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_11_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 25);
    i0.ɵɵelement(1, "i", 30);
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_Conditional_1_For_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 18)(1, "div", 21);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 22);
    i0.ɵɵrepeaterCreate(4, SchedulesComponent_Conditional_7_Conditional_1_For_11_For_5_Template, 1, 1, null, null, i0.ɵɵcomponentInstance().TrackHour, true);
    i0.ɵɵelement(6, "div", 23);
    i0.ɵɵrepeaterCreate(7, SchedulesComponent_Conditional_7_Conditional_1_For_11_For_8_Template, 1, 5, "div", 24, i0.ɵɵcomponentInstance().TrackMarker, true);
    i0.ɵɵconditionalCreate(9, SchedulesComponent_Conditional_7_Conditional_1_For_11_Conditional_9_Template, 2, 0, "div", 25);
    i0.ɵɵelement(10, "div", 26);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const row_r5 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", row_r5.IntegrationName);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", row_r5.IntegrationName, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.TimelineHours);
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(row_r5.Markers);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(row_r5.IsLocked ? 9 : -1);
} }
function SchedulesComponent_Conditional_7_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8)(1, "div", 12);
    i0.ɵɵelement(2, "i", 13);
    i0.ɵɵtext(3, " Next 24 Hours ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 14)(5, "div", 15);
    i0.ɵɵelement(6, "div", 16);
    i0.ɵɵelementStart(7, "div", 17);
    i0.ɵɵrepeaterCreate(8, SchedulesComponent_Conditional_7_Conditional_1_For_9_Template, 1, 1, null, null, i0.ɵɵcomponentInstance().TrackHour, true);
    i0.ɵɵelementEnd()();
    i0.ɵɵrepeaterCreate(10, SchedulesComponent_Conditional_7_Conditional_1_For_11_Template, 11, 3, "div", 18, i0.ɵɵcomponentInstance().TrackTimelineByID, true);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(8);
    i0.ɵɵrepeater(ctx_r0.TimelineHours);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.TimelineMarkers);
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 38);
    i0.ɵɵtext(1, "Active");
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 39);
    i0.ɵɵtext(1, "Inactive");
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 40);
    i0.ɵɵelement(1, "i", 30);
    i0.ɵɵtext(2, " Running ");
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_For_3_Template(rf, ctx) { if (rf & 1) {
    const _r10 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 63);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_For_3_Template_button_click_0_listener() { const preset_r11 = i0.ɵɵrestoreView(_r10).$implicit; const schedule_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetInterval(schedule_r7.ID, preset_r11.Minutes)); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const preset_r11 = ctx.$implicit;
    const schedule_r7 = i0.ɵɵnextContext(3).$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("preset-btn-active", ctx_r0.IsIntervalSelected(schedule_r7, preset_r11.Minutes));
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", preset_r11.Label, " ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_Template(rf, ctx) { if (rf & 1) {
    const _r9 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 42)(1, "div", 58);
    i0.ɵɵrepeaterCreate(2, SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_For_3_Template, 2, 3, "button", 59, i0.ɵɵcomponentInstance().TrackPresetByMinutes, true);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 60)(5, "input", 61);
    i0.ɵɵlistener("change", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_Template_input_change_5_listener($event) { i0.ɵɵrestoreView(_r9); const schedule_r7 = i0.ɵɵnextContext(2).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetCustomInterval(schedule_r7.ID, $event)); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "span", 62);
    i0.ɵɵtext(7, "min");
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const schedule_r7 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.IntervalPresets);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("value", ctx_r0.GetEffectiveInterval(schedule_r7));
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_For_3_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 63);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_For_3_Template_button_click_0_listener() { const preset_r14 = i0.ɵɵrestoreView(_r13).$implicit; const schedule_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetCronExpression(schedule_r7.ID, preset_r14.Expression)); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const preset_r14 = ctx.$implicit;
    const schedule_r7 = i0.ɵɵnextContext(3).$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("preset-btn-active", ctx_r0.GetEffectiveCron(schedule_r7) === preset_r14.Expression);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", preset_r14.Label, " ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 67);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const schedule_r7 = i0.ɵɵnextContext(3).$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r0.GetCronDescription(ctx_r0.GetEffectiveCron(schedule_r7)), " ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    const _r12 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 42)(1, "div", 64);
    i0.ɵɵrepeaterCreate(2, SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_For_3_Template, 2, 3, "button", 59, i0.ɵɵcomponentInstance().TrackCronPresetByExpr, true);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 65)(5, "input", 66);
    i0.ɵɵlistener("change", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_Template_input_change_5_listener($event) { i0.ɵɵrestoreView(_r12); const schedule_r7 = i0.ɵɵnextContext(2).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.OnCronInputChange(schedule_r7.ID, $event)); });
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(6, SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_Conditional_6_Template, 2, 1, "span", 67);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const schedule_r7 = i0.ɵɵnextContext(2).$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.CronPresets);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("value", ctx_r0.GetEffectiveCron(schedule_r7) ?? "");
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.GetEffectiveCron(schedule_r7) ? 6 : -1);
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 42)(1, "div", 56)(2, "button", 57);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r8); const schedule_r7 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetScheduleType(schedule_r7.ID, "Manual")); });
    i0.ɵɵtext(3, " Manual ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "button", 57);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r8); const schedule_r7 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetScheduleType(schedule_r7.ID, "Interval")); });
    i0.ɵɵtext(5, " Interval ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "button", 57);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_19_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r8); const schedule_r7 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SetScheduleType(schedule_r7.ID, "Cron")); });
    i0.ɵɵtext(7, " Cron ");
    i0.ɵɵelementEnd()()();
    i0.ɵɵconditionalCreate(8, SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_8_Template, 8, 1, "div", 42);
    i0.ɵɵconditionalCreate(9, SchedulesComponent_Conditional_7_For_4_Conditional_19_Conditional_9_Template, 7, 2, "div", 42);
} if (rf & 2) {
    const schedule_r7 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("type-pill-active", ctx_r0.GetEffectiveScheduleType(schedule_r7) === "Manual");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("type-pill-active", ctx_r0.GetEffectiveScheduleType(schedule_r7) === "Interval");
    i0.ɵɵadvance(2);
    i0.ɵɵclassProp("type-pill-active", ctx_r0.GetEffectiveScheduleType(schedule_r7) === "Cron");
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r0.GetEffectiveScheduleType(schedule_r7) === "Interval" ? 8 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.GetEffectiveScheduleType(schedule_r7) === "Cron" ? 9 : -1);
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_35_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 51);
    i0.ɵɵelement(1, "i", 30);
    i0.ɵɵtext(2, " Running ");
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_36_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 52);
    i0.ɵɵtext(1, "Idle");
    i0.ɵɵelementEnd();
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_38_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 30);
    i0.ɵɵtext(1, " Saving... ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_38_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 69);
    i0.ɵɵtext(1, " Save ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_38_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 68);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Conditional_38_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r15); const schedule_r7 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.SaveSchedule(schedule_r7.ID)); });
    i0.ɵɵconditionalCreate(1, SchedulesComponent_Conditional_7_For_4_Conditional_38_Conditional_1_Template, 2, 0)(2, SchedulesComponent_Conditional_7_For_4_Conditional_38_Conditional_2_Template, 2, 0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const schedule_r7 = i0.ɵɵnextContext().$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("disabled", ctx_r0.IsSaving(schedule_r7.ID));
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.IsSaving(schedule_r7.ID) ? 1 : 2);
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_40_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 30);
    i0.ɵɵtext(1, " Running... ");
} }
function SchedulesComponent_Conditional_7_For_4_Conditional_41_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 70);
    i0.ɵɵtext(1, " Run Now ");
} }
function SchedulesComponent_Conditional_7_For_4_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 31)(1, "div", 32)(2, "div", 33);
    i0.ɵɵelement(3, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 34)(5, "div", 35);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "div", 36);
    i0.ɵɵtext(8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "div", 37);
    i0.ɵɵconditionalCreate(10, SchedulesComponent_Conditional_7_For_4_Conditional_10_Template, 2, 0, "span", 38)(11, SchedulesComponent_Conditional_7_For_4_Conditional_11_Template, 2, 0, "span", 39);
    i0.ɵɵconditionalCreate(12, SchedulesComponent_Conditional_7_For_4_Conditional_12_Template, 3, 0, "span", 40);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(13, "div", 41)(14, "div", 42)(15, "label", 43);
    i0.ɵɵtext(16, " Auto-sync ");
    i0.ɵɵelementStart(17, "button", 44);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Template_button_click_17_listener() { const schedule_r7 = i0.ɵɵrestoreView(_r6).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.ToggleScheduleEnabled(schedule_r7.ID)); });
    i0.ɵɵelement(18, "span", 45);
    i0.ɵɵelementEnd()()();
    i0.ɵɵconditionalCreate(19, SchedulesComponent_Conditional_7_For_4_Conditional_19_Template, 10, 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(20, "div", 46)(21, "div", 47)(22, "div", 48)(23, "span", 49);
    i0.ɵɵtext(24, "Next run");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(25, "span", 50);
    i0.ɵɵtext(26);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(27, "div", 48)(28, "span", 49);
    i0.ɵɵtext(29, "Last run");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(30, "span", 50);
    i0.ɵɵtext(31);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(32, "div", 48)(33, "span", 49);
    i0.ɵɵtext(34, "Status");
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(35, SchedulesComponent_Conditional_7_For_4_Conditional_35_Template, 3, 0, "span", 51)(36, SchedulesComponent_Conditional_7_For_4_Conditional_36_Template, 2, 0, "span", 52);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(37, "div", 53);
    i0.ɵɵconditionalCreate(38, SchedulesComponent_Conditional_7_For_4_Conditional_38_Template, 3, 2, "button", 54);
    i0.ɵɵelementStart(39, "button", 55);
    i0.ɵɵlistener("click", function SchedulesComponent_Conditional_7_For_4_Template_button_click_39_listener() { const schedule_r7 = i0.ɵɵrestoreView(_r6).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.RunNow(schedule_r7.ID)); });
    i0.ɵɵconditionalCreate(40, SchedulesComponent_Conditional_7_For_4_Conditional_40_Template, 2, 0)(41, SchedulesComponent_Conditional_7_For_4_Conditional_41_Template, 2, 0);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const schedule_r7 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("schedule-card-disabled", !schedule_r7.IsActive);
    i0.ɵɵadvance(3);
    i0.ɵɵclassMap(ctx_r0.GetIntegrationIcon(schedule_r7.Integration || schedule_r7.Name));
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(schedule_r7.Integration || schedule_r7.Name);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(schedule_r7.Company);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(schedule_r7.IsActive ? 10 : 11);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(schedule_r7.IsLocked ? 12 : -1);
    i0.ɵɵadvance(5);
    i0.ɵɵclassProp("toggle-on", ctx_r0.GetEffectiveScheduleEnabled(schedule_r7));
    i0.ɵɵattribute("aria-checked", ctx_r0.GetEffectiveScheduleEnabled(schedule_r7));
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r0.GetEffectiveScheduleEnabled(schedule_r7) ? 19 : -1);
    i0.ɵɵadvance(7);
    i0.ɵɵtextInterpolate(ctx_r0.GetNextRunRelative(schedule_r7));
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r0.GetLastRunRelative(schedule_r7));
    i0.ɵɵadvance(4);
    i0.ɵɵconditional(schedule_r7.IsLocked ? 35 : 36);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r0.HasChanges(schedule_r7.ID) ? 38 : -1);
    i0.ɵɵadvance();
    i0.ɵɵproperty("disabled", ctx_r0.IsRunning(schedule_r7.ID) || schedule_r7.IsLocked);
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.IsRunning(schedule_r7.ID) ? 40 : 41);
} }
function SchedulesComponent_Conditional_7_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-empty-state", 11);
} }
function SchedulesComponent_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 5);
    i0.ɵɵconditionalCreate(1, SchedulesComponent_Conditional_7_Conditional_1_Template, 12, 0, "div", 8);
    i0.ɵɵelementStart(2, "div", 9);
    i0.ɵɵrepeaterCreate(3, SchedulesComponent_Conditional_7_For_4_Template, 42, 18, "div", 10, i0.ɵɵcomponentInstance().TrackByID, true);
    i0.ɵɵconditionalCreate(5, SchedulesComponent_Conditional_7_Conditional_5_Template, 1, 0, "mj-empty-state", 11);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r0.TimelineMarkers.length > 0 ? 1 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r0.Schedules);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r0.Schedules.length === 0 ? 5 : -1);
} }
// ---------------------------------------------------------------------------
// Component
// ---------------------------------------------------------------------------
let SchedulesComponent = class SchedulesComponent extends BaseResourceComponent {
    // ---------------------------------------------------------------------------
    // Public state
    // ---------------------------------------------------------------------------
    Schedules = [];
    IsLoading = true;
    SavingID = null;
    RunningID = null;
    /** Track pending edits per integration ID */
    PendingChanges = new Map();
    /** Timeline data built from schedules */
    TimelineMarkers = [];
    TimelineHours = [];
    /** Preset interval choices */
    IntervalPresets = [
        { Label: '5m', Minutes: 5 },
        { Label: '15m', Minutes: 15 },
        { Label: '30m', Minutes: 30 },
        { Label: '1h', Minutes: 60 },
        { Label: '6h', Minutes: 360 },
        { Label: '12h', Minutes: 720 },
        { Label: '24h', Minutes: 1440 }
    ];
    /** Preset cron expressions */
    CronPresets = [
        { Label: 'Every hour', Expression: '0 * * * *' },
        { Label: 'Every 6 hours', Expression: '0 */6 * * *' },
        { Label: 'Daily midnight', Expression: '0 0 * * *' },
        { Label: 'Weekdays 9am', Expression: '0 9 * * 1-5' }
    ];
    // ---------------------------------------------------------------------------
    // Private
    // ---------------------------------------------------------------------------
    dataService = inject(IntegrationDataService);
    cdr = inject(ChangeDetectorRef);
    refreshTimer = null;
    /** JobTypeID for "Integration Sync" scheduled job type (from MJ metadata) */
    INTEGRATION_SYNC_JOB_TYPE_ID = '4CD34733-4751-4572-B946-17DF6CB3EC90';
    // ---------------------------------------------------------------------------
    // Lifecycle
    // ---------------------------------------------------------------------------
    async ngOnInit() {
        super.ngOnInit();
        this.dataService.Provider = this.ProviderToUse;
        this.buildTimelineHours();
        await this.LoadData();
        this.NotifyLoadComplete();
        // Refresh relative times every 60 seconds
        this.refreshTimer = setInterval(() => this.cdr.detectChanges(), 60_000);
    }
    ngOnDestroy() {
        super.ngOnDestroy();
        if (this.refreshTimer) {
            clearInterval(this.refreshTimer);
            this.refreshTimer = null;
        }
    }
    // ---------------------------------------------------------------------------
    // AI Agent Context & Client Tools
    //
    // 🔒 SAFETY BOUNDARY: The Schedules surface exposes ONLY navigational,
    // read-only open-record, and refresh tools to the agent
    // (SwitchIntegrationSurface, OpenScheduleRecord, RefreshIntegrationData). It
    // deliberately does NOT expose any sync trigger (RunSync / RunNow — a LIVE
    // external sync), nor update-schedule (SaveSchedule / ToggleScheduleEnabled /
    // SetScheduleType / SetInterval / SetCronExpression — which create/update/disable
    // the linked ScheduledJob), nor edit-mapping / change-credentials. Changing a
    // schedule remains user-driven from the UI. OpenScheduleRecord opens the record
    // in a tab for VIEWING — it does not edit.
    // ---------------------------------------------------------------------------
    ngAfterViewInit() {
        this.emitAgentContext();
        this.registerAgentTools();
    }
    emitAgentContext() {
        const context = buildSchedulesAgentContext({
            KPIs: {
                TotalIntegrations: this.Schedules.length,
                ActiveSyncs: 0,
                RecordsSyncedToday: 0,
                SyncErrorRate: 0,
                PipelineCount: 0,
                ScheduledSyncCount: this.ScheduledCount,
            },
            IsLoading: this.IsLoading,
            ScheduleCount: this.Schedules.length,
            EnabledCount: this.ScheduledCount,
            LockedCount: this.LockedCount,
            IntervalCount: this.countByType('Interval'),
            CronCount: this.countByType('Cron'),
            ManualCount: this.countByType('Manual'),
            VisibleSchedules: this.Schedules.map(s => this.buildScheduleSummary(s)),
        });
        this.navigationService.SetAgentContext(this, context);
    }
    registerAgentTools() {
        this.navigationService.SetAgentClientTools(this, [
            {
                Name: 'SwitchIntegrationSurface',
                Description: 'Switch to a different Integration surface. Valid surfaces: Overview, Connections, Activity, Schedules.',
                ParameterSchema: { type: 'object', properties: { surface: { type: 'string' } }, required: ['surface'] },
                Handler: async (params) => this.toolSwitchSurface(params),
            },
            {
                Name: 'OpenScheduleRecord',
                Description: 'Open a scheduled integration\'s company-integration record in a tab for viewing. Accepts the integration ID or name (exact or partial).',
                ParameterSchema: { type: 'object', properties: { integration: { type: 'string' } }, required: ['integration'] },
                Handler: async (params) => this.toolOpenScheduleRecord(params),
            },
            {
                Name: 'RefreshIntegrationData',
                Description: 'Reload the integration sync schedules.',
                ParameterSchema: { type: 'object', properties: {} },
                Handler: async () => {
                    await this.LoadData();
                    return { Success: true };
                },
            },
        ]);
    }
    async toolSwitchSurface(params) {
        const surface = resolveIntegrationSurface(params['surface']);
        if (!surface) {
            return { Success: false, ErrorMessage: 'Invalid surface. Expected one of: Overview, Connections, Activity, Schedules.' };
        }
        const tabId = await this.navigationService.OpenNavItemByName(navLabelForSurface(surface));
        if (!tabId) {
            return { Success: false, ErrorMessage: `Could not open the "${surface}" surface.` };
        }
        return { Success: true };
    }
    toolOpenScheduleRecord(params) {
        const check = validateStringParam(params['integration'], 'integration');
        if (!check.ok) {
            return check.result;
        }
        const candidates = this.Schedules.map(s => ({
            ID: s.ID,
            Name: s.Integration ?? s.Name,
        }));
        const match = resolveIntegrationRecord(check.value, candidates);
        if (!match) {
            return { Success: false, ErrorMessage: buildIntegrationNotFoundError(check.value, candidates, 'integration') };
        }
        this.navigationService.OpenEntityRecord('MJ: Company Integrations', CompositeKey.FromID(match.ID));
        return { Success: true };
    }
    /** Count of schedules of a given cadence type. */
    countByType(type) {
        return this.Schedules.filter(s => s.ScheduleType === type).length;
    }
    buildScheduleSummary(s) {
        return {
            Name: `${s.Integration ?? s.Name} · ${this.GetNextRunRelative(s)}`,
            Type: s.ScheduleType,
            Enabled: s.ScheduleEnabled,
            Locked: s.IsLocked,
            NextRun: this.GetNextRunRelative(s),
        };
    }
    // ---------------------------------------------------------------------------
    // Resource overrides
    // ---------------------------------------------------------------------------
    async GetResourceDisplayName(_data) {
        return 'Schedules';
    }
    async GetResourceIconClass(_data) {
        return 'fa-solid fa-calendar-check';
    }
    // ---------------------------------------------------------------------------
    // Data loading
    // ---------------------------------------------------------------------------
    async LoadData() {
        this.IsLoading = true;
        this.cdr.detectChanges();
        try {
            const provider = this.RunViewToUse;
            const rv = new RunView(provider ?? null);
            const result = await rv.RunView({
                EntityName: 'MJ: Company Integrations',
                ExtraFilter: '',
                OrderBy: 'Name',
                Fields: [
                    'ID', 'Name', 'Integration', 'Company', 'IsActive',
                    'ScheduleEnabled', 'ScheduleType', 'ScheduleIntervalMinutes',
                    'CronExpression', 'NextScheduledRunAt', 'LastScheduledRunAt',
                    'IsLocked', 'LockedAt', 'ScheduledJobID'
                ],
                ResultType: 'simple'
            });
            this.Schedules = result.Results;
            this.BuildTimeline();
        }
        catch (err) {
            console.error('[SchedulesComponent] Failed to load data:', err);
        }
        finally {
            this.IsLoading = false;
            this.cdr.detectChanges();
            this.emitAgentContext();
        }
    }
    // ---------------------------------------------------------------------------
    // Timeline
    // ---------------------------------------------------------------------------
    BuildTimeline() {
        const now = new Date();
        const rows = [];
        for (const schedule of this.Schedules) {
            if (!schedule.ScheduleEnabled)
                continue;
            const markers = this.computeMarkersForSchedule(schedule, now);
            if (markers.length > 0 || schedule.IsLocked) {
                rows.push({
                    IntegrationID: schedule.ID,
                    IntegrationName: schedule.Integration ?? schedule.Name,
                    Markers: markers,
                    IsLocked: schedule.IsLocked
                });
            }
        }
        this.TimelineMarkers = rows;
    }
    // ---------------------------------------------------------------------------
    // Schedule editing
    // ---------------------------------------------------------------------------
    ToggleScheduleEnabled(integrationID) {
        const schedule = this.findSchedule(integrationID);
        if (!schedule)
            return;
        const current = this.getEffectiveValue(integrationID, 'ScheduleEnabled', schedule.ScheduleEnabled);
        this.setPendingChange(integrationID, 'ScheduleEnabled', !current);
    }
    SetScheduleType(integrationID, type) {
        this.setPendingChange(integrationID, 'ScheduleType', type);
    }
    SetInterval(integrationID, minutes) {
        this.setPendingChange(integrationID, 'ScheduleIntervalMinutes', minutes);
        this.setPendingChange(integrationID, 'ScheduleType', 'Interval');
    }
    SetCronExpression(integrationID, expression) {
        this.setPendingChange(integrationID, 'CronExpression', expression);
    }
    OnCronInputChange(integrationID, event) {
        const input = event.target;
        this.SetCronExpression(integrationID, input.value);
    }
    SetCustomInterval(integrationID, event) {
        const input = event.target;
        const value = parseInt(input.value, 10);
        if (!isNaN(value) && value > 0) {
            this.SetInterval(integrationID, value);
        }
    }
    HasChanges(integrationID) {
        return this.PendingChanges.has(integrationID);
    }
    // ---------------------------------------------------------------------------
    // Save & Run
    // ---------------------------------------------------------------------------
    async SaveSchedule(integrationID) {
        const changes = this.PendingChanges.get(integrationID);
        if (!changes)
            return;
        this.SavingID = integrationID;
        this.cdr.detectChanges();
        try {
            const md = this.ProviderToUse;
            const entity = await md.GetEntityObject('MJ: Company Integrations');
            await entity.Load(integrationID);
            // Resolve effective values (pending change wins over stored value)
            const scheduleEnabled = changes.ScheduleEnabled ?? entity.Get('ScheduleEnabled');
            const scheduleType = (changes.ScheduleType ?? entity.Get('ScheduleType'));
            const cronExpression = changes.CronExpression ?? entity.Get('CronExpression');
            const intervalMinutes = changes.ScheduleIntervalMinutes ?? entity.Get('ScheduleIntervalMinutes');
            // Apply schedule fields to the entity
            if (changes.ScheduleEnabled !== undefined)
                entity.Set('ScheduleEnabled', changes.ScheduleEnabled);
            if (changes.ScheduleType !== undefined)
                entity.Set('ScheduleType', changes.ScheduleType);
            if (changes.ScheduleIntervalMinutes !== undefined)
                entity.Set('ScheduleIntervalMinutes', changes.ScheduleIntervalMinutes);
            if (changes.CronExpression !== undefined)
                entity.Set('CronExpression', changes.CronExpression);
            // Create/update/disable the linked ScheduledJob so the scheduler actually fires
            await this.SyncScheduledJob(entity, scheduleEnabled, scheduleType, cronExpression, intervalMinutes, integrationID);
            const saved = await entity.Save();
            if (saved) {
                this.PendingChanges.delete(integrationID);
                await this.LoadData();
            }
            else {
                console.error('[SchedulesComponent] Failed to save schedule:', entity.LatestResult?.CompleteMessage);
            }
        }
        catch (err) {
            console.error('[SchedulesComponent] Error saving schedule:', err);
        }
        finally {
            this.SavingID = null;
            this.cdr.detectChanges();
        }
    }
    // ---------------------------------------------------------------------------
    // Scheduled job sync helpers
    // ---------------------------------------------------------------------------
    /**
     * Creates, updates, or disables the ScheduledJob record linked to this integration.
     * When enabled with a real schedule type, ensures an Active ScheduledJob exists.
     * When disabled or set to Manual, marks the ScheduledJob as Disabled (if one exists).
     */
    async SyncScheduledJob(entity, enabled, scheduleType, cronExpression, intervalMinutes, integrationID) {
        const effectiveCron = this.ResolveCronExpression(scheduleType, cronExpression, intervalMinutes);
        const existingJobID = entity.Get('ScheduledJobID');
        const shouldBeActive = enabled && scheduleType !== 'Manual' && !!effectiveCron;
        if (shouldBeActive) {
            const jobID = await this.UpsertScheduledJob(existingJobID, entity, effectiveCron, integrationID);
            if (jobID !== existingJobID) {
                entity.Set('ScheduledJobID', jobID);
            }
        }
        else if (existingJobID) {
            await this.DisableScheduledJob(existingJobID);
        }
    }
    /** Converts schedule type + config into a cron expression. */
    ResolveCronExpression(scheduleType, cronExpression, intervalMinutes) {
        if (scheduleType === 'Cron')
            return cronExpression;
        if (scheduleType === 'Interval' && intervalMinutes)
            return this.IntervalToCron(intervalMinutes);
        return null;
    }
    /** Converts an interval in minutes to an equivalent cron expression. */
    IntervalToCron(minutes) {
        if (minutes < 60)
            return `*/${minutes} * * * *`;
        const hours = minutes / 60;
        if (Number.isInteger(hours))
            return hours === 1 ? '0 * * * *' : `0 */${hours} * * *`;
        return `*/${minutes} * * * *`;
    }
    /**
     * Creates a new ScheduledJob or updates the existing one.
     * Returns the ID of the job (new or existing).
     */
    async UpsertScheduledJob(existingJobID, entity, cronExpression, integrationID) {
        const md = this.ProviderToUse;
        if (existingJobID) {
            const job = await md.GetEntityObject('MJ: Scheduled Jobs');
            const loaded = await job.Load(existingJobID);
            if (loaded) {
                job.Set('CronExpression', cronExpression);
                job.Set('Status', 'Active');
                // Reset NextRunAt so the scheduler picks up the new cron immediately
                job.Set('NextRunAt', new Date());
                await job.Save();
                return existingJobID;
            }
        }
        // No existing job (or failed to load) — create a new one
        const integrationName = entity.Get('Name') ?? entity.Get('Integration') ?? 'Integration';
        const job = await md.GetEntityObject('MJ: Scheduled Jobs');
        job.NewRecord();
        job.Set('Name', `${integrationName} Sync`);
        job.Set('JobTypeID', this.INTEGRATION_SYNC_JOB_TYPE_ID);
        job.Set('CronExpression', cronExpression);
        job.Set('Timezone', 'UTC');
        job.Set('Status', 'Active');
        job.Set('ConcurrencyMode', 'Skip');
        job.Set('Configuration', JSON.stringify({ CompanyIntegrationID: integrationID }));
        // Set NextRunAt to now so the scheduler fires it on next poll without needing a restart
        job.Set('NextRunAt', new Date());
        await job.Save();
        return job.Get('ID');
    }
    /** Sets an existing ScheduledJob to Disabled so it stops firing. */
    async DisableScheduledJob(jobID) {
        const md = this.ProviderToUse;
        const job = await md.GetEntityObject('MJ: Scheduled Jobs');
        const loaded = await job.Load(jobID);
        if (loaded) {
            job.Set('Status', 'Disabled');
            await job.Save();
        }
    }
    async RunNow(integrationID) {
        if (this.RunningID)
            return;
        this.RunningID = integrationID;
        this.cdr.detectChanges();
        try {
            const result = await this.dataService.RunSync(integrationID);
            if (!result.Success) {
                console.error('[SchedulesComponent] RunSync failed:', result.Message);
            }
            await this.LoadData();
        }
        catch (err) {
            console.error('[SchedulesComponent] RunNow error:', err);
        }
        finally {
            this.RunningID = null;
            this.cdr.detectChanges();
        }
    }
    // ---------------------------------------------------------------------------
    // Template helpers
    // ---------------------------------------------------------------------------
    GetEffectiveScheduleEnabled(schedule) {
        return this.getEffectiveValue(schedule.ID, 'ScheduleEnabled', schedule.ScheduleEnabled);
    }
    GetEffectiveScheduleType(schedule) {
        return this.getEffectiveValue(schedule.ID, 'ScheduleType', schedule.ScheduleType);
    }
    GetEffectiveInterval(schedule) {
        return this.getEffectiveValue(schedule.ID, 'ScheduleIntervalMinutes', schedule.ScheduleIntervalMinutes);
    }
    GetEffectiveCron(schedule) {
        return this.getEffectiveValue(schedule.ID, 'CronExpression', schedule.CronExpression);
    }
    IsIntervalSelected(schedule, minutes) {
        return this.GetEffectiveInterval(schedule) === minutes;
    }
    GetNextRunRelative(schedule) {
        if (!schedule.NextScheduledRunAt)
            return 'Not scheduled';
        const next = new Date(schedule.NextScheduledRunAt);
        const diffMs = next.getTime() - Date.now();
        if (diffMs < 0)
            return 'Overdue';
        return 'in ' + this.formatDurationMs(diffMs);
    }
    GetLastRunRelative(schedule) {
        if (!schedule.LastScheduledRunAt)
            return 'Never';
        return this.dataService.ComputeRelativeTime(schedule.LastScheduledRunAt);
    }
    GetCronDescription(expression) {
        if (!expression)
            return '';
        const parts = expression.split(' ');
        if (parts.length !== 5)
            return expression;
        const [min, hour, , , dow] = parts;
        if (min === '0' && hour === '*')
            return 'Every hour';
        if (min === '0' && hour.startsWith('*/'))
            return `Every ${hour.slice(2)} hours`;
        if (min === '0' && hour !== '*' && dow === '*')
            return `Daily at ${hour}:00`;
        if (min === '0' && hour !== '*' && dow === '1-5')
            return `Weekdays at ${hour}:00`;
        if (dow === '1-5')
            return `Weekdays at ${hour}:${min.padStart(2, '0')}`;
        return expression;
    }
    GetIntegrationIcon(name) {
        return ResolveIntegrationIcon(name);
    }
    ComputeTimelinePosition(hour, minute) {
        return ((hour * 60 + minute) / (24 * 60)) * 100;
    }
    IsSaving(integrationID) {
        return UUIDsEqual(this.SavingID, integrationID);
    }
    IsRunning(integrationID) {
        return UUIDsEqual(this.RunningID, integrationID);
    }
    get ScheduledCount() {
        return this.Schedules.filter(s => s.ScheduleEnabled).length;
    }
    get LockedCount() {
        return this.Schedules.filter(s => s.IsLocked).length;
    }
    TrackByID(_index, item) {
        return item.ID;
    }
    TrackTimelineByID(_index, item) {
        return item.IntegrationID;
    }
    TrackPresetByMinutes(_index, item) {
        return item.Minutes;
    }
    TrackCronPresetByExpr(_index, item) {
        return item.Expression;
    }
    TrackHour(_index, hour) {
        return hour;
    }
    TrackMarker(index, _item) {
        return index;
    }
    // ---------------------------------------------------------------------------
    // Private helpers
    // ---------------------------------------------------------------------------
    findSchedule(integrationID) {
        return this.Schedules.find(s => UUIDsEqual(s.ID, integrationID));
    }
    getEffectiveValue(integrationID, field, originalValue) {
        const changes = this.PendingChanges.get(integrationID);
        if (changes && field in changes) {
            return changes[field];
        }
        return originalValue;
    }
    setPendingChange(integrationID, field, value) {
        const existing = this.PendingChanges.get(integrationID) ?? {};
        existing[field] = value;
        this.PendingChanges.set(integrationID, existing);
        this.cdr.detectChanges();
    }
    buildTimelineHours() {
        this.TimelineHours = Array.from({ length: 24 }, (_, i) => i);
    }
    computeMarkersForSchedule(schedule, now) {
        const markers = [];
        const type = schedule.ScheduleType;
        if (type === 'Interval' && schedule.ScheduleIntervalMinutes && schedule.ScheduleIntervalMinutes > 0) {
            this.computeIntervalMarkers(schedule, now, markers);
        }
        else if (type === 'Cron' && schedule.CronExpression) {
            this.computeCronMarkers(schedule, now, markers);
        }
        else if (schedule.NextScheduledRunAt) {
            this.addNextRunMarker(schedule, now, markers);
        }
        return markers;
    }
    computeIntervalMarkers(schedule, now, markers) {
        const intervalMs = schedule.ScheduleIntervalMinutes * 60_000;
        const endTime = now.getTime() + 24 * 60 * 60_000;
        // Start from the next scheduled run or from now
        let cursor = schedule.NextScheduledRunAt
            ? new Date(schedule.NextScheduledRunAt).getTime()
            : now.getTime();
        // If cursor is in the past, advance to the next future occurrence
        while (cursor < now.getTime()) {
            cursor += intervalMs;
        }
        const nextRun = cursor;
        while (cursor < endTime) {
            const d = new Date(cursor);
            markers.push({
                Hour: d.getHours(),
                Minute: d.getMinutes(),
                IsNext: cursor === nextRun
            });
            cursor += intervalMs;
        }
    }
    computeCronMarkers(schedule, now, markers) {
        // Simple cron approximation for timeline display
        const times = this.approximateCronTimes(schedule.CronExpression);
        const nextRunTime = schedule.NextScheduledRunAt ? new Date(schedule.NextScheduledRunAt) : null;
        for (const time of times) {
            const isNext = nextRunTime != null
                && time.Hour === nextRunTime.getHours()
                && time.Minute === nextRunTime.getMinutes();
            markers.push({ Hour: time.Hour, Minute: time.Minute, IsNext: isNext });
        }
    }
    addNextRunMarker(schedule, now, markers) {
        const next = new Date(schedule.NextScheduledRunAt);
        const diffMs = next.getTime() - now.getTime();
        if (diffMs >= 0 && diffMs <= 24 * 60 * 60_000) {
            markers.push({ Hour: next.getHours(), Minute: next.getMinutes(), IsNext: true });
        }
    }
    /**
     * Approximate cron schedule times within a 24-hour window.
     * Handles common patterns only -- not a full cron parser.
     */
    approximateCronTimes(expression) {
        const parts = expression.split(' ');
        if (parts.length !== 5)
            return [];
        const [minPart, hourPart] = parts;
        const minute = minPart === '*' ? 0 : parseInt(minPart, 10);
        const times = [];
        if (hourPart === '*') {
            // Every hour
            for (let h = 0; h < 24; h++) {
                times.push({ Hour: h, Minute: isNaN(minute) ? 0 : minute });
            }
        }
        else if (hourPart.startsWith('*/')) {
            const step = parseInt(hourPart.slice(2), 10);
            if (!isNaN(step) && step > 0) {
                for (let h = 0; h < 24; h += step) {
                    times.push({ Hour: h, Minute: isNaN(minute) ? 0 : minute });
                }
            }
        }
        else {
            // Specific hour(s) — comma-separated
            const hours = hourPart.split(',').map(h => parseInt(h.trim(), 10)).filter(h => !isNaN(h));
            for (const h of hours) {
                times.push({ Hour: h, Minute: isNaN(minute) ? 0 : minute });
            }
        }
        return times;
    }
    formatDurationMs(ms) {
        const totalMinutes = Math.floor(ms / 60_000);
        if (totalMinutes < 1)
            return 'less than a minute';
        if (totalMinutes < 60)
            return `${totalMinutes} minute${totalMinutes === 1 ? '' : 's'}`;
        const hours = Math.floor(totalMinutes / 60);
        const minutes = totalMinutes % 60;
        if (minutes === 0)
            return `${hours} hour${hours === 1 ? '' : 's'}`;
        return `${hours}h ${minutes}m`;
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵSchedulesComponent_BaseFactory; return function SchedulesComponent_Factory(__ngFactoryType__) { return (ɵSchedulesComponent_BaseFactory || (ɵSchedulesComponent_BaseFactory = i0.ɵɵgetInheritedFactory(SchedulesComponent)))(__ngFactoryType__ || SchedulesComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SchedulesComponent, selectors: [["app-integration-schedules"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 3, consts: [["Title", "Integration Schedules", "Icon", "fa-solid fa-calendar-check", "Subtitle", "When and how often integrations sync"], ["meta", ""], ["actions", ""], [3, "Clicked", "Loading"], [1, "loading-container"], [1, "schedules-root"], ["Icon", "fa-solid fa-spinner fa-spin", "Label", "running", "Variant", "running", 3, "Count"], ["text", "Loading schedules..."], [1, "timeline-section"], [1, "cards-section"], [1, "schedule-card", 3, "schedule-card-disabled"], ["Icon", "fa-solid fa-calendar-xmark", "Title", "No integrations found"], [1, "timeline-title"], [1, "fa-regular", "fa-clock"], [1, "timeline-container"], [1, "timeline-grid-labels"], [1, "timeline-label-spacer"], [1, "timeline-grid-track"], [1, "timeline-row"], [1, "timeline-hour-label", 3, "left"], [1, "timeline-hour-label"], [1, "timeline-row-label", 3, "title"], [1, "timeline-track-container"], [1, "timeline-track"], [1, "timeline-marker", 3, "timeline-marker-next", "left", "title"], [1, "timeline-locked-indicator"], [1, "timeline-now-line"], [1, "timeline-grid-line", 3, "left"], [1, "timeline-grid-line"], [1, "timeline-marker", 3, "title"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "schedule-card"], [1, "card-info"], [1, "card-icon"], [1, "card-details"], [1, "card-name"], [1, "card-company"], [1, "card-badges"], [1, "badge", "badge-success"], [1, "badge", "badge-gray"], [1, "badge", "badge-running"], [1, "card-config"], [1, "config-row"], [1, "toggle-label"], ["role", "switch", 1, "toggle-switch", 3, "click"], [1, "toggle-knob"], [1, "card-status"], [1, "status-items"], [1, "status-item"], [1, "status-label"], [1, "status-value"], [1, "status-value", "status-running"], [1, "status-value", "status-idle"], [1, "card-actions"], [1, "btn", "btn-primary", "btn-save", 3, "disabled"], [1, "btn", "btn-outline", "btn-run", 3, "click", "disabled"], [1, "type-pills"], [1, "type-pill", 3, "click"], [1, "interval-presets"], [1, "preset-btn", 3, "preset-btn-active"], [1, "custom-interval"], ["type", "number", "placeholder", "Custom min", "min", "1", 1, "interval-input", 3, "change", "value"], [1, "interval-unit"], [1, "preset-btn", 3, "click"], [1, "cron-presets"], [1, "cron-input-row"], ["type", "text", "placeholder", "* * * * *", 1, "cron-input", 3, "change", "value"], [1, "cron-description"], [1, "btn", "btn-primary", "btn-save", 3, "click", "disabled"], [1, "fa-solid", "fa-check"], [1, "fa-solid", "fa-play"]], template: function SchedulesComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "mj-page-layout")(1, "mj-page-header", 0);
            i0.ɵɵconditionalCreate(2, SchedulesComponent_Conditional_2_Template, 2, 1, "div", 1);
            i0.ɵɵelementStart(3, "div", 2)(4, "mj-refresh-button", 3);
            i0.ɵɵlistener("Clicked", function SchedulesComponent_Template_mj_refresh_button_Clicked_4_listener() { return ctx.LoadData(); });
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(5, "mj-page-body");
            i0.ɵɵconditionalCreate(6, SchedulesComponent_Conditional_6_Template, 2, 0, "div", 4)(7, SchedulesComponent_Conditional_7_Template, 6, 2, "div", 5);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.LockedCount > 0 ? 2 : -1);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("Loading", ctx.IsLoading);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.IsLoading ? 6 : 7);
        } }, dependencies: [i1.MJPageLayoutComponent, i1.MJPageHeaderComponent, i1.MJPageBodyComponent, i1.MJStatBadgeComponent, i1.MJRefreshButtonComponent, i1.MJEmptyStateComponent, i2.LoadingComponent], styles: ["\n\n\n\n\n[_nghost-%COMP%] {\n  display: block;\n  height: 100%;\n  overflow-y: auto;\n  background: var(--mj-bg-page);\n}\n\n\n\n\n.schedules-root[_ngcontent-%COMP%] {\n  padding: 24px;\n  max-width: 1400px;\n  margin: 0 auto;\n}\n\n.loading-container[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  height: 300px;\n}\n\n\n\n\n\n\n\n\n\n\n\n.btn[_ngcontent-%COMP%] {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 8px 16px;\n  border-radius: 8px;\n  font-size: 13px;\n  font-weight: 500;\n  cursor: pointer;\n  border: none;\n  transition: all 0.15s ease;\n  white-space: nowrap;\n}\n\n.btn[_ngcontent-%COMP%]:disabled {\n  opacity: 0.5;\n  cursor: not-allowed;\n}\n\n.btn-primary[_ngcontent-%COMP%] {\n  background: var(--mj-brand-primary);\n  color: var(--mj-bg-surface);\n}\n\n.btn-primary[_ngcontent-%COMP%]:hover:not(:disabled) {\n  background: var(--mj-color-info-700);\n}\n\n.btn-outline[_ngcontent-%COMP%] {\n  background: var(--mj-bg-surface);\n  color: var(--mj-text-secondary);\n  border: 1px solid var(--mj-border-strong);\n}\n\n.btn-outline[_ngcontent-%COMP%]:hover:not(:disabled) {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-text-disabled);\n}\n\n\n\n\n\n\n.timeline-section[_ngcontent-%COMP%] {\n  background: var(--mj-bg-surface);\n  border-radius: 12px;\n  padding: 20px 24px;\n  margin-bottom: 24px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n  border: 1px solid var(--mj-border-default);\n}\n\n.timeline-title[_ngcontent-%COMP%] {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--mj-text-secondary);\n  margin-bottom: 16px;\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.timeline-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  color: var(--mj-text-muted);\n}\n\n.timeline-container[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n\n\n\n.timeline-grid-labels[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-end;\n  height: 20px;\n  margin-bottom: 4px;\n}\n\n.timeline-label-spacer[_ngcontent-%COMP%] {\n  width: 200px;\n  min-width: 200px;\n  flex-shrink: 0;\n}\n\n.timeline-grid-track[_ngcontent-%COMP%] {\n  flex: 1;\n  position: relative;\n  height: 20px;\n}\n\n.timeline-hour-label[_ngcontent-%COMP%] {\n  position: absolute;\n  font-size: 10px;\n  color: var(--mj-text-disabled);\n  transform: translateX(-50%);\n  white-space: nowrap;\n}\n\n\n\n.timeline-row[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  height: 28px;\n}\n\n.timeline-row-label[_ngcontent-%COMP%] {\n  width: 200px;\n  min-width: 200px;\n  flex-shrink: 0;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  padding-right: 16px;\n}\n\n.timeline-track-container[_ngcontent-%COMP%] {\n  flex: 1;\n  position: relative;\n  height: 28px;\n  display: flex;\n  align-items: center;\n}\n\n.timeline-track[_ngcontent-%COMP%] {\n  position: absolute;\n  left: 0;\n  right: 0;\n  height: 4px;\n  background: var(--mj-border-default);\n  border-radius: 2px;\n}\n\n.timeline-grid-line[_ngcontent-%COMP%] {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  width: 1px;\n  background: var(--mj-border-subtle);\n  z-index: 0;\n}\n\n\n\n.timeline-marker[_ngcontent-%COMP%] {\n  position: absolute;\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  background: var(--mj-text-disabled);\n  transform: translate(-50%, 0);\n  z-index: 2;\n  transition: all 0.2s ease;\n}\n\n.timeline-marker[_ngcontent-%COMP%]:hover {\n  transform: translate(-50%, 0) scale(1.4);\n}\n\n.timeline-marker-next[_ngcontent-%COMP%] {\n  width: 12px;\n  height: 12px;\n  background: var(--mj-brand-primary);\n  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 20%, transparent);\n}\n\n\n\n.timeline-now-line[_ngcontent-%COMP%] {\n  position: absolute;\n  left: 0;\n  top: -2px;\n  bottom: -2px;\n  width: 2px;\n  background: var(--mj-status-error);\n  z-index: 3;\n  border-radius: 1px;\n}\n\n\n\n.timeline-locked-indicator[_ngcontent-%COMP%] {\n  position: absolute;\n  left: -4px;\n  font-size: 12px;\n  color: var(--mj-color-warning-600);\n  z-index: 4;\n  animation: _ngcontent-%COMP%_pulse-opacity 1.5s ease-in-out infinite;\n}\n\n@keyframes _ngcontent-%COMP%_pulse-opacity {\n  0%, 100% { opacity: 1; }\n  50% { opacity: 0.4; }\n}\n\n\n\n\n\n\n.cards-section[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 16px;\n}\n\n.schedule-card[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-start;\n  background: var(--mj-bg-surface);\n  border-radius: 12px;\n  padding: 24px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n  border: 1px solid var(--mj-border-default);\n  transition: box-shadow 0.2s ease;\n  gap: 32px;\n}\n\n.schedule-card[_ngcontent-%COMP%]:hover {\n  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);\n}\n\n.schedule-card-disabled[_ngcontent-%COMP%] {\n  opacity: 0.6;\n}\n\n\n\n.card-info[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: flex-start;\n  gap: 16px;\n  min-width: 220px;\n  flex-shrink: 0;\n}\n\n.card-icon[_ngcontent-%COMP%] {\n  width: 48px;\n  height: 48px;\n  border-radius: 12px;\n  background: var(--mj-status-info-bg);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-shrink: 0;\n}\n\n.card-icon[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n  font-size: 20px;\n  color: var(--mj-brand-primary);\n}\n\n.card-details[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 4px;\n}\n\n.card-name[_ngcontent-%COMP%] {\n  font-size: 15px;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n\n.card-company[_ngcontent-%COMP%] {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n.card-badges[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 6px;\n  margin-top: 4px;\n  flex-wrap: wrap;\n}\n\n.badge[_ngcontent-%COMP%] {\n  font-size: 11px;\n  font-weight: 500;\n  padding: 2px 8px;\n  border-radius: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n}\n\n.badge-success[_ngcontent-%COMP%] {\n  background: var(--mj-status-success-bg);\n  color: var(--mj-color-success-600);\n}\n\n.badge-gray[_ngcontent-%COMP%] {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-muted);\n}\n\n.badge-running[_ngcontent-%COMP%] {\n  background: var(--mj-color-warning-100);\n  color: var(--mj-color-warning-600);\n}\n\n\n\n.card-config[_ngcontent-%COMP%] {\n  flex: 1;\n  min-width: 0;\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n}\n\n.config-row[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n\n\n\n.toggle-label[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n  cursor: pointer;\n}\n\n.toggle-switch[_ngcontent-%COMP%] {\n  position: relative;\n  width: 40px;\n  height: 22px;\n  border-radius: 11px;\n  background: var(--mj-color-neutral-300);\n  border: none;\n  cursor: pointer;\n  transition: background 0.2s ease;\n  padding: 0;\n  flex-shrink: 0;\n}\n\n.toggle-switch.toggle-on[_ngcontent-%COMP%] {\n  background: var(--mj-brand-primary);\n}\n\n.toggle-knob[_ngcontent-%COMP%] {\n  position: absolute;\n  top: 2px;\n  left: 2px;\n  width: 18px;\n  height: 18px;\n  border-radius: 50%;\n  background: var(--mj-bg-surface);\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n  transition: transform 0.2s ease;\n}\n\n.toggle-on[_ngcontent-%COMP%]   .toggle-knob[_ngcontent-%COMP%] {\n  transform: translateX(18px);\n}\n\n\n\n.type-pills[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 4px;\n  background: var(--mj-bg-surface-hover);\n  border-radius: 8px;\n  padding: 3px;\n  width: fit-content;\n}\n\n.type-pill[_ngcontent-%COMP%] {\n  padding: 5px 14px;\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-muted);\n  background: transparent;\n  border: none;\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n\n.type-pill[_ngcontent-%COMP%]:hover {\n  color: var(--mj-text-secondary);\n}\n\n.type-pill-active[_ngcontent-%COMP%] {\n  background: var(--mj-bg-surface);\n  color: var(--mj-brand-primary);\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n\n\n.interval-presets[_ngcontent-%COMP%] {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 6px;\n}\n\n.preset-btn[_ngcontent-%COMP%] {\n  padding: 4px 12px;\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-muted);\n  background: var(--mj-bg-surface-hover);\n  border: 1px solid var(--mj-border-default);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n\n.preset-btn[_ngcontent-%COMP%]:hover {\n  border-color: var(--mj-text-disabled);\n  color: var(--mj-text-secondary);\n}\n\n.preset-btn-active[_ngcontent-%COMP%] {\n  background: var(--mj-status-info-bg);\n  border-color: var(--mj-brand-primary);\n  color: var(--mj-brand-primary);\n}\n\n\n\n.custom-interval[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  margin-top: 4px;\n}\n\n.interval-input[_ngcontent-%COMP%] {\n  width: 100px;\n  padding: 5px 10px;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 6px;\n  font-size: 12px;\n  color: var(--mj-text-secondary);\n  outline: none;\n  transition: border-color 0.15s ease;\n}\n\n.interval-input[_ngcontent-%COMP%]:focus {\n  border-color: var(--mj-brand-primary);\n  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n}\n\n.interval-unit[_ngcontent-%COMP%] {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n\n\n.cron-presets[_ngcontent-%COMP%] {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 6px;\n}\n\n.cron-input-row[_ngcontent-%COMP%] {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  margin-top: 4px;\n  flex-wrap: wrap;\n}\n\n.cron-input[_ngcontent-%COMP%] {\n  width: 180px;\n  padding: 5px 10px;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 6px;\n  font-size: 12px;\n  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n  color: var(--mj-text-secondary);\n  outline: none;\n  transition: border-color 0.15s ease;\n}\n\n.cron-input[_ngcontent-%COMP%]:focus {\n  border-color: var(--mj-brand-primary);\n  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n}\n\n.cron-description[_ngcontent-%COMP%] {\n  font-size: 12px;\n  color: var(--mj-text-muted);\n  font-style: italic;\n}\n\n\n\n.card-status[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n  gap: 16px;\n  min-width: 180px;\n  flex-shrink: 0;\n}\n\n.status-items[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n  text-align: right;\n}\n\n.status-item[_ngcontent-%COMP%] {\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n}\n\n.status-label[_ngcontent-%COMP%] {\n  font-size: 11px;\n  color: var(--mj-text-disabled);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.status-value[_ngcontent-%COMP%] {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n}\n\n.status-running[_ngcontent-%COMP%] {\n  color: var(--mj-color-warning-600);\n  display: flex;\n  align-items: center;\n  justify-content: flex-end;\n  gap: 6px;\n}\n\n.status-idle[_ngcontent-%COMP%] {\n  color: var(--mj-color-success-600);\n}\n\n\n\n.card-actions[_ngcontent-%COMP%] {\n  display: flex;\n  gap: 8px;\n}\n\n.btn-save[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_slideIn 0.2s ease;\n}\n\n@keyframes _ngcontent-%COMP%_slideIn {\n  from {\n    opacity: 0;\n    transform: translateX(8px);\n  }\n  to {\n    opacity: 1;\n    transform: translateX(0);\n  }\n}\n\n.btn-run[_ngcontent-%COMP%] {\n  font-size: 12px;\n  padding: 6px 12px;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n@media (max-width: 900px) {\n  .schedule-card[_ngcontent-%COMP%] {\n    flex-direction: column;\n    gap: 20px;\n  }\n\n  .card-info[_ngcontent-%COMP%] {\n    min-width: 0;\n    width: 100%;\n  }\n\n  .card-config[_ngcontent-%COMP%] {\n    width: 100%;\n  }\n\n  .card-status[_ngcontent-%COMP%] {\n    align-items: flex-start;\n    width: 100%;\n    min-width: 0;\n  }\n\n  .status-items[_ngcontent-%COMP%] {\n    text-align: left;\n    flex-direction: row;\n    gap: 20px;\n    flex-wrap: wrap;\n  }\n\n  .status-running[_ngcontent-%COMP%] {\n    justify-content: flex-start;\n  }\n\n  .card-actions[_ngcontent-%COMP%] {\n    width: 100%;\n  }\n\n  .card-actions[_ngcontent-%COMP%]   .btn[_ngcontent-%COMP%] {\n    flex: 1;\n    justify-content: center;\n  }\n}\n\n@media (max-width: 768px) {\n  .timeline-section[_ngcontent-%COMP%] {\n    display: none;\n  }\n\n  .schedules-root[_ngcontent-%COMP%] {\n    padding: 16px;\n  }\n}"] });
};
SchedulesComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'IntegrationSchedules')
], SchedulesComponent);
export { SchedulesComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SchedulesComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'app-integration-schedules', template: "<mj-page-layout>\n  <mj-page-header\n    Title=\"Integration Schedules\"\n    Icon=\"fa-solid fa-calendar-check\"\n    Subtitle=\"When and how often integrations sync\">\n    <!-- [meta] retains the conditional \"running\" status pill (genuine\n         signal); integrations/scheduled count badges dropped per chrome\n         slot discipline audit Task B \u2014 both mirrored the visible list. -->\n    @if (LockedCount > 0) {\n      <div meta>\n        <mj-stat-badge\n          Icon=\"fa-solid fa-spinner fa-spin\"\n          [Count]=\"LockedCount\"\n          Label=\"running\"\n          Variant=\"running\">\n        </mj-stat-badge>\n      </div>\n    }\n    <div actions>\n      <mj-refresh-button [Loading]=\"IsLoading\" (Clicked)=\"LoadData()\"></mj-refresh-button>\n    </div>\n  </mj-page-header>\n\n  <mj-page-body>\n<!-- Loading state -->\n@if (IsLoading) {\n  <div class=\"loading-container\">\n    <mj-loading text=\"Loading schedules...\"></mj-loading>\n  </div>\n} @else {\n  <div class=\"schedules-root\">\n\n\n    <!-- ================================================================= -->\n    <!-- TIMELINE (24-hour visual) -->\n    <!-- ================================================================= -->\n    @if (TimelineMarkers.length > 0) {\n      <div class=\"timeline-section\">\n        <div class=\"timeline-title\">\n          <i class=\"fa-regular fa-clock\"></i>\n          Next 24 Hours\n        </div>\n        <div class=\"timeline-container\">\n          <!-- Hour grid labels -->\n          <div class=\"timeline-grid-labels\">\n            <div class=\"timeline-label-spacer\"></div>\n            <div class=\"timeline-grid-track\">\n              @for (hour of TimelineHours; track TrackHour($index, hour)) {\n                @if (hour % 4 === 0) {\n                  <span class=\"timeline-hour-label\"\n                        [style.left.%]=\"ComputeTimelinePosition(hour, 0)\">\n                    {{ hour }}:00\n                  </span>\n                }\n              }\n            </div>\n          </div>\n\n          <!-- Integration rows -->\n          @for (row of TimelineMarkers; track TrackTimelineByID($index, row)) {\n            <div class=\"timeline-row\">\n              <div class=\"timeline-row-label\" [title]=\"row.IntegrationName\">\n                {{ row.IntegrationName }}\n              </div>\n              <div class=\"timeline-track-container\">\n                <!-- Hour grid lines -->\n                @for (hour of TimelineHours; track TrackHour($index, hour)) {\n                  @if (hour % 4 === 0) {\n                    <div class=\"timeline-grid-line\"\n                         [style.left.%]=\"ComputeTimelinePosition(hour, 0)\">\n                    </div>\n                  }\n                }\n\n                <!-- Track bar -->\n                <div class=\"timeline-track\"></div>\n\n                <!-- Markers -->\n                @for (marker of row.Markers; track TrackMarker($index, marker)) {\n                  <div class=\"timeline-marker\"\n                       [class.timeline-marker-next]=\"marker.IsNext\"\n                       [style.left.%]=\"ComputeTimelinePosition(marker.Hour, marker.Minute)\"\n                       [title]=\"marker.Hour + ':' + ('' + marker.Minute).padStart(2, '0')\">\n                  </div>\n                }\n\n                <!-- Locked indicator -->\n                @if (row.IsLocked) {\n                  <div class=\"timeline-locked-indicator\">\n                    <i class=\"fa-solid fa-spinner fa-spin\"></i>\n                  </div>\n                }\n\n                <!-- Current time line -->\n                <div class=\"timeline-now-line\"></div>\n              </div>\n            </div>\n          }\n        </div>\n      </div>\n    }\n\n    <!-- ================================================================= -->\n    <!-- SCHEDULE CARDS -->\n    <!-- ================================================================= -->\n    <div class=\"cards-section\">\n      @for (schedule of Schedules; track TrackByID($index, schedule)) {\n        <div class=\"schedule-card\" [class.schedule-card-disabled]=\"!schedule.IsActive\">\n\n          <!-- LEFT: Icon + Info -->\n          <div class=\"card-info\">\n            <div class=\"card-icon\">\n              <i [class]=\"GetIntegrationIcon(schedule.Integration || schedule.Name)\"></i>\n            </div>\n            <div class=\"card-details\">\n              <div class=\"card-name\">{{ schedule.Integration || schedule.Name }}</div>\n              <div class=\"card-company\">{{ schedule.Company }}</div>\n              <div class=\"card-badges\">\n                @if (schedule.IsActive) {\n                  <span class=\"badge badge-success\">Active</span>\n                } @else {\n                  <span class=\"badge badge-gray\">Inactive</span>\n                }\n                @if (schedule.IsLocked) {\n                  <span class=\"badge badge-running\">\n                    <i class=\"fa-solid fa-spinner fa-spin\"></i>\n                    Running\n                  </span>\n                }\n              </div>\n            </div>\n          </div>\n\n          <!-- CENTER: Schedule Configuration -->\n          <div class=\"card-config\">\n            <!-- Schedule toggle -->\n            <div class=\"config-row\">\n              <label class=\"toggle-label\">\n                Auto-sync\n                <button class=\"toggle-switch\"\n                        [class.toggle-on]=\"GetEffectiveScheduleEnabled(schedule)\"\n                        (click)=\"ToggleScheduleEnabled(schedule.ID)\"\n                        [attr.aria-checked]=\"GetEffectiveScheduleEnabled(schedule)\"\n                        role=\"switch\">\n                  <span class=\"toggle-knob\"></span>\n                </button>\n              </label>\n            </div>\n\n            @if (GetEffectiveScheduleEnabled(schedule)) {\n              <!-- Schedule type pills -->\n              <div class=\"config-row\">\n                <div class=\"type-pills\">\n                  <button class=\"type-pill\"\n                          [class.type-pill-active]=\"GetEffectiveScheduleType(schedule) === 'Manual'\"\n                          (click)=\"SetScheduleType(schedule.ID, 'Manual')\">\n                    Manual\n                  </button>\n                  <button class=\"type-pill\"\n                          [class.type-pill-active]=\"GetEffectiveScheduleType(schedule) === 'Interval'\"\n                          (click)=\"SetScheduleType(schedule.ID, 'Interval')\">\n                    Interval\n                  </button>\n                  <button class=\"type-pill\"\n                          [class.type-pill-active]=\"GetEffectiveScheduleType(schedule) === 'Cron'\"\n                          (click)=\"SetScheduleType(schedule.ID, 'Cron')\">\n                    Cron\n                  </button>\n                </div>\n              </div>\n\n              <!-- Interval config -->\n              @if (GetEffectiveScheduleType(schedule) === 'Interval') {\n                <div class=\"config-row\">\n                  <div class=\"interval-presets\">\n                    @for (preset of IntervalPresets; track TrackPresetByMinutes($index, preset)) {\n                      <button class=\"preset-btn\"\n                              [class.preset-btn-active]=\"IsIntervalSelected(schedule, preset.Minutes)\"\n                              (click)=\"SetInterval(schedule.ID, preset.Minutes)\">\n                        {{ preset.Label }}\n                      </button>\n                    }\n                  </div>\n                  <div class=\"custom-interval\">\n                    <input type=\"number\"\n                           class=\"interval-input\"\n                           placeholder=\"Custom min\"\n                           min=\"1\"\n                           [value]=\"GetEffectiveInterval(schedule)\"\n                           (change)=\"SetCustomInterval(schedule.ID, $event)\" />\n                    <span class=\"interval-unit\">min</span>\n                  </div>\n                </div>\n              }\n\n              <!-- Cron config -->\n              @if (GetEffectiveScheduleType(schedule) === 'Cron') {\n                <div class=\"config-row\">\n                  <div class=\"cron-presets\">\n                    @for (preset of CronPresets; track TrackCronPresetByExpr($index, preset)) {\n                      <button class=\"preset-btn\"\n                              [class.preset-btn-active]=\"GetEffectiveCron(schedule) === preset.Expression\"\n                              (click)=\"SetCronExpression(schedule.ID, preset.Expression)\">\n                        {{ preset.Label }}\n                      </button>\n                    }\n                  </div>\n                  <div class=\"cron-input-row\">\n                    <input type=\"text\"\n                           class=\"cron-input\"\n                           placeholder=\"* * * * *\"\n                           [value]=\"GetEffectiveCron(schedule) ?? ''\"\n                           (change)=\"OnCronInputChange(schedule.ID, $event)\" />\n                    @if (GetEffectiveCron(schedule)) {\n                      <span class=\"cron-description\">\n                        {{ GetCronDescription(GetEffectiveCron(schedule)) }}\n                      </span>\n                    }\n                  </div>\n                </div>\n              }\n            }\n          </div>\n\n          <!-- RIGHT: Status + Actions -->\n          <div class=\"card-status\">\n            <div class=\"status-items\">\n              <div class=\"status-item\">\n                <span class=\"status-label\">Next run</span>\n                <span class=\"status-value\">{{ GetNextRunRelative(schedule) }}</span>\n              </div>\n              <div class=\"status-item\">\n                <span class=\"status-label\">Last run</span>\n                <span class=\"status-value\">{{ GetLastRunRelative(schedule) }}</span>\n              </div>\n              <div class=\"status-item\">\n                <span class=\"status-label\">Status</span>\n                @if (schedule.IsLocked) {\n                  <span class=\"status-value status-running\">\n                    <i class=\"fa-solid fa-spinner fa-spin\"></i>\n                    Running\n                  </span>\n                } @else {\n                  <span class=\"status-value status-idle\">Idle</span>\n                }\n              </div>\n            </div>\n\n            <div class=\"card-actions\">\n              @if (HasChanges(schedule.ID)) {\n                <button class=\"btn btn-primary btn-save\"\n                        [disabled]=\"IsSaving(schedule.ID)\"\n                        (click)=\"SaveSchedule(schedule.ID)\">\n                  @if (IsSaving(schedule.ID)) {\n                    <i class=\"fa-solid fa-spinner fa-spin\"></i>\n                    Saving...\n                  } @else {\n                    <i class=\"fa-solid fa-check\"></i>\n                    Save\n                  }\n                </button>\n              }\n              <button class=\"btn btn-outline btn-run\"\n                      [disabled]=\"IsRunning(schedule.ID) || schedule.IsLocked\"\n                      (click)=\"RunNow(schedule.ID)\">\n                @if (IsRunning(schedule.ID)) {\n                  <i class=\"fa-solid fa-spinner fa-spin\"></i>\n                  Running...\n                } @else {\n                  <i class=\"fa-solid fa-play\"></i>\n                  Run Now\n                }\n              </button>\n            </div>\n          </div>\n        </div>\n      }\n\n      @if (Schedules.length === 0) {\n        <mj-empty-state Icon=\"fa-solid fa-calendar-xmark\"\n          Title=\"No integrations found\" />\n      }\n    </div>\n  </div>\n}\n  </mj-page-body>\n</mj-page-layout>\n", styles: ["/* ==========================================================================\n   Schedules Component\n   ========================================================================== */\n\n:host {\n  display: block;\n  height: 100%;\n  overflow-y: auto;\n  background: var(--mj-bg-page);\n}\n\n/* Slot passthrough now in <mj-page-header>; stat badges now via <mj-stat-badge>. */\n\n.schedules-root {\n  padding: 24px;\n  max-width: 1400px;\n  margin: 0 auto;\n}\n\n.loading-container {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  height: 300px;\n}\n\n/* --------------------------------------------------------------------------\n   Header\n   -------------------------------------------------------------------------- */\n\n/* --------------------------------------------------------------------------\n   Buttons (shared)\n   -------------------------------------------------------------------------- */\n\n.btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 8px 16px;\n  border-radius: 8px;\n  font-size: 13px;\n  font-weight: 500;\n  cursor: pointer;\n  border: none;\n  transition: all 0.15s ease;\n  white-space: nowrap;\n}\n\n.btn:disabled {\n  opacity: 0.5;\n  cursor: not-allowed;\n}\n\n.btn-primary {\n  background: var(--mj-brand-primary);\n  color: var(--mj-bg-surface);\n}\n\n.btn-primary:hover:not(:disabled) {\n  background: var(--mj-color-info-700);\n}\n\n.btn-outline {\n  background: var(--mj-bg-surface);\n  color: var(--mj-text-secondary);\n  border: 1px solid var(--mj-border-strong);\n}\n\n.btn-outline:hover:not(:disabled) {\n  background: var(--mj-bg-surface-hover);\n  border-color: var(--mj-text-disabled);\n}\n\n/* --------------------------------------------------------------------------\n   Timeline Section\n   -------------------------------------------------------------------------- */\n\n.timeline-section {\n  background: var(--mj-bg-surface);\n  border-radius: 12px;\n  padding: 20px 24px;\n  margin-bottom: 24px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n  border: 1px solid var(--mj-border-default);\n}\n\n.timeline-title {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--mj-text-secondary);\n  margin-bottom: 16px;\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.timeline-title i {\n  color: var(--mj-text-muted);\n}\n\n.timeline-container {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n\n/* Grid labels row */\n.timeline-grid-labels {\n  display: flex;\n  align-items: flex-end;\n  height: 20px;\n  margin-bottom: 4px;\n}\n\n.timeline-label-spacer {\n  width: 200px;\n  min-width: 200px;\n  flex-shrink: 0;\n}\n\n.timeline-grid-track {\n  flex: 1;\n  position: relative;\n  height: 20px;\n}\n\n.timeline-hour-label {\n  position: absolute;\n  font-size: 10px;\n  color: var(--mj-text-disabled);\n  transform: translateX(-50%);\n  white-space: nowrap;\n}\n\n/* Individual timeline rows */\n.timeline-row {\n  display: flex;\n  align-items: center;\n  height: 28px;\n}\n\n.timeline-row-label {\n  width: 200px;\n  min-width: 200px;\n  flex-shrink: 0;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  padding-right: 16px;\n}\n\n.timeline-track-container {\n  flex: 1;\n  position: relative;\n  height: 28px;\n  display: flex;\n  align-items: center;\n}\n\n.timeline-track {\n  position: absolute;\n  left: 0;\n  right: 0;\n  height: 4px;\n  background: var(--mj-border-default);\n  border-radius: 2px;\n}\n\n.timeline-grid-line {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  width: 1px;\n  background: var(--mj-border-subtle);\n  z-index: 0;\n}\n\n/* Markers */\n.timeline-marker {\n  position: absolute;\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  background: var(--mj-text-disabled);\n  transform: translate(-50%, 0);\n  z-index: 2;\n  transition: all 0.2s ease;\n}\n\n.timeline-marker:hover {\n  transform: translate(-50%, 0) scale(1.4);\n}\n\n.timeline-marker-next {\n  width: 12px;\n  height: 12px;\n  background: var(--mj-brand-primary);\n  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 20%, transparent);\n}\n\n/* Now line */\n.timeline-now-line {\n  position: absolute;\n  left: 0;\n  top: -2px;\n  bottom: -2px;\n  width: 2px;\n  background: var(--mj-status-error);\n  z-index: 3;\n  border-radius: 1px;\n}\n\n/* Locked indicator */\n.timeline-locked-indicator {\n  position: absolute;\n  left: -4px;\n  font-size: 12px;\n  color: var(--mj-color-warning-600);\n  z-index: 4;\n  animation: pulse-opacity 1.5s ease-in-out infinite;\n}\n\n@keyframes pulse-opacity {\n  0%, 100% { opacity: 1; }\n  50% { opacity: 0.4; }\n}\n\n/* --------------------------------------------------------------------------\n   Schedule Cards\n   -------------------------------------------------------------------------- */\n\n.cards-section {\n  display: flex;\n  flex-direction: column;\n  gap: 16px;\n}\n\n.schedule-card {\n  display: flex;\n  align-items: flex-start;\n  background: var(--mj-bg-surface);\n  border-radius: 12px;\n  padding: 24px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n  border: 1px solid var(--mj-border-default);\n  transition: box-shadow 0.2s ease;\n  gap: 32px;\n}\n\n.schedule-card:hover {\n  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);\n}\n\n.schedule-card-disabled {\n  opacity: 0.6;\n}\n\n/* Card: Left (info) */\n.card-info {\n  display: flex;\n  align-items: flex-start;\n  gap: 16px;\n  min-width: 220px;\n  flex-shrink: 0;\n}\n\n.card-icon {\n  width: 48px;\n  height: 48px;\n  border-radius: 12px;\n  background: var(--mj-status-info-bg);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-shrink: 0;\n}\n\n.card-icon i {\n  font-size: 20px;\n  color: var(--mj-brand-primary);\n}\n\n.card-details {\n  display: flex;\n  flex-direction: column;\n  gap: 4px;\n}\n\n.card-name {\n  font-size: 15px;\n  font-weight: 600;\n  color: var(--mj-text-primary);\n}\n\n.card-company {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n.card-badges {\n  display: flex;\n  gap: 6px;\n  margin-top: 4px;\n  flex-wrap: wrap;\n}\n\n.badge {\n  font-size: 11px;\n  font-weight: 500;\n  padding: 2px 8px;\n  border-radius: 10px;\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n}\n\n.badge-success {\n  background: var(--mj-status-success-bg);\n  color: var(--mj-color-success-600);\n}\n\n.badge-gray {\n  background: var(--mj-bg-surface-hover);\n  color: var(--mj-text-muted);\n}\n\n.badge-running {\n  background: var(--mj-color-warning-100);\n  color: var(--mj-color-warning-600);\n}\n\n/* Card: Center (config) */\n.card-config {\n  flex: 1;\n  min-width: 0;\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n}\n\n.config-row {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n\n/* Toggle switch */\n.toggle-label {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n  cursor: pointer;\n}\n\n.toggle-switch {\n  position: relative;\n  width: 40px;\n  height: 22px;\n  border-radius: 11px;\n  background: var(--mj-color-neutral-300);\n  border: none;\n  cursor: pointer;\n  transition: background 0.2s ease;\n  padding: 0;\n  flex-shrink: 0;\n}\n\n.toggle-switch.toggle-on {\n  background: var(--mj-brand-primary);\n}\n\n.toggle-knob {\n  position: absolute;\n  top: 2px;\n  left: 2px;\n  width: 18px;\n  height: 18px;\n  border-radius: 50%;\n  background: var(--mj-bg-surface);\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n  transition: transform 0.2s ease;\n}\n\n.toggle-on .toggle-knob {\n  transform: translateX(18px);\n}\n\n/* Type pills */\n.type-pills {\n  display: flex;\n  gap: 4px;\n  background: var(--mj-bg-surface-hover);\n  border-radius: 8px;\n  padding: 3px;\n  width: fit-content;\n}\n\n.type-pill {\n  padding: 5px 14px;\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-muted);\n  background: transparent;\n  border: none;\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n\n.type-pill:hover {\n  color: var(--mj-text-secondary);\n}\n\n.type-pill-active {\n  background: var(--mj-bg-surface);\n  color: var(--mj-brand-primary);\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n}\n\n/* Interval presets */\n.interval-presets {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 6px;\n}\n\n.preset-btn {\n  padding: 4px 12px;\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 500;\n  color: var(--mj-text-muted);\n  background: var(--mj-bg-surface-hover);\n  border: 1px solid var(--mj-border-default);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n\n.preset-btn:hover {\n  border-color: var(--mj-text-disabled);\n  color: var(--mj-text-secondary);\n}\n\n.preset-btn-active {\n  background: var(--mj-status-info-bg);\n  border-color: var(--mj-brand-primary);\n  color: var(--mj-brand-primary);\n}\n\n/* Custom interval input */\n.custom-interval {\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  margin-top: 4px;\n}\n\n.interval-input {\n  width: 100px;\n  padding: 5px 10px;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 6px;\n  font-size: 12px;\n  color: var(--mj-text-secondary);\n  outline: none;\n  transition: border-color 0.15s ease;\n}\n\n.interval-input:focus {\n  border-color: var(--mj-brand-primary);\n  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n}\n\n.interval-unit {\n  font-size: 12px;\n  color: var(--mj-text-disabled);\n}\n\n/* Cron config */\n.cron-presets {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 6px;\n}\n\n.cron-input-row {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  margin-top: 4px;\n  flex-wrap: wrap;\n}\n\n.cron-input {\n  width: 180px;\n  padding: 5px 10px;\n  border: 1px solid var(--mj-border-default);\n  border-radius: 6px;\n  font-size: 12px;\n  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n  color: var(--mj-text-secondary);\n  outline: none;\n  transition: border-color 0.15s ease;\n}\n\n.cron-input:focus {\n  border-color: var(--mj-brand-primary);\n  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 10%, transparent);\n}\n\n.cron-description {\n  font-size: 12px;\n  color: var(--mj-text-muted);\n  font-style: italic;\n}\n\n/* Card: Right (status) */\n.card-status {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n  gap: 16px;\n  min-width: 180px;\n  flex-shrink: 0;\n}\n\n.status-items {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n  text-align: right;\n}\n\n.status-item {\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n}\n\n.status-label {\n  font-size: 11px;\n  color: var(--mj-text-disabled);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.status-value {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--mj-text-secondary);\n}\n\n.status-running {\n  color: var(--mj-color-warning-600);\n  display: flex;\n  align-items: center;\n  justify-content: flex-end;\n  gap: 6px;\n}\n\n.status-idle {\n  color: var(--mj-color-success-600);\n}\n\n/* Card actions */\n.card-actions {\n  display: flex;\n  gap: 8px;\n}\n\n.btn-save {\n  animation: slideIn 0.2s ease;\n}\n\n@keyframes slideIn {\n  from {\n    opacity: 0;\n    transform: translateX(8px);\n  }\n  to {\n    opacity: 1;\n    transform: translateX(0);\n  }\n}\n\n.btn-run {\n  font-size: 12px;\n  padding: 6px 12px;\n}\n\n/* --------------------------------------------------------------------------\n   Empty State\n   -------------------------------------------------------------------------- */\n\n\n/* --------------------------------------------------------------------------\n   Responsive\n   -------------------------------------------------------------------------- */\n\n@media (max-width: 900px) {\n  .schedule-card {\n    flex-direction: column;\n    gap: 20px;\n  }\n\n  .card-info {\n    min-width: 0;\n    width: 100%;\n  }\n\n  .card-config {\n    width: 100%;\n  }\n\n  .card-status {\n    align-items: flex-start;\n    width: 100%;\n    min-width: 0;\n  }\n\n  .status-items {\n    text-align: left;\n    flex-direction: row;\n    gap: 20px;\n    flex-wrap: wrap;\n  }\n\n  .status-running {\n    justify-content: flex-start;\n  }\n\n  .card-actions {\n    width: 100%;\n  }\n\n  .card-actions .btn {\n    flex: 1;\n    justify-content: center;\n  }\n}\n\n@media (max-width: 768px) {\n  .timeline-section {\n    display: none;\n  }\n\n  .schedules-root {\n    padding: 16px;\n  }\n}\n"] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SchedulesComponent, { className: "SchedulesComponent", filePath: "src/Integration/components/schedules/schedules.component.ts", lineNumber: 73 }); })();
export function LoadSchedulesComponent() {
    // Tree-shaking prevention: importing this module causes
    // @RegisterClass decorators to fire, registering components.
}
//# sourceMappingURL=schedules.component.js.map