// #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 { 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 { tourAnchorElementCosmopolitanStyle } from './Themes/TourAnchorElement.Cosmopolitan';
import { tourAnchorElementJoyStyle } from './Themes/TourAnchorElement.Joy';
import { tourAnchorElementMemphisStyle } from './Themes/TourAnchorElement.Memphis';
import { tourAnchorElementTemplate } from './TourAnchorElementTemplate';
import { addTourRegistryController } from './TourRegistryController';
// #endregion
/**
 * TourAnchor - A marker element that registers a target for guided tour steps.
 *
 * @description
 * Place this element around any UI element you want to highlight during a tour.
 * Associate it with a tour via `tour-id` and identify it for steps via `anchor-id`.
 *
 * @name TourAnchor
 * @element mosaik-tour-anchor
 * @category Overlays
 *
 * @slot - Content that should be associated with the anchor.
 *
 * @cssprop {String} --tour-anchor-display - The anchor display CSS custom property.
 * @cssprop {String} --tour-anchor-font-family - The anchor font family CSS custom property.
 * @cssprop {String} --tour-anchor-font-letter-spacing - The anchor font letter spacing CSS custom property.
 * @cssprop {String} --tour-anchor-font-line-height - The anchor font line height CSS custom property.
 * @cssprop {String} --tour-anchor-font-size - The anchor font size CSS custom property.
 * @cssprop {String} --tour-anchor-font-text-decoration - The anchor font text decoration CSS custom property.
 * @cssprop {String} --tour-anchor-font-text-transform - The anchor font text transform CSS custom property.
 * @cssprop {String} --tour-anchor-font-weight - The anchor font weight CSS custom property.
 * @cssprop {String} --tour-anchor-gap - The anchor gap CSS custom property.
 * @cssprop {String} --tour-anchor-padding-bottom - The anchor padding bottom CSS custom property.
 * @cssprop {String} --tour-anchor-padding-left - The anchor padding left CSS custom property.
 * @cssprop {String} --tour-anchor-padding-right - The anchor padding right CSS custom property.
 * @cssprop {String} --tour-anchor-padding-top - The anchor padding top CSS custom property.
 * @cssprop {String} --tour-anchor-position - The anchor position CSS custom property.
 * @cssprop {String} --tour-anchor-shadow - The anchor shadow CSS custom property.
 * @cssprop {String} --tour-anchor-shadow-blur - The anchor shadow blur CSS custom property.
 * @cssprop {String} --tour-anchor-shadow-color - The anchor shadow color CSS custom property.
 * @cssprop {String} --tour-anchor-shadow-offset-x - The anchor shadow offset x CSS custom property.
 * @cssprop {String} --tour-anchor-shadow-offset-y - The anchor shadow offset y CSS custom property.
 * @cssprop {String} --tour-anchor-shadow-spread - The anchor shadow spread CSS custom property.
 * @cssprop {String} --tour-anchor-transition-duration - The anchor transition duration CSS custom property.
 * @cssprop {String} --tour-anchor-transition-mode - The anchor transition mode CSS custom property.
 * @cssprop {String} --tour-anchor-transition-property - The anchor transition property CSS custom property.
 * @cssprop {String} --tour-anchor-translate - The anchor translate CSS custom property.
 *
 * @example
 * Anchor wrapping a button for tour step "step-1":
 * ```html
 * <mosaik-tour-anchor tour-id="onboarding" anchor-id="step-1">
 *   <mosaik-button variant="primary"><span slot="label">Get Started</span></mosaik-button>
 * </mosaik-tour-anchor>
 * ```
 *
 * @example
 * Anchor wrapping a navigation item:
 * ```html
 * <mosaik-tour-anchor tour-id="onboarding" anchor-id="nav-home">
 *   <a href="/home">Home</a>
 * </mosaik-tour-anchor>
 * ```
 *
 * @public
 */
let TourAnchorElement = class TourAnchorElement extends Themeable(CustomElement) {
    // #region Fields
    _registryController;
    _tourId;
    _anchorId;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._tourId = 'default';
        this._anchorId = '';
        this._registryController = addTourRegistryController(this, {
            getTourId: () => this.tourId,
            getAnchorId: () => this.anchorId
        });
    }
    // #endregion
    // #region Properties
    /**
     * Gets or sets the `tourId` property.
     *
     * @public
     * @attr
     */
    get tourId() {
        return this._tourId;
    }
    set tourId(value) {
        if (this.tourId !== value) {
            this._tourId = value || 'default';
            this.requestUpdate('tourId');
        }
    }
    /**
     * Gets or sets the `anchorId` property.
     *
     * @public
     * @attr
     */
    get anchorId() {
        return this._anchorId;
    }
    set anchorId(value) {
        if (this.anchorId !== value) {
            this._anchorId = value;
            this.requestUpdate('anchorId');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onAnchorIdChanged(previousValue, nextValue) {
        if (previousValue === nextValue) {
            return;
        }
        this._registryController.updateRegistration(this.tourId, previousValue);
    }
    /**
     * @protected
     */
    onTourIdChanged(previousValue, nextValue) {
        if (previousValue === nextValue) {
            return;
        }
        this._registryController.updateRegistration(previousValue, this.anchorId);
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TourAnchorElement.prototype, "tourId", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TourAnchorElement.prototype, "anchorId", null);
__decorate([
    Watch('anchorId', { waitUntilFirstUpdate: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], TourAnchorElement.prototype, "onAnchorIdChanged", null);
__decorate([
    Watch('tourId', { waitUntilFirstUpdate: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], TourAnchorElement.prototype, "onTourIdChanged", null);
TourAnchorElement = __decorate([
    Component({
        selector: 'mosaik-tour-anchor',
        template: tourAnchorElementTemplate,
        themes: {
            joy: tourAnchorElementJoyStyle,
            memphis: tourAnchorElementMemphisStyle,
            cosmopolitan: tourAnchorElementCosmopolitanStyle
        }
    }),
    __metadata("design:paramtypes", [])
], TourAnchorElement);
export { TourAnchorElement };
//# sourceMappingURL=TourAnchorElement.js.map