import * as i0 from '@angular/core';
import { EventEmitter, Component, ContentChildren, forwardRef, HostBinding, Output, Input, NgModule } from '@angular/core';
import * as i3 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from '@mintplayer/ng-bootstrap/no-noscript';
import { BsNoNoscriptModule } from '@mintplayer/ng-bootstrap/no-noscript';
import { BehaviorSubject, combineLatest, map } from 'rxjs';
import { SlideUpDownAnimation } from '@mintplayer/ng-animations';

class BsAccordionTabComponent {
    constructor(accordion) {
        this.accordionItemClass = true;
        this.dBlock = true;
        this.noBorder = false;
        //#region IsActive
        this.isActiveChange = new EventEmitter();
        this._isActive = false;
        this.accordion = accordion;
        this.accordionTabId$ = new BehaviorSubject(++this.accordion.accordionTabCounter);
        this.accordionTabName$ = combineLatest([this.accordion.accordionName$, this.accordionTabId$])
            .pipe(map(([accordionName, accordionTabId]) => `${accordionName}-${accordionTabId}`));
    }
    get isActive() {
        return this._isActive;
    }
    set isActive(value) {
        if (this._isActive !== value) {
            this._isActive = value;
            if (this._isActive) {
                this.accordion.tabPages.filter((tab) => {
                    return tab !== this;
                }).forEach((tab) => {
                    tab.isActive = false;
                });
            }
            else {
                this.childAccordions.forEach((accordion) => {
                    accordion.tabPages.forEach((tab) => {
                        tab.isActive = false;
                    });
                });
            }
            this.isActiveChange.emit(value);
        }
    }
}
BsAccordionTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionTabComponent, deps: [{ token: BsAccordionComponent }], target: i0.ɵɵFactoryTarget.Component });
BsAccordionTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsAccordionTabComponent, selector: "bs-accordion-tab", inputs: { isActive: "isActive" }, outputs: { isActiveChange: "isActiveChange" }, host: { properties: { "class.accordion-item": "this.accordionItemClass", "class.d-block": "this.dBlock", "class.border-0": "this.noBorder" } }, queries: [{ propertyName: "childAccordions", predicate: i0.forwardRef(function () { return BsAccordionComponent; }) }], ngImport: i0, template: "<div [class.border-0]=\"false\" [@.disabled]=\"accordion.disableAnimations\" bsNoNoscript>\n\n    <input type=\"radio\" class=\"d-none\" [name]=\"accordion.accordionName$ | async\" [id]=\"accordionTabName$ | async\">\n    <ng-content select=\"bs-accordion-tab-header\"></ng-content>\n    <div class=\"accordion-collapse collapse show overflow-hidden\" [@slideUpDown]=\"isActive\">\n        <div class=\"accordion-body p-0\">\n            <ng-content></ng-content>\n        </div>\n    </div>\n</div>", styles: [".card,.card-header,.card-block{border-radius:0}.card{margin-bottom:-1px}:host ::ng-deep .noscript>input[type=radio]:checked+bs-accordion-tab-header>h2>label{background-color:#e7f1ff}:host ::ng-deep .noscript>input[type=radio]:checked+bs-accordion-tab-header>h2>label:after{transform:var(--bs-accordion-btn-icon-transform)}:host ::ng-deep .noscript>input[type=radio]:checked~.accordion-collapse{height:auto!important}\n"], dependencies: [{ kind: "directive", type: i2.BsNoNoscriptDirective, selector: "[bsNoNoscript]" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], animations: [SlideUpDownAnimation] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionTabComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-accordion-tab', animations: [SlideUpDownAnimation], template: "<div [class.border-0]=\"false\" [@.disabled]=\"accordion.disableAnimations\" bsNoNoscript>\n\n    <input type=\"radio\" class=\"d-none\" [name]=\"accordion.accordionName$ | async\" [id]=\"accordionTabName$ | async\">\n    <ng-content select=\"bs-accordion-tab-header\"></ng-content>\n    <div class=\"accordion-collapse collapse show overflow-hidden\" [@slideUpDown]=\"isActive\">\n        <div class=\"accordion-body p-0\">\n            <ng-content></ng-content>\n        </div>\n    </div>\n</div>", styles: [".card,.card-header,.card-block{border-radius:0}.card{margin-bottom:-1px}:host ::ng-deep .noscript>input[type=radio]:checked+bs-accordion-tab-header>h2>label{background-color:#e7f1ff}:host ::ng-deep .noscript>input[type=radio]:checked+bs-accordion-tab-header>h2>label:after{transform:var(--bs-accordion-btn-icon-transform)}:host ::ng-deep .noscript>input[type=radio]:checked~.accordion-collapse{height:auto!important}\n"] }]
        }], ctorParameters: function () { return [{ type: BsAccordionComponent }]; }, propDecorators: { childAccordions: [{
                type: ContentChildren,
                args: [forwardRef(() => BsAccordionComponent)]
            }], accordionItemClass: [{
                type: HostBinding,
                args: ['class.accordion-item']
            }], dBlock: [{
                type: HostBinding,
                args: ['class.d-block']
            }], noBorder: [{
                type: HostBinding,
                args: ['class.border-0']
            }], isActiveChange: [{
                type: Output
            }], isActive: [{
                type: Input
            }] } });

class BsAccordionComponent {
    constructor() {
        this.disableAnimations = false;
        this.highlightActiveTab = false;
        this.accordionTabCounter = 0;
        this.accordionId$ = new BehaviorSubject(++BsAccordionComponent.accordionCounter);
        this.accordionName$ = this.accordionId$.pipe(map((id) => `bs-accordion-${id}`));
    }
}
BsAccordionComponent.accordionCounter = 0;
BsAccordionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
BsAccordionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsAccordionComponent, selector: "bs-accordion", inputs: { highlightActiveTab: "highlightActiveTab" }, queries: [{ propertyName: "tabPages", predicate: i0.forwardRef(function () { return BsAccordionTabComponent; }) }], ngImport: i0, template: "<div class=\"accordion\">\n    <ng-content></ng-content>\n</div>", styles: [":host ::ng-deep .accordion{--bs-accordion-color: #212529;--bs-accordion-bg: #fff;--bs-accordion-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out, border-radius .15s ease;--bs-accordion-border-color: var(--bs-border-color);--bs-accordion-border-width: 1px;--bs-accordion-border-radius: .375rem;--bs-accordion-inner-border-radius:calc(.375rem - 1px);--bs-accordion-btn-padding-x: 1.25rem;--bs-accordion-btn-padding-y: 1rem;--bs-accordion-btn-color: #212529;--bs-accordion-btn-bg: var(--bs-accordion-bg);--bs-accordion-btn-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");--bs-accordion-btn-icon-width: 1.25rem;--bs-accordion-btn-icon-transform: rotate(-180deg);--bs-accordion-btn-icon-transition: transform .2s ease-in-out;--bs-accordion-btn-active-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");--bs-accordion-btn-focus-border-color: #86b7fe;--bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);--bs-accordion-body-padding-x: 1.25rem;--bs-accordion-body-padding-y: 1rem;--bs-accordion-active-color: #0c63e4;--bs-accordion-active-bg: #e7f1ff}:host ::ng-deep .accordion-button{position:relative;display:flex;align-items:center;width:100%;padding:var(--bs-accordion-btn-padding-y) var(--bs-accordion-btn-padding-x);font-size:1rem;color:var(--bs-accordion-btn-color);text-align:left;background-color:var(--bs-accordion-btn-bg);border:0;border-radius:0;overflow-anchor:none;transition:var(--bs-accordion-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .accordion-button{transition:none}}:host ::ng-deep .accordion-button:not(.collapsed){color:var(--bs-accordion-active-color);background-color:var(--bs-accordion-active-bg);box-shadow:inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color)}:host ::ng-deep .accordion-button:not(.collapsed):after{background-image:var(--bs-accordion-btn-active-icon);transform:var(--bs-accordion-btn-icon-transform)}:host ::ng-deep .accordion-button:after{flex-shrink:0;width:var(--bs-accordion-btn-icon-width);height:var(--bs-accordion-btn-icon-width);margin-left:auto;content:\"\";background-image:var(--bs-accordion-btn-icon);background-repeat:no-repeat;background-size:var(--bs-accordion-btn-icon-width);transition:var(--bs-accordion-btn-icon-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .accordion-button:after{transition:none}}:host ::ng-deep .accordion-button:hover{z-index:2}:host ::ng-deep .accordion-button:focus{z-index:3;border-color:var(--bs-accordion-btn-focus-border-color);outline:0;box-shadow:var(--bs-accordion-btn-focus-box-shadow)}:host ::ng-deep .accordion-header{margin-bottom:0}:host ::ng-deep .accordion-item{color:var(--bs-accordion-color);background-color:var(--bs-accordion-bg);border:var(--bs-accordion-border-width) solid var(--bs-accordion-border-color)}:host ::ng-deep .accordion-item:first-of-type{border-top-left-radius:var(--bs-accordion-border-radius);border-top-right-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-item:first-of-type .accordion-button{border-top-left-radius:var(--bs-accordion-inner-border-radius);border-top-right-radius:var(--bs-accordion-inner-border-radius)}:host ::ng-deep .accordion-item:not(:first-of-type){border-top:0}:host ::ng-deep .accordion-item:last-of-type{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-item:last-of-type .accordion-button.collapsed{border-bottom-right-radius:var(--bs-accordion-inner-border-radius);border-bottom-left-radius:var(--bs-accordion-inner-border-radius)}:host ::ng-deep .accordion-item:last-of-type .accordion-collapse{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-body{padding:var(--bs-accordion-body-padding-y) var(--bs-accordion-body-padding-x)}:host ::ng-deep .accordion-flush .accordion-collapse{border-width:0}:host ::ng-deep .accordion-flush .accordion-item{border-right:0;border-left:0;border-radius:0}:host ::ng-deep .accordion-flush .accordion-item:first-child{border-top:0}:host ::ng-deep .accordion-flush .accordion-item:last-child{border-bottom:0}:host ::ng-deep .accordion-flush .accordion-item .accordion-button,:host ::ng-deep .accordion-flush .accordion-item .accordion-button.collapsed{border-radius:0}:host ::ng-deep bs-accordion{margin:-1px}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-accordion', template: "<div class=\"accordion\">\n    <ng-content></ng-content>\n</div>", styles: [":host ::ng-deep .accordion{--bs-accordion-color: #212529;--bs-accordion-bg: #fff;--bs-accordion-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out, border-radius .15s ease;--bs-accordion-border-color: var(--bs-border-color);--bs-accordion-border-width: 1px;--bs-accordion-border-radius: .375rem;--bs-accordion-inner-border-radius:calc(.375rem - 1px);--bs-accordion-btn-padding-x: 1.25rem;--bs-accordion-btn-padding-y: 1rem;--bs-accordion-btn-color: #212529;--bs-accordion-btn-bg: var(--bs-accordion-bg);--bs-accordion-btn-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");--bs-accordion-btn-icon-width: 1.25rem;--bs-accordion-btn-icon-transform: rotate(-180deg);--bs-accordion-btn-icon-transition: transform .2s ease-in-out;--bs-accordion-btn-active-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");--bs-accordion-btn-focus-border-color: #86b7fe;--bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);--bs-accordion-body-padding-x: 1.25rem;--bs-accordion-body-padding-y: 1rem;--bs-accordion-active-color: #0c63e4;--bs-accordion-active-bg: #e7f1ff}:host ::ng-deep .accordion-button{position:relative;display:flex;align-items:center;width:100%;padding:var(--bs-accordion-btn-padding-y) var(--bs-accordion-btn-padding-x);font-size:1rem;color:var(--bs-accordion-btn-color);text-align:left;background-color:var(--bs-accordion-btn-bg);border:0;border-radius:0;overflow-anchor:none;transition:var(--bs-accordion-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .accordion-button{transition:none}}:host ::ng-deep .accordion-button:not(.collapsed){color:var(--bs-accordion-active-color);background-color:var(--bs-accordion-active-bg);box-shadow:inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color)}:host ::ng-deep .accordion-button:not(.collapsed):after{background-image:var(--bs-accordion-btn-active-icon);transform:var(--bs-accordion-btn-icon-transform)}:host ::ng-deep .accordion-button:after{flex-shrink:0;width:var(--bs-accordion-btn-icon-width);height:var(--bs-accordion-btn-icon-width);margin-left:auto;content:\"\";background-image:var(--bs-accordion-btn-icon);background-repeat:no-repeat;background-size:var(--bs-accordion-btn-icon-width);transition:var(--bs-accordion-btn-icon-transition)}@media (prefers-reduced-motion: reduce){:host ::ng-deep .accordion-button:after{transition:none}}:host ::ng-deep .accordion-button:hover{z-index:2}:host ::ng-deep .accordion-button:focus{z-index:3;border-color:var(--bs-accordion-btn-focus-border-color);outline:0;box-shadow:var(--bs-accordion-btn-focus-box-shadow)}:host ::ng-deep .accordion-header{margin-bottom:0}:host ::ng-deep .accordion-item{color:var(--bs-accordion-color);background-color:var(--bs-accordion-bg);border:var(--bs-accordion-border-width) solid var(--bs-accordion-border-color)}:host ::ng-deep .accordion-item:first-of-type{border-top-left-radius:var(--bs-accordion-border-radius);border-top-right-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-item:first-of-type .accordion-button{border-top-left-radius:var(--bs-accordion-inner-border-radius);border-top-right-radius:var(--bs-accordion-inner-border-radius)}:host ::ng-deep .accordion-item:not(:first-of-type){border-top:0}:host ::ng-deep .accordion-item:last-of-type{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-item:last-of-type .accordion-button.collapsed{border-bottom-right-radius:var(--bs-accordion-inner-border-radius);border-bottom-left-radius:var(--bs-accordion-inner-border-radius)}:host ::ng-deep .accordion-item:last-of-type .accordion-collapse{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}:host ::ng-deep .accordion-body{padding:var(--bs-accordion-body-padding-y) var(--bs-accordion-body-padding-x)}:host ::ng-deep .accordion-flush .accordion-collapse{border-width:0}:host ::ng-deep .accordion-flush .accordion-item{border-right:0;border-left:0;border-radius:0}:host ::ng-deep .accordion-flush .accordion-item:first-child{border-top:0}:host ::ng-deep .accordion-flush .accordion-item:last-child{border-bottom:0}:host ::ng-deep .accordion-flush .accordion-item .accordion-button,:host ::ng-deep .accordion-flush .accordion-item .accordion-button.collapsed{border-radius:0}:host ::ng-deep bs-accordion{margin:-1px}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { tabPages: [{
                type: ContentChildren,
                args: [forwardRef(() => BsAccordionTabComponent)]
            }], highlightActiveTab: [{
                type: Input
            }] } });

class BsAccordionTabHeaderComponent {
    constructor(accordionTab) {
        this.accordionTab = accordionTab;
    }
    headerClicked(event) {
        event.preventDefault();
        this.accordionTab.isActive = !this.accordionTab.isActive;
    }
}
BsAccordionTabHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionTabHeaderComponent, deps: [{ token: BsAccordionTabComponent }], target: i0.ɵɵFactoryTarget.Component });
BsAccordionTabHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsAccordionTabHeaderComponent, selector: "bs-accordion-tab-header", ngImport: i0, template: "<!-- <input type=\"radio\" class=\"d-none\" [name]=\"accordionTab.accordion.accordionName$ | async\" [id]=\"accordionTab.accordionTabName$ | async\"> -->\n<h2 class=\"accordion-header cursor-pointer\" (click)=\"headerClicked($event)\">\n    <!-- [class.bg-transparent]=\"!accordionTab.isActive && accordionTab.accordion.highlightActiveTab\" -->\n    <label class=\"btn accordion-button\" [class.collapsed]=\"!accordionTab.isActive\" [class.bg-unset]=\"!accordionTab.accordion.highlightActiveTab\" [for]=\"accordionTab.accordionTabName$ | async\" type=\"button\">\n        <ng-content></ng-content>\n    </label>\n</h2>", styles: [".bg-unset{background:unset}\n"], dependencies: [{ kind: "pipe", type: i3.AsyncPipe, name: "async" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionTabHeaderComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-accordion-tab-header', template: "<!-- <input type=\"radio\" class=\"d-none\" [name]=\"accordionTab.accordion.accordionName$ | async\" [id]=\"accordionTab.accordionTabName$ | async\"> -->\n<h2 class=\"accordion-header cursor-pointer\" (click)=\"headerClicked($event)\">\n    <!-- [class.bg-transparent]=\"!accordionTab.isActive && accordionTab.accordion.highlightActiveTab\" -->\n    <label class=\"btn accordion-button\" [class.collapsed]=\"!accordionTab.isActive\" [class.bg-unset]=\"!accordionTab.accordion.highlightActiveTab\" [for]=\"accordionTab.accordionTabName$ | async\" type=\"button\">\n        <ng-content></ng-content>\n    </label>\n</h2>", styles: [".bg-unset{background:unset}\n"] }]
        }], ctorParameters: function () { return [{ type: BsAccordionTabComponent }]; } });

class BsAccordionModule {
}
BsAccordionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
BsAccordionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionModule, declarations: [BsAccordionComponent,
        BsAccordionTabComponent,
        BsAccordionTabHeaderComponent], imports: [CommonModule,
        BsNoNoscriptModule], exports: [BsAccordionComponent,
        BsAccordionTabComponent,
        BsAccordionTabHeaderComponent] });
BsAccordionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionModule, imports: [CommonModule,
        BsNoNoscriptModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsAccordionModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        BsAccordionComponent,
                        BsAccordionTabComponent,
                        BsAccordionTabHeaderComponent
                    ],
                    imports: [
                        CommonModule,
                        BsNoNoscriptModule
                    ],
                    exports: [
                        BsAccordionComponent,
                        BsAccordionTabComponent,
                        BsAccordionTabHeaderComponent
                    ]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { BsAccordionComponent, BsAccordionModule, BsAccordionTabComponent, BsAccordionTabHeaderComponent };
//# sourceMappingURL=mintplayer-ng-bootstrap-accordion.mjs.map
