var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { consume } from '@lit/context';
import { LitElement, html } from 'lit';
import { property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
import { carouselContext } from '../common/context.js';
import { registerComponent } from '../common/definitions/register.js';
import { formatString } from '../common/util.js';
import { styles } from './themes/carousel-indicator.base.css.js';
class IgcCarouselIndicatorComponent extends LitElement {
    static register() {
        registerComponent(IgcCarouselIndicatorComponent);
    }
    get _labelFormat() {
        return this._carousel ? this._carousel.indicatorsLabelFormat : '';
    }
    set active(value) {
        this._active = Boolean(value);
        this.tabIndex = this._active ? 0 : -1;
        this._internals.ariaSelected = this._active.toString();
    }
    get active() {
        return this._active;
    }
    constructor() {
        super();
        this._active = false;
        this.index = 0;
        this._internals = this.attachInternals();
        this._internals.role = 'tab';
    }
    connectedCallback() {
        super.connectedCallback();
        this.role = 'tab';
        this.slot = this.slot || 'indicator';
    }
    willUpdate() {
        this._internals.ariaLabel = formatString(this._labelFormat, this.index + 1);
    }
    render() {
        const forward = this.active ? 'visible' : 'hidden';
        const backward = this.active ? 'hidden' : 'visible';
        return html `
      <div
        part="indicator inactive"
        style=${styleMap({ visibility: backward })}
      >
        <slot></slot>
      </div>
      <div part="indicator active" style=${styleMap({ visibility: forward })}>
        <slot name="active"></slot>
      </div>
    `;
    }
}
IgcCarouselIndicatorComponent.tagName = 'igc-carousel-indicator';
IgcCarouselIndicatorComponent.styles = styles;
export default IgcCarouselIndicatorComponent;
__decorate([
    consume({ context: carouselContext, subscribe: true })
], IgcCarouselIndicatorComponent.prototype, "_carousel", void 0);
__decorate([
    property({ attribute: false })
], IgcCarouselIndicatorComponent.prototype, "active", null);
__decorate([
    property({ attribute: false })
], IgcCarouselIndicatorComponent.prototype, "index", void 0);
//# sourceMappingURL=carousel-indicator.js.map