import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
import { InputsModule } from '@progress/kendo-angular-inputs';
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@progress/kendo-angular-inputs";
import * as i3 from "@progress/kendo-angular-buttons";
function ConditionEditorComponent_button_21_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 17);
    i0.ɵɵlistener("click", function ConditionEditorComponent_button_21_Template_button_click_0_listener() { const cond_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.applyQuickCondition(cond_r2)); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const cond_r2 = ctx.$implicit;
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵproperty("themeColor", ctx_r2.conditionExpression === cond_r2.expression ? "primary" : "base");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", cond_r2.label, " ");
} }
export class ConditionEditorComponent {
    constructor() {
        this.connection = null;
        this.save = new EventEmitter();
        this.cancel = new EventEmitter();
        this.conditionExpression = '';
        this.conditionLabel = '';
        this.connectionLabel = '';
        this.quickConditions = [
            { expression: 'success', label: 'Success' },
            { expression: 'error', label: 'Error' },
            { expression: 'completed', label: 'Completed' },
            { expression: 'failed', label: 'Failed' },
            { expression: 'timeout', label: 'Timeout' },
            { expression: 'true', label: 'Always' },
            { expression: 'false', label: 'Never' }
        ];
    }
    ngOnInit() {
        this.loadConnectionData();
    }
    loadConnectionData() {
        if (this.connection?.condition) {
            this.conditionExpression = this.connection.condition.expression;
            this.conditionLabel = this.connection.condition.label || '';
        }
        // If the connection has a label property (from extended model), use it
        this.connectionLabel = this.connection?.label || '';
    }
    applyQuickCondition(condition) {
        this.conditionExpression = condition.expression;
        this.conditionLabel = condition.label;
    }
    onSave() {
        const condition = {
            expression: this.conditionExpression || 'true',
            label: this.conditionLabel || undefined
        };
        this.save.emit({
            condition,
            label: this.connectionLabel || undefined
        });
    }
    onCancel() {
        this.cancel.emit();
    }
    static { this.ɵfac = function ConditionEditorComponent_Factory(t) { return new (t || ConditionEditorComponent)(); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ConditionEditorComponent, selectors: [["app-condition-editor"]], inputs: { connection: "connection" }, outputs: { save: "save", cancel: "cancel" }, standalone: true, features: [i0.ɵɵStandaloneFeature], decls: 31, vars: 10, consts: [[1, "condition-editor"], [1, "editor-header"], [1, "close-button", 3, "click"], [1, "fa-solid", "fa-times"], [1, "editor-content"], [1, "form-group"], ["placeholder", "e.g., success, error, result > 0", 3, "valueChange", "value"], [1, "help-text"], ["placeholder", "Label to display on the connection", 3, "valueChange", "value"], [1, "quick-conditions"], [1, "condition-buttons"], ["kendoButton", "", 3, "themeColor", "click", 4, "ngFor", "ngForOf"], [1, "connection-label-section"], ["placeholder", "Name for this connection", 3, "valueChange", "value"], [1, "editor-footer"], ["kendoButton", "", 3, "click"], ["kendoButton", "", "themeColor", "primary", 3, "click"], ["kendoButton", "", 3, "click", "themeColor"]], template: function ConditionEditorComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "h3");
            i0.ɵɵtext(3, "Edit Path Condition");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(4, "button", 2);
            i0.ɵɵlistener("click", function ConditionEditorComponent_Template_button_click_4_listener() { return ctx.onCancel(); });
            i0.ɵɵelement(5, "i", 3);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(6, "div", 4)(7, "div", 5)(8, "label");
            i0.ɵɵtext(9, "Condition Expression");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(10, "kendo-textbox", 6);
            i0.ɵɵtwoWayListener("valueChange", function ConditionEditorComponent_Template_kendo_textbox_valueChange_10_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.conditionExpression, $event) || (ctx.conditionExpression = $event); return $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(11, "small", 7);
            i0.ɵɵtext(12, " Enter a boolean expression that will determine when this path is taken ");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(13, "div", 5)(14, "label");
            i0.ɵɵtext(15, "Display Label (Optional)");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(16, "kendo-textbox", 8);
            i0.ɵɵtwoWayListener("valueChange", function ConditionEditorComponent_Template_kendo_textbox_valueChange_16_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.conditionLabel, $event) || (ctx.conditionLabel = $event); return $event; });
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(17, "div", 9)(18, "label");
            i0.ɵɵtext(19, "Quick Conditions:");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(20, "div", 10);
            i0.ɵɵtemplate(21, ConditionEditorComponent_button_21_Template, 2, 2, "button", 11);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(22, "div", 12)(23, "label");
            i0.ɵɵtext(24, "Connection Name (Optional)");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(25, "kendo-textbox", 13);
            i0.ɵɵtwoWayListener("valueChange", function ConditionEditorComponent_Template_kendo_textbox_valueChange_25_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.connectionLabel, $event) || (ctx.connectionLabel = $event); return $event; });
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(26, "div", 14)(27, "button", 15);
            i0.ɵɵlistener("click", function ConditionEditorComponent_Template_button_click_27_listener() { return ctx.onCancel(); });
            i0.ɵɵtext(28, "Cancel");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(29, "button", 16);
            i0.ɵɵlistener("click", function ConditionEditorComponent_Template_button_click_29_listener() { return ctx.onSave(); });
            i0.ɵɵtext(30, "Save");
            i0.ɵɵelementEnd()()();
        } if (rf & 2) {
            i0.ɵɵadvance(10);
            i0.ɵɵstyleProp("width", 100, "%");
            i0.ɵɵtwoWayProperty("value", ctx.conditionExpression);
            i0.ɵɵadvance(6);
            i0.ɵɵstyleProp("width", 100, "%");
            i0.ɵɵtwoWayProperty("value", ctx.conditionLabel);
            i0.ɵɵadvance(5);
            i0.ɵɵproperty("ngForOf", ctx.quickConditions);
            i0.ɵɵadvance(4);
            i0.ɵɵstyleProp("width", 100, "%");
            i0.ɵɵtwoWayProperty("value", ctx.connectionLabel);
        } }, dependencies: [CommonModule, i1.NgForOf, FormsModule, DropDownsModule, InputsModule, i2.TextBoxComponent, ButtonsModule, i3.ButtonComponent], styles: [".condition-editor[_ngcontent-%COMP%] {\n      background: white;\n      border-radius: 8px;\n      box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n      overflow: hidden;\n    }\n    \n    .editor-header[_ngcontent-%COMP%] {\n      display: flex;\n      justify-content: space-between;\n      align-items: center;\n      padding: 15px 20px;\n      background: #f5f5f5;\n      border-bottom: 1px solid #e0e0e0;\n    }\n    \n    .editor-header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%] {\n      margin: 0;\n      font-size: 16px;\n      font-weight: 600;\n      color: #333;\n    }\n    \n    .close-button[_ngcontent-%COMP%] {\n      background: none;\n      border: none;\n      font-size: 18px;\n      color: #666;\n      cursor: pointer;\n      padding: 5px;\n    }\n    \n    .close-button[_ngcontent-%COMP%]:hover {\n      color: #333;\n    }\n    \n    .editor-content[_ngcontent-%COMP%] {\n      padding: 20px;\n    }\n    \n    .form-group[_ngcontent-%COMP%] {\n      margin-bottom: 20px;\n    }\n    \n    .form-group[_ngcontent-%COMP%]   label[_ngcontent-%COMP%] {\n      display: block;\n      margin-bottom: 5px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .help-text[_ngcontent-%COMP%] {\n      display: block;\n      margin-top: 5px;\n      font-size: 12px;\n      color: #999;\n    }\n    \n    .quick-conditions[_ngcontent-%COMP%] {\n      margin: 25px 0;\n      padding: 15px;\n      background: #f9f9f9;\n      border-radius: 4px;\n    }\n    \n    .quick-conditions[_ngcontent-%COMP%]   label[_ngcontent-%COMP%] {\n      display: block;\n      margin-bottom: 10px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .condition-buttons[_ngcontent-%COMP%] {\n      display: flex;\n      flex-wrap: wrap;\n      gap: 8px;\n    }\n    \n    .connection-label-section[_ngcontent-%COMP%] {\n      margin-top: 20px;\n      padding-top: 20px;\n      border-top: 1px solid #e0e0e0;\n    }\n    \n    .connection-label-section[_ngcontent-%COMP%]   label[_ngcontent-%COMP%] {\n      display: block;\n      margin-bottom: 5px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .editor-footer[_ngcontent-%COMP%] {\n      display: flex;\n      justify-content: flex-end;\n      gap: 10px;\n      padding: 15px 20px;\n      background: #f5f5f5;\n      border-top: 1px solid #e0e0e0;\n    }"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConditionEditorComponent, [{
        type: Component,
        args: [{ selector: 'app-condition-editor', standalone: true, imports: [CommonModule, FormsModule, DropDownsModule, InputsModule, ButtonsModule], template: `
    <div class="condition-editor">
      <div class="editor-header">
        <h3>Edit Path Condition</h3>
        <button class="close-button" (click)="onCancel()">
          <i class="fa-solid fa-times"></i>
        </button>
      </div>
      
      <div class="editor-content">
        <div class="form-group">
          <label>Condition Expression</label>
          <kendo-textbox
            [(value)]="conditionExpression"
            placeholder="e.g., success, error, result > 0"
            [style.width.%]="100">
          </kendo-textbox>
          <small class="help-text">
            Enter a boolean expression that will determine when this path is taken
          </small>
        </div>
        
        <div class="form-group">
          <label>Display Label (Optional)</label>
          <kendo-textbox
            [(value)]="conditionLabel"
            placeholder="Label to display on the connection"
            [style.width.%]="100">
          </kendo-textbox>
        </div>
        
        <div class="quick-conditions">
          <label>Quick Conditions:</label>
          <div class="condition-buttons">
            <button 
              kendoButton
              *ngFor="let cond of quickConditions"
              (click)="applyQuickCondition(cond)"
              [themeColor]="conditionExpression === cond.expression ? 'primary' : 'base'">
              {{ cond.label }}
            </button>
          </div>
        </div>
        
        <div class="connection-label-section">
          <label>Connection Name (Optional)</label>
          <kendo-textbox
            [(value)]="connectionLabel"
            placeholder="Name for this connection"
            [style.width.%]="100">
          </kendo-textbox>
        </div>
      </div>
      
      <div class="editor-footer">
        <button kendoButton (click)="onCancel()">Cancel</button>
        <button kendoButton themeColor="primary" (click)="onSave()">Save</button>
      </div>
    </div>
  `, styles: ["\n    .condition-editor {\n      background: white;\n      border-radius: 8px;\n      box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n      overflow: hidden;\n    }\n    \n    .editor-header {\n      display: flex;\n      justify-content: space-between;\n      align-items: center;\n      padding: 15px 20px;\n      background: #f5f5f5;\n      border-bottom: 1px solid #e0e0e0;\n    }\n    \n    .editor-header h3 {\n      margin: 0;\n      font-size: 16px;\n      font-weight: 600;\n      color: #333;\n    }\n    \n    .close-button {\n      background: none;\n      border: none;\n      font-size: 18px;\n      color: #666;\n      cursor: pointer;\n      padding: 5px;\n    }\n    \n    .close-button:hover {\n      color: #333;\n    }\n    \n    .editor-content {\n      padding: 20px;\n    }\n    \n    .form-group {\n      margin-bottom: 20px;\n    }\n    \n    .form-group label {\n      display: block;\n      margin-bottom: 5px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .help-text {\n      display: block;\n      margin-top: 5px;\n      font-size: 12px;\n      color: #999;\n    }\n    \n    .quick-conditions {\n      margin: 25px 0;\n      padding: 15px;\n      background: #f9f9f9;\n      border-radius: 4px;\n    }\n    \n    .quick-conditions label {\n      display: block;\n      margin-bottom: 10px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .condition-buttons {\n      display: flex;\n      flex-wrap: wrap;\n      gap: 8px;\n    }\n    \n    .connection-label-section {\n      margin-top: 20px;\n      padding-top: 20px;\n      border-top: 1px solid #e0e0e0;\n    }\n    \n    .connection-label-section label {\n      display: block;\n      margin-bottom: 5px;\n      font-size: 13px;\n      font-weight: 600;\n      color: #666;\n    }\n    \n    .editor-footer {\n      display: flex;\n      justify-content: flex-end;\n      gap: 10px;\n      padding: 15px 20px;\n      background: #f5f5f5;\n      border-top: 1px solid #e0e0e0;\n    }\n  "] }]
    }], null, { connection: [{
            type: Input
        }], save: [{
            type: Output
        }], cancel: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ConditionEditorComponent, { className: "ConditionEditorComponent", filePath: "src/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/condition-editor/condition-editor.component.ts", lineNumber: 178 }); })();
//# sourceMappingURL=condition-editor.component.js.map