// #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 { RendererServiceLocator } from '../../../../Dom/Renderer';
import { Themeable } from '../../../Behaviors/Themeable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { ISchedulerNowIndicatorElementProps } from './ISchedulerNowIndicatorElementProps';
import { schedulerNowIndicatorElementTemplate } from './SchedulerNowIndicatorElementTemplate';
import { schedulerNowIndicatorElementCosmopolitanStyle } from './Themes/SchedulerNowIndicatorElement.Cosmopolitan';
import { schedulerNowIndicatorElementJoyStyle } from './Themes/SchedulerNowIndicatorElement.Joy';
import { schedulerNowIndicatorElementMemphisStyle } from './Themes/SchedulerNowIndicatorElement.Memphis';
// #endregion
/**
 * Scheduler Now Indicator - A real-time visual indicator showing the current time position in scheduler views.
 *
 * @description
 * The Scheduler Now Indicator component displays a horizontal line and dot marker that
 * dynamically positions itself to show the current time within scheduler and timeline views.
 * The indicator automatically updates its position based on the percentage of elapsed time,
 * creating a live reference point for users viewing scheduled events. It includes smooth
 * transitions when repositioning and can be shown or hidden based on whether the current
 * time falls within the visible scheduler range. The component is designed for internal
 * use within scheduler components and provides clear visual feedback of the present moment.
 *
 * @name Scheduler Now Indicator
 * @element mosaik-scheduler-now-indicator
 * @category Inputs
 *
 * @csspart line - The horizontal indicator line spanning across the scheduler
 * @csspart dot - The circular marker positioned at the start of the indicator line
 *
 * @cssprop {String} --scheduler-now-indicator-color - The color of both the indicator line and dot
 * @cssprop {String} --scheduler-now-indicator-dot-size - The diameter of the circular dot marker
 * @cssprop {String} --scheduler-now-indicator-line-height - The thickness of the horizontal line
 * @cssprop {String} --scheduler-now-indicator-transition-duration - The duration of position transitions
 * @cssprop {String} --scheduler-now-indicator-transition-mode - The timing function for transitions
 * @cssprop {String} --scheduler-now-indicator-transition-property - The CSS properties to transition
 *
 * @example
 * Scheduler with now indicator (internal usage):
 * ```html
 * <mosaik-scheduler>
 *   <!-- Now indicator automatically rendered and positioned -->
 *   <mosaik-scheduler-now-indicator top="35.5" visible></mosaik-scheduler-now-indicator>
 * </mosaik-scheduler>
 * ```
 *
 * @example
 * Programmatic control of indicator position:
 * ```typescript
 * const indicator = document.querySelector('mosaik-scheduler-now-indicator');
 *
 * // Update position based on current time calculation
 * const percentageOfDay = (currentHour * 60 + currentMinute) / (24 * 60) * 100;
 * indicator.top = percentageOfDay;
 * indicator.visible = isCurrentDateInView;
 * ```
 *
 * @example
 * Hidden indicator (outside visible range):
 * ```html
 * <mosaik-scheduler-now-indicator top="0" visible="false"></mosaik-scheduler-now-indicator>
 * ```
 *
 * @internal
 */
let SchedulerNowIndicatorElement = class SchedulerNowIndicatorElement extends Themeable(CustomElement) {
    // #region Fields
    _top;
    _visible;
    // #endregion
    // #region Ctor
    constructor() {
        super();
        this._top = ISchedulerNowIndicatorElementProps.DEFAULTS.top;
        this._visible = ISchedulerNowIndicatorElementProps.DEFAULTS.visible;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-scheduler-now-indicator';
    }
    /**
     * Gets or sets the top position as percentage.
     *
     * @internal
     */
    get top() {
        return this._top;
    }
    set top(value) {
        if (this._top !== value) {
            this._top = value;
            this.requestUpdate('top');
        }
    }
    /**
     * Gets or sets whether the indicator is visible.
     *
     * @internal
     */
    get visible() {
        return this._visible;
    }
    set visible(value) {
        if (this._visible !== value) {
            this._visible = value;
            this.requestUpdate('visible');
        }
    }
    // #endregion
    // #region Methods
    onTopChanged(prev, next) {
        RendererServiceLocator.current.setStyle(this, 'top', `${next ?? 0}%`);
    }
    onVisibleChanged(prev, next) {
        if (next) {
            RendererServiceLocator.current.removeAttribute(this, 'hidden');
        }
        else {
            RendererServiceLocator.current.setAttribute(this, 'hidden', '');
        }
    }
};
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], SchedulerNowIndicatorElement.prototype, "top", null);
__decorate([
    Attribute({ type: Boolean }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], SchedulerNowIndicatorElement.prototype, "visible", null);
__decorate([
    Watch('top'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], SchedulerNowIndicatorElement.prototype, "onTopChanged", null);
__decorate([
    Watch('visible'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], SchedulerNowIndicatorElement.prototype, "onVisibleChanged", null);
SchedulerNowIndicatorElement = __decorate([
    Component({
        selector: 'mosaik-scheduler-now-indicator',
        template: schedulerNowIndicatorElementTemplate,
        themes: {
            joy: schedulerNowIndicatorElementJoyStyle,
            cosmopolitan: schedulerNowIndicatorElementCosmopolitanStyle,
            memphis: schedulerNowIndicatorElementMemphisStyle
        }
    }),
    __metadata("design:paramtypes", [])
], SchedulerNowIndicatorElement);
export { SchedulerNowIndicatorElement };
//# sourceMappingURL=SchedulerNowIndicatorElement.js.map