/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { __decorate } from "tslib";
import { attachShadowTemplate, coerceBoolean, CustomElement, FoundationProperty } from '@tylertech/forge-core';
import { BaseComponent } from '../core/base/base-component';
import { BadgeAdapter } from './badge-adapter';
import { BADGE_CONSTANTS } from './badge-constants';
import { BadgeFoundation } from './badge-foundation';
const template = '<template><div class=\"forge-badge forge-badge--open\" part=\"root\"><slot name=\"leading\"></slot><div class=\"forge-badge__content\"><slot></slot></div><slot name=\"trailing\"></slot></div></template>';
const styles = '.forge-badge{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);height:1.25rem;height:var(--forge-badge-height,1.25rem);line-height:1.25rem;line-height:var(--forge-badge-line-height, 1.25rem);min-width:0;min-width:var(--forge-badge-min-width,0);max-width:auto;max-width:var(--forge-badge-max-width,auto);border:none;border:var(--forge-badge-border,none);display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;gap:4px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;-webkit-transform:scale(0);transform:scale(0);pointer-events:none;border-radius:16px;padding:0 8px;font-weight:700}.forge-badge__content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.forge-badge--elevated{-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)}.forge-badge--open{-webkit-transform:scale(1);transform:scale(1)}.forge-badge--dot{height:.5rem;width:.5rem;min-width:auto;padding:0}:host{--forge-icon-font-size:14px;display:-webkit-box;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box}:host([hidden]){display:none}:host([positioned]){position:absolute;top:0;left:100%;-webkit-transform:translateX(-1.25rem);transform:translateX(-1.25rem)}:host([dot]){top:.5rem}:host([dot]) .forge-badge>slot{display:none}:host([static]){position:static}:host(:not([theme])) .forge-badge,:host([theme=\"\"]) .forge-badge{background:#ffc107;background:var(--forge-badge-theme-default-muted-background,#ffc107);color:rgba(0,0,0,.87);color:var(--forge-badge-theme-default-muted-color,rgba(0,0,0,.87))}:host(:not([theme])[strong]) .forge-badge,:host([theme=\"\"][strong]) .forge-badge{background:#3d5afe;background:var(--forge-badge-theme-default-strong-background,#3d5afe);color:#fff;color:var(--forge-badge-theme-default-strong-color,#fff)}:host([theme=default]) .forge-badge{background:#ffc107;background:var(--forge-badge-theme-default-muted-background,#ffc107);color:rgba(0,0,0,.87);color:var(--forge-badge-theme-default-muted-color,rgba(0,0,0,.87))}:host([theme=default][strong]) .forge-badge{background:#3d5afe;background:var(--forge-badge-theme-default-strong-background,#3d5afe);color:#fff;color:var(--forge-badge-theme-default-strong-color,#fff)}:host([theme=danger]) .forge-badge{background:#ffcdd2;background:var(--forge-badge-theme-danger-muted-background,#ffcdd2);color:#a22d0e;color:var(--forge-badge-theme-danger-muted-color,#a22d0e)}:host([theme=danger][strong]) .forge-badge{background:#b00020;background:var(--forge-badge-theme-danger-strong-background,#b00020);color:#fff;color:var(--forge-badge-theme-danger-strong-color,#fff)}:host([theme=warning]) .forge-badge{background:#ffdba6;background:var(--forge-badge-theme-warning-muted-background,#ffdba6);color:#a03a03;color:var(--forge-badge-theme-warning-muted-color,#a03a03)}:host([theme=warning][strong]) .forge-badge{background:#d14900;background:var(--forge-badge-theme-warning-strong-background,#d14900);color:#fff;color:var(--forge-badge-theme-warning-strong-color,#fff)}:host([theme=success]) .forge-badge{background:#a5d6a7;background:var(--forge-badge-theme-success-muted-background,#a5d6a7);color:#1b5e20;color:var(--forge-badge-theme-success-muted-color,#1b5e20)}:host([theme=success][strong]) .forge-badge{background:#2e7d32;background:var(--forge-badge-theme-success-strong-background,#2e7d32);color:#fff;color:var(--forge-badge-theme-success-strong-color,#fff)}:host([theme=info-primary]) .forge-badge{background:#bbdefb;background:var(--forge-badge-theme-info-primary-muted-background,#bbdefb);color:#1a237e;color:var(--forge-badge-theme-info-primary-muted-color,#1a237e)}:host([theme=info-primary][strong]) .forge-badge{background:#1a237e;background:var(--forge-badge-theme-info-primary-strong-background,#1a237e);color:#fff;color:var(--forge-badge-theme-info-primary-strong-color,#fff)}:host([theme=info-secondary]) .forge-badge{background:#e0e0e0;background:var(--forge-badge-theme-info-secondary-muted-background,#e0e0e0);color:#000;color:var(--forge-badge-theme-info-secondary-muted-color,#000)}:host([theme=info-secondary][strong]) .forge-badge{background:#000;background:var(--forge-badge-theme-info-secondary-strong-background,#000);color:#fff;color:var(--forge-badge-theme-info-secondary-strong-color,#fff)}';
/**
 * The web component class behind the `<forge-badge>` custom element.
 *
 * @tag forge-badge
 */
let BadgeComponent = class BadgeComponent extends BaseComponent {
    constructor() {
        super();
        attachShadowTemplate(this, template, styles);
        this._foundation = new BadgeFoundation(new BadgeAdapter(this));
    }
    static get observedAttributes() {
        return [
            BADGE_CONSTANTS.attributes.DOT,
            BADGE_CONSTANTS.attributes.OPEN
        ];
    }
    connectedCallback() {
        this._foundation.initialize();
    }
    attributeChangedCallback(name, oldValue, newValue) {
        switch (name) {
            case BADGE_CONSTANTS.attributes.DOT:
                this.dot = coerceBoolean(newValue);
                break;
            case BADGE_CONSTANTS.attributes.OPEN:
                this.open = coerceBoolean(newValue);
                break;
        }
    }
};
__decorate([
    FoundationProperty()
], BadgeComponent.prototype, "dot", void 0);
__decorate([
    FoundationProperty()
], BadgeComponent.prototype, "open", void 0);
BadgeComponent = __decorate([
    CustomElement({
        name: BADGE_CONSTANTS.elementName
    })
], BadgeComponent);
export { BadgeComponent };
