import { Component, ElementRef, HostListener, Input, ViewChild, ViewEncapsulation } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { PropertiesService } from '../../../common-property-panel/properties/properties.service';
import { TextBox } from '../../../forms/page/widgets/textbox';
import { WidgetsService } from '../widgets.service';
import { FormBuilderMasterService } from '../../../sculptor/form-builder-master/form-builder-master.service';
import { WidgetDropListComponent } from '../../../sculptor/form-builder-master/canvas/widget-drop-list/widget-drop-list.component';
import * as i0 from "@angular/core";
import * as i1 from "../../../common-property-panel/properties/properties.service";
import * as i2 from "../widgets.service";
import * as i3 from "../../../sculptor/form-builder-master/form-builder-master.service";
import * as i4 from "../../../sculptor/form-builder-master/canvas/widget-drop-list/widget-drop-list.component";
const _c0 = ["inputField"];
function TextBoxComponent_ng_container_0_ng_container_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelement(1, "mat-icon", 21);
    i0.ɵɵelementContainerEnd();
} }
function TextBoxComponent_ng_container_0_div_10_mat_icon_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mat-icon", 28);
} }
function TextBoxComponent_ng_container_0_div_10_mat_icon_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mat-icon", 29);
} }
function TextBoxComponent_ng_container_0_div_10_mat_icon_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mat-icon", 30);
} }
function TextBoxComponent_ng_container_0_div_10_mat_icon_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mat-icon", 31);
} }
function TextBoxComponent_ng_container_0_div_10_mat_icon_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mat-icon", 32);
} }
function TextBoxComponent_ng_container_0_div_10_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 22);
    i0.ɵɵtemplate(1, TextBoxComponent_ng_container_0_div_10_mat_icon_1_Template, 1, 0, "mat-icon", 23);
    i0.ɵɵtemplate(2, TextBoxComponent_ng_container_0_div_10_mat_icon_2_Template, 1, 0, "mat-icon", 24);
    i0.ɵɵtemplate(3, TextBoxComponent_ng_container_0_div_10_mat_icon_3_Template, 1, 0, "mat-icon", 25);
    i0.ɵɵtemplate(4, TextBoxComponent_ng_container_0_div_10_mat_icon_4_Template, 1, 0, "mat-icon", 26);
    i0.ɵɵtemplate(5, TextBoxComponent_ng_container_0_div_10_mat_icon_5_Template, 1, 0, "mat-icon", 27);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngSwitch", ctx_r3.widget.inputType);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "numeric");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "decimal");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "email");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "phone");
} }
function TextBoxComponent_ng_container_0_div_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 33);
    i0.ɵɵelement(1, "mat-icon", 34);
    i0.ɵɵelementEnd();
} }
function TextBoxComponent_ng_container_0_input_12_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "input", 35);
} if (rf & 2) {
    const ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("placeholder", ctx_r5.widget.placeholder ? ctx_r5.widget.placeholder : "Enter your response")("formControlName", ctx_r5.widget.id);
} }
function TextBoxComponent_ng_container_0_textarea_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "textarea", 36);
} if (rf & 2) {
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("placeholder", ctx_r6.widget.placeholder ? ctx_r6.widget.placeholder : "Enter your response")("formControlName", ctx_r6.widget.id);
} }
function TextBoxComponent_ng_container_0_button_14_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 37);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_button_14_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(2); return ctx_r14.onClickEditor(); });
    i0.ɵɵelement(1, "mat-icon", 38);
    i0.ɵɵelementEnd();
} }
function TextBoxComponent_ng_container_0_lib_confirmation_button_22_Template(rf, ctx) { if (rf & 1) {
    const _r17 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "lib-confirmation-button", 39);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_lib_confirmation_button_22_Template_lib_confirmation_button_click_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(2); return ctx_r16.delete(); });
    i0.ɵɵelementEnd();
} }
function TextBoxComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    const _r19 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 1);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_Template_div_click_1_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(); return ctx_r18.onWidgetClick(); });
    i0.ɵɵelementStart(2, "div", 2);
    i0.ɵɵelementStart(3, "div", 3);
    i0.ɵɵelementStart(4, "form", 4);
    i0.ɵɵelementStart(5, "textarea", 5, 6);
    i0.ɵɵlistener("ngModelChange", function TextBoxComponent_ng_container_0_Template_textarea_ngModelChange_5_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r20 = i0.ɵɵnextContext(); return ctx_r20.widget.prompt = $event; })("mousedown", function TextBoxComponent_ng_container_0_Template_textarea_mousedown_5_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r21 = i0.ɵɵnextContext(); return ctx_r21.preventFocus($event); })("focus", function TextBoxComponent_ng_container_0_Template_textarea_focus_5_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r22 = i0.ɵɵnextContext(); return ctx_r22.onFocus($event); })("keydown.enter", function TextBoxComponent_ng_container_0_Template_textarea_keydown_enter_5_listener() { i0.ɵɵrestoreView(_r19); const _r1 = i0.ɵɵreference(6); const ctx_r23 = i0.ɵɵnextContext(); ctx_r23.updateIdentifier(); return _r1.blur(); })("blur", function TextBoxComponent_ng_container_0_Template_textarea_blur_5_listener() { i0.ɵɵrestoreView(_r19); const ctx_r24 = i0.ɵɵnextContext(); return ctx_r24.updateIdentifier(); })("dblclick", function TextBoxComponent_ng_container_0_Template_textarea_dblclick_5_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r25 = i0.ɵɵnextContext(); return ctx_r25.onDoubleClick($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(7, TextBoxComponent_ng_container_0_ng_container_7_Template, 2, 0, "ng-container", 0);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(8, "div", 7);
    i0.ɵɵelementStart(9, "div", 8);
    i0.ɵɵtemplate(10, TextBoxComponent_ng_container_0_div_10_Template, 6, 5, "div", 9);
    i0.ɵɵtemplate(11, TextBoxComponent_ng_container_0_div_11_Template, 2, 0, "div", 10);
    i0.ɵɵtemplate(12, TextBoxComponent_ng_container_0_input_12_Template, 1, 2, "input", 11);
    i0.ɵɵtemplate(13, TextBoxComponent_ng_container_0_textarea_13_Template, 1, 2, "textarea", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(14, TextBoxComponent_ng_container_0_button_14_Template, 2, 0, "button", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(15, "div", 14);
    i0.ɵɵelementStart(16, "button", 15);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_Template_button_click_16_listener() { i0.ɵɵrestoreView(_r19); const ctx_r26 = i0.ɵɵnextContext(); return ctx_r26.copyWidget(ctx_r26.widget); });
    i0.ɵɵelement(17, "mat-icon", 16);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "button", 17);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_Template_button_click_18_listener() { i0.ɵɵrestoreView(_r19); const ctx_r27 = i0.ɵɵnextContext(); return ctx_r27.pasteWidget(); });
    i0.ɵɵelement(19, "mat-icon", 18);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(20, "button", 15);
    i0.ɵɵlistener("click", function TextBoxComponent_ng_container_0_Template_button_click_20_listener() { i0.ɵɵrestoreView(_r19); const ctx_r28 = i0.ɵɵnextContext(); return ctx_r28.confirmbutton(); });
    i0.ɵɵelement(21, "mat-icon", 19);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(22, TextBoxComponent_ng_container_0_lib_confirmation_button_22_Template, 1, 0, "lib-confirmation-button", 20);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵclassProp("selected-widget", ctx_r0.widget.widgetSelect);
    i0.ɵɵproperty("formGroup", ctx_r0.group)("id", ctx_r0.widget.id);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("formGroupName", ctx_r0.widget.id + "_group");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("id", ctx_r0.getTextAreaId())("ngModel", ctx_r0.widget.prompt)("formControlName", ctx_r0.widget.id + "_prompt")("readonly", !ctx_r0.isEditable);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.widget.isHidden);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", ctx_r0.widget.isMultiline ? "text-area" : "form-field-input");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", !ctx_r0.widget.isMultiline);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.widget.isMultiline);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r0.widget.isMultiline);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.widget.isMultiline);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r0.isEditable);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("disabled", ctx_r0.isPasteInProgress);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("ngIf", ctx_r0.showConfirmation);
} }
export class TextBoxComponent {
    // --------------------------------------------
    /**
     * constructor
     *
     * @param _propertiesService
     */
    constructor(_propertiesService, _widgetProperties, _formBuilderMasterService, _widgetDropListComponent) {
        this._propertiesService = _propertiesService;
        this._widgetProperties = _widgetProperties;
        this._formBuilderMasterService = _formBuilderMasterService;
        this._widgetDropListComponent = _widgetDropListComponent;
        // Reset confirmation when hovering over other widgets
        this.showConfirmation = false;
        this.isPasteInProgress = false;
        this.isEditable = false;
        this.previousValue = '';
    }
    // -----------------------------------------------------------------------------------------------------
    // @ Lifecycle hooks start
    // -----------------------------------------------------------------------------------------------------
    /**
     * on init
     */
    ngOnInit() {
    }
    ngAfterViewInit() {
        const textareaElement = document.getElementById(this.getTextAreaId());
        textareaElement.style.height = "20px";
        textareaElement.style.height = `${textareaElement.scrollHeight}px`;
        // const rows = (this.widget.prompt.length / textareaElement.cols) - 1;
        // rows <= 1 ? textareaElement.rows = 1 : textareaElement.rows = rows;
        textareaElement.addEventListener("keyup", e => {
            const element = e.target;
            textareaElement.style.height = "20px";
            textareaElement.style.height = `${element.scrollHeight}px`;
        });
    }
    // -----------------------------------------------------------------------------------------------------
    // @ Lifecycle hooks end
    // -----------------------------------------------------------------------------------------------------
    /**
     * to emit widgetClickEvent to show properties of selected widget
     */
    onWidgetClick() {
        this._propertiesService.widgetClickEvent(this.widget);
    }
    async updateIdentifier() {
        // Clear any existing timeout to debounce the function calls
        if (this.debounceTimeout) {
            clearTimeout(this.debounceTimeout);
        }
        // Set a new timeout
        this.debounceTimeout = setTimeout(async () => {
            try {
                const newIdentifier = this.widget.identifier.replace(/[_0-9]/g, '');
                // Do not clean the prompt by removing digits or replacing characters
                const promptCleaned = this.widget.prompt; // No modifications here
                if (this.widget.prompt !== newIdentifier) {
                    // Directly add a unique identifier without validating
                    if (!this.widget.identifier.includes(promptCleaned)) {
                        await this._widgetDropListComponent.addUniqueIdentifier(this.widget);
                    }
                }
                this.isEditable = false; // Set back to read-only after updating
            }
            catch (error) {
                console.error("Error updating identifier:", error); // Log the error for debugging
            }
        }, 300); // Set the debounce timeout interval to 300ms (adjust as necessary)
    }
    /**    console.log("***save***");
  
     * to emit widgetDeleteEvent to Delete Widget
     */
    delete() {
        this._widgetProperties.widgetDeleteEvent(this.widget);
        this._formBuilderMasterService.triggerLocalstorageFormUpdate();
        this._formBuilderMasterService.triggersetDropViewFormUpdate();
    }
    onClickEditor() {
        this._widgetDropListComponent.toggleEditor(this.widget);
    }
    confirmbutton() {
        this.showConfirmation = !this.showConfirmation;
    }
    onMouseEnter() {
        this.showConfirmation = false;
    }
    copyWidget() {
        this._widgetProperties.widgetCopyEvent(this.widget);
    }
    cutWidget() {
        this._widgetProperties.widgetCutEvent(this.widget);
    }
    pasteWidget() {
        this.isPasteInProgress = true;
        // Call the widget paste event
        this._propertiesService.widgetClickEvent(this.widget);
        this._widgetProperties.widgetPasteEvent();
        // Set a timeout to reset the flag after a certain period
        setTimeout(() => {
            // Reset the flag after a certain period (e.g., 500 milliseconds)
            this.isPasteInProgress = false;
        }, 500); // Adjust the timeout duration as needed
    }
    calculateHeight() {
        const promptLength = this.getPromptLength();
        const lineHeight = 15;
        const minHeight = 10;
        const additionalHeight = Math.ceil(promptLength / 30) * lineHeight;
        const totalHeight = minHeight + additionalHeight;
        return totalHeight;
    }
    getPromptLength() {
        return this.widget.prompt ? this.widget.prompt.length : 0;
    }
    onDoubleClick(event) {
        if (!this.isEditable) {
            this.toggleEditable();
        }
    }
    toggleEditable() {
        this.isEditable = !this.isEditable;
        if (this.isEditable) {
            setTimeout(() => this.inputField.nativeElement.focus(), 0); // Focus the input field when it becomes editable
        }
    }
    // Prevent focus on single click
    preventFocus(event) {
        if (!this.isEditable) {
            event.preventDefault();
        }
    }
    // Handle focus event
    onFocus(event) {
        if (!this.isEditable) {
            event.target.blur();
        }
        this.inputField.nativeElement.select();
    }
    getTextAreaId() {
        const promptId = `prompt-widget.${this.widget.id}`;
        return promptId;
    }
    onModelChange(currentValue) {
        if (this.previousValue !== currentValue) {
            this.previousValue = currentValue;
            this.updateIdentifier(); // Call only if the value has changed
        }
    }
    onEnterKey(inputField) {
        this.onModelChange(inputField.value); // Ensure change detection on enter
        inputField.blur(); // Trigger blur after enter
    }
    onBlur() {
        this.onModelChange(this.widget.prompt); // Check for value changes on blur
    }
}
TextBoxComponent.ɵfac = function TextBoxComponent_Factory(t) { return new (t || TextBoxComponent)(i0.ɵɵdirectiveInject(i1.PropertiesService), i0.ɵɵdirectiveInject(i2.WidgetsService), i0.ɵɵdirectiveInject(i3.FormBuilderMasterService), i0.ɵɵdirectiveInject(i4.WidgetDropListComponent)); };
TextBoxComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TextBoxComponent, selectors: [["widget-textBox"]], viewQuery: function TextBoxComponent_Query(rf, ctx) { if (rf & 1) {
        i0.ɵɵviewQuery(_c0, 5);
    } if (rf & 2) {
        let _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputField = _t.first);
    } }, hostBindings: function TextBoxComponent_HostBindings(rf, ctx) { if (rf & 1) {
        i0.ɵɵlistener("mouseenter", function TextBoxComponent_mouseenter_HostBindingHandler() { return ctx.onMouseEnter(); });
    } }, inputs: { widget: "widget", group: "group" }, decls: 1, vars: 1, consts: [[4, "ngIf"], [1, "text-widget", 3, "formGroup", "id", "click"], [1, "flex", "gap-2", "justify-between", "box-border"], [1, "flex", "gap-2", "items-center", "box-border"], [1, "prompt", "box-border", 3, "formGroupName"], ["matInput", "", "matTooltip", "Double Click to Edit", 1, "prompt-text", "box-border", 3, "id", "ngModel", "formControlName", "readonly", "ngModelChange", "mousedown", "focus", "keydown.enter", "blur", "dblclick"], ["inputField", ""], [3, "ngClass"], [1, "icon-input-container", "flex"], ["class", "icon-parent", 3, "ngSwitch", 4, "ngIf"], ["class", "icon-parent mb-16", 4, "ngIf"], ["readonly", "true", 3, "placeholder", "formControlName", 4, "ngIf"], ["readonly", "true", "rows", "3", 3, "placeholder", "formControlName", 4, "ngIf"], ["class", "find-help", 3, "click", 4, "ngIf"], [1, "tooltip-container"], [1, "clipboard-icon", 3, "click"], ["svgIcon", "axo_sculptor_copy", "matTooltip", "Copy", 1, "h-4", "min-h-4", "w-4", "min-w-4"], [1, "clipboard-icon", 3, "disabled", "click"], ["svgIcon", "axo_sculptor_paste", "matTooltip", "Paste", 1, "h-4", "min-h-4", "w-4", "min-w-4"], ["svgIcon", "axo_sculptor_delete", "matTooltip", "Delete", 1, "h-4", "min-h-4", "w-4", "min-w-4"], [3, "click", 4, "ngIf"], ["svgIcon", "axo_sculptor_close_eye", 1, "h-4", "w-4", "min-w-4", "min-h-4"], [1, "icon-parent", 3, "ngSwitch"], ["svgIcon", "axo_number_color", "class", "field-icon", 4, "ngSwitchCase"], ["svgIcon", "axo_decimal", "class", "field-icon", 4, "ngSwitchCase"], ["svgIcon", "axo_email", "class", "field-icon", 4, "ngSwitchCase"], ["svgIcon", "axo_sculptor_phone", "class", "field-icon ", 4, "ngSwitchCase"], ["svgIcon", "axo_sculptor_text", "class", "field-icon", 4, "ngSwitchDefault"], ["svgIcon", "axo_number_color", 1, "field-icon"], ["svgIcon", "axo_decimal", 1, "field-icon"], ["svgIcon", "axo_email", 1, "field-icon"], ["svgIcon", "axo_sculptor_phone", 1, "field-icon"], ["svgIcon", "axo_sculptor_text", 1, "field-icon"], [1, "icon-parent", "mb-16"], ["svgIcon", "axo_sculptor_multilinetext", 1, ""], ["readonly", "true", 3, "placeholder", "formControlName"], ["readonly", "true", "rows", "3", 3, "placeholder", "formControlName"], [1, "find-help", 3, "click"], ["svgIcon", "axo_sculptor_help-text", "matTooltip", "Help", 1, "h-4", "min-h-4", "w-4", "min-w-4"], [3, "click"]], template: function TextBoxComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, TextBoxComponent_ng_container_0_Template, 23, 18, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.widget);
    } }, styles: ["widget-textBox{width:100%}widget-textBox .text-widget{background:#ffffff;border:1px solid #CED0DD;padding:1rem;border-radius:10px;padding-top:10px;height:fit-content;box-sizing:border-box}widget-textBox .text-widget:hover{background-color:#eaeaea}widget-textBox .text-widget .form-field-input{border-radius:10px}widget-textBox .text-widget .form-field-input input{box-sizing:border-box;width:100%;cursor:pointer;margin-left:5px}widget-textBox .text-widget .field-icon{margin-bottom:18px}widget-textBox .text-widget .prompt-text{color:#000;font-size:14px!important;font-style:normal;font-weight:500;line-height:130%;font-family:Noto Sans,sans-serif;width:96%;resize:none;margin:0;padding:3px 3px 0}widget-textBox .text-widget .text-area{cursor:pointer;border-radius:10px}widget-textBox .text-widget .text-area textarea{height:88px!important;box-sizing:border-box;width:100%;cursor:pointer;margin-left:5px}widget-textBox .text-widget .icon-input-container input::placeholder,widget-textBox .text-widget .icon-input-container textarea::placeholder{font-size:14px;font-weight:400;color:#575757}widget-textBox .text-widget .icon-input-container{margin:.5rem 0 0;border:1px solid #bed0df;border-radius:10px;align-self:flex-end;position:relative;display:flex;flex-flow:row;align-items:center;padding:5px 10px;height:100%;width:100%}widget-textBox .text-widget .icon-parent{height:30px!important;width:30px!important;display:flex!important;flex-wrap:wrap!important;justify-content:center!important;align-items:center!important}widget-textBox .text-widget .mat-icon{height:30px;width:30px}.text-widget div div,.text-widget div div form,.text-widget div div form input{width:100%}.text-widget div div form{line-height:13px!important}.text-widget div div form input{height:16px!important}.text-widget div div form :focus{outline:1px solid #9cbbe9!important;border-radius:4px;background-color:#fff;width:96%}\n"], encapsulation: 2 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TextBoxComponent, [{
        type: Component,
        args: [{ selector: 'widget-textBox', encapsulation: ViewEncapsulation.None, template: "<!-- Text box widget -->\n<ng-container *ngIf=\"widget\">\n  <div [formGroup]=\"group\" class=\"text-widget\" [id]=\"widget.id\" [class.selected-widget]=\"widget.widgetSelect\"\n    (click)=\"onWidgetClick()\">\n    <div class=\"flex gap-2 justify-between box-border\">\n      <div class=\"flex gap-2 items-center box-border\">\n        <form [formGroupName]=\"this.widget.id + '_group'\" class=\"prompt box-border\">\n          <textarea matInput [id]=\"getTextAreaId()\" [(ngModel)]='widget.prompt'\n            [formControlName]=\"widget.id + '_prompt'\" #inputField (mousedown)=\"preventFocus($event)\"\n            (focus)=\"onFocus($event)\" (keydown.enter)=\"updateIdentifier(); inputField.blur()\"\n            (blur)=\"updateIdentifier()\" class=\"prompt-text box-border\" [readonly]=\"!isEditable\" (dblclick)=\"onDoubleClick($event)\"\n            matTooltip=\"Double Click to Edit\"></textarea>\n        </form>\n      </div>\n      <ng-container *ngIf=\"widget.isHidden\">\n        <mat-icon svgIcon=\"axo_sculptor_close_eye\" class=\"h-4 w-4 min-w-4 min-h-4\"></mat-icon>\n      </ng-container>\n\n    </div>\n\n    <div [ngClass]=\"widget.isMultiline ? 'text-area' : 'form-field-input'\">\n      <div class=\"icon-input-container flex\">\n\n        <div *ngIf=\"!widget.isMultiline\" [ngSwitch]=\"widget.inputType\" class=\"icon-parent\">\n          <mat-icon *ngSwitchCase=\"'numeric'\" svgIcon=\"axo_number_color\" class=\"field-icon\"></mat-icon>\n          <mat-icon *ngSwitchCase=\"'decimal'\" svgIcon=\"axo_decimal\" class=\"field-icon\"></mat-icon>\n          <mat-icon *ngSwitchCase=\"'email'\" svgIcon=\"axo_email\" class=\"field-icon\"></mat-icon>\n          <mat-icon *ngSwitchCase=\"'phone'\" svgIcon=\"axo_sculptor_phone\" class=\"field-icon \"></mat-icon>\n          <mat-icon *ngSwitchDefault svgIcon=\"axo_sculptor_text\" class=\"field-icon\"></mat-icon>\n        </div>\n\n        <div *ngIf=\"widget.isMultiline\" class=\"icon-parent mb-16\">\n          <mat-icon svgIcon=\"axo_sculptor_multilinetext\" class=\"\"></mat-icon>\n        </div>\n\n        <input [placeholder]=\"widget.placeholder ? widget.placeholder : 'Enter your response'\" readonly=true\n          [formControlName]=\"widget.id\" *ngIf=\"!widget.isMultiline\" />\n        <textarea [placeholder]=\"widget.placeholder ? widget.placeholder : 'Enter your response'\" readonly=true\n          [formControlName]=\"widget.id\" *ngIf=\"widget.isMultiline\" rows=\"3\"></textarea>\n      </div>\n\n    </div>\n    <button *ngIf=\"!isEditable\" class=\"find-help\" (click)=\"onClickEditor()\"> <mat-icon svgIcon=\"axo_sculptor_help-text\"\n        class=\"h-4 min-h-4 w-4 min-w-4\" matTooltip=\"Help\"></mat-icon></button>\n\n  </div>\n  <div class=\"tooltip-container\">\n    <!-- <button class=\"find-help\" (click)=\"onClickEditor()\"> <mat-icon svgIcon=\"axo_sculptor_help-text\" class=\"h-4 min-h-4 w-4 min-w-4\" matTooltip=\"Help\"></mat-icon></button> -->\n    <!-- <button class=\"clipboard-icon\" (click)=\"cutWidget(widget)\"> <mat-icon svgIcon=\"axo_sculptor_cut\" matTooltip=\"Cut\" class=\"h-4 min-h-4 w-4 min-w-4\"></mat-icon></button> -->\n    <button class=\"clipboard-icon\" (click)=\"copyWidget(widget)\"> <mat-icon svgIcon=\"axo_sculptor_copy\" matTooltip=\"Copy\"\n        class=\"h-4 min-h-4 w-4 min-w-4\"></mat-icon></button>\n    <button class=\"clipboard-icon\" (click)=\"pasteWidget()\" [disabled]=\"isPasteInProgress\"> <mat-icon\n        svgIcon=\"axo_sculptor_paste\" matTooltip=\"Paste\" class=\"h-4 min-h-4 w-4 min-w-4\"></mat-icon></button>\n    <button class=\"clipboard-icon\" (click)=\"confirmbutton()\"><mat-icon svgIcon=\"axo_sculptor_delete\" matTooltip=\"Delete\"\n        class=\"h-4 min-h-4 w-4 min-w-4\"></mat-icon>\n    </button>\n    <lib-confirmation-button *ngIf=\"showConfirmation\" (click)=\"delete()\"> </lib-confirmation-button>\n\n  </div>\n\n</ng-container>", styles: ["widget-textBox{width:100%}widget-textBox .text-widget{background:#ffffff;border:1px solid #CED0DD;padding:1rem;border-radius:10px;padding-top:10px;height:fit-content;box-sizing:border-box}widget-textBox .text-widget:hover{background-color:#eaeaea}widget-textBox .text-widget .form-field-input{border-radius:10px}widget-textBox .text-widget .form-field-input input{box-sizing:border-box;width:100%;cursor:pointer;margin-left:5px}widget-textBox .text-widget .field-icon{margin-bottom:18px}widget-textBox .text-widget .prompt-text{color:#000;font-size:14px!important;font-style:normal;font-weight:500;line-height:130%;font-family:Noto Sans,sans-serif;width:96%;resize:none;margin:0;padding:3px 3px 0}widget-textBox .text-widget .text-area{cursor:pointer;border-radius:10px}widget-textBox .text-widget .text-area textarea{height:88px!important;box-sizing:border-box;width:100%;cursor:pointer;margin-left:5px}widget-textBox .text-widget .icon-input-container input::placeholder,widget-textBox .text-widget .icon-input-container textarea::placeholder{font-size:14px;font-weight:400;color:#575757}widget-textBox .text-widget .icon-input-container{margin:.5rem 0 0;border:1px solid #bed0df;border-radius:10px;align-self:flex-end;position:relative;display:flex;flex-flow:row;align-items:center;padding:5px 10px;height:100%;width:100%}widget-textBox .text-widget .icon-parent{height:30px!important;width:30px!important;display:flex!important;flex-wrap:wrap!important;justify-content:center!important;align-items:center!important}widget-textBox .text-widget .mat-icon{height:30px;width:30px}.text-widget div div,.text-widget div div form,.text-widget div div form input{width:100%}.text-widget div div form{line-height:13px!important}.text-widget div div form input{height:16px!important}.text-widget div div form :focus{outline:1px solid #9cbbe9!important;border-radius:4px;background-color:#fff;width:96%}\n"] }]
    }], function () { return [{ type: i1.PropertiesService }, { type: i2.WidgetsService }, { type: i3.FormBuilderMasterService }, { type: i4.WidgetDropListComponent }]; }, { widget: [{
            type: Input
        }], group: [{
            type: Input
        }], inputField: [{
            type: ViewChild,
            args: ['inputField']
        }], onMouseEnter: [{
            type: HostListener,
            args: ['mouseenter']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 