import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
import { GraphQLActionClient } from '@memberjunction/graphql-dataprovider';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
const _forTrack0 = ($index, $item) => $item.Name;
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 14);
    i0.ɵɵelement(1, "i", 15);
    i0.ɵɵtext(2, " This action runs with all parameters preset \u2014 no input needed. ");
    i0.ɵɵelementEnd();
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_1_For_4_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 18)(1, "label", 19);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "input", 20);
    i0.ɵɵtwoWayListener("ngModelChange", function ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_1_For_4_Template_input_ngModelChange_3_listener($event) { const f_r4 = i0.ɵɵrestoreView(_r3).$implicit; i0.ɵɵtwoWayBindingSet(f_r4.Value, $event) || (f_r4.Value = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const f_r4 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵproperty("for", "rf-" + f_r4.Name);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(f_r4.Name);
    i0.ɵɵadvance();
    i0.ɵɵproperty("id", "rf-" + f_r4.Name);
    i0.ɵɵtwoWayProperty("ngModel", f_r4.Value);
    i0.ɵɵproperty("disabled", ctx_r1.IsRunning)("placeholder", "Enter " + f_r4.Name);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 16);
    i0.ɵɵtext(1, "Provide values for the parameters below:");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "div", 17);
    i0.ɵɵrepeaterCreate(3, ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_1_For_4_Template, 4, 6, "div", 18, _forTrack0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(ctx_r1.RuntimeFields);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_0_Template, 3, 0, "div", 14)(1, ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Conditional_1_Template, 5, 0);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵconditional(ctx_r1.RuntimeFields.length === 0 ? 0 : 1);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 23);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 24);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 27);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(ctx_r1.ResultMessage);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 21)(1, "div", 22);
    i0.ɵɵconditionalCreate(2, ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_2_Template, 1, 0, "i", 23)(3, ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_3_Template, 1, 0, "i", 24);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 25)(5, "div", 26);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd();
    i0.ɵɵconditionalCreate(7, ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Conditional_7_Template, 2, 1, "div", 27);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("success", ctx_r1.RunSucceeded)("failure", !ctx_r1.RunSucceeded);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.RunSucceeded ? 2 : 3);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate(ctx_r1.RunSucceeded ? "Action completed" : "Action failed");
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.ResultMessage ? 7 : -1);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 11);
    i0.ɵɵelement(1, "i", 28);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.ErrorMessage, " ");
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 31);
    i0.ɵɵtext(1, " Running\u2026 ");
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 32);
    i0.ɵɵtext(1, " Run action ");
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Template(rf, ctx) { if (rf & 1) {
    const _r5 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 29);
    i0.ɵɵlistener("click", function ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.Run()); });
    i0.ɵɵconditionalCreate(1, ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Conditional_1_Template, 2, 0)(2, ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Conditional_2_Template, 2, 0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "button", 30);
    i0.ɵɵlistener("click", function ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.Close()); });
    i0.ɵɵtext(4, " Cancel ");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵstyleProp("background", ctx_r1.AccentColor)("border-color", ctx_r1.AccentColor);
    i0.ɵɵproperty("disabled", !ctx_r1.CanRun());
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.IsRunning ? 1 : 2);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("disabled", ctx_r1.IsRunning);
} }
function ActionPinRunnerDialogComponent_Conditional_0_Conditional_18_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 33);
    i0.ɵɵlistener("click", function ActionPinRunnerDialogComponent_Conditional_0_Conditional_18_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r6); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.Close()); });
    i0.ɵɵtext(1, " Done ");
    i0.ɵɵelementEnd();
} }
function ActionPinRunnerDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 0);
    i0.ɵɵlistener("click", function ActionPinRunnerDialogComponent_Conditional_0_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.Close()); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(1, "div", 1)(2, "div", 2)(3, "div", 3);
    i0.ɵɵelement(4, "i");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "div", 4)(6, "div", 5);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "div", 6);
    i0.ɵɵtext(9);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(10, "button", 7);
    i0.ɵɵlistener("click", function ActionPinRunnerDialogComponent_Conditional_0_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.Close()); });
    i0.ɵɵelement(11, "i", 8);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(12, "div", 9);
    i0.ɵɵconditionalCreate(13, ActionPinRunnerDialogComponent_Conditional_0_Conditional_13_Template, 2, 1)(14, ActionPinRunnerDialogComponent_Conditional_0_Conditional_14_Template, 8, 7, "div", 10);
    i0.ɵɵconditionalCreate(15, ActionPinRunnerDialogComponent_Conditional_0_Conditional_15_Template, 3, 1, "div", 11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(16, "div", 12);
    i0.ɵɵconditionalCreate(17, ActionPinRunnerDialogComponent_Conditional_0_Conditional_17_Template, 5, 7)(18, ActionPinRunnerDialogComponent_Conditional_0_Conditional_18_Template, 2, 0, "button", 13);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵstyleProp("background", "linear-gradient(135deg, " + ctx_r1.AccentColor + " 0%, " + ctx_r1.AccentColor + "cc 100%)");
    i0.ɵɵadvance(2);
    i0.ɵɵclassMap(ctx_r1.FaIcon);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(ctx_r1.Pin.DisplayName);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.ActionName);
    i0.ɵɵadvance();
    i0.ɵɵproperty("disabled", ctx_r1.IsRunning);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.RunSucceeded === null ? 13 : 14);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.ErrorMessage ? 15 : -1);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.RunSucceeded === null ? 17 : 18);
} }
export class ActionPinRunnerDialogComponent extends BaseAngularComponent {
    cdr;
    Visible = false;
    Pin = null;
    Result = new EventEmitter();
    RuntimeFields = [];
    IsRunning = false;
    RunSucceeded = null;
    ResultMessage = null;
    ErrorMessage = null;
    constructor(cdr) {
        super();
        this.cdr = cdr;
    }
    ngOnChanges(changes) {
        if (changes['Visible'] && this.Visible && this.Pin) {
            this.initFromPin();
        }
    }
    getConfig() {
        if (!this.Pin)
            return null;
        return this.Pin.Configuration;
    }
    initFromPin() {
        const cfg = this.getConfig();
        this.RuntimeFields = (cfg?.runtimeParamNames ?? []).map(name => ({ Name: name, Value: '' }));
        this.IsRunning = false;
        this.RunSucceeded = null;
        this.ResultMessage = null;
        this.ErrorMessage = null;
        this.cdr.markForCheck();
    }
    get AccentColor() {
        return this.getConfig()?.accentColor ?? 'var(--mj-brand-primary)';
    }
    get FaIcon() {
        return this.Pin?.Icon ?? 'fa-solid fa-bolt';
    }
    get ActionName() {
        return this.getConfig()?.actionName ?? 'Action';
    }
    CanRun() {
        if (this.IsRunning)
            return false;
        // Runtime fields without values are allowed (action may handle missing params).
        // The action itself reports required-param errors via its result.
        return true;
    }
    async Run() {
        const cfg = this.getConfig();
        if (!cfg || !cfg.actionId) {
            this.ErrorMessage = 'Pin is missing an actionId — cannot execute.';
            this.cdr.markForCheck();
            return;
        }
        this.IsRunning = true;
        this.RunSucceeded = null;
        this.ResultMessage = null;
        this.ErrorMessage = null;
        this.cdr.markForCheck();
        try {
            const params = this.buildActionParams(cfg);
            const provider = this.ProviderToUse;
            const actionClient = new GraphQLActionClient(provider);
            const result = await actionClient.RunAction(cfg.actionId, params);
            this.RunSucceeded = result.Success;
            this.ResultMessage = result.Message ?? (result.Success ? 'Action completed.' : 'Action reported a failure.');
        }
        catch (err) {
            this.RunSucceeded = false;
            this.ErrorMessage = `Execution failed: ${err.message}`;
        }
        finally {
            this.IsRunning = false;
            this.cdr.markForCheck();
        }
    }
    buildActionParams(cfg) {
        const params = [];
        for (const [name, value] of Object.entries(cfg.presetParams ?? {})) {
            params.push({ Name: name, Value: value, Type: 'Input' });
        }
        for (const f of this.RuntimeFields) {
            if (f.Value !== '') {
                params.push({ Name: f.Name, Value: f.Value, Type: 'Input' });
            }
        }
        return params;
    }
    Close() {
        if (this.IsRunning)
            return;
        this.Result.emit({ Closed: true });
    }
    static ɵfac = function ActionPinRunnerDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ActionPinRunnerDialogComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionPinRunnerDialogComponent, selectors: [["mj-action-pin-runner-dialog"]], inputs: { Visible: "Visible", Pin: "Pin" }, outputs: { Result: "Result" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[1, "apr-backdrop", 3, "click"], ["role", "dialog", "aria-modal", "true", 1, "apr-dialog"], [1, "apr-hero"], [1, "apr-hero-icon"], [1, "apr-hero-info"], [1, "apr-hero-title"], [1, "apr-hero-sub"], ["aria-label", "Close", 1, "apr-close", 3, "click", "disabled"], [1, "fa-solid", "fa-xmark"], [1, "apr-body"], [1, "apr-result", 3, "success", "failure"], [1, "apr-error"], [1, "apr-footer"], ["type", "button", 1, "apr-btn", "primary"], [1, "apr-no-fields"], [1, "fa-solid", "fa-circle-info"], [1, "apr-help"], [1, "apr-fields"], [1, "apr-field"], [3, "for"], ["type", "text", 1, "mj-input", 3, "ngModelChange", "id", "ngModel", "disabled", "placeholder"], [1, "apr-result"], [1, "apr-result-icon"], [1, "fa-solid", "fa-circle-check"], [1, "fa-solid", "fa-circle-xmark"], [1, "apr-result-text"], [1, "apr-result-title"], [1, "apr-result-msg"], [1, "fa-solid", "fa-triangle-exclamation"], ["type", "button", 1, "apr-btn", "primary", 3, "click", "disabled"], ["type", "button", 1, "apr-btn", 3, "click", "disabled"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "fa-solid", "fa-play"], ["type", "button", 1, "apr-btn", "primary", 3, "click"]], template: function ActionPinRunnerDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵconditionalCreate(0, ActionPinRunnerDialogComponent_Conditional_0_Template, 19, 10);
        } if (rf & 2) {
            i0.ɵɵconditional(ctx.Visible && ctx.Pin ? 0 : -1);
        } }, dependencies: [i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel], styles: [".apr-backdrop {\n    position: fixed;\n    inset: 0;\n    background: var(--mj-bg-overlay);\n    z-index: 9000;\n    animation: apr-fade-in 0.15s ease;\n}\n\n.apr-dialog {\n    position: fixed;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 9001;\n    width: min(480px, calc(100vw - 32px));\n    max-height: calc(100vh - 48px);\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    animation: apr-pop-in 0.18s ease;\n}\n\n@keyframes apr-fade-in {\n    from { opacity: 0; }\n    to { opacity: 1; }\n}\n\n@keyframes apr-pop-in {\n    from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }\n    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }\n}\n\n.apr-hero {\n    display: flex;\n    align-items: center;\n    gap: 14px;\n    padding: 18px 20px;\n    color: var(--mj-text-inverse, white);\n    position: relative;\n}\n\n.apr-hero-icon {\n    width: 48px;\n    height: 48px;\n    border-radius: 10px;\n    background: rgba(255, 255, 255, 0.2);\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    font-size: 22px;\n    flex-shrink: 0;\n    color: var(--mj-text-inverse, white);\n}\n\n.apr-hero-info {\n    flex: 1;\n    min-width: 0;\n}\n\n.apr-hero-title {\n    font-size: 16px;\n    font-weight: 600;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.apr-hero-sub {\n    font-size: 12px;\n    opacity: 0.85;\n    margin-top: 2px;\n    display: flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.apr-close {\n    background: rgba(255, 255, 255, 0.15);\n    border: none;\n    color: var(--mj-text-inverse, white);\n    font-size: 14px;\n    width: 32px;\n    height: 32px;\n    border-radius: 8px;\n    cursor: pointer;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    flex-shrink: 0;\n}\n\n.apr-close:hover:not(:disabled) {\n    background: rgba(255, 255, 255, 0.25);\n}\n\n.apr-close:disabled {\n    opacity: 0.5;\n    cursor: not-allowed;\n}\n\n.apr-body {\n    padding: 20px;\n    overflow-y: auto;\n    display: flex;\n    flex-direction: column;\n    gap: 14px;\n}\n\n.apr-no-fields {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 14px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    border-radius: 8px;\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n}\n\n.apr-no-fields i {\n    color: var(--mj-brand-primary);\n}\n\n.apr-help {\n    font-size: 13px;\n    color: var(--mj-text-muted);\n}\n\n.apr-fields {\n    display: flex;\n    flex-direction: column;\n    gap: 12px;\n}\n\n.apr-field {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n}\n\n.apr-field label {\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n}\n\n.apr-result {\n    display: flex;\n    gap: 14px;\n    padding: 16px;\n    border-radius: 8px;\n    align-items: flex-start;\n}\n\n.apr-result.success {\n    background: var(--mj-status-success-bg);\n    border: 1px solid var(--mj-status-success-border);\n    color: var(--mj-status-success-text);\n}\n\n.apr-result.failure {\n    background: var(--mj-status-error-bg);\n    border: 1px solid var(--mj-status-error-border);\n    color: var(--mj-status-error-text);\n}\n\n.apr-result-icon {\n    font-size: 28px;\n    line-height: 1;\n}\n\n.apr-result-title {\n    font-size: 14px;\n    font-weight: 600;\n    margin-bottom: 4px;\n}\n\n.apr-result-msg {\n    font-size: 13px;\n    line-height: 1.5;\n    opacity: 0.9;\n}\n\n.apr-error {\n    padding: 10px 12px;\n    background: var(--mj-status-error-bg);\n    color: var(--mj-status-error-text);\n    border: 1px solid var(--mj-status-error-border);\n    border-radius: 6px;\n    font-size: 13px;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.apr-footer {\n    display: flex;\n    gap: 8px;\n    padding: 14px 20px;\n    border-top: 1px solid var(--mj-border-subtle);\n    background: var(--mj-bg-surface-card);\n}\n\n.apr-btn {\n    padding: 9px 16px;\n    border-radius: 6px;\n    font-size: 13px;\n    font-weight: 500;\n    cursor: pointer;\n    border: 1px solid var(--mj-border-default);\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.apr-btn:hover:not(:disabled) {\n    background: var(--mj-bg-surface-hover);\n}\n\n.apr-btn.primary {\n    background: var(--mj-brand-primary);\n    color: var(--mj-text-inverse, white);\n    border-color: var(--mj-brand-primary);\n}\n\n.apr-btn.primary:hover:not(:disabled) {\n    filter: brightness(0.92);\n}\n\n.apr-btn:disabled {\n    opacity: 0.5;\n    cursor: not-allowed;\n}\n"], encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionPinRunnerDialogComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-action-pin-runner-dialog', encapsulation: ViewEncapsulation.None, template: "@if (Visible && Pin) {\n  <div class=\"apr-backdrop\" (click)=\"Close()\"></div>\n  <div class=\"apr-dialog\" role=\"dialog\" aria-modal=\"true\">\n    <div class=\"apr-hero\" [style.background]=\"'linear-gradient(135deg, ' + AccentColor + ' 0%, ' + AccentColor + 'cc 100%)'\">\n      <div class=\"apr-hero-icon\">\n        <i [class]=\"FaIcon\"></i>\n      </div>\n      <div class=\"apr-hero-info\">\n        <div class=\"apr-hero-title\">{{ Pin.DisplayName }}</div>\n        <div class=\"apr-hero-sub\">{{ ActionName }}</div>\n      </div>\n      <button class=\"apr-close\" (click)=\"Close()\" [disabled]=\"IsRunning\" aria-label=\"Close\">\n        <i class=\"fa-solid fa-xmark\"></i>\n      </button>\n    </div>\n\n    <div class=\"apr-body\">\n      @if (RunSucceeded === null) {\n        @if (RuntimeFields.length === 0) {\n          <div class=\"apr-no-fields\">\n            <i class=\"fa-solid fa-circle-info\"></i>\n            This action runs with all parameters preset \u2014 no input needed.\n          </div>\n        } @else {\n          <div class=\"apr-help\">Provide values for the parameters below:</div>\n          <div class=\"apr-fields\">\n            @for (f of RuntimeFields; track f.Name) {\n              <div class=\"apr-field\">\n                <label [for]=\"'rf-' + f.Name\">{{ f.Name }}</label>\n                <input [id]=\"'rf-' + f.Name\"\n                       type=\"text\"\n                       class=\"mj-input\"\n                       [(ngModel)]=\"f.Value\"\n                       [disabled]=\"IsRunning\"\n                       [placeholder]=\"'Enter ' + f.Name\" />\n              </div>\n            }\n          </div>\n        }\n      } @else {\n        <div class=\"apr-result\" [class.success]=\"RunSucceeded\" [class.failure]=\"!RunSucceeded\">\n          <div class=\"apr-result-icon\">\n            @if (RunSucceeded) {\n              <i class=\"fa-solid fa-circle-check\"></i>\n            } @else {\n              <i class=\"fa-solid fa-circle-xmark\"></i>\n            }\n          </div>\n          <div class=\"apr-result-text\">\n            <div class=\"apr-result-title\">{{ RunSucceeded ? 'Action completed' : 'Action failed' }}</div>\n            @if (ResultMessage) {\n              <div class=\"apr-result-msg\">{{ ResultMessage }}</div>\n            }\n          </div>\n        </div>\n      }\n\n      @if (ErrorMessage) {\n        <div class=\"apr-error\">\n          <i class=\"fa-solid fa-triangle-exclamation\"></i> {{ ErrorMessage }}\n        </div>\n      }\n    </div>\n\n    <div class=\"apr-footer\">\n      @if (RunSucceeded === null) {\n        <button type=\"button\" class=\"apr-btn primary\"\n                [disabled]=\"!CanRun()\"\n                [style.background]=\"AccentColor\"\n                [style.border-color]=\"AccentColor\"\n                (click)=\"Run()\">\n          @if (IsRunning) {\n            <i class=\"fa-solid fa-spinner fa-spin\"></i> Running\u2026\n          } @else {\n            <i class=\"fa-solid fa-play\"></i> Run action\n          }\n        </button>\n        <button type=\"button\" class=\"apr-btn\" [disabled]=\"IsRunning\" (click)=\"Close()\">\n          Cancel\n        </button>\n      } @else {\n        <button type=\"button\" class=\"apr-btn primary\" (click)=\"Close()\">\n          Done\n        </button>\n      }\n    </div>\n  </div>\n}\n", styles: [".apr-backdrop {\n    position: fixed;\n    inset: 0;\n    background: var(--mj-bg-overlay);\n    z-index: 9000;\n    animation: apr-fade-in 0.15s ease;\n}\n\n.apr-dialog {\n    position: fixed;\n    top: 50%;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 9001;\n    width: min(480px, calc(100vw - 32px));\n    max-height: calc(100vh - 48px);\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    border: 1px solid var(--mj-border-default);\n    border-radius: 12px;\n    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);\n    display: flex;\n    flex-direction: column;\n    overflow: hidden;\n    animation: apr-pop-in 0.18s ease;\n}\n\n@keyframes apr-fade-in {\n    from { opacity: 0; }\n    to { opacity: 1; }\n}\n\n@keyframes apr-pop-in {\n    from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }\n    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }\n}\n\n.apr-hero {\n    display: flex;\n    align-items: center;\n    gap: 14px;\n    padding: 18px 20px;\n    color: var(--mj-text-inverse, white);\n    position: relative;\n}\n\n.apr-hero-icon {\n    width: 48px;\n    height: 48px;\n    border-radius: 10px;\n    background: rgba(255, 255, 255, 0.2);\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    font-size: 22px;\n    flex-shrink: 0;\n    color: var(--mj-text-inverse, white);\n}\n\n.apr-hero-info {\n    flex: 1;\n    min-width: 0;\n}\n\n.apr-hero-title {\n    font-size: 16px;\n    font-weight: 600;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.apr-hero-sub {\n    font-size: 12px;\n    opacity: 0.85;\n    margin-top: 2px;\n    display: flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.apr-close {\n    background: rgba(255, 255, 255, 0.15);\n    border: none;\n    color: var(--mj-text-inverse, white);\n    font-size: 14px;\n    width: 32px;\n    height: 32px;\n    border-radius: 8px;\n    cursor: pointer;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    flex-shrink: 0;\n}\n\n.apr-close:hover:not(:disabled) {\n    background: rgba(255, 255, 255, 0.25);\n}\n\n.apr-close:disabled {\n    opacity: 0.5;\n    cursor: not-allowed;\n}\n\n.apr-body {\n    padding: 20px;\n    overflow-y: auto;\n    display: flex;\n    flex-direction: column;\n    gap: 14px;\n}\n\n.apr-no-fields {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    padding: 14px;\n    background: var(--mj-bg-surface-sunken);\n    border: 1px solid var(--mj-border-subtle);\n    border-radius: 8px;\n    font-size: 13px;\n    color: var(--mj-text-secondary);\n}\n\n.apr-no-fields i {\n    color: var(--mj-brand-primary);\n}\n\n.apr-help {\n    font-size: 13px;\n    color: var(--mj-text-muted);\n}\n\n.apr-fields {\n    display: flex;\n    flex-direction: column;\n    gap: 12px;\n}\n\n.apr-field {\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n}\n\n.apr-field label {\n    font-size: 12px;\n    font-weight: 600;\n    color: var(--mj-text-secondary);\n}\n\n.apr-result {\n    display: flex;\n    gap: 14px;\n    padding: 16px;\n    border-radius: 8px;\n    align-items: flex-start;\n}\n\n.apr-result.success {\n    background: var(--mj-status-success-bg);\n    border: 1px solid var(--mj-status-success-border);\n    color: var(--mj-status-success-text);\n}\n\n.apr-result.failure {\n    background: var(--mj-status-error-bg);\n    border: 1px solid var(--mj-status-error-border);\n    color: var(--mj-status-error-text);\n}\n\n.apr-result-icon {\n    font-size: 28px;\n    line-height: 1;\n}\n\n.apr-result-title {\n    font-size: 14px;\n    font-weight: 600;\n    margin-bottom: 4px;\n}\n\n.apr-result-msg {\n    font-size: 13px;\n    line-height: 1.5;\n    opacity: 0.9;\n}\n\n.apr-error {\n    padding: 10px 12px;\n    background: var(--mj-status-error-bg);\n    color: var(--mj-status-error-text);\n    border: 1px solid var(--mj-status-error-border);\n    border-radius: 6px;\n    font-size: 13px;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n}\n\n.apr-footer {\n    display: flex;\n    gap: 8px;\n    padding: 14px 20px;\n    border-top: 1px solid var(--mj-border-subtle);\n    background: var(--mj-bg-surface-card);\n}\n\n.apr-btn {\n    padding: 9px 16px;\n    border-radius: 6px;\n    font-size: 13px;\n    font-weight: 500;\n    cursor: pointer;\n    border: 1px solid var(--mj-border-default);\n    background: var(--mj-bg-surface);\n    color: var(--mj-text-primary);\n    display: inline-flex;\n    align-items: center;\n    gap: 6px;\n}\n\n.apr-btn:hover:not(:disabled) {\n    background: var(--mj-bg-surface-hover);\n}\n\n.apr-btn.primary {\n    background: var(--mj-brand-primary);\n    color: var(--mj-text-inverse, white);\n    border-color: var(--mj-brand-primary);\n}\n\n.apr-btn.primary:hover:not(:disabled) {\n    filter: brightness(0.92);\n}\n\n.apr-btn:disabled {\n    opacity: 0.5;\n    cursor: not-allowed;\n}\n"] }]
    }], () => [{ type: i0.ChangeDetectorRef }], { Visible: [{
            type: Input
        }], Pin: [{
            type: Input
        }], Result: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActionPinRunnerDialogComponent, { className: "ActionPinRunnerDialogComponent", filePath: "src/Home/action-pin-runner-dialog.component.ts", lineNumber: 26 }); })();
//# sourceMappingURL=action-pin-runner-dialog.component.js.map