import { Component, HostListener, Input } from '@angular/core';
import { SimpoElementsModule } from './../../elements/index';
import { CommonModule } from '@angular/common';
import { SimpoComponentModule } from '../../components/index';
import { AnimationDirective } from '../../directive/animation-directive';
import { BackgroundDirective } from '../../directive/background-directive';
import { ContentFitDirective } from '../../directive/content-fit-directive';
import { BannerContentFitDirective } from '../../directive/banner-content-fit-directive';
import { BorderDirective } from '../../directive/border-directive';
import { ButtonDirectiveDirective } from '../../directive/button-directive.directive';
import { ColumnDirectiveDirective } from '../../directive/column-directive.directive';
import { ContainerFitDirective } from '../../directive/container-fir.directive';
import { simpoConetenAlignmentDirective } from '../../directive/content-alignment-directive';
import { CornerDirective } from '../../directive/corner-directive';
import { SimpoFooterLayoutDirective } from '../../directive/footer-layout-directive';
import { HoverDirective } from '../../directive/hover-element-directive';
import { ImageDirectiveDirective } from '../../directive/image-directive.directive';
import { OverlayDirective } from '../../directive/overlay-directive';
import { PositionLayoutDirectiveDirective } from '../../directive/position-layout-directive.directive';
import { TextBackgroundDirectiveDirective } from '../../directive/text-background-directive.directive';
import BaseSection from '../BaseSection';
import { ContentTitleDirective } from '../../directive/content-title-spacing.directive';
import { ObjectPositionDirective } from '../../directive/image-position.directive';
import { SimpoContainerAligment } from '../../directive/container-alignment.directive';
import { MatIcon } from '@angular/material/icon';
import { SanitizeHtmlPipe } from '../../services/sanitizeHtml';
import { SpacingHorizontalDirective } from '../../directive/spacing-horizontal.directive';
import { SvgDividerComponent } from '../../elements/svg-divider/svg-divider.component';
import { TextEditorComponent } from '../../elements/text-editor/text-editor.component';
import { ImageEditorDirective } from '../../directive/image-editor.directive';
import * as i0 from "@angular/core";
import * as i1 from "./../../services/events.service";
import * as i2 from "../../elements/svg-divider/svg-divider.component";
import * as i3 from "@angular/common";
import * as i4 from "../../components/hover-elements/hover-elements.component";
import * as i5 from "../../components/delete-hover-element/delete-hover-element.component";
export class FaqSectionComponent extends BaseSection {
    constructor(_eventService) {
        super();
        this._eventService = _eventService;
        this.unCollapsedList = [];
        this.screenWidth = 0;
        this.getScreenSize();
    }
    ngOnInit() {
        this.content = this.data?.content;
        this.style = this.data?.styles;
        this.deleteSelected = this.delete;
    }
    get headingSpace() {
        return this.style?.layout.headingSpacing;
    }
    get stylesLayout() {
        return { ...this.style?.layout };
    }
    toggleContent(idx) {
        // this.unCollapsedList.push(idx);
        if (this.unCollapsedList.includes(idx)) {
            this.unCollapsedList = this.unCollapsedList.filter((index) => idx != index);
        }
        else {
            this.unCollapsedList = [];
            this.unCollapsedList.push(idx);
        }
    }
    editSection() {
        this._eventService.toggleEditorEvent.emit(false);
        setTimeout(() => {
            this._eventService.editSection.emit({ data: this.data });
        }, 100);
    }
    getScreenSize() {
        if (typeof window !== 'undefined') {
            this.screenWidth = window.innerWidth;
        }
    }
    getLayout() {
        if (this.style?.layout?.align == 'left')
            return 'justify-content-start';
        if (this.style?.layout?.align == 'center')
            return 'justify-content-center';
        if (this.style?.layout?.align == 'right')
            return 'justify-content-end';
        return 'justify-content-center';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FaqSectionComponent, deps: [{ token: i1.EventsService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FaqSectionComponent, isStandalone: true, selector: "simpo-faq-section", inputs: { data: "data", index: "index", edit: "edit", delete: "delete", customClass: "customClass", nextComponentColor: "nextComponentColor" }, host: { listeners: { "window: resize": "getScreenSize($event)" } }, usesInheritance: true, ngImport: i0, template: "<section [id]=\"data?.id\" [simpoBackground]=\"style?.background\" class=\"total-container\" simpoHover\r\n  (hovering)=\"showEditTabs($event)\" [attr.style]=\"customClass\">\r\n  <div class=\"col-xxl-8 py-5 w-100\" #mainContainer [id]=\"data?.id\" [simpoOverlay]=\"style?.background\"\r\n    [spacingHorizontal]=\"stylesLayout\" [simpoBorder]=\"style?.border\" [simpoAnimation]=\"style?.animation\">\r\n\r\n    <div [simpoPositionLayoutDirective]=\"style?.positionLayout\" class=\"row\" [id]=\"data?.id\"\r\n      [simpoLayout]=\"style?.layout\" [simpoContainerAlignment]=\"stylesLayout\" [class]=\"getLayout()\">\r\n      <div class=\"container-fluid flex-col cursor-pointer mx-0\" [class.col-lg-9]=\"!content?.image?.showImage\" [class.col-md-9]=\"!content?.image?.showImage\" [class.col-lg-6]=\"content?.image?.showImage\" [class.col-md-6]=\"content?.image?.showImage\">\r\n        <div *ngFor=\"let text of data?.content?.inputText; let i = index\" class=\"w-100\" [simpoContentTitleSpace]=\"headingSpace\">\r\n          <simpo-text-editor [(value)]=\"text.value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"i\" [isRTE]=\"text.isRTE\"></simpo-text-editor>\r\n        </div>\r\n        <div *ngFor=\"let itemData of content?.listItem?.data; let i = index\" class=\"data data-1 w-100 cursor-pointer\"\r\n          [ngStyle]=\"\r\n    unCollapsedList.includes(i) && data?.styles?.background?.accentBackgroundType == 'Gradient'\r\n      ? { background: 'linear-gradient(90deg, ' + data?.styles?.background?.accentColor + ', ' + data?.styles?.background?.secondaryAccentColor + ')' }\r\n      :     unCollapsedList.includes(i) && data?.styles?.background?.accentBackgroundType == 'Solid' ?\r\n{ background : data?.styles?.background?.accentColor} : {}\r\n  \">\r\n          <div style=\"display: flex;align-items: center;justify-content: space-between; cursor: pointer;\"\r\n            class=\"question\">\r\n            <p class=\"heading-medium  position-relative content-side mb-0 text-start cursor-pointer\"\r\n              data-toggle=\"collapse\" [ngClass]=\"{'fw-600':unCollapsedList.includes(i)}\" (click)=\"toggleContent(i)\">\r\n              <!-- <span style=\"display: block;\" > -->\r\n              <simpo-text-editor [(value)]=\"itemData.inputText[0].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"0\" [itemIndex]=\"i\" [isRTE]=\"itemData.inputText[0]?.isRTE\"></simpo-text-editor>\r\n              <!-- </span> -->\r\n            </p>\r\n            <mat-icon *ngIf=\"unCollapsedList.includes(i)\"\r\n              [ngStyle]=\"{'left' : style?.layout?.align == 'right' ? 0 : '', 'right' : style?.layout?.align !== 'right' ? 0 : ''}\"\r\n              (click)=\"toggleContent(i)\">close</mat-icon>\r\n            <mat-icon *ngIf=\"!unCollapsedList.includes(i)\"\r\n              [ngStyle]=\"{'left' : style?.layout?.align == 'right' ? 0 : '', 'right' : style?.layout?.align !== 'right' ? 0 : ''}\"\r\n              (click)=\"toggleContent(i)\">add</mat-icon>\r\n          </div>\r\n          <div class=\"body-large desc multi-collapse text-start cursor-pointer\"\r\n            [ngClass]=\"{'collapse': !unCollapsedList.includes(i)}\">\r\n            <simpo-text-editor [(value)]=\"itemData.inputText[1].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"1\" [itemIndex]=\"i\" [isRTE]=\"itemData.inputText[1]?.isRTE\"></simpo-text-editor>\r\n          </div>\r\n        </div>\r\n      </div>\r\n      <div class=\"col-10 col-sm-6 col-md-6 col-lg-6 d-flex align-items-center\" *ngIf=\"content?.image?.showImage\">\r\n        <img loading=\"lazy\" [src]=\"content?.image?.url\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\"\r\n          [simpoObjectPosition]=\"content?.image?.position\" [simpoCorner]=\"style?.corners\"\r\n          [class]=\"data?.id+(content?.image?.id || '')\" class=\"d-block mx-lg-auto img-fluid\"\r\n          [alt]=\"content?.image?.altText\" loading=\"lazy\" [appImageEditor]=\"edit || false\" [imageData]=\"content?.image\"\r\n          [sectionId]=\"data?.id\" class=\"h-100 w-100\" />\r\n      </div>\r\n    </div>\r\n  </div>\r\n\r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\"\r\n      [color]=\"nextComponentColor?.color\"></simpo-svg-divider>\r\n  </ng-container>\r\n  <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n    <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n  </div>\r\n  <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n    <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n  </div>\r\n</section>", styles: [".mb-2{margin-bottom:2.5rem!important}mat-icon{font-family:Material Icons!important}.data{gap:1rem;padding-top:.5rem;padding-bottom:.5rem;box-shadow:#11182733 0 -1px inset;cursor:pointer;width:100%}.flex-col{display:block!important}.hover_effect{position:unset;width:100%;top:0;left:0;height:100%}.total-container{height:auto;position:relative}.heading-large{margin-top:20px}.question p{width:95%}.question mat-icon{width:5%}@media only screen and (max-width: 475px){.row{display:flex;flex-direction:column-reverse}.col-10{width:100%!important}.question p{width:90%}.question mat-icon{width:10%}}.float-end{position:absolute;top:0}@media only screen and (min-width: 500px){.heading-medium{font-size:20px}}@media screen and (max-width: 500px){.heading-medium{font-size:16px}.desc{font-size:14px}}.w-60{width:60%}.data-1{box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px;border-radius:10px;text-align:center;padding-left:1rem;padding-right:1rem;margin-bottom:1rem;cursor:pointer}.fw-600{font-weight:600}.cursor-pointer{cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: SimpoElementsModule }, { kind: "component", type: i2.SvgDividerComponent, selector: "simpo-svg-divider", inputs: ["dividerType", "color"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: ContentFitDirective, selector: "[simpoLayout]", inputs: ["simpoLayout"] }, { kind: "ngmodule", type: SimpoComponentModule }, { kind: "component", type: i4.HoverElementsComponent, selector: "simpo-hover-elements", inputs: ["data", "index", "editOptions", "isMerged", "isEcommerce"], outputs: ["edit"] }, { kind: "component", type: i5.DeleteHoverElementComponent, selector: "simpo-delete-hover-element", inputs: ["index", "data"], outputs: ["edit"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: TextEditorComponent, selector: "simpo-text-editor", inputs: ["value", "editable", "isRTE", "sectionId", "label", "type", "inputTextIndex", "itemIndex"], outputs: ["valueChange"] }, { kind: "directive", type: 
                //directive
                AnimationDirective, selector: "[simpoAnimation]", inputs: ["simpoAnimation"] }, { kind: "directive", type: BackgroundDirective, selector: "[simpoBackground]", inputs: ["simpoBackground", "scrollValue"] }, { kind: "directive", type: BorderDirective, selector: "[simpoBorder]", inputs: ["simpoBorder"] }, { kind: "directive", type: CornerDirective, selector: "[simpoCorner]", inputs: ["simpoCorner"] }, { kind: "directive", type: HoverDirective, selector: "[simpoHover]", outputs: ["hovering"] }, { kind: "directive", type: ImageDirectiveDirective, selector: "[simpoImageDirective]", inputs: ["simpoImageDirective"] }, { kind: "directive", type: OverlayDirective, selector: "[simpoOverlay]", inputs: ["simpoOverlay"] }, { kind: "directive", type: PositionLayoutDirectiveDirective, selector: "[simpoPositionLayoutDirective]", inputs: ["simpoPositionLayoutDirective"] }, { kind: "directive", type: ContentTitleDirective, selector: "[simpoContentTitleSpace]", inputs: ["simpoContentTitleSpace"] }, { kind: "directive", type: ObjectPositionDirective, selector: "[simpoObjectPosition]", inputs: ["simpoObjectPosition"] }, { kind: "directive", type: SimpoContainerAligment, selector: "[simpoContainerAlignment]", inputs: ["simpoContainerAlignment"] }, { kind: "directive", type: SpacingHorizontalDirective, selector: "[spacingHorizontal]", inputs: ["spacingHorizontal", "isHeader"] }, { kind: "directive", type: ImageEditorDirective, selector: "[appImageEditor]", inputs: ["appImageEditor", "imageData", "sectionId", "showIcon", "iconData", "itemIndex"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FaqSectionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'simpo-faq-section', standalone: true, imports: [
                        SimpoElementsModule,
                        CommonModule,
                        ContentFitDirective,
                        SimpoComponentModule,
                        MatIcon,
                        TextEditorComponent,
                        //directive
                        AnimationDirective,
                        BackgroundDirective,
                        BannerContentFitDirective,
                        BorderDirective,
                        ButtonDirectiveDirective,
                        ColumnDirectiveDirective,
                        ContainerFitDirective,
                        simpoConetenAlignmentDirective,
                        ContentFitDirective,
                        CornerDirective,
                        SimpoFooterLayoutDirective,
                        HoverDirective,
                        ImageDirectiveDirective,
                        OverlayDirective,
                        PositionLayoutDirectiveDirective,
                        TextBackgroundDirectiveDirective,
                        ContentTitleDirective,
                        ObjectPositionDirective,
                        SimpoContainerAligment,
                        SanitizeHtmlPipe,
                        SpacingHorizontalDirective,
                        SvgDividerComponent,
                        ImageEditorDirective
                    ], template: "<section [id]=\"data?.id\" [simpoBackground]=\"style?.background\" class=\"total-container\" simpoHover\r\n  (hovering)=\"showEditTabs($event)\" [attr.style]=\"customClass\">\r\n  <div class=\"col-xxl-8 py-5 w-100\" #mainContainer [id]=\"data?.id\" [simpoOverlay]=\"style?.background\"\r\n    [spacingHorizontal]=\"stylesLayout\" [simpoBorder]=\"style?.border\" [simpoAnimation]=\"style?.animation\">\r\n\r\n    <div [simpoPositionLayoutDirective]=\"style?.positionLayout\" class=\"row\" [id]=\"data?.id\"\r\n      [simpoLayout]=\"style?.layout\" [simpoContainerAlignment]=\"stylesLayout\" [class]=\"getLayout()\">\r\n      <div class=\"container-fluid flex-col cursor-pointer mx-0\" [class.col-lg-9]=\"!content?.image?.showImage\" [class.col-md-9]=\"!content?.image?.showImage\" [class.col-lg-6]=\"content?.image?.showImage\" [class.col-md-6]=\"content?.image?.showImage\">\r\n        <div *ngFor=\"let text of data?.content?.inputText; let i = index\" class=\"w-100\" [simpoContentTitleSpace]=\"headingSpace\">\r\n          <simpo-text-editor [(value)]=\"text.value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"i\" [isRTE]=\"text.isRTE\"></simpo-text-editor>\r\n        </div>\r\n        <div *ngFor=\"let itemData of content?.listItem?.data; let i = index\" class=\"data data-1 w-100 cursor-pointer\"\r\n          [ngStyle]=\"\r\n    unCollapsedList.includes(i) && data?.styles?.background?.accentBackgroundType == 'Gradient'\r\n      ? { background: 'linear-gradient(90deg, ' + data?.styles?.background?.accentColor + ', ' + data?.styles?.background?.secondaryAccentColor + ')' }\r\n      :     unCollapsedList.includes(i) && data?.styles?.background?.accentBackgroundType == 'Solid' ?\r\n{ background : data?.styles?.background?.accentColor} : {}\r\n  \">\r\n          <div style=\"display: flex;align-items: center;justify-content: space-between; cursor: pointer;\"\r\n            class=\"question\">\r\n            <p class=\"heading-medium  position-relative content-side mb-0 text-start cursor-pointer\"\r\n              data-toggle=\"collapse\" [ngClass]=\"{'fw-600':unCollapsedList.includes(i)}\" (click)=\"toggleContent(i)\">\r\n              <!-- <span style=\"display: block;\" > -->\r\n              <simpo-text-editor [(value)]=\"itemData.inputText[0].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"0\" [itemIndex]=\"i\" [isRTE]=\"itemData.inputText[0]?.isRTE\"></simpo-text-editor>\r\n              <!-- </span> -->\r\n            </p>\r\n            <mat-icon *ngIf=\"unCollapsedList.includes(i)\"\r\n              [ngStyle]=\"{'left' : style?.layout?.align == 'right' ? 0 : '', 'right' : style?.layout?.align !== 'right' ? 0 : ''}\"\r\n              (click)=\"toggleContent(i)\">close</mat-icon>\r\n            <mat-icon *ngIf=\"!unCollapsedList.includes(i)\"\r\n              [ngStyle]=\"{'left' : style?.layout?.align == 'right' ? 0 : '', 'right' : style?.layout?.align !== 'right' ? 0 : ''}\"\r\n              (click)=\"toggleContent(i)\">add</mat-icon>\r\n          </div>\r\n          <div class=\"body-large desc multi-collapse text-start cursor-pointer\"\r\n            [ngClass]=\"{'collapse': !unCollapsedList.includes(i)}\">\r\n            <simpo-text-editor [(value)]=\"itemData.inputText[1].value\" [editable]=\"edit || false\" [sectionId]=\"data?.id\" [inputTextIndex]=\"1\" [itemIndex]=\"i\" [isRTE]=\"itemData.inputText[1]?.isRTE\"></simpo-text-editor>\r\n          </div>\r\n        </div>\r\n      </div>\r\n      <div class=\"col-10 col-sm-6 col-md-6 col-lg-6 d-flex align-items-center\" *ngIf=\"content?.image?.showImage\">\r\n        <img loading=\"lazy\" [src]=\"content?.image?.url\" [simpoImageDirective]=\"style?.image\" [id]=\"data?.id\"\r\n          [simpoObjectPosition]=\"content?.image?.position\" [simpoCorner]=\"style?.corners\"\r\n          [class]=\"data?.id+(content?.image?.id || '')\" class=\"d-block mx-lg-auto img-fluid\"\r\n          [alt]=\"content?.image?.altText\" loading=\"lazy\" [appImageEditor]=\"edit || false\" [imageData]=\"content?.image\"\r\n          [sectionId]=\"data?.id\" class=\"h-100 w-100\" />\r\n      </div>\r\n    </div>\r\n  </div>\r\n\r\n  <ng-container *ngIf=\"style?.devider?.display\">\r\n    <simpo-svg-divider [dividerType]=\"style?.devider?.deviderType\"\r\n      [color]=\"nextComponentColor?.color\"></simpo-svg-divider>\r\n  </ng-container>\r\n  <div [ngClass]=\"{'hover_effect': edit}\" *ngIf=\"showEditors\">\r\n    <simpo-hover-elements [data]=\"data\" [index]=\"index\" [editOptions]=\"edit\"></simpo-hover-elements>\r\n  </div>\r\n  <div *ngIf=\"showDelete\" [ngClass]=\"{'hover_effect': delete}\">\r\n    <simpo-delete-hover-element [data]=\"data\" [index]=\"index\"></simpo-delete-hover-element>\r\n  </div>\r\n</section>", styles: [".mb-2{margin-bottom:2.5rem!important}mat-icon{font-family:Material Icons!important}.data{gap:1rem;padding-top:.5rem;padding-bottom:.5rem;box-shadow:#11182733 0 -1px inset;cursor:pointer;width:100%}.flex-col{display:block!important}.hover_effect{position:unset;width:100%;top:0;left:0;height:100%}.total-container{height:auto;position:relative}.heading-large{margin-top:20px}.question p{width:95%}.question mat-icon{width:5%}@media only screen and (max-width: 475px){.row{display:flex;flex-direction:column-reverse}.col-10{width:100%!important}.question p{width:90%}.question mat-icon{width:10%}}.float-end{position:absolute;top:0}@media only screen and (min-width: 500px){.heading-medium{font-size:20px}}@media screen and (max-width: 500px){.heading-medium{font-size:16px}.desc{font-size:14px}}.w-60{width:60%}.data-1{box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px;border-radius:10px;text-align:center;padding-left:1rem;padding-right:1rem;margin-bottom:1rem;cursor:pointer}.fw-600{font-weight:600}.cursor-pointer{cursor:pointer}\n"] }]
        }], ctorParameters: () => [{ type: i1.EventsService }], propDecorators: { data: [{
                type: Input
            }], index: [{
                type: Input
            }], edit: [{
                type: Input
            }], delete: [{
                type: Input
            }], customClass: [{
                type: Input
            }], nextComponentColor: [{
                type: Input
            }], getScreenSize: [{
                type: HostListener,
                args: ["window: resize", ["$event"]]
            }] } });
//# sourceMappingURL=data:application/json;base64, 