/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { customElement, attachShadowTemplate, coerceBoolean, coerceNumber, coreProperty } from '@tylertech/forge-core';
import { ProfileCardAdapter } from './profile-card-adapter';
import { ProfileCardCore } from './profile-card-core';
import { PROFILE_CARD_CONSTANTS } from './profile-card-constants';
import { ButtonComponent } from '../button';
import { AvatarComponent } from '../avatar';
import { IconComponent } from '../icon/icon';
import { ToolbarComponent } from '../toolbar';
import { BaseComponent } from '../core/base/base-component';
const template = '<template><div class=\"forge-profile-card\" part=\"root\"><div class=\"info-container\"><div class=\"avatar\"><forge-avatar part=\"avatar\"></forge-avatar></div><div class=\"info-text\"><div class=\"full-name\" part=\"name\"></div><div class=\"email\" part=\"email\"></div></div></div><slot></slot><forge-toolbar inverted id=\"action-toolbar\"><forge-button variant=\"outlined\" slot=\"end\" style=\"display: none\" part=\"profile-button\" id=\"profile-button\">Profile</forge-button><forge-button slot=\"end\" part=\"sign-out-button\" id=\"sign-out-button\">Sign out</forge-button></forge-toolbar></div></template>';
const styles = ':host{display:block}:host([hidden]){display:none}.forge-profile-card{--_profile-card-min-width:var(--forge-profile-card-min-width, 360px);--_profile-card-shape:var(--forge-profile-card-shape, var(--forge-shape-medium, 4px));--_profile-card-avatar-size:var(--forge-profile-card-avatar-size, 56px)}.forge-profile-card{min-width:var(--_profile-card-min-width);border-radius:var(--_profile-card-shape)}@media (max-width:399px){.forge-profile-card{width:100vw;min-width:unset;overflow:auto}}.forge-profile-card .info-container{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding-block:var(--forge-spacing-xsmall,8px);padding-inline:var(--forge-spacing-medium,16px)}.forge-profile-card .avatar{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding:var(--forge-spacing-xsmall,8px);-webkit-margin-end:var(--forge-spacing-medium,16px);margin-inline-end:var(--forge-spacing-medium,16px);--forge-avatar-size:var(--_profile-card-avatar-size)}.forge-profile-card .text{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.forge-profile-card .full-name{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-heading2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-heading2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading2-font-size-scale, 1)));font-weight:var(--forge-typography-heading2-font-weight,500);line-height:var(--forge-typography-heading2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-heading2-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-heading2-letter-spacing, .0125em);text-transform:var(--forge-typography-heading2-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-heading2-text-decoration,inherit);text-decoration:var(--forge-typography-heading2-text-decoration,inherit)}.forge-profile-card .email{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-subheading1-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-subheading1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-subheading1-font-size-scale, .875)));font-weight:var(--forge-typography-subheading1-font-weight,400);line-height:var(--forge-typography-subheading1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-subheading1-line-height-scale, 1.125)));letter-spacing:var(--forge-typography-subheading1-letter-spacing, normal);text-transform:var(--forge-typography-subheading1-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-subheading1-text-decoration,inherit);text-decoration:var(--forge-typography-subheading1-text-decoration,inherit);color:var(--forge-theme-text-medium,rgba(0,0,0,.6))}#action-toolbar{--forge-toolbar-padding:8px}#action-toolbar forge-button:not(:last-of-type){-webkit-margin-end:8px;margin-inline-end:8px}';
/**
 * @tag forge-profile-card
 */
let ProfileCardComponent = class ProfileCardComponent extends BaseComponent {
    static get observedAttributes() {
        return [
            PROFILE_CARD_CONSTANTS.attributes.FULL_NAME,
            PROFILE_CARD_CONSTANTS.attributes.EMAIL,
            PROFILE_CARD_CONSTANTS.attributes.SIGN_OUT,
            PROFILE_CARD_CONSTANTS.attributes.PROFILE,
            PROFILE_CARD_CONSTANTS.attributes.SIGN_OUT_TEXT,
            PROFILE_CARD_CONSTANTS.attributes.PROFILE_TEXT,
            PROFILE_CARD_CONSTANTS.attributes.AVATAR_TEXT,
            PROFILE_CARD_CONSTANTS.attributes.AVATAR_ICON,
            PROFILE_CARD_CONSTANTS.attributes.AVATAR_IMAGE_URL,
            PROFILE_CARD_CONSTANTS.attributes.AVATAR_LETTER_COUNT
        ];
    }
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._core = new ProfileCardCore(new ProfileCardAdapter(this));
    }
    connectedCallback() {
        this._core.initialize();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case PROFILE_CARD_CONSTANTS.attributes.FULL_NAME:
                this.fullName = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.EMAIL:
                this.email = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.SIGN_OUT:
                this.signOut = coerceBoolean(newValue);
                break;
            case PROFILE_CARD_CONSTANTS.attributes.PROFILE:
                this.profile = coerceBoolean(newValue);
                break;
            case PROFILE_CARD_CONSTANTS.attributes.SIGN_OUT_TEXT:
                this.signOutText = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.PROFILE_TEXT:
                this.profileText = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.AVATAR_TEXT:
                this.avatarText = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.AVATAR_ICON:
                this.avatarIcon = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.AVATAR_IMAGE_URL:
                this.avatarImageUrl = newValue;
                break;
            case PROFILE_CARD_CONSTANTS.attributes.AVATAR_LETTER_COUNT:
                this.avatarLetterCount = coerceNumber(newValue);
                break;
        }
    }
    focus(options) {
        this._core.focus(options);
    }
};
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "fullName", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "email", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "signOut", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "profile", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "signOutText", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "profileText", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "avatarText", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "avatarIcon", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "avatarImageUrl", void 0);
__decorate([
    coreProperty()
], ProfileCardComponent.prototype, "avatarLetterCount", void 0);
ProfileCardComponent = __decorate([
    customElement({
        name: PROFILE_CARD_CONSTANTS.elementName,
        dependencies: [ToolbarComponent, ButtonComponent, IconComponent, AvatarComponent]
    })
], ProfileCardComponent);
export { ProfileCardComponent };
