// #region Imports
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Listen } from '../../../../events/Decorators/ListenDecorator';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Required } from '../../../Decorators/RequiredDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { epgMinimapElementTemplate } from './EpgMinimapElementTemplate';
import { epgMinimapElementJoyStyle } from './Themes/EpgMinimapElement.Joy';
// #endregion
/**
 * EPG Minimap - A compact overview panel for an Electronic Program Guide.
 *
 * @description
 * Renders a bird's-eye view of channel rows scaled to fit the visible viewport window.
 * Clicking on the minimap emits a `jumpToRow` event so the host EPG can scroll accordingly.
 *
 * @name EpgMinimapElement
 * @element mosaik-epg-minimap
 * @category Selectors
 *
 * @csspart marker - The marker part.
 * @csspart row ${i >= e.visibleStart && i <= e.visibleEnd ? 'in-view' : ''} - The row ${i >= e.visibleStart && i <= e.visibleEnd ? 'in-view' : ''} part.
 *
 * @cssprop {String} --epg-minimap-background-color - The minimap background color CSS custom property.
 * @cssprop {String} --epg-minimap-border-color - The minimap border color CSS custom property.
 * @cssprop {String} --epg-minimap-border-radius - The minimap border radius CSS custom property.
 * @cssprop {String} --epg-minimap-border-style - The minimap border style CSS custom property.
 * @cssprop {String} --epg-minimap-border-width - The minimap border width CSS custom property.
 * @cssprop {String} --epg-minimap-font-family - The minimap font family CSS custom property.
 * @cssprop {String} --epg-minimap-font-letter-spacing - The minimap font letter spacing CSS custom property.
 * @cssprop {String} --epg-minimap-font-line-height - The minimap font line height CSS custom property.
 * @cssprop {String} --epg-minimap-font-size - The minimap font size CSS custom property.
 * @cssprop {String} --epg-minimap-font-text-decoration - The minimap font text decoration CSS custom property.
 * @cssprop {String} --epg-minimap-font-text-transform - The minimap font text transform CSS custom property.
 * @cssprop {String} --epg-minimap-font-weight - The minimap font weight CSS custom property.
 * @cssprop {String} --epg-minimap-foreground-color - The minimap foreground color CSS custom property.
 * @cssprop {String} --epg-minimap-gap - The minimap gap CSS custom property.
 * @cssprop {String} --epg-minimap-padding-bottom - The minimap padding bottom CSS custom property.
 * @cssprop {String} --epg-minimap-padding-left - The minimap padding left CSS custom property.
 * @cssprop {String} --epg-minimap-padding-right - The minimap padding right CSS custom property.
 * @cssprop {String} --epg-minimap-padding-top - The minimap padding top CSS custom property.
 * @cssprop {String} --epg-minimap-shadow - The minimap shadow CSS custom property.
 * @cssprop {String} --epg-minimap-shadow-blur - The minimap shadow blur CSS custom property.
 * @cssprop {String} --epg-minimap-shadow-color - The minimap shadow color CSS custom property.
 * @cssprop {String} --epg-minimap-shadow-offset-x - The minimap shadow offset x CSS custom property.
 * @cssprop {String} --epg-minimap-shadow-offset-y - The minimap shadow offset y CSS custom property.
 * @cssprop {String} --epg-minimap-shadow-spread - The minimap shadow spread CSS custom property.
 * @cssprop {String} --epg-minimap-transition-duration - The minimap transition duration CSS custom property.
 * @cssprop {String} --epg-minimap-transition-mode - The minimap transition mode CSS custom property.
 * @cssprop {String} --epg-minimap-transition-property - The minimap transition property CSS custom property.
 * @cssprop {String} --epg-minimap-translate - The minimap translate CSS custom property.
 *
 * @example
 * ```html
 * <mosaik-epg-minimap lanes="10" visible-start="0" visible-end="5"></mosaik-epg-minimap>
 * ```
 *
 * @public
 */
let EpgMinimapElement = class EpgMinimapElement extends CustomElement {
    // #region Fields
    _lanes;
    _visibleStart;
    _visibleEnd;
    _channels;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._lanes = 0;
        this._visibleStart = 0;
        this._visibleEnd = 10;
        this._channels = [];
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-epg-minimap';
    }
    /**
     * Gets or sets the `lanes` property.
     *
     * @public
     * @attr
     */
    get lanes() {
        return this._lanes;
    }
    set lanes(value) {
        if (this._lanes !== value) {
            this._lanes = value;
            this.requestUpdate('lanes');
        }
    }
    /**
     * Gets or sets the `visibleStart` property.
     *
     * @public
     * @attr
     */
    get visibleStart() {
        return this._visibleStart;
    }
    set visibleStart(value) {
        if (this._visibleStart !== value) {
            this._visibleStart = value;
            this.requestUpdate('visibleStart');
        }
    }
    /**
     * Gets or sets the `visibleEnd` property.
     *
     * @public
     * @attr
     */
    get visibleEnd() {
        return this._visibleEnd;
    }
    set visibleEnd(value) {
        if (this._visibleEnd !== value) {
            this._visibleEnd = value;
            this.requestUpdate('visibleEnd');
        }
    }
    /**
     * Gets or sets the `channels` property.
     *
     * @public
     */
    get channels() {
        return this._channels;
    }
    set channels(value) {
        if (this._channels !== value) {
            this._channels = value;
            this.requestUpdate('channels');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onClick(e) {
        const y = e.offsetY;
        const row = Math.floor(y / 4);
        this.dispatchEvent(new CustomEvent('jumpToRow', {
            detail: row,
            bubbles: true,
            composed: true
        }));
    }
};
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], EpgMinimapElement.prototype, "lanes", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], EpgMinimapElement.prototype, "visibleStart", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], EpgMinimapElement.prototype, "visibleEnd", null);
__decorate([
    Required(),
    Property({ type: (Array) }),
    __metadata("design:type", Array),
    __metadata("design:paramtypes", [Array])
], EpgMinimapElement.prototype, "channels", null);
__decorate([
    Listen('click'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [MouseEvent]),
    __metadata("design:returntype", void 0)
], EpgMinimapElement.prototype, "onClick", null);
EpgMinimapElement = __decorate([
    Component({
        selector: 'mosaik-epg-minimap',
        template: epgMinimapElementTemplate,
        styles: epgMinimapElementJoyStyle,
        imports: []
    }),
    __metadata("design:paramtypes", [])
], EpgMinimapElement);
export { EpgMinimapElement };
//# sourceMappingURL=EpgMinimapElement.js.map