import { Component, Input, Output, EventEmitter } from '@angular/core';
import { MJNotificationService } from '@memberjunction/ng-notifications';
import { Metadata } from '@memberjunction/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "@progress/kendo-angular-layout";
import * as i4 from "@progress/kendo-angular-dialog";
import * as i5 from "@progress/kendo-angular-inputs";
import * as i6 from "@progress/kendo-angular-buttons";
const _forTrack0 = ($index, $item) => $item.name;
const _forTrack1 = ($index, $item) => $item.field;
function QueryRunDialogComponent_kendo_dialog_0_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 5);
    i0.ɵɵelement(1, "i", 6);
    i0.ɵɵelementStart(2, "span", 7);
    i0.ɵɵtext(3, "Loading query parameters...");
    i0.ɵɵelementEnd()();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 27);
    i0.ɵɵelement(1, "i", 28);
    i0.ɵɵtext(2, " Query Parameters ");
    i0.ɵɵelementStart(3, "span", 29);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.parameterPairs.length, " ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 33);
    i0.ɵɵtext(1, "*");
    i0.ɵɵelementEnd();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 34);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const param_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", param_r5.description, " ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 37);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_12_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-numerictextbox", 41);
    i0.ɵɵtwoWayListener("ngModelChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_12_Template_kendo_numerictextbox_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const param_r5 = i0.ɵɵnextContext().$implicit; i0.ɵɵtwoWayBindingSet(param_r5.value, $event) || (param_r5.value = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const param_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵtwoWayProperty("ngModel", param_r5.value);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_13_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-textarea", 42);
    i0.ɵɵtwoWayListener("ngModelChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_13_Template_kendo_textarea_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const param_r5 = i0.ɵɵnextContext().$implicit; i0.ɵɵtwoWayBindingSet(param_r5.value, $event) || (param_r5.value = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const param_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵtwoWayProperty("ngModel", param_r5.value);
    i0.ɵɵproperty("rows", 2);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_14_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 40);
    i0.ɵɵtext(1, " Default: ");
    i0.ɵɵelementStart(2, "code", 43);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const param_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate(param_r5.defaultValue);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 26)(1, "div", 30)(2, "div")(3, "label", 31);
    i0.ɵɵelement(4, "i", 32);
    i0.ɵɵtext(5);
    i0.ɵɵtemplate(6, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_6_Template, 2, 0, "span", 33);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(7, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_7_Template, 2, 1, "div", 34);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "div", 35)(9, "span", 36);
    i0.ɵɵtext(10);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(11, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_11_Template, 1, 0, "i", 37);
    i0.ɵɵelementEnd()();
    i0.ɵɵtemplate(12, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_12_Template, 1, 1, "kendo-numerictextbox", 38)(13, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_13_Template, 1, 2, "kendo-textarea", 39)(14, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Conditional_14_Template, 4, 1, "div", 40);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const param_r5 = ctx.$implicit;
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate1(" ", param_r5.name, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(param_r5.isRequired ? 6 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(param_r5.description ? 7 : -1);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", param_r5.type, " ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(!ctx_r1.isParameterValid(param_r5) ? 11 : -1);
    i0.ɵɵadvance();
    i0.ɵɵconditional(param_r5.type === "number" ? 12 : 13);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(param_r5.defaultValue ? 14 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    const _r4 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-expansionpanel", 22);
    i0.ɵɵtwoWayListener("expandedChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_Template_kendo_expansionpanel_expandedChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(3); i0.ɵɵtwoWayBindingSet(ctx_r1.parametersExpanded, $event) || (ctx_r1.parametersExpanded = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵtemplate(1, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_ng_template_1_Template, 5, 1, "ng-template", 11);
    i0.ɵɵelementStart(2, "div", 12)(3, "div", 23);
    i0.ɵɵelement(4, "i", 24);
    i0.ɵɵtext(5, " Configure parameter values for query execution. ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "div", 25);
    i0.ɵɵrepeaterCreate(7, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_For_8_Template, 15, 7, "div", 26, _forTrack0);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵtwoWayProperty("expanded", ctx_r1.parametersExpanded);
    i0.ɵɵadvance(7);
    i0.ɵɵrepeater(ctx_r1.parameterPairs);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 9);
    i0.ɵɵelement(1, "i", 24);
    i0.ɵɵtext(2, " This query has no parameters. ");
    i0.ɵɵelementEnd();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_ng_template_3_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 45);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.maxRows, " rows/page ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 27);
    i0.ɵɵelement(1, "i", 44);
    i0.ɵɵtext(2, " Pagination Settings ");
    i0.ɵɵtemplate(3, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_ng_template_3_Conditional_3_Template, 2, 1, "span", 45);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.maxRows && ctx_r1.maxRows > 0 ? 3 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 29);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(6);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" of ", ctx_r1.runResult.TotalRowCount, " total ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 52);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(2, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_3_Conditional_2_Template, 2, 1, "span", 29);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.runResult.RowCount, " rows ");
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.runResult.TotalRowCount > ctx_r1.runResult.RowCount ? 2 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 50);
    i0.ɵɵtext(1, " Error ");
    i0.ɵɵelementEnd();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 51);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" (", ctx_r1.runResult.ExecutionTime, "ms) ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 27);
    i0.ɵɵelement(1, "i", 49);
    i0.ɵɵtext(2, " Query Results ");
    i0.ɵɵtemplate(3, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_3_Template, 3, 2)(4, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_4_Template, 2, 0, "span", 50)(5, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Conditional_5_Template, 2, 1, "span", 51);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.runResult.Success ? 3 : 4);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.runResult.ExecutionTime ? 5 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    const _r10 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "span", 66);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(2, "div", 67)(3, "button", 68);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r1.goToFirstPage()); });
    i0.ɵɵelement(4, "i", 69);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "button", 70);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r1.goToPreviousPage()); });
    i0.ɵɵelement(6, "i", 71);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "button", 72);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r1.goToNextPage()); });
    i0.ɵɵelement(8, "i", 73);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(9, "button", 74);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template_button_click_9_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r1.goToLastPage()); });
    i0.ɵɵelement(10, "i", 75);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(6);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate3(" Showing rows ", ctx_r1.startRow + 1, " - ", ctx_r1.startRow + ctx_r1.runResult.RowCount, " of ", ctx_r1.runResult.TotalRowCount, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("disabled", ctx_r1.startRow === 0);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("disabled", ctx_r1.startRow === 0);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("disabled", ctx_r1.startRow + ctx_r1.runResult.RowCount >= ctx_r1.runResult.TotalRowCount);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("disabled", ctx_r1.startRow + ctx_r1.runResult.RowCount >= ctx_r1.runResult.TotalRowCount);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_15_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "th", 63);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const col_r11 = ctx.$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", col_r11.title, " ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_18_For_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "td", 76);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const col_r12 = ctx.$implicit;
    const row_r13 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("title", row_r13[col_r12.field]);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", row_r13[col_r12.field] || "", " ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "tr", 64);
    i0.ɵɵrepeaterCreate(1, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_18_For_2_Template, 2, 2, "td", 76, _forTrack1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(6);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r1.resultColumns);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_19_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 65);
    i0.ɵɵelement(1, "i", 77);
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtext(3, "No data in results");
    i0.ɵɵelementEnd()();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    const _r9 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 54)(1, "div", 14);
    i0.ɵɵtemplate(2, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_2_Template, 11, 7);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "div", 55)(4, "button", 56);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r9); const ctx_r1 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r1.copyToClipboard()); });
    i0.ɵɵelement(5, "i", 57);
    i0.ɵɵtext(6, " Copy ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(7, "button", 58);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r9); const ctx_r1 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r1.exportToCSV()); });
    i0.ɵɵelement(8, "i", 59);
    i0.ɵɵtext(9, " Export CSV ");
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(10, "div", 60)(11, "table", 61)(12, "thead", 62)(13, "tr");
    i0.ɵɵrepeaterCreate(14, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_15_Template, 2, 1, "th", 63, _forTrack1);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(16, "tbody");
    i0.ɵɵrepeaterCreate(17, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_For_18_Template, 3, 0, "tr", 64, i0.ɵɵrepeaterTrackByIndex);
    i0.ɵɵelementEnd()();
    i0.ɵɵtemplate(19, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Conditional_19_Template, 4, 0, "div", 65);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.runResult.TotalRowCount > ctx_r1.runResult.RowCount || ctx_r1.startRow > 0 ? 2 : -1);
    i0.ɵɵadvance(12);
    i0.ɵɵrepeater(ctx_r1.resultColumns);
    i0.ɵɵadvance(3);
    i0.ɵɵrepeater(ctx_r1.resultRows);
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.resultRows.length === 0 ? 19 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 53);
    i0.ɵɵelement(1, "i", 78);
    i0.ɵɵelementStart(2, "p");
    i0.ɵɵtext(3, "No results returned");
    i0.ɵɵelementEnd()();
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_0_Template, 20, 2)(1, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Conditional_1_Template, 4, 0, "div", 53);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵconditional(ctx_r1.resultRows.length > 0 ? 0 : 1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_4_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 81);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.runResult.ErrorMessage, " ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 48)(1, "div", 79);
    i0.ɵɵelement(2, "i", 80);
    i0.ɵɵelementStart(3, "strong");
    i0.ɵɵtext(4, "Query execution failed");
    i0.ɵɵelementEnd()();
    i0.ɵɵtemplate(5, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_4_Conditional_5_Template, 2, 1, "div", 81);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(4);
    i0.ɵɵadvance(5);
    i0.ɵɵconditional(ctx_r1.runResult.ErrorMessage ? 5 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-expansionpanel", 46);
    i0.ɵɵtwoWayListener("expandedChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Template_kendo_expansionpanel_expandedChange_0_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r1 = i0.ɵɵnextContext(3); i0.ɵɵtwoWayBindingSet(ctx_r1.resultsExpanded, $event) || (ctx_r1.resultsExpanded = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵtemplate(1, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_ng_template_1_Template, 6, 2, "ng-template", 11);
    i0.ɵɵelementStart(2, "div", 47);
    i0.ɵɵtemplate(3, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_3_Template, 2, 1)(4, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Conditional_4_Template, 6, 1, "div", 48);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(3);
    i0.ɵɵtwoWayProperty("expanded", ctx_r1.resultsExpanded);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.runResult.Success ? 3 : 4);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵtemplate(0, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_0_Template, 9, 1, "kendo-expansionpanel", 8)(1, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_1_Template, 3, 0, "div", 9);
    i0.ɵɵelementStart(2, "kendo-expansionpanel", 10);
    i0.ɵɵtwoWayListener("expandedChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Template_kendo_expansionpanel_expandedChange_2_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.paginationExpanded, $event) || (ctx_r1.paginationExpanded = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵtemplate(3, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_ng_template_3_Template, 4, 1, "ng-template", 11);
    i0.ɵɵelementStart(4, "div", 12)(5, "div", 13)(6, "div", 14)(7, "label", 15);
    i0.ɵɵelement(8, "i", 16);
    i0.ɵɵtext(9, " Max Rows: ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "kendo-numerictextbox", 17);
    i0.ɵɵtwoWayListener("ngModelChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Template_kendo_numerictextbox_ngModelChange_10_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.maxRows, $event) || (ctx_r1.maxRows = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "span", 18);
    i0.ɵɵtext(12, " Leave empty to return all rows ");
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(13, "div", 14)(14, "label", 15);
    i0.ɵɵelement(15, "i", 19);
    i0.ɵɵtext(16, " Start Row: ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(17, "kendo-numerictextbox", 20);
    i0.ɵɵtwoWayListener("ngModelChange", function QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Template_kendo_numerictextbox_ngModelChange_17_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(2); i0.ɵɵtwoWayBindingSet(ctx_r1.startRow, $event) || (ctx_r1.startRow = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "span", 18);
    i0.ɵɵtext(19, " 0-based offset for pagination ");
    i0.ɵɵelementEnd()()()()();
    i0.ɵɵtemplate(20, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Conditional_20_Template, 5, 2, "kendo-expansionpanel", 21);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵconditional(ctx_r1.parameterPairs.length > 0 ? 0 : 1);
    i0.ɵɵadvance(2);
    i0.ɵɵtwoWayProperty("expanded", ctx_r1.paginationExpanded);
    i0.ɵɵadvance(8);
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.maxRows);
    i0.ɵɵproperty("min", 1)("step", 100);
    i0.ɵɵadvance(7);
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.startRow);
    i0.ɵɵproperty("min", 0)("step", 1);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(ctx_r1.runResult ? 20 : -1);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Conditional_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 85);
    i0.ɵɵtext(1, " Running... ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Conditional_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 86);
    i0.ɵɵtext(1, " Run Query ");
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Template(rf, ctx) { if (rf & 1) {
    const _r14 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 82);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r14); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.close()); });
    i0.ɵɵelement(1, "i", 83);
    i0.ɵɵtext(2, " Cancel ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "button", 84);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r14); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.runQuery()); });
    i0.ɵɵtemplate(4, QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Conditional_4_Template, 2, 0)(5, QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Conditional_5_Template, 2, 0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("themeColor", "primary")("disabled", ctx_r1.isRunning || ctx_r1.hasInvalidParameters());
    i0.ɵɵadvance();
    i0.ɵɵconditional(ctx_r1.isRunning ? 4 : 5);
} }
function QueryRunDialogComponent_kendo_dialog_0_Conditional_10_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 82);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_10_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.close()); });
    i0.ɵɵelement(1, "i", 83);
    i0.ɵɵtext(2, " Close ");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(3, "button", 84);
    i0.ɵɵlistener("click", function QueryRunDialogComponent_kendo_dialog_0_Conditional_10_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r15); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.runQuery()); });
    i0.ɵɵelement(4, "i", 87);
    i0.ɵɵtext(5, " Run Again ");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("themeColor", "primary")("disabled", ctx_r1.isRunning);
} }
function QueryRunDialogComponent_kendo_dialog_0_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "kendo-dialog", 1);
    i0.ɵɵlistener("close", function QueryRunDialogComponent_kendo_dialog_0_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.close()); });
    i0.ɵɵelementStart(1, "kendo-dialog-titlebar")(2, "div", 2);
    i0.ɵɵelement(3, "i", 3);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(5, "div", 4);
    i0.ɵɵtemplate(6, QueryRunDialogComponent_kendo_dialog_0_Conditional_6_Template, 4, 0, "div", 5)(7, QueryRunDialogComponent_kendo_dialog_0_Conditional_7_Template, 21, 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "kendo-dialog-actions");
    i0.ɵɵtemplate(9, QueryRunDialogComponent_kendo_dialog_0_Conditional_9_Template, 6, 3)(10, QueryRunDialogComponent_kendo_dialog_0_Conditional_10_Template, 6, 2);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("width", 900)("height", 800);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1(" Run Query: ", (ctx_r1.query == null ? null : ctx_r1.query.Name) || "Untitled", " ");
    i0.ɵɵadvance(2);
    i0.ɵɵconditional(ctx_r1.isLoadingParams ? 6 : 7);
    i0.ɵɵadvance(3);
    i0.ɵɵconditional(!ctx_r1.runResult ? 9 : 10);
} }
export class QueryRunDialogComponent {
    constructor() {
        this.query = null;
        this.parameters = [];
        this.isVisible = false;
        this.isVisibleChange = new EventEmitter();
        this.onClose = new EventEmitter();
        this.isRunning = false;
        this.isLoadingParams = false;
        this.parameterPairs = [];
        this.parametersExpanded = true;
        this.resultsExpanded = true;
        this.paginationExpanded = false;
        this.runResult = null;
        this.resultColumns = [];
        this.resultRows = [];
        this.selectedRows = [];
        this.maxRows = null;
        this.startRow = 0;
    }
    ngOnInit() {
        this.initializeParameters();
    }
    ngOnChanges(changes) {
        if (changes['isVisible'] && changes['isVisible'].currentValue) {
            this.initializeParameters();
        }
        if (changes['parameters']) {
            this.initializeParameters();
        }
    }
    initializeParameters() {
        if (!this.query || !this.parameters)
            return;
        // Create parameter pairs from defined query parameters only
        this.parameterPairs = this.parameters.map(param => ({
            name: param.Name,
            value: param.DefaultValue || '',
            type: param.Type || 'string',
            defaultValue: param.DefaultValue || '',
            description: param.Description || '',
            isRequired: param.IsRequired || false
        }));
    }
    getValueListOptions(valueList) {
        if (!valueList)
            return [];
        try {
            const options = valueList.split(',').map(v => v.trim());
            return options.map(opt => ({ text: opt, value: opt }));
        }
        catch {
            return [];
        }
    }
    isParameterValid(param) {
        if (param.isRequired && !param.value) {
            return false;
        }
        // Additional type-specific validation could go here
        if (param.type === 'number' && param.value) {
            return !isNaN(Number(param.value));
        }
        return true;
    }
    async runQuery(isPaginationRequest = false) {
        if (!this.query?.ID)
            return;
        // Validate required parameters
        const invalidParams = this.parameterPairs.filter(p => p.isRequired && !p.value);
        if (invalidParams.length > 0) {
            MJNotificationService.Instance.CreateSimpleNotification(`Required parameters missing: ${invalidParams.map(p => p.name).join(', ')}`, 'warning', 3000);
            return;
        }
        this.isRunning = true;
        this.runResult = null;
        try {
            // Build parameters object
            const queryParameters = {};
            this.parameterPairs.forEach(param => {
                if (param.value) {
                    try {
                        // Try to parse as JSON first, fallback to string
                        queryParameters[param.name] = JSON.parse(param.value);
                    }
                    catch {
                        // If JSON parsing fails, treat as string or number based on type
                        if (param.type === 'number') {
                            queryParameters[param.name] = Number(param.value);
                        }
                        else {
                            queryParameters[param.name] = param.value;
                        }
                    }
                }
            });
            // Get GraphQL data provider
            const dataProvider = Metadata.Provider;
            // Execute the GetQueryData GraphQL query
            const query = `
                query GetQueryData($QueryID: String!, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
                    GetQueryData(QueryID: $QueryID, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
                        QueryID
                        QueryName
                        Success
                        Results
                        ErrorMessage
                        RowCount
                        TotalRowCount
                        ExecutionTime
                        AppliedParameters
                    }
                }
            `;
            const variables = {
                QueryID: this.query.ID,
                Parameters: queryParameters
            };
            // Only include MaxRows if it's set
            if (this.maxRows && this.maxRows > 0) {
                variables.MaxRows = this.maxRows;
            }
            // Only include StartRow if it's set and greater than 0
            if (this.startRow && this.startRow > 0) {
                variables.StartRow = this.startRow;
            }
            console.log('Executing query with variables:', variables);
            const response = await dataProvider.ExecuteGQL(query, variables);
            if (response?.GetQueryData) {
                this.runResult = response.GetQueryData;
                if (this.runResult.Success && this.runResult.Results) {
                    // Parse the JSON string results
                    try {
                        const parsedResults = JSON.parse(this.runResult.Results);
                        this.processResults(parsedResults);
                        // Only show notification on first run (not pagination)
                        if (!isPaginationRequest) {
                            const rowCountMsg = this.runResult.TotalRowCount > this.runResult.RowCount
                                ? `Query executed successfully. Showing ${this.runResult.RowCount} of ${this.runResult.TotalRowCount} total rows.`
                                : `Query executed successfully. ${this.runResult.RowCount} rows returned.`;
                            MJNotificationService.Instance.CreateSimpleNotification(rowCountMsg, 'success', 3000);
                        }
                        // Automatically expand results and collapse other sections
                        this.parametersExpanded = false;
                        this.paginationExpanded = false;
                        this.resultsExpanded = true;
                    }
                    catch (error) {
                        console.error('Error parsing results:', error);
                        MJNotificationService.Instance.CreateSimpleNotification('Failed to parse query results', 'error', 3000);
                    }
                }
                else {
                    console.error('Query execution failed:', this.runResult);
                    MJNotificationService.Instance.CreateSimpleNotification(this.runResult?.ErrorMessage || 'Query execution failed', 'error', 3000);
                    // Expand results section to show error
                    this.parametersExpanded = false;
                    this.paginationExpanded = false;
                    this.resultsExpanded = true;
                }
            }
            else {
                throw new Error('No response from server');
            }
        }
        catch (error) {
            console.error('Error running query:', error);
            this.runResult = {
                QueryID: this.query.ID,
                QueryName: this.query.Name,
                Success: false,
                Results: '[]',
                ErrorMessage: error instanceof Error ? error.message : 'Unknown error occurred',
                RowCount: 0,
                TotalRowCount: 0,
                ExecutionTime: 0
            };
            MJNotificationService.Instance.CreateSimpleNotification('Failed to execute query. Please check your parameters and try again.', 'error', 3000);
        }
        finally {
            this.isRunning = false;
        }
    }
    processResults(results) {
        if (!results || results.length === 0) {
            this.resultColumns = [];
            this.resultRows = [];
            return;
        }
        // Extract columns from first row
        const firstRow = results[0];
        this.resultColumns = Object.keys(firstRow).map(key => ({
            field: key,
            title: this.formatColumnTitle(key),
            width: this.calculateColumnWidth(key, results)
        }));
        // Set rows
        this.resultRows = results;
    }
    formatColumnTitle(field) {
        // Convert camelCase or snake_case to Title Case
        return field
            .replace(/([A-Z])/g, ' $1')
            .replace(/_/g, ' ')
            .replace(/^\s+/, '')
            .split(' ')
            .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
            .join(' ');
    }
    calculateColumnWidth(field, data) {
        // Calculate appropriate column width based on content
        const maxLength = Math.max(field.length, ...data.slice(0, 10).map(row => String(row[field] || '').length));
        return Math.min(Math.max(maxLength * 10, 100), 300);
    }
    exportToCSV() {
        if (!this.resultRows || this.resultRows.length === 0) {
            MJNotificationService.Instance.CreateSimpleNotification('No data to export', 'warning', 3000);
            return;
        }
        // Create CSV content
        const headers = this.resultColumns.map(col => col.title).join(',');
        const rows = this.resultRows.map(row => this.resultColumns.map(col => {
            const value = row[col.field];
            // Escape values containing commas or quotes
            if (typeof value === 'string' && (value.includes(',') || value.includes('"'))) {
                return `"${value.replace(/"/g, '""')}"`;
            }
            return value;
        }).join(','));
        const csv = [headers, ...rows].join('\n');
        // Create and download file
        const blob = new Blob([csv], { type: 'text/csv' });
        const url = window.URL.createObjectURL(blob);
        const a = document.createElement('a');
        a.href = url;
        a.download = `${this.query?.Name || 'query'}_results_${new Date().toISOString().slice(0, 10)}.csv`;
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
        window.URL.revokeObjectURL(url);
        MJNotificationService.Instance.CreateSimpleNotification('Results exported to CSV', 'success', 3000);
    }
    async copyToClipboard() {
        if (!this.resultRows || this.resultRows.length === 0) {
            MJNotificationService.Instance.CreateSimpleNotification('No data to copy', 'warning', 3000);
            return;
        }
        try {
            // Create tab-delimited content for pasting into Excel
            const headers = this.resultColumns.map(col => col.title).join('\t');
            const rows = this.resultRows.map(row => this.resultColumns.map(col => row[col.field] || '').join('\t'));
            const content = [headers, ...rows].join('\n');
            await navigator.clipboard.writeText(content);
            MJNotificationService.Instance.CreateSimpleNotification('Results copied to clipboard', 'success', 3000);
        }
        catch (error) {
            console.error('Failed to copy to clipboard:', error);
            MJNotificationService.Instance.CreateSimpleNotification('Failed to copy to clipboard', 'error', 3000);
        }
    }
    close() {
        this.isVisible = false;
        this.isVisibleChange.emit(false);
        this.onClose.emit();
        // Reset state
        this.runResult = null;
        this.resultColumns = [];
        this.resultRows = [];
        this.selectedRows = [];
        this.startRow = 0;
    }
    getAppliedParametersCount() {
        return this.parameterPairs.filter(p => p.value).length;
    }
    hasInvalidParameters() {
        return this.parameterPairs.some(p => !this.isParameterValid(p));
    }
    // Pagination methods
    goToFirstPage() {
        this.startRow = 0;
        this.runQuery(true);
    }
    goToPreviousPage() {
        if (this.startRow > 0 && this.maxRows) {
            this.startRow = Math.max(0, this.startRow - this.maxRows);
            this.runQuery(true);
        }
    }
    goToNextPage() {
        if (this.maxRows && this.runResult && this.startRow + this.runResult.RowCount < this.runResult.TotalRowCount) {
            this.startRow += this.maxRows;
            this.runQuery(true);
        }
    }
    goToLastPage() {
        if (this.maxRows && this.runResult) {
            const totalPages = Math.ceil(this.runResult.TotalRowCount / this.maxRows);
            this.startRow = (totalPages - 1) * this.maxRows;
            this.runQuery(true);
        }
    }
    static { this.ɵfac = function QueryRunDialogComponent_Factory(t) { return new (t || QueryRunDialogComponent)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: QueryRunDialogComponent, selectors: [["mj-query-run-dialog"]], inputs: { query: "query", parameters: "parameters", isVisible: "isVisible" }, outputs: { isVisibleChange: "isVisibleChange", onClose: "onClose" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "width", "height", "close", 4, "ngIf"], [3, "close", "width", "height"], [2, "display", "flex", "align-items", "center", "gap", "8px"], [1, "fa-solid", "fa-play-circle", 2, "color", "#007bff"], [2, "display", "flex", "flex-direction", "column", "height", "100%", "overflow-y", "auto", "overflow-x", "hidden"], [2, "display", "flex", "align-items", "center", "justify-content", "center", "padding", "40px"], [1, "fa-solid", "fa-spinner", "fa-spin", 2, "font-size", "24px", "color", "#6c757d", "margin-right", "12px"], [2, "color", "#6c757d"], [2, "margin-bottom", "16px", "flex-shrink", "0", 3, "expanded"], [2, "padding", "20px", "background", "#f8f9fa", "border-radius", "6px", "margin-bottom", "16px", "text-align", "center", "color", "#6c757d"], [2, "margin-bottom", "16px", 3, "expandedChange", "expanded"], ["kendoExpansionPanelTitleDirective", ""], [2, "padding", "12px 0"], [2, "display", "flex", "flex-direction", "column", "gap", "12px"], [2, "display", "flex", "align-items", "center", "gap", "12px"], [2, "font-weight", "600", "color", "#495057", "white-space", "nowrap", "min-width", "100px"], [1, "fa-solid", "fa-list-ol", 2, "color", "#6c757d", "margin-right", "6px"], ["placeholder", "All rows", 2, "width", "150px", 3, "ngModelChange", "ngModel", "min", "step"], [2, "font-size", "0.85em", "color", "#6c757d"], [1, "fa-solid", "fa-forward", 2, "color", "#6c757d", "margin-right", "6px"], ["placeholder", "0", 2, "width", "150px", 3, "ngModelChange", "ngModel", "min", "step"], [2, "flex", "1", "display", "flex", "flex-direction", "column", "overflow", "hidden", "min-height", "0", 3, "expanded"], [2, "margin-bottom", "16px", "flex-shrink", "0", 3, "expandedChange", "expanded"], [2, "margin-bottom", "12px", "color", "#6c757d", "font-size", "0.85em"], [1, "fa-solid", "fa-info-circle"], [2, "display", "flex", "flex-direction", "column", "gap", "16px"], [2, "background", "#f8f9fa", "border", "1px solid #dee2e6", "border-radius", "6px", "padding", "16px"], [2, "display", "flex", "align-items", "center", "gap", "8px", "font-weight", "600"], [1, "fa-solid", "fa-sliders", 2, "color", "#6c757d"], [1, "badge", 2, "background", "#17a2b8", "color", "white", "padding", "2px 6px", "border-radius", "10px", "font-size", "0.7em"], [2, "display", "flex", "justify-content", "space-between", "align-items", "flex-start", "margin-bottom", "8px"], [2, "font-weight", "600", "color", "#495057", "display", "flex", "align-items", "center", "gap", "6px"], [1, "fa-solid", "fa-at", 2, "color", "#007bff"], [2, "color", "#dc3545"], [2, "font-size", "0.85em", "color", "#6c757d", "margin-top", "4px"], [2, "display", "flex", "gap", "8px", "align-items", "center"], [1, "badge", 2, "background", "#6c757d", "color", "white", "padding", "2px 6px", "border-radius", "4px", "font-size", "0.75em"], ["title", "Required parameter is empty", 1, "fa-solid", "fa-exclamation-triangle", 2, "color", "#dc3545"], ["placeholder", "Enter number value...", 2, "width", "100%", 3, "ngModel"], ["placeholder", "Enter value (JSON, string, or number)...", 2, "width", "100%", "font-family", "'Courier New', monospace", 3, "ngModel", "rows"], [2, "font-size", "0.8em", "color", "#6c757d", "margin-top", "4px"], ["placeholder", "Enter number value...", 2, "width", "100%", 3, "ngModelChange", "ngModel"], ["placeholder", "Enter value (JSON, string, or number)...", 2, "width", "100%", "font-family", "'Courier New', monospace", 3, "ngModelChange", "ngModel", "rows"], [2, "background", "#e9ecef", "padding", "2px 4px", "border-radius", "3px"], [1, "fa-solid", "fa-table-list", 2, "color", "#6c757d"], [1, "badge", 2, "background", "#6c757d", "color", "white", "padding", "2px 6px", "border-radius", "10px", "font-size", "0.7em"], [2, "flex", "1", "display", "flex", "flex-direction", "column", "overflow", "hidden", "min-height", "0", 3, "expandedChange", "expanded"], [2, "flex", "1", "display", "flex", "flex-direction", "column", "overflow", "hidden", "min-height", "0"], [2, "padding", "20px", "background", "#f8d7da", "border", "1px solid #f5c6cb", "border-radius", "6px", "margin", "12px"], [1, "fa-solid", "fa-table", 2, "color", "#28a745"], [1, "badge", 2, "background", "#dc3545", "color", "white", "padding", "2px 6px", "border-radius", "10px", "font-size", "0.7em"], [2, "font-size", "0.8em", "color", "#6c757d", "font-weight", "normal"], [1, "badge", 2, "background", "#28a745", "color", "white", "padding", "2px 6px", "border-radius", "10px", "font-size", "0.7em"], [2, "display", "flex", "align-items", "center", "justify-content", "center", "height", "200px", "color", "#6c757d"], [2, "display", "flex", "justify-content", "space-between", "align-items", "center", "padding", "12px", "border-bottom", "1px solid #dee2e6"], [2, "display", "flex", "gap", "8px"], ["kendoButton", "", "fillMode", "flat", "title", "Copy to clipboard", 3, "click"], [1, "fa-solid", "fa-copy"], ["kendoButton", "", "fillMode", "flat", "title", "Export to CSV", 3, "click"], [1, "fa-solid", "fa-download"], [1, "results-table-container", 2, "flex", "1", "overflow", "auto", "border", "1px solid #dee2e6", "border-radius", "4px", "min-height", "0"], [1, "results-table", 2, "width", "100%", "border-collapse", "collapse", "font-size", "14px"], [2, "position", "sticky", "top", "0", "background", "#f8f9fa", "z-index", "10"], [2, "padding", "12px 16px", "text-align", "left", "font-weight", "600", "color", "#495057", "border-bottom", "2px solid #dee2e6", "background", "#f8f9fa", "white-space", "nowrap"], [2, "border-bottom", "1px solid #e9ecef", "transition", "background-color 0.2s"], [2, "padding", "40px", "text-align", "center", "color", "#6c757d"], [2, "font-size", "0.9em", "color", "#6c757d"], [2, "display", "flex", "gap", "4px"], ["kendoButton", "", "fillMode", "flat", "size", "small", "title", "First page", 3, "click", "disabled"], [1, "fa-solid", "fa-angles-left"], ["kendoButton", "", "fillMode", "flat", "size", "small", "title", "Previous page", 3, "click", "disabled"], [1, "fa-solid", "fa-angle-left"], ["kendoButton", "", "fillMode", "flat", "size", "small", "title", "Next page", 3, "click", "disabled"], [1, "fa-solid", "fa-angle-right"], ["kendoButton", "", "fillMode", "flat", "size", "small", "title", "Last page", 3, "click", "disabled"], [1, "fa-solid", "fa-angles-right"], [2, "padding", "10px 16px", "color", "#212529", "max-width", "300px", "overflow", "hidden", "text-overflow", "ellipsis", "white-space", "nowrap", 3, "title"], [1, "fa-solid", "fa-table", 2, "font-size", "48px", "margin-bottom", "12px", "opacity", "0.3"], [1, "fa-solid", "fa-inbox", 2, "font-size", "48px", "margin-bottom", "12px"], [2, "color", "#721c24"], [1, "fa-solid", "fa-exclamation-circle"], [2, "margin-top", "8px", "font-family", "'Courier New', monospace", "font-size", "0.9em"], ["kendoButton", "", 3, "click"], [1, "fa-solid", "fa-times"], ["kendoButton", "", 3, "click", "themeColor", "disabled"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "fa-solid", "fa-play"], [1, "fa-solid", "fa-refresh"]], template: function QueryRunDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, QueryRunDialogComponent_kendo_dialog_0_Template, 11, 5, "kendo-dialog", 0);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.isVisible);
        } }, dependencies: [i1.NgIf, i2.NgControlStatus, i2.NgModel, i3.ExpansionPanelComponent, i3.ExpansionPanelTitleDirective, i4.DialogComponent, i4.DialogTitleBarComponent, i4.DialogActionsComponent, i5.TextAreaComponent, i5.NumericTextBoxComponent, i6.ButtonComponent], styles: [".param-value[_ngcontent-%COMP%]   textarea[_ngcontent-%COMP%] {\n    resize: vertical;\n    min-height: 60px;\n}\n\n.loading-state[_ngcontent-%COMP%] {\n    color: #6c757d;\n}\n\n.badge[_ngcontent-%COMP%] {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n}\n\n\n\n.results-table-container[_ngcontent-%COMP%] {\n    background: white;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n    display: flex;\n    flex-direction: column;\n}\n\n.results-table-container[_ngcontent-%COMP%]::-webkit-scrollbar {\n    width: 8px;\n    height: 8px;\n}\n\n.results-table-container[_ngcontent-%COMP%]::-webkit-scrollbar-track {\n    background: #f1f1f1;\n}\n\n.results-table-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb {\n    background: #c1c1c1;\n    border-radius: 4px;\n}\n\n.results-table-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover {\n    background: #a8a8a8;\n}\n\n.results-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover {\n    background-color: #f8f9fa !important;\n}\n\n.results-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:nth-child(even) {\n    background-color: #fafbfc;\n}\n\n.dialog-content[_ngcontent-%COMP%] {\n    overflow-y: auto;\n}\n\n.header-section[_ngcontent-%COMP%] {\n    flex-shrink: 0;\n}\n\n.param-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%] {\n    min-width: 30px;\n    padding: 4px 6px;\n}\n\n\n\n  .k-expander-content-wrapper {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-height: 0;\n    overflow: hidden;\n}\n\n  .k-expander-content {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-height: 0;\n    overflow: hidden;\n}"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(QueryRunDialogComponent, [{
        type: Component,
        args: [{ selector: 'mj-query-run-dialog', template: "<kendo-dialog \n    *ngIf=\"isVisible\"\n    [width]=\"900\"\n    [height]=\"800\"\n    (close)=\"close()\">\n    \n    <kendo-dialog-titlebar>\n        <div style=\"display: flex; align-items: center; gap: 8px;\">\n            <i class=\"fa-solid fa-play-circle\" style=\"color: #007bff;\"></i>\n            Run Query: {{ query?.Name || 'Untitled' }}\n        </div>\n    </kendo-dialog-titlebar>\n    \n    <div style=\"display: flex; flex-direction: column; height: 100%; overflow-y: auto; overflow-x: hidden;\">\n        @if (isLoadingParams) {\n            <div style=\"display: flex; align-items: center; justify-content: center; padding: 40px;\">\n                <i class=\"fa-solid fa-spinner fa-spin\" style=\"font-size: 24px; color: #6c757d; margin-right: 12px;\"></i>\n                <span style=\"color: #6c757d;\">Loading query parameters...</span>\n            </div>\n        } @else {\n            \n            <!-- Query Parameters Section -->\n            @if (parameterPairs.length > 0) {\n                <kendo-expansionpanel \n                    [(expanded)]=\"parametersExpanded\"\n                    style=\"margin-bottom: 16px; flex-shrink: 0;\">\n                    <ng-template kendoExpansionPanelTitleDirective>\n                        <span style=\"display: flex; align-items: center; gap: 8px; font-weight: 600;\">\n                            <i class=\"fa-solid fa-sliders\" style=\"color: #6c757d;\"></i>\n                            Query Parameters\n                            <span class=\"badge\" style=\"background: #17a2b8; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7em;\">\n                                {{ parameterPairs.length }}\n                            </span>\n                        </span>\n                    </ng-template>\n                    \n                    <div style=\"padding: 12px 0;\">\n                        <div style=\"margin-bottom: 12px; color: #6c757d; font-size: 0.85em;\">\n                            <i class=\"fa-solid fa-info-circle\"></i>\n                            Configure parameter values for query execution.\n                        </div>\n                        \n                        <!-- Parameters List -->\n                        <div style=\"display: flex; flex-direction: column; gap: 16px;\">\n                            @for (param of parameterPairs; track param.name) {\n                                <div style=\"background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 16px;\">\n                                    <div style=\"display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px;\">\n                                        <div>\n                                            <label style=\"font-weight: 600; color: #495057; display: flex; align-items: center; gap: 6px;\">\n                                                <i class=\"fa-solid fa-at\" style=\"color: #007bff;\"></i>\n                                                {{ param.name }}\n                                                @if (param.isRequired) {\n                                                    <span style=\"color: #dc3545;\">*</span>\n                                                }\n                                            </label>\n                                            @if (param.description) {\n                                                <div style=\"font-size: 0.85em; color: #6c757d; margin-top: 4px;\">\n                                                    {{ param.description }}\n                                                </div>\n                                            }\n                                        </div>\n                                        <div style=\"display: flex; gap: 8px; align-items: center;\">\n                                            <span class=\"badge\" style=\"background: #6c757d; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.75em;\">\n                                                {{ param.type }}\n                                            </span>\n                                            @if (!isParameterValid(param)) {\n                                                <i class=\"fa-solid fa-exclamation-triangle\" style=\"color: #dc3545;\" title=\"Required parameter is empty\"></i>\n                                            }\n                                        </div>\n                                    </div>\n                                    \n                                    <!-- Parameter Value Input -->\n                                    @if (param.type === 'number') {\n                                        <kendo-numerictextbox\n                                            [(ngModel)]=\"param.value\"\n                                            placeholder=\"Enter number value...\"\n                                            style=\"width: 100%;\">\n                                        </kendo-numerictextbox>\n                                    } @else {\n                                        <kendo-textarea\n                                            [(ngModel)]=\"param.value\"\n                                            [rows]=\"2\"\n                                            placeholder=\"Enter value (JSON, string, or number)...\"\n                                            style=\"width: 100%; font-family: 'Courier New', monospace;\">\n                                        </kendo-textarea>\n                                    }\n                                    \n                                    @if (param.defaultValue) {\n                                        <div style=\"font-size: 0.8em; color: #6c757d; margin-top: 4px;\">\n                                            Default: <code style=\"background: #e9ecef; padding: 2px 4px; border-radius: 3px;\">{{ param.defaultValue }}</code>\n                                        </div>\n                                    }\n                                </div>\n                            }\n                        </div>\n                    </div>\n                </kendo-expansionpanel>\n            } @else {\n                <div style=\"padding: 20px; background: #f8f9fa; border-radius: 6px; margin-bottom: 16px; text-align: center; color: #6c757d;\">\n                    <i class=\"fa-solid fa-info-circle\"></i> This query has no parameters.\n                </div>\n            }\n            \n            <!-- Pagination Settings -->\n            <kendo-expansionpanel \n                [(expanded)]=\"paginationExpanded\"\n                style=\"margin-bottom: 16px;\">\n                <ng-template kendoExpansionPanelTitleDirective>\n                    <span style=\"display: flex; align-items: center; gap: 8px; font-weight: 600;\">\n                        <i class=\"fa-solid fa-table-list\" style=\"color: #6c757d;\"></i>\n                        Pagination Settings\n                        @if (maxRows && maxRows > 0) {\n                            <span class=\"badge\" style=\"background: #6c757d; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7em;\">\n                                {{ maxRows }} rows/page\n                            </span>\n                        }\n                    </span>\n                </ng-template>\n                \n                <div style=\"padding: 12px 0;\">\n                    <div style=\"display: flex; flex-direction: column; gap: 12px;\">\n                        <!-- Max Rows -->\n                        <div style=\"display: flex; align-items: center; gap: 12px;\">\n                            <label style=\"font-weight: 600; color: #495057; white-space: nowrap; min-width: 100px;\">\n                                <i class=\"fa-solid fa-list-ol\" style=\"color: #6c757d; margin-right: 6px;\"></i>\n                                Max Rows:\n                            </label>\n                            <kendo-numerictextbox\n                                [(ngModel)]=\"maxRows\"\n                                [min]=\"1\"\n                                [step]=\"100\"\n                                placeholder=\"All rows\"\n                                style=\"width: 150px;\">\n                            </kendo-numerictextbox>\n                            <span style=\"font-size: 0.85em; color: #6c757d;\">\n                                Leave empty to return all rows\n                            </span>\n                        </div>\n                        <!-- Start Row -->\n                        <div style=\"display: flex; align-items: center; gap: 12px;\">\n                            <label style=\"font-weight: 600; color: #495057; white-space: nowrap; min-width: 100px;\">\n                                <i class=\"fa-solid fa-forward\" style=\"color: #6c757d; margin-right: 6px;\"></i>\n                                Start Row:\n                            </label>\n                            <kendo-numerictextbox\n                                [(ngModel)]=\"startRow\"\n                                [min]=\"0\"\n                                [step]=\"1\"\n                                placeholder=\"0\"\n                                style=\"width: 150px;\">\n                            </kendo-numerictextbox>\n                            <span style=\"font-size: 0.85em; color: #6c757d;\">\n                                0-based offset for pagination\n                            </span>\n                        </div>\n                    </div>\n                </div>\n            </kendo-expansionpanel>\n            \n            <!-- Results Section -->\n            @if (runResult) {\n                <kendo-expansionpanel \n                    [(expanded)]=\"resultsExpanded\"\n                    style=\"flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;\">\n                    <ng-template kendoExpansionPanelTitleDirective>\n                        <span style=\"display: flex; align-items: center; gap: 8px; font-weight: 600;\">\n                            <i class=\"fa-solid fa-table\" style=\"color: #28a745;\"></i>\n                            Query Results\n                            @if (runResult.Success) {\n                                <span class=\"badge\" style=\"background: #28a745; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7em;\">\n                                    {{ runResult.RowCount }} rows\n                                </span>\n                                @if (runResult.TotalRowCount > runResult.RowCount) {\n                                    <span class=\"badge\" style=\"background: #17a2b8; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7em;\">\n                                        of {{ runResult.TotalRowCount }} total\n                                    </span>\n                                }\n                            } @else {\n                                <span class=\"badge\" style=\"background: #dc3545; color: white; padding: 2px 6px; border-radius: 10px; font-size: 0.7em;\">\n                                    Error\n                                </span>\n                            }\n                            @if (runResult.ExecutionTime) {\n                                <span style=\"font-size: 0.8em; color: #6c757d; font-weight: normal;\">\n                                    ({{ runResult.ExecutionTime }}ms)\n                                </span>\n                            }\n                        </span>\n                    </ng-template>\n                    \n                    <div style=\"flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;\">\n                        @if (runResult.Success) {\n                            @if (resultRows.length > 0) {\n                                <!-- Export and Pagination Controls -->\n                                <div style=\"display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid #dee2e6;\">\n                                    <!-- Pagination Info and Controls -->\n                                    <div style=\"display: flex; align-items: center; gap: 12px;\">\n                                        @if (runResult.TotalRowCount > runResult.RowCount || startRow > 0) {\n                                            <span style=\"font-size: 0.9em; color: #6c757d;\">\n                                                Showing rows {{ startRow + 1 }} - {{ startRow + runResult.RowCount }} of {{ runResult.TotalRowCount }}\n                                            </span>\n                                            <div style=\"display: flex; gap: 4px;\">\n                                                <button kendoButton \n                                                        fillMode=\"flat\"\n                                                        size=\"small\"\n                                                        [disabled]=\"startRow === 0\"\n                                                        (click)=\"goToFirstPage()\"\n                                                        title=\"First page\">\n                                                    <i class=\"fa-solid fa-angles-left\"></i>\n                                                </button>\n                                                <button kendoButton \n                                                        fillMode=\"flat\"\n                                                        size=\"small\"\n                                                        [disabled]=\"startRow === 0\"\n                                                        (click)=\"goToPreviousPage()\"\n                                                        title=\"Previous page\">\n                                                    <i class=\"fa-solid fa-angle-left\"></i>\n                                                </button>\n                                                <button kendoButton \n                                                        fillMode=\"flat\"\n                                                        size=\"small\"\n                                                        [disabled]=\"startRow + runResult.RowCount >= runResult.TotalRowCount\"\n                                                        (click)=\"goToNextPage()\"\n                                                        title=\"Next page\">\n                                                    <i class=\"fa-solid fa-angle-right\"></i>\n                                                </button>\n                                                <button kendoButton \n                                                        fillMode=\"flat\"\n                                                        size=\"small\"\n                                                        [disabled]=\"startRow + runResult.RowCount >= runResult.TotalRowCount\"\n                                                        (click)=\"goToLastPage()\"\n                                                        title=\"Last page\">\n                                                    <i class=\"fa-solid fa-angles-right\"></i>\n                                                </button>\n                                            </div>\n                                        }\n                                    </div>\n                                    <!-- Export Buttons -->\n                                    <div style=\"display: flex; gap: 8px;\">\n                                        <button kendoButton \n                                                fillMode=\"flat\"\n                                                (click)=\"copyToClipboard()\"\n                                                title=\"Copy to clipboard\">\n                                            <i class=\"fa-solid fa-copy\"></i> Copy\n                                        </button>\n                                        <button kendoButton \n                                                fillMode=\"flat\"\n                                                (click)=\"exportToCSV()\"\n                                                title=\"Export to CSV\">\n                                            <i class=\"fa-solid fa-download\"></i> Export CSV\n                                        </button>\n                                    </div>\n                                </div>\n                                \n                                <!-- Results Grid -->\n                                <div class=\"results-table-container\" style=\"flex: 1; overflow: auto; border: 1px solid #dee2e6; border-radius: 4px; min-height: 0;\">\n                                    <table class=\"results-table\" style=\"width: 100%; border-collapse: collapse; font-size: 14px;\">\n                                        <thead style=\"position: sticky; top: 0; background: #f8f9fa; z-index: 10;\">\n                                            <tr>\n                                                @for (col of resultColumns; track col.field) {\n                                                    <th style=\"padding: 12px 16px; text-align: left; font-weight: 600; color: #495057; border-bottom: 2px solid #dee2e6; background: #f8f9fa; white-space: nowrap;\">\n                                                        {{ col.title }}\n                                                    </th>\n                                                }\n                                            </tr>\n                                        </thead>\n                                        <tbody>\n                                            @for (row of resultRows; track $index) {\n                                                <tr style=\"border-bottom: 1px solid #e9ecef; transition: background-color 0.2s;\">\n                                                    @for (col of resultColumns; track col.field) {\n                                                        <td style=\"padding: 10px 16px; color: #212529; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\" \n                                                            [title]=\"row[col.field]\">\n                                                            {{ row[col.field] || '' }}\n                                                        </td>\n                                                    }\n                                                </tr>\n                                            }\n                                        </tbody>\n                                    </table>\n                                    @if (resultRows.length === 0) {\n                                        <div style=\"padding: 40px; text-align: center; color: #6c757d;\">\n                                            <i class=\"fa-solid fa-table\" style=\"font-size: 48px; margin-bottom: 12px; opacity: 0.3;\"></i>\n                                            <p>No data in results</p>\n                                        </div>\n                                    }\n                                </div>\n                            } @else {\n                                <div style=\"display: flex; align-items: center; justify-content: center; height: 200px; color: #6c757d;\">\n                                    <i class=\"fa-solid fa-inbox\" style=\"font-size: 48px; margin-bottom: 12px;\"></i>\n                                    <p>No results returned</p>\n                                </div>\n                            }\n                        } @else {\n                            <div style=\"padding: 20px; background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 6px; margin: 12px;\">\n                                <div style=\"color: #721c24;\">\n                                    <i class=\"fa-solid fa-exclamation-circle\"></i>\n                                    <strong>Query execution failed</strong>\n                                </div>\n                                @if (runResult.ErrorMessage) {\n                                    <div style=\"margin-top: 8px; font-family: 'Courier New', monospace; font-size: 0.9em;\">\n                                        {{ runResult.ErrorMessage }}\n                                    </div>\n                                }\n                            </div>\n                        }\n                    </div>\n                </kendo-expansionpanel>\n            }\n        }\n    </div>\n    \n    <kendo-dialog-actions>\n        @if (!runResult) {\n            <button kendoButton (click)=\"close()\">\n                <i class=\"fa-solid fa-times\"></i> Cancel\n            </button>\n            <button kendoButton \n                    [themeColor]=\"'primary'\"\n                    [disabled]=\"isRunning || hasInvalidParameters()\"\n                    (click)=\"runQuery()\">\n                @if (isRunning) {\n                    <i class=\"fa-solid fa-spinner fa-spin\"></i> Running...\n                } @else {\n                    <i class=\"fa-solid fa-play\"></i> Run Query\n                }\n            </button>\n        } @else {\n            <button kendoButton (click)=\"close()\">\n                <i class=\"fa-solid fa-times\"></i> Close\n            </button>\n            <button kendoButton \n                    [themeColor]=\"'primary'\"\n                    [disabled]=\"isRunning\"\n                    (click)=\"runQuery()\">\n                <i class=\"fa-solid fa-refresh\"></i> Run Again\n            </button>\n        }\n    </kendo-dialog-actions>\n</kendo-dialog>", styles: [".param-value textarea {\n    resize: vertical;\n    min-height: 60px;\n}\n\n.loading-state {\n    color: #6c757d;\n}\n\n.badge {\n    display: inline-flex;\n    align-items: center;\n    gap: 4px;\n}\n\n/* Professional Results Table Styling */\n.results-table-container {\n    background: white;\n    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n    display: flex;\n    flex-direction: column;\n}\n\n.results-table-container::-webkit-scrollbar {\n    width: 8px;\n    height: 8px;\n}\n\n.results-table-container::-webkit-scrollbar-track {\n    background: #f1f1f1;\n}\n\n.results-table-container::-webkit-scrollbar-thumb {\n    background: #c1c1c1;\n    border-radius: 4px;\n}\n\n.results-table-container::-webkit-scrollbar-thumb:hover {\n    background: #a8a8a8;\n}\n\n.results-table tbody tr:hover {\n    background-color: #f8f9fa !important;\n}\n\n.results-table tbody tr:nth-child(even) {\n    background-color: #fafbfc;\n}\n\n.dialog-content {\n    overflow-y: auto;\n}\n\n.header-section {\n    flex-shrink: 0;\n}\n\n.param-actions button {\n    min-width: 30px;\n    padding: 4px 6px;\n}\n\n/* Ensure expansion panel content flexes properly */\n::ng-deep .k-expander-content-wrapper {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-height: 0;\n    overflow: hidden;\n}\n\n::ng-deep .k-expander-content {\n    display: flex;\n    flex-direction: column;\n    flex: 1;\n    min-height: 0;\n    overflow: hidden;\n}"] }]
    }], null, { query: [{
            type: Input
        }], parameters: [{
            type: Input
        }], isVisible: [{
            type: Input
        }], isVisibleChange: [{
            type: Output
        }], onClose: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryRunDialogComponent, { className: "QueryRunDialogComponent", filePath: "src/lib/custom/Queries/query-run-dialog.component.ts", lineNumber: 33 }); })();
//# sourceMappingURL=query-run-dialog.component.js.map